### DO NOT EDIT THIS FILE. ###
./beg.php:196: // @TODO Opps, what is missing here???
./inc/extensions/ext-sql_patches.php:705: // @TODO Rewrite this to a filter!
-./inc/extensions/ext-sql_patches.php:743: // @TODO Can we remove this? setConfigEntry('verbose_sql' , "N");
+./inc/extensions/ext-sql_patches.php:743: // @TODO Can we remove this? setConfigEntry('verbose_sql' , 'N');
./inc/extensions/ext-sql_patches.php:93: /* @TODO SQL_ALTER_TABLE() should work now properly
+./inc/extensions/ext-surfbar.php:237: // @TODO Set some constants we need???
./inc/extensions.php:343:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
./inc/extensions.php:419: // @TODO Extension is loaded, what next?
-./inc/functions.php:1239: // @TODO Rewrite this unnice code
-./inc/functions.php:1300: // @TODO Remove this if() block if all is working fine
-./inc/functions.php:1600: // @TODO This can be, somehow, rewritten
-./inc/functions.php:2328:// @TODO Rewrite all language constants to this function.
-./inc/functions.php:249: // @TODO Fine all templates which are using these direct variables and rewrite them.
-./inc/functions.php:250: // @TODO After this step is done, this else-block is history
-./inc/functions.php:2575: $GLOBALS['cache_instance']->destroyCacheFile(); // @TODO isn't it better to do $GLOBALS['cache_instance']->destroyCacheFile('revision')?
-./inc/functions.php:2577: // @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')?
-./inc/functions.php:2649: searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time);
-./inc/functions.php:2761: // @TODO Add a little more infos here
-./inc/functions.php:2772: // @TODO This cannot be rewritten to app_die(), try to find a solution for this.
-./inc/functions.php:2869:// @TODO Implement $compress
-./inc/functions.php:2876:// @TODO Implement $decompress
-./inc/functions.php:2987:// @TODO Rewrite this function to use READ_FILE() and WRITE_FILE()
-./inc/functions.php:465:// @TODO Rewrite this to an extension 'smtp'
+./inc/functions.php:1277: // @TODO Rewrite this unnice code
+./inc/functions.php:1338: // @TODO Remove this if() block if all is working fine
+./inc/functions.php:1638: // @TODO This can be, somehow, rewritten
+./inc/functions.php:1991: // @TODO eregi() should be rewritten here
+./inc/functions.php:2367:// @TODO Rewrite all language constants to this function.
+./inc/functions.php:248: // @TODO Fine all templates which are using these direct variables and rewrite them.
+./inc/functions.php:249: // @TODO After this step is done, this else-block is history
+./inc/functions.php:2614: $GLOBALS['cache_instance']->destroyCacheFile(); // @TODO isn't it better to do $GLOBALS['cache_instance']->destroyCacheFile('revision')?
+./inc/functions.php:2616: // @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')?
+./inc/functions.php:2677:// @TODO Please describe this function
+./inc/functions.php:2689: searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time);
+./inc/functions.php:2801: // @TODO Add a little more infos here
+./inc/functions.php:2812: // @TODO This cannot be rewritten to app_die(), try to find a solution for this.
+./inc/functions.php:2909:// @TODO Implement $compress
+./inc/functions.php:2916:// @TODO Implement $decompress
+./inc/functions.php:3027:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./inc/functions.php:464:// @TODO Rewrite this to an extension 'smtp'
./inc/language/de.php:1156:// @TODO Rewrite these two constants
./inc/language/de.php:1172:// @TODO Rewrite these five constants
./inc/language/de.php:756:// @TODO The template 'admin_extensions_installed' is using this. But the template is no longer used.
./inc/libs/rallye_functions.php:661: // @TODO Rewrite this to a function
./inc/libs/rallye_functions.php:697: // @TODO Rewrite this to our API function
./inc/libs/register_functions.php:53: // @TODO Rewrite these constants
-./inc/libs/surfbar_functions.php:1425: // @TODO This can be somehow rewritten
-./inc/libs/surfbar_functions.php:915: // @TODO Invalid salt should be refused
+./inc/libs/register_functions.php:62: // @TODO Rewrite these constants, too
+./inc/libs/surfbar_functions.php:1469: // @TODO This can be somehow rewritten
+./inc/libs/surfbar_functions.php:942: // @TODO Invalid salt should be refused
./inc/libs/task_functions.php:261: // @TODO These can be rewritten to filter
./inc/libs/task_functions.php:53:// @TODO Move all extension-dependent queries into filters
./inc/libs/user_functions.php:317: // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
./inc/load_extensions.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php *
./inc/mails/birthday_mails.php:85: // @TODO 4 is hard-coded here, should we move it out in config?
./inc/modules/admin/admin-inc.php:343: // @TODO Rewrite this to $content = SQL_FETCHARRAY()
-./inc/modules/admin/admin-inc.php:394: // @TODO Rewrite this to $content = SQL_FETCHARRAY()
-./inc/modules/admin/admin-inc.php:508: // @TODO Rewrite these both constants
-./inc/modules/admin/admin-inc.php:534: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY(). Please look some lines above for the dynamic query
-./inc/modules/admin/overview-inc.php:226: // @TODO Rewrite this to something with include files
-./inc/modules/admin/overview-inc.php:265: // @TODO This may also be rewritten to include files
-./inc/modules/admin/overview-inc.php:268: default: // @TODO Unknown support mode
-./inc/modules/admin/overview-inc.php:414: // @TODO Rewritings: admin->assigned_admin,uid->userid,type->task_type_msg in template
+./inc/modules/admin/admin-inc.php:390: // @TODO Rewrite this to $content = SQL_FETCHARRAY()
+./inc/modules/admin/admin-inc.php:504: // @TODO Rewrite these both constants
+./inc/modules/admin/admin-inc.php:530: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY(). Please look some lines above for the dynamic query
+./inc/modules/admin/overview-inc.php:143: // @TODO Rewrite this to a filter
+./inc/modules/admin/overview-inc.php:230: // @TODO Rewrite this to something with include files
+./inc/modules/admin/overview-inc.php:269: // @TODO This may also be rewritten to include files
+./inc/modules/admin/overview-inc.php:272: default: // @TODO Unknown support mode
+./inc/modules/admin/overview-inc.php:418: // @TODO Rewritings: admin->assigned_admin,uid->userid,type->task_type_msg in template
./inc/modules/admin.php:257: // @TODO Rewrite all these constants
./inc/modules/admin.php:94: // @TODO Why is this set to 'done'?
./inc/modules/admin/what-add_points.php:120: // @TODO Rewrite these both constants
./inc/modules/admin/what-config_cats.php:199: // @TODO Rewrite this constant
./inc/modules/admin/what-config_mods.php:139: // @TODO Rewritings: mod->module in template
./inc/modules/admin/what-config_mods.php:161: // @TODO Rewrite this constant
-./inc/modules/admin/what-config_payouts.php:144: // @TODO Rewrite this constant
-./inc/modules/admin/what-config_payouts.php:230: // @TODO Rewrite this constant
-./inc/modules/admin/what-config_points.php:262: // @TODO Rewritings: lvl->level, per->percents in template
+./inc/modules/admin/what-config_payouts.php:145: // @TODO Rewrite this constant
+./inc/modules/admin/what-config_payouts.php:231: // @TODO Rewrite this constant
+./inc/modules/admin/what-config_points.php:269: // @TODO Rewritings: lvl->level, per->percents in template
./inc/modules/admin/what-config_rallye_prices.php:203: // @TODO Rewritings: level->price_level, infos->info in template
./inc/modules/admin/what-config_rallye_prices.php:220: // @TODO Rewrite these two constants
./inc/modules/admin/what-config_rallye_prices.php:248: // @TODO Rewritings: aid->admin_id, alogin->login in template
./inc/modules/admin/what-logs.php:72: // @TODO Fix content-type here
./inc/modules/admin/what-mem_add.php:120: // @TODO This can be somehow rewritten to a function
./inc/modules/admin/what-mem_add.php:78: // @TODO This can be somehow rewritten to a function
-./inc/modules/admin/what-memedit.php:255: // @TODO Rewrite this constant
-./inc/modules/admin/what-memedit.php:291: // @TODO Rewrite this constant
+./inc/modules/admin/what-memedit.php:252: // @TODO Rewrite this constant
+./inc/modules/admin/what-memedit.php:288: // @TODO Rewrite this constant
./inc/modules/admin/what-payments.php:154: // @TODO Rewritings: title->mail_title, pay->payment in template
./inc/modules/admin/what-refbanner.php:127: // @TODO Rewrite this constant
./inc/modules/admin/what-refbanner.php:149: // @TODO Rewritings: alt->alternate,cnt->counter,clx->clicks in template
./inc/modules/guest/what-mediadata.php:186:// @TODO Rewrite these all if-blocks to filters
./inc/modules/guest/what-mediadata.php:49:// @TODO Rewrite all constants
./inc/modules/guest/what-mediadata.php:69: // @TODO Find a better formular than this one
-./inc/modules/guest/what-register.php:201: // @TODO Rewrite this to a single filter
-./inc/modules/guest/what-register.php:270: // @TODO Rewrite this to a filter
+./inc/modules/guest/what-register.php:196: // @TODO Rewrite these all to a single filter
+./inc/modules/guest/what-register.php:273: // @TODO Rewrite this to a filter
./inc/modules/guest/what-sponsor_infos.php:67: // @TODO Rewritings: conv->conv_rate,name->conv_name in template
./inc/modules/guest/what-sponsor_infos.php:87: // @TODO Rewritings: name->pay_name,min->pay_min_count,min->pay_min_count,curr->pay_currency
./inc/modules/guest/what-sponsor_reg.php:284: // @TODO Swap this HTML code to templates
./inc/modules/member/what-categories.php:112: // @TODO Rewrite this to use $OUT .= ...
./inc/modules/member/what-order.php:411: // @TODO Rewrite this to a filter
./inc/modules/member/what-order.php:506: // @TODO Rewrite this old lost code to a template
-./inc/modules/member/what-payout.php:131: // @TODO Rewritings: acc->target_account,bank->target_bank in templates
-./inc/modules/member/what-payout.php:147: // @TODO Rewrite this constant
-./inc/modules/member/what-payout.php:181: // @TODO Rewrite these constants
-./inc/modules/member/what-payout.php:189: // @TODO Rewrite this constant
+./inc/modules/member/what-payout.php:132: // @TODO Rewritings: acc->target_account,bank->target_bank in templates
+./inc/modules/member/what-payout.php:148: // @TODO Rewrite this constant
+./inc/modules/member/what-payout.php:182: // @TODO Rewrite these constants
+./inc/modules/member/what-payout.php:190: // @TODO Rewrite this constant
+./inc/modules/member/what-payout.php:235: // @TODO Rewrite this to a filter
./inc/modules/member/what-points.php:54:// @TODO Should we rewrite this to a filter?
./inc/modules/member/what-reflinks.php:105: // @TODO Rewritings: alt->alternate,cnt->counter,cks->clicks,uid->userid in template
./inc/modules/member/what-transfer.php:116: // @TODO Rewrite all these constants to array elements
./inc/modules/member/what-transfer.php:364: // @TODO Rewrite these constants
./inc/modules/member/what-transfer.php:451: // @TODO Rewrite all these constants
./inc/modules/member/what-unconfirmed.php:134: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:1528: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:1571: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:173: // @TODO Nothing helped???
-./inc/mysql-manager.php:1745: // @TODO Find a way for updating $_CONFIG here
-./inc/mysql-manager.php:1769: // @TODO Find a way for updating $_CONFIG here
-./inc/mysql-manager.php:1853: // @TODO Rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:2147: // @TODO This can be somehow rewritten
-./inc/mysql-manager.php:617: // @TODO Why is this global??? #100
-./inc/mysql-manager.php:946: // @TODO Why does this lead into an endless loop but we still need it???
-./inc/mysql-manager.php:947: // @TODO Commented out LOAD_URL('admin.php');
+./inc/mysql-manager.php:1549: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:1592: // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1768: // @TODO Find a way for updating $_CONFIG here
+./inc/mysql-manager.php:1792: // @TODO Find a way for updating $_CONFIG here
+./inc/mysql-manager.php:1815:// @TODO Can this be rewritten to a filter?
+./inc/mysql-manager.php:1877: // @TODO Rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:199: // @TODO Nothing helped???
+./inc/mysql-manager.php:2171: // @TODO This can be somehow rewritten
+./inc/mysql-manager.php:513: // @TODO Why is this global??? #100
+./inc/mysql-manager.php:947: // @TODO Why does this lead into an endless loop but we still need it???
+./inc/mysql-manager.php:948: // @TODO Commented out LOAD_URL('admin.php');
./mailid_top.php:208: // @TODO Rewrite these blocks to filter
./surfbar.php:65: // @TODO Display quick login form here or redirect as configured
### ### DEPRECATION FOLLOWS: ### ###
-./inc/functions.php:2338: // @DEPRECATED Language array element found in BIG_LETTERS
-./inc/functions.php:2341: // @DEPRECATED Deprecated constant found
-./inc/functions.php:234: // @DEPRECATED Try to rewrite the if() condition
-./inc/functions.php:248: // @DEPRECATED
+./inc/functions.php:233: // @DEPRECATED Try to rewrite the if() condition
+./inc/functions.php:2377: // @DEPRECATED Language array element found in BIG_LETTERS
+./inc/functions.php:2380: // @DEPRECATED Deprecated constant found
+./inc/functions.php:247: // @DEPRECATED
// Is the admin logged-in and no sql_patches installed?
if ((IS_ADMIN()) && (!EXT_IS_ACTIVE('sql_patches'))) {
// Extension 'sql_patches' is missing!
- LOAD_URL('modules.php?module=admin&sql_patches=1');
+ redirectToUrl('modules.php?module=admin&sql_patches=1');
} else {
// Default redirect
- LOAD_URL('modules.php?module=admin');
+ redirectToUrl('modules.php?module=admin');
}
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
// Is the script installed?
if (isInstalled()) {
// Simply redirect... :-)
- LOAD_URL('modules.php?module=index&what=agb');
+ redirectToUrl('modules.php?module=index&what=agb');
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
list($uid, $clicks, $ref_payout, $status, $last) = SQL_FETCHROW($result);
// Account confirmed?
- if ($status == "CONFIRMED") {
+ if ($status == 'CONFIRMED') {
// Secure userid
$uid = bigintval($uid);
define('__BEG_UID' , REQUEST_GET('uid'));
define('__BEG_CLICKS', ($clicks + 1));
define('__BEG_BANNER', LOAD_TEMPLATE("beg_banner", true));
- define('__BEG_POINTS', TRANSLATE_COMMA($points));
+ define('__BEG_POINTS', translateComma($points));
} else {
// Other status
$uid = 0;
array($uid), __FILE__, __LINE__);
// Check for last entry for userid w/o IP number
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_beg_ips` WHERE (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_timeout').") OR (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_uid_timeout').") AND userid=%s)) AND (remote_ip='%s' OR sid='%s') LIMIT 1",
- array($uid, GET_REMOTE_ADDR(), session_id()), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_beg_ips` WHERE (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_timeout').") OR (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_uid_timeout').") AND `userid`=%s)) AND (remote_ip='%s' OR sid='%s') LIMIT 1",
+ array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__);
// Entry not found, points set and not logged in?
if (((SQL_NUMROWS($result) == 0) || (IS_ADMIN())) && ($points > 0) && (!IS_MEMBER()) && (getConfig('beg_pay_mode') == "NONE")) {
// but only when there is no admin begging.
// Admins shall be able to test it!
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_beg_ips` (userid, remote_ip,sid, timeout) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())",
- array($uid, GET_REMOTE_ADDR(), session_id()), __FILE__, __LINE__);
+ array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__);
// Was is successfull?
if (SQL_AFFECTEDROWS() == 1) {
if ($pay === true) {
// Add points to user or begging rallye account
if (BEG_ADD_POINTS($uid, $points)) {
- // Set "done" message
+ // Set 'done' message
define('__BEG_MSG', LOAD_TEMPLATE("beg_done", true));
} else {
// Error!
SQL_FREERESULT($result);
// Include header
- LOAD_INC_ONCE('inc/header.php');
+ loadIncludeOnce('inc/header.php');
// Load final template
LOAD_TEMPLATE("beg_link");
}
// Include footer
- LOAD_INC_ONCE('inc/footer.php');
- } elseif (($status != "CONFIRMED") && ($status != "failed")) {
+ loadIncludeOnce('inc/footer.php');
+ } elseif (($status != 'CONFIRMED') && ($status != "failed")) {
// Maybe locked/unconfirmed account?
- $msg = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
- } elseif (($uid == "0") || ($status == "failed")) {
+ $msg = generateErrorCodeFromUserStatus($status);
+ } elseif (($uid == '0') || ($status == "failed")) {
// Inalid or locked account, so let's find out
$result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1",
array(REQUEST_GET('uid')), __FILE__, __LINE__);
}
// Reload to index module
- if ((!empty($msg)) && (!empty($msg))) LOAD_URL('modules.php?module=index&msg='.$msg.'&ext=beg');
+ if ((!empty($msg)) && (!empty($msg))) redirectToUrl('modules.php?module=index&msg='.$msg.'&ext=beg');
} else {
// No userid entered
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
ON b.userid=d.userid
WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1",
array($uid, $chk), __FILE__, __LINE__);
- //* DEBUG: */ echo "uid=".$uid.",chk=".$chk." (".strlen($chk)."/".strlen(REQUEST_GET('check'))."/".SQL_NUMROWS($result).")<br />\n";
+ //* DEBUG: */ echo "uid=".$uid.",chk=".$chk." (".strlen($chk).'/'.strlen(REQUEST_GET('check')).'/'.SQL_NUMROWS($result).")<br />\n";
// Is an entry there?
if (SQL_NUMROWS($result) == 1) {
array($uid, $chk), __FILE__, __LINE__);
// Transfer data to constants for the template
- define('__GENDER', TRANSLATE_GENDER($data['gender']));
+ define('__GENDER', translateGender($data['gender']));
define('__SNAME' , $data['surname']);
define('__FNAME' , $data['family']);
- define('__GIFT' , TRANSLATE_COMMA($data['points']));
+ define('__GIFT' , translateComma($data['points']));
// Load message from template
define('__MSG', LOAD_TEMPLATE('birthday_msg', true));
} else {
// Unconfirmed / locked accounts cannot get points
- define('__MSG', sprintf(getMessage('BIRTHDAY_CANNOT_STATUS'), TRANSLATE_STATUS($data['status'])));
+ define('__MSG', sprintf(getMessage('BIRTHDAY_CANNOT_STATUS'), translateUserStatus($data['status'])));
}
} else {
// Cannot load data!
$GLOBALS['module'] = 'birthday_confirm';
// Include header
- LOAD_INC('inc/header.php');
+ loadInclude('inc/header.php');
// Load birthday header template (for your banners, e.g.?)
define('__BIRTHDAY_HEADER', LOAD_TEMPLATE('birthday_header', true));
LOAD_TEMPLATE('birthday_confirm');
// Include footer
- LOAD_INC('inc/footer.php');
+ loadInclude('inc/footer.php');
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
if (((REQUEST_ISSET_GET(('user'))) || (REQUEST_ISSET_GET(('reseller')))) && (REQUEST_ISSET_GET(('banner')))) {
// Update clicks counter...
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refbanner` SET clicks=clicks+1 WHERE id=%s LIMIT 1", array(bigintval(REQUEST_GET('banner'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refbanner` SET clicks=clicks+1 WHERE `id`=%s LIMIT 1", array(bigintval(REQUEST_GET('banner'))), __FILE__, __LINE__);
if (SQL_AFFECTEDROWS() == 1) {
if (REQUEST_ISSET_GET(('user'))) {
- LOAD_URL('ref.php?refid=' . bigintval(REQUEST_GET('user')));
+ redirectToUrl('ref.php?refid=' . bigintval(REQUEST_GET('user')));
} elseif (REQUEST_ISSET_GET(('reseller'))) {
- LOAD_URL('shop_reseller.php?reseller=' . bigintval(REQUEST_GET('reseller')));
+ redirectToUrl('shop_reseller.php?reseller=' . bigintval(REQUEST_GET('reseller')));
}
} // END - if
} // END - if
// Load index page
-LOAD_URL('index.php');
+redirectToUrl('index.php');
// Shutdown
shutdown();
}
// Load the URL
- LOAD_URL($URL);
+ redirectToUrl($URL);
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
require('inc/config.php');
// Load header
-LOAD_INC('inc/header.php');
+loadInclude('inc/header.php');
// Load CSS code
-LOAD_INC('inc/stylesheet.php');
+loadInclude('inc/stylesheet.php');
// Load footer
-LOAD_INC('inc/footer.php');
+loadInclude('inc/footer.php');
//
?>
);
// Is the module there? Else we log it!
- if (INCLUDE_READABLE($INC)) {
+ if (isIncludeReadable($INC)) {
// Load the request module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
// Missing request file, may happen while development
DEBUG_ABUSE_LOG(__FILE__, __LINE__, 'request_404', REQUEST_POST('request'));
SQL_FREERESULT($result);
// Remove any dots and unwanted chars from the points
- REQUEST_SET_POST('points', bigintval(round(REVERT_COMMA(REQUEST_POST('points')))));
+ REQUEST_SET_POST('points', bigintval(round(convertCommaToDot(REQUEST_POST('points')))));
// Probe for enough points
$probe_points = ((REQUEST_POST('points') >= getConfig('doubler_min')) && (REQUEST_POST('points') <= getConfig('doubler_max')));
if (($points - getConfig('doubler_left') - REQUEST_POST('points') * getConfig('doubler_charge')) >= 0)
// Enough points are left so let's continue with the doubling process
// Create doubling "account" width *DOUBLED* points
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_doubler` (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s','%s','%s','".GET_REMOTE_ADDR()."', UNIX_TIMESTAMP(), 'N','N')",
+ SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_doubler` (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s','%s','%s','".detectRemoteAddr()."', UNIX_TIMESTAMP(), 'N','N')",
array($uid, bigintval($GLOBALS['refid']), bigintval(REQUEST_POST('points') * 2)), __FILE__, __LINE__);
// Subtract entered points
// Add points to "total payed" including charge
$points = REQUEST_POST('points') - REQUEST_POST('points') * getConfig('doubler_charge');
- UPDATE_CONFIG('doubler_points', $points, '+');
+ updateConfiguration('doubler_points', $points, '+');
incrementConfigEntry('doubler_points', $points);
// Add second line for the referal but only when uid != refid
if (($GLOBALS['refid'] > 0) && ($GLOBALS['refid'] != $uid)) {
// Okay add a refid line and apply refid percents
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_doubler` (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s',0,'%s','".GET_REMOTE_ADDR()."',UNIX_TIMESTAMP(),'N','Y')",
+ SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_doubler` (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s',0,'%s','".detectRemoteAddr()."',UNIX_TIMESTAMP(),'N','Y')",
array(
bigintval($GLOBALS['refid']),
bigintval(REQUEST_POST('points') * 2 * getConfig('doubler_ref'))
} // END - if
// Update usage counter
- UPDATE_CONFIG('doubler_counter', 1, '+');
+ updateConfiguration('doubler_counter', 1, '+');
// Set constant
define('__DOUBLER_MSG', LOAD_TEMPLATE('doubler_reflink', true, REQUEST_POST('userid')));
if (!defined('__ERROR_MSG')) define('__ERROR_MSG' , '');
// Shall I check for points immediately?
- if (getConfig('doubler_send_mode') == 'DIRECT') LOAD_INC('inc/doubler_send.php');
+ if (getConfig('doubler_send_mode') == 'DIRECT') loadInclude('inc/doubler_send.php');
// Output header
- LOAD_INC('inc/header.php');
+ loadInclude('inc/header.php');
// Banner in text
define('__DOUBLER_BANNER', LOAD_TEMPLATE('doubler_banner', true));
}
// Percent values etc.
- define('__CHARGE_VALUE', TRANSLATE_COMMA(getConfig('doubler_charge') * 100));
- define('__REF_VALUE' , TRANSLATE_COMMA(getConfig('doubler_ref') * 100));
- define('__TOTAL_VALUE' , TRANSLATE_COMMA(getConfig('doubler_points')));
- define('__MIN_VALUE' , TRANSLATE_COMMA(getConfig('doubler_min')));
- define('__MAX_VALUE' , TRANSLATE_COMMA(getConfig('doubler_max')));
+ define('__CHARGE_VALUE', translateComma(getConfig('doubler_charge') * 100));
+ define('__REF_VALUE' , translateComma(getConfig('doubler_ref') * 100));
+ define('__TOTAL_VALUE' , translateComma(getConfig('doubler_points')));
+ define('__MIN_VALUE' , translateComma(getConfig('doubler_min')));
+ define('__MAX_VALUE' , translateComma(getConfig('doubler_max')));
// Text "Enter login"
if (EXT_IS_ACTIVE('nickname')) {
define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE('0', 'Y', 'N', 'DESC'));
// Generate timemark
- define('__TIMEOUT_MARK', CREATE_FANCY_TIME(getConfig('doubler_timeout')));
+ define('__TIMEOUT_MARK', createFancyTime(getConfig('doubler_timeout')));
// Usage counter
define('__DOUBLER_COUNTER', getConfig('doubler_counter'));
// Points left to doubler
- define('__LEFT_VALUE', TRANSLATE_COMMA(DOUBLER_GET_TOTAL_POINTS_LEFT()));
+ define('__LEFT_VALUE', translateComma(DOUBLER_GET_TOTAL_POINTS_LEFT()));
// Output neccessary form for this
LOAD_TEMPLATE('doubler_index');
// Output footer
- LOAD_INC('inc/footer.php');
+ loadInclude('inc/footer.php');
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
// Script installed?
if (isInstalled()) {
// Load header
- LOAD_INC_ONCE('inc/header.php');
+ loadIncludeOnce('inc/header.php');
// Code set?
if (REQUEST_ISSET_GET(('code'))) {
);
// Include is readable?
- if (INCLUDE_READABLE($INC)) {
+ if (isIncludeReadable($INC)) {
// Include it
- LOAD_INC($INC);
+ loadInclude($INC);
} // END - if
}
// Finish generation here
- LOAD_INC_ONCE('inc/footer.php');
+ loadIncludeOnce('inc/footer.php');
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
// Init & set the include pool
INIT_INC_POOL();
-SET_INC_POOL(GET_DIR_AS_ARRAY('inc/autopurge/', 'purge-'));
+SET_INC_POOL(getArrayFromDirectory('inc/autopurge/', 'purge-'));
// Run the filter
runFilterChain('load_includes');
$uid = 0; $points = 0;
while ($content = SQL_FETCHARRAY($result)) {
// Check if confirmation links are purged or not
- $result_links = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s LIMIT 1",
+ $result_links = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s LIMIT 1",
array(bigintval($content['id'])), __FILE__, __LINE__);
if (SQL_NUMROWS($result_links) == 1) {
// Free memory
array(bigintval($content['id'])), __FILE__, __LINE__, false));
// Update status of order
- ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='DELETED' WHERE id=%s LIMIT 1",
+ ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='DELETED' WHERE `id`=%s LIMIT 1",
array(bigintval($content['pool_id'])), __FILE__, __LINE__, false));
} // END - if
} // END - while
$points = 0;
while ($content = SQL_FETCHARRAY($result)) {
// Check if confirmation links are purged or not
- $result_links = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
+ $result_links = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
array(bigintval($content['id'])), __FILE__, __LINE__);
if (SQL_NUMROWS($result_links) > 0) {
// At least one link was found, enougth to pay back the points
array(bigintval($content['id'])), __FILE__, __LINE__, false));
// Update status of order
- ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='DELETED' WHERE id=%s LIMIT 1",
+ ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='DELETED' WHERE `id`=%s LIMIT 1",
array(bigintval($content['id'])), __FILE__, __LINE__, false));
} // END - if
} // END - while
// Add points from deleted accounts to jackpot, but here just add to notify mail
if ($admin_points > 0) {
// Send mail to admin
- SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_SUBJECT'), "admin_autopurge_points", TRANSLATE_COMMA($points), "0");
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_SUBJECT'), "admin_autopurge_points", translateComma($points), '0');
} // END - if
// Run all SQLs here
$UIDs .= $content['userid'].", ";
// Get date/time from timestamp
- $content['last_online'] = MAKE_DATETIME($content['last_online'], "0");
+ $content['last_online'] = generateDateTime($content['last_online'], '0');
// Load mail template
$msg = LOAD_EMAIL_TEMPLATE("member_autopurge_inactive", $content['last_online'], bigintval($content['userid']));
- SEND_EMAIL($content['email'], getMessage('AUTOPURGE_MEMBER_INACTIVE_SUBJECT'), $msg);
+ sendEmail($content['email'], getMessage('AUTOPURGE_MEMBER_INACTIVE_SUBJECT'), $msg);
// Update this account
ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ap_notified=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
$UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));
// Send mail notification to admin
- SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_INACTIVE_SUBJECT'), "admin_autopurge_inactive", $UIDs, '');
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_INACTIVE_SUBJECT'), "admin_autopurge_inactive", $UIDs, '');
} // END - if
// Free memory
$time = getConfig(('ap_in_time'));
$result_inactive = SQL_QUERY_ESC("SELECT d.userid, d.email, d.last_online
FROM `{!_MYSQL_PREFIX!}_user_data` AS d
-WHERE `status`='CONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s) AND last_online < (UNIX_TIMESTAMP() - %s) AND ap_notified < (UNIX_TIMESTAMP() - %s)
+WHERE `status`='CONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s) AND `last_online` < (UNIX_TIMESTAMP() - %s) AND ap_notified < (UNIX_TIMESTAMP() - %s)
".$EXCLUDE_LIST."
-ORDER BY userid",
+ORDER BY `userid` ASC",
array($since, $since, $time), __FILE__, __LINE__);
if (SQL_NUMROWS($result_inactive) > 0) {
// Prepare variable...
$UIDs .= $content['userid'].", ";
// Get date/time from timestamp
- $content['last_online'] = MAKE_DATETIME($content['last_online'], "0");
+ $content['last_online'] = generateDateTime($content['last_online'], '0');
// Finnaly delete this inactive account
- DELETE_USER_ACCOUNT($content['userid'], LOAD_EMAIL_TEMPLATE("member_autopurge_delete", $content['last_online'], ''));
+ deleteUserAccount($content['userid'], LOAD_EMAIL_TEMPLATE("member_autopurge_delete", $content['last_online'], ''));
} // END - while
// Remove last comma
// Send mail notification to admin
if (getConfig('ap_in_notify') == 'Y') {
- SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_DELETE_SUBJECT'), "admin_autopurge_delete", $UIDs, '');
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_DELETE_SUBJECT'), "admin_autopurge_delete", $UIDs, '');
} // END - if
} // END - if
// Do we have deleted mails and the admin want's to receive a notification
if (($DELETED > 0) && (getConfig('ap_dm_notify') == 'Y')) {
// Send out email to admin
- SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT'), "admin_autopurge_del_mails", $DELETED, '');
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT'), "admin_autopurge_del_mails", $DELETED, '');
} // END - if
}
// Do we need to send a notification?
if (($DELETED > 0) && (getConfig('ap_tasks_notify') == 'Y')) {
// Send out email to admin
- SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_TASKS_SUBJECT'), "admin_autopurge_tsks", $DELETED, '');
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_TASKS_SUBJECT'), "admin_autopurge_tsks", $DELETED, '');
} // END - if
} // END - if
$UIDs .= $content['userid'].", ";
// Get date/time from timestamp
- $content['joined'] = MAKE_DATETIME($content['joined'], "0");
+ $content['joined'] = generateDateTime($content['joined'], '0');
// Finnaly delete this inactive account
- DELETE_USER_ACCOUNT($content['userid'], LOAD_EMAIL_TEMPLATE("member_autopurge_unconfirmed", $content['joined'], ''));
+ deleteUserAccount($content['userid'], LOAD_EMAIL_TEMPLATE("member_autopurge_unconfirmed", $content['joined'], ''));
} // END - while
// Remove last comma
// Send mail notification to admin
if (getConfig('ap_un_notify') == 'Y') {
- SEND_ADMIN_NOTIFICATION(getMessage('AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT'), "admin_autopurge_unconfirmed", $UIDs, '');
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT'), "admin_autopurge_unconfirmed", $UIDs, '');
} // END - if
} // END - if
// Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
// 01 2 3 32 2 3321 1 221 1 221 1 221 1 23 321 1 10
-if ((date("d", getConfig('last_update')) != date("d", time())) && (!isInstalling()) && (isInstalled()) && (isAdminRegistered()) && (!REQUEST_ISSET_GET(('register'))) && ($GLOBALS['output_mode'] != 1)) {
+if ((date('d', getConfig('last_update')) != date('d', time())) && (!isInstalling()) && (isInstalled()) && (isAdminRegistered()) && (!REQUEST_ISSET_GET(('register'))) && ($GLOBALS['output_mode'] != 1)) {
// Tell every module we are in reset-mode!
enableResetMode();
}
// Load configuration and return it as an arry
-function loadConfiguration ($no="0") {
+function loadConfiguration ($no = '0') {
global $_CONFIG;
// Check for cache extension, cache-array and if the requested configuration is in cache
define('SLOGAN', "Your cool slogan here");
// Auto-detection... (patched by "Stelzi" aka. profi-concept, thanks again!)
-$URL = "http://".getenv('SERVER_NAME') . str_replace("\\", "/", dirname($_SERVER['PHP_SELF']));
-while (substr($URL, -1, 1) == "/") { $URL = substr($URL, 0, -1); }
-$PATH = str_replace("\\", "/", substr(dirname(__FILE__), 0, -3));
+$URL = "http://".getenv('SERVER_NAME') . str_replace("\\", '/', dirname($_SERVER['PHP_SELF']));
+while (substr($URL, -1, 1) == '/') { $URL = substr($URL, 0, -1); }
+$PATH = str_replace("\\", '/', substr(dirname(__FILE__), 0, -3));
// CFG: HOST-URL (without trailing '/' !)
define('URL', $URL);
addCode('MODULE_MEM_ONLY' , 0x023);
// Server-URL (DO NOT CHANGE THIS OR YOU CANNOT CHECK FOR UPDATES/EXTENSIONS!)
-define('SERVER_URL', "http://www.mxchange.org");
+define('SERVER_URL', 'http://www.mxchange.org');
// Replacement strings
$GLOBALS['replacer'] = array(
- 'userid' => "%uid%", // User-ID
- 'surname' => "%vorname%", // Surname
- 'family' => "%nachname%", // Family name
- 'gender' => "%anrede%", // Gender
+ 'userid' => '%uid%', // User-ID
+ 'surname' => '%vorname%', // Surname
+ 'family' => '%nachname%', // Family name
+ 'gender' => '%anrede%', // Gender
);
// One day
//
// Timestamp for yesterday, today ... all at 00:00 am
-define('START_YDAY', MAKE_TIME(0, 0, 0, time() - getConfig('one_day')));
-define('START_TDAY', MAKE_TIME(0, 0, 0, time()));
+define('START_YDAY', makeTime(0, 0, 0, time() - getConfig('one_day')));
+define('START_TDAY', makeTime(0, 0, 0, time()));
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
// CFG: DEBUG-SQL (if enabled and DEBUG_MODE is enabled all SQL queries will be logged to debug.log)
define('DEBUG_SQL', false);
+// CFG: ENCRYPT-SEPERATOR
+define('ENCRYPT_SEPERATOR', ':');
+
// Extra title is empty by default
$EXTRA_TITLE = '';
incrementConfigEntry('db_hits', getConfig('db_hits_run'));
// Update counter for db/cache
- UPDATE_CONFIG(array('db_hits', 'cache_hits'), array(getConfig(('db_hits')), getConfig(('cache_hits'))));
+ updateConfiguration(array('db_hits', 'cache_hits'), array(getConfig(('db_hits')), getConfig(('cache_hits'))));
} // END - if
// Close database link and forget the link
// 123 4 4 3 3 4 432 23 4 4 3 3 4 4321
if (((SQL_NUMROWS($result) == 0) && (ereg("ADD", $sql))) || ((SQL_NUMROWS($result) == 1) && (ereg("DROP", $sql)))) {
// Do the query
- //* DEBUG: */ print __LINE__.":".$sql."<br />\n";
+ //* DEBUG: */ print __LINE__.':'.$sql."<br />\n";
$result = SQL_QUERY($sql, $F, $L, false);
} // END - if
} elseif ((constant('_TABLE_TYPE') == "InnoDB") && (ereg("FULLTEXT", $sql))) {
while (strpos($columnName, ",") !== false) {
// Use last
$columnName = str_replace("`", '', $tableArray[count($tableArray) - $begin]);
- //* DEBUG: */ print __LINE__.":".$columnName."----------------".$begin."<br />\n";
+ //* DEBUG: */ print __LINE__.':'.$columnName."----------------".$begin."<br />\n";
// Remove brackes
$columnName = str_replace("(", '', str_replace(")", '', $columnName));
- //* DEBUG: */ print __LINE__.":".$columnName."----------------".$begin."<br />\n";
+ //* DEBUG: */ print __LINE__.':'.$columnName."----------------".$begin."<br />\n";
// Continue
$begin++;
// Shall we run it?
if (!$skip) {
// Send it to the SQL_QUERY() function
- //* DEBUG: */ print __LINE__.":".$sql."<br />\n";
+ //* DEBUG: */ print __LINE__.':'.$sql."<br />\n";
$result = SQL_QUERY($sql, $F, $L, false);
} // END - if
} else {
// Other ALTER TABLE query
- //* DEBUG: */ print __LINE__.":".$sql."<br />\n";
+ //* DEBUG: */ print __LINE__.':'.$sql."<br />\n";
$result = SQL_QUERY($sql, $F, $L, false);
}
// Create include file name
$INC = sprintf("inc/db/lib-%s.php", constant('_DB_TYPE'));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Include abstraction layer
- LOAD_INC_ONCE($INC);
+ loadIncludeOnce($INC);
} else {
// Bye, bye...
die("Cannot load database abstraction layer ".constant('_DB_TYPE')." -> R.I.P.");
// If not currently doubled set it to zero
unset($_GET['DOUBLER_UID']);
unset($_POST['DOUBLER_UID']);
-set_session('DOUBLER_UID', '');
+setSession('DOUBLER_UID', '');
if (empty($GLOBALS['doubler_uid'])) $GLOBALS['doubler_uid'] = 0;
// Check for doubles which we can pay out
// Exclude webmaster from doubling...
if ($content['userid'] != getConfig('doubler_uid')) {
// Add points
- ADD_POINTS_REFSYSTEM(sprintf("doubler_%s", strtolower(getConfig('doubler_send_mode'))), $content['userid'], $content['points'], false, "0", false, "direct");
+ ADD_POINTS_REFSYSTEM_DIRECT(sprintf("doubler_%s", strtolower(getConfig('doubler_send_mode'))), $content['userid'], $content['points']);
} // END - if
// Set entry as "payed"
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET completed='Y' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET completed='Y' WHERE `id`=%s LIMIT 1",
array(bigintval($content['id'])), __FILE__, __LINE__);
$okay = false;
// Update doubler's account only when others are not updated
if (!$okay) {
// Add points to used doubler points
- UPDATE_CONFIG("doubler_used", $content['points'], "+");
+ updateConfiguration('doubler_used', $content['points'], '+');
} // END - if
// Update variables to prevent errors
// Doubler transmission ID
'id' => $content['id'],
// Doubled points
- 'points' => TRANSLATE_COMMA($content['points']),
+ 'points' => translateComma($content['points']),
// Timemark
- 'when' => MAKE_DATETIME($content['timemark'], "2"),
+ 'when' => generateDateTime($content['timemark'], "2"),
// IP number when the member submitted the doubling form
'ip' => $content['remote_ip'],
);
// Load mail template and send mail away...
$msg = LOAD_EMAIL_TEMPLATE("member_doubler", $content, $content['userid']);
- SEND_EMAIL($content['userid'], getMessage('DOUBLER_MEMBER_SUBJECT'), $msg);
+ sendEmail($content['userid'], getMessage('DOUBLER_MEMBER_SUBJECT'), $msg);
} // END - if
} // END - while
} // END - if
}
// Load the extension and maybe found language and function files.
-function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run = false) {
+function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = '', $EXT_VER = '', $dry_run = false) {
// Set current extension name
EXT_SET_CURR_NAME($ext_name);
$FQFN = constant('PATH') . $INC;
// Is the extension file NOT there?
- if (!INCLUDE_READABLE($INC)) {
+ if (!isIncludeReadable($INC)) {
// Debug message
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension %s not found.", $ext_name));
} // END - if
// Construct FQFN for language file
- $langInclude = sprintf("inc/language/%s_%s.php", $ext_name, GET_LANGUAGE());
+ $langInclude = sprintf("inc/language/%s_%s.php", $ext_name, getLanguage());
// Is this include there?
- if ((FILE_READABLE($langInclude)) && (!isset($GLOBALS['ext_loaded']['lang'][$ext_name]))) {
+ if ((isFileReadable($langInclude)) && (!isset($GLOBALS['ext_loaded']['lang'][$ext_name]))) {
// Then load it
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Language loaded.");
$GLOBALS['ext_loaded']['lang'][$ext_name] = true;
- LOAD_INC_ONCE($langInclude);
+ loadIncludeOnce($langInclude);
} // END - if
// Construct FQFN for functions file
$funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name);
// Is this include there?
- if ((FILE_READABLE($funcsInclude)) && (!isset($GLOBALS['ext_loaded']['funcs'][$ext_name]))) {
+ if ((isFileReadable($funcsInclude)) && (!isset($GLOBALS['ext_loaded']['funcs'][$ext_name]))) {
// Then load it
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Functions loaded.");
$GLOBALS['ext_loaded']['funcs'][$ext_name] = true;
- LOAD_INC_ONCE($funcsInclude);
+ loadIncludeOnce($funcsInclude);
} // END - if
// Extensions are not deprecated by default
- EXT_SET_DEPRECATED("N");
+ EXT_SET_DEPRECATED('N');
// Extensions are not always active by default
- EXT_SET_ALWAYS_ACTIVE("N");
+ EXT_SET_ALWAYS_ACTIVE('N');
// Extension update notes
EXT_SET_UPDATE_NOTES("");
// Try to register the extension
//* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().":ext_update=".$ext_update.",taskId=".$task."<br />\n";
$test = REGISTER_EXTENSION($ext_update, $task, $dry_run, false);
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().":"; var_dump($test);
+ //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'; var_dump($test);
} // END - if
} elseif ($ext_ver != EXT_GET_VERSION()) {
// Ok, update this extension now
$EXT_LOAD_MODE = 'register';
// Remains true if extension registration reports no failures
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().":"; var_dump($test);
+ //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'; var_dump($test);
$test = (($test === true) && (EXT_GET_REPORTS_FAILURE() === false));
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().":"; var_dump($test);
+ //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'; var_dump($test);
// Does everthing before wents ok?
if ($test === true) {
runFilterChain('pre_extension_installed', array('dry_run' => $dry_run));
// Register extension
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:insert=".EXT_GET_CURR_NAME()."/".EXT_GET_VERSION()." - INSERT!<br />\n";
+ //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:insert=".EXT_GET_CURR_NAME().'/'.EXT_GET_VERSION()." - INSERT!<br />\n";
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_extensions` (ext_name, ext_active, ext_version) VALUES ('%s','%s','%s')",
array(EXT_GET_CURR_NAME(), EXT_GET_ALWAYS_ACTIVE(), EXT_GET_VERSION()), __FUNCTION__, __LINE__);
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "".EXT_GET_CURR_NAME());
$ret = false;
}
- } elseif (($task_id > 0) && (EXT_GET_CURR_NAME() != "")) {
+ } elseif (($task_id > 0) && (EXT_GET_CURR_NAME() != '')) {
//* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME()."<br />\n";
// Remove task from system when id and extension's name is valid
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s AND `status`='NEW' LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `id`=%s AND `status`='NEW' LIMIT 1",
array(bigintval($task_id)), __FUNCTION__, __LINE__);
}
// Is this the sql_patches?
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":".EXT_GET_CURR_NAME()."/{$EXT_LOAD_MODE}");
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ':'.EXT_GET_CURR_NAME()."/{$EXT_LOAD_MODE}");
if ((EXT_GET_CURR_NAME() == 'sql_patches') && (($EXT_LOAD_MODE == 'register') || ($EXT_LOAD_MODE == 'remove')) && (!$dry_run) && ($test)) {
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": LOAD!");
if ($logout === true) {
// Then redirect to logout
- LOAD_URL('modules.php?module=admin&logout=1&' . $EXT_LOAD_MODE . '=sql_patches');
+ redirectToUrl('modules.php?module=admin&logout=1&' . $EXT_LOAD_MODE . '=sql_patches');
} else {
// Add temporary filter
REGISTER_FILTER('shutdown', 'REDIRECT_TO_LOGOUT_SQL_PATCHES', true, true);
$ext_name = GET_EXT_NAME($ext_id);
// If it is not set then maybe there is no extension for that ID number
- if ($ext_name == "") return false;
+ if ($ext_name == '') return false;
// Set current SQL name
EXT_SET_CURR_NAME($ext_name);
// Removal mode?
if ($load_mode == 'remove') {
// Delete this extension (remember to remove it from your server *before* you click on welcome!
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array(EXT_GET_CURR_NAME()), __FUNCTION__, __LINE__);
} // END - if
} // END - if
// Remove cache file(s) if extension is active
- if (((EXT_IS_ACTIVE('cache')) || (GET_EXT_VERSION('cache') != "")) && (((SQL_AFFECTEDROWS() == 1)) || ($sqlRan === true) || ($load_mode == 'activate') || ($load_mode == 'deactivate'))) {
+ if (((EXT_IS_ACTIVE('cache')) || (GET_EXT_VERSION('cache') != '')) && (((SQL_AFFECTEDROWS() == 1)) || ($sqlRan === true) || ($load_mode == 'activate') || ($load_mode == 'deactivate'))) {
// Run filters
runFilterChain('post_extension_run_sql', EXT_GET_CURR_NAME());
} // END - if
if ((EXT_GET_CURR_NAME() == 'sql_patches') && (($load_mode == 'register') || ($load_mode == 'remove'))) {
// Then redirect to logout
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": LOAD!");
- LOAD_URL('modules.php?module=admin&logout=1&' . $load_mode . '=sql_patches');
+ redirectToUrl('modules.php?module=admin&logout=1&' . $load_mode . '=sql_patches');
} // END - if
}
} elseif (isset($GLOBALS['ext_loaded'][$ext_name])) {
// @TODO Extension is loaded, what next?
app_die(__FUNCTION__, __LINE__, "LOADED:$ext_name");
- } elseif (($ext_name == 'cache') || (GET_EXT_VERSION('cache') == "")) {
+ } elseif (($ext_name == 'cache') || (GET_EXT_VERSION('cache') == '')) {
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "DB! ext_name={$ext_name}");
// Load from database
- $result = SQL_QUERY_ESC("SELECT ext_active FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT ext_active FROM `{!_MYSQL_PREFIX!}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
// Entry found?
} else {
// Extension not active!
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "ext_name=".$ext_name.": Not active!");
- $GLOBALS['cache_array']['extensions']['ext_active'][$ext_name] = "N";
+ $GLOBALS['cache_array']['extensions']['ext_active'][$ext_name] = 'N';
}
// Debug message
incrementConfigEntry('cache_hits');
} elseif (!isCacheInstanceValid()) {
// Load from database
- $result = SQL_QUERY_ESC("SELECT ext_version FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT ext_version FROM `{!_MYSQL_PREFIX!}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": DB - ".SQL_NUMROWS($result)."");
// Load again...
LOAD_EXTENSION(EXT_GET_CURR_NAME(), 'update', $GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], $dry_run);
- if (EXT_GET_UPDATE_DEPENDS() != "") {
+ if (EXT_GET_UPDATE_DEPENDS() != '') {
// Is the extension there?
- if (GET_EXT_VERSION(EXT_GET_UPDATE_DEPENDS()) != "") {
+ if (GET_EXT_VERSION(EXT_GET_UPDATE_DEPENDS()) != '') {
// Update another extension first!
$test = EXTENSION_UPDATE(EXT_GET_UPDATE_DEPENDS(), GET_EXT_VERSION(EXT_GET_UPDATE_DEPENDS()), $dry_run);
} else {
if (!$dry_run) {
// Create task
- CREATE_EXTENSION_UPDATE_TASK(GET_CURRENT_ADMIN_ID(), EXT_GET_CURR_NAME(), $GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], SQL_ESCAPE(EXT_GET_NOTES(EXT_GET_NOTES())));
+ CREATE_EXTENSION_UPDATE_TASK(getCurrentAdminId(), EXT_GET_CURR_NAME(), $GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], SQL_ESCAPE(EXT_GET_NOTES(EXT_GET_NOTES())));
// Update extension's version
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_version='%s' WHERE ext_name='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_version='%s' WHERE `ext_name`='%s' LIMIT 1",
array($GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], EXT_GET_CURR_NAME()), __FUNCTION__, __LINE__);
// Remove arrays
}
// Output verbose SQL table for extension
-function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = "", $dashed = "", $switch = false, $width = "100%") {
+function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = '', $dashed = '', $switch = false, $width = "100%") {
// Empty title?
if (empty($title)) {
// Then fix it to default
incrementConfigEntry('cache_hits');
} elseif (!EXT_IS_ACTIVE('cache')) {
// Load from database
- $result = SQL_QUERY_ESC("SELECT ext_name FROM `{!_MYSQL_PREFIX!}_extensions` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT ext_name FROM `{!_MYSQL_PREFIX!}_extensions` WHERE `id`=%s LIMIT 1",
array(bigintval($ext_id)), __FUNCTION__, __LINE__);
list($ret) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
incrementConfigEntry('cache_hits');
} elseif (!EXT_IS_ACTIVE('cache')) {
// Load from database
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
list($ret) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Activate given extension
function ACTIVATE_EXTENSION ($ext_name) {
// Activate the extension
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_active='Y' WHERE ext_name='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET `ext_active`='Y' WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
// Extension has been activated?
// Deactivate given extension
function DEACTIVATE_EXTENSION($ext_name) {
// Activate the extension
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_active='N' WHERE ext_name='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET `ext_active`='N' WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
// Extension has been activated?
CREATE_EXTENSION_DEACTIVATION_TASK($ext_name);
// Notify the admin
- SEND_ADMIN_NOTIFICATION(
+ sendAdminNotification(
getMessage('ADMIN_SUBJECT_EXTENSION_DEACTIVATED'),
- "admin_ext_deactivated",
+ 'admin_ext_deactivated',
array('ext_name' => $ext_name)
);
} // END - if
$currVersion = GET_EXT_VERSION($ext_name);
// Remove all dots from both versions
- $currVersion = str_replace(".", '', $currVersion);
- $ext_ver = str_replace(".", '', $ext_ver);
+ $currVersion = str_replace('.', '', $currVersion);
+ $ext_ver = str_replace('.', '', $ext_ver);
// Now compare both and return the result
return ($currVersion < $ext_ver);
// Creates a new task for updated extension
function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $ext_name, $ext_ver, $notes) {
// Create subject line
- $subject = "[UPDATE-".$ext_name."-".$ext_ver.":] {--ADMIN_UPDATE_EXT_SUBJ--}";
+ $subject = '[UPDATE-'.$ext_name.'-'.$ext_ver.':] {--ADMIN_UPDATE_EXT_SUBJ--}';
// Is the extension there?
- if (GET_EXT_VERSION($ext_name) != "") {
+ if (GET_EXT_VERSION($ext_name) != '') {
// Check if task is not there
if (DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) {
// Task not created so it's a brand-new extension which we need to register and create a task for!
// Creates a new task for newly installed extension
function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) {
// Not installed and do we have created a task for the admin?
- if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) == "")) {
+ if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) == '')) {
// Template file
$tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl",
constant('PATH'),
- GET_LANGUAGE(),
+ getLanguage(),
$ext
);
$msg = sprintf(getMessage('ADMIN_EXT_TEXT_FILE_MISSING'), $ext);
// Load text for task if found
- if (FILE_READABLE($tpl)) {
+ if (isFileReadable($tpl)) {
// Load extension's own text template (HTML!)
- $msg = LOAD_TEMPLATE("ext_" . $ext, true);
+ $msg = LOAD_TEMPLATE('ext_' . $ext, true);
} else {
// Write this in debug.log as well
DEBUG_LOG(__FUNCTION__, __LINE__, $msg);
$subject = sprintf("[%s:] %s", $ext, getMessage('TASK_SUBJ_EXTENSION_DEACTIVATED'));
// Not installed and do we have created a task for the admin?
- if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) != "")) {
+ if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) != '')) {
// Task not created so add it
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, userid, status, task_type, subject, text, task_created)
VALUES (0, 0, 'NEW', 'EXTENSION_DEACTIVATION', '%s', '%s', UNIX_TIMESTAMP())",
array(
$subject,
- SQL_ESCAPE(LOAD_TEMPLATE("task_ext_deactivated", true, $ext)),
+ SQL_ESCAPE(LOAD_TEMPLATE('task_ext_deactivated', true, $ext)),
), __FUNCTION__, __LINE__, true, false
);
} // END - if
// Free memory
SQL_FREERESULT($result);
- } elseif (GET_EXT_VERSION('sql_patches') == "") {
+ } elseif (GET_EXT_VERSION('sql_patches') == '') {
// No sql_patches installed, so maybe in admin area or no admin registered?
$ret = (((IS_ADMIN()) || (!isAdminRegistered())) && ($mod == 'admin')); // Then there is a menu!
}
// Return status
- //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().":"; var_dump($ret);
+ //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'; var_dump($ret);
return $ret;
}
$task_id = 0;
// Search for extension task's id
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_task_system` WHERE task_type='EXTENSION' AND subject='[%s:]' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE task_type='EXTENSION' AND subject='[%s:]' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
// Entry found?
$task_id = 0;
// Search for task id
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_task_system` WHERE subject LIKE '%s%%' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE subject LIKE '%s%%' LIMIT 1",
array($subject), __FUNCTION__, __LINE__);
// Entry found?
// Is it not yet added?
if (!in_array($updateDepends, $GLOBALS['ext_running_updates'])) {
- //* DEBUG */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME()."/".$updateDepends);
+ //* DEBUG */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME().'/'.$updateDepends);
// Add it to the list of extension update depencies map
$GLOBALS['ext_update_depends'][EXT_GET_CURR_NAME()][] = (string) $updateDepends;
if (!isset($GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()])) EXT_INIT_UPDATE_ITERATOR();
// Return it
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME()."/".$GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()]);
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "currName=".EXT_GET_CURR_NAME().'/'.$GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()]);
return $GLOBALS['ext_depend_iterator'][EXT_GET_CURR_NAME()];
}
// So is the extension there?
if (!EXT_IS_ACTIVE($ext_name)) {
// Redirect to index
- LOAD_URL('modules.php?module=index&msg=' . getCode('EXTENSION_PROBLEM') . '&ext=' . $ext_name);
+ redirectToUrl('modules.php?module=index&msg=' . getCode('EXTENSION_PROBLEM') . '&ext=' . $ext_name);
} // END - if
}
ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` ADD default_acl ENUM('deny','allow') NOT NULL DEFAULT 'deny'");
// But allow current admin everything (THIS SHALL BE YOU!)
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admins` SET default_acl='allow' WHERE login='".get_session('admin_login')."' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admins` SET default_acl='allow' WHERE login='".getSession('admin_login')."' LIMIT 1");
ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_admins_acls`");
ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_admins_acls` (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
case '0.6.8': // SQL queries for v0.6.8
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("<strong>set_session()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
+ EXT_SET_UPDATE_NOTES("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
break;
case '0.6.9': // SQL queries for v0.6.9
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
case '0.2.7': // SQL queries for v0.2.7
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
+ EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
break;
case '0.2.8': // SQL queries for v0.2.8
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
+ EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
break;
case '0.2.9': // SQL queries for v0.2.9
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
case '0.0.9': // SQL queries for v0.0.9
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Bitte verschieben Sie die beg-Templates (Ordner: {!PATH!}/templates/".GET_LANGUAGE()."/html/) in den neuen Order beg!");
+ EXT_SET_UPDATE_NOTES("Bitte verschieben Sie die beg-Templates (Ordner: {!PATH!}/templates/".getLanguage()."/html/) in den neuen Order beg!");
break;
case '0.1.0': // SQL queries for v0.2.1
ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD beg_rallye ENUM('Y','N') NOT NULL DEFAULT 'N'");
ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD beg_points FLOAT(21,5) UNSIGNED NOT NULL DEFAULT 0.00000");
- $VIS = "N"; $LOCKED = "Y";
- if (EXT_IS_ACTIVE('beg')) { $VIS = "Y"; $LOCKED = "N"; }
+ $VIS = 'N'; $LOCKED = 'Y';
+ if (EXT_IS_ACTIVE('beg')) { $VIS = 'Y'; $LOCKED = 'N'; }
ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('main','beg2','Bettel-Rallye','".$VIS."','".$LOCKED."','7')");
ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_beg','Bettel-Rallye','Listet alle Teilnehmer der monatlichen Bettel-Rallye auf.','12')");
case '0.3.3': // SQL queries for v0.3.3
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Bitte verschieben Sie die birthday-Templates (Ordner: {!PATH!}/templates/".GET_LANGUAGE()."/html/) in den neuen Order birthday!");
+ EXT_SET_UPDATE_NOTES("Bitte verschieben Sie die birthday-Templates (Ordner: {!PATH!}/templates/".getLanguage()."/html/) in den neuen Order birthday!");
break;
case '0.3.4': // SQL queries for v0.3.4
// Use actual month for this update
ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD login_bonus FLOAT(20,3) NOT NULL DEFAULT 0.000");
ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD turbo_bonus FLOAT(20,3) NOT NULL DEFAULT 0.000");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='Y' WHERE ext_name='bonus' AND ext_has_css='N' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='Y' WHERE `ext_name`='bonus' AND ext_has_css='N' LIMIT 1");
// Update notes (these will be set as task text!)
EXT_SET_UPDATE_NOTES("Login-Bonus und Turbo-Klick-Bonus intergriert.");
case '0.5.6': // SQL queries for v0.5.6
// Get current month
- $curr = date("m", time());
- if (strlen($curr) == 1) $curr = "0".$curr;
+ $curr = date('m', time());
+ if (strlen($curr) == 1) $curr = '0'.$curr;
if ($curr == "00") $curr = "12";
// Generate timemark...
// Update accounts which are not active last months
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_data`
-SET turbo_bonus=0, login_bonus=0, bonus_order=0, bonus_stats=0, bonus_ref=0
-WHERE last_online < ".$mark." ORDER BY userid");
+SET `turbo_bonus`=0, `login_bonus`=0, `bonus_order`=0, `bonus_stats`=0, `bonus_ref`=0
+WHERE `last_online` < ".$mark." ORDER BY `userid` ASC");
// Update notes (these will be set as task text!)
EXT_SET_UPDATE_NOTES("Ein weiterer Scriptfehler hat nur die Gewinner aus der Aktiv-Rallye genommen. Die anderen Mitglieder sind somit "nach oben gerutsch".");
default: // Do stuff when extension is loaded
// Create instance on class
- if ($GLOBALS['cache_mode'] != "init") {
+ if ($GLOBALS['cache_mode'] != 'init') {
// Initialize cache system only when it's needed
$GLOBALS['cache_instance'] = new CacheSystem(getConfig('cache_update'), "inc/".getConfig('cache_path'), getConfig('cache_tested'));
- if ($GLOBALS['cache_instance']->getStatus() != "done") {
+ if ($GLOBALS['cache_instance']->getStatus() != 'done') {
// Failed to initialize cache sustem
addFatalMessage(__FILE__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMessage('CACHE_CANNOT_INITIALIZE'));
} // END - if
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
case '0.0.8': // SQL queries for v0.0.8
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Bitte verschieben Sie die doubler-Templates (Ordner: {!PATH!}/templates/".GET_LANGUAGE()."/html/) in den neuen Order doubler!");
+ EXT_SET_UPDATE_NOTES("Bitte verschieben Sie die doubler-Templates (Ordner: {!PATH!}/templates/".getLanguage()."/html/) in den neuen Order doubler!");
break;
case '0.0.9': // SQL queries for v0.0.9
case '0.0.8': // SQL queries for v0.0.8
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
+ EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
break;
case '0.0.9': // SQL queries for v0.0.9
default: // Do stuff when extension is loaded
// Valid HTML tags (only simple and no attributes!)
$GLOBALS['html_tags'] = array(
- "b",
- "i",
- "u",
- "ol",
- "ul",
- "li",
- "strong",
- "center",
- "left",
- "right",
- "br",
+ 'b',
+ 'i',
+ 'u',
+ 'ol',
+ 'ul',
+ 'li',
+ 'strong',
+ 'center',
+ 'left',
+ 'right',
+ 'br',
);
// URL ends which are used to indentify the end of an URL or email link
// Don't use these chars in links... ;-)
//
$GLOBALS['url_ends'] = array(
- " ",
+ ' ',
"\n",
"\r",
- ")",
+ ')',
);
// Valid email chars (without @, or do you want to have another @ inside your email addy?)
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
} // END - if
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
// Update notes (these will be set as task text!)
EXT_SET_UPDATE_NOTES("Einbindung der Erweiterung <strong>country</strong>, die Sie sich noch optional von <a href=\"{!URL!}/modules.php?module=admin&what=extensions&do=search\">meiner Seite herunterladen</a> müssen.<br />
<br />
-<strong>Wichtig: Laden Sie noch die Template member_mydata_overview und member_mydata_edit (beide zu finden unter templates/".GET_LANGUAGE()."/html/member/ !) mit hoch!</strong>");
+<strong>Wichtig: Laden Sie noch die Template member_mydata_overview und member_mydata_edit (beide zu finden unter templates/".getLanguage()."/html/member/ !) mit hoch!</strong>");
// Depends on 'country'!
EXT_ADD_UPDATE_DEPENDS('country');
switch ($EXT_VER)
{
case '0.0.1': // SQL queries for v0.0.1
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='Y' WHERE ext_name='nickname' AND ext_has_css='N' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='Y' WHERE `ext_name`='nickname' AND ext_has_css='N' LIMIT 1");
// This update depends on sql_patches update!
EXT_ADD_UPDATE_DEPENDS('sql_patches');
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
case '0.4.4': // SQL queries for v0.4.4
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Ein <strong>WHERE ext_active='Y'</strong> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.");
+ EXT_SET_UPDATE_NOTES("Ein <strong>WHERE `ext_active`='Y'</strong> tauchte bei einigen Betreibern auf und ist mit dieser Version beseitigt.");
break;
case '0.4.5': // SQL queries for v0.4.5
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
case '0.2.7': // SQL queries for v0.2.7
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
+ EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
break;
case '0.2.8': // SQL queries for v0.2.8
case '0.1.9': // SQL queries for v0.1.9
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Funktion ADMIN_USER_PROFILE_LINK() mit Verlinkung auf Referal-Liste implementiert.");
+ EXT_SET_UPDATE_NOTES("Funktion <u>generateUserProfileLink()</u> mit Verlinkung auf Referal-Liste implementiert.");
break;
case '0.2.0': // SQL queries for v0.2.0
<li>$DATA[min_users]</li>
<li>$DATA[min_prices]</li>
</ul>
-Zudem sollten Sie mindestens folgende Templates (in <strong>templates/".GET_LANGUAGE()."/html/guest/</strong> !) aktualisieren:<br />
+Zudem sollten Sie mindestens folgende Templates (in <strong>templates/".getLanguage()."/html/guest/</strong> !) aktualisieren:<br />
<ul>
<li><strong>guest_rallye_footer.tpl</strong></li>
<li><strong>guest_rallye_header.tpl</strong></li>
default: // Do stuff when extension is loaded
// Do stuff only when not in CSS mode
- if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && ($GLOBALS['cache_mode'] != "init")) {
+ if (($GLOBALS['output_mode'] != '1') && ($GLOBALS['output_mode'] != '-1') && ($GLOBALS['cache_mode'] != 'init')) {
// Get total member count
- $total = GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true);
+ $total = GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true);
// Add more data on higher versions
$ADD1 = ''; $ADD2 = ''; $OR = '';
break;
case '0.1.1': // SQL queries for v0.1.1
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='Y' WHERE ext_name='register' AND ext_has_css='N' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='Y' WHERE `ext_name`='register' AND ext_has_css='N' LIMIT 1");
// This update depends on sql_patches update!
EXT_ADD_UPDATE_DEPENDS('sql_patches');
// Update notes (these will be set as task text!)
EXT_SET_UPDATE_NOTES("Einbindung der Erweiterung <strong>country</strong>, die Sie sich noch optional von <a href=\"{!URL!}/modules.php?module=admin&what=extensions&do=search\">meiner Seite herunterladen</a> müssen.<br />
<br />
-<strong>Wichtig: Laden Sie noch das Template <strong>guest_register.tpl</strong> mit hoch, welches unter templates/".GET_LANGUAGE()."/html/guest/ zu finden ist!</strong>");
+<strong>Wichtig: Laden Sie noch das Template <strong>guest_register.tpl</strong> mit hoch, welches unter templates/".getLanguage()."/html/guest/ zu finden ist!</strong>");
// Depends on 'country'
EXT_ADD_UPDATE_DEPENDS('country');
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `what`='config_register2' WHERE `what`='config_reg' LIMIT 1");
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Bei der Anmeldung kann die Standart-Auswahl zwischen Ja/Nein umgeschaltet werden. Das Ändern des Templates <strong>templates/".GET_LANGUAGE()."/html/guest/guest_register.tpl</strong> ist nicht mehr nötig.");
+ EXT_SET_UPDATE_NOTES("Bei der Anmeldung kann die Standart-Auswahl zwischen Ja/Nein umgeschaltet werden. Das Ändern des Templates <strong>templates/".getLanguage()."/html/guest/guest_register.tpl</strong> ist nicht mehr nötig.");
break;
case '0.4.3': // SQL queries for v0.4.3
case '0.4.7': // SQL queries for v0.4.7
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("<strong>set_session()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
+ EXT_SET_UPDATE_NOTES("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
break;
case '0.4.8': // SQL queries for v0.4.8
case '0.5.0': // SQL queries for v0.5.0
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Fehlermeldung <em><strong>Fatal error:</strong> Call to undefined function REGISTER_ADD_CATEGORY_TABLE() in <strong>{!PATH!}/inc/modules/guest/what-register.php</strong> on line <strong>434</strong></em> beseitigt.");
+ EXT_SET_UPDATE_NOTES("Fehlermeldung <em><strong>Fatal error:</strong> Call to undefined function registerGenerateCategoryTable() in <strong>{!PATH!}/inc/modules/guest/what-register.php</strong> on line <strong>434</strong></em> beseitigt.");
break;
case '0.5.1': // SQL queries for v0.5.1
{
case 'register': // Do stuff when installation is running (modules.php?module=admin&action=login is called)
// Check if mod_rewrite is loadeded
- if (!IF_APACHE_MODULE_LOADED('mod_rewrite')){
+ if (!isApacheModuleLoaded('mod_rewrite')){
EXT_SET_REPORTS_FAILURE(true);
addFatalMessage(__FILE__, __LINE__, getMessage('MOD_REWRITE_ERROR'));
} // END - if
case 'activate': // Do stuff when admin activates this extension
// Check if mod_rewrite is loadeded
- if (!IF_APACHE_MODULE_LOADED('mod_rewrite')) {
- SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_active='N' WHERE ext_name='rewrite' LIMIT 1", __FILE__, __LINE__);
+ if (!isApacheModuleLoaded('mod_rewrite')) {
+ SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET `ext_active`='N' WHERE `ext_name`='rewrite' LIMIT 1", __FILE__, __LINE__);
EXT_SET_REPORTS_FAILURE(true);
addFatalMessage(__FILE__, __LINE__, getMessage('MOD_REWRITE_ERROR'));
} // END - if
break;
case '0.1.3':
// Check if mod_rewrite is loadeded
- if (!IF_APACHE_MODULE_LOADED('mod_rewrite')){
+ if (!isApacheModuleLoaded('mod_rewrite')){
EXT_SET_REPORTS_FAILURE(true);
//addFatalMessage(__FILE__, __LINE__, getMessage('MOD_REWRITE_ERROR'));
} // END - if
default: // Do stuff when extension is loaded
// Check if mod_rewrite is loadeded
- if (!IF_APACHE_MODULE_LOADED('mod_rewrite')){
+ if (!isApacheModuleLoaded('mod_rewrite')){
EXT_SET_REPORTS_FAILURE(true);
- SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_active='N' WHERE ext_name='rewrite' LIMIT 1", __FILE__, __LINE__);
+ SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET `ext_active`='N' WHERE `ext_name`='rewrite' LIMIT 1", __FILE__, __LINE__);
if (!IS_ADMIN()) addFatalMessage(__FILE__, __LINE__, getMessage('MOD_REWRITE_ERROR'));
} // END - if
break;
//
// Add default entries
//
- ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_registry` (ext_name, is_active, aid, stamp_added) VALUES ('sponsor','N',".GET_CURRENT_ADMIN_ID().",UNIX_TIMESTAMP())");
+ ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_registry` (ext_name, is_active, aid, stamp_added) VALUES ('sponsor','N',".getCurrentAdminId().",UNIX_TIMESTAMP())");
ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_action_convert` (ext_name, conv_rate, conv_name) VALUES ('sponsor','10','Mails')");
ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_paytypes` (pay_name, pay_min_count, pay_rate, pay_currency) VALUES ('Standart-Paket', 5, 1000.00000, '€')");
ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_paytypes` (pay_name, pay_min_count, pay_rate, pay_currency) VALUES ('Spar-Paket', 1, 200.00000, '€')");
break;
case '0.2.4': // SQL queries for v0.2.4
- $auto_type = "png"; // PNG image is the default
- if ((INCLUDE_READABLE("theme/".GET_CURR_THEME()."/images/code_bg.jpg")) && function_exists('imagecreatefromjpeg')) {
+ $auto_type = 'png'; // PNG image is the default
+ if ((isIncludeReadable('theme/'.getCurrentTheme().'/images/code_bg.jpg')) && function_exists('imagecreatefromjpeg')) {
// Switch to JPEG format
- $auto_type = "jpg";
+ $auto_type = 'jpg';
}
ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD img_type ENUM('jpg','png') NOT NULL DEFAULT '".$auto_type."'");
setConfigEntry('secret_key', '');
// Read key from secret file
- if ((getConfig('file_hash') == "") || (getConfig('master_salt') == "") || (getConfig('pass_scramble') == "")) {
+ if ((getConfig('file_hash') == '') || (getConfig('master_salt') == '') || (getConfig('pass_scramble') == '')) {
// Cache instance
// Maybe need setup of secret key!
- LOAD_INC_ONCE("inc/gen_sql_patches.php");
+ loadIncludeOnce('inc/gen_sql_patches.php');
// @TODO Rewrite this to a filter!
if ((GET_EXT_VERSION('cache') >= '0.1.2') && (isCacheInstanceValid())) {
// Remove extensions and mod_reg cache file
- LOAD_INC_ONCE("inc/libs/cache_functions.php");
+ loadIncludeOnce('inc/libs/cache_functions.php');
require(sprintf("%sinc/extensions/ext-cache.php", constant('PATH')));
if ($GLOBALS['cache_instance']->loadCacheFile("extensions", true)) $GLOBALS['cache_instance']->destroyCacheFile();
if ($GLOBALS['cache_instance']->loadCacheFile("modreg")) $GLOBALS['cache_instance']->destroyCacheFile();
} // END - if
// Test again
- if ((getConfig('file_hash') != "") && (getConfig('master_salt') != "") && (getConfig('pass_scramble') != "")) {
+ if ((getConfig('file_hash') != '') && (getConfig('master_salt') != '') && (getConfig('pass_scramble') != '')) {
// File hash fas generated so we can also file the secret file... hopefully.
$hashFile = sprintf("%sinc/.secret/.%s", constant('PATH'), getConfig('file_hash'));
- if (FILE_READABLE($hashFile)) {
+ if (isFileReadable($hashFile)) {
// Read file
- setConfigEntry('secret_key', READ_FILE($hashFile));
+ setConfigEntry('secret_key', readFromFile($hashFile));
} else {
// Remove it from database
- UPDATE_CONFIG("file_hash", '');
+ updateConfiguration('file_hash', '');
// Cannot read secret file!
app_die(__FILE__, __LINE__, "Cannot read secret file! Please try to reload");
} else {
// Set some lame ( ;-) ) default settings
setConfigEntry('def_refid' , 0);
- setConfigEntry('enable_title_deco', "N");
- setConfigEntry('title_mod_show' , "Y");
- setConfigEntry('title_middle' , "-");
- // @TODO Can we remove this? setConfigEntry('verbose_sql' , "N");
+ setConfigEntry('enable_title_deco', 'N');
+ setConfigEntry('title_mod_show' , 'Y');
+ setConfigEntry('title_middle' , '-');
+ // @TODO Can we remove this? setConfigEntry('verbose_sql' , 'N');
define('MT_WORD' , getMessage('DEFAULT_MT_WORD'));
define('MT_WORD2', getMessage('DEFAULT_MT_WORD2'));
define('MT_WORD3', getMessage('DEFAULT_MT_WORD3'));
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
break;
default: // Do stuff when extension is loaded
- // Set some constants we need???
- define('edit', "edit");
+ // @TODO Set some constants we need???
+ define('edit', 'edit');
break;
}
switch ($EXT_VER)
{
case '0.0.1': // SQL queries for v0.0.1
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='Y' WHERE ext_name='task' AND ext_has_css='N' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='Y' WHERE `ext_name`='task' AND ext_has_css='N' LIMIT 1");
// This update depends on sql_patches update!
EXT_ADD_UPDATE_DEPENDS('sql_patches');
case '0.1.3': // SQL queries for v0.1.3
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
+ EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
break;
case '0.1.4': // SQL queries for v0.1.4
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
case '0.0.5': // SQL queries for v0.0.5
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("<strong>set_session()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
+ EXT_SET_UPDATE_NOTES("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
break;
case '0.0.6': // SQL queries for v0.0.6
case '0.1.4': // SQL queries for v0.1.4
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
+ EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
break;
case '0.1.5': // SQL queries for v0.1.5
case '0.1.9': // SQL queries for v0.1.9
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
+ EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
break;
case '0.2.0': // SQL queries for v0.2.0
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
// [EOF]
?>
EXT_SET_VER_HISTORY(array('0.0'));
// This extension is deprecated!
-// Only since 'network' is ready! EXT_SET_DEPRECATED("Y");
+// Only since 'network' is ready! EXT_SET_DEPRECATED('Y');
switch ($EXT_LOAD_MODE)
{
}
// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
//
?>
$CORR = getMessage('FATAL_REPORT_ERRORS');
// PHP warnings fixed
- if ($check == "done") {
+ if ($check == 'done') {
if (IS_ADMIN()) $CORR = getMessage('FATAL_CORRECT_ERRORS');
} // END - if
// Filters for post-extension-registration
REGISTER_FILTER('post_extension_installed', 'AUTO_ACTIVATE_EXTENSION');
REGISTER_FILTER('post_extension_installed', 'SOLVE_TASK');
- REGISTER_FILTER('post_extension_installed', 'LOAD_INCLUDES');
+ REGISTER_FILTER('post_extension_installed', 'loadIncludeLUDES');
REGISTER_FILTER('post_extension_installed', 'REMOVE_UPDATES');
// Solving tasks
REGISTER_FILTER('solve_task', 'SOLVE_TASK');
// Loading includes in general
- REGISTER_FILTER('load_includes', 'LOAD_INCLUDES');
+ REGISTER_FILTER('load_includes', 'loadIncludeLUDES');
// Run SQLs
REGISTER_FILTER('run_sqls', 'RUN_SQLS');
// Shall we add it?
if (!$dry_run) {
// Simply add it to the array
- $GLOBALS['filters']['chains'][$filterName][$filterFunction] = "Y";
+ $GLOBALS['filters']['chains'][$filterName][$filterFunction] = 'Y';
$GLOBALS['filters']['counter'][$filterName][$filterFunction] = 0;
} // END - if
}
// Is the element set?
if (isset($GLOBALS['ext_load_mode'])) {
// Redirect here
- LOAD_URL('modules.php?module=admin&logout=1&' . $GLOBALS['ext_load_mode'] . '=sql_patches');
+ redirectToUrl('modules.php?module=admin&logout=1&' . $GLOBALS['ext_load_mode'] . '=sql_patches');
} // END - if
// This should not happen!
}
// Filter to load include files
-function FILTER_LOAD_INCLUDES () {
+function FILTER_loadIncludeLUDES () {
// Default is $data as inclusion list
$data = GET_INC_POOL();
if (COUNT_INC_POOL() > 0) {
// Loads every include file
foreach (GET_INC_POOL() as $FQFN) {
- LOAD_INC_ONCE($FQFN);
+ loadIncludeOnce($FQFN);
} // END - foreach
// Reset array
if (!IS_MEMBER()) return false;
// Secure user ID
- setUserId(get_session('userid'));
+ setUserId(getSession('userid'));
// Load last module and last online time
$result = SQL_QUERY_ESC("SELECT last_module, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
if (empty($GLOBALS['what'])) {
// Fix it to default
$GLOBALS['what'] = "welcome";
- if (getConfig('index_home') != "") $GLOBALS['what'] = getConfig('index_home');
+ if (getConfig('index_home') != '') $GLOBALS['what'] = getConfig('index_home');
} // END - if
// Update last module / online time
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `last_module`='%s', last_online=UNIX_TIMESTAMP(), REMOTE_ADDR='%s' WHERE userid=%s LIMIT 1",
- array($GLOBALS['what'], GET_REMOTE_ADDR(), getUserId()), __FUNCTION__, __LINE__);
+ array($GLOBALS['what'], detectRemoteAddr(), getUserId()), __FUNCTION__, __LINE__);
} else {
// Destroy session, we cannot update!
- destroy_user_session();
+ destroyUserSession();
}
// Free the result
$action = SQL_ESCAPE($GLOBALS['action']);
if (!empty($GLOBALS['what'])) {
// Get action value by what-value
- $action = GET_ACTION('admin', $GLOBALS['what']);
+ $action = getModeAction('admin', $GLOBALS['what']);
} // END - if
// Check for access control line of current menu entry
- $ret = ADMINS_CHECK_ACL($action, $GLOBALS['what']);
+ $ret = adminsCheckAdminAcl($action, $GLOBALS['what']);
} // END - if
// Return result
// Output the generated HTML code or do nothing in direct-mode
if (getTotalFatalErrors() > 0) {
// Output fatal error messages
- LOAD_INC_ONCE("inc/fatal_errors.php");
+ loadIncludeOnce("inc/fatal_errors.php");
} // END - if
// Shall we display the copyright notice?
// Shall we display the parsing time and number of queries?
if ((GET_EXT_VERSION('sql_patches') >= '0.4.1') && (getConfig('show_timings') == 'Y') && (!REQUEST_ISSET_GET(('frame'))) && ($GLOBALS['header_sent'] == "2")) {
// Then display it here
- DISPLAY_PARSING_TIME_FOOTER();
+ displayParsingTime();
} // END - if
// Load page footer
// That's why you don't need any \n at the end of your HTML code... :-)
if (constant('_OB_CACHING') == "on") {
// Output into PHP's internal buffer
- OUTPUT_RAW($HTML);
+ outputRawCode($HTML);
// That's why you don't need any \n at the end of your HTML code... :-)
if ($newLine) echo "\n";
}
break;
- case "direct":
+ case 'direct':
// If we are switching from render to direct output rendered code
- if ((!empty($OUTPUT)) && (constant('_OB_CACHING') != "on")) { OUTPUT_RAW($OUTPUT); $OUTPUT = ''; }
+ if ((!empty($OUTPUT)) && (constant('_OB_CACHING') != "on")) { outputRawCode($OUTPUT); $OUTPUT = ''; }
// The same as above... ^
- OUTPUT_RAW($HTML);
+ outputRawCode($HTML);
if ($newLine) echo "\n";
break;
// Extension 'rewrite' installed?
if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
- $OUTPUT = REWRITE_LINKS($OUTPUT);
+ $OUTPUT = rewriteLinksInCode($OUTPUT);
} // END - if
// Compile and run finished rendered HTML code
} // END - while
// Output code here, DO NOT REMOVE! ;-)
- OUTPUT_RAW($OUTPUT);
+ outputRawCode($OUTPUT);
} elseif ((constant('OUTPUT_MODE') == "render") && (!empty($OUTPUT))) {
// Rewrite links when rewrite extension is active
if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
- $OUTPUT = REWRITE_LINKS($OUTPUT);
+ $OUTPUT = rewriteLinksInCode($OUTPUT);
} // END - if
// Compile and run finished rendered HTML code
} // END - while
// Output code here, DO NOT REMOVE! ;-)
- OUTPUT_RAW($OUTPUT);
+ outputRawCode($OUTPUT);
}
}
// Output the raw HTML code
-function OUTPUT_RAW ($HTML) {
+function outputRawCode ($HTML) {
// Output stripped HTML code to avoid broken JavaScript code, etc.
echo stripslashes(stripslashes($HTML));
// Add a fatal error message to the queue array
function addFatalMessage ($F, $L, $message, $extra='') {
- debug_report_bug($message);
if (is_array($extra)) {
// Multiple extras for a message with masks
$message = call_user_func_array('sprintf', $extra);
incrementConfigEntry('num_templates');
// Prepare IP number and User Agent
- $REMOTE_ADDR = GET_REMOTE_ADDR();
+ $REMOTE_ADDR = detectRemoteAddr();
if (!defined('REMOTE_ADDR')) define('REMOTE_ADDR', $REMOTE_ADDR);
- $HTTP_USER_AGENT = GET_USER_AGENT();
+ $HTTP_USER_AGENT = detectUserAgent();
// Init some data
$ret = '';
$content = merge_array($content, SQL_FETCHARRAY($result));
// Translate gender
- $content['gender'] = TRANSLATE_GENDER($content['gender']);
+ $content['gender'] = translateGender($content['gender']);
} else {
// @DEPRECATED
// @TODO Fine all templates which are using these direct variables and rewrite them.
list($gender, $surname, $family, $email) = SQL_FETCHROW($result);
// Translate gender
- $gender = TRANSLATE_GENDER($gender);
+ $gender = translateGender($gender);
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("DEPRECATION-WARNING: content is not array (%s).", gettype($content)));
}
} // END - if
// Generate date/time string
- $date_time = MAKE_DATETIME(time(), "1");
+ $date_time = generateDateTime(time(), "1");
// Base directory
- $basePath = sprintf("%stemplates/%s/html/", constant('PATH'), GET_LANGUAGE());
+ $basePath = sprintf("%stemplates/%s/html/", constant('PATH'), getLanguage());
$mode = '';
// Check for admin/guest/member templates
$test = substr($template, 0, strpos($template, "_"));
if (EXT_IS_ACTIVE($test)) {
// Set extra path to extension's name
- $mode = $test."/";
+ $mode = $test.'/';
}
}
);
// Probe for it...
- if (FILE_READABLE($file2)) $FQFN = $file2;
+ if (isFileReadable($file2)) $FQFN = $file2;
// Remove variable from memory
unset($file2);
}
// Does the special template exists?
- if (!FILE_READABLE($FQFN)) {
+ if (!isFileReadable($FQFN)) {
// Reset to default template
$FQFN = $basePath.$template.".tpl";
} // END - if
// Now does the final template exists?
- if (FILE_READABLE($FQFN)) {
+ if (isFileReadable($FQFN)) {
// The local file does exists so we load it. :)
- $tmpl_file = READ_FILE($FQFN);
+ $tmpl_file = readFromFile($FQFN);
// Replace ' to our own chars to preventing them being quoted
while (strpos($tmpl_file, "'") !== false) { $tmpl_file = str_replace("'", '{QUOT}', $tmpl_file); }
}
// Send mail out to an email address
-function SEND_EMAIL($toEmail, $subject, $message, $HTML = "N", $mailHeader = "") {
+function sendEmail($toEmail, $subject, $message, $HTML = 'N', $mailHeader = '') {
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):TO={$toEmail},SUBJECT={$subject}<br />\n";
// Compile subject line (for POINTS constant etc.)
// Free result
SQL_FREERESULT($result_email);
}
- } elseif ("$toEmail" == "0") {
+ } elseif ("$toEmail" == '0') {
// Is the webmaster!
$toEmail = constant('WEBMASTER');
}
eval($eval);
// Fix HTML parameter (default is no!)
- if (empty($HTML)) $HTML = "N";
+ if (empty($HTML)) $HTML = 'N';
if (isDebugModeEnabled()) {
// In debug mode we want to display the mail instead of sending it away so we can debug this part
print("<pre>
// @TODO Rewrite this to an extension 'smtp'
// @private
function CHECK_PHPMAILER_USAGE() {
- return ((defined('SMTP_HOSTNAME')) && (defined('SMTP_USER')) && (defined('SMTP_PASSWORD')) && (constant('SMTP_HOSTNAME') != "") && (constant('SMTP_USER') != ""));
+ return ((defined('SMTP_HOSTNAME')) && (defined('SMTP_USER')) && (defined('SMTP_PASSWORD')) && (constant('SMTP_HOSTNAME') != '') && (constant('SMTP_USER') != ''));
}
/*
// Shall we use PHPMailer class or legacy mode?
if (CHECK_PHPMAILER_USAGE()) {
// Use PHPMailer class with SMTP enabled
- LOAD_INC_ONCE("inc/phpmailer/class.phpmailer.php");
- LOAD_INC_ONCE("inc/phpmailer/class.smtp.php");
+ loadIncludeOnce("inc/phpmailer/class.phpmailer.php");
+ loadIncludeOnce("inc/phpmailer/class.smtp.php");
// get new instance
$mail = new PHPMailer();
@mail($toEmail, $subject, decodeEntities($msg), $from);
}
}
-//
// Generate a password in a specified length or use default password length
-function GEN_PASS ($LEN = 0) {
+function generatePassword ($LEN = 0) {
// Auto-fix invalid length of zero
if ($LEN == 0) $LEN = getConfig('pass_len');
// Initialize array with all allowed chars
- $ABC = explode(",", "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9,-,+,_,/");
+ $ABC = explode(',', 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9,-,+,_,/');
// Start creating password
$PASS = '';
$PASS .= $ABC[mt_rand(0, count($ABC) -1)];
} // END - for
- // When the size is below 40 we can also add additional security by scrambling it
+ // When the size is below 40 we can also add additional security by scrambling
+ // it. Otherwise we may corrupt hashes
if (strlen($PASS) <= 40) {
// Also scramble the password
$PASS = scrambleString($PASS);
// Return the password
return $PASS;
}
-//
-function MAKE_DATETIME ($time, $mode="0")
-{
+
+// Generates a human-readable timestamp from the Uni* stamp
+function generateDateTime ($time, $mode = '0') {
+ // Filter out numbers
+ $time = bigintval($time);
+
+ // If the stamp is zero it mostly didn't "happen"
if ($time == 0) {
// Never happend
- return NEVER_HAPPENED;
- } else {
- // Filter out numbers
- $time = bigintval($time);
- }
+ return getMessage('NEVER_HAPPENED');
+ } // END - if
- switch (GET_LANGUAGE())
+ switch (getLanguage())
{
- case "de": // German date / time format
+ case 'de': // German date / time format
switch ($mode) {
- case "0": $ret = date("d.m.Y \u\m H:i \U\h\\r", $time); break;
- case "1": $ret = strtolower(date("d.m.Y - H:i", $time)); break;
- case "2": $ret = date("d.m.Y|H:i", $time); break;
- case "3": $ret = date("d.m.Y", $time); break;
+ case '0': $ret = date("d.m.Y \u\m H:i \U\h\\r", $time); break;
+ case '1': $ret = strtolower(date("d.m.Y - H:i", $time)); break;
+ case '2': $ret = date("d.m.Y|H:i", $time); break;
+ case '3': $ret = date("d.m.Y", $time); break;
default:
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid date mode %s detected.", $mode));
break;
}
break;
- default: // Default is the US date / time format!
+ default: // Default is the US date / time format!
switch ($mode) {
- case "0": $ret = date("r", $time); break;
- case "1": $ret = date("Y-m-d - g:i A", $time); break;
- case "2": $ret = date("y-m-d|H:i", $time); break;
- case "3": $ret = date("y-m-d", $time); break;
+ case '0': $ret = date("r", $time); break;
+ case '1': $ret = date("Y-m-d - g:i A", $time); break;
+ case '2': $ret = date("y-m-d|H:i", $time); break;
+ case '3': $ret = date("y-m-d", $time); break;
default:
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid date mode %s detected.", $mode));
break;
return $ret;
}
+// Translates Y/N to yes/no
+function translateYesNo ($yn) {
+ // Default
+ $translated = "??? (".$yn.")";
+ switch ($yn) {
+ case 'Y': $translated = getMessage('YES'); break;
+ case 'N': $translated = getMessage('NO'); break;
+ default:
+ // Log unknown value
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown value %s. Expected Y/N!", $yn));
+ break;
+ }
+
+ // Return it
+ return $translated;
+}
+
+// Translates the "pool type" into human-readable
+function translatePoolType ($type) {
+ // Default?type is unknown
+ $translated = sprintf(getMessage('POOL_TYPE_UNKNOWN'), $type);
+
+ // Generate constant
+ $constName = sprintf("POOL_TYPE_%s", $type);
+
+ // Does it exist?
+ if (defined($constName)) {
+ // Then use it
+ $translated = getMessage($constName);
+ } // END - if
+
+ // Return "translation"
+ return $translated;
+}
+
// Translates the american decimal dot into a german comma
-function TRANSLATE_COMMA ($dotted, $cut=true, $max=0) {
+function translateComma ($dotted, $cut = true, $max = 0) {
// Default is 3 you can change this in admin area "Misc -> Misc Options"
- if (!isConfigEntrySet('max_comma')) setConfigEntry('max_comma', "3");
+ if (!isConfigEntrySet('max_comma')) setConfigEntry('max_comma', '3');
// Use from config is default
$maxComma = getConfig('max_comma');
// Cut zeros off?
if (($cut) && ($max == 0)) {
// Test for commata if in cut-mode
- $com = explode(".", $dotted);
+ $com = explode('.', $dotted);
if (count($com) < 2) {
// Don't display commatas even if there are none... ;-)
$maxComma = 0;
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "dotted={$dotted},maxComma={$maxComma}");
// Translate it now
- switch (GET_LANGUAGE()) {
- case "de":
- $dotted = number_format($dotted, $maxComma, ",", ".");
+ switch (getLanguage()) {
+ case 'de':
+ $dotted = number_format($dotted, $maxComma, ',', '.');
break;
default:
- $dotted = number_format($dotted, $maxComma, ".", ",");
+ $dotted = number_format($dotted, $maxComma, '.', ',');
break;
}
return $dotted;
}
-//
-function DEREFERER ($URL) {
- // Don't de-refer our own links!
- if (substr($URL, 0, strlen(URL)) != URL) {
- // De-refer this link
- $URL = 'modules.php?module=loader&url=' . encodeString(compileUriCode($URL));
- } // END - if
-
- // Return link
- return $URL;
-}
-
// Translate Uni*-like gender to human-readable
-function TRANSLATE_GENDER ($gender) {
+function translateGender ($gender) {
// Default
$ret = '!' . $gender . '!';
return $ret;
}
-//
-function FRAMETESTER ($URL) {
- // Prepare frametester URL
- $frametesterUrl = sprintf("{!URL!}/modules.php?module=frametester&url=%s",
- encodeString(compileUriCode($URL))
- );
- return $frametesterUrl;
-}
-
-//
-function SELECTION_COUNT ($array) {
- $ret = 0;
- if (is_array($array)) {
- foreach ($array as $key => $selected) {
- if (!empty($selected)) $ret++;
- }
- }
- return $ret;
-}
-
-//
-function IMG_CODE ($code, $type, $DATA, $uid) {
- return '<IMG border="0" alt="Code" src="{!URL!}/mailid_top.php?uid=' . $uid . '&' . $type . '=' . $DATA . '&mode=img&code=' . $code . '" />';
-}
-
-//
-function TRANSLATE_STATUS ($status) {
+// "Translates" the user status
+function translateUserStatus ($status) {
switch ($status)
{
case 'UNCONFIRMED':
// Return it
return $ret;
}
-//
-function GET_LANGUAGE() {
+
+// Generates an URL for the dereferer
+function DEREFERER ($URL) {
+ // Don't de-refer our own links!
+ if (substr($URL, 0, strlen(constant('URL'))) != constant('URL')) {
+ // De-refer this link
+ $URL = 'modules.php?module=loader&url=' . encodeString(compileUriCode($URL));
+ } // END - if
+
+ // Return link
+ return $URL;
+}
+
+// Generates an URL for the frametester
+function FRAMETESTER ($URL) {
+ // Prepare frametester URL
+ $frametesterUrl = sprintf("{!URL!}/modules.php?module=frametester&url=%s",
+ encodeString(compileUriCode($URL))
+ );
+ return $frametesterUrl;
+}
+
+// Count entries from e.g. a selection box
+function countSelection ($array) {
+ $ret = 0;
+ if (is_array($array)) {
+ foreach ($array as $key => $selected) {
+ if (!empty($selected)) $ret++;
+ }
+ }
+ return $ret;
+}
+
+// Wrapper for $_POST['sel']
+function countPostSelection () {
+ return countSelection(REQUEST_POST('sel'));
+}
+
+// Generate XHTML code for the CAPTCHA
+function generateCaptchaCode ($code, $type, $DATA, $uid) {
+ return '<IMG border="0" alt="Code" src="{!URL!}/mailid_top.php?uid=' . $uid . '&' . $type . '=' . $DATA . '&mode=img&code=' . $code . '" />';
+}
+
+// "Getter" for language
+function getLanguage () {
// Set default return value to default language from config
$ret = constant('DEFAULT_LANG');
$ret = $GLOBALS['cache_array']['language'];
} elseif (!empty($lang)) {
// Check if main language file does exist
- if (FILE_READABLE(constant('PATH').'inc/language/'.$lang.'.php')) {
+ if (isFileReadable(constant('PATH').'inc/language/'.$lang.'.php')) {
// Okay found, so let's update cookies
- SET_LANGUAGE($lang);
+ setLanguage($lang);
}
} elseif (!isSessionVariableSet('mx_lang')) {
// Return stored value from cookie
- $ret = get_session('mx_lang');
+ $ret = getSession('mx_lang');
// Fixes a warning before the session has the mx_lang constant
if (empty($ret)) $ret = constant('DEFAULT_LANG');
// Return value
return $ret;
}
-//
-function SET_LANGUAGE ($lang) {
+
+// "Setter" for language
+function setLanguage ($lang) {
// Accept only first 2 chars!
$lang = substr(SQL_ESCAPE(strip_tags($lang)), 0, 2);
// Set cookie
- set_session('mx_lang', $lang);
+ setSession('mx_lang', $lang);
}
-//
-function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID='0') {
+
+// Loads an email template and compiles it
+function LOAD_EMAIL_TEMPLATE ($template, $content = array(), $UID = '0') {
global $DATA, $_CONFIG;
// Make sure all template names are lowercase!
$nick = '---';
// Prepare IP number and User Agent
- $REMOTE_ADDR = GET_REMOTE_ADDR();
- $HTTP_USER_AGENT = GET_USER_AGENT();
+ $REMOTE_ADDR = detectRemoteAddr();
+ $HTTP_USER_AGENT = detectUserAgent();
// Default admin
$ADMIN = constant('MAIN_TITLE');
// Is the admin logged in?
if (IS_ADMIN()) {
// Get admin id
- $aid = GET_CURRENT_ADMIN_ID();
+ $aid = getCurrentAdminId();
// Load Admin data
- $ADMIN = GET_ADMIN_EMAIL($aid);
+ $ADMIN = getAdminEmail($aid);
} // END - if
// Neutral email address is default
$email = constant('WEBMASTER');
// Expiration in a nice output format
+ // NOTE: Use $content[expiration] in your templates instead of $EXPIRATION
if (getConfig('auto_purge') == 0) {
// Will never expire!
$EXPIRATION = getMessage('MAIL_WILL_NEVER_EXPIRE');
} else {
// Create nice date string
- $EXPIRATION = CREATE_FANCY_TIME(getConfig('auto_purge'));
+ $EXPIRATION = createFancyTime(getConfig('auto_purge'));
}
// Is content an array?
} // END - if
// Translate M to male or F to female if present
- if (isset($content['gender'])) $content['gender'] = TRANSLATE_GENDER($content['gender']);
+ if (isset($content['gender'])) $content['gender'] = translateGender($content['gender']);
// Overwrite email from data if present
if (isset($content['email'])) $email = $content['email'];
$DATA['email'] = $email;
// Base directory
- $basePath = sprintf("%stemplates/%s/emails/", constant('PATH'), GET_LANGUAGE());
+ $basePath = sprintf("%stemplates/%s/emails/", constant('PATH'), getLanguage());
// Check for admin/guest/member templates
- if (strpos($template, "admin_") > -1) {
+ if (strpos($template, 'admin_') > -1) {
// Admin template found
- $FQFN = $basePath."admin/".$template.".tpl";
- } elseif (strpos($template, "guest_") > -1) {
+ $FQFN = $basePath.'admin/'.$template.'.tpl';
+ } elseif (strpos($template, 'guest_') > -1) {
// Guest template found
- $FQFN = $basePath."guest/".$template.".tpl";
- } elseif (strpos($template, "member_") > -1) {
+ $FQFN = $basePath.'guest/'.$template.'.tpl';
+ } elseif (strpos($template, 'member_') > -1) {
// Member template found
- $FQFN = $basePath."member/".$template.".tpl";
+ $FQFN = $basePath.'member/'.$template.'.tpl';
} else {
// Test for extension
- $test = substr($template, 0, strpos($template, "_"));
+ $test = substr($template, 0, strpos($template, '_'));
if (EXT_IS_ACTIVE($test)) {
// Set extra path to extension's name
- $FQFN = $basePath.$test."/".$template.".tpl";
+ $FQFN = $basePath.$test.'/'.$template.'.tpl';
} else {
// No special filename
- $FQFN = $basePath.$template.".tpl";
+ $FQFN = $basePath.$template.'.tpl';
}
}
// Does the special template exists?
- if (!FILE_READABLE($FQFN)) {
+ if (!isFileReadable($FQFN)) {
// Reset to default template
- $FQFN = $basePath.$template.".tpl";
+ $FQFN = $basePath.$template.'.tpl';
} // END - if
// Now does the final template exists?
$newContent = '';
- if (FILE_READABLE($FQFN)) {
+ if (isFileReadable($FQFN)) {
// The local file does exists so we load it. :)
- $tmpl_file = READ_FILE($FQFN);
+ $tmpl_file = readFromFile($FQFN);
$tmpl_file = SQL_ESCAPE($tmpl_file);
// Run code
// Return compiled content
return COMPILE_CODE($newContent);
}
-//
-function MAKE_TIME ($H, $M, $S, $stamp) {
+
+// Generates a timestamp (wrapper for mktime())
+function makeTime ($H, $M, $S, $stamp) {
// Extract day, month and year from given timestamp
- $DAY = date("d", $stamp);
- $MONTH = date("m", $stamp);
- $YEAR = date('Y', $stamp);
+ $day = date('d', $stamp);
+ $month = date('m', $stamp);
+ $year = date('Y', $stamp);
// Create timestamp for wished time which depends on extracted date
- return mktime($H, $M, $S, $MONTH, $DAY, $YEAR);
+ return mktime($H, $M, $S, $month, $day, $year);
}
-//
-function LOAD_URL ($URL, $addUrlData=true) {
+
+// Redirects to an URL and if neccessarry extends it with own base URL
+function redirectToUrl ($URL, $addUrlData=true) {
// Compile out URI codes
$URL = compileUriCode($URL);
// Check if http(s):// is there
- if ((substr($URL, 0, 7) != "http://") && (substr($URL, 0, 8) != "https://")) {
+ if ((substr($URL, 0, 7) != 'http://') && (substr($URL, 0, 8) != 'https://')) {
// Make all URLs full-qualified
- $URL = "".$URL;
+ $URL = constant('URL') . '/' . $URL;
} // END - if
// Three different debug ways...
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, $URL);
//* DEBUG: */ die($URL);
+ // Default 'rel' value is external, nofollow is evil from Google and hurts the Internet
+ $rel = ' rel="external"';
+
+ // Do we have internal or external URL?
+ if (substr($URL, 0, strlen(constant('URL'))) == constant('URL')) {
+ // Own (=internal) URL
+ $rel = '';
+ } // END - if
+
// Get output buffer
$OUTPUT = ob_get_contents();
} // END - if
// Add some data to URL if cookies are not accepted
- if (((!defined('__COOKIES')) || (!constant('__COOKIES'))) && ($addUrlData)) $URL = ADD_URL_DATA($URL);
+ if ((!isBooleanConstantAndTrue('__COOKIES')) && ($addUrlData === true)) $URL = addUrlData($URL);
- // Probe for bot from search engine
- if ((eregi("spider", GET_USER_AGENT())) || (eregi("bot", GET_USER_AGENT()))) {
- // Search engine bot detected so let's rewrite many chars for the link
- $URL = htmlentities(strip_tags($URL), ENT_QUOTES);
+ // Secure the URL against bad things such als HTML insertions and so on...
+ $URL = htmlentities(strip_tags($URL), ENT_QUOTES);
+ // Simple probe for bots/spiders from search engines
+ if ((strpos(detectUserAgent(), 'spider') !== false) || (strpos(detectUserAgent(), 'bot') !== false)) {
// Output new location link as anchor
- OUTPUT_HTML("<a href=\"".$URL."\">".$URL."</a>");
+ OUTPUT_HTML('<a href="' . $URL . '"' . $rel . '>' . $URL . '</a>');
} elseif (!headers_sent()) {
// Load URL when headers are not sent
//* DEBUG: */ debug_report_bug("URL={$URL}");
- header ("Location: ".str_replace("&", "&", $URL));
+ header ('Location: '.str_replace('&', '&', $URL));
} else {
// Output error message
- LOAD_INC('inc/header.php');
- LOAD_TEMPLATE("redirect_url", false, str_replace("&", "&", $URL));
- LOAD_INC('inc/footer.php');
+ loadInclude('inc/header.php');
+ LOAD_TEMPLATE('redirect_url', false, str_replace('&', '&', $URL));
+ loadInclude('inc/footer.php');
}
// Shut the mailer down here
shutdown();
}
-// Wrapper for LOAD_URL but URL comes from a configuration entry
+// Wrapper for redirectToUrl but URL comes from a configuration entry
function LOAD_CONFIGURED_URL ($configEntry) {
// Get the URL
$URL = getConfig($configEntry);
} // END - if
// Load the URL
- LOAD_URL($URL);
+ redirectToUrl($URL);
}
//
// Return compiled code
return $code;
}
-//
+
/************************************************************************
* *
* Gaenderter Sortier-Algorythmus, $array wird nach dem Array (!) *
}
//
-function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") {
+function ADD_SELECTION ($type, $default, $prefix = '', $id = '0') {
$OUT = '';
if ($type == 'yn') {
case "day": // Day
for ($idx = 1; $idx < 32; $idx++) {
$OUT .= "<option value=\"".$idx."\"";
- if ($DEFAULT == $idx) $OUT .= ' selected="selected"';
+ if ($default == $idx) $OUT .= ' selected="selected"';
$OUT .= ">".$idx."</option>\n";
} // END - for
break;
case "month": // Month
foreach ($GLOBALS['month_descr'] as $month => $descr) {
$OUT .= "<option value=\"".$month."\"";
- if ($DEFAULT == $month) $OUT .= ' selected="selected"';
+ if ($default == $month) $OUT .= ' selected="selected"';
$OUT .= ">".$descr."</option>\n";
} // END - for
break;
case "year": // Year
// Get current year
- $YEAR = date('Y', time());
+ $year = date('Y', time());
// Use configured min age or fixed?
if (GET_EXT_VERSION('other') >= '0.2.1') {
// Configured
- $startYear = $YEAR - getConfig('min_age');
+ $startYear = $year - getConfig('min_age');
} else {
// Fixed 16 years
- $startYear = $YEAR - 16;
+ $startYear = $year - 16;
}
// Calculate earliest year (100 years old people can still enter Internet???)
- $minYear = $YEAR - 100;
+ $minYear = $year - 100;
// Check if the default value is larger than minimum and bigger than actual year
- if (($DEFAULT > $minYear) && ($DEFAULT >= $YEAR)) {
- for ($idx = $YEAR; $idx < ($YEAR + 11); $idx++) {
+ if (($default > $minYear) && ($default >= $year)) {
+ for ($idx = $year; $idx < ($year + 11); $idx++) {
$OUT .= "<option value=\"".$idx."\"";
- if ($DEFAULT == $idx) $OUT .= ' selected="selected"';
+ if ($default == $idx) $OUT .= ' selected="selected"';
$OUT .= ">".$idx."</option>\n";
} // END - for
- } elseif ($DEFAULT == -1) {
+ } elseif ($default == -1) {
// Current year minus 1
- for ($idx = $startYear; $idx <= ($YEAR + 1); $idx++)
+ for ($idx = $startYear; $idx <= ($year + 1); $idx++)
{
$OUT .= "<option value=\"".$idx."\">".$idx."</option>\n";
}
// Calculate earliest year depending on extension version
if (GET_EXT_VERSION('other') >= '0.2.1') {
// Use configured minimum age
- $YEAR = date('Y', time()) - getConfig('min_age');
+ $year = date('Y', time()) - getConfig('min_age');
} else {
// Use fixed 16 years age
- $YEAR = date('Y', time()) - 16;
+ $year = date('Y', time()) - 16;
}
// Construct year selection list
- for ($idx = $minYear; $idx <= $YEAR; $idx++) {
+ for ($idx = $minYear; $idx <= $year; $idx++) {
$OUT .= "<option value=\"".$idx."\"";
- if ($DEFAULT == $idx) $OUT .= ' selected="selected"';
+ if ($default == $idx) $OUT .= ' selected="selected"';
$OUT .= ">".$idx."</option>\n";
} // END - for
}
case "sec":
case "min":
for ($idx = 0; $idx < 60; $idx+=5) {
- if (strlen($idx) == 1) $idx = "0".$idx;
+ if (strlen($idx) == 1) $idx = '0'.$idx;
$OUT .= "<option value=\"".$idx."\"";
- if ($DEFAULT == $idx) $OUT .= ' selected="selected"';
+ if ($default == $idx) $OUT .= ' selected="selected"';
$OUT .= ">".$idx."</option>\n";
} // END - for
break;
case "hour":
for ($idx = 0; $idx < 24; $idx++) {
- if (strlen($idx) == 1) $idx = "0".$idx;
+ if (strlen($idx) == 1) $idx = '0'.$idx;
$OUT .= "<option value=\"".$idx."\"";
- if ($DEFAULT == $idx) $OUT .= ' selected="selected"';
+ if ($default == $idx) $OUT .= ' selected="selected"';
$OUT .= ">".$idx."</option>\n";
} // END - for
break;
case 'yn':
$OUT .= "<option value=\"Y\"";
- if ($DEFAULT == 'Y') $OUT .= ' selected="selected"';
+ if ($default == 'Y') $OUT .= ' selected="selected"';
$OUT .= ">{--YES--}</option>\n<option value=\"N\"";
- if ($DEFAULT == 'N') $OUT .= ' selected="selected"';
+ if ($default == 'N') $OUT .= ' selected="selected"';
$OUT .= ">{--NO--}</option>\n";
break;
}
return $OUT;
}
-//
-function TRANSLATE_YESNO ($yn) {
- // Default
- $translated = "??? (".$yn.")";
- switch ($yn) {
- case 'Y': $translated = getMessage('YES'); break;
- case 'N': $translated = getMessage('NO'); break;
- default:
- // Log unknown value
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown value %s. Expected Y/N!", $yn));
- break;
- }
-
- // Return it
- return $translated;
-}
-
//
// Deprecated : $length
// Optional : $DATA
//
-function generateRandomCodde ($length, $code, $uid, $DATA="") {
+function generateRandomCodde ($length, $code, $uid, $DATA = '') {
// Fix missing _MAX constant
// @TODO Rewrite this unnice code
if (!defined('_MAX')) define('_MAX', 15235);
// Build server string
- $server = $_SERVER['PHP_SELF'].":".GET_USER_AGENT().":".getenv('SERVER_SOFTWARE').":".GET_REMOTE_ADDR().":".":".filemtime(constant('PATH')."inc/databases.php");
+ $server = $_SERVER['PHP_SELF'].constant('ENCRYPT_SEPERATOR').detectUserAgent().constant('ENCRYPT_SEPERATOR').getenv('SERVER_SOFTWARE').constant('ENCRYPT_SEPERATOR').detectRemoteAddr().":'.':".filemtime(constant('PATH')."inc/databases.php");
// Build key string
- $keys = constant('SITE_KEY').":".constant('DATE_KEY');
- if (isConfigEntrySet('secret_key')) $keys .= ":".getConfig('secret_key');
- if (isConfigEntrySet('file_hash')) $keys .= ":".getConfig('file_hash');
- $keys .= ":".date("d-m-Y (l-F-T)", getConfig(('patch_ctime')));
- if (isConfigEntrySet('master_salt')) $keys .= ":".getConfig('master_salt');
+ $keys = constant('SITE_KEY').constant('ENCRYPT_SEPERATOR').constant('DATE_KEY');
+ if (isConfigEntrySet('secret_key')) $keys .= constant('ENCRYPT_SEPERATOR').getConfig('secret_key');
+ if (isConfigEntrySet('file_hash')) $keys .= constant('ENCRYPT_SEPERATOR').getConfig('file_hash');
+ $keys .= constant('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", getConfig(('patch_ctime')));
+ if (isConfigEntrySet('master_salt')) $keys .= constant('ENCRYPT_SEPERATOR').getConfig('master_salt');
// Build string from misc data
- $data = $code.":".$uid.":".$DATA;
+ $data = $code.constant('ENCRYPT_SEPERATOR').$uid.constant('ENCRYPT_SEPERATOR').$DATA;
// Add more additional data
- if (isSessionVariableSet('u_hash')) $data .= ":".get_session('u_hash');
- if (isUserIdSet()) $data .= ":".getUserId();
- if (isSessionVariableSet('mxchange_theme')) $data .= ":".get_session('mxchange_theme');
- if (isSessionVariableSet('mx_lang')) $data .= ":".GET_LANGUAGE();
- if (isset($GLOBALS['refid'])) $data .= ":".$GLOBALS['refid'];
+ if (isSessionVariableSet('u_hash')) $data .= constant('ENCRYPT_SEPERATOR').getSession('u_hash');
+ if (isUserIdSet()) $data .= constant('ENCRYPT_SEPERATOR').getUserId();
+ if (isSessionVariableSet('mxchange_theme')) $data .= constant('ENCRYPT_SEPERATOR').getSession('mxchange_theme');
+ if (isSessionVariableSet('mx_lang')) $data .= constant('ENCRYPT_SEPERATOR').getLanguage();
+ if (isset($GLOBALS['refid'])) $data .= constant('ENCRYPT_SEPERATOR').$GLOBALS['refid'];
// Calculate number for generating the code
$a = $code + constant('_ADD') - 1;
if (isConfigEntrySet('master_hash')) {
// Generate hash with master salt from modula of number with the prime number and other data
- $saltedHash = generateHash(($a % constant('_PRIME')).":".$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a, getConfig('master_salt'));
+ $saltedHash = generateHash(($a % constant('_PRIME')).constant('ENCRYPT_SEPERATOR').$server.constant('ENCRYPT_SEPERATOR').$keys.constant('ENCRYPT_SEPERATOR').$data.constant('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", time()).constant('ENCRYPT_SEPERATOR').$a, getConfig('master_salt'));
// Create number from hash
$rcode = hexdec(substr($saltedHash, strlen(getConfig('master_salt')), 9)) / abs(constant('_MAX') - $a + sqrt(constant('_ADD'))) / pi();
} else {
// Generate hash with "hash of site key" from modula of number with the prime number and other data
- $saltedHash = generateHash(($a % constant('_PRIME')).":".$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a, substr(sha1(constant('SITE_KEY')), 0, 8));
+ $saltedHash = generateHash(($a % constant('_PRIME')).constant('ENCRYPT_SEPERATOR').$server.constant('ENCRYPT_SEPERATOR').$keys.constant('ENCRYPT_SEPERATOR').$data.constant('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", time()).constant('ENCRYPT_SEPERATOR').$a, substr(sha1(constant('SITE_KEY')), 0, 8));
// Create number from hash
$rcode = hexdec(substr($saltedHash, 8, 9)) / abs(constant('_MAX') - $a + sqrt(constant('_ADD'))) / pi();
// Has the whole value changed?
// @TODO Remove this if() block if all is working fine
- if ("".$ret."" != "".$num."") {
+ if ("".$ret."" != ''.$num."") {
// Log the values
debug_report_bug("{$ret}<>{$num}");
} // END - if
}
// Load image
- $img = sprintf("%s/theme/%s/images/code_bg.%s", constant('PATH'), GET_CURR_THEME(), getConfig('img_type'));
- if (FILE_READABLE($img)) {
+ $img = sprintf("%s/theme/%s/images/code_bg.%s", constant('PATH'), getCurrentTheme(), getConfig('img_type'));
+ if (isFileReadable($img)) {
// Switch image type
switch (getConfig('img_type'))
{
imagedestroy($image);
}
// Create selection box or array of splitted timestamp
-function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="center", $return_array=false) {
+function createTimeSelections ($timestamp, $prefix = '', $display = '', $align="center", $return_array=false) {
// Calculate 2-seconds timestamp
$stamp = round($timestamp);
- //* DEBUG: */ print("*".$stamp."/".$timestamp."*<br />");
+ //* DEBUG: */ print("*".$stamp.'/'.$timestamp."*<br />");
// Do we have a leap year?
$SWITCH = 0;
$TEST = date('Y', time()) / 4;
- $M1 = date("m", time());
- $M2 = date("m", (time() + $timestamp));
+ $M1 = date('m', time());
+ $M2 = date('m', (time() + $timestamp));
// If so and if current time is before 02/29 and estimated time is after 02/29 then add 86400 seconds (one day)
if ((floor($TEST) == $TEST) && ($M1 == "02") && ($M2 > "02")) $SWITCH = getConfig('one_day');
$OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_HOURS--}</strong></td>\n";
}
- if (ereg("m", $display) || (empty($display))) {
+ if (ereg('m', $display) || (empty($display))) {
$OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_MINUTES--}</strong></td>\n";
}
$OUT .= "<INPUT type=\"hidden\" name=\"".$prefix."_ho\" value=\"0\">\n";
}
- if (ereg("m", $display) || (empty($display))) {
+ if (ereg('m', $display) || (empty($display))) {
// Generate minute selection
$OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_mi\" size=\"1\">\n";
for ($idx = 0; $idx <= 59; $idx++) {
}
//
-function CREATE_TIMESTAMP_FROM_SELECTIONS ($prefix, $POST) {
+function createTimestampFromSelections ($prefix, $POST) {
// Initial return value
$ret = 0;
// Do we have a leap year?
$SWITCH = 0;
$TEST = date('Y', time()) / 4;
- $M1 = date("m", time());
+ $M1 = date('m', time());
// If so and if current time is before 02/29 and estimated time is after 02/29 then add 86400 seconds (one day)
if ((floor($TEST) == $TEST) && ($M1 == "02") && ($POST[$prefix."_mo"] > "02")) $SWITCH = getConfig('one_day');
// First add years...
$UID
));
}
- } elseif ($aid == "0") {
+ } elseif ($aid == '0') {
// Select all email adresses
$result = SQL_QUERY("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id`",
__FUNCTION__, __LINE__);
// Load email addresses and send away
while ($content = SQL_FETCHARRAY($result)) {
- SEND_EMAIL($content['email'], $subj, $msg);
+ sendEmail($content['email'], $subj, $msg);
} // END - while
// Free memory
SQL_FREERESULT($result);
}
-//
-function CREATE_FANCY_TIME ($stamp) {
+// Creates a 'fancy' human-readable timestamp from a Uni* stamp
+function createFancyTime ($stamp) {
// Get data array with years/months/weeks/days/...
- $data = CREATE_TIME_SELECTIONS($stamp, '', '', '', true);
+ $data = createTimeSelections($stamp, '', '', '', true);
$ret = '';
foreach($data as $k => $v) {
if ($v > 0) {
// Add seperator if we have not yet reached total pages
if ($page < $PAGES) $NAV .= " | ";
- }
+ } // END - for
// Define constants only once
if (!defined('__NAV_OUTPUT')) {
define('__NAV_COLSPAN', $colspan);
define('__NAV_TOP' , $TOP);
define('__NAV_SEP' , $SEP);
- }
+ } // END - if
// Load navigation template
$OUT = LOAD_TEMPLATE("admin_email_nav_row", true);
}
// Extract host from script name
-function EXTRACT_HOST (&$script) {
+function extractHostnameFromUrl (&$script) {
// Use default SERVER_URL by default... ;) So?
$url = constant('SERVER_URL');
if (substr($script, 0, 7) == "http://") {
// Use the hostname from script URL as new hostname
$url = substr($script, 7);
- $extract = explode("/", $url);
+ $extract = explode('/', $url);
$url = $extract[0];
// Done extracting the URL :)
} // END - if
// Extract host name
$host = str_replace("http://", '', $url);
- if (ereg("/", $host)) $host = substr($host, 0, strpos($host, "/"));
+ if (ereg('/', $host)) $host = substr($host, 0, strpos($host, '/'));
// Generate relative URL
//* DEBUG: */ print("SCRIPT=".$script."<br />\n");
}
//* DEBUG: */ print("SCRIPT=".$script."<br />\n");
- if (substr($script, 0, 1) == "/") $script = substr($script, 1);
+ if (substr($script, 0, 1) == '/') $script = substr($script, 1);
// Return host name
return $host;
}
// Send a GET request
-function GET_URL ($script) {
+function sendGetRequest ($script) {
// Compile the script name
$script = COMPILE_CODE($script);
// Extract host name from script
- $host = EXTRACT_HOST($script);
+ $host = extractHostnameFromUrl($script);
// Generate GET request header
$request = "GET /" . trim($script) . " HTTP/1.1\r\n";
$request .= "Host: " . $host . "\r\n";
$request .= "Referer: " . constant('URL') . "/admin.php\r\n";
if (defined('FULL_VERSION')) {
- $request .= "User-Agent: " . constant('TITLE') . "/" . constant('FULL_VERSION') . "\r\n";
+ $request .= "User-Agent: " . constant('TITLE') . '/' . constant('FULL_VERSION') . "\r\n";
} else {
$request .= "User-Agent: " . constant('TITLE') . "/?.?.?\r\n";
}
$request .= "Connection: Close\r\n\r\n";
// Send the raw request
- $response = SEND_RAW_REQUEST($host, $request);
+ $response = sendRawRequest($host, $request);
// Return the result to the caller function
return $response;
}
// Send a POST request
-function POST_URL ($script, $postData) {
+function sendPostRequest ($script, $postData) {
// Is postData an array?
if (!is_array($postData)) {
// Abort here
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("postData is not an array. Type: %s", gettype($postData)));
- return array("", '', '');
+ return array('', '', '');
} // END - if
// Compile the script name
$script = COMPILE_CODE($script);
// Extract host name from script
- $host = EXTRACT_HOST($script);
+ $host = extractHostnameFromUrl($script);
// Construct request
$data = http_build_query($postData, '','&');
$request = "POST /" . trim($script) . " HTTP/1.1\r\n";
$request .= "Host: " . $host . "\r\n";
$request .= "Referer: " . constant('URL') . "/admin.php\r\n";
- $request .= "User-Agent: " . constant('TITLE') . "/" . constant('FULL_VERSION') . "\r\n";
+ $request .= "User-Agent: " . constant('TITLE') . '/' . constant('FULL_VERSION') . "\r\n";
$request .= "Content-type: application/x-www-form-urlencoded\r\n";
$request .= "Content-length: " . strlen($data) . "\r\n";
$request .= "Cache-Control: no-cache\r\n";
$request .= $data;
// Send the raw request
- $response = SEND_RAW_REQUEST($host, $request);
+ $response = sendRawRequest($host, $request);
// Return the result to the caller function
return $response;
}
// Sends a raw request to another host
-function SEND_RAW_REQUEST ($host, $request) {
+function sendRawRequest ($host, $request) {
// Initialize array
- $response = array("", '', '');
+ $response = array('', '', '');
// Default is not to use proxy
$useProxy = false;
// Are proxy settins set?
- if ((getConfig('proxy_host') != "") && (getConfig('proxy_port') > 0)) {
+ if ((getConfig('proxy_host') != '') && (getConfig('proxy_port') > 0)) {
// Then use it
$useProxy = true;
} // END - if
$proxyTunnel .= "Host: ".$host."\r\n";
// Use login data to proxy? (username at least!)
- if (getConfig('proxy_username') != "") {
+ if (getConfig('proxy_username') != '') {
// Add it as well
- $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')).":".COMPILE_CODE(getConfig('proxy_password')));
+ $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')).constant('ENCRYPT_SEPERATOR').COMPILE_CODE(getConfig('proxy_password')));
$proxyTunnel .= "Proxy-Authorization: Basic ".$encodedAuth."\r\n";
} // END - if
// Read the first line
$resp = trim(fgets($fp, 10240));
- $respArray = explode(" ", $resp);
- if ((strtolower($respArray[0]) !== "http/1.0") || ($respArray[1] != "200")) {
+ $respArray = explode(' ', $resp);
+ if ((strtolower($respArray[0]) !== 'http/1.0') || ($respArray[1] != '200')) {
// Invalid response!
return $response;
} // END - if
//* DEBUG: */ print("<strong>Response:</strong><pre>".print_r($response, true)."</pre>");
// Proxy agent found?
- if ((substr(strtolower($response[0]), 0, 11) == "proxy-agent") && ($useProxy)) {
+ if ((substr(strtolower($response[0]), 0, 11) == 'proxy-agent') && ($useProxy)) {
// Proxy header detected, so remove two lines
array_shift($response);
array_shift($response);
} // END - if
// Was the request successfull?
- if ((!eregi("200 OK", $response[0])) || (empty($response[0]))) {
+ if ((!eregi('200 OK', $response[0])) || (empty($response[0]))) {
// Not found / access forbidden
- $response = array("", '', '');
+ $response = array('', '', '');
} // END - if
// Return response
$domain = "[a-z0-9-]+(\.[a-z0-9-]{2,5})+";
// Generate pattern
- $regex = "^".$first."@".$domain."$";
+ $regex = '^'.$first.'@'.$domain.'$';
// Return check result
+ // @TODO eregi() should be rewritten here
return eregi($regex, $email);
}
// Function taken from user comments on www.php.net / function eregi()
-function VALIDATE_URL ($URL, $compile=true) {
+function isUrlValid ($URL, $compile=true) {
// Trim URL a little
$URL = trim(urldecode($URL));
//* DEBUG: */ echo $URL."<br />";
//* DEBUG: */ echo $URL."<br />";
// Check for the extension filter
- if (EXT_IS_ACTIVE("filter")) {
+ if (EXT_IS_ACTIVE('filter')) {
// Use the extension's filter set
- return FILTER_VALIDATE_URL($URL, false);
- }
+ return FILTER_isUrlValid($URL, false);
+ } // END - if
// If not installed, perform a simple test. Just make it sure there is always a http:// or
// https:// in front of the URLs
}
// Generate a list of administrative links to a given userid
-function MEMBER_ACTION_LINKS ($uid, $status = "") {
+function generateMemberAdminActionLinks ($uid, $status = '') {
// Define all main targets
- $TARGETS = array("del_user", "edit_user", "lock_user", "add_points", "sub_points");
+ $TARGETS = array('del_user', 'edit_user', 'lock_user', 'add_points', 'sub_points');
// Begin of navigation links
$eval = "\$OUT = \"[ ";
foreach ($TARGETS as $tar) {
$eval .= "<span class=\\\"admin_user_link\\\"><a href=\\\"{!URL!}/modules.php?module=admin&what=".$tar."&uid=".$uid."\\\" title=\\\"{--ADMIN_LINK_";
- //* DEBUG: */ echo "*".$tar."/".$status."*<br />\n";
- if (($tar == "lock_user") && ($status == "LOCKED")) {
+ //* DEBUG: */ echo "*".$tar.'/'.$status."*<br />\n";
+ if (($tar == "lock_user") && ($status == 'LOCKED')) {
// Locked accounts shall be unlocked
$eval .= "UNLOCK_USER";
} else {
$eval .= strtoupper($tar);
}
$eval .= "_TITLE--}\\\">{--ADMIN_";
- if (($tar == "lock_user") && ($status == "LOCKED")) {
+ if (($tar == "lock_user") && ($status == 'LOCKED')) {
// Locked accounts shall be unlocked
$eval .= "UNLOCK_USER";
} else {
}
// Generate an email link
-function CREATE_EMAIL_LINK ($email, $table = 'admins') {
+function generateMemberEmailLink ($email, $table = 'admins') {
// Default email link (INSECURE! Spammer can read this by harvester programs)
- $EMAIL = "mailto:".$email;
+ $EMAIL = 'mailto:' . $email;
// Check for several extensions
if ((EXT_IS_ACTIVE('admins')) && ($table == 'admins')) {
// Create email link for contacting admin in guest area
- $EMAIL = ADMINS_CREATE_EMAIL_LINK($email);
- } elseif ((EXT_IS_ACTIVE('user')) && (GET_EXT_VERSION('user') >= '0.3.3') && ($table == "user_data")) {
+ $EMAIL = adminsCreateEmailLink($email);
+ } elseif ((EXT_IS_ACTIVE('user')) && (GET_EXT_VERSION('user') >= '0.3.3') && ($table == 'user_data')) {
// Create email link for contacting a member within admin area (or later in other areas, too?)
- $EMAIL = USER_CREATE_EMAIL_LINK($email);
- } elseif ((EXT_IS_ACTIVE('sponsor')) && ($table == "sponsor_data")) {
+ $EMAIL = USER_generateMemberEmailLink($email);
+ } elseif ((EXT_IS_ACTIVE('sponsor')) && ($table == 'sponsor_data')) {
// Create email link to contact sponsor within admin area (or like the link above?)
- $EMAIL = SPONSOR_CREATE_EMAIL_LINK($email);
+ $EMAIL = SPONSOR_generateMemberEmailLink($email);
}
// Shall I close the link when there is no admin?
- if ((!IS_ADMIN()) && ($EMAIL == $email)) $EMAIL = "#"; // Closed!
+ if ((!IS_ADMIN()) && ($EMAIL == $email)) $EMAIL = '#'; // Closed!
// Return email link
return $EMAIL;
}
// Generate a hash for extra-security for all passwords
-function generateHash ($plainText, $salt = "") {
+function generateHash ($plainText, $salt = '') {
// Is the required extension 'sql_patches' there and a salt is not given?
if (((EXT_VERSION_IS_OLDER('sql_patches', '0.3.6')) || (!EXT_IS_ACTIVE('sql_patches'))) && (empty($salt))) {
// Extension sql_patches is missing/outdated so we hash the plain text with MD5
// Do we miss an arry element here?
if (!isConfigEntrySet('file_hash')) {
// Stop here
- debug_report_bug("Missing file_hash in ".__FUNCTION__.".");
+ debug_report_bug('Missing file_hash in ' . __FUNCTION__ . '.');
} // END - if
// When the salt is empty build a new one, else use the first x configured characters as the salt
if (empty($salt)) {
- // Build server string
- $server = $_SERVER['PHP_SELF'].":".GET_USER_AGENT().":".getenv('SERVER_SOFTWARE').":".GET_REMOTE_ADDR().":".":".filemtime(constant('PATH')."inc/databases.php");
+ // Build server string (inc/databases.php is no longer updated with every commit)
+ $server = $_SERVER['PHP_SELF'].constant('ENCRYPT_SEPERATOR').detectUserAgent().constant('ENCRYPT_SEPERATOR').getenv('SERVER_SOFTWARE').constant('ENCRYPT_SEPERATOR').detectRemoteAddr();
// Build key string
- $keys = constant('SITE_KEY').":".constant('DATE_KEY').":".getConfig('secret_key').":".getConfig('file_hash').":".date("d-m-Y (l-F-T)", getConfig(('patch_ctime'))).":".getConfig('master_salt');
+ $keys = constant('SITE_KEY').constant('ENCRYPT_SEPERATOR').constant('DATE_KEY').constant('ENCRYPT_SEPERATOR').getConfig('secret_key').constant('ENCRYPT_SEPERATOR').getConfig('file_hash').constant('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", getConfig(('patch_ctime'))).constant('ENCRYPT_SEPERATOR').getConfig('master_salt');
// Additional data
- $data = $plainText.":".uniqid(mt_rand(), true).":".time();
+ $data = $plainText.constant('ENCRYPT_SEPERATOR').uniqid(mt_rand(), true).constant('ENCRYPT_SEPERATOR').time();
// Calculate number for generating the code
$a = time() + constant('_ADD') - 1;
// Generate SHA1 sum from modula of number and the prime number
- $sha1 = sha1(($a % constant('_PRIME')).$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a);
+ $sha1 = sha1(($a % constant('_PRIME')).$server.constant('ENCRYPT_SEPERATOR').$keys.constant('ENCRYPT_SEPERATOR').$data.constant('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", time()).constant('ENCRYPT_SEPERATOR').$a);
//* DEBUG: */ echo "SHA1=".$sha1." (".strlen($sha1).")<br />";
$sha1 = scrambleString($sha1);
//* DEBUG: */ echo "Scrambled=".$sha1." (".strlen($sha1).")<br />";
return $str;
} elseif (strlen($str) == 40) {
// From database
- $scrambleNums = explode(":", getConfig('pass_scramble'));
+ $scrambleNums = explode(':', getConfig('pass_scramble'));
} else {
// Generate new numbers
- $scrambleNums = explode(":", genScrambleString(strlen($str)));
+ $scrambleNums = explode(':', genScrambleString(strlen($str)));
}
// Scramble string here
if (strlen($str) != 40) return $str;
// Load numbers from config
- $scrambleNums = explode(":", getConfig('pass_scramble'));
+ $scrambleNums = explode(':', getConfig('pass_scramble'));
// Validate numbers
if (count($scrambleNums) != 40) return $str;
} // END - for
// So let's create the string for storing it in database
- $scrambleString = implode(":", $scrambleNumbers);
+ $scrambleString = implode(':', $scrambleNumbers);
return $scrambleString;
}
// Append data like session ID or referal ID to the given URL which would
// normally be stored in cookies
-function ADD_URL_DATA ($URL) {
+function addUrlData ($URL) {
// Init add
$add = '';
// Determine URL binder
- $BIND = "?";
- if (strpos($URL, "?") !== false) $BIND = "&";
+ $BIND = '?';
+ if (strpos($URL, '?') !== false) $BIND = '&';
- if ((!defined('__COOKIES')) || ((!__COOKIES))) {
+ if ((!defined('__COOKIES')) || ((!constant('__COOKIES')))) {
// Cookies are not accepted
if ((REQUEST_ISSET_GET(('refid'))) && (strpos($URL, "refid=") == 0)) {
// Cookie found in URL
$ret = $passHash;
// Is a secret key and master salt already initialized?
- if ((getConfig('secret_key') != "") && (getConfig('master_salt') != "")) {
+ if ((getConfig('secret_key') != '') && (getConfig('master_salt') != '')) {
// Only calculate when the secret key is generated
$newHash = ''; $start = 9;
for ($idx = 0; $idx < 10; $idx++) {
}
$mod = substr(round($mod), 0, 4);
$mod = str_repeat('0', 4-strlen($mod)).$mod;
- //* DEBUG: */ echo "*".$start."=".$mod."*<br />";
+ //* DEBUG: */ echo "*".$start.'='.$mod."*<br />";
$start += 4;
$newHash .= $mod;
} // END - for
}
// Fix "deleted" cookies
-function FIX_DELETED_COOKIES ($cookies) {
+function fixDeletedCookies ($cookies) {
// Is this an array with entries?
if ((is_array($cookies)) && (count($cookies) > 0)) {
// Then check all cookies if they are marked as deleted!
foreach ($cookies as $cookieName) {
// Is the cookie set to "deleted"?
- if (get_session($cookieName) == "deleted") {
- set_session($cookieName, '');
- }
+ if (getSession($cookieName) == 'deleted') {
+ setSession($cookieName, '');
+ } // END - if
} // END - foreach
} // END - if
}
// Output error messages in a fasioned way and die...
function app_die ($F, $L, $msg) {
// Load header
- LOAD_INC_ONCE('inc/header.php');
+ loadIncludeOnce('inc/header.php');
// Prepare message for output
$msg = sprintf(getMessage('MXCHANGE_HAS_DIED'), basename($F), $L, $msg);
LOAD_TEMPLATE('admin_settings_saved', false, $msg);
// Load footer
- LOAD_INC_ONCE('inc/footer.php');
+ loadIncludeOnce('inc/footer.php');
// Exit explicitly
shutdown();
}
// Display parsing time and number of SQL queries in footer
-function DISPLAY_PARSING_TIME_FOOTER() {
+function displayParsingTime() {
// Is the timer started?
if (!isset($GLOBALS['startTime'])) {
// Abort here
$endTime = microtime(true);
// "Explode" both times
- $start = explode(" ", $GLOBALS['startTime']);
- $end = explode(" ", $endTime);
+ $start = explode(' ', $GLOBALS['startTime']);
+ $end = explode(' ', $endTime);
$runTime = $end[0] - $start[0];
if ($runTime < 0) $runTime = 0;
- $runTime = TRANSLATE_COMMA($runTime);
+ $runTime = translateComma($runTime);
// Prepare output
$content = array(
);
// Load the template
- LOAD_TEMPLATE("show_timings", false, $content);
+ LOAD_TEMPLATE('show_timings', false, $content);
}
// Check wether a boolean constant is set
}
// Checks if a given apache module is loaded
-function IF_APACHE_MODULE_LOADED ($apacheModule) {
+function isApacheModuleLoaded ($apacheModule) {
// Check it and return result
return (((function_exists('apache_get_modules')) && (in_array($apacheModule, apache_get_modules()))) || (!function_exists('apache_get_modules')));
}
// @TODO Rewrite all language constants to this function.
function getMessage ($messageId) {
// Default is not found!
- $return = "!".$messageId."!";
+ $return = '!'.$messageId.'!';
// Is the language string found?
if (isset($GLOBALS['msg'][strtolower($messageId)])) {
}
// Get current theme name
-function GET_CURR_THEME() {
+function getCurrentTheme() {
// The default theme is 'default'... ;-)
- $ret = "default";
+ $ret = 'default';
// Load default theme if not empty from configuration
- if (getConfig('default_theme') != "") $ret = getConfig('default_theme');
+ if (getConfig('default_theme') != '') $ret = getConfig('default_theme');
if (!isSessionVariableSet('mxchange_theme')) {
// Set default theme
- set_session('mxchange_theme', $ret);
+ setSession('mxchange_theme', $ret);
} elseif ((isSessionVariableSet('mxchange_theme')) && (GET_EXT_VERSION('sql_patches') >= '0.1.4')) {
//die("<pre>".print_r($GLOBALS['cache_array']['themes'], true)."</pre>");
// Get theme from cookie
- $ret = get_session('mxchange_theme');
+ $ret = getSession('mxchange_theme');
// Is it valid?
- if (THEME_GET_ID($ret) == 0) {
+ if (getThemeId($ret) == 0) {
// Fix it to default
- $ret = "default";
+ $ret = 'default';
} // END - if
} elseif ((!isInstalled()) && ((isInstalling()) || ($GLOBALS['output_mode'] == true)) && ((REQUEST_ISSET_GET('theme')) || (REQUEST_ISSET_POST('theme')))) {
// Prepare FQFN for checking
$theme = sprintf("%stheme/%s/theme.php", constant('PATH'), REQUEST_GET('theme'));
// Installation mode active
- if ((REQUEST_ISSET_GET('theme')) && (FILE_READABLE($theme))) {
+ if ((REQUEST_ISSET_GET('theme')) && (isFileReadable($theme))) {
// Set cookie from URL data
- set_session('mxchange_theme', REQUEST_GET('theme'));
- } elseif (FILE_READABLE(sprintf("%stheme/%s/theme.php", constant('PATH'), SQL_ESCAPE(REQUEST_POST('theme'))))) {
+ setSession('mxchange_theme', REQUEST_GET('theme'));
+ } elseif (isFileReadable(sprintf("%stheme/%s/theme.php", constant('PATH'), SQL_ESCAPE(REQUEST_POST('theme'))))) {
// Set cookie from posted data
- set_session('mxchange_theme', SQL_ESCAPE(REQUEST_POST('theme')));
+ setSession('mxchange_theme', SQL_ESCAPE(REQUEST_POST('theme')));
}
// Set return value
- $ret = get_session('mxchange_theme');
+ $ret = getSession('mxchange_theme');
} else {
// Invalid design, reset cookie
- set_session('mxchange_theme', $ret);
+ setSession('mxchange_theme', $ret);
}
// Add (maybe) found theme.php file to inclusion list
$INC = sprintf("theme/%s/theme.php", SQL_ESCAPE($ret));
// Try to load the requested include file
- if (INCLUDE_READABLE($INC)) ADD_INC_TO_POOL($INC);
+ if (isIncludeReadable($INC)) ADD_INC_TO_POOL($INC);
// Return theme value
return $ret;
}
// Get id from theme
-function THEME_GET_ID ($name) {
+function getThemeId ($name) {
// Is the extension 'theme' installed?
if (!EXT_IS_ACTIVE('theme')) {
// Then abort here
incrementConfigEntry('cache_hits');
} elseif (GET_EXT_VERSION('cache') != '0.1.8') {
// Check if current theme is already imported or not
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_themes` WHERE theme_path='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_themes` WHERE theme_path='%s' LIMIT 1",
array($name), __FUNCTION__, __LINE__);
// Entry found?
}
// Read a given file
-function READ_FILE ($FQFN, $sqlPrepare = false) {
+function readFromFile ($FQFN, $sqlPrepare = false) {
// Load the file
if (function_exists('file_get_contents')) {
// Use new function
$content = file_get_contents($FQFN);
} else {
// Fall-back to implode-file chain
- $content = implode("", file($FQFN));
+ $content = implode('', file($FQFN));
}
// Prepare SQL queries?
}
// Writes content to a file
-function WRITE_FILE ($FQFN, $content) {
+function writeToFile ($FQFN, $content) {
// Is the file writeable?
- if ((FILE_READABLE($FQFN)) && (!is_writeable($FQFN)) && (!chmod($FQFN, 0644))) {
+ if ((isFileReadable($FQFN)) && (!is_writeable($FQFN)) && (!chmod($FQFN, 0644))) {
// Not writeable!
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("File %s not writeable.", basename($FQFN)));
$return = file_put_contents($FQFN, $content);
} else {
// Write it with fopen
- $fp = fopen($FQFN, 'w') or app_die(__FUNCTION__, __LINE__, "Cannot write file ".basename($FQFN)."!");
+ $fp = fopen($FQFN, 'w') or app_die(__FUNCTION__, __LINE__, "Cannot write file ".basename($FQFN).'!');
fwrite($fp, $content);
fclose($fp);
}
// Generates an error code from given account status
-function GEN_ERROR_CODE_FROM_ACCOUNT_STATUS ($status) {
+function generateErrorCodeFromUserStatus ($status) {
// Default error code if unknown account status
$errorCode = getCode('UNKNOWN_STATUS');
// Trigger an error on failure
if (!ob_end_clean()) {
// Failed!
- debug_report_bug(__FUNCTION__.": Failed to clean output buffer.");
+ debug_report_bug(__FUNCTION__.': Failed to clean output buffer.');
} // END - if
}
// Does it match what we are looking for? (We skip a lot files already!)
// RegexPattern to exclude ., .., .revision, .svn, debug.log or .cache in the filenames
$excludePattern = '@(\.|\.\.|\.revision|\.svn|debug\.log|\.cache|config\.php)$@';
- $ds = GET_DIR_AS_ARRAY($dir, '', true, false, $excludePattern);
+ $ds = getArrayFromDirectory($dir, '', true, false, $excludePattern);
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ds[]=".count($ds)."<br />\n";
// Walk through all entries
foreach ($ds as $d) {
// Generate proper FQFN
- $FQFN = str_replace("//", "/", constant('PATH') . $dir. "/". $d);
+ $FQFN = str_replace("//", '/', constant('PATH') . $dir. '/'. $d);
// Is it a file and readable?
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):FQFN={$FQFN}<br />\n";
if (isDirectory($FQFN)) {
// $FQFN is a directory so also crawl into this directory
$newDir = $d;
- if (!empty($dir)) $newDir = $dir . "/". $d;
+ if (!empty($dir)) $newDir = $dir . '/'. $d;
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):DESCENT: ".$newDir."<br />\n";
searchDirsRecursive($newDir, $last_changed);
- } elseif (FILE_READABLE($FQFN)) {
+ } elseif (isFileReadable($FQFN)) {
// $FQFN is a filename and no directory
$time = filemtime($FQFN);
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):File: ".$d." found. (".($last_changed['time'] - $time).")<br />\n";
unset($GLOBALS['cache_array']['revision']);
// Reload load_cach-revison.php
- LOAD_INC('inc/loader/load_cache-revision.php');
+ loadInclude('inc/loader/load_cache-revision.php');
} // END - if
// Return found value
$new = true;
} else {
// Check for revision file
- if (!FILE_READABLE($FQFN)) {
+ if (!isFileReadable($FQFN)) {
// Not found, so we need to create it
$new = true;
} else {
// Revision file found
- $ins_vers = explode("\n", READ_FILE($FQFN));
+ $ins_vers = explode("\n", readFromFile($FQFN));
// Get array for mapping information
$mapper = array_flip(getSearchFor());
//* DEBUG: */ print("<pre>".print_r($mapper, true).print_r($ins_vers, true)."</pre>");
// Is the content valid?
- if ((!is_array($ins_vers)) || (count($ins_vers) <= 0) || (!isset($ins_vers[$mapper[$type]])) || (trim($ins_vers[$mapper[$type]]) == "") || ($ins_vers[0]) == "new") {
+ if ((!is_array($ins_vers)) || (count($ins_vers) <= 0) || (!isset($ins_vers[$mapper[$type]])) || (trim($ins_vers[$mapper[$type]]) == '') || ($ins_vers[0]) == "new") {
// File needs update!
$new = true;
} else {
// Has it been updated?
if ($new === true) {
- WRITE_FILE($FQFN, implode("\n", getAkt_vers()));
+ writeToFile($FQFN, implode("\n", getArrayFromActualVersion()));
} // END - if
}
}
// Repares an array we are looking for
-// The returned Array is needed twice (in getAkt_vers() and in getActualVersion() in the old .revision-fallback) so I puted it in an extra function to not polute the global namespace
+// The returned Array is needed twice (in getArrayFromActualVersion() and in getActualVersion() in the old .revision-fallback) so I puted it in an extra function to not polute the global namespace
function getSearchFor () {
// Add Revision, Date, Tag and Author
$searchFor = array('Revision', 'Date', 'Tag', 'Author');
return $searchFor;
}
-function getAkt_vers () {
+// @TODO Please describe this function
+function getArrayFromActualVersion () {
// Init variables
$next_dir = ''; // Directory to start with search
$last_changed = array(
- 'path_name' => "",
+ 'path_name' => '',
'time' => 0
);
$akt_vers = array(); // Init return array
searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time);
// Get file
- $last_file = READ_FILE($last_changed['path_name']);
+ $last_file = readFromFile($last_changed['path_name']);
// Get all the keywords to search for
$searchFor = getSearchFor();
} else {
// No valid Data from the last modificated file so read the Revision from the Server. Fallback-solution!! Should not be removed I think.
- $version = GET_URL("check-updates3.php");
+ $version = sendGetRequest('check-updates3.php');
// Prepare content
// Only sets not setted or not proper values to the Online-Server-Fallback-Solution
// Loads an include file and logs any missing files for debug purposes
-function LOAD_INC ($INC) {
+function loadInclude ($INC) {
// Add the path. This is why we need a trailing slash in config.php
$FQFN = constant('PATH') . $INC;
// Is the include file there?
- if (!INCLUDE_READABLE($INC)) {
+ if (!isIncludeReadable($INC)) {
// Not there so log it
debug_report_bug(sprintf("Include file %s not found.", $INC));
return false;
}
// Loads an include file once
-function LOAD_INC_ONCE ($INC) {
+function loadIncludeOnce ($INC) {
// Is it not loaded?
if (!isset($GLOBALS['load_once'][$INC])) {
// Then try to load it
- LOAD_INC($INC);
+ loadInclude($INC);
// And mark it as loaded
$GLOBALS['load_once'][$INC] = "loaded";
}
// Output a debug backtrace to the user
-function debug_report_bug ($message = "") {
+function debug_report_bug ($message = '') {
// Init message
$debug = '';
// Is the optional message set?
}
// Generate a "link" for the given admin id (aid)
-function GENERATE_AID_LINK ($aid) {
+function generateAdminLink ($aid) {
// No assigned admin is default
$admin = "<span class=\"admin_note\">{--ADMIN_NO_ADMIN_ASSIGNED--}</span>";
// Zero? = Not assigned
if (bigintval($aid) > 0) {
// Load admin's login
- $login = GET_ADMIN_LOGIN($aid);
+ $login = getAdminLogin($aid);
// Is the login valid?
- if ($login != "***") {
+ if ($login != '***') {
// Is the extension there?
if (EXT_IS_ACTIVE('admins')) {
// Admin found
- $admin = "<a href=\"".ADMINS_CREATE_EMAIL_LINK(GET_ADMIN_EMAIL($aid))."\">".$login."</a>";
+ $admin = "<a href=\"".adminsCreateEmailLink(getAdminEmail($aid))."\">".$login."</a>";
} else {
// Extension not found
$admin = sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), 'admins');
}
// Checks wether an include file (non-FQFN better) is readable
-function INCLUDE_READABLE ($INC) {
+function isIncludeReadable ($INC) {
// Construct FQFN
$FQFN = constant('PATH') . $INC;
// Is it readable?
- return FILE_READABLE($FQFN);
+ return isFileReadable($FQFN);
}
// Encode strings
if (!$simple) $code = str_replace("{--", '".', str_replace("--}", '."', $code));
// Compile QUOT and other non-HTML codes
- $code = str_replace("{DOT}", ".",
- str_replace("{SLASH}", "/",
- str_replace("{QUOT}", "'",
- str_replace("{DOLLAR}", "$",
- str_replace("{OPEN_ANCHOR}", "(",
- str_replace("{CLOSE_ANCHOR}", ")",
- str_replace("{OPEN_SQR}", "[",
- str_replace("{CLOSE_SQR}", "]",
- str_replace("{PER}", "%",
+ $code = str_replace('{DOT}', '.',
+ str_replace('{SLASH}', '/',
+ str_replace('{QUOT}', "'",
+ str_replace('{DOLLAR}', '$',
+ str_replace('{OPEN_ANCHOR}', '(',
+ str_replace('{CLOSE_ANCHOR}', ')',
+ str_replace('{OPEN_SQR}', '[',
+ str_replace('{CLOSE_SQR}', ']',
+ str_replace('{PER}', '%',
$code
)))))))));
$pattern['d2dpg1'] = $http.$domain2.$dir.$page.$getstring1;
$pattern['ipdpg1'] = $http.$ip.$dir.$page.$getstring1;
// Pattern for URLs like http://url/dir/?var=value
- $pattern['d1dg1'] = $http.$domain1.$dir."/".$getstring1;
- $pattern['d2dg1'] = $http.$domain2.$dir."/".$getstring1;
- $pattern['ipdg1'] = $http.$ip.$dir."/".$getstring1;
+ $pattern['d1dg1'] = $http.$domain1.$dir.'/'.$getstring1;
+ $pattern['d2dg1'] = $http.$domain2.$dir.'/'.$getstring1;
+ $pattern['ipdg1'] = $http.$ip.$dir.'/'.$getstring1;
// Pattern for URLs like http://url/dir/page.ext
$pattern['d1dp'] = $http.$domain1.$dir.$page;
$pattern['d1dp'] = $http.$domain2.$dir.$page;
$pattern['d2d'] = $http.$domain2.$dir;
$pattern['ipd'] = $http.$ip.$dir;
// Pattern for URLs like http://url/?var=value
- $pattern['d1g1'] = $http.$domain1."/".$getstring1;
- $pattern['d2g1'] = $http.$domain2."/".$getstring1;
- $pattern['ipg1'] = $http.$ip."/".$getstring1;
+ $pattern['d1g1'] = $http.$domain1.'/'.$getstring1;
+ $pattern['d2g1'] = $http.$domain2.'/'.$getstring1;
+ $pattern['ipg1'] = $http.$ip.'/'.$getstring1;
// Pattern for URLs like http://url?var=value
$pattern['d1g12'] = $http.$domain1.$getstring1;
$pattern['d2g12'] = $http.$domain2.$getstring1;
$pat = str_replace("[:alnum:]", "0-9a-zA-Z", $pat);
$pat = str_replace("[:alpha:]", "a-zA-Z", $pat);
$pat = str_replace("[:digit:]", "0-9", $pat);
- $pat = str_replace(".", "\.", $pat);
+ $pat = str_replace('.', "\.", $pat);
$pat = str_replace("@", "\@", $pat);
echo $key."= ".$pat."<br />";
}
}
// Wtites data to a config.php-style file
-// @TODO Rewrite this function to use READ_FILE() and WRITE_FILE()
+// @TODO Rewrite this function to use readFromFile() and writeToFile()
function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
// Initialize some variables
$done = false;
$found = false;
// Is the file there and read-/write-able?
- if ((FILE_READABLE($FQFN)) && (is_writeable($FQFN))) {
+ if ((isFileReadable($FQFN)) && (is_writeable($FQFN))) {
$search = "CFG: ".$comment;
$tmp = $FQFN.".tmp";
return false;
}
// Send notification to admin
-function SEND_ADMIN_NOTIFICATION ($subject, $templateName, $content=array(), $uid="0") {
+function sendAdminNotification ($subject, $templateName, $content=array(), $uid = '0') {
if (GET_EXT_VERSION('admins') >= '0.4.1') {
// Send new way
SEND_ADMIN_EMAILS_PRO($subject, $templateName, $content, $uid);
} // END - if
// Get more daily reset scripts
- SET_INC_POOL(GET_DIR_AS_ARRAY("inc/reset/", "reset_"));
+ SET_INC_POOL(getArrayFromDirectory('inc/reset/', 'reset_'));
// Update database
- if (!defined('DEBUG_RESET')) UPDATE_CONFIG("last_update", time());
+ if (!defined('DEBUG_RESET')) updateConfiguration('last_update', time());
// Is the config entry set?
if (GET_EXT_VERSION('sql_patches') >= '0.4.2') {
// Create current week mark
- $currWeek = date("W", time());
+ $currWeek = date('W', time());
// Has it changed?
if (getConfig('last_week') != $currWeek) {
// Include weekly reset scripts
- MERGE_INC_POOL(GET_DIR_AS_ARRAY("inc/weekly/", "weekly_"));
+ MERGE_INC_POOL(getArrayFromDirectory('inc/weekly/', 'weekly_'));
// Update config
- if (!defined('DEBUG_WEEKLY')) UPDATE_CONFIG("last_week", $currWeek);
+ if (!defined('DEBUG_WEEKLY')) updateConfiguration('last_week', $currWeek);
} // END - if
// Create current month mark
- $currMonth = date("m", time());
+ $currMonth = date('m', time());
// Has it changed?
if (getConfig('last_month') != $currMonth) {
// Include monthly reset scripts
- MERGE_INC_POOL(GET_DIR_AS_ARRAY("inc/monthly/", "monthly_"));
+ MERGE_INC_POOL(getArrayFromDirectory('inc/monthly/', 'monthly_'));
// Update config
- if (!defined('DEBUG_MONTHLY')) UPDATE_CONFIG("last_month", $currMonth);
+ if (!defined('DEBUG_MONTHLY')) updateConfiguration('last_month', $currMonth);
} // END - if
} // END - if
}
// Handle extra values
-function HANDLE_EXTRA_VALUES ($filterFunction, $value, $extraValue) {
+function handleExtraValues ($filterFunction, $value, $extraValue) {
// Default is the value itself
$ret = $value;
}
// Check if given FQFN is a readable file
-function FILE_READABLE ($FQFN) {
+function isFileReadable ($FQFN) {
// Check all...
return ((file_exists($FQFN)) && (is_file($FQFN)) && (is_readable($FQFN)));
}
// Converts timestamp selections into a timestamp
-function CONVERT_SELECTIONS_TO_TIMESTAMP (&$POST, &$DATA, &$id, &$skip) {
+function convertSelectionsToTimestamp (&$POST, &$DATA, &$id, &$skip) {
// Init test variable
$test2 = '';
$test = substr($id, -3);
// Improved way of checking! :-)
- if (in_array($test, array("_ye", "_mo", "_we", "_da", "_ho", "_mi", "_se"))) {
+ if (in_array($test, array('_ye', '_mo', '_we', '_da', '_ho', '_mi', '_se'))) {
// Found a multi-selection for timings?
$test = substr($id, 0, -3);
- if ((isset($POST[$test."_ye"])) && (isset($POST[$test."_mo"])) && (isset($POST[$test."_we"])) && (isset($POST[$test."_da"])) && (isset($POST[$test."_ho"])) && (isset($POST[$test."_mi"])) && (isset($POST[$test."_se"])) && ($test != $test2)) {
+ if ((isset($POST[$test.'_ye'])) && (isset($POST[$test.'_mo'])) && (isset($POST[$test.'_we'])) && (isset($POST[$test.'_da'])) && (isset($POST[$test.'_ho'])) && (isset($POST[$test.'_mi'])) && (isset($POST[$test.'_se'])) && ($test != $test2)) {
// Generate timestamp
- $POST[$test] = CREATE_TIMESTAMP_FROM_SELECTIONS($test, $POST);
+ $POST[$test] = createTimestampFromSelections($test, $POST);
$DATA[] = sprintf("%s='%s'", $test, $POST[$test]);
// Remove data from array
- foreach (array("ye", "mo", "we", "da", "ho", "mi", "se") as $rem) {
- unset($POST[$test."_".$rem]);
+ foreach (array('ye', 'mo', 'we', 'da', 'ho', 'mi', 'se') as $rem) {
+ unset($POST[$test.'_'.$rem]);
} // END - foreach
// Skip adding
}
// Reverts the german decimal comma into Computer decimal dot
-function REVERT_COMMA ($str) {
+function convertCommaToDot ($str) {
// Default float is not a float... ;-)
$float = false;
// Which language is selected?
- switch (GET_LANGUAGE()) {
- case "de": // German language
+ switch (getLanguage()) {
+ case 'de': // German language
// Remove german thousand dots first
- $str = str_replace(".", '', $str);
+ $str = str_replace('.', '', $str);
// Replace german commata with decimal dot and cast it
- $float = (float)str_replace(",", ".", $str);
+ $float = (float)str_replace(',', '.', $str);
break;
default: // US and so on
// Remove thousand dots first and cast
- $float = (float)str_replace(",", '', $str);
+ $float = (float)str_replace(',', '', $str);
break;
}
// Is the session data set?
if ((isSessionVariableSet('mxchange_'.$accessLevel.'_failures')) && (isSessionVariableSet('mxchange_'.$accessLevel.'_last_fail'))) {
// Ignore zero values
- if (get_session('mxchange_'.$accessLevel.'_failures') > 0) {
+ if (getSession('mxchange_'.$accessLevel.'_failures') > 0) {
// Non-guest has login failures found, get both data and prepare it for template
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):accessLevel={$accessLevel}<br />\n";
$content = array(
- 'login_failures' => get_session('mxchange_'.$accessLevel.'_failures'),
- 'last_failure' => MAKE_DATETIME(get_session('mxchange_'.$accessLevel.'_last_fail'), "2")
+ 'login_failures' => getSession('mxchange_'.$accessLevel.'_failures'),
+ 'last_failure' => generateDateTime(getSession('mxchange_'.$accessLevel.'_last_fail'), "2")
);
// Load template
- $OUT = LOAD_TEMPLATE("login_failures", true, $content);
+ $OUT = LOAD_TEMPLATE('login_failures', true, $content);
} // END - if
// Reset session data
- set_session('mxchange_'.$accessLevel.'_failures', '');
- set_session('mxchange_'.$accessLevel.'_last_fail', '');
+ setSession('mxchange_'.$accessLevel.'_failures', '');
+ setSession('mxchange_'.$accessLevel.'_last_fail', '');
} // END - if
// Return rendered content
}
// Rebuild cache
-function rebuildCacheFiles ($cache, $inc="") {
+function rebuildCacheFiles ($cache, $inc = '') {
// Shall I remove the cache file?
if ((EXT_IS_ACTIVE('cache')) && (isCacheInstanceValid())) {
// Rebuild cache
$INC = sprintf("inc/loader/load_cache-%s.php", $inc);
// Is the include there?
- if (INCLUDE_READABLE($INC)) {
+ if (isIncludeReadable($INC)) {
// And rebuild it from scratch
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): inc={$inc} - LOADED!<br />\n";
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
// Include not found!
DEBUG_LOG(__FUNCTION__, __LINE__, "Include {$inc} not found. cache={$cache}");
}
// Purge admin menu cache
-function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") {
+function cachePurgeAdminMenu ($id=0, $action = '', $what = '', $str = '') {
// Is the cache extension enabled or no cache instance or admin menu cache disabled?
if (!EXT_IS_ACTIVE('cache')) {
// Cache extension not active
debug_report_bug("<strong>Experimental feature:</strong> You have to delete the admin_*.cache files by yourself at this point.");
}
-// Translates the "pool type" into human-readable
-function TRANSLATE_POOL_TYPE ($type) {
- // Default?type is unknown
- $translated = sprintf(getMessage('POOL_TYPE_UNKNOWN'), $type);
-
- // Generate constant
- $constName = sprintf("POOL_TYPE_%s", $type);
-
- // Does it exist?
- if (defined($constName)) {
- // Then use it
- $translated = getMessage($constName);
- } // END - if
-
- // Return "translation"
- return $translated;
-}
-
// Determines the real remote address
function determineRealRemoteAddress () {
// Is a proxy in use?
}
// "Getter" for remote IP number
-function GET_REMOTE_ADDR () {
+function detectRemoteAddr () {
// Get remote ip from environment
$remoteAddr = determineRealRemoteAddress();
}
// "Getter" for remote hostname
-function GET_REMOTE_HOST () {
+function detectRemoteHostname () {
// Get remote ip from environment
$remoteHost = getenv('REMOTE_HOST');
}
// "Getter" for user agent
-function GET_USER_AGENT () {
+function detectUserAgent () {
// Get remote ip from environment
$userAgent = getenv('HTTP_USER_AGENT');
}
// "Getter" for referer
-function GET_REFERER () {
+function detectReferer () {
// Get remote ip from environment
$referer = getenv('HTTP_REFERER');
// Adds a bonus mail to the queue
// This is a high-level function!
-function ADD_NEW_BONUS_MAIL ($data, $mode="", $output=true) {
+function addNewBonusMail ($data, $mode = '', $output=true) {
// Use mode from data if not set and availble ;-)
if ((empty($mode)) && (isset($data['mode']))) $mode = $data['mode'];
// Generate receiver list
- $RECEIVER = GENERATE_RECEIVER_LIST($data['cat'], $data['receiver'], $mode);
+ $RECEIVER = generateReceiverList($data['cat'], $data['receiver'], $mode);
// Receivers added?
if (!empty($RECEIVER)) {
// Add bonus mail to queue
- ADD_BONUS_MAIL_TO_QUEUE(
+ addBonusMailToQueue(
$data['subject'],
$data['text'],
$RECEIVER,
} elseif (!empty($_GET['ref'])) {
// Set refid=ref (the referal link uses such variable)
$GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_GET['ref']));
- } elseif ((isSessionVariableSet('refid')) && (get_session('refid') != 0)) {
+ } elseif ((isSessionVariableSet('refid')) && (getSession('refid') != 0)) {
// Set session refid als global
- $GLOBALS['refid'] = bigintval(get_session('refid'));
- } elseif ((GET_EXT_VERSION('sql_patches') != "") && (getConfig('def_refid') > 0)) {
+ $GLOBALS['refid'] = bigintval(getSession('refid'));
+ } elseif ((GET_EXT_VERSION('sql_patches') != '') && (getConfig('def_refid') > 0)) {
// Set default refid as refid in URL
$GLOBALS['refid'] = getConfig(('def_refid'));
} elseif ((GET_EXT_VERSION('user') >= '0.3.4') && (getConfig('select_user_zero_refid')) == 'Y') {
}
// Set cookie when default refid > 0
- if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((get_session('refid') == "0") && (getConfig('def_refid') > 0))) {
+ if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((getSession('refid') == '0') && (getConfig('def_refid') > 0))) {
// Set cookie
- set_session('refid', $GLOBALS['refid']);
+ setSession('refid', $GLOBALS['refid']);
} // END - if
// Return determined refid
$baseName = basename($FQFN);
// Check it
- $isDirectory = ((is_dir($FQFN)) && ($baseName != ".") && ($baseName != "..") && ($baseName != ".svn"));
+ $isDirectory = ((is_dir($FQFN)) && ($baseName != '.') && ($baseName != '..') && ($baseName != ".svn"));
// Return the result
return $isDirectory;
} // END - if
// Load (maybe) missing file
-LOAD_INC_ONCE('inc/libs/mediadata_functions.php');
+loadIncludeOnce('inc/libs/mediadata_functions.php');
// Insert info to database
MEDIA_UPDATE_ENTRY(array('total_send' , 'normal_send') , 'init', $nsent);
}
// Make sure our functions are there
-LOAD_INC_ONCE("inc/libs/refback_functions.php");
+loadIncludeOnce('inc/libs/refback_functions.php');
// Sanity-check: Do we have ref level 0?
-$result = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_refsystem` WHERE level=0", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT `id` FROM `{!_MYSQL_PREFIX!}_refsystem` WHERE level=0", __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Remove index temporaly
SQL_ALTER_TABLE("ALTER TABLE `{!_MYSQL_PREFIX!}_refsystem` DROP INDEX `userid_level`", __FILE__, __LINE__);
// Update refback table
//* DEBUG: */ echo "uid={$content['userid']}<br />\n";
- UPDATE_REFBACK_TABLE($content['userid']);
+ updateRefbackTable($content['userid']);
} // END - while
} // END - if
if (GET_EXT_VERSION('sql_patches') < '0.3.6') return false;
// Check if there is no scrambling string
-if (getConfig('pass_scramble') == "") {
+if (getConfig('pass_scramble') == '') {
// Generate 40 chars long scramble string
$scrambleString = genScrambleString(40);
} // END - if
// Check if there is no master salt string
-if (getConfig('master_salt') == "") {
+if (getConfig('master_salt') == '') {
// Generate the master salt which is the first chars minus 40 chars of this random hash
// We do an extra scrambling here...
- $masterSalt = scrambleString(substr(sha1(GEN_PASS(mt_rand(128, 256))), 0, -40));
+ $masterSalt = scrambleString(substr(sha1(generatePassword(mt_rand(128, 256))), 0, -40));
// ... and store it there for future usage
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_config` SET master_salt='%s' WHERE config=0 LIMIT 1",
unset($masterSalt);
} // END - if
-if (getConfig('file_hash') == "") {
+if (getConfig('file_hash') == '') {
// Create filename from hashed random string
- $fileHash = sha1(GEN_PASS(mt_rand(128, 256)));
+ $fileHash = sha1(generatePassword(mt_rand(128, 256)));
$FQFN = sprintf("%sinc/.secret/.%s",
constant('PATH'),
$fileHash
$nums = mt_rand(40, 45);
// Generate secret key from a randomized string
- $secretKey = substr(sha1(GEN_PASS(mt_rand(128, 256))), -$nums);
+ $secretKey = substr(sha1(generatePassword(mt_rand(128, 256))), -$nums);
// File hash was never created
- WRITE_FILE($FQFN, $secretKey);
+ writeToFile($FQFN, $secretKey);
// Is the file there?
- if (FILE_READABLE($FQFN)) {
+ if (isFileReadable($FQFN)) {
//* DEBUG: */ unlink($FQFN);
- //* DEBUG: */ $test = hexdec(get_session('u_hash')) / hexdec($secretKey);
+ //* DEBUG: */ $test = hexdec(getSession('u_hash')) / hexdec($secretKey);
//* DEBUG: */ $test = generateHash(str_replace('.', '', $test));
- //* DEBUG: */ die("Secret-Key: ".$secretKey."<br />Cookie: ".get_session('u_hash')."<br />Test: ".$test);
+ //* DEBUG: */ die("Secret-Key: ".$secretKey."<br />Cookie: ".getSession('u_hash')."<br />Test: ".$test);
// Write $fileHash to database
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_config` SET file_hash='%s' WHERE config=0 LIMIT 1",
);
// Is the .htaccess file there?
- if (!FILE_READABLE($FQFN)) {
+ if (!isFileReadable($FQFN)) {
// Also create .htaccess file
- WRITE_FILE($FQFN, "Deny from all\n");
+ writeToFile($FQFN, "Deny from all\n");
} // END - if
// Also update configuration
// Config and database connection valid?
if ((isConfigLoaded()) && (SQL_IS_LINK_UP())) {
// Title decoration enabled?
- if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_left') != "")) $TITLE .= trim(getConfig('title_left'))." ";
+ if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_left') != '')) $TITLE .= trim(getConfig('title_left'))." ";
// Do we have some extra title?
if (!empty($EXTRA_TITLE)) {
$TITLE .= constant('MAIN_TITLE');
// Add title of module? (middle decoration will also be added!)
- if ((getConfig('enable_mod_title') == 'Y') || ((empty($GLOBALS['what'])) && (empty($GLOBALS['action']))) || ($GLOBALS['module'] == 'admin')) $TITLE .= " ".trim(getConfig('title_middle'))." ".ADD_MODULE_TITLE($GLOBALS['module']);
+ if ((getConfig('enable_mod_title') == 'Y') || ((empty($GLOBALS['what'])) && (empty($GLOBALS['action']))) || ($GLOBALS['module'] == 'admin')) $TITLE .= " ".trim(getConfig('title_middle'))." ".getModuleTitle($GLOBALS['module']);
// Add title from what file
$mode = '';
if ($GLOBALS['module'] == "login") $mode = 'member';
elseif ($GLOBALS['module'] == 'index') $mode = 'guest';
- if ((!empty($mode)) && (getConfig('enable_what_title') == 'Y')) $TITLE .= " ".trim(getConfig('title_middle'))." ".GET_MOD_DESCR($mode, $GLOBALS['what']);
+ if ((!empty($mode)) && (getConfig('enable_what_title') == 'Y')) $TITLE .= " ".trim(getConfig('title_middle'))." ".getModuleDescription($mode, $GLOBALS['what']);
// Add title decorations? (right)
- if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_right') != "")) $TITLE .= " ".trim(getConfig('title_right'));
+ if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_right') != '')) $TITLE .= " ".trim(getConfig('title_right'));
// Remember title in constant for the template
define('__PAGE_TITLE', $TITLE);
// Add meta description to header
if ((isInstalled()) && (isAdminRegistered()) && (SQL_IS_LINK_UP())) {
// Add meta description not in admin and login module and when the script is installed
- META_DESCRIPTION($GLOBALS['module'], $GLOBALS['what']);
+ generateMetaDescriptionCode($GLOBALS['module'], $GLOBALS['what']);
} // END - if
} // END - if
LOAD_TEMPLATE("header");
// Include stylesheet
- LOAD_INC_ONCE("inc/stylesheet.php");
+ loadIncludeOnce("inc/stylesheet.php");
} // END - if
// Closing HEAD tag
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
* MA 02110-1301 USA *
************************************************************************/
+
// Some security stuff...
if (!defined('__SECURITY')) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
}
// Check if our config file is writeable or not
-function IS_INC_WRITEABLE ($inc) {
+function isIncludeWriteable ($inc) {
// Generate FQFN
$FQFN = sprintf("%sinc/%s.php", constant('PATH'), $inc);
// Abort by simple test
- if ((FILE_READABLE($FQFN)) && (!is_writeable($FQFN))) {
+ if ((isFileReadable($FQFN)) && (!is_writeable($FQFN))) {
return false;
} // END - if
}
// Reads a directory with PHP files in and gets only files back
-function GET_DIR_AS_ARRAY ($baseDir, $prefix, $includeDirs = false, $addBaseDir = true, $excludePattern = '@(\.|\.\.)$@') {
+function getArrayFromDirectory ($baseDir, $prefix, $includeDirs = false, $addBaseDir = true, $excludePattern = '@(\.|\.\.)$@') {
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix} - Entered!");
// Init includes
$INCs = array();
// Steps over this returned $baseFile-Name, when it matches the $excludePattern
if (preg_match($excludePattern, $baseFile, $match)) {
// These Lines are only for debugging!!
- //$INC = $baseDir . "/" . $baseFile;
+ //$INC = $baseDir . '/' . $baseFile;
//$FQFN = constant('PATH') . $INC;
//echo '<pre>$baseDir:'.print_r($baseDir, true).'</pre>';
//echo '<pre>$baseDir:'.print_r(constant('PATH') . $baseDir, true).'</pre>';
} // END - if
// Construct include filename and FQFN
- $INC = $baseDir . "/" . $baseFile;
+ $INC = $baseDir . '/' . $baseFile;
$FQFN = constant('PATH') . $INC;
// repalecment of // to / is needed, whenn $baseDir is an emty String
// Is this a valid reset file?
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix},baseFile={$baseFile}");
- if (((FILE_READABLE($FQFN)) && (substr($baseFile, 0, strlen($prefix)) == $prefix) && (substr($baseFile, -4, 4) == ".php")) || (($includeDirs) && (isDirectory($FQFN)))) {
+ if (((isFileReadable($FQFN)) && (substr($baseFile, 0, strlen($prefix)) == $prefix) && (substr($baseFile, -4, 4) == ".php")) || (($includeDirs) && (isDirectory($FQFN)))) {
// Remove both for extension name
$extName = substr($baseFile, strlen($prefix), -4);
// Seems to work, also right database?
if (SQL_SELECT_DB($mysql['dbase'], __FILE__, __LINE__) === true) {
// Automatically run install.sql
- if ((FILE_READABLE(REQUEST_POST('spath').'install/tables.sql')) && (FILE_READABLE(REQUEST_POST('spath').'install/menu-'.GET_LANGUAGE().'.sql'))) {
+ if ((isFileReadable(REQUEST_POST('spath').'install/tables.sql')) && (isFileReadable(REQUEST_POST('spath').'install/menu-'.getLanguage().'.sql'))) {
// Both exists so import them
- foreach (array('tables', 'menu-'.GET_LANGUAGE()) as $dump) {
+ foreach (array('tables', 'menu-'.getLanguage()) as $dump) {
// Should be save here because file_exists() is there but we check it again. :)
$FQFN = REQUEST_POST('spath') . 'install/' . $dump . '.sql';
// Is the file readable?
- if (FILE_READABLE($FQFN)) {
+ if (isFileReadable($FQFN)) {
// Read the file
- $fileContent = READ_FILE($FQFN, true);
+ $fileContent = readFromFile($FQFN, true);
// Replace the {!prefix/type!} with actual one
foreach (array('prefix', 'type') as $replace) {
LOAD_TEMPLATE('install_fatal_errors');
} else {
// Installation is done!
- LOAD_URL('install.php?page=finalize');
+ redirectToUrl('install.php?page=finalize');
}
} elseif (isInstalled()) {
// Redirection after writing data... :-)
} else {
// Something goes wrong during installation! :-(
addFatalMessage(__FILE__, __LINE__, getMessage('INSTALL_FINALIZER_FAILED'));
- LOAD_INC('inc/fatal_errors.php');
+ loadInclude('inc/fatal_errors.php');
}
break;
}
// Try to get language from session
-$mx_lang = get_session('mx_lang');
+$mx_lang = getSession('mx_lang');
// Set default language if it is not (yet) set
if (is_null($mx_lang)) $mx_lang = constant('DEFAULT_LANG');
$FQFN = constant('PATH') . $INC;
// Look for file
-if (!FILE_READABLE($FQFN)) {
+if (!isFileReadable($FQFN)) {
// Switch to default (DO NOT CHANGE!!!)
$mx_lang = constant('DEFAULT_LANG');
- set_session('mx_lang', $mx_lang);
+ setSession('mx_lang', $mx_lang);
$INC = sprintf("inc/language/%s.php", $mx_lang);
} // END - if
// Load language file
-LOAD_INC_ONCE($INC);
+loadIncludeOnce($INC);
// Check for installation mode
if ((isInstalling()) || (!isInstalled()) || (!isAdminRegistered())) {
// Load matching language file
- LOAD_INC('inc/language/install_' . $mx_lang . '.php');
+ loadInclude('inc/language/install_' . $mx_lang . '.php');
}
// Remove no more needed variables
}
// Check ACL for menu combination
-function ADMINS_CHECK_ACL($act, $wht) {
+function adminsCheckAdminAcl ($act, $wht) {
// If action is login or logout allow allways!
$default = "allow";
if (($act == "login") || ($act == "logout")) return true;
$ret = false;
// Get admin's ID
- $aid = GET_CURRENT_ADMIN_ID();
+ $aid = getCurrentAdminId();
// Get admin's defult access right
- $default = GET_ADMIN_DEFAULT_ACL($aid);
+ $default = getAdminDefaultAcl($aid);
if (!empty($wht)) {
// Check for parent menu:
// First get it's action value
- $parent_action = GET_ACTION('admin', $wht);
+ $parent_action = getModeAction('admin', $wht);
// Check with this function...
- $parent = ADMINS_CHECK_ACL($parent_action, '');
+ $parent = adminsCheckAdminAcl($parent_action, '');
} else {
// Anything else is true!
$parent = false;
}
// Create email link to admins's account
-function ADMINS_CREATE_EMAIL_LINK ($email, $mod='admin') {
+function adminsCreateEmailLink ($email, $mod='admin') {
// Is it an email?
if (strpos($email, "@") !== false) {
// Create email link
}
// Change a lot admin account
-function ADMINS_CHANGE_ADMIN_ACCOUNT($POST) {
+function adminsChangeAdminAccount ($POST) {
// Begin the update
$cache_update = 0;
foreach ($POST['login'] as $id => $login) {
if (!empty($POST['pass1'][$id])) $add = sprintf(", password='%s'", SQL_ESCAPE($hash));
// Get admin's ID
- $aid = GET_CURRENT_ADMIN_ID();
+ $aid = getCurrentAdminId();
$salt = substr(GET_ADMIN_HASH($aid), 0, -40);
// Rewrite cookie when it's own account
if ($aid == $id) {
// Set timeout cookie
- set_session('admin_last', time());
+ setSession('admin_last', time());
- if ($login != get_session('admin_login')) {
+ if ($login != getSession('admin_login')) {
// Update login cookie
- set_session('admin_login', $login);
+ setSession('admin_login', $login);
// Update password cookie as well?
- if (!empty($add)) set_session('admin_md5', $hash);
- } elseif (generateHash($POST['pass1'][$id], $salt) != get_session('admin_md5')) {
+ if (!empty($add)) setSession('admin_md5', $hash);
+ } elseif (generateHash($POST['pass1'][$id], $salt) != getSession('admin_md5')) {
// Update password cookie
- set_session('admin_md5', $hash);
+ setSession('admin_md5', $hash);
}
} // END - if
// Get default ACL from admin to check if we can allow him to change the default ACL
- $default = GET_ADMIN_DEFAULT_ACL(GET_CURRENT_ADMIN_ID());
+ $default = getAdminDefaultAcl(getCurrentAdminId());
// Update admin account
if ($default == "allow") {
email='%s',
default_acl='%s',
la_mode='%s'
-WHERE id=%s LIMIT 1",
+WHERE `id`=%s LIMIT 1",
array(
$login,
$POST['email'][$id],
login='%s'".$add.",
email='%s',
la_mode='%s'
-WHERE id=%s LIMIT 1",
+WHERE `id`=%s LIMIT 1",
array(
$login,
$POST['email'][$id],
}
// Purge cache
- CACHE_PURGE_ADMIN_MENU($id);
+ cachePurgeAdminMenu($id);
// Admin account saved
$message = ADMIN_ACCOUNT_SAVED;
}
// Make admin accounts editable
-function ADMINS_EDIT_ADMIN_ACCOUNTS ($POST) {
+function adminsEditAdminAccount ($POST) {
// "Resolve" current's admin access mode
- $currMode = GET_ADMIN_DEFAULT_ACL(GET_CURRENT_ADMIN_ID());
+ $currMode = getAdminDefaultAcl(getCurrentAdminId());
// Begin the edit loop
$OUT = ''; $SW = 2;
$id = bigintval($id);
// Get the admin's data
- $result = SQL_QUERY_ESC("SELECT login, email, default_acl AS mode, la_mode FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT login, email, default_acl AS mode, la_mode FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
array($id), __FUNCTION__, __LINE__);
if ((SQL_NUMROWS($result) == 1) && ($selected == 1)) {
// Entry found
// Shall we allow changing default ACL?
if ($currMode == "allow") {
// Allow chaning it
- $content['mode'] = ADD_OPTION_LINES("/ARRAY/", array("allow", "deny"), array(constant('ADMINS_ALLOW_MODE'), constant('ADMINS_DENY_MODE')), $content['mode']);
+ $content['mode'] = generateOptionList("/ARRAY/", array("allow", "deny"), array(constant('ADMINS_ALLOW_MODE'), constant('ADMINS_DENY_MODE')), $content['mode']);
} else {
// Don't allow it
$content['mode'] = " ";
}
- $content['la_mode'] = ADD_OPTION_LINES("/ARRAY/", array("global", "OLD", "NEW"), array(ADMINS_GLOBAL_LA_SETTING, ADMINS_OLD_LA_SETTING, ADMINS_NEW_LA_SETTING), $content['la_mode']);
+ $content['la_mode'] = generateOptionList("/ARRAY/", array("global", "OLD", "NEW"), array(ADMINS_GLOBAL_LA_SETTING, ADMINS_OLD_LA_SETTING, ADMINS_NEW_LA_SETTING), $content['la_mode']);
// Load row template and switch color
$OUT .= LOAD_TEMPLATE("admin_edit_admins_row", true, $content);
}
// Delete given admin accounts
-function ADMINS_DELETE_ADMIN_ACCOUNTS ($POST) {
+function adminsDeleteAdminAccount ($POST) {
// Check if this account is the last one which cannot be deleted...
- $result_main = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_admins`", __FUNCTION__, __LINE__);
+ $result_main = SQL_QUERY("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admins`", __FUNCTION__, __LINE__);
$accounts = SQL_NUMROWS($result_main);
SQL_FREERESULT($result_main);
if ($accounts > 1) {
$id = bigintval($id);
// Get the admin's data
- $result = SQL_QUERY_ESC("SELECT login, email, default_acl AS mode, la_mode FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT login, email, default_acl AS mode, la_mode FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
array($id), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Entry found
}
// Remove the given accounts
-function ADMINS_REMOVE_ADMIN_ACCOUNTS ($POST) {
+function adminsRemoveAdminAccount ($POST) {
// Begin removal
$cache_update = 0;
foreach ($POST['sel'] as $id => $del) {
$id = bigintval($id);
// Delete only when it's not your own account!
- if (($del == 1) && (GET_CURRENT_ADMIN_ID() != $id)) {
+ if (($del == 1) && (getCurrentAdminId() != $id)) {
// Rewrite his tasks to all admins
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET assigned_admin=0 WHERE assigned_admin=%s",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET `assigned_admin`=0 WHERE `assigned_admin`=%s",
array($id), __FUNCTION__, __LINE__);
// Remove account
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
array($id), __FUNCTION__, __LINE__);
// Purge cache
- CACHE_PURGE_ADMIN_MENU($id);
+ cachePurgeAdminMenu($id);
$cache_update = "1";
}
}
}
// List all admin accounts
-function ADMINS_LIST_ADMIN_ACCOUNTS() {
+function adminsListAdminAccounts() {
// Select all admin accounts
$result = SQL_QUERY("SELECT id, login, email, default_acl AS mode, la_mode FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY login ASC", __FUNCTION__, __LINE__);
$OUT = ''; $SW = 2;
// Prepare some more data
$content['sw'] = $SW;
- $content['email_link'] = CREATE_EMAIL_LINK($content['id']);
+ $content['email_link'] = generateMemberEmailLink($content['id']);
// Load row template and switch color
$OUT .= LOAD_TEMPLATE("admin_list_admins_row", true, $content);
}
// Filter for adding extra data to the query
-function FILTER_ADD_EXTRA_SQL_DATA ($add = "") {
+function FILTER_ADD_EXTRA_SQL_DATA ($add = '') {
// Is the admins extension updated? (should be!)
if (GET_EXT_VERSION('admins') >= '0.3.0') $add .= ", default_acl AS def_acl";
if (GET_EXT_VERSION('admins') >= '0.6.7') $add .= ", la_mode";
if (($payout > 0) && (!empty($payout))) {
// Yes, he has.
$target = "locked_points";
- } elseif ($payout == "0") {
+ } elseif ($payout == '0') {
// No, he has not
$target = "points";
}
}
// Send out mail to user
- $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_points", TRANSLATE_COMMA($points), $uid);
- SEND_EMAIL($uid, AUTOPURGE_MEMBER_SUBJECT, $msg);
+ $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_points", translateComma($points), $uid);
+ sendEmail($uid, getMessage('AUTOPURGE_MEMBER_SUBJECT'), $msg);
}
}
} else {
// Add points to account
unset($GLOBALS['ref_level']);
- ADD_POINTS_REFSYSTEM('beg', $uid, $points, false, "0", $locked, strtolower(getConfig('beg_mode')));
+ ADD_POINTS_REFSYSTEM('beg', $uid, $points, false, '0', $locked, strtolower(getConfig('beg_mode')));
}
// Subtract begged points from member account if the admin has selected one
$ranks = count(explode(';', getConfig('turbo_rates'))) + 1;
// Load current user's data
- $result = SQL_QUERY_ESC("SELECT level, points, timemark FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE %s=%s AND userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT level, points, timemark FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE %s=%s AND `userid`=%s LIMIT 1",
array($type, $data, $uid), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load data
list($rank, $points, $mark) = SQL_FETCHROW($result);
// Remember all values for later use
- $self = true; $points = TRANSLATE_COMMA($points);
+ $self = true; $points = translateComma($points);
// Transfer data to template
define('__YR_LEVEL' , $rank);
define('__YR_POINTS', $points);
- define('__YR_TMARK' , MAKE_DATETIME($mark, "1"));
+ define('__YR_TMARK' , generateDateTime($mark, "1"));
// Load template
define('__YOUR_RANKING_LINE', LOAD_TEMPLATE("show_bonus_yr", true));
} // END - if
// Load rankings
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE %s=%s ORDER BY level LIMIT %s",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE %s=%s ORDER BY level LIMIT %s",
array($type, $data, getConfig('bonus_lines')), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Start generating the ranking list
list($userid, $points, $mark) = SQL_FETCHROW($result_users);
// Translate comma
- $points = TRANSLATE_COMMA($points);
+ $points = translateComma($points);
} // END - if
// Output row
if (getConfig('bonus_active') != 'Y') return;
// Switch to jackpot-mode when no UID is supplied but userid-mode is selected
- if ((getConfig('bonus_mode') == "UID") && (getConfig('bonus_uid') == "0")) {
+ if ((getConfig('bonus_mode') == "UID") && (getConfig('bonus_uid') == '0')) {
// Update database & config
- UPDATE_CONFIG('bonus_mode', "JACKPOT");
+ updateConfiguration('bonus_mode', 'JACKPOT');
} // END - if
if ($mode == "login_bonus") {
// Subtract points from...
switch (getConfig('bonus_mode'))
{
- case "JACKPOT": // ... jackpot
+ case 'JACKPOT': // ... jackpot
if ((SUB_JACKPOT($points) == -1) && (getConfig('bonus_uid') > 0)) {
// Check points amount first...
$total = GET_TOTAL_DATA(getConfig('bonus_uid'), "user_points", "points") - GET_TOTAL_DATA(getConfig('bonus_uid'), "user_data", "used_points");
$result = SQL_QUERY("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE timemark < (UNIX_TIMESTAMP() - ".getConfig('bonus_timeout').")", __FUNCTION__, __LINE__);
if (SQL_AFFECTEDROWS() > 0) {
// Send out email to admin
- SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_TURBO_SUBJECT, "admin_autopurge_turbo", SQL_AFFECTEDROWS(), '');
+ sendAdminNotification(AUTOPURGE_ADMIN_TURBO_SUBJECT, "admin_autopurge_turbo", SQL_AFFECTEDROWS(), '');
}
}
//
touch($fqfn, 'w');
// Is the file there?
- if (FILE_READABLE($fqfn)) {
+ if (isFileReadable($fqfn)) {
// Yes, we can do. So let's remove it
unlink($fqfn);
// Is there a .htaccess file?
- if (FILE_READABLE($path . '.htaccess')) {
+ if (isFileReadable($path . '.htaccess')) {
// Update database that we have tested it
- UPDATE_CONFIG('cache_tested', 1);
+ updateConfiguration('cache_tested', 1);
// All done!
$this->ret = $this->statusDone;
// Remember cache file
$this->name = $cacheName;
- // Construct include filename for LOAD_INC_ONCE() call
+ // Construct include filename for loadIncludeOnce() call
$this->inc = $this->path . $cacheName . $this->extension;
// Construct FQFN (full qualified file name)
// Checks wether the current cache file is readable
function isCacheReadable () {
- return INCLUDE_READABLE($this->inc);
+ return isIncludeReadable($this->inc);
}
} // END - class
// Filter for purging entire admin menu cache
function FILTER_CACHE_PURGE_ADMIN_MENU () {
// Just call the function
- CACHE_PURGE_ADMIN_MENU();
+ cachePurgeAdminMenu();
}
//
// Generate a human-readable country description with code
function COUNTRY_GENERATE_INFO ($id) {
// Load code and description
- $result = SQL_QUERY_ESC("SELECT code, descr FROM `{!_MYSQL_PREFIX!}_countries` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT code, descr FROM `{!_MYSQL_PREFIX!}_countries` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FUNCTION__, __LINE__);
// Is there an entry?
// Generates a HTML table based on given data
// @TODO Lame description
-function DOUBLER_GENERATE_TABLE ($uid="0", $done='N', $ref='N', $sort="ASC") {
+function DOUBLER_GENERATE_TABLE ($uid = '0', $done='N', $ref='N', $sort="ASC") {
if (empty($cnt)) $cnt = 0;
$add = ''; $DT_MODE = 0;
if ($uid > 0) {
// Load entries only from a single user
- $add = " AND userid='".bigintval($uid)."'";
+ $add = " AND `userid`='".bigintval($uid)."'";
$mode = 'member'; $COLS = "4"; $DT_MODE = "2";
$NOT_FOUND = getMessage('DOUBLER_MEMBER_NO_ENTRIES_FOUND');
} else {
// Rewrite userid/refid only if admin is in
if (IS_ADMIN()) {
// Set links to admin area
- if ($content['userid'] > 0) { $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']); } else { $content['userid'] = '---'; }
- if ($content['refid'] > 0) { $content['refid'] = ADMIN_USER_PROFILE_LINK($content['refid']); } else { $content['refid'] = '---'; }
+ if ($content['userid'] > 0) { $content['userid'] = generateUserProfileLink($content['userid']); } else { $content['userid'] = '---'; }
+ if ($content['refid'] > 0) { $content['refid'] = generateUserProfileLink($content['refid']); } else { $content['refid'] = '---'; }
} // END - if
// Prepare data for the row template
$content = array(
'uid' => $content['userid'],
'rid' => $content['refid'],
- 'points' => TRANSLATE_COMMA($content['points']),
- 'stamp' => MAKE_DATETIME($content['timemark'], $DT_MODE),
+ 'points' => translateComma($content['points']),
+ 'stamp' => generateDateTime($content['timemark'], $DT_MODE),
'sw' => $SW,
);
$result_stop = SQL_QUERY("SELECT userid, holiday_start, holiday_end, comments
FROM `{!_MYSQL_PREFIX!}_user_holidays`
WHERE holiday_end <= UNIX_TIMESTAMP()
-ORDER BY userid", __FUNCTION__, __LINE__);
+ORDER BY `userid` ASC", __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result_stop) > 0) {
// We foud at least one
$admin = '';
// Unlock account
ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
-SET `holiday_active`='N', holiday_activated='0'
-WHERE userid=%s LIMIT 1", array(bigintval($content['userid'])), __FUNCTION__, __LINE__, false));
+SET `holiday_active`='N', `holiday_activated`=0
+WHERE `userid`=%s
+LIMIT 1", array(bigintval($content['userid'])), __FUNCTION__, __LINE__, false));
// Prepare array
$content = array(
- 'holiday_end' => MAKE_DATETIME($content['holiday_end'] , "3"),
- 'holiday_start' => MAKE_DATETIME($content['holiday_start'], "3"),
+ 'holiday_end' => generateDateTime($content['holiday_end'] , "3"),
+ 'holiday_start' => generateDateTime($content['holiday_start'], "3"),
'holiday_comments' => $content['comments']
);
// Send mail to user
$msg = LOAD_EMAIL_TEMPLATE("member_holiday_unlock", $content, $content['userid']);
- SEND_EMAIL($content['userid'], getMessage('HOLIDAY_MEMBER_UNLOCK_SUBJ'), $msg);
+ sendEmail($content['userid'], getMessage('HOLIDAY_MEMBER_UNLOCK_SUBJ'), $msg);
// Remember userid for admin
$admin .= $content['userid']."\n";
} // END - if
// Send mail to admins
- SEND_ADMIN_NOTIFICATION(getMessage('HOLIDAY_ADMIN_UNLOCK_SUBJ'), "admin_holiday_unlock", $admin, "0");
+ sendAdminNotification(getMessage('HOLIDAY_ADMIN_UNLOCK_SUBJ'), "admin_holiday_unlock", $admin, '0');
// Run all SQLs
runFilterChain('run_sqls');
$test = stripslashes($html);
while (ereg("<", $test) && ereg(">", $test)) {
$check = strtolower(substr($test, strpos($test, "<") + 1, strpos($test, ">") - strpos($test, "<") - 1));
- $check = str_replace("/", '', $check);
+ $check = str_replace('/', '', $check);
if (!in_array($check, $GLOBALS['html_tags'])) {
// Invalid tag found!
return "";
if (EXT_IS_ACTIVE('html_mail')) {
// Send mail away as HTML
$FROM = "Content-Type: text/html\n".$FROM;
- SEND_EMAIL($to, $subject, $message, 'N', $FROM);
+ sendEmail($to, $subject, $message, 'N', $FROM);
}
}
}
//
-function MEDIA_UPDATE_ENTRY($keys_array, $mode, $value)
-{
- if (is_array($keys_array) && ($value > 0))
- {
+function MEDIA_UPDATE_ENTRY($keys_array, $mode, $value) {
+ if (is_array($keys_array) && ($value > 0)) {
// Is an array so we can run it through
- foreach ($keys_array as $key)
- {
+ foreach ($keys_array as $key) {
// First check if it does exist
$result_media = SQL_QUERY_ESC("SELECT media_key FROM `{!_MYSQL_PREFIX!}_mediadata`
WHERE media_key = '%s' LIMIT 1", array($key), __FUNCTION__, __LINE__);
- if (SQL_NUMROWS($result_media) == 0)
- {
+ if (SQL_NUMROWS($result_media) == 0) {
// Not found so we create it (mode will be ignored here!)
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_mediadata` (media_key, media_value) VALUES ('%s', '%s')",
array($key, $value), __FUNCTION__, __LINE__);
- }
- else
- {
+ } else {
// Update entry
- switch ($mode)
- {
- case 'add': $mode = "+"; break;
- case 'sub': $mode = "-"; break;
+ switch ($mode) {
+ case 'add': $mode = '+'; break;
+ case 'sub': $mode = '-'; break;
}
- if ($mode == "init")
- {
+
+ if ($mode == 'init') {
// Initialize entry
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mediadata` SET media_value=%s WHERE media_key='%s' LIMIT 1",
array($value, $key), __FUNCTION__, __LINE__);
- }
- else
- {
+ } else {
// Update entry
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mediadata` SET media_value=media_value".$mode."%s WHERE media_key='%s' LIMIT 1",
array($value, $key), __FUNCTION__, __LINE__);
}
}
}
+
//
-function MEDIA_GET_ENTRY($key)
-{
+function MEDIA_GET_ENTRY ($key) {
// Return nothing by default
$value = '';
// Return data
return $value;
}
+
//
?>
$test = stripslashes($html);
while (ereg("<", $test) && ereg(">", $test)) {
$check = strtolower(substr($test, strpos($test, "<") + 1, strpos($test, ">") - strpos($test, "<") - 1));
- $check = str_replace("/", '', $check);
+ $check = str_replace('/', '', $check);
if (!in_array($check, $GLOBALS['html_tags'])) {
// Invalid tag found!
return "";
// Automatically insert URLs into newsletter
if ((EXT_IS_ACTIVE('html_mail')) && ($mode == 'html')) {
// Send HTML mail
- SEND_EMAIL($to, $subject, HTML_INSERT_URLS($message), "Y");
+ sendEmail($to, $subject, HTML_INSERT_URLS($message), 'Y');
} else {
// Send normal mail
- SEND_EMAIL($to, $subject, NL_INSERT_URLS($message), "N");
+ sendEmail($to, $subject, NL_INSERT_URLS($message), 'N');
}
} else {
// Regular send-out
if ((EXT_IS_ACTIVE('html_mail')) && ($mode == 'html')) {
- SEND_EMAIL($to, $subject, $message, "Y");
+ sendEmail($to, $subject, $message, 'Y');
} else {
- SEND_EMAIL($to, $subject, $message, "N");
+ sendEmail($to, $subject, $message, 'N');
}
}
}
// Simple wrapper function
function NICKNAME_PROBE_ON_USERID ($uid) {
- return (NICKNAME_GET_NICK($uid) != "");
+ return (NICKNAME_GET_NICK($uid) != '');
}
//
if (!EXT_IS_ACTIVE('online', true)) return;
// Empty session?
- if (session_id() == "") {
+ if (session_id() == '') {
// This is invalid here!
debug_report_bug("Invalid session.");
} // END - if
// Initialize variables
- $uid = 0; $rid = 0; $MEM = "N"; $ADMIN = "N";
+ $uid = 0; $rid = 0; $MEM = 'N'; $ADMIN = 'N';
// Valid userid?
if ((isUserIdSet()) && (getUserId() > 0) && (IS_MEMBER())) {
// Is valid user
$uid = getUserId();
- $MEM = "Y";
+ $MEM = 'Y';
} // END - if
if (IS_ADMIN()) {
// Is administrator
- $ADMIN = "Y";
+ $ADMIN = 'Y';
} // END - if
if (!empty($GLOBALS['refid'])) {
$rid,
$MEM,
$ADMIN,
- GET_REMOTE_ADDR(),
+ detectRemoteAddr(),
session_id()
), __FUNCTION__, __LINE__
);
$MEM,
$ADMIN,
session_id(),
- GET_REMOTE_ADDR()
+ detectRemoteAddr()
), __FUNCTION__, __LINE__
);
}
//
function PAYOUT_OUTPUT_PAYOUT_LIST ($points) {
// Replace german decimal comma with CPU's decimal dot
- $points = REVERT_COMMA($points);
+ $points = convertCommaToDot($points);
// Enougth points?
if ($points > 0) {
*
* Die komplette Rückgabe des Interfaces wird als assoziatives Array in der Klassen-
* variable __data gespeichert:
- * __data => array("status" => Rückgabecode (PI_DONE, PI_SENDER_ERROR, ...),
+ * __data => array('status' => Rückgabecode (PI_DONE, PI_SENDER_ERROR, ...),
* "statustext" => Status in Worten (z.B.: "Transaktion erfolgreich durchgeführt"),
* ")
*
var $path = "/transfer.interface.2.0.php";
var $errno = 0;
- var $err = "";
+ var $err = '';
- var $seperator = ":";
+ var $seperator = ':';
- var $username = "";
- var $password = "";
+ var $username = '';
+ var $password = '';
var $data = array();
- var $headers = "";
+ var $headers = '';
/**
* Konstruktor
*/
function queryApi ( $data = array() ) {
// Base64-encode username and password hash
- $data["PrimusInterface_Username"] = base64_encode($this->username);
- $data["PrimusInterface_Password"] = base64_encode($this->password);
+ $data['PrimusInterface_Username'] = base64_encode($this->username);
+ $data['PrimusInterface_Password'] = base64_encode($this->password);
// Send POST request
- $return = POST_URL($this->host.$this->path, $data);
+ $return = sendPostRequest($this->host.$this->path, $data);
// Convert the array into a full string
$returnStr = implode("\n", $return);
// Extract the real content, strip header away
- $content = explode("<!-- return-start -->", $returnStr);
+ $content = explode('<!-- return-start -->', $returnStr);
// Store headers away for debugging
$this->headers = $content[0];
$x = explode("\n", $content);
$return = array();
foreach($x as $currentLine) {
- $line_exploded = explode(":", $currentLine,2);
+ $line_exploded = explode(':', $currentLine,2);
if (count($line_exploded) > 1) {
$return[$line_exploded[0]] = $line_exploded[1];
}
* @param int $Amount Betrag in ganzzahligen Primera
* @param string $Description Beschreibung (Sichtbar in Einzelauflistung)
*/
- function payPrimera ($Receiver, $Amount, $Description = "") {
+ function payPrimera ($Receiver, $Amount, $Description = '') {
$valid = false;
- $postData = array("PrimusInterface_Action" => "Pay",
- "PrimusInterface_Receiver" => base64_encode($Receiver),
- "PrimusInterface_Amount" => base64_encode($Amount),
- "PrimusInterface_Description" => base64_encode($Description) );
+ $postData = array('PrimusInterface_Action' => 'Pay',
+ 'PrimusInterface_Receiver' => base64_encode($Receiver),
+ 'PrimusInterface_Amount' => base64_encode($Amount),
+ 'PrimusInterface_Description' => base64_encode($Description) );
$postReturn = $this->parseContent( $this->queryApi($postData) );
$this->data = $postReturn;
- if ($postReturn["status"] == "200") {
+ if ($postReturn['status'] == '200') {
$valid = true;
}
return $valid;
*/
function CheckPrimusUser($User) {
$valid = false;
- $postData = array("PrimusInterface_Action"=> "CheckPrimusUser",
- "PrimusInterface_CheckPrimusUser" => $User);
+ $postData = array('PrimusInterface_Action'=> 'CheckPrimusUser',
+ 'PrimusInterface_CheckPrimusUser' => $User);
$postReturn = $this->parseContent( $this->queryApi($postData) );
$this->data = $postReturn;
- if ($postReturn["status"] == self::PI_USER_CHECK_OK) {
+ if ($postReturn['status'] == self::PI_USER_CHECK_OK) {
$valid = true;
}
return $valid;
*/
function getPrimera() {
$primera = false;
- $postData = array( "PrimusInterface_Action" => "GetPrimera" );
+ $postData = array( 'PrimusInterface_Action' => 'GetPrimera' );
$postReturn = $this->parseContent( $this->queryApi($postData) );
$this->data = $postReturn;
- if ($postReturn["status"] == self::PI_GET_PRIMERA_DONE) {
+ if ($postReturn['status'] == self::PI_GET_PRIMERA_DONE) {
$primera = $postReturn['primera'];
}
return $primera;
$api = new PrimeraApi($primusNick, $userMd5);
// Prepare purpose
- $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('PRIMERA_API_PURPOSE_WITHDRAW'), get_session('sponsorid')))."\";";
+ $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('PRIMERA_API_PURPOSE_WITHDRAW'), getSession('sponsorid')))."\";";
eval($eval);
// Pay the Primera
SQL_FREERESULT($result);
// Set notified to Y
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET notified='Y' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET notified='Y' WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FUNCTION__, __LINE__);
// Do a snapshot off all user refs
- $result_user = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY userid", __FUNCTION__, __LINE__);
+ $result_user = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY `userid` ASC", __FUNCTION__, __LINE__);
// Transfer all neccessary data to the global $DATA array
$DATA['uid_cnt'] = SQL_NUMROWS($result_user);
- $DATA['start'] = MAKE_DATETIME($start, "2");
- $DATA['end'] = MAKE_DATETIME($end , "2");
- $DATA['now_t'] = MAKE_DATETIME(time(), "2");
+ $DATA['start'] = generateDateTime($start, "2");
+ $DATA['end'] = generateDateTime($end , "2");
+ $DATA['now_t'] = generateDateTime(time(), "2");
$DATA['title'] = $title;
$DATA['id'] = $id; // ID for the rallye details link
if (empty($cnt)) $cnt = 0; // Added prevent some unknown troubles... :-?
// Check if line is already included...
- $result_ref = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s AND userid=%s LIMIT 1",
+ $result_ref = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s AND `userid`=%s LIMIT 1",
array(bigintval($id), bigintval($content['userid'])), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result_ref) == 0) {
// Free memory
if (($notify == 'Y') && ($un)) {
// Load email template and send it to the user
$msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $content['userid']);
- SEND_EMAIL($content['userid'], sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg);
+ sendEmail($content['userid'], sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg);
} // END - if
} // END - while
if ($notify == 'Y') $templ = "admin_rallye_notify";
// Send email to admin
- SEND_ADMIN_NOTIFICATION(sprintf(getMessage('RALLYE_ADMIN_NOTIFY'), $title), $templ, $prices, "0");
+ sendAdminNotification(sprintf(getMessage('RALLYE_ADMIN_NOTIFY'), $title), $templ, $prices, '0');
// Free memory
SQL_FREERESULT($result_user);
//
function RALLYE_ADD_TOPUSERS ($rallye, $default=0) {
// First check how many prices are set
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
array(bigintval($rallye)), __FUNCTION__, __LINE__);
$prices = SQL_NUMROWS($result);
SQL_FREERESULT($result);
// Init userid for list
$_uid = '---';
// List only users with at least one ref!
- //* DEBUG: */ echo "*".$cnt."/".$content['userid']."/".$content['curr_points']."/".$refpoints."*<br />\n";
+ //* DEBUG: */ echo "*".$cnt.'/'.$content['userid'].'/'.$content['curr_points'].'/'.$refpoints."*<br />\n";
if (($cnt > 0) && ($refpoints > $content['curr_points'])) { $_uid = $content['userid']; } else { $cnt = ''; }
// Save values to array
SQL_FREERESULT($result);
// Check if line is already included...
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s AND userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s AND `userid`=%s LIMIT 1",
array(bigintval($id), bigintval($uid)), __FUNCTION__, __LINE__);
// Is this user added?
if ($notify == 'Y') {
// Transfer all neccessary data to the global $DATA array
- $DATA['start'] = MAKE_DATETIME($start, "2");
- $DATA['end'] = MAKE_DATETIME($end , "2");
- $DATA['now_t'] = MAKE_DATETIME(time(), "2");
+ $DATA['start'] = generateDateTime($start, "2");
+ $DATA['end'] = generateDateTime($end , "2");
+ $DATA['now_t'] = generateDateTime(time(), "2");
$DATA['title'] = $title;
$DATA['id'] = $id; // ID for the rallye details link
$DATA['ref'] = 0;
// Send notification to member
$msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid);
- SEND_EMAIL($uid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg);
+ sendEmail($uid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg);
} // END - if
} // END - if
}
$DATA = array(); $cnt = 0;
$users = array();
$DATA['title'] = $title;
- $DATA['start'] = MAKE_DATETIME($start, "1");
- $DATA['end'] = MAKE_DATETIME($end , "1");
- $DATA['now_t'] = MAKE_DATETIME(time(), "1");
+ $DATA['start'] = generateDateTime($start, "1");
+ $DATA['end'] = generateDateTime($end , "1");
+ $DATA['now_t'] = generateDateTime(time(), "1");
// Just count...
$total = 0;
} // END - if
// Expire rallye
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET expired='Y' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET expired='Y' WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FUNCTION__, __LINE__);
// Run array through (by uid is the most important 2nd-level-array)
if ($DATA['points'] > 0) {
// Add points directly to user's account
- ADD_POINTS_REFSYSTEM("rallye_winner" . $winnerLevel, $uid, $DATA['points'], false, "0", false, "direct");
+ ADD_POINTS_REFSYSTEM_DIRECT('rallye_winner' . $winnerLevel, $uid, $DATA['points']);
} // END - if
if ($notify == 'Y') {
// Load template
$msg = LOAD_EMAIL_TEMPLATE($template, $DATA, $uid);
- SEND_EMAIL($uid, sprintf(getMessage('RALLYE_MEMBER_EXPIRED_SUBJ'), $DATA['level']), $msg);
+ sendEmail($uid, sprintf(getMessage('RALLYE_MEMBER_EXPIRED_SUBJ'), $DATA['level']), $msg);
} // END - if
// Count userid
}
// Send mail to admin
- SEND_ADMIN_NOTIFICATION(sprintf(getMessage('RALLYE_ADMIN_EXPIRED_SUBJ'), $title), $templ, $cnt, 0);
+ sendAdminNotification(sprintf(getMessage('RALLYE_ADMIN_EXPIRED_SUBJ'), $title), $templ, $cnt, 0);
// Add task
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created)
while ($content = SQL_FETCHARRAY($result)) {
// Construct the message masked and add it
$ret .= sprintf("%s %s %s (%s) - %s\n",
- TRANSLATE_GENDER($content['gender']),
+ translateGender($content['gender']),
$content['surname'],
$content['family'],
$content['email'],
//
function RALLYE_LOAD_USERS_ARRAY ($rallye) {
// Fix zero points to 0.00000
- if (getConfig('ref_payout') == "0") setConfigEntry('ref_payout', "0.00000");
+ if (getConfig('ref_payout') == '0') setConfigEntry('ref_payout', "0.00000");
// Init multi array
$users = array(
);
// Load users uid old points earned
- $result_user = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s ORDER BY userid",
+ $result_user = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s ORDER BY `userid` ASC",
array(bigintval($rallye)), __FUNCTION__, __LINE__);
while ($content = SQL_FETCHARRAY($result_user)) {
// Load current ref count
//
function RALLYE_LIST_WINNERS ($rallye, $default=0) {
// First check how many prices are set
- $result_prices = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
+ $result_prices = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
array(bigintval($rallye)), __FUNCTION__, __LINE__);
$prices = SQL_NUMROWS($result_prices);
SQL_FREERESULT($result_prices);
SQL_FREERESULT($result_active);
if (empty($DATA['uid'][$idx])) $DATA['uid'][$idx] = '---';
- if ((empty($DATA['ref'][$idx])) || ($DATA['ref'][$idx] == 0) || ($active == 0) || ("".round($DATA['cpoints'][$idx])."" == "0") || (empty($DATA['cpoints'][$idx]))) {
+ if ((empty($DATA['ref'][$idx])) || ($DATA['ref'][$idx] == 0) || ($active == 0) || ("".round($DATA['cpoints'][$idx])."" == '0') || (empty($DATA['cpoints'][$idx]))) {
// Allow valid and active users with at least one ref to get points
$DATA['ref'][$idx] = '---';
$DATA['uid'][$idx] = '---';
while ($content = SQL_FETCHARRAY($result_rallye)) {
// Prepare data for mail template
$DATA['title'] = $content['title'];
- $DATA['start'] = MAKE_DATETIME($content['start_time'], "1");
- $DATA['end'] = MAKE_DATETIME($content['end_time'] , "1");
- $DATA['now_t'] = MAKE_DATETIME(time(), "1");
+ $DATA['start'] = generateDateTime($content['start_time'], "1");
+ $DATA['end'] = generateDateTime($content['end_time'] , "1");
+ $DATA['now_t'] = generateDateTime(time(), "1");
// Send mail to admin
- SEND_ADMIN_NOTIFICATION(sprintf(getMessage('RALLYE_ADMIN_PURGED_SUBJ'), $content['title']), "admin_rallye_purged", '', 0);
+ sendAdminNotification(sprintf(getMessage('RALLYE_ADMIN_PURGED_SUBJ'), $content['title']), "admin_rallye_purged", '', 0);
// Purge whole rallye
- ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1",
+ ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE `id`=%s LIMIT 1",
array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s LIMIT 1",
array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
}
//
-function RALLYE_TEMPLATE_SELECTION ($name="template", $default="") {
+function RALLYE_TEMPLATE_SELECTION ($name="template", $default = '') {
// Check templates directory
$OUT = ''; $ral = array();
- $basePath = sprintf("%stemplates/%s/html/rallye/", constant('PATH'), GET_LANGUAGE());
+ $basePath = sprintf("%stemplates/%s/html/rallye/", constant('PATH'), getLanguage());
$dir = opendir($basePath) or mxchange_die(sprintf("Cannot open dir %s.", $basePath));
while ($read = readdir($dir)) {
// If it is no dir (so a file)
if (!isDirectory($basePath.$read)) {
// Accept only templates matching with rallye_????.tpl.xx
if (eregi("^rallye_.*\.tpl", $read)) {
- $read = substr($read, 7, strpos($read, ".") - 7);
+ $read = substr($read, 7, strpos($read, '.') - 7);
// Accept only template names between 1 and 255 chars length
if ((strlen($read) < 256) && (!empty($read))) $ral[] = $read;
} // END - if
if (($level == $GLOBALS['cache_array']['refsystem']['level'][$id]) && ($level == 1)) {
// Level does exist so abort here
$cnt = $GLOBALS['cache_array']['refsystem']['counter'][$id];
- //* DEBUG: */ echo "*".$uid."/".$cnt."*<br />";
+ //* DEBUG: */ echo "*".$uid.'/'.$cnt."*<br />";
break;
} elseif ($level > 1) {
// Not interesting here...
incrementConfigEntry('cache_hits');
// Remove old refs
- //* DEBUG: */ echo "+".$cnt."/".$old."+<br />";
+ //* DEBUG: */ echo '+'.$cnt.'/'.$old."+<br />";
$cnt -= $old;
} // END - if
} else {
}
// Return count
- //* DEBUG: */ echo "*".$uid."/".$old."/".$cnt."*<br />";
+ //* DEBUG: */ echo "*".$uid.'/'.$old.'/'.$cnt."*<br />";
return $cnt;
}
// Add points again, but only directly
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):refback={$refback}<br />\n";
- ADD_POINTS_REFSYSTEM(sprintf("refback:%s", $refid), $uid, $refback, false, "0", false, "direct");
+ ADD_POINTS_REFSYSTEM_DIRECT(sprintf("refback:%s", $refid), $uid, $refback);
// Reduce points if refid is found
if ($refid == $ref) {
}
// Update "refback table"
-function UPDATE_REFBACK_TABLE ($uid) {
+function updateRefbackTable ($uid) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
// Make it sure referal level zero (member him-/herself) is at least selected
if (empty($GLOBALS['cache_array']['back_level'])) $GLOBALS['cache_array']['back_level'] = 1;
} // END - if
// Check existence
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_refs` WHERE userid=%s AND level='%s' AND refid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_refs` WHERE userid=%s AND level='%s' AND refid=%s LIMIT 1",
array(bigintval($uid), $GLOBALS['cache_array']['back_level'], bigintval($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']])), __FUNCTION__, __LINE__);
// Do we have no entry?
array(bigintval($uid), $GLOBALS['cache_array']['back_level'], bigintval($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']])), __FUNCTION__, __LINE__);
// Move to next referal level and count his counter one up!
- $GLOBALS['cache_array']['back_level']++; UPDATE_REFBACK_TABLE($GLOBALS['cache_array']['up_refid'][($GLOBALS['cache_array']['back_level'] - 1)]);
+ $GLOBALS['cache_array']['back_level']++; updateRefbackTable($GLOBALS['cache_array']['up_refid'][($GLOBALS['cache_array']['back_level'] - 1)]);
} // END - if
// Do we have another level here?
$uid = $old;
// Shall we add this as well?
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_refs` WHERE userid=%s AND level='%s' AND refid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_refs` WHERE userid=%s AND level='%s' AND refid=%s LIMIT 1",
array(bigintval($uid), ($GLOBALS['cache_array']['back_level']-$minus), bigintval($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']])), __FUNCTION__, __LINE__);
// Do we have no entry?
$id = bigintval($id);
// Get entry from database
- $result = SQL_QUERY_ESC("SELECT id, refid, refback, level FROM `{!_MYSQL_PREFIX!}_user_refs` WHERE id=%s AND userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id, refid, refback, level FROM `{!_MYSQL_PREFIX!}_user_refs` WHERE `id`=%s AND `userid`=%s LIMIT 1",
array($id, getUserId()), __FUNCTION__, __LINE__);
// Is there an entry?
// No member!
$status['message'] = getMessage('MEMBER_REFBACK_ERROR_NO_MEMBER');
return $status;
- } elseif ("".$id."" != "".($id + 0)."") {
+ } elseif ("".$id."" != ''.($id + 0)."") {
// No number!
$status['message'] = getMessage('MEMBER_REFBACK_ERROR_INVALID_ID_NUMBER');
return $status;
} // END - if
// Revert german commata
- $percents = REVERT_COMMA($percents);
+ $percents = convertCommaToDot($percents);
// Update entry
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_refs` SET refback='%s' WHERE id=%s AND userid=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_refs` SET refback='%s' WHERE `id`=%s AND `userid`=%s LIMIT 1",
array($percents, $id, getUserId()), __FUNCTION__, __LINE__);
// Entry updated?
// Prepare email content
$content = array(
- 'percents' => TRANSLATE_COMMA($percents),
+ 'percents' => translateComma($percents),
'refid' => $dummy['refid'],
'level' => $dummy['level']
);
$mail = LOAD_EMAIL_TEMPLATE("member_refback", $content, getUserId());
// Send email to user
- SEND_EMAIL($dummy['refid'], getMessage('MEMBER_REFBACK_SUBJECT'), $mail);
+ sendEmail($dummy['refid'], getMessage('MEMBER_REFBACK_SUBJECT'), $mail);
// Send admin notification
- SEND_ADMIN_NOTIFICATION(getMessage('ADMIN_REFBACK_SUBJECT'), "admin_refback", $content, getUserId());
+ sendAdminNotification(getMessage('ADMIN_REFBACK_SUBJECT'), "admin_refback", $content, getUserId());
// All fine!
$status['ok'] = true;
}
//
-function REGISTER_FILL_MUST_CONSTANTS () {
+function registerMustFillout () {
$result = SQL_QUERY("SELECT field_name, field_required FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`",
__FUNCTION__, __LINE__);
SQL_FREERESULT($result);
// Also fill other constants
+ // @TODO Rewrite these constants, too
define('MUST_GENDER', "<div class=\"guest_failed\"> (*)</div>");
define('MUST_ADDY' , "<div class=\"guest_failed\"> (*)</div>");
define('MUST_BIRTH' , "<div class=\"guest_failed\"> (*)</div>");
if ((empty($value)) && ($chk == 'Y') && (!$country))
{
// Required field not set
- $array[$key] = "!";
+ $array[$key] = '!';
$ret = true;
}
}
//
function REGISTER_OUTPUT_REQUIRE_CHECK (&$array) {
- $result = SQL_QUERY("SELECT field_name, field_required FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY("SELECT `field_name`, `field_required` FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`", __FUNCTION__, __LINE__);
while ($content = SQL_FETCHARRAY($result)) {
- if (($array[$content['field_name']] == "!") && ($content['field_required'] == 'Y')) {
+ if (($array[$content['field_name']] == '!') && ($content['field_required'] == 'Y')) {
// Empty entry found
$array[$content['field_name']] = '';
$OUT = constant('REGISTER_'.strtoupper($content['field_name']).'_REQUIRED');
- OUTPUT_HTML("<div class=\"register_failed\">".$OUT."</div>");
+ registerOutputFailedMessage('', $OUT);
} // END - if
} // END - while
SQL_FREERESULT($result);
}
-//
-function REGISTER_ADD_CATEGORY_TABLE ($mode, $return=false) {
+// Generates a 'category table' for the registration form
+function registerGenerateCategoryTable ($mode, $return=false) {
$OUT = '';
// Guests are mostly not interested in how many members has
if (IS_ADMIN()) $AND = '';
// Look for categories
- $result = SQL_QUERY("SELECT id, cat, visible FROM `{!_MYSQL_PREFIX!}_cats` ".$AND." ORDER BY `sort`",
+ $result = SQL_QUERY("SELECT `id`, `cat`, `visible` FROM `{!_MYSQL_PREFIX!}_cats` ".$AND." ORDER BY `sort` ASC",
__FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
$content = array(
'sw' => $SW,
'cat' => $content['cat'],
- 'def_y' => "",
- 'def_n' => "",
+ 'def_y' => '',
+ 'def_n' => '',
'id' => $content['id'],
);
OUTPUT_HTML($OUT);
}
}
+
+// Outputs a 'failed message'
+function registerOutputFailedMessage ($messageId, $extra='') {
+ if (empty($messageId)) {
+ OUTPUT_HTML('<div class="register_failed">' . $extra . '</div>');
+ } else {
+ OUTPUT_HTML('<div class="register_failed">{--' . $messageId . '--}' . $extra . '</div>');
+ }
+}
+
//
?>
break;
case "RANDOM": // Pseudo-random IP number
- $remoteAddr = mt_rand(1,254).".".mt_rand(0,254).".".mt_rand(0,254).".".mt_rand(1,254);
+ $remoteAddr = mt_rand(1,254).'.'.mt_rand(0,254).'.'.mt_rand(0,254).'.'.mt_rand(1,254);
break;
} // END - switch
} // END - if
// Is config enabled?
if (getConfig('removeip_anon_ua') == 'Y') {
// Set anon user agent
- $userAgent = "-";
+ $userAgent = '-';
} // END - if
// Return it
// Is config enabled?
if (getConfig('removeip_anon_ref') == 'Y') {
// Set anon user agent
- $referer = "-";
+ $referer = '-';
} // END - if
// Return it
}
// Rewrite links in HTML for better SEO (ugly part of mx!)
-function REWRITE_LINKS ($HTML) {
+function rewriteLinksInCode ($HTML) {
// Skip rewriting for configured modules
if (eregi($GLOBALS['module'], getConfig('rewrite_skip')) !== false) return $HTML;
} // END - if
// Strip slashes as above for the main URL
- $target2 = preg_quote($target, "/");
+ $target2 = preg_quote($target, '/');
// Action variable
$act = $target."\$1/act/";
// Convert &|&action=...
- $output = preg_replace("/" . $target2 . "(.*)&action=/i", $act, $output);
+ $output = preg_replace('/' . $target2 . "(.*)&action=/i", $act, $output);
// "The same procedure as last variable"... now for &what=
$wht = $target."\$1/wht/";
- $output = preg_replace("/" . $target2 . "(.*)&what=/i", $wht, $output);
+ $output = preg_replace('/' . $target2 . "(.*)&what=/i", $wht, $output);
// Repair missed &what=??? entries
while (preg_match("/&what=(.*)\/(.*)\/(.*)/i", $output)) {
// Generate arrays which holds the relevante chars to replace
$GLOBALS['security_chars'] = array(
// The chars we are looking for...
- 'from' => array("{", "}", "/", ".", "'", "$", "(", ")", '{--', '--}', "%", ';', "[", "]", ":", "--"),
+ 'from' => array("{", "}", '/', '.', "'", "$", "(", ")", '{--', '--}', "%", ';', "[", "]", ':', "--"),
// ... and we will replace to.
'to' => array(
"{OPEN_ANCHOR2}",
// Search for these secured characters
'to' => array("{SLASH}", "{DOT}", "{PER}", "{DBL_DOT}", "{COMMENT}"),
// Replace with these characters
- 'from' => array("/", ".", "%", ":", "--")
+ 'from' => array('/', '.', "%", ':', "--")
);
// Overworked security part:
}
// Put both together again and let's pray it is secured now...
-$_SERVER['PHP_SELF'] = $SELF_DIR."/".$SELF_FILE;
+$_SERVER['PHP_SELF'] = $SELF_DIR.'/'.$SELF_FILE;
// Remove uneccessary variables
unset($SELF_DIR);
$SAVE = false;
} else {
// Do we want to add a new sponsor or update his data?
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE email='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE email='%s' LIMIT 1",
array($POST['email']), __FUNCTION__, __LINE__);
// Is a sponsor alread in the db?
break;
case "url":
- if (!VALIDATE_URL($v)) $SAVE = false;
+ if (!isUrlValid($v)) $SAVE = false;
break;
default:
// Test if there is are time selections
- CONVERT_SELECTIONS_TO_TIMESTAMP($POST, $DATA, $k, $skip);
+ convertSelectionsToTimestamp($POST, $DATA, $k, $skip);
break;
}
}
// Remove last ", " from SQL string
- $sql = substr($sql, 0, -2)." WHERE id='%s' LIMIT 1";
+ $sql = substr($sql, 0, -2)." WHERE `id`='%s' LIMIT 1";
$DATA['values'][] = bigintval(REQUEST_GET('id'));
// Generate message
} elseif ((!$ALREADY) || (($POST['force'] == "1") && (IS_ADMIN()))) {
// Add new sponsor, first add more data
$DATA['keys'][] = "sponsor_created"; $DATA['values'][] = time();
- $DATA['keys'][] = "status";
+ $DATA['keys'][] = 'status';
if ((!$NO_UPDATE) && (IS_ADMIN()) && ($GLOBALS['what'] == "add_sponsor")) {
// Only allowed for admin
$DATA['values'][] = "PENDING";
// Generate hash code
$DATA['keys'][] = "hash";
- $DATA['values'][] = md5(session_id().":".$POST['email'].":".GET_REMOTE_ADDR().":".GET_USER_AGENT().":".time());
+ $DATA['values'][] = md5(session_id().':'.$POST['email'].':'.detectRemoteAddr().':'.detectUserAgent().':'.time());
$DATA['keys'][] = "remote_addr";
- $DATA['values'][] = GET_REMOTE_ADDR();
+ $DATA['values'][] = detectRemoteAddr();
}
// Implode all data into strings
$KEYS = implode(", " , $DATA['keys']);
- $VALUES = str_repeat("%s', '", count($DATA['values']) - 1);
+ $valueS = str_repeat("%s', '", count($DATA['values']) - 1);
// Generate string
- $sql = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_data` (".$KEYS.") VALUES ('".$VALUES."%s')";
+ $sql = "INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_data` (".$KEYS.") VALUES ('".$valueS."%s')";
// Generate message
$message = SPONSOR_GET_MESSAGE(getMessage('ADMIN_SPONSOR_ADDED'), "added", $messageArray);
if ($RET_STATUS) return $ret;
}
//
-function SPONSOR_TRANSLATE_STATUS ($status) {
+function sponsorTranslateUserStatus ($status) {
// Construct constant name
$constantName = sprintf("ACCOUNT_%s", $status);
$ret = false;
if ((isSessionVariableSet('sponsorid')) && (isSessionVariableSet('sponsorpass'))) {
// Check cookies against database records...
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE id='%s' AND password='%s' AND `status`='CONFIRMED' LIMIT 1",
- array(bigintval(get_session('sponsorid')), get_session('sponsorpass')), __FUNCTION__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data`
+WHERE `id`='%s' AND password='%s' AND `status`='CONFIRMED' LIMIT 1",
+ array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// All is fine
$ret = true;
function GENERATE_SPONSOR_CONTENT ($what) {
$OUT = '';
$INC = sprintf("inc/modules/sponsor/%s.php", $what);
- if (INCLUDE_READABLE($INC)) {
+ if (isIncludeReadable($INC)) {
// Every sponsor action will output nothing directly. It will be written into $OUT!
- LOAD_INC_ONCE($INC);
+ loadIncludeOnce($INC);
} else {
// File not found!
$OUT .= LOAD_TEMPLATE('admin_settings_saved', true, sprintf(getMessage('SPONSOR_CONTENT_404'), $what));
// Update last online timestamp
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data`
SET last_online=UNIX_TIMESTAMP()
-WHERE id='%s' AND password='%s' LIMIT 1",
- array(bigintval(get_session('sponsorid')), get_session('sponsorpass')), __FUNCTION__, __LINE__);
+WHERE `id`='%s' AND password='%s' LIMIT 1",
+ array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FUNCTION__, __LINE__);
// This update went fine?
$login = (SQL_AFFECTEDROWS() == 1);
$sql .= " `status`='EMAIL', hash='%s',";
// Generate hash code
- $HASH = md5(session_id().":".$POST['email'].":".GET_REMOTE_ADDR().":".GET_USER_AGENT().":".time());
+ $HASH = md5(session_id().':'.$POST['email'].':'.detectRemoteAddr().':'.detectUserAgent().':'.time());
$DATA[] = $HASH;
} // END - if
} // END - if
$sql = substr($sql, 0, -1);
// Add SQL tail data
- $sql .= " WHERE id='%s' AND password='%s' LIMIT 1";
- $DATA[] = bigintval(get_session('sponsorid'));
- $DATA[] = get_session('sponsorpass');
+ $sql .= " WHERE `id`='%s' AND password='%s' LIMIT 1";
+ $DATA[] = bigintval(getSession('sponsorid'));
+ $DATA[] = getSession('sponsorpass');
// Saving data was completed... ufff...
switch ($GLOBALS['what'])
case "settings": // Change settings
// Translate some data
- $content['receive'] = TRANSLATE_YESNO($content['receive_warnings']);
- $content['interval'] = CREATE_FANCY_TIME($content['warning_interval']);
+ $content['receive'] = translateYesNo($content['receive_warnings']);
+ $content['interval'] = createFancyTime($content['warning_interval']);
// Set message template and subject for admin
$message = getMessage('SPONSOR_SETTINGS_SAVED');
$DATA = $POST;
// Change some data
- if (isset($content['gender'])) $content['gender'] = TRANSLATE_GENDER($content['gender']);
- if (isset($DATA['gender'])) $DATA['gender'] = TRANSLATE_GENDER($DATA['gender']);
- if (isset($content['receive_warnings'])) $DATA['receive'] = TRANSLATE_YESNO($POST['receive_warnings']);
- if (isset($content['warning_interval'])) $DATA['interval'] = CREATE_FANCY_TIME($POST['warning_interval']);
+ if (isset($content['gender'])) $content['gender'] = translateGender($content['gender']);
+ if (isset($DATA['gender'])) $DATA['gender'] = translateGender($DATA['gender']);
+ if (isset($content['receive_warnings'])) $DATA['receive'] = translateYesNo($POST['receive_warnings']);
+ if (isset($content['warning_interval'])) $DATA['interval'] = createFancyTime($POST['warning_interval']);
// Send email to admins
- SEND_ADMIN_NOTIFICATION($subj, $templ, $content);
+ sendAdminNotification($subj, $templ, $content);
// Shall we send mail to the sponsor's new email address?
if ($content['receive_warnings'] == 'Y') {
{
case "account": // Change account data
$email_msg = LOAD_EMAIL_TEMPLATE("sponsor_change_data", $content);
- SEND_EMAIL($content['email'], getMessage('SPONSOR_ACC_DATA_SUBJ'), $email_msg);
+ sendEmail($content['email'], getMessage('SPONSOR_ACC_DATA_SUBJ'), $email_msg);
if ($EMAIL === true) {
// Add hash code to content array
// Second mail goes to the new address
$email_msg = LOAD_EMAIL_TEMPLATE("sponsor_change_email", $content);
- SEND_EMAIL($content['email'], getMessage('SPONSOR_ACC_EMAIL_SUBJ'), $email_msg);
+ sendEmail($content['email'], getMessage('SPONSOR_ACC_EMAIL_SUBJ'), $email_msg);
}
break;
case "settings": // Change settings
// Send email
$email_msg = LOAD_EMAIL_TEMPLATE("sponsor_settings", $content);
- SEND_EMAIL($content['email'], getMessage('SPONSOR_SETTINGS_SUBJ'), $email_msg);
+ sendEmail($content['email'], getMessage('SPONSOR_SETTINGS_SUBJ'), $email_msg);
break;
}
} // END - if
if (!IS_ADMIN()) {
// Not an admin
return false;
- } elseif (!VALIDATE_URL($url)) {
+ } elseif (!isUrlValid($url)) {
// URL invalid
return false;
- } elseif (SURFBAR_LOOKUP_BY_URL($url, "0")) {
+ } elseif (SURFBAR_LOOKUP_BY_URL($url, '0')) {
// URL already found in surfbar!
return false;
} elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
// No more allowed!
return false;
- } elseif ("".($limit + 0)."" != "".$limit."") {
+ } elseif (''.($limit + 0).'' != ''.$limit.'') {
// Invalid amount entered
return false;
- } elseif ("".($reload + 0)."" != "".$reload."") {
+ } elseif (''.($reload + 0).'' != ''.$reload.'') {
// Invalid amount entered
return false;
}
// Register the new URL
- return SURFBAR_REGISTER_URL($url, "0", "ACTIVE", "unlock", array('limit' => $limit, 'reload' => $reload));
+ return SURFBAR_REGISTER_URL($url, '0', 'ACTIVE', 'unlock', array('limit' => $limit, 'reload' => $reload));
}
+
// Admin unlocked an email so we can migrate the URL
function SURFBAR_ADMIN_MIGRATE_URL ($url, $uid) {
// Do some pre-checks
if (!IS_ADMIN()) {
// Not an admin
return false;
- } elseif (!VALIDATE_URL($url)) {
+ } elseif (!isUrlValid($url)) {
// URL invalid
return false;
} elseif (SURFBAR_LOOKUP_BY_URL($url, $uid)) {
}
// Register the new URL
- return SURFBAR_REGISTER_URL($url, $uid, "MIGRATED", "migrate");
+ return SURFBAR_REGISTER_URL($url, $uid, 'MIGRATED', 'migrate');
}
+
// Admin function for unlocking URLs
function SURFBAR_ADMIN_UNLOCK_URL_IDS ($IDs) {
// Is this an admin or invalid array?
// Update the status for all ids
foreach ($IDs as $id => $dummy) {
// Test all ids through (ignores failed)
- $done = (($done) && (SURFBAR_CHANGE_STATUS($id, "PENDING", "ACTIVE")));
+ $done = (($done) && (SURFBAR_CHANGE_STATUS($id, 'PENDING', 'ACTIVE')));
} // END - if
// Return total status
return $done;
}
+
// Admin function for rejecting URLs
function SURFBAR_ADMIN_REJECT_URL_IDS ($IDs) {
// Is this an admin or invalid array?
// Update the status for all ids
foreach ($IDs as $id => $dummy) {
// Test all ids through (ignores failed)
- $done = (($done) && (SURFBAR_CHANGE_STATUS($id, "PENDING", "REJECTED")));
+ $done = (($done) && (SURFBAR_CHANGE_STATUS($id, 'PENDING', 'REJECTED')));
} // END - if
// Return total status
return $done;
}
+
//
// -----------------------------------------------------------------------------
// Member functions
if (!IS_MEMBER()) {
// Not a member
return false;
- } elseif (!VALIDATE_URL($url)) {
+ } elseif (!isUrlValid($url)) {
// URL invalid
return false;
} elseif (SURFBAR_LOOKUP_BY_URL($url, getUserId())) {
} elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS(getUserId())) {
// No more allowed!
return false;
- } elseif ("".($limit + 0)."" != "".$limit."") {
+ } elseif (''.($limit + 0).'' != ''.$limit.'') {
// Invalid amount entered
return false;
}
// Register the new URL
- return SURFBAR_REGISTER_URL($url, getUserId(), "PENDING", "reg", array('limit' => $limit));
+ return SURFBAR_REGISTER_URL($url, getUserId(), 'PENDING', 'reg', array('limit' => $limit));
}
+
// Create list of actions depending on status for the user
function SURFBAR_MEMBER_ACTIONS ($urlId, $status) {
// Load all actions in an array for given status
- $actionArray = SURFBAR_GET_ACTION_ARRAY($status);
+ $actionArray = SURFBAR_getModeAction_ARRAY($status);
// Init HTML code
$OUT = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\">
$width = round(100 / count($actionArray));
// "Walk" through all actions and create forms
- foreach ($actionArray as $actionId=>$action) {
+ foreach ($actionArray as $actionId => $action) {
// Add form for this action
- $OUT .= sprintf(LOAD_TEMPLATE("member_surfbar_list_form", true),
+ $OUT .= sprintf(LOAD_TEMPLATE('member_surfbar_list_form', true),
$width,
bigintval($urlId),
strtolower($action),
// Return code
return $OUT;
}
+
// Do the member form request
function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) {
// By default no action is performed
// Return status
return $performed;
}
+
// Validate if the requested action can be performed on current URL status
function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) {
// Search for the requested action/status combination in database
// Return status
return $isValid;
}
+
//
// -----------------------------------------------------------------------------
// Member actions
// Simply change the status here
return SURFBAR_CHANGE_STATUS ($urlData['id'], $urlData['status'], $urlData['new_status'], $data);
}
+
// Book an URL now (from migration)
function SURFBAR_MEMBER_BOOKNOW_ACTION ($urlData) {
// Create the data array for next function call
// Simply change the status here
return SURFBAR_CHANGE_STATUS ($urlData['id'], $urlData['status'], $urlData['new_status'], $data);
}
+
// Show edit form or do the changes
function SURFBAR_MEMBER_EDIT_ACTION ($urlData) {
// Is the "execute" flag there?
if (isset($urlData['edit']['execute'])) {
// Execute the changes
- return SURFBAR_MEMBER_EXECUTE_ACTION("edit", $urlData);
+ return SURFBAR_MEMBER_EXECUTE_ACTION('edit', $urlData);
} // END - if
// Display form
- return SURFBAR_MEMBER_DISPLAY_ACTION_FORM("edit", $urlData);
+ return SURFBAR_MEMBER_DISPLAY_ACTION_FORM('edit', $urlData);
}
+
// Show delete form or do the changes
function SURFBAR_MEMBER_DELETE_ACTION ($urlData) {
// Is the "execute" flag there?
if (isset($urlData['delete']['execute'])) {
// Execute the changes
- return SURFBAR_MEMBER_EXECUTE_ACTION("delete", $urlData);
+ return SURFBAR_MEMBER_EXECUTE_ACTION('delete', $urlData);
} // END - if
// Display form
- return SURFBAR_MEMBER_DISPLAY_ACTION_FORM("delete", $urlData);
+ return SURFBAR_MEMBER_DISPLAY_ACTION_FORM('delete', $urlData);
}
+
// Pause active banner
function SURFBAR_MEMBER_PAUSE_ACTION ($urlData) {
return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['status'], $urlData['new_status'], array($urlData['id'] => $urlData));
}
+
// Unpause stopped banner
function SURFBAR_MEMBER_UNPAUSE_ACTION ($urlData) {
// Fix missing entry for template
// Return status change
return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['status'], $urlData['new_status'], array($urlData['id'] => $urlData));
}
+
// Resubmit locked URL
function SURFBAR_MEMBER_RESUBMIT_ACTION ($urlData) {
return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['status'], $urlData['new_status'], array($urlData['id'] => $urlData));
}
+
// Display selected "action form"
function SURFBAR_MEMBER_DISPLAY_ACTION_FORM ($action, $urlData) {
// Translate some data
- $urlData['registered'] = MAKE_DATETIME($urlData['registered'], "2");
- $urlData['views_total'] = TRANSLATE_COMMA($urlData['views_total']);
- $urlData['views_max'] = TRANSLATE_COMMA($urlData['views_max']);
- $urlData['views_allowed'] = TRANSLATE_COMMA($urlData['views_allowed']);
- $urlData['last_locked'] = MAKE_DATETIME($urlData['last_locked'], "2");
+ $urlData['registered'] = generateDateTime($urlData['registered'], '2');
+ $urlData['views_total'] = translateComma($urlData['views_total']);
+ $urlData['views_max'] = translateComma($urlData['views_max']);
+ $urlData['views_allowed'] = translateComma($urlData['views_allowed']);
+ $urlData['last_locked'] = generateDateTime($urlData['last_locked'], '2');
// Is the lock reason empty?
if (empty($urlData['lock_reason'])) {
} // END - if
// Include fields only for action 'edit'
- if ($action == "edit") {
+ if ($action == 'edit') {
// Default is not limited
$urlData['limited_yes'] = '';
$urlData['limited_no'] = ' chkecked="checked"';
- $urlData['limited'] = "false";
+ $urlData['limited'] = 'false';
// Is this URL limited?
if ($urlData['views_max'] > 0) {
// Then rewrite form data
$urlData['limited_yes'] = ' chkecked="checked"';
$urlData['limited_no'] = '';
- $urlData['limited'] = "true";
+ $urlData['limited'] = 'true';
} // END - if
} // END - if
// All fine by default ... ;-)
return true;
}
+
// Execute choosen action
function SURFBAR_MEMBER_EXECUTE_ACTION ($action, $urlData) {
// By default nothing is executed
if (true) {
//if (($urlData['views_allowed'] != $urlData['edit']['limit']) || ($url1 != $url2)) {
// Run the query
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET url='%s', views_allowed=%s, views_max=%s WHERE id=%s AND `status`='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET url='%s', views_allowed=%s, views_max=%s WHERE `id`=%s AND `status`='%s' LIMIT 1",
array($urlData['url'], $urlData['edit']['limit'], $urlData['edit']['limit'], $urlData['id'], $urlData['status']), __FUNCTION__, __LINE__);
// All fine
// Handle URLs which limit has depleted
function SURFBAR_HANDLE_DEPLETED_VIEWS () {
// Get all URLs
- $urlArray = SURFBAR_GET_URL_DATA("0", "views_max", "id", "ASC", "id", " AND views_allowed>0 AND `status`='ACTIVE'");
+ $urlArray = SURFBAR_GET_URL_DATA('0', 'views_max', 'id', 'ASC', 'id', " AND views_allowed>0 AND `status`='ACTIVE'");
// Do we have some entries?
if (count($urlArray) > 0) {
$urlData[$id] = $data;
// Handle the status
- SURFBAR_CHANGE_STATUS($id, "ACTIVE", "DEPLETED", $urlData);
+ SURFBAR_CHANGE_STATUS($id, 'ACTIVE', 'DEPLETED', $urlData);
} // END - foreach
} // END - if
}
// Prepare content
$content = array(
'uid' => $uid,
- 'low' => TRANSLATE_COMMA(getConfig('surfbar_warn_low_points')),
- 'points' => TRANSLATE_COMMA($UIDs['points'][$uid]),
- 'notified' => MAKE_DATETIME($UIDs['notified'][$uid]),
- 'interval' => CREATE_FANCY_TIME(getConfig('surfbar_low_interval'))
+ 'low' => translateComma(getConfig('surfbar_warn_low_points')),
+ 'points' => translateComma($UIDs['points'][$uid]),
+ 'notified' => generateDateTime($UIDs['notified'][$uid]),
+ 'interval' => createFancyTime(getConfig('surfbar_low_interval'))
);
// Notify this user
- SURFBAR_NOTIFY_USER("low_points", $content);
+ SURFBAR_NOTIFY_USER('low_points', $content);
// Update last notified
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET surfbar_low_notified=NOW() WHERE userid=%s LIMIT 1",
// Looks up by an URL
function SURFBAR_LOOKUP_BY_URL ($url, $uid) {
// Now lookup that given URL by itself
- $urlArray = SURFBAR_GET_URL_DATA($url, "url", "id", "ASC", "id", sprintf(" AND userid=%s", bigintval($uid)));
+ $urlArray = SURFBAR_GET_URL_DATA($url, 'url', 'id', 'ASC', 'id', sprintf(" AND `userid`=%s", bigintval($uid)));
// Was it found?
return (count($urlArray) > 0);
}
// Load URL data by given search term and column
-function SURFBAR_GET_URL_DATA ($searchTerm, $column="id", $order="id", $sort="ASC", $group="id", $add="") {
+function SURFBAR_GET_URL_DATA ($searchTerm, $column="id", $order="id", $sort="ASC", $group="id", $add = '') {
// By default nothing is found
$GLOBALS['last_url_data'] = array();
} // END - if
// Translate status and limit
- $content['limit'] = SURFBAR_TRANSLATE_LIMIT($content['limit']);
+ $content['limit'] = surfbarTranslateLimit($content['limit']);
// If in reg-mode we notify admin
if (($addMode == "reg") || (getConfig('surfbar_notify_admin_unlock') == 'Y')) {
));
// Is the subject line there?
- if ((substr($subject, 0, 1) == "!") && (substr($subject, -1, 1) == "!")) {
+ if ((substr($subject, 0, 1) == '!') && (substr($subject, -1, 1) == '!')) {
// Set default subject if following eval() wents wrong
$subject = getMessage('ADMIN_SURFBAR_NOTIFY_DEFAULT_SUBJECT');
} // END - if
// Translate some data if present
- if (isset($content['status'])) $content['status'] = SURFBAR_TRANSLATE_STATUS($content['status']);
- if (isset($content['registered'])) $content['registered'] = MAKE_DATETIME($content['registered'], "2");
- if (isset($content['last_locked'])) $content['last_locked'] = MAKE_DATETIME($content['last_locked'], "2");
- if (isset($content['views_total'])) $content['views_total'] = TRANSLATE_COMMA($content['views_total']);
- if (isset($content['views_allowed'])) $content['views_allowed'] = TRANSLATE_COMMA($content['views_allowed']);
- if (isset($content['views_max'])) $content['views_max'] = TRANSLATE_COMMA($content['views_max']);
+ if (isset($content['status'])) $content['status'] = surfbarTranslateUserStatus($content['status']);
+ if (isset($content['registered'])) $content['registered'] = generateDateTime($content['registered'], "2");
+ if (isset($content['last_locked'])) $content['last_locked'] = generateDateTime($content['last_locked'], "2");
+ if (isset($content['views_total'])) $content['views_total'] = translateComma($content['views_total']);
+ if (isset($content['views_allowed'])) $content['views_allowed'] = translateComma($content['views_allowed']);
+ if (isset($content['views_max'])) $content['views_max'] = translateComma($content['views_max']);
// Send the notification out
- return SEND_ADMIN_NOTIFICATION($subject, $templateName, $content, $content['uid']);
+ return sendAdminNotification($subject, $templateName, $content, $content['uid']);
}
// Notify the user about the performed action
));
// Is the subject line there?
- if ((substr($subject, 0, 1) == "!") && (substr($subject, -1, 1) == "!")) {
+ if ((substr($subject, 0, 1) == '!') && (substr($subject, -1, 1) == '!')) {
// Set default subject if following eval() wents wrong
$subject = getMessage('MEMBER_SURFBAR_NOTIFY_DEFAULT_SUBJECT');
} // END - if
// Translate some data if present
- if (isset($content['status'])) $content['status'] = SURFBAR_TRANSLATE_STATUS($content['status']);
- if (isset($content['registered'])) $content['registered'] = MAKE_DATETIME($content['registered'], "2");
- if (isset($content['last_locked'])) $content['last_locked'] = MAKE_DATETIME($content['last_locked'], "2");
- if (isset($content['views_total'])) $content['views_total'] = TRANSLATE_COMMA($content['views_total']);
- if (isset($content['views_allowed'])) $content['views_allowed'] = TRANSLATE_COMMA($content['views_allowed']);
- if (isset($content['views_max'])) $content['views_max'] = TRANSLATE_COMMA($content['views_max']);
+ if (isset($content['status'])) $content['status'] = surfbarTranslateUserStatus($content['status']);
+ if (isset($content['registered'])) $content['registered'] = generateDateTime($content['registered'], "2");
+ if (isset($content['last_locked'])) $content['last_locked'] = generateDateTime($content['last_locked'], "2");
+ if (isset($content['views_total'])) $content['views_total'] = translateComma($content['views_total']);
+ if (isset($content['views_allowed'])) $content['views_allowed'] = translateComma($content['views_allowed']);
+ if (isset($content['views_max'])) $content['views_max'] = translateComma($content['views_max']);
// Load template
$mailText = LOAD_EMAIL_TEMPLATE($templateName, $content, $content['uid']);
// Send the email
- return SEND_EMAIL($content['uid'], $subject, $mailText);
+ return sendEmail($content['uid'], $subject, $mailText);
}
+
// Translates the limit
-function SURFBAR_TRANSLATE_LIMIT ($limit) {
+function surfbarTranslateLimit ($limit) {
// Is this zero?
if ($limit == 0) {
// Unlimited!
- $return = MEMBER_SURFBAR_UNLIMITED_VIEWS;
+ $return = getMessage('MEMBER_SURFBAR_UNLIMITED_VIEWS');
} else {
// Translate comma
- $return = TRANSLATE_COMMA($limit);
+ $return = translateComma($limit);
}
// Return value
return $return;
}
+
// Translate the URL status
-function SURFBAR_TRANSLATE_STATUS ($status) {
+function surfbarTranslateUserStatus ($status) {
// Create constant name
$constantName = sprintf("SURFBAR_URL_STATUS_%s", strtoupper($status));
// Set default translated status
- $statusTranslated = "!".$constantName."!";
+ $statusTranslated = '!'.$constantName.'!';
// Is the constant there?
if (defined($constantName)) {
// Return result
return $statusTranslated;
}
+
// Determine reward
function SURFBAR_DETERMINE_REWARD ($onlyMin=false) {
// Static values are default
$reward = getConfig('surfbar_static_reward');
// Do we have static or dynamic?
- if (getConfig('surfbar_pay_model') == "DYNAMIC") {
+ if (getConfig('surfbar_pay_model') == 'DYNAMIC') {
// "Calculate" dynamic reward
if ($onlyMin) {
$reward += SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE();
// Return reward
return $reward;
}
+
// Determine costs
function SURFBAR_DETERMINE_COSTS ($onlyMin=false) {
// Static costs is default
$costs = getConfig('surfbar_static_costs');
// Do we have static or dynamic?
- if (getConfig('surfbar_pay_model') == "DYNAMIC") {
+ if (getConfig('surfbar_pay_model') == 'DYNAMIC') {
// "Calculate" dynamic costs
if ($onlyMin) {
$costs += SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE();
// Return costs
return $costs;
}
+
// "Calculate" dynamic add
function SURFBAR_CALCULATE_DYNAMIC_ADD () {
// Get min/max values
// "Calculate" dynamic part and return it
return mt_rand($min, $max);
}
+
// Determine right template name
function SURFBAR_DETERMINE_TEMPLATE_NAME() {
// Default is the frameset
// Return result
return $templateName;
}
+
// Check if the "reload lock" of the current user is full, call this function
// before you call SURFBAR_CHECK_RELOAD_LOCK().
function SURFBAR_CHECK_RELOAD_FULL() {
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Fixed surf lock is ".getConfig('surfbar_static_lock')."", false);
// Do we have dynamic model?
- if (getConfig('surfbar_pay_model') == "DYNAMIC") {
+ if (getConfig('surfbar_pay_model') == 'DYNAMIC') {
// "Calculate" dynamic lock
$GLOBALS['cache_array']['surfbar']['surf_lock'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
} // END - if
// Return result
return $isFull;
}
+
// Get total amount of URLs of given status for current user or of ACTIVE URLs by default
-function SURFBAR_GET_TOTAL_URLS ($status="ACTIVE", $excludeUserId=0) {
+function SURFBAR_GET_TOTAL_URLS ($status = 'ACTIVE', $excludeUserId = 0) {
// Determine depleted user account
$UIDs = SURFBAR_DETERMINE_DEPLETED_USERIDS();
// Return result
return $cnt;
}
+
// Check wether the user is allowed to book more URLs
function SURFBAR_IF_USER_BOOK_MORE_URLS ($uid=0) {
// Is this admin and userid is zero or does the user has some URLs left to book?
return ((($uid == 0) && (IS_ADMIN())) || (SURFBAR_GET_TOTAL_USER_URLS($uid, '', array("REJECTED")) < getConfig('surfbar_max_order')));
}
+
// Get total amount of URLs of given status for current user
-function SURFBAR_GET_TOTAL_USER_URLS ($uid=0, $status="",$exclude="") {
+function SURFBAR_GET_TOTAL_USER_URLS ($uid=0, $status = '',$exclude = '') {
// Is the user 0 and user is logged in?
if (($uid == 0) && (IS_MEMBER())) {
// Then use this userid
// Return result
return $cnt;
}
+
// Generate a validation code for the given id number
-function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
+function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt = '') {
// @TODO Invalid salt should be refused
$GLOBALS['cache_array']['surfbar']['salt'] = "INVALID";
// Is the salt set?
if (empty($salt)) {
// Generate random hashed string
- $GLOBALS['cache_array']['surfbar']['salt'] = sha1(GEN_PASS(255));
+ $GLOBALS['cache_array']['surfbar']['salt'] = sha1(generatePassword(255));
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "newSalt=".SURFBAR_GET_SALT()."", false);
} else {
// Use this as salt!
}
// ... and now the validation code
- $valCode = generateRandomCodde($length, sha1(SURFBAR_GET_SALT().":".$urlId), getUserId());
+ $valCode = generateRandomCodde($length, sha1(SURFBAR_GET_SALT().':'.$urlId), getUserId());
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "valCode={$valCode}", false);
} // END - while
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "finalValCode={$valHashedCode}", false);
return $valHashedCode;
}
+
// Check validation code
function SURFBAR_CHECK_VALIDATION_CODE ($urlId, $check, $salt) {
// Secure id number
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "+++".$salt."|".SURFBAR_GET_DATA('last_salt')."+++", false);
return (($code == $check) && ($salt == SURFBAR_GET_DATA('last_salt')));
}
+
// Lockdown the userid/id combination (reload lock)
function SURFBAR_LOCKDOWN_ID ($urlId) {
//* DEBUG: */ print "LOCK!");
array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__);
// Remove the salt from database
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_surfbar_salts` WHERE url_id=%s AND userid=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_surfbar_salts` WHERE url_id=%s AND `userid`=%s LIMIT 1",
array(bigintval($urlId), getUserId()), __FUNCTION__, __LINE__);
}
+
// Pay points to the user and remove it from the sender if userid is given else it is a "sponsored surf"
function SURFBAR_PAY_POINTS () {
// Remove it from the URL owner
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "uid=".getUserId().",reward=".SURFBAR_GET_REWARD()."", false);
ADD_POINTS_REFSYSTEM(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), getUserId(), SURFBAR_GET_DATA('reward'));
}
+
// Updates the statistics of current URL/userid
function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
// Init add
} // END - if
// Update URL stats
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET views_total=views_total+1".$add." WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET views_total=views_total+1".$add." WHERE `id`=%s LIMIT 1",
array(SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
// Update the stats entry
incrementConfigEntry('surfbar_monthly_counter');
// Update config as well
- UPDATE_CONFIG(array("surfbar_total_counter", "surfbar_daily_counter", "surfbar_weekly_counter", "surfbar_monthly_counter"), array(1,1,1,1), "+");
+ updateConfiguration(array('surfbar_total_counter', 'surfbar_daily_counter', 'surfbar_weekly_counter', 'surfbar_monthly_counter'), array(1,1,1,1), '+');
}
+
// Update the salt for validation and statistics
function SURFBAR_UPDATE_SALT_STATS () {
// Update statistics record
SURFBAR_UPDATE_INSERT_STATS_RECORD();
// Simply store the salt from cache away in database...
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_salts` SET last_salt='%s' WHERE url_id=%s AND userid=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_salts` SET last_salt='%s' WHERE url_id=%s AND `userid`=%s LIMIT 1",
array(SURFBAR_GET_SALT(), SURFBAR_GET_ID(), getUserId()), __FUNCTION__, __LINE__);
// Debug message
// Return if the update was okay
return (SQL_AFFECTEDROWS() == 1);
}
+
// Check if the reload lock is active for given id
function SURFBAR_CHECK_RELOAD_LOCK ($urlId) {
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "id={$urlId}", false);
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "cnt={$cnt},".SURFBAR_GET_SURF_LOCK()."", false);
return ($cnt == 1);
}
+
// Determine which user hash no more points left
function SURFBAR_DETERMINE_DEPLETED_USERIDS ($limit=0) {
// Init array
// Return result
return $UIDs;
}
+
// Determine how many users are Online in surfbar
function SURFBAR_DETERMINE_TOTAL_ONLINE () {
// Count all users in surfbar modue and return the value
// Return result
return $cnt;
}
+
// Determine waiting time for one URL
function SURFBAR_DETERMINE_WAIT_TIME () {
// Get fixed reload lock
$time = getConfig('surfbar_static_time');
// Which payment model do we have?
- if (getConfig('surfbar_pay_model') == "DYNAMIC") {
+ if (getConfig('surfbar_pay_model') == 'DYNAMIC') {
// "Calculate" dynamic time
$time += SURFBAR_CALCULATE_DYNAMIC_ADD();
} // END - if
// Return value
return $time;
}
+
// Changes the status of an URL from given to other
function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data=array()) {
// Make new status always lower-case
// Update the status now
// ---------- Comment out for debugging/developing member actions! ---------
- //SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET `status`='%s' WHERE id=%s LIMIT 1",
+ //SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET `status`='%s' WHERE `id`=%s LIMIT 1",
// array($newStatus, bigintval($urlId)), __FUNCTION__, __LINE__);
// ---------- Comment out for debugging/developing member actions! ---------
// Prepare content for notification routines
$data[$urlId]['uid'] = $data[$urlId]['userid'];
$data[$urlId]['frametester'] = FRAMETESTER($data[$urlId]['url']);
- $data[$urlId]['reward'] = TRANSLATE_COMMA(getConfig('surfbar_static_reward'));
- $data[$urlId]['costs'] = TRANSLATE_COMMA(getConfig('surfbar_static_costs'));
+ $data[$urlId]['reward'] = translateComma(getConfig('surfbar_static_reward'));
+ $data[$urlId]['costs'] = translateComma(getConfig('surfbar_static_costs'));
// Do some dirty fixing here:
- if (($data[$urlId]['status'] == "STOPPED") && ($newStatus == "pending")) {
+ if (($data[$urlId]['status'] == 'STOPPED') && ($newStatus == 'pending')) {
// Fix for template change
- $newStatus = "continued";
+ $newStatus = 'continued';
} // END - if
// Send admin notification
// All done!
return true;
}
+
// Calculate minimum value for dynamic payment model
function SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE () {
// Addon is zero by default
$percent = abs(log(getConfig('surfbar_dynamic_percent') / 100 + 1));
// Get total users
- $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true);
+ $totalUsers = GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true);
// Get online users
$onlineUsers = SURFBAR_DETERMINE_TOTAL_ONLINE();
$addon += abs(log($onlineUsers / $totalUsers + 1) * $percent * $totalUsers);
// Get total URLs
- $totalUrls = SURFBAR_GET_TOTAL_URLS("ACTIVE", "0");
+ $totalUrls = SURFBAR_GET_TOTAL_URLS('ACTIVE', '0');
// Get user's total URLs
- $userUrls = SURFBAR_GET_TOTAL_USER_URLS(0, "ACTIVE");
+ $userUrls = SURFBAR_GET_TOTAL_USER_URLS(0, 'ACTIVE');
// Calculate addon
if ($totalUrls > 0) {
// Return addon
return $addon;
}
+
// Calculate maximum value for dynamic payment model
function SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE () {
// Addon is zero by default
$percent = abs(log(getConfig('surfbar_dynamic_percent') / 100 + 1));
// Get total users
- $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true);
+ $totalUsers = GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true);
// Calculate addon
$addon += abs($max * $percent * $totalUsers);
// Get total URLs
- $totalUrls = SURFBAR_GET_TOTAL_URLS("ACTIVE", "0");
+ $totalUrls = SURFBAR_GET_TOTAL_URLS('ACTIVE', '0');
// Calculate addon
$addon += abs($max * $percent * $totalUrls);
// Return addon
return $addon;
}
+
// Calculate dynamic lock
function SURFBAR_CALCULATE_DYNAMIC_LOCK () {
// Default lock is 30 seconds
// Return value
return $addon;
}
+
// "Getter" for lock ids array
function SURFBAR_GET_LOCK_IDS () {
// Prepare some arrays
// Load all entries
while ($content = SQL_FETCHARRAY($result)) {
// Debug message
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "next - lid={$content['id']},url={$content['url_id']},rest=".(time() - $last)."/".SURFBAR_GET_SURF_LOCK()."", false);
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "next - lid={$content['id']},url={$content['url_id']},rest=".(time() - $last).'/'.SURFBAR_GET_SURF_LOCK()."", false);
// Skip entries that are too old
if (($last > (time() - SURFBAR_GET_SURF_LOCK())) && (!in_array($content['url_id'], $ignored))) {
// Return array
return $USE;
}
+
// "Getter" for maximum random number
function SURFBAR_GET_MAX_RANDOM ($UIDs, $add) {
// Count max availabe entries
// Return value
return $maxRand;
}
+
// Load all URLs of the current user and return it as an array
function SURFBAR_GET_USER_URLS () {
// Init array
// Return the array
return $URLs;
}
+
// "Getter" for member action array for given status
-function SURFBAR_GET_ACTION_ARRAY ($status) {
+function SURFBAR_getModeAction_ARRAY ($status) {
// Init array
$returnArray = array();
// Return result
return $returnArray;
}
+
// Reload to configured stop page
-function SURFBAR_RELOAD_TO_STOP_PAGE($page="stop") {
+function SURFBAR_RELOAD_TO_STOP_PAGE ($page="stop") {
// Internal or external?
- if ((getConfig('surfbar_pause_mode') == "INTERNAL") || (getConfig('surfbar_pause_url') == "")) {
+ if ((getConfig('surfbar_pause_mode') == 'INTERNAL') || (getConfig('surfbar_pause_url') == '')) {
// Reload to internal page
- LOAD_URL("surfbar.php?frame=".$page);
+ redirectToUrl("surfbar.php?frame=".$page);
} else {
// Reload to external page
LOAD_CONFIGURED_URL('surfbar_pause_url');
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "BASE/STATIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."", false);
// Only in dynamic model add the dynamic bonus!
- if (getConfig('surfbar_pay_model') == "DYNAMIC") {
+ if (getConfig('surfbar_pay_model') == 'DYNAMIC') {
// Calculate dynamic reward/costs and add it
$GLOBALS['cache_array']['surfbar']['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
$GLOBALS['cache_array']['surfbar']['costs'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "nextId={$nextId}", false);
return $nextId;
}
+
// -----------------------------------------------------------------------------
// PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE IF THEY DON'T "WRAP"
// THE $GLOBALS['cache_array']['surfbar'] ARRAY!
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "element[$element]={$data}", false);
return $data;
}
+
// Getter for reward from cache
function SURFBAR_GET_REWARD () {
// Get data element and return its contents
return SURFBAR_GET_DATA('reward');
}
+
// Getter for costs from cache
function SURFBAR_GET_COSTS () {
// Get data element and return its contents
return SURFBAR_GET_DATA('costs');
}
+
// Getter for URL from cache
function SURFBAR_GET_URL () {
// Get data element and return its contents
return SURFBAR_GET_DATA('url');
}
+
// Getter for salt from cache
function SURFBAR_GET_SALT () {
// Get data element and return its contents
return SURFBAR_GET_DATA('salt');
}
+
// Getter for id from cache
function SURFBAR_GET_ID () {
// Get data element and return its contents
return SURFBAR_GET_DATA('id');
}
+
// Getter for userid from cache
function SURFBAR_GET_USERID () {
// Get data element and return its contents
return SURFBAR_GET_DATA('userid');
}
+
// Getter for user reload locks
function SURFBAR_GET_USER_LOCKS () {
// Get data element and return its contents
return SURFBAR_GET_DATA('user_locks');
}
+
// Getter for reload time
function SURFBAR_GET_RELOAD_TIME () {
// Get data element and return its contents
return SURFBAR_GET_DATA('time');
}
+
// Getter for allowed views
function SURFBAR_GET_VIEWS_ALLOWED () {
// Get data element and return its contents
return SURFBAR_GET_DATA('views_allowed');
}
+
// Getter for fixed reload
function SURFBAR_GET_FIXED_RELOAD () {
// Get data element and return its contents
return SURFBAR_GET_DATA('fixed_reload');
}
+
// Getter for surf lock
function SURFBAR_GET_SURF_LOCK () {
// Get data element and return its contents
return SURFBAR_GET_DATA('surf_lock');
}
-//
+
+// [EOF]
?>
if (!$jobsDone) {
// New extensions or updates found
- $value = GET_TOTAL_DATA(GET_CURRENT_ADMIN_ID(), "task_system", "id", "assigned_admin", true, " AND `status`='NEW' AND task_type='EXTENSION_UPDATE'");
+ $value = GET_TOTAL_DATA(getCurrentAdminId(), 'task_system', 'id', 'assigned_admin', true, " AND `status`='NEW' AND `task_type`='EXTENSION_UPDATE'");
if ($value > 0) {
define('__TASK_UPDATE_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=list_task&type=updates\">".$value."</a>");
} else {
- define('__TASK_UPDATE_VALUE', "0");
+ define('__TASK_UPDATE_VALUE', '0');
}
} else {
- define('__TASK_UPDATE_VALUE', "0");
+ define('__TASK_UPDATE_VALUE', '0');
}
//
// First check for all account status seperately
//
// Confirmed accounts
- $value = GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true);
+ $value = GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true);
if ($value > 0) {
define('__CONFIRMED_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=list_user&status=confirmed\">".$value."</a>");
} else {
- define('__CONFIRMED_VALUE', "0");
+ define('__CONFIRMED_VALUE', '0');
}
// Unconfirmed accounts
- $value = GET_TOTAL_DATA("UNCONFIRMED", "user_data", 'userid', "status", true);
+ $value = GET_TOTAL_DATA('UNCONFIRMED', 'user_data', 'userid', 'status', true);
if ($value > 0) {
define('__UNCONFIRMED_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=chk_regs\">".$value."</a>");
} else {
- define('__UNCONFIRMED_VALUE', "0");
+ define('__UNCONFIRMED_VALUE', '0');
}
// And locked accounts
- $value = GET_TOTAL_DATA("LOCKED", "user_data", 'userid', "status", true);
+ $value = GET_TOTAL_DATA('LOCKED', 'user_data', 'userid', 'status', true);
if ($value > 0) {
define('__LOCKED_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=list_user&status=locked\">".$value."</a>");
} else {
- define('__LOCKED_VALUE', "0");
+ define('__LOCKED_VALUE', '0');
}
//
// Unassigned tasks
//
- $value = GET_TOTAL_DATA("0", "task_system", "id", "assigned_admin", true, " AND `status` != 'DELETED'");
+ $value = GET_TOTAL_DATA('0', 'task_system', 'id', 'assigned_admin', true, " AND `status` != 'DELETED'");
if ($value > 0) {
define('__TASK_NEW_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=list_task&type=unassigned\">".$value."</a>");
} else {
- define('__TASK_NEW_VALUE', "0");
+ define('__TASK_NEW_VALUE', '0');
}
//
// Closed tasks
//
- $value = GET_TOTAL_DATA("CLOSED", "task_system", "id", "status", true);
+ $value = GET_TOTAL_DATA('CLOSED', 'task_system', 'id', 'status', true);
if ($value > 0) {
define('__TASK_CLOSED_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=list_task&type=closed\">".$value."</a>");
} else {
- define('__TASK_CLOSED_VALUE', "0");
+ define('__TASK_CLOSED_VALUE', '0');
}
//
// Deleted tasks
//
- $value = GET_TOTAL_DATA("DELETED", "task_system", "id", "status", true);
+ $value = GET_TOTAL_DATA('DELETED', 'task_system', 'id', 'status', true);
if ($value > 0) {
define('__TASK_DELETED_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=list_task&type=deleted\">".$value."</a>");
} else {
- define('__TASK_DELETED_VALUE', "0");
+ define('__TASK_DELETED_VALUE', '0');
}
//
// Solved tasks
//
- $value = GET_TOTAL_DATA("SOLVED", "task_system", "id", "status", true, sprintf(" AND assigned_admin=%s", GET_CURRENT_ADMIN_ID()));
+ $value = GET_TOTAL_DATA('SOLVED', 'task_system', 'id', 'status', true, sprintf(" AND `assigned_admin`=%s", getCurrentAdminId()));
if ($value > 0) {
define('__TASK_SOLVED_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=list_task&type=solved\">".$value."</a>");
} else {
- define('__TASK_SOLVED_VALUE', "0");
+ define('__TASK_SOLVED_VALUE', '0');
}
//
// Your tasks
//
- $value = GET_TOTAL_DATA(GET_CURRENT_ADMIN_ID(), "task_system", "id", "assigned_admin", true, " AND status = 'NEW' AND task_type != 'EXTENSION_UPDATE'");
+ $value = GET_TOTAL_DATA(getCurrentAdminId(), 'task_system', 'id', 'assigned_admin', true, " AND `status`='NEW' AND task_type != 'EXTENSION_UPDATE'");
if ($value > 0) {
define('__TASK_YOUR_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=list_task\">".$value."</a>");
} else {
- define('__TASK_YOUR_VALUE', "0");
+ define('__TASK_YOUR_VALUE', '0');
}
//
// Mails waiting to be approved
//
- $value = GET_TOTAL_DATA("ADMIN", "pool", "id", "data_type", true);
+ $value = GET_TOTAL_DATA('ADMIN', 'pool', 'id', 'data_type', true);
if ($value > 0) {
define('__MAIL_ADMIN_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=unlock_emails\">".$value."</a>");
} else {
- define('__MAIL_ADMIN_VALUE', "0");
+ define('__MAIL_ADMIN_VALUE', '0');
}
//
// Unfinished mail orders
//
- $value = GET_TOTAL_DATA("TEMP", "pool", "id", "data_type", true);
+ $value = GET_TOTAL_DATA('TEMP', 'pool', 'id', 'data_type', true);
if ($value > 0) {
define('__MAIL_TEMP_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=email_details\">".$value."</a>");
} else {
- define('__MAIL_TEMP_VALUE', "0");
+ define('__MAIL_TEMP_VALUE', '0');
}
//
// Sent mail orders
//
- $value = GET_TOTAL_DATA("SEND", "pool", "id", "data_type", true);
+ $value = GET_TOTAL_DATA('SEND', 'pool', 'id', 'data_type', true);
if ($value > 0) {
define('__MAIL_SEND_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=email_archiv\">".$value."</a>");
} else {
- define('__MAIL_SEND_VALUE', "0");
+ define('__MAIL_SEND_VALUE', '0');
}
//
//
if (EXT_IS_ACTIVE('autopurge')) {
// Get auto-purged mails
- $value = GET_TOTAL_DATA("DELETED", "pool", "id", "data_type", true);
+ $value = GET_TOTAL_DATA('DELETED', 'pool', 'id', 'data_type', true);
if ($value > 0) {
define('__MAIL_DELETED_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=email_details\">".$value."</a>");
} else {
- define('__MAIL_DELETED_VALUE', "0");
+ define('__MAIL_DELETED_VALUE', '0');
}
//
//
if (GET_EXT_VERSION('bonus') >= '0.1.8') {
// Get auto-purged bonus mails
- $value = GET_TOTAL_DATA("DELETED", 'bonus', "id", "data_type", true);
+ $value = GET_TOTAL_DATA('DELETED', 'bonus', 'id', 'data_type', true);
if ($value > 0) {
define('__MAIL_BONUS_AP_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=email_details\">".$value."</a>");
} else {
- define('__MAIL_BONUS_AP_VALUE', "0");
+ define('__MAIL_BONUS_AP_VALUE', '0');
}
} elseif (EXT_IS_ACTIVE('bonus')) {
define('__MAIL_BONUS_AP_VALUE', sprintf(getMessage('ADMIN_EXT_BONUS_OUTDATED', '0.1.8')));
//
if (GET_EXT_VERSION('bonus') >= '0.1.8') {
// Get sent bonus mails (but not notifications)
- $value = GET_TOTAL_DATA("SEND", 'bonus', "id", "data_type", true, " AND is_notify='N'");
+ $value = GET_TOTAL_DATA('SEND', 'bonus', 'id', 'data_type', true, " AND `is_notify`='N'");
if ($value > 0) {
define('__MAIL_BONUS_SEND_VALUE', "<a href=\"{!URL!}/modules.php?module=admin&what=email_details\">".$value."</a>");
} else {
- define('__MAIL_BONUS_SEND_VALUE', "0");
+ define('__MAIL_BONUS_SEND_VALUE', '0');
}
} elseif (EXT_IS_ACTIVE('bonus')) {
define('__MAIL_BONUS_SEND_VALUE', sprintf(getMessage('ADMIN_EXT_BONUS_OUTDATED', '0.1.8')));
WHERE d.`status`='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - ".$since.") AND d.last_online < (UNIX_TIMESTAMP() - ".$since.") AND d.ap_notified < (UNIX_TIMESTAMP() - ".$since.")
".$EXCLUDE_LIST."
ORDER BY d.userid");
- $WHATs[] = "list_autopurge";
+ $WHATs[] = 'list_autopurge';
$DESCRs[] = getMessage('ADMIN_TASK_INACTIVE_AUTOPURGE');
$TITLEs[] = getMessage('ADMIN_TASK_INACTIVE_AUTOPURGE_TITLE');
}
if (GET_EXT_VERSION('sql_patches') >= '0.3.4') {
// Check for accounts without referal
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE refid='0' ORDER BY userid");
+ ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `refid`=0 ORDER BY `userid` ASC");
$DESCRs[] = getMessage('ADMIN_TASK_LIST_ACCOUNT_NOREF');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_ACCOUNT_NOREF_TITLE');
- $WHATs[] = "list_user&mode=norefs";
+ $WHATs[] = 'list_user&mode=norefs';
}
if (EXT_IS_ACTIVE('payout')) {
// List new payout requests
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE `status`='NEW' ORDER BY userid");
- $WHATs[] = "list_payouts";
+ ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE `status`='NEW' ORDER BY `userid` ASC");
+ $WHATs[] = 'list_payouts';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_WAITING');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_WAITING_TITLE');
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_payouts` ORDER BY userid");
- $WHATs[] = "list_payouts";
+ ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_payouts` ORDER BY `userid` ASC");
+ $WHATs[] = 'list_payouts';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_ALL');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_ALL_TITLE');
}
if (EXT_IS_ACTIVE('wernis')) {
// List new wernis requests
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_wernis` ORDER BY userid");
- $WHATs[] = "list_wernis";
+ ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_wernis` ORDER BY `userid` ASC");
+ $WHATs[] = 'list_wernis';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_WERNIS_ALL');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_WERNIS_ALL_TITLE');
}
if (EXT_IS_ACTIVE('primera')) {
// List new primera requests
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_primera` ORDER BY userid");
- $WHATs[] = "list_primera";
+ ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_primera` ORDER BY `userid` ASC");
+ $WHATs[] = 'list_primera';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_PRIMERA_ALL');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_PRIMERA_ALL_TITLE');
}
if (EXT_IS_ACTIVE('holiday')) {
// List holiday requests
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_holidays` ORDER BY userid");
- $WHATs[] = "list_holiday";
+ ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_holidays` ORDER BY `userid` ASC");
+ $WHATs[] = 'list_holiday';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_HOLIDAYS');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_HOLIDAYS_TITLE');
}
if (GET_EXT_VERSION('bonus') >= '0.8.7') {
// List all notifications
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_bonus` WHERE is_notify='Y' ORDER BY timestamp DESC");
- $WHATs[] = "list_notifications";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE is_notify='Y' ORDER BY timestamp DESC");
+ $WHATs[] = 'list_notifications';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_NOTIFICATIONS');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_NOTIFICATIONS_TITLE');
} // END - if
// Active rallye
if (GET_EXT_VERSION('bonus') >= '0.6.9') {
// Add more bonus points here
- $USE = "(0";
- if (getConfig('bonus_click_yn') == 'Y') $USE .= " + turbo_bonus";
- if (getConfig('bonus_login_yn') == 'Y') $USE .= " + login_bonus";
- if (getConfig('bonus_order_yn') == 'Y') $USE .= " + bonus_order";
- if (getConfig('bonus_stats_yn') == 'Y') $USE .= " + bonus_stats";
- if (getConfig('bonus_ref_yn') == 'Y') $USE .= " + bonus_ref";
- $USE .= ")";
+ $USE = '(0';
+ if (getConfig('bonus_click_yn') == 'Y') $USE .= ' + `turbo_bonus`';
+ if (getConfig('bonus_login_yn') == 'Y') $USE .= ' + `login_bonus`';
+ if (getConfig('bonus_order_yn') == 'Y') $USE .= ' + `bonus_order`';
+ if (getConfig('bonus_stats_yn') == 'Y') $USE .= ' + `bonus_stats`';
+ if (getConfig('bonus_ref_yn') == 'Y') $USE .= ' + `bonus_ref`';
+ $USE .= ')';
} else {
// Old version ???
- $USE = "turbo_bonus";
+ $USE = 'turbo_bonus';
}
// Autopurge installed?
$lastOnline = '';
if ((EXT_IS_ACTIVE('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getConfig('ap_inactive_since') > 0)) {
// Use last online timestamp to keep inactive members away from here
- $lastOnline = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
+ $lastOnline = sprintf(" AND `last_online` >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
}
ADD_SQL("SELECT ".$USE." AS points
FROM `{!_MYSQL_PREFIX!}_user_data`
WHERE `status`='CONFIRMED' AND ".$USE.">0".$lastOnline."
ORDER BY points DESC, userid");
- $WHATs[] = "list_bonus";
+ $WHATs[] = 'list_bonus';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_BONUS');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_BONUS_TITLE');
}
$lastOnline = '';
if ((EXT_IS_ACTIVE('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getConfig('ap_inactive_since') > 0)) {
// Use last online timestamp to keep inactive members away from here
- $lastOnline = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
+ $lastOnline = sprintf(" AND `last_online` >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
}
ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data`
WHERE `status`='CONFIRMED' AND beg_points>0".$lastOnline."
ORDER BY beg_points DESC, userid");
- $WHATs[] = "list_beg";
+ $WHATs[] = 'list_beg';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_BEG');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_BEG_TITLE');
}
if (EXT_IS_ACTIVE('doubler')) {
// List waiting payouts
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' ORDER BY `id`");
- $WHATs[] = "list_doubler&mode=waiting&select=all";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' ORDER BY `id`");
+ $WHATs[] = 'list_doubler&mode=waiting&select=all';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_WAITING');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_WAITING_TITLE');
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_doubler` ORDER BY `id`");
- $WHATs[] = "list_doubler";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_doubler` ORDER BY `id`");
+ $WHATs[] = 'list_doubler';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_ALL');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_ALL_TITLE');
}
//
// All referal banner
//
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_refbanner` ORDER BY `id`");
- $WHATs[] = "refbanner";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_refbanner` ORDER BY `id`");
+ $WHATs[] = 'refbanner';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ALL');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ALL_TITLE');
//
// All activated referal banner
//
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `visible`='Y' ORDER BY `id`");
- $WHATs[] = "refbanner";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `visible`='Y' ORDER BY `id`");
+ $WHATs[] = 'refbanner';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ACTIVE');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ACTIVE_TITLE');
//
// All extensions
//
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_extensions` ORDER BY `id`");
- $WHATs[] = "extensions";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_extensions` ORDER BY `id`");
+ $WHATs[] = 'extensions';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ALL');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ALL_TITLE');
//
// All activated extensions
//
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_active='Y' ORDER BY `id`");
- $WHATs[] = "extensions&active=Y";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_extensions` WHERE `ext_active`='Y' ORDER BY `id`");
+ $WHATs[] = 'extensions&active=Y';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ACTIVE');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ACTIVE_TITLE');
- if (EXT_IS_ACTIVE("engine")) {
+ if (EXT_IS_ACTIVE('engine')) {
// List all export accounts
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_engine_accounts` ORDER BY `id`");
- $WHATs[] = "list_engine";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_engine_accounts` ORDER BY `id`");
+ $WHATs[] = 'list_engine';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_ENGINE');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_ENGINE_TITLE');
// List all pending accounts
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_engine_accounts` WHERE `status`='UNCONFIRMED' ORDER BY `id`");
- $WHATs[] = "unlock_engine";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_engine_accounts` WHERE `status`='UNCONFIRMED' ORDER BY `id`");
+ $WHATs[] = 'unlock_engine';
$DESCRs[] = getMessage('ADMIN_TASK_UNLOCK_ENGINE');
$TITLEs[] = getMessage('ADMIN_TASK_UNLOCK_ENGINE_TITLE');
// List all safes
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_engine_safe` ORDER BY `id`");
- $WHATs[] = "list_engine&mode=safe";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_engine_safe` ORDER BY `id`");
+ $WHATs[] = 'list_engine&mode=safe';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_ENGINE_SAFES');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_ENGINE_SAFES_TITLE');
// List all export URLs
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_engine_urls` ORDER BY `id`");
- $WHATs[] = "engine_urls";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_engine_urls` ORDER BY `id`");
+ $WHATs[] = 'engine_urls';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_ENGINE_URLS');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_ENGINE_URLS_TITLE');
- }
+ } // END - if
if (EXT_IS_ACTIVE('sponsor')) {
// List all sponsors
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` ORDER BY `id`");
- $WHATs[] = "list_sponsor";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data` ORDER BY `id`");
+ $WHATs[] = 'list_sponsor';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_TITLE');
// List confirmed sponsor accounts
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='CONFIRMED' ORDER BY `id`");
- $WHATs[] = "list_sponsor";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='CONFIRMED' ORDER BY `id`");
+ $WHATs[] = 'list_sponsor';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_CONFIRMED');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_CONFIRMED_TITLE');
// List unconfirmed sponsor accounts
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='UNCONFIRMED' ORDER BY `id`");
- $WHATs[] = "list_sponsor";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='UNCONFIRMED' ORDER BY `id`");
+ $WHATs[] = 'list_sponsor';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_UNCONFIRMED');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_UNCONFIRMED_TITLE');
// List locked sponsor accounts
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='LOCKED' ORDER BY `id`");
- $WHATs[] = "list_sponsor";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='LOCKED' ORDER BY `id`");
+ $WHATs[] = 'list_sponsor';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_LOCKED');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_LOCKED_TITLE');
// List waiting sponsor accounts to be approved
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='PENDING' ORDER BY `id`");
- $WHATs[] = "unlock_sponsor";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='PENDING' ORDER BY `id`");
+ $WHATs[] = 'unlock_sponsor';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_PENDING');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_PENDING_TITLE');
// Waiting payments
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_orders` WHERE `pay_status`='PENDING' ORDER BY `id`");
- $WHATs[] = "list_sponsor_pays";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_orders` WHERE `pay_status`='PENDING' ORDER BY `id`");
+ $WHATs[] = 'list_sponsor_pays';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_ORDERS');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_ORDERS_TITLE');
}
if (EXT_IS_ACTIVE('country')) {
// List country codes
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_countries` ORDER BY `id`");
- $WHATs[] = "list_country";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_countries` ORDER BY `id`");
+ $WHATs[] = 'list_country';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_COUNTRY');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_COUNTRY_TITLE');
}
if (EXT_IS_ACTIVE('theme')) {
// List all themes
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_themes` ORDER BY `id`");
- $WHATs[] = "theme_edit";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_themes` ORDER BY `id`");
+ $WHATs[] = 'theme_edit';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_THEME_ALL');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_THEME_ALL_TITLE');
// List active themes
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_themes` WHERE theme_active='Y' ORDER BY `id`");
- $WHATs[] = "theme_edit";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_themes` WHERE theme_active='Y' ORDER BY `id`");
+ $WHATs[] = 'theme_edit';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_THEME_ACTIVE');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_THEME_ACTIVE_TITLE');
}
if (EXT_IS_ACTIVE('admins')) {
// List all administrator logins
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id`");
- $WHATs[] = "admins_edit";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id`");
+ $WHATs[] = 'admins_edit';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_ADMINS_ALL');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_ADMINS_ALL_TITLE');
}
if (EXT_IS_ACTIVE('surfbar')) {
// List all URLs in surfbar
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_surfbar_urls` ORDER BY `id`");
- $WHATs[] = "list_surfbar_urls";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_surfbar_urls` ORDER BY `id`");
+ $WHATs[] = 'list_surfbar_urls';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_ALL');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_ALL_TITLE');
// List all pending URLs in surfbar
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_surfbar_urls` WHERE `status`='PENDING' ORDER BY `id`");
- $WHATs[] = "unlock_surfbar_urls";
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_surfbar_urls` WHERE `status`='PENDING' ORDER BY `id`");
+ $WHATs[] = 'unlock_surfbar_urls';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_PENDING');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_PENDING_TITLE');
}
$EXTRAS .= TASK_CREATE_EXTRA_ROWS($WHATs, $DESCRs, $TITLEs);
// If empty just keep a forced-space left for CSS issues
- if (empty($EXTRAS)) $EXTRAS = " ";
+ if (empty($EXTRAS)) $EXTRAS = ' ';
// Add compiled string to constant for final template
define('__OVERVIEW_EXTRA_TABLE', $EXTRAS);
// Simply load the template... :-)
- LOAD_TEMPLATE("admin_overview_task");
+ LOAD_TEMPLATE('admin_overview_task');
}
//
$content = array(
'row_descr' => $DESCRs[$key],
'row_sw' => $SW,
- 'bottom' => "",
+ 'bottom' => '',
);
// Rewrite CSS class if not last entry is reached
- if ($key < (COUNT_SQLS() - 1)) $content['bottom'] = "bottom2";
+ if ($key < (COUNT_SQLS() - 1)) $content['bottom'] = 'bottom2';
if (($value > 0) && (!empty($WHATs[$key]))) {
if (empty($TITLEs[$key])) $TITLEs[$key] = getMessage('ADMIN_TASK_UNKNOWN_LIST_TITLE');
}
// And insert the final string into extras template
- $OUT .= LOAD_TEMPLATE("admin_overview_task_rows", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_overview_task_rows', true, $content);
// Switch color
$SW = 3 - $SW;
} // END - if
// Return output in the template
- return LOAD_TEMPLATE("admin_overview_task_extras", true, $OUT);
+ return LOAD_TEMPLATE('admin_overview_task_extras', true, $OUT);
}
//
}
// Create a selection box with installed and activated themes
-function THEME_SELECTION_BOX ($mod, $act, $wht, $result) {
+function generateThemeSelectionBox ($mod, $act, $wht, $result) {
// Construction URL
$formAction = "{!URL!}/modules.php?module=".$mod;
if (!empty($act)) $formAction .= "&action=".$act;
while ($content = SQL_FETCHARRAY($result)) {
// Load it's theme.php file
$INC = sprintf("theme/%s/theme.php", SQL_ESCAPE($content['theme_path']));
- if (INCLUDE_READABLE($INC)) {
+ if (isIncludeReadable($INC)) {
// And save all data in array
- LOAD_INC($INC);
+ loadInclude($INC);
$themesArray['theme_unix'][] = $content['theme_path'];
$themesArray['theme_name'][] = $GLOBALS['theme_data']['name'];
} // END - if
$OUT = '';
foreach ($themesArray['theme_unix'] as $key => $theme) {
$OUT .= " <option value=\"".$theme."\"";
- if ($theme == GET_CURR_THEME()) $OUT .= ' selected="selected"';
+ if ($theme == getCurrentTheme()) $OUT .= ' selected="selected"';
$OUT .= ">".$themesArray['theme_name'][$key]."</option>\n";
} // END - foreach
}
// Checks wether a theme is found in db
-function THEME_CHECK_EXIST ($name) {
+function ifThemeExists ($name) {
// Get theme and is it not nul?
- return (THEME_GET_ID($name) > 0);
+ return (getThemeId($name) > 0);
}
// Checks if a theme is active
-function THEME_IS_ACTIVE ($name) {
+function isThemeActive ($name) {
// Is the extension 'theme' installed?
if (!EXT_IS_ACTIVE('theme')) {
// Then abort here
}
// Gets current human-readable theme name
-function GET_CURR_THEME_NAME () {
+function getCurrentThemeName () {
// Is the extension 'theme' installed?
if (!EXT_IS_ACTIVE('theme')) {
// Then abort here
} // END - if
// Get the Uni* name
- $name = GET_CURR_THEME();
+ $name = getCurrentTheme();
// Is the cache entry there?
if (isset($GLOBALS['cache_array']['themes']['theme_name'][$name])) {
}
// Initialize variables
-$GLOBALS['curr_theme'] = GET_CURR_THEME();
+$GLOBALS['curr_theme'] = getCurrentTheme();
// Check if new theme is selcted
if ((REQUEST_ISSET_POST(('new_theme'))) && (REQUEST_POST('new_theme') != $GLOBALS['curr_theme'])) {
$newTheme = REQUEST_POST('new_theme');
// Change to new theme
- set_session('mxchange_theme', $newTheme);
+ setSession('mxchange_theme', $newTheme);
// Remove current from array and set new
$theme = sprintf("%stheme/%s/theme.php", constant('PATH'), $GLOBALS['curr_theme']);
//
function TRANSFER_AUTPPURGE($max, $age) {
// First get total in-going lines
- $result = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_user_transfers_in` ORDER BY `id`", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_transfers_in` ORDER BY `id`", __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > $max) {
// Update overdue transfers
$remove = SQL_NUMROWS($result) - $max;
// This will make it really old, so the final removal query will find it
- $result = SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_user_transfers_in` SET time_trans='0' ORDER BY `id` LIMIT ".$remove, __FUNCTION__, __LINE__);
+ $result = SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_user_transfers_in` SET `time_trans`=0 ORDER BY `id` LIMIT ".$remove, __FUNCTION__, __LINE__);
}
// Second get total out-going lines
- $result = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_user_transfers_out` ORDER BY `id`", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_transfers_out` ORDER BY `id`", __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > $max) {
// Update overdue transfers
$remove = SQL_NUMROWS($result) - $max;
// This will make it really old, so the final removal query will find it
- $result = SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_user_transfers_out` SET time_trans='0' ORDER BY `id` LIMIT ".$remove, __FUNCTION__, __LINE__);
+ $result = SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_user_transfers_out` SET `time_trans`=0 ORDER BY `id` LIMIT ".$remove, __FUNCTION__, __LINE__);
}
// Remove old in-going transfers
// Only send email to admin(s) when we have removed entries
if ($REMOVE > 0) {
- SEND_ADMIN_NOTIFICATION(TRANSFER_ADMIN_AUTOPURGE, "admin_transfer_ap", $REMOVE, 0);
+ sendAdminNotification(TRANSFER_ADMIN_AUTOPURGE, "admin_transfer_ap", $REMOVE, 0);
}
}
//
if (REQUEST_ISSET_GET(('mode'))) $add .= "&mode=".REQUEST_GET(('mode'));
/* Creates the list of letters and makes them a link. */
- $alphabet = array(getMessage('_ALL2'),"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",getMessage('_OTHERS'));
+ $alphabet = explode(',', getMessage('_ALL2') . 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z' . getMessage('_OTHERS'));
$num = count($alphabet) - 1;
$OUT = '';
while (list($counter, $ltr) = each($alphabet)) {
$list = array(
'userid' => getMessage('_UID'),
'family' => getMessage('FAMILY_NAME'),
- 'email' => getMessage('ADDY'),
+ 'email' => getMessage('ADDY'),
'REMOTE_ADDR' => getMessage('REMOTE_IP')
);
}
// Create email link to user's account
-function USER_CREATE_EMAIL_LINK($email, $mod='admin') {
+function USER_generateMemberEmailLink($email, $mod='admin') {
// Show contact link only if user is confirmed by default
$locked = " AND `status`='CONFIRMED'";
// Is the extension version fine?
if (GET_EXT_VERSION('user') >= '0.3.4') {
// Get all user ids
- $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true, " AND `rand_confirmed` >= ".getConfig('user_min_confirmed')."");
+ $totalUsers = GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true, " AND `rand_confirmed` >= ".getConfig('user_min_confirmed')."");
// Do we have at least one?
if ($totalUsers > 0) {
setUserId($uid);
// Try to set session data (which shall normally always work!)
- if ((set_session('userid', $uid )) && (set_session('u_hash', $content['hash']))) {
+ if ((setSession('userid', $uid )) && (setSession('u_hash', $content['hash']))) {
// Update database records
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET total_logins=total_logins+1".$add." WHERE userid=%s LIMIT 1",
array($uid), __FUNCTION__, __LINE__);
list($status) = SQL_FETCHROW($result);
// Create an error code from given status
- $errorCode = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
+ $errorCode = generateErrorCodeFromUserStatus($status);
} else {
// ID not found!
$errorCode = getCode('WRONG_ID');
if ($status == 'CONFIRMED') {
// Ooppps, this was missing! ;-) We should update the database...
- $NEW_PASS = GEN_PASS();
+ $NEW_PASS = generatePassword();
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET password='%s' WHERE userid=%s LIMIT 1",
array(generateHash($NEW_PASS), $uid), __FUNCTION__, __LINE__);
$msg = LOAD_EMAIL_TEMPLATE('new-pass', array('new_pass' => $NEW_PASS), $uid);
// ... and send it away
- SEND_EMAIL($uid, getMessage('GUEST_NEW_PASSWORD'), $msg);
+ sendEmail($uid, getMessage('GUEST_NEW_PASSWORD'), $msg);
// Output note to user
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('GUEST_NEW_PASSWORD_SEND'));
} else {
// Account is locked or unconfirmed
- $errorCode = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
+ $errorCode = generateErrorCodeFromUserStatus($status);
// Load URL
- LOAD_URL('modules.php?module=index&what=login&login='.$errorCode);
+ redirectToUrl('modules.php?module=index&what=login&login='.$errorCode);
}
} else {
// ID or email is wrong
return $GLOBALS['wernis_data']['message'];
} elseif (isset($GLOBALS['wernis_data']['status'])) {
// Fall-back to status
- return sprintf(WERNIS_ERROR_STATUS, $GLOBALS['wernis_data']['status']);
+ return sprintf(getMessage('WERNIS_ERROR_STATUS'), $GLOBALS['wernis_data']['status']);
} else {
// Something bad happend
- return WERNIS_UNKNOWN_ERROR;
+ return getMessage('WERNIS_UNKNOWN_ERROR');
}
}
return $GLOBALS['wernis_data']['status'];
} else {
// Something bad happend
- return WERNIS_UNKNOWN_ERROR;
+ return getMessage('WERNIS_UNKNOWN_ERROR');
}
}
if (!is_array($requestData)) {
// Then abort here!
return array(
- 'status' => "failed_general",
- 'message' => WERNIS_API_REQUEST_DATA_INVALID
+ 'status' => 'failed_general',
+ 'message' => getMessage('WERNIS_API_REQUEST_DATA_INVALID')
);
} // END - if
// Is the API id and MD5 hash there?
- if ((getConfig('wernis_api_id') == "") || (getConfig('wernis_api_md5') == "")) {
+ if ((getConfig('wernis_api_id') == '') || (getConfig('wernis_api_md5') == '')) {
// Abort here...
return array(
- 'status' => "failed_general",
- 'message' => WERNIS_API_REQUEST_DATA_MISSING
+ 'status' => 'failed_general',
+ 'message' => getMessage('WERNIS_API_REQUEST_DATA_MISSING')
);
} // END - if
// Add more request data
- $requestData['api_id'] = getConfig(('wernis_api_id'));
+ $requestData['api_id'] = getConfig('wernis_api_id');
$requestData['api_key'] = getConfig('wernis_api_md5');
// Construct the request string
$requestString = getConfig('wernis_api_url') . $scriptName;
// Get the raw response from the lower function
- $response = POST_URL($requestString, $requestData);
+ $response = sendPostRequest($requestString, $requestData);
// Check the response header if all is fine
- if (strpos($response[0], "200") === false) {
+ if (strpos($response[0], '200') === false) {
// Something bad happend... :(
return array(
- 'status' => "request_error",
- 'message' => sprintf(WERNIS_API_REQUEST_ERROR, $response[0])
+ 'status' => 'request_error',
+ 'message' => sprintf(getMessage('WERNIS_API_REQUEST_ERROR'), $response[0])
);
} // END - if
$response = $response[(count($response) - 1)];
// Prepare the returning result for higher functions
- if (substr($response, 0, 1) == "&") {
+ if (substr($response, 0, 1) == '&') {
// Remove the leading & (which can be used in Flash)
$response = substr($response, 1);
} // END - if
// Bring back the response
- $data = explode("=", $response);
+ $data = explode('=', $response);
// Default return array (should not stay empty)
$return = array();
// We use only the first two entries (which shall be fine)
- if ($data[0] === "error") {
+ if ($data[0] === 'error') {
// The request has failed... :(
switch ($data[1]) {
- case "404": // Invalid API ID
- case "AUTH": // Authorization has failed
+ case '404': // Invalid API ID
+ case 'AUTH': // Authorization has failed
$return = array(
- 'status' => "auth_failed",
- 'message' => WERNIS_API_REQUEST_FAILED_AUTH
+ 'status' => 'auth_failed',
+ 'message' => getMessage('WERNIS_API_REQUEST_FAILED_AUTH')
);
break;
- case "LOCKED": // User account is locked!
- case "PASS": // Bad passphrase entered
- case "USER": // Missing account or invalid password
+ case 'LOCKED': // User account is locked!
+ case 'PASS': // Bad passphrase entered
+ case 'USER': // Missing account or invalid password
$return = array(
- 'status' => "user_failed",
- 'message' => WERNIS_API_REQUEST_FAILED_USER
+ 'status' => 'user_failed',
+ 'message' => getMessage('WERNIS_API_REQUEST_FAILED_USER')
);
break;
- case "OWN": // Transfer to own account
+ case 'OWN': // Transfer to own account
$return = array(
- 'status' => "own_failed",
- 'message' => WERNIS_API_REQUEST_FAILED_OWN
+ 'status' => 'own_failed',
+ 'message' => getMessage('WERNIS_API_REQUEST_FAILED_OWN')
);
break;
- case "AMOUNT": // Amount is depleted
+ case 'AMOUNT': // Amount is depleted
$return = array(
- 'status' => "amount_failed",
- 'message' => WERNIS_API_REQUEST_FAILED_AMOUNT
+ 'status' => 'amount_failed',
+ 'message' => getMessage('WERNIS_API_REQUEST_FAILED_AMOUNT')
);
break;
- case "AMOUNT-SEND": // API amount is depleted
+ case 'AMOUNT-SEND': // API amount is depleted
$return = array(
- 'status' => "api_amount_failed",
- 'message' => WERNIS_API_REQUEST_FAILED_API_AMOUNT
+ 'status' => 'api_amount_failed',
+ 'message' => getMessage('WERNIS_API_REQUEST_FAILED_API_AMOUNT')
);
break;
default: // Unknown error (maybe new?)
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown error %s from WDS66 API received.", $data[1]));
$return = array(
- 'status' => "request_failed",
- 'message' => sprintf(WERNIS_API_REQUEST_FAILED, $data[1])
+ 'status' => 'request_failed',
+ 'message' => sprintf(getMessage('WERNIS_API_REQUEST_FAILED'), $data[1])
);
break;
}
} else {
// All fine here
$return = array(
- 'status' => "OK",
+ 'status' => 'OK',
'response' => $response
);
}
$result = false;
// Return the result from the lower functions
- $return = WERNIS_SEND_REQUEST("balance.php");
+ $return = WERNIS_SEND_REQUEST('balance.php');
- if ($return['status'] == "OK") {
+ if ($return['status'] == 'OK') {
// All fine!
$result = true;
} else {
$result = false;
// Prepare the purpose
- $eval = "\$purpose = \"".COMPILE_CODE(sprintf(WERNIS_API_PURPOSE_WITHDRAW, getUserId()))."\";";
+ $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('WERNIS_API_PURPOSE_WITHDRAW'), getUserId()))."\";";
eval($eval);
// Prepare the request data
$requestData = array(
- 'sub_request' => "receive",
+ 'sub_request' => 'receive',
't_uid' => bigintval($wdsId),
't_md5' => $userMd5,
'r_uid' => getConfig('wernis_refid'),
);
// Return the result from the lower functions
- $return = WERNIS_SEND_REQUEST("book.php", $requestData);
+ $return = WERNIS_SEND_REQUEST('book.php', $requestData);
- if ($return['status'] == "OK") {
+ if ($return['status'] == 'OK') {
// All fine!
$result = true;
// Prepare the request data
$requestData = array(
- 'sub_request' => "send",
+ 'sub_request' => 'send',
't_uid' => getConfig('wernis_refid'),
't_md5' => getConfig('wernis_pass_md5'),
'r_uid' => bigintval($wdsId),
);
// Return the result from the lower functions
- $return = WERNIS_SEND_REQUEST("book.php", $requestData);
+ $return = WERNIS_SEND_REQUEST('book.php', $requestData);
- if ($return['status'] == "OK") {
+ if ($return['status'] == 'OK') {
// All fine!
$result = true;
// Translate the status IN/OUT
function WERNIS_TRANSFER_STATUS ($status) {
// Default status
- $return = sprintf(WERNIS_STATUS_UNKNWOWN, $status);
+ $return = sprintf(getMessage('WERNIS_STATUS_UNKNWOWN'), $status);
switch ($status) {
- case "IN": // Withdraw
- $return = WERNIS_STATUS_WITHDRAW;
+ case 'IN': // Withdraw
+ $return = getMessage('WERNIS_STATUS_WITHDRAW');
break;
- case "OUT": // Payout
- $return = WERNIS_STATUS_PAYOUT;
+ case 'OUT': // Payout
+ $return = getMessage('WERNIS_STATUS_PAYOUT');
break;
- case "FAILED": // Payout
- $return = WERNIS_STATUS_FAILED;
+ case 'FAILED': // Payout
+ $return = getMessage('WERNIS_STATUS_FAILED');
break;
}
}
// Log the transfer
-function WERNIS_LOG_TRANSFER ($wdsId, $amount, $type = 'FAILED', $message = "", $status = "") {
+function WERNIS_LOG_TRANSFER ($wdsId, $amount, $type = 'FAILED', $message = '', $status = '') {
// Register this wernis movement
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_wernis` (`userid`,`wernis_account`,`wernis_amount`,`wernis_timestamp`,`wernis_type`,`wernis_api_message`,`wernis_api_status`) VALUES (%d, %d, %d, UNIX_TIMESTAMP(), '%s', '%s', '%s')",
array(getUserId(), bigintval($wdsId), bigintval($amount), $type, $message, $status), __FUNCTION__, __LINE__);
// Is the array an array? ;-)
if (!is_array($array)) {
// Log error and return
- DEBUG_LOG(__FUNCTION__, __LINE__, " Type ".gettype($array)." != array.");
+ DEBUG_LOG(__FUNCTION__, __LINE__, ' Type '.gettype($array).'!=array.');
return;
} // END - if
// Add both factors
- $array['payout_factor'] = TRANSLATE_COMMA(getConfig('wernis_payout_factor'));
- $array['withdraw_factor'] = TRANSLATE_COMMA(getConfig('wernis_withdraw_factor'));
+ $array['payout_factor'] = translateComma(getConfig('wernis_payout_factor'));
+ $array['withdraw_factor'] = translateComma(getConfig('wernis_withdraw_factor'));
// Add all fees
- $array['payout_fee_percent'] = TRANSLATE_COMMA(getConfig('wernis_payout_fee_percent'));
- $array['withdraw_fee_percent'] = TRANSLATE_COMMA(getConfig('wernis_withdraw_fee_percent'));
- $array['payout_fee_fix'] = TRANSLATE_COMMA(getConfig('wernis_payout_fee_fix'));
- $array['withdraw_fee_fix'] = TRANSLATE_COMMA(getConfig('wernis_withdraw_fee_fix'));
+ $array['payout_fee_percent'] = translateComma(getConfig('wernis_payout_fee_percent'));
+ $array['withdraw_fee_percent'] = translateComma(getConfig('wernis_withdraw_fee_percent'));
+ $array['payout_fee_fix'] = translateComma(getConfig('wernis_payout_fee_fix'));
+ $array['withdraw_fee_fix'] = translateComma(getConfig('wernis_withdraw_fee_fix'));
}
//
);
// Run the query
- $response = GET_URL($requestString);
+ $response = sendGetRequest($requestString);
// Shall we count the query as used?
if ($countQuery) {
// Then update the config!
- UPDATE_CONFIG("yoomedia_requests_remain", 1, "-");
+ updateConfiguration('yoomedia_requests_remain', 1, '-');
} // END - if
} // END - if
$cnt = 0; $entry = 0;
foreach ($dataArray as $line) {
// Add the line
- $result[$entry][YOOMEDIA_TRANSLATE_INDEX($type, $cnt)] = $line;
+ $result[$entry][yoomediaTranslateIndex($type, $cnt)] = $line;
// End of data of first entry reached?
if ($cnt == 6) {
$data['sid'] = getConfig('yoomedia_sid');
// Add total receivers
- $data['all'] = TRANSLATE_COMMA(GET_TOTAL_RECEIVERS());
+ $data['all'] = translateComma(getTotalReceivers());
// Add categories
- $data['categories'] = ADD_CATEGORY_OPTIONS('normal');
+ $data['categories'] = generateCategoryOptionsList('normal');
// Load template
LOAD_TEMPLATE("admin_send_yoomedia", false, $data);
YOOMEDIA_RELOAD_LOCK($data, $mode);
// Call the lower function
- ADD_NEW_BONUS_MAIL($data, $mode);
+ addNewBonusMail($data, $mode);
}
// Lockdown given id
}
// "Translates" the index number into an assosiative value
-function YOOMEDIA_TRANSLATE_INDEX ($type, $index) {
+function yoomediaTranslateIndex ($type, $index) {
// Default is the index
$return = $index;
}
// "Translate" error code
-function YOOMEDIA_TRANSLATE_ERROR ($errorCode) {
+function yoomediaTranslateError ($errorCode) {
// Default is "failed"
$return = "failed";
// Are we ready to sent again?
if (((time() - $time) >= ($reload * 60*60)) && ($time > 0)) {
// Remove entry
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_yoomedia_reload` WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_yoomedia_reload` WHERE `id`=%s LIMIT 1",
array($id), __FUNCTION__, __LINE__);
} else {
// Dont' sent again this mail
// Init & set the INC_POOL
INIT_INC_POOL();
-SET_INC_POOL(GET_DIR_AS_ARRAY('inc/loader/', 'load_cache-'));
+SET_INC_POOL(getArrayFromDirectory('inc/loader/', 'load_cache-'));
// Run the filter
runFilterChain('load_includes');
INIT_FILTER_SYSTEM();
// Load more cache files (like admins)
- LOAD_INC_ONCE('inc/load_cache.php');
+ loadIncludeOnce('inc/load_cache.php');
// Remove array
unset($EXT_POOL);
// If current user is not admin load only activated extensions. But load
// them all if we are going to init the cache files. The admin shall use
// every available extension for testing purposes.
- if ((!IS_ADMIN()) && ($GLOBALS['cache_mode'] != 'init')) $add = " WHERE ext_active='Y'";
+ if ((!IS_ADMIN()) && ($GLOBALS['cache_mode'] != 'init')) $add = " WHERE `ext_active`='Y'";
if (GET_EXT_VERSION('sql_patches') >= '0.0.6') {
// Query with CSS file from DB
- $res_ext_crt = SQL_QUERY('SELECT id AS ext_id, ext_name, ext_has_css AS ext_css, ext_active, ext_version
-FROM `{!_MYSQL_PREFIX!}_extensions`' . $add . '
-ORDER BY ext_name', __FILE__, __LINE__);
+ $res_ext_crt = SQL_QUERY("SELECT id AS ext_id, ext_name, ext_has_css AS ext_css, ext_active, ext_version
+FROM `{!_MYSQL_PREFIX!}_extensions`" . $add . "
+ORDER BY ext_name", __FILE__, __LINE__);
} else {
// Old obsolete query string
- $res_ext_crt = SQL_QUERY('SELECT id AS ext_id, ext_name, ext_name, ext_active, ext_version
-FROM `{!_MYSQL_PREFIX!}_extensions`' . $add . '
-ORDER BY ext_name', __FILE__, __LINE__);
+ $res_ext_crt = SQL_QUERY("SELECT id AS ext_id, ext_name, ext_name, ext_active, ext_version
+FROM `{!_MYSQL_PREFIX!}_extensions`" . $add . "
+ORDER BY ext_name", __FILE__, __LINE__);
}
}
$FQFN = sprintf("%sinc/extensions/ext-%s.php", constant('PATH'), $content['ext_name']);
// Does the extension file exists?
- if (FILE_READABLE($FQFN)) {
+ if (isFileReadable($FQFN)) {
// By default no extension is always active, except sql_patches
EXT_SET_ALWAYS_ACTIVE('N');
// CSS file handling:
if ((!isset($content['ext_css'])) || ($content['ext_css'] == 'Y')) {
// Create FQFN for the CSS file
- $FQFN = sprintf("%stheme/%s/css/%s.css", constant('PATH'), GET_CURR_THEME(), $content['ext_name']);
+ $FQFN = sprintf("%stheme/%s/css/%s.css", constant('PATH'), getCurrentTheme(), $content['ext_name']);
// Is the file there?
- if (FILE_READABLE($FQFN)) {
+ if (isFileReadable($FQFN)) {
// CSS file for extension was found (use only relative path for now!)
EXT_ADD_CSS_FILE($content['ext_name'] . '.css');
$content['ext_css'] = 'Y';
// Remember this value for later usage
$GLOBALS['cache_array']['active_extensions'][$content['ext_name']] = EXT_GET_ALWAYS_ACTIVE();
}
- } elseif (!FILE_READABLE($FQFN)) {
+ } elseif (!isFileReadable($FQFN)) {
// Deleted extension file so we mark it for removal from DB
$DEL[] = $content['ext_name'];
}
$GLOBALS['cache_instance']->finalize();
// Load more cache files (like admins)
- LOAD_INC_ONCE('inc/load_cache.php');
+ loadIncludeOnce('inc/load_cache.php');
} // END - if
// Free memory
// Remove extensions from two tables: extension registry and tasks table
foreach ($DEL as $del_ext) {
// First remove entry from extensions table
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($del_ext), __FILE__, __LINE__);
// Remove (maybe?) found tasks (main task and possible updates
$GLOBALS['cache_instance']->init('revision');
// add the new RevInfos in and saves it to the cache
- $GLOBALS['cache_instance']->addRow(getAkt_vers());
+ $GLOBALS['cache_instance']->addRow(getArrayFromActualVersion());
// Close the cache
$GLOBALS['cache_instance']->finalize();
if ($GLOBALS['output_mode'] == 1) return;
// Create timemark from saved month
-$mark = mktime(0, 0, 0, getConfig('last_month'), date("d", time()), date('Y', time()));
+$mark = mktime(0, 0, 0, getConfig('last_month'), date('d', time()), date('Y', time()));
$sql = ''; $mode = '';
// Shall I sent activation or deactivation mail?
$sql .= ") AND `status`='CONFIRMED' ORDER BY last_online ASC";
// Prepare data for the template
- define('__BEG_MIN_POINTS' , TRANSLATE_COMMA(getConfig('beg_points')));
- define('__BEG_MAX_POINTS' , TRANSLATE_COMMA(getConfig('beg_points_max')));
+ define('__BEG_MIN_POINTS' , translateComma(getConfig('beg_points')));
+ define('__BEG_MAX_POINTS' , translateComma(getConfig('beg_points_max')));
define('__BEG_MAX_WINNERS', round(getConfig('beg_ranks')));
if (getConfig('beg_ip_timeout') == 0)
{
// No IP locking setuped!
- define('__BEG_IP_LOCKER', BEG_NO_LIMITATION);
+ define('__BEG_IP_LOCKER', getMessage('BEG_NO_LIMITATION'));
}
else
{
// Create timemark
- define('__BEG_IP_LOCKER', CREATE_FANCY_TIME(getConfig('beg_ip_timeout')));
+ define('__BEG_IP_LOCKER', createFancyTime(getConfig('beg_ip_timeout')));
}
// Check for accounts to be notified
} else {
// Send normal notification mail to the members
$message = LOAD_EMAIL_TEMPLATE('beg_' . $mode . '_notify', array(), $content['userid']);
- SEND_EMAIL($content['email'], $subject, $message);
+ sendEmail($content['email'], $subject, $message);
}
} // END - while
$URL = 'modules.php?module=index&what=login';
// Insert mail
- ADD_BONUS_MAIL_TO_QUEUE($subject, $message, $RECEIVER, getConfig('beg_notify_bonus'), getConfig('beg_notify_wait'), $URL, 0, 'normal', SQL_NUMROWS($result_main));
+ addBonusMailToQueue($subject, $message, $RECEIVER, getConfig('beg_notify_bonus'), getConfig('beg_notify_wait'), $URL, 0, 'normal', SQL_NUMROWS($result_main));
} // END - if
} // END - if
if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
// Get current day (01 to 31), month (01 to 12) and year (4-digits year)
-$DAY = date("d", time());
-$MONTH = date("m", time());
-$YEAR = date('Y', time());
+$day = date('d', time());
+$month = date('m', time());
+$year = date('Y', time());
// Shall I include only active members?
-$add = "%s"; $VALUE = '';
+$add = "%s"; $value = '';
if ((getConfig('birthday_active')) && (EXT_IS_ACTIVE('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getConfig('ap_inactive_since') > 0)) {
- $add = " AND last_online >= (UNIX_TIMESTAP() - %s)";
- $VALUE = getConfig('ap_inactive_since');
+ $add = " AND `last_online` >= (UNIX_TIMESTAP() - %s)";
+ $value = getConfig('ap_inactive_since');
}
// Only confirmed members shall receive birthday mails...
$result_birthday = SQL_QUERY_ESC("SELECT userid, email, birth_year
FROM `{!_MYSQL_PREFIX!}_user_data`
WHERE `status`='CONFIRMED' AND birth_day=%s AND birth_month=%s AND birthday_sent < (UNIX_TIMESTAMP() - ".(getConfig('one_day') * 364).")".$add."
-ORDER BY userid",
- array($DAY, $MONTH, $VALUE), __FILE__, __LINE__);
+ORDER BY `userid` ASC",
+ array($day, $month, $value), __FILE__, __LINE__);
if (SQL_NUMROWS($result_birthday) > 0) {
// Start sending out birthday mails
while ($content = SQL_FETCHARRAY($result_birthday)) {
// Calculate own timestamp for birthday and today
- $BD = $content['birth_year'] + 12 * $MONTH + 365 * $DAY;
- $NOW = $YEAR + 12 * $MONTH + 365 * $DAY;
+ $bd = $content['birth_year'] + 12 * $month + 365 * $day;
+ $now = $year + 12 * $month + 365 * $day;
// Simply subtract both values and you got the age... :)
- $AGE = $NOW - $BD;
+ $age = $now - $bd;
if (getConfig('birthday_points') > 0) {
// Add more entries to the array
- $content['age'] = $AGE;
- $content['points'] = TRANSLATE_COMMA(getConfig('birthday_points'));
+ $content['age'] = $age;
+ $content['points'] = translateComma(getConfig('birthday_points'));
$content['check'] = '';
// @TODO 4 is hard-coded here, should we move it out in config?
for ($idx = 0; $idx < 4; $idx++) {
- $content['check'] .= generateRandomCodde("8", mt_rand(0, "$MONTH$DAY"), $content['userid'], ($AGE*($idx+1)));
+ $content['check'] .= generateRandomCodde("8", mt_rand(0, $month.$day), $content['userid'], ($age * ($idx + 1)));
}
// Insert row into database
$msg = LOAD_EMAIL_TEMPLATE("member_birthday_confirm", $content, bigintval($content['userid']));
} else {
// Load default email template and fill in the age
- $msg = LOAD_EMAIL_TEMPLATE("member_birthday", $AGE, $content['userid']);
+ $msg = LOAD_EMAIL_TEMPLATE("member_birthday", $age, $content['userid']);
}
// Send email
- SEND_EMAIL($content['email'], getMessage('HAPPY_BIRTHDAY'), $msg);
+ sendEmail($content['email'], getMessage('HAPPY_BIRTHDAY'), $msg);
// Remember him that he has received a birthday mail
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET birthday_sent=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
if ($GLOBALS['output_mode'] == 1) return;
// Create timemark from saved month
-$mark = mktime(0, 0, 0, getConfig('last_month'), date("d", time()), date('Y', time()));
+$mark = mktime(0, 0, 0, getConfig('last_month'), date('d', time()), date('Y', time()));
$sql = ''; $mode = '';
// Shall I sent activation or deactivation mail?
} else {
// Send normal notification mail to the members
$message = LOAD_EMAIL_TEMPLATE('bonus_' . $mode . '_notify', array(), $content['userid']);
- SEND_EMAIL($content['email'], $subject, $message);
+ sendEmail($content['email'], $subject, $message);
}
} // END - while
$URL = 'modules.php?module=index&what=login';
// Insert mail
- ADD_BONUS_MAIL_TO_QUEUE($subject, $message, $RECEIVER, getConfig('bonus_notify_points'), getConfig('bonus_notify_wait'), $URL, 0, 'normal', SQL_NUMROWS($result_main));
+ addBonusMailToQueue($subject, $message, $RECEIVER, getConfig('bonus_notify_points'), getConfig('bonus_notify_wait'), $URL, 0, 'normal', SQL_NUMROWS($result_main));
} // END - if
} // END - if
}
// Load include file
-LOAD_INC_ONCE("inc/modules/admin/admin-inc.php");
+loadIncludeOnce('inc/modules/admin/admin-inc.php');
// Fix "deleted" cookies in PHP4 (PHP5 does remove them, PHP4 sets them to deleted!)
-FIX_DELETED_COOKIES(array('admin_login', 'admin_md5', 'admin_last', 'admin_to'));
+fixDeletedCookies(array('admin_login', 'admin_md5', 'admin_last', 'admin_to'));
// Init return value
-$ret = "init";
+$ret = 'init';
// Is no admin registered?
if (!isAdminRegistered()) {
// Admin is not registered so we have to inform the user
if ((IS_FORM_SENT()) && ((!REQUEST_ISSET_POST(('login'))) || (!REQUEST_ISSET_POST(('pass'))) || (strlen(REQUEST_POST('pass')) < 4))) {
- REQUEST_SET_POST('ok', "***");
+ REQUEST_SET_POST('ok', '***');
}
- if ((IS_FORM_SENT()) && (REQUEST_POST('ok') != "***")) {
+ if ((IS_FORM_SENT()) && (REQUEST_POST('ok') != '***')) {
// Hash the password with the old function because we are here in install mode
$hashedPass = md5(REQUEST_POST('pass'));
$ret = REGISTER_ADMIN(REQUEST_POST('login'), $hashedPass, constant('WEBMASTER'));
switch ($ret)
{
- case "done":
+ case 'done':
$done = changeDataInFile(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
if ($done === true) {
// Registering is done
- LOAD_URL('modules.php?module=admin&register=done');
+ redirectToUrl('modules.php?module=admin&register=done');
} else {
$ret = getMessage('ADMIN_CANNOT_COMPLETE');
}
changeDataInFile(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
// Load URL for login
- LOAD_URL('modules.php?module=admin');
+ redirectToUrl('modules.php?module=admin');
} // END - if
break;
}
// Output reset password form
LOAD_TEMPLATE('admin_send_reset_link');
}
-} elseif ((!isSessionVariableSet('admin_login')) || (!isSessionVariableSet('admin_md5')) || (!isSessionVariableSet('admin_last')) || (!isSessionVariableSet('admin_to')) || ((get_session('admin_last') + bigintval(get_session('admin_to')) * 3600 * 24) < time())) {
+} elseif ((!isSessionVariableSet('admin_login')) || (!isSessionVariableSet('admin_md5')) || (!isSessionVariableSet('admin_last')) || (!isSessionVariableSet('admin_to')) || ((getSession('admin_last') + bigintval(getSession('admin_to')) * 3600 * 24) < time())) {
// At leat one administrator account was created
if ((isSessionVariableSet('admin_login')) && (isSessionVariableSet('admin_md5')) && (isSessionVariableSet('admin_last')) && (isSessionVariableSet('admin_to'))) {
// Timeout for last login, we have to logout first!
- LOAD_URL('modules.php?module=admin&logout=1');
+ redirectToUrl('modules.php?module=admin&logout=1');
} // END - if
if (REQUEST_ISSET_GET(('register'))) {
// Rewrite overview module
if ($GLOBALS['what'] == 'overview') {
- $GLOBALS['action'] = GET_ACTION($GLOBALS['module'], $GLOBALS['what']);
+ $GLOBALS['action'] = getModeAction($GLOBALS['module'], $GLOBALS['what']);
} // END - if
// Add data to URL
elseif (REQUEST_ISSET_GET('area')) $URL .= 'area='.REQUEST_GET('area');
// Load URL
- LOAD_URL($URL);
+ redirectToUrl($URL);
break;
case '404': // Administrator login not found
}
} else {
// Maybe an Admin want's to login?
- $ret = CHECK_ADMIN_COOKIES(get_session('admin_login'), get_session('admin_md5'));
+ $ret = CHECK_ADMIN_COOKIES(getSession('admin_login'), getSession('admin_md5'));
switch ($ret)
{
case 'done':
if (!isConfigEntrySet('admin_menu')) setConfigEntry('admin_menu', 'OLD');
// Check for version and switch between old menu system and new intelligent menu system
- if ((ADMIN_CHECK_MENU_MODE() == 'NEW') && (INCLUDE_READABLE('inc/modules/admin/lasys-inc.php'))) {
+ if ((ADMIN_CHECK_MENU_MODE() == 'NEW') && (isIncludeReadable('inc/modules/admin/lasys-inc.php'))) {
// Default area is the entrance, of course
$area = 'entrance';
if (REQUEST_ISSET_GET('area')) $area = REQUEST_GET('area');
// Load logical-area menu-system file
- LOAD_INC_ONCE('inc/modules/admin/lasys-inc.php');
+ loadIncludeOnce('inc/modules/admin/lasys-inc.php');
// Create new-style menu system will logical areas
ADMIN_LOGICAL_AREA_SYSTEM($area, $act, $GLOBALS['what']);
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (FILE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, ADMIN_404_ACTION_1.$GLOBALS['what'].ADMIN_404_ACTION_2);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
// "what file" not found
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
if (REQUEST_ISSET_POST(('no'))) {
// Do not logout now
- LOAD_URL('admin.php');
+ redirectToUrl('admin.php');
} elseif ((REQUEST_ISSET_POST(('yes'))) && ($GLOBALS['action'] == 'logout')) {
// Redirect to logout link
- LOAD_URL('modules.php?module=admin&logout=1');
+ redirectToUrl('modules.php?module=admin&logout=1');
}
// Load logout form template
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/admin/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_ACTION_404'), $GLOBALS['what']);
}
$ret = "already";
// Lookup the admin
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
array($user), __FUNCTION__, __LINE__);
// Is the entry there?
// Ok, let's create the admin login
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_admins` (login, password, email) VALUES ('%s', '%s', '%s')",
array($user, $md5, $email), __FUNCTION__, __LINE__);
- $ret = "done";
+ $ret = 'done';
} // END - if
// Free memory
$add = runFilterChain('sql_admin_extra_data');
// Get password from DB
- $result = SQL_QUERY_ESC("SELECT password".$add." FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT password".$add." FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
array($aid), __FUNCTION__, __LINE__);
// Entry found?
SQL_FREERESULT($result);
}
- //* DEBUG: */ echo "*".$data['password']."/".md5($password)."/".$ret."<br />";
+ //* DEBUG: */ echo "*".$data['password'].'/'.md5($password).'/'.$ret."<br />";
if ((isset($data['password'])) && (strlen($data['password']) == 32) && ($data['password'] == md5($password))) {
// Generate new hash
$data['password'] = generateHash($password);
// Is the sql_patches not installed, than we cannot have a valid hashed password here!
- if (($ret == 'pass') && ((EXT_VERSION_IS_OLDER('sql_patches', '0.3.6')) || (GET_EXT_VERSION('sql_patches') == ""))) $ret = "done";
- } elseif ((EXT_VERSION_IS_OLDER('sql_patches', '0.3.6')) || (GET_EXT_VERSION('sql_patches') == "")) {
+ if (($ret == 'pass') && ((EXT_VERSION_IS_OLDER('sql_patches', '0.3.6')) || (GET_EXT_VERSION('sql_patches') == ''))) $ret = 'done';
+ } elseif ((EXT_VERSION_IS_OLDER('sql_patches', '0.3.6')) || (GET_EXT_VERSION('sql_patches') == '')) {
// Old hashing way
return $ret;
} elseif (!isset($data['password'])) {
// Remmeber login failures if available
if (GET_EXT_VERSION('admins') >= '0.7.2') {
// Store it in session
- set_session('mxchange_admin_failures', $data['login_failures']);
- set_session('mxchange_admin_last_fail', $data['last_failure']);
+ setSession('mxchange_admin_failures', $data['login_failures']);
+ setSession('mxchange_admin_last_fail', $data['last_failure']);
// Update password and reset login failures
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET password='%s',login_failures=0,last_failure='0000-00-00 00:00:00' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET password='%s',login_failures=0,last_failure='0000-00-00 00:00:00' WHERE `id`=%s LIMIT 1",
array($data['password'], $aid), __FUNCTION__, __LINE__);
} else {
// Update password
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET password='%s' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET password='%s' WHERE `id`=%s LIMIT 1",
array($data['password'], $aid), __FUNCTION__, __LINE__);
}
// Password matches so login here
if (LOGIN_ADMIN($admin_login, $data['password'])) {
// All done now
- $ret = "done";
+ $ret = 'done';
} // END - if
} elseif ((empty($salt)) && ($ret == 'pass')) {
// Something bad went wrong
$ret = "failed";
- } elseif ($ret == "done") {
+ } elseif ($ret == 'done') {
// Try to login here if we have the old hashing way (sql_patches not installed?)
if (!LOGIN_ADMIN($admin_login, $data['password'])) {
// Something went wrong
// Count login failure if admins extension version is 0.7.0+
if (($ret == 'pass') && (GET_EXT_VERSION('admins') >= '0.7.0')) {
// Update counter
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET login_failures=login_failures+1,last_failure=NOW() WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET login_failures=login_failures+1,last_failure=NOW() WHERE `id`=%s LIMIT 1",
array($aid), __FUNCTION__, __LINE__);
// Rebuild cache
// Try to login the admin by setting some session/cookie variables
function LOGIN_ADMIN ($adminLogin, $passHash) {
// Reset failure counter on matching admins version
- if ((GET_EXT_VERSION('admins') >= '0.7.0') && ((EXT_VERSION_IS_OLDER('sql_patches', '0.3.6')) || (GET_EXT_VERSION('sql_patches') == ""))) {
+ if ((GET_EXT_VERSION('admins') >= '0.7.0') && ((EXT_VERSION_IS_OLDER('sql_patches', '0.3.6')) || (GET_EXT_VERSION('sql_patches') == ''))) {
// Reset counter on out-dated sql_patches version
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET login_failures=0,last_failure='0000-00-00 00:00:00' WHERE login='%s' LIMIT 1",
array($adminLogin), __FUNCTION__, __LINE__);
// Now set all session variables and return the result
return (
(
- set_session('admin_md5', generatePassString($passHash))
+ setSession('admin_md5', generatePassString($passHash))
) && (
- set_session('admin_login', $adminLogin)
+ setSession('admin_login', $adminLogin)
) && (
- set_session('admin_last', time())
+ setSession('admin_last', time())
) && (
- set_session('admin_to', bigintval(REQUEST_POST('timeout')))
+ setSession('admin_to', bigintval(REQUEST_POST('timeout')))
)
);
}
// Check if password matches
if (($ret == 'pass') && ((generatePassString($pass) == $password) || ($pass == $password) || ((strlen($pass) == 32) && (md5($password) == $pass)))) {
// Passwords matches!
- $ret = "done";
+ $ret = 'done';
}
// Return result
//
function ADMIN_DO_ACTION ($wht) {
global $DATA;
- //* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*<br />\n";
+ //* DEBUG: */ echo __LINE__."*".$wht.'/'.$GLOBALS['module'].'/'.$GLOBALS['action'].'/'.$GLOBALS['what']."*<br />\n";
// Remove any spaces from variable
if (empty($wht)) {
}
// Get action value
- $act = GET_ACTION($GLOBALS['module'], $wht);
+ $act = getModeAction($GLOBALS['module'], $wht);
// Define admin login name and ID number
- define('__ADMIN_LOGIN', get_session('admin_login'));
- define('__ADMIN_ID' , GET_CURRENT_ADMIN_ID());
+ define('__ADMIN_LOGIN', getSession('admin_login'));
+ define('__ADMIN_ID' , getCurrentAdminId());
// Preload templates
if (EXT_IS_ACTIVE('admins')) {
LOAD_TEMPLATE("admin_main_header");
// Check if action/what pair is valid
- $result_action = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu`
+ $result_action = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admin_menu`
WHERE `action`='%s' AND ((`what`='%s' AND what != 'overview') OR ((`what`='' OR `what` IS NULL) AND '%s'='overview'))
LIMIT 1", array($act, $wht, $wht), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result_action) == 1) {
// Is valid but does the inlcude file exists?
$INC = sprintf("inc/modules/admin/action-%s.php", $act);
- if ((INCLUDE_READABLE($INC)) && (VALIDATE_MENU_ACTION('admin', $act, $wht)) && ($GLOBALS['acl_allow'] === true)) {
+ if ((isIncludeReadable($INC)) && (isMenuActionValid('admin', $act, $wht)) && ($GLOBALS['acl_allow'] === true)) {
// Ok, we finally load the admin action module
- LOAD_INC($INC);
+ loadInclude($INC);
} elseif ($GLOBALS['acl_allow'] === false) {
// Access denied
LOAD_TEMPLATE("admin_menu_failed", false, getMessage('ADMIN_ACCESS_DENIED'));
}
} else {
// Invalid action/what pair found!
- LOAD_TEMPLATE("admin_menu_failed", false, sprintf(getMessage('ADMIN_ACTION_INVALID'), $act."/".$wht));
- addFatalMessage(__FUNCTION__, __LINE__, getMessage('ADMIN_ACTION_INVALID'), $act."/".$wht);
+ LOAD_TEMPLATE("admin_menu_failed", false, sprintf(getMessage('ADMIN_ACTION_INVALID'), $act.'/'.$wht));
+ addFatalMessage(__FUNCTION__, __LINE__, getMessage('ADMIN_ACTION_INVALID'), $act.'/'.$wht);
}
// Free memory
// Is there a cache instance?
if ((isCacheInstanceValid()) && (getConfig('cache_admin_menu') == 'Y')) {
// Create cache name
- $cacheName = "admin_".$act."_".$wht."_".GET_LANGUAGE()."_".strtolower(get_session('admin_login'));
+ $cacheName = "admin_".$act."_".$wht."_".getLanguage()."_".strtolower(getSession('admin_login'));
// Is that cache there?
if ($GLOBALS['cache_instance']->loadCacheFile($cacheName)) {
// @TODO Rewrite this to $content = SQL_FETCHARRAY()
while (list($menu, $title, $descr) = SQL_FETCHROW($result_main)) {
if ((EXT_IS_ACTIVE('admins')) && (GET_EXT_VERSION('admins') > '0.2.0')) {
- $ACL = ADMINS_CHECK_ACL($menu, '');
+ $ACL = adminsCheckAdminAcl($menu, '');
} else {
// ACL is "allow"... hmmm
$ACL = true;
$OUT .= "<ul class=\"admin_menu_sub\">\n";
// @TODO Rewrite this to $content = SQL_FETCHARRAY()
while (list($wht_sub, $title_what, $desc_what) = SQL_FETCHROW($result_what)) {
- // Filename
- $INC = sprintf("inc/modules/admin/what-%s.php", $wht_sub);
+ // Check for access level
if ((EXT_IS_ACTIVE('admins')) && (GET_EXT_VERSION('admins') > '0.2.0')) {
- $ACL = ADMINS_CHECK_ACL("", $wht_sub);
+ $ACL = adminsCheckAdminAcl('', $wht_sub);
} else {
// ACL is "allow"... hmmm
$ACL = true;
}
+ // Filename
+ $INC = sprintf("inc/modules/admin/what-%s.php", $wht_sub);
+
// Is the file readable?
- $readable = INCLUDE_READABLE($INC);
+ $readable = isIncludeReadable($INC);
// Access allowed?
if ($ACL === true) {
}
// Create member selection box
-function ADD_MEMBER_SELECTION_BOX ($def="0", $add_all=false, $return=false, $none=false, $field='userid') {
+function ADD_MEMBER_SELECTION_BOX ($def='0', $add_all=false, $return=false, $none=false, $field='userid') {
// Output selection form with all confirmed user accounts listed
- $result = SQL_QUERY("SELECT userid, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` ORDER BY userid", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY("SELECT userid, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` ORDER BY `userid` ASC", __FUNCTION__, __LINE__);
// Default output
$OUT = '';
define('_MEMBER_SELECTION', $OUT);
// Display selection box
- define('__LANG_VALUE', GET_LANGUAGE());
+ define('__LANG_VALUE', getLanguage());
// Load template
LOAD_TEMPLATE("admin_member_selection_box", false, $GLOBALS['what']);
}
// Create a menu selection box for given menu system
-function ADMIN_MENU_SELECTION ($mode, $default="", $defid="") {
+function ADMIN_MENU_SELECTION ($mode, $default = '', $defid = '') {
$wht = "`what` != ''";
if ($mode == "action") $wht = "(`what`='' OR `what` IS NULL) AND action !='login'";
$result = SQL_QUERY_ESC("SELECT %s, title FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE ".$wht." ORDER BY `sort`",
if (SQL_NUMROWS($result) > 0) {
// Load menu as selection
$OUT = "<select name=\"".$mode."_menu";
- if ((!empty($defid)) || ($defid == "0")) $OUT .= "[".$defid."]";
+ if ((!empty($defid)) || ($defid == '0')) $OUT .= "[".$defid."]";
$OUT .= "\" size=\"1\" class=\"admin_select\">
<option value=\"\">{--SELECT_NONE--}</option>\n";
// @TODO Try to rewrite this to $content = SQL_FETCHARRAY(). Please look some lines above for the dynamic query
// Process only formular field but not submit buttons ;)
if ($id != "ok") {
// Do not save the ok value
- CONVERT_SELECTIONS_TO_TIMESTAMP($POST, $DATA, $id, $skip);
+ convertSelectionsToTimestamp($POST, $DATA, $id, $skip);
// Shall we process this ID? It muss not be empty, of course
if ((!$skip) && (!empty($id))) {
// Translate the value? (comma to dot!)
if ((is_array($translateComma)) && (in_array($id, $translateComma))) {
// Then do it here... :)
- $val = REVERT_COMMA($val);
+ $val = convertCommaToDot($val);
} // END - if
// Shall we add numbers or strings?
$test = (float)$val;
- if ("".$val."" == "".$test."") {
+ if ("".$val."" == ''.$test."") {
// Add numbers
$DATA[] = sprintf("`%s`=%s", $id, $test);
} else {
);
} else {
// Add Line (does only work with auto_increment!
- $KEYs = array(); $VALUEs = array();
+ $KEYs = array(); $values = array();
foreach ($DATA as $entry) {
// Split up
- $line = explode("=", $entry);
- $KEYs[] = $line[0]; $VALUEs[] = $line[1];
+ $line = explode('=', $entry);
+ $KEYs[] = $line[0]; $values[] = $line[1];
} // END - foreach
// Add both in one line
$KEYs = implode(", ", $KEYs);
- $VALUEs = implode(", ", $VALUEs);
+ $values = implode(", ", $values);
// Generate SQL string
$sql = sprintf("INSERT INTO {!_MYSQL_PREFIX!}%s (%s) VALUES (%s)",
$tableName,
$KEYs,
- $VALUEs
+ $values
);
}
}
// Generate a selection box
-function ADMIN_MAKE_MENU_SELECTION ($menu, $type, $name, $default="") {
+function ADMIN_MAKE_MENU_SELECTION ($menu, $type, $name, $default = '') {
// Open the requested menu directory
- $menuArray = GET_DIR_AS_ARRAY(sprintf("inc/modules/%s/", $menu), '', false, false);
+ $menuArray = getArrayFromDirectory(sprintf("inc/modules/%s/", $menu), '', false, false);
// Init the selection box
$OUT = "<select name=\"".$name."\" class=\"admin_select\" size=\"1\">
// Walk through all files
foreach ($menuArray as $file) {
// Is this a PHP script?
- if (($file != ".") && ($file != "..") && ($file != "lost+found") && (strpos($file, "".$type."-") > -1) && (strpos($file, ".php") > 0)) {
+ if ((!isDirectory($file)) && (strpos($file, "".$type.'-') > -1) && (strpos($file, ".php") > 0)) {
// Then test if the file is readable
$test = sprintf("%sinc/modules/%s/%s", constant('PATH'), $menu, $file);
// Is the file there?
- if (FILE_READABLE($test)) {
+ if (isFileReadable($test)) {
// Extract the value for what=xxx
$part = substr($file, (strlen($type) + 1));
$part = substr($part, 0, -4);
}
// Creates a user-profile link for the admin. This function can also be used for many other purposes
-function ADMIN_USER_PROFILE_LINK ($uid, $title="", $wht="list_user") {
- if (($title == "") && ($title != "0")) {
+function generateUserProfileLink ($uid, $title = '', $wht="list_user") {
+ if (($title == '') && ($title != '0')) {
// Set userid as title
$title = $uid;
} // END - if
- if (($title == "0") && ($wht == "list_refs")) {
+ if (($title == '0') && ($wht == "list_refs")) {
// Return title again
return $title;
} // END - if
$ADMIN = $mode;
// Get admin id
- $aid = GET_CURRENT_ADMIN_ID();
+ $aid = getCurrentAdminId();
// Check individual settings of current admin
if (isset($GLOBALS['cache_array']['admins']['la_mode'][$aid])) {
incrementConfigEntry('cache_hits');
} elseif (GET_EXT_VERSION('admins') >= '0.6.7') {
// Load from database when version of 'admins' is enough
- $result = SQL_QUERY_ESC("SELECT la_mode FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT la_mode FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
array($aid), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load data
// Change activation status
function ADMIN_CHANGE_ACTIVATION_STATUS ($IDs, $table, $row, $idRow = "id") {
- $cnt = 0; $newStatus = "Y";
+ $cnt = 0; $newStatus = 'Y';
if ((is_array($IDs)) && (count($IDs) > 0)) {
// "Walk" all through and count them
foreach ($IDs as $id => $selected) {
list($currStatus) = SQL_FETCHROW($result);
// And switch it N<->Y
- if ($currStatus == 'Y') $newStatus = "N"; else $newStatus = "Y";
+ if ($currStatus == 'Y') $newStatus = 'N'; else $newStatus = 'Y';
// Change this status
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_%s` SET %s='%s' WHERE %s=%s LIMIT 1",
}
// Send mails for del/edit/lock build modes
-function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="") {
+function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart = '') {
// Default subject is the subject part
$subject = $subjectPart;
}
// Send email out
- SEND_EMAIL(REQUEST_POST('uid_raw', $id), $subjectLine, $mail);
+ sendEmail(REQUEST_POST('uid_raw', $id), $subjectLine, $mail);
} // END - if
// Generate subject
// Send admin notification out
if (!empty($subjectPart)) {
- SEND_ADMIN_NOTIFICATION($subjectLine, "admin_".$mode."_".strtolower($subjectPart)."_".$table, $content, REQUEST_POST('uid_raw', $id));
+ sendAdminNotification($subjectLine, "admin_".$mode."_".strtolower($subjectPart)."_".$table, $content, REQUEST_POST('uid_raw', $id));
} else {
- SEND_ADMIN_NOTIFICATION($subjectLine, "admin_".$mode."_".$table, $content, REQUEST_POST('uid_raw', $id));
+ sendAdminNotification($subjectLine, "admin_".$mode."_".$table, $content, REQUEST_POST('uid_raw', $id));
}
}
} // END - if
// Handle the call in external function
- $content[$key] = HANDLE_EXTRA_VALUES($filterFunctions[$idx], $value, $extraValues[$idx]);
+ $content[$key] = handleExtraValues($filterFunctions[$idx], $value, $extraValues[$idx]);
} // END - foreach
// Add color switching
SQL_FREERESULT($result);
// Send "build mails" out
- ADMIN_SEND_BUILD_MAILS("del", $table, $content, $id);
+ ADMIN_SEND_BUILD_MAILS('del', $table, $content, $id);
} // END - if
// Add id number
}
} else {
// List for deletion confirmation
- ADMIN_BUILD_LIST("del", $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
+ ADMIN_BUILD_LIST('del', $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
}
} // END - if
}
// Send data through the filter function if found
if ((isset($filterFunctions[$key])) && (isset($extraValues[$key]))) {
// Filter function set!
- $entries[$id] = HANDLE_EXTRA_VALUES($filterFunctions[$key], $entries[$id], $extraValues[$key]);
+ $entries[$id] = handleExtraValues($filterFunctions[$key], $entries[$id], $extraValues[$key]);
} // END - if
// Then add this value
} // END - foreach
// Finish SQL command
- $sql = substr($sql, 0, -1) . " WHERE ".$idColumn."=".bigintval($id)." LIMIT 1";
+ $sql = substr($sql, 0, -1) . " WHERE `".$idColumn."`=".bigintval($id)." LIMIT 1";
// Run this query
SQL_QUERY($sql, __FUNCTION__, __LINE__);
$affected += SQL_AFFECTEDROWS();
// Load all data from that id
- $result = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_%s` WHERE %s=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_%s` WHERE `%s`=%s LIMIT 1",
array($table, $idColumn, $id), __FUNCTION__, __LINE__);
// Fetch the data
SQL_FREERESULT($result);
// Send "build mails" out
- ADMIN_SEND_BUILD_MAILS("edit", $table, $content, $id);
+ ADMIN_SEND_BUILD_MAILS('edit', $table, $content, $id);
} // END - foreach
// Was this fine?
}
} else {
// List for editing
- ADMIN_BUILD_LIST("edit", $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
+ ADMIN_BUILD_LIST('edit', $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
}
} // END - if
}
mergeConfig($settingsArray);
// Now get the test URL
- $content = GET_URL("check-updates3.php");
+ $content = sendGetRequest('check-updates3.php');
// Is the first line with "200 OK"?
- $valid = eregi("200 OK", $content[0]);
+ $valid = (strpos($content[0], '200 OK') !== false);
// Return result
return $valid;
SQL_FREERESULT($result);
// Generate hash for reset link
- $content['hash'] = generateHash(URL.":".$content['id'].":".$content['login'].":".$content['password'], substr($content['password'], 10));
+ $content['hash'] = generateHash(URL.':'.$content['id'].':'.$content['login'].':'.$content['password'], substr($content['password'], 10));
// Remove some data
unset($content['id']);
$mailText = LOAD_EMAIL_TEMPLATE("admin_reset_password", $content);
// Send it out
- SEND_EMAIL($email, getMessage('ADMIN_RESET_PASS_LINK_SUBJ'), $mailText);
+ sendEmail($email, getMessage('ADMIN_RESET_PASS_LINK_SUBJ'), $mailText);
// Prepare output
return getMessage('ADMIN_RESET_LINK_SENT');
$content = SQL_FETCHARRAY($result);
// Generate hash again
- $hashFromData = generateHash(URL.":".$content['id'].":".$login.":".$content['password'], substr($content['password'], 10));
+ $hashFromData = generateHash(URL.':'.$content['id'].':'.$login.':'.$content['password'], substr($content['password'], 10));
// Does both match?
$valid = ($hash == $hashFromData);
// Solves a task by given id number
function ADMIN_SOLVE_TASK ($id) {
// Update the task data
- ADMIN_UPDATE_TASK_DATA($id, "status", "SOLVED");
+ ADMIN_UPDATE_TASK_DATA($id, 'status', "SOLVED");
}
// Marks a given task as deleted
function ADMIN_DELETE_TASK ($id) {
// Update the task data
- ADMIN_UPDATE_TASK_DATA($id, "status", "DELETED");
+ ADMIN_UPDATE_TASK_DATA($id, 'status', "DELETED");
}
// Function to update task data
} // END - if
// Update the task
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET %s='%s' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET %s='%s' WHERE `id`=%s LIMIT 1",
array($row, $data, bigintval($id)), __FUNCTION__, __LINE__);
}
function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) {
// First check for solved and not assigned tasks and assign them to current admin
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET assigned_admin='%s' WHERE assigned_admin < 1 AND status != 'NEW'",
- array(GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET `assigned_admin`=%s WHERE assigned_admin < 1 AND status != 'NEW'",
+ array(getCurrentAdminId()), __FILE__, __LINE__);
// We currently don't want to install an extension so let's find out if we need...
$EXT_LOAD_MODE = 'register';
$jobsDone = true;
// Open the extension directory
- $extensionList = GET_DIR_AS_ARRAY("inc/extensions/", "ext-", false, false);
+ $extensionList = getArrayFromDirectory("inc/extensions/", "ext-", false, false);
foreach ($extensionList as $file) {
// Is this file an extension?
if ((substr($file, 0, 4) == "ext-") && (substr($file, -4) == ".php")) {
// We maybe want to install an extension so let's test-drive it...
if (LOAD_EXTENSION($ext_name, $EXT_LOAD_MODE)) {
// Create a task for newly installed extension
- CREATE_NEW_EXTENSION_TASK(GET_CURRENT_ADMIN_ID(), $ext_subj, $ext_name);
+ CREATE_NEW_EXTENSION_TASK(getCurrentAdminId(), $ext_subj, $ext_name);
} // END - if
} else {
// Test-drive extension in update mode
} // END - foreach
// At last - but not least - check for own and new unassigned tasks...
- $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created
+ $result_tasks = SQL_QUERY_ESC("SELECT `id`, `assigned_admin`, `userid`, `task_type`, `subject`, `text`, `task_created`
FROM `{!_MYSQL_PREFIX!}_task_system`
-WHERE assigned_admin='%s' OR (assigned_admin='0' AND `status`='NEW')
-ORDER BY userid DESC, task_type DESC, subject, task_created DESC",
- array(GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
+WHERE `assigned_admin`=%s OR (`assigned_admin`=0 AND `status`='NEW')
+ORDER BY `userid` DESC, `task_type` DESC, `subject` ASC, `task_created` DESC",
+ array(getCurrentAdminId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result_tasks) > 0) {
// New jobs found!
// Assign / do tasks
$OUT = ''; $SW = 2;
foreach ($POST['task'] as $id => $sel) {
- $result_task = SQL_QUERY_ESC("SELECT id, userid, task_type, subject, text, task_created, status, assigned_admin FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s AND (assigned_admin='%s' OR (assigned_admin='0' AND `status`='NEW')) LIMIT 1",
- array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
+ $result_task = SQL_QUERY_ESC("SELECT `id`, `userid`, `task_type`, `subject`, `text`, `task_created`, `status`, `assigned_admin`
+FROM `{!_MYSQL_PREFIX!}_task_system`
+WHERE `id`=%s AND (`assigned_admin`=%s OR (`assigned_admin`=0 AND `status`='NEW'))
+LIMIT 1",
+ array(bigintval($id), getCurrentAdminId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result_task) == 1) {
// Task is valid...
list($tid, $uid, $type, $subj, $text, $created, $status, $aid) = SQL_FETCHROW($result_task);
SQL_FREERESULT($result_task);
- if ($aid == "0") {
+ if ($aid == '0') {
// Assgin current admin to unassgigned task
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET assigned_admin='%s' WHERE id=%s LIMIT 1",
- array(GET_CURRENT_ADMIN_ID(), bigintval($tid)), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET `assigned_admin`=%s WHERE `id`=%s LIMIT 1",
+ array(getCurrentAdminId(), bigintval($tid)), __FILE__, __LINE__);
} // END - if
$add = '';
- if ($type == "SUPPORT_MEMBER") {
- $mode = substr($text, 0, strpos($text, ":"));
- $text = substr($text, strpos($text, ":") + 1);
+ // @TODO Rewrite this to a filter
+ if ($type == 'SUPPORT_MEMBER') {
+ $mode = substr($text, 0, strpos($text, ':'));
+ $text = substr($text, strpos($text, ':') + 1);
$add = "<li>{--ADMIN_TASK_SUPPORT_MODE--}: <strong>".$mode."</strong></li>";
} // END - if
if (SQL_NUMROWS($result_user) == 1) {
list($gender, $sname, $fname, $email) = SQL_FETCHROW($result_user);
SQL_FREERESULT($result_user);
- $add = "<li>{--ADMIN_MEMBER_UID--}: <strong>".ADMIN_USER_PROFILE_LINK($uid)." (<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".TRANSLATE_GENDER($gender)." ".$sname." ".$fname."</a>)</strong></li>";
+ $add = "<li>{--ADMIN_MEMBER_UID--}: <strong>".generateUserProfileLink($uid)." (<a href=\"".generateMemberEmailLink($email, "user_data")."\">".translateGender($gender)." ".$sname." ".$fname."</a>)</strong></li>";
} // END - if
} // END - if
$text = decodeEntities($text);
// Compile and insert text from task into table template
- $text = LOAD_TEMPLATE("admin_extensions_text", true, $text);
+ $text = LOAD_TEMPLATE('admin_extensions_text', true, $text);
// Initialize variables (no title for SQL commands by default)
$ext_name = '';
// Shall I list SQL commands assigned to an extension installation or update task?
if (((GET_EXT_VERSION('sql_patches') != '') && (getConfig('verbose_sql') == 'Y')) || (!EXT_IS_ACTIVE('sql_patches'))) {
- $ext_name = substr($subj, 1, strpos($subj, ":") - 1);
- if ($type == "EXTENSION") {
+ $ext_name = substr($subj, 1, strpos($subj, ':') - 1);
+ if ($type == 'EXTENSION') {
// Load SQL commands for registering
REGISTER_EXTENSION($ext_name, $id, true);
// Set title
$title = getMessage('ADMIN_SQLS_EXECUTED_ON_REGISTER');
- } elseif ($type == "EXTENSION_UPDATE") {
+ } elseif ($type == 'EXTENSION_UPDATE') {
// Prepare extension name and version
$ext_name = substr($ext_name, 7);
- $ext_name = substr($ext_name, 0, strpos($ext_name, "-"));
- $test = "[UPDATE-".$ext_name."-";
+ $ext_name = substr($ext_name, 0, strpos($ext_name, '-'));
+ $test = '[UPDATE-'.$ext_name.'-';
$ext_ver = substr($subj, strlen($test));
- $ext_ver = substr($ext_ver, 0, strpos($ext_ver, ":"));
+ $ext_ver = substr($ext_ver, 0, strpos($ext_ver, ':'));
// Load SQLs from file
EXTENSION_UPDATE($ext_name, $ext_ver, true);
'subj' => $subj,
'add' => $add,
'text' => $text,
- 'created' => MAKE_DATETIME($created, "1"),
+ 'created' => generateDateTime($created, '1'),
'extension' => $ext_name
);
// Load template
- $OUT .= LOAD_TEMPLATE("admin_overview_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_overview_row', true, $content);
// Which task do we actually have here?
// @TODO Rewrite this to something with include files
switch ($type)
{
- case "EXTENSION": // Install new extensions
- $ext_name = substr($subj, 1, strpos($subj, ":") - 1);
- $result_lines = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
+ case 'EXTENSION': // Install new extensions
+ $ext_name = substr($subj, 1, strpos($subj, ':') - 1);
+ $result_lines = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FILE__, __LINE__);
$lines = SQL_NUMROWS($result_lines);
SQL_FREERESULT($result_lines);
- if ($lines == "0") {
+ if ($lines == '0') {
// New extension found
- $OUT .= LOAD_TEMPLATE("admin_ext_reg_form", true, array(
+ $OUT .= LOAD_TEMPLATE('admin_ext_reg_form', true, array(
'id' => bigintval($id),
'ext_name' => $ext_name
));
$OUT .= "<div class=\"admin_failed\">{--ADMIN_EXT_ALREADY_REGISTERED--}</div>\n";
// Close task but not already closes or deleted or update tasks
- if (($status != "CLOSED") && ($status != "DELETED") && ($type != "EXTENSION_UPDATE")) {
+ if (($status != 'CLOSED') && ($status != 'DELETED') && ($type != 'EXTENSION_UPDATE')) {
// Solve the task
runFilterChain('solve_task', $tid);
} // END - if
}
break;
- case "EXTENSION_UPDATE": // Extension update
+ case 'EXTENSION_UPDATE': // Extension update
// Extension updates are installed automatically
$OUT .= "<div class=\"admin_failed medium\">{--ADMIN_EXTENSION_UPDATED--}</div>\n";
// Close task
- if (($status != "CLOSED") && ($status != "DELETED")) {
+ if (($status != 'CLOSED') && ($status != 'DELETED')) {
// Solve the task
runFilterChain('solve_task', $tid);
} // END - if
break;
- case "SUPPORT_MEMBER": // Assign on member's support request
+ case 'SUPPORT_MEMBER': // Assign on member's support request
// @TODO This may also be rewritten to include files
switch ($mode)
{
}
break;
- case "PAYOUT_REQUEST": // Payout requests
+ case 'PAYOUT_REQUEST': // Payout requests
if (EXT_IS_ACTIVE('payout')) {
// Extension is installed so let him send a notification to the user
- $result_pay = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE userid=%s AND payout_timestamp=%s LIMIT 1",
+ $result_pay = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE userid=%s AND payout_timestamp=%s LIMIT 1",
array(bigintval($uid), bigintval($created)), __FILE__, __LINE__);
list($pid) = SQL_FETCHROW($result_pay);
SQL_FREERESULT($result_pay);
'pid' => $pid,
'tid' => $tid,
);
- $OUT .= LOAD_TEMPLATE("admin_payout_overview_form", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_payout_overview_form', true, $content);
} else {
// Problem obtaining payout ID
- $OUT .= "<div class=\"admin_failed medium\">".PAYOUT_OBTAIN_ID_FAILED."</div>\n";
+ $OUT .= "<div class=\"admin_failed medium\">{--PAYOUT_OBTAIN_ID_FAILED--}</div>\n";
}
} else {
// Extension is not installed
}
break;
- case "WERNIS_REQUEST": // Wernis requests
+ case 'WERNIS_REQUEST': // Wernis requests
if (EXT_IS_ACTIVE('wernis')) {
// Extension is installed so let him send a notification to the user
- $result_pay = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_wernis` WHERE userid=%s AND wernis_timestamp=%s LIMIT 1",
+ $result_pay = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_wernis` WHERE userid=%s AND wernis_timestamp=%s LIMIT 1",
array(bigintval($uid), bigintval($created)), __FILE__, __LINE__);
list($pid) = SQL_FETCHROW($result_pay);
SQL_FREERESULT($result_pay);
'pid' => $pid,
'tid' => $tid,
);
- $OUT .= LOAD_TEMPLATE("admin_wernis_overview_form", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_wernis_overview_form', true, $content);
} else {
// Problem obtaining wernis ID
$OUT .= "<div class=\"admin_failed medium\">{--WERNIS_OBTAIN_ID_FAILED--}</div>\n";
}
break;
- case "HOLIDAY_REQUEST": // Holiday requests
- $OUT .= LOAD_TEMPLATE("admin_task_holiday", true, $uid);
+ case 'HOLIDAY_REQUEST': // Holiday requests
+ $OUT .= LOAD_TEMPLATE('admin_task_holiday', true, $uid);
break;
- case "NL_UNSUBSCRIBE": // Newsletter unsubscriptions
+ case 'NL_UNSUBSCRIBE': // Newsletter unsubscriptions
$result = SQL_QUERY_ESC("SELECT nl_timespan FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
array(bigintval($uid)), __FILE__, __LINE__);
list($span) = SQL_FETCHROW($result);
'uid' => $uid,
'id' => $tid
);
- $OUT .= LOAD_TEMPLATE("admin_newsletter_tsk", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_newsletter_tsk', true, $content);
} else {
// Already unsubscribed
$OUT .= "<div class=\"admin_failed medium\">".ADMIN_NL_UNSUBSCRIBE_ALREADY."</div>\n";
define('__TASK_ROWS', $OUT);
// Load final template
- LOAD_TEMPLATE("admin_overview_list");
+ LOAD_TEMPLATE('admin_overview_list');
} else {
- if ((isset($POST['task'])) && ((count($POST['task']) > 0) || ($POST['task'][0] == "1"))) {
+ if ((isset($POST['task'])) && ((count($POST['task']) > 0) || ($POST['task'][0] == '1'))) {
// Only unassign / delete tasks when there are selected tasks posted
if (!empty($POST['unassign'])) {
// Unassign from tasks
foreach ($POST['task'] as $id => $sel) {
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET assigned_admin=0 WHERE id=%s AND assigned_admin=%s LIMIT 1",
- array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET `assigned_admin`=0 WHERE `id`=%s AND `assigned_admin`=%s LIMIT 1",
+ array(bigintval($id), getCurrentAdminId()), __FILE__, __LINE__);
}
} elseif (isset($POST['del'])) {
// Delete tasks
foreach ($POST['task'] as $id => $sel) {
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s AND assigned_admin IN (%s,0) LIMIT 1",
- array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `id`=%s AND assigned_admin IN (%s,0) LIMIT 1",
+ array(bigintval($id), getCurrentAdminId()), __FILE__, __LINE__);
}
}
// Update query
- $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created FROM `{!_MYSQL_PREFIX!}_task_system` WHERE assigned_admin=%s OR (assigned_admin=0 AND `status`='NEW') ORDER BY task_created DESC",
- array(GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
+ $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `assigned_admin`=%s OR (`assigned_admin`=0 AND `status`='NEW') ORDER BY task_created DESC",
+ array(getCurrentAdminId()), __FILE__, __LINE__);
} // END - if
// There are uncompleted jobs!
$content['infos'] = '---';
// Generate assign link
- $content['assigned_admin'] = GENERATE_AID_LINK($content['assigned_admin']);
+ $content['assigned_admin'] = generateAdminLink($content['assigned_admin']);
// Generate infos
switch ($content['task_type'])
{
- case "EXTENSION":
- case "EXTENSION_UPDATE":
- $content['infos'] = substr($content['subject'], 1, strpos($content['subject'], ":") - 1);
+ case 'EXTENSION':
+ case 'EXTENSION_UPDATE':
+ $content['infos'] = substr($content['subject'], 1, strpos($content['subject'], ':') - 1);
break;
}
if ($content['userid'] > 0) {
// Member found otherwise it's a system task
- $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
+ $content['userid'] = generateUserProfileLink($content['userid']);
} else {
$content['userid'] = "<em>{--ADMIN_IS_SYSTEM_TASK--}</em>";
}
'admin' => $content['assigned_admin'],
'uid' => $content['userid'],
'type' => $content['task_type_msg'],
- 'created' => MAKE_DATETIME($content['task_created'], "2")
+ 'created' => generateDateTime($content['task_created'], "2")
));
// Do we have extension task?
- if (($content['task_type'] == "EXTENSION") && (GET_EXT_VERSION($content['infos']) == "")) {
+ if (($content['task_type'] == 'EXTENSION') && (GET_EXT_VERSION($content['infos']) == '')) {
// Load extension row template
$OUT .= LOAD_TEMPLATE("admin_overview_list_ext_rows", true, $content);
} else {
define('__POINTS_VALUE', REQUEST_POST('points'));
// Select all users
- $result_main = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY userid",
+ $result_main = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY `userid` ASC",
__FILE__, __LINE__);
// Process all entries
$GLOBALS['ref_level'] = -1;
// Ok, add points and send an email to him...
- ADD_POINTS_REFSYSTEM("admin_all", $content['userid'], bigintval(REQUEST_POST('points')), false, "0", false, "direct");
+ ADD_POINTS_REFSYSTEM_DIRECT('admin_all', $content['userid'], bigintval(REQUEST_POST('points')));
// Prepare content
$content['text'] = SQL_ESCAPE(REQUEST_POST('reason'));
// Load email template and send email away
$msg = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval($content['userid']));
- SEND_EMAIL(bigintval($content['userid']), getMessage('ADMIN_ADD_SUBJ'), $msg);
+ sendEmail(bigintval($content['userid']), getMessage('ADMIN_ADD_SUBJ'), $msg);
} // END - while
// Free memory
unset($GLOBALS['ref_level']);
// Ok, add points and send an email to him...
- ADD_POINTS_REFSYSTEM("admin_single", bigintval(REQUEST_GET('uid')), bigintval(REQUEST_POST('points')), false, "0", false, "direct");
+ ADD_POINTS_REFSYSTEM_DIRECT('admin_single', bigintval(REQUEST_GET('uid')), bigintval(REQUEST_POST('points')));
// Prepare content
$content = array(
// Message laden
$msg = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval(REQUEST_GET('uid')));
- SEND_EMAIL(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_ADD_SUBJ'), $msg);
+ sendEmail(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_ADD_SUBJ'), $msg);
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
} else {
// Opps, missing form here
// @TODO Rewrite these both constants
- define('__USER_VALUE', "<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$sname." ".$fname."</a>");
+ define('__USER_VALUE', "<a href=\"".generateMemberEmailLink($email, "user_data")."\">".$sname." ".$fname."</a>");
define('__UID' , bigintval(REQUEST_GET('uid')));
LOAD_TEMPLATE("admin_add_points");
}
}
} else {
// Output selection form with all confirmed user accounts listed
- ADD_MEMBER_SELECTION_BOX("0", true);
+ ADD_MEMBER_SELECTION_BOX('0', true);
}
//
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_rallye_data` (admin_id, title, descr, template, start_time, end_time, auto_add_new_user, is_active, send_notify)
VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')",
array(
- GET_CURRENT_ADMIN_ID(),
+ getCurrentAdminId(),
REQUEST_POST('title'),
REQUEST_POST('descr'),
REQUEST_POST('template'),
), __FILE__, __LINE__);
// Load ID
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE start_time='%s' AND end_time='%s' AND `title`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE start_time='%s' AND end_time='%s' AND `title`='%s' LIMIT 1",
array($START, $END, REQUEST_POST('title')), __FILE__, __LINE__);
list($id) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if (!empty($id)) {
// Reload to prices...
- LOAD_URL('modules.php?module=admin&what=config_rallye_prices&rallye='.$id);
+ redirectToUrl('modules.php?module=admin&what=config_rallye_prices&rallye='.$id);
} else {
// Problem detected...
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('RALLYE_PROBLEM_CREATE'));
}
// Prepare some constants for the template
-define('_AUTO_ADD_OPTIONS', ADD_OPTION_LINES('/ARRAY/', array('Y','N'), array(YES, NO )));
-define('_ACTIVE_OPTIONS' , ADD_OPTION_LINES('/ARRAY/', array('N','Y'), array(NO , YES)));
-define('_NOTIFY_OPTIONS' , ADD_OPTION_LINES('/ARRAY/', array('Y','N'), array(YES, NO )));
+define('_AUTO_ADD_OPTIONS', generateOptionList('/ARRAY/', array('Y','N'), array(YES, NO )));
+define('_ACTIVE_OPTIONS' , generateOptionList('/ARRAY/', array('N','Y'), array(NO , YES)));
+define('_NOTIFY_OPTIONS' , generateOptionList('/ARRAY/', array('Y','N'), array(YES, NO )));
// Starting day
define('_START_SEC' , ADD_SELECTION('sec' , '0' , 'start'));
$DATA = array(); $id = "reload_ye"; $skip = false;
// Convert the "reload selections"
- CONVERT_SELECTIONS_TO_TIMESTAMP(REQUEST_POST_ARRAY(), $DATA, $id, $skip);
+ convertSelectionsToTimestamp(REQUEST_POST_ARRAY(), $DATA, $id, $skip);
// Then add this URL
if (SURFBAR_ADMIN_ADD_URL(REQUEST_POST('url'), REQUEST_POST('limit'), REQUEST_POST('reload'))) {
// Prepare content for template
$content = array(
- 'reload' => CREATE_TIME_SELECTIONS(0, "reload", "WDhms")
+ 'reload' => createTimeSelections(0, "reload", "WDhms")
);
// Load template
bigintval(REQUEST_POST('sort')),
), __FILE__, __LINE__
);
- CACHE_PURGE_ADMIN_MENU(0, REQUEST_POST('menu'), REQUEST_POST('name'));
+ cachePurgeAdminMenu(0, REQUEST_POST('menu'), REQUEST_POST('name'));
} else {
// Add main menu
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (action, title, descr, sort) VALUES ('%s','%s','%s','%s')",
bigintval(REQUEST_POST('sort')),
), __FILE__, __LINE__
);
- CACHE_PURGE_ADMIN_MENU(0, REQUEST_POST('name'));
+ cachePurgeAdminMenu(0, REQUEST_POST('name'));
}
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
} else {
// Get count of (maybe) selected menu points
$chk = 0;
-if (REQUEST_ISSET_POST('sel')) $chk = SELECTION_COUNT(REQUEST_POST('sel'));
+if (REQUEST_ISSET_POST('sel')) $chk = countPostSelection();
// List all menu points and make them editable
if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) {
// An action is done...
switch (REQUEST_POST('ok'))
{
- case "edit": // Edit menu
+ case 'edit': // Edit menu
foreach (REQUEST_POST('sel') as $sel => $menu) {
// Secure ID
$sel = bigintval($sel);
}
// Purge admin menu cache
- CACHE_PURGE_ADMIN_MENU(0, REQUEST_POST('sel_action', $sel), REQUEST_POST('sel_what', $sel));
+ cachePurgeAdminMenu(0, REQUEST_POST('sel_action', $sel), REQUEST_POST('sel_what', $sel));
// Load template
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
break;
- case "del": // Delete menu
+ case 'del': // Delete menu
foreach (REQUEST_POST('sel') as $sel => $menu) {
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE ".$AND." AND id=%s LIMIT 1",
array(bigintval($sel)), __FILE__, __LINE__);
- CACHE_PURGE_ADMIN_MENU(0, '', '', $AND);
+ cachePurgeAdminMenu(0, '', '', $AND);
} // END - foreach
// Load template
// Get IDs
if (REQUEST_ISSET_GET(('w'))) {
// Sub menus selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
array(REQUEST_GET('act'), bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
array(REQUEST_GET('act'), bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
} else {
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
array(bigintval(REQUEST_GET('tid')), bigintval($fid)), __FILE__, __LINE__);
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
array(bigintval(REQUEST_GET('fid')), bigintval($tid)), __FILE__, __LINE__);
- CACHE_PURGE_ADMIN_MENU(0, '', '', $AND);
+ cachePurgeAdminMenu(0, '', '', $AND);
}
}
if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('login'))) && (REQUEST_ISSET_POST(('email'))) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))) && (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
// Add admin when not added already
- if (REGISTER_ADMIN(REQUEST_POST('login'), generateHash(REQUEST_POST('pass1')), REQUEST_POST('email')) == "done") {
+ if (REGISTER_ADMIN(REQUEST_POST('login'), generateHash(REQUEST_POST('pass1')), REQUEST_POST('email')) == 'done') {
// Do not ouput any form!
$FORM = false;
// Send mail or message
if ((EXT_IS_ACTIVE("msg")) && (REQUEST_POST('type') == "msg")) {
// Add message
- $msg = LOAD_EMAIL_TEMPLATE("admins_msg_contct_admin", REQUEST_POST('text'), "0");
+ $msg = LOAD_EMAIL_TEMPLATE("admins_msg_contct_admin", REQUEST_POST('text'), '0');
SEND_ADMIN_MESSAGE(REQUEST_GET('admin'), ADMINS_MSG_FROM_ADMIN, $msg);
} else {
// Load admin's email address
- $email = GET_ADMIN_EMAIL(bigintval(REQUEST_GET('admin')));
+ $email = getAdminEmail(bigintval(REQUEST_GET('admin')));
// Load email template and send the mail to the admin
- $msg = LOAD_EMAIL_TEMPLATE("admins_mail_contct_admin", REQUEST_POST('text'), "0");
- SEND_EMAIL($email, ADMINS_MSG_FROM_ADMIN, $msg);
+ $msg = LOAD_EMAIL_TEMPLATE("admins_mail_contct_admin", REQUEST_POST('text'), '0');
+ sendEmail($email, getMessage('ADMINS_MSG_FROM_ADMIN'), $msg);
}
// Mail / message dropped
// Set required fields
REQUEST_SET_POST('edit', "1");
REQUEST_SET_POST(array('sel', $aid), "1");
-}
+} // END - if
-if ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+if ((REQUEST_ISSET_POST('edit')) && (countPostSelection() > 0)) {
// Edit account(s)
- ADMINS_EDIT_ADMIN_ACCOUNTS(REQUEST_POST_ARRAY());
+ adminsEditAdminAccount(REQUEST_POST_ARRAY());
} elseif ((REQUEST_ISSET_POST('change')) && (count(REQUEST_POST('login')) > 0)) {
// Change admin accounts
- ADMINS_CHANGE_ADMIN_ACCOUNT(REQUEST_POST_ARRAY());
-} elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+ adminsChangeAdminAccount(REQUEST_POST_ARRAY());
+} elseif ((REQUEST_ISSET_POST('del')) && (countPostSelection() > 0)) {
// Show admin accounts for deletetion
- ADMINS_DELETE_ADMIN_ACCOUNTS(REQUEST_POST_ARRAY());
+ adminsDeleteAdminAccount(REQUEST_POST_ARRAY());
} else {
- if ((REQUEST_ISSET_POST('remove')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+ if ((REQUEST_ISSET_POST('remove')) && (countPostSelection() > 0)) {
// Remove accounts now
- ADMINS_REMOVE_ADMIN_ACCOUNTS(REQUEST_POST_ARRAY());
- }
+ adminsRemoveAdminAccount(REQUEST_POST_ARRAY());
+ } // END - if
// List all admin accounts
- ADMINS_LIST_ADMIN_ACCOUNTS();
+ adminsListAdminAccounts();
}
//
if (REQUEST_ISSET_POST('edit')) {
// Check if entires are checked
- $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+ $SEL = countPostSelection();
if ($SEL > 0) {
// Add option for events
- $GLOBALS['cache_array']['admins'] = ADD_OPTION_LINES('admins', "id", "login", '', 'email');
+ $GLOBALS['cache_array']['admins'] = generateOptionList('admins', "id", "login", '', 'email');
$SW = 2; $rowNameS = '';
foreach (REQUEST_POST('sel') as $template => $sel) {
// First of all load data from DB
// @TODO Can this be rewritten???
$OUT .= "<select name=\"admin_id[".$content['id']."]\" size=\"1\" class=\"admin_select\">
<option value=\"0\"";
- if ($content['admin_id'] == "0") $OUT .= ' selected="selected"';
+ if ($content['admin_id'] == '0') $OUT .= ' selected="selected"';
$OUT .=">{--ADMINS_ALL_ADMINS--}</option>\n";
if (EXT_IS_ACTIVE('events')) {
$OUT .= "<option value=\"-1\"";
if ($content['admin_id'] == "-1") $OUT .= ' selected="selected"';
$OUT .= ">{--ADMINS_TO_USER_EVENTS--}</option>\n";
}
- $OUT .= ADD_OPTION_LINES('admins', "id", "login", $content['admin_id'], 'email');
+ $OUT .= generateOptionList('admins', "id", "login", $content['admin_id'], 'email');
$OUT .= "</select>\n<br />\n";
$aid2 = $content['admin_id']; $id2 = $content['id'];
}
$content['admin_id'] = bigintval($content['admin_id']);
// Update entry
- ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins_mails` SET admin_id=%s WHERE id=%s ORDER BY `id` LIMIT 1",
+ ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins_mails` SET admin_id=%s WHERE `id`=%s ORDER BY `id` LIMIT 1",
array($content['admin_id'], $id), __FILE__, __LINE__, false));
if (($content['admin_id'] < 1) && (REQUEST_ISSET_POST('template', $id))) {
'sw' => $SW,
'id' => $data['id'],
'tpl' => $data['mail_template'],
- 'alnk' => GENERATE_AID_LINK($data['admin_id'])
+ 'alnk' => generateAdminLink($data['admin_id'])
);
// Load row template
$totalHits = (getConfig('db_hits') + getConfig('cache_hits'));
// Prepare data for the template
-define('__DB_HITS' , TRANSLATE_COMMA(getConfig('db_hits')));
-define('__CACHE_HITS', TRANSLATE_COMMA(getConfig('cache_hits')));
-define('__TOTAL_HITS', TRANSLATE_COMMA($totalHits));
-define('__CACHE_PERC', TRANSLATE_COMMA((getConfig('cache_hits') / $totalHits * 100)));
+define('__DB_HITS' , translateComma(getConfig('db_hits')));
+define('__CACHE_HITS', translateComma(getConfig('cache_hits')));
+define('__TOTAL_HITS', translateComma($totalHits));
+define('__CACHE_PERC', translateComma((getConfig('cache_hits') / $totalHits * 100)));
// Load template
LOAD_TEMPLATE("admin_cache_stats");
$OUT = ''; $SW = 2;
while ($content = SQL_FETCHARRAY($result)) {
// Add link to refid
- if ($content['refid'] > 0) $content['refid'] = ADMIN_USER_PROFILE_LINK($content['refid']);
+ if ($content['refid'] > 0) $content['refid'] = generateUserProfileLink($content['refid']);
// Prepare array for the row template
// @TODO Rewritings: sname->surname,fname->family,ip->REMOTE_ADDR,ref->refid,hash->user_hash in template
$content = array(
'sw' => $SW,
- 'gender' => TRANSLATE_GENDER($content['gender']),
+ 'gender' => translateGender($content['gender']),
'sname' => $content['surname'],
'fname' => $content['family'],
- 'email' => "<a href=\"".CREATE_EMAIL_LINK($content['email'], "user_data")."\">".$content['email']."</a>",
+ 'email' => "<a href=\"".generateMemberEmailLink($content['email'], "user_data")."\">".$content['email']."</a>",
'ip' => $content['REMOTE_ADDR'],
'ref' => $content['refid'],
'hash' => $content['user_hash'],
- 'link' => ADMIN_USER_PROFILE_LINK($content['userid']),
+ 'link' => generateUserProfileLink($content['userid']),
);
// Load row template and switch color
ADD_DESCR('admin', __FILE__);
$SEL = 0;
-if (REQUEST_ISSET_POST('sel')) $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+if (REQUEST_ISSET_POST('sel')) $SEL = countPostSelection();
if ((REQUEST_ISSET_POST('edit')) && ($SEL > 0)) {
// Edit ACLs
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $selected) {
// Load data for the ID
- $result = SQL_QUERY_ESC("SELECT admin_id, action_menu, what_menu, access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT admin_id, action_menu, what_menu, access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($aid, $act, $wht, $mode) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
$content = array(
'sw' => $SW,
'id' => $id,
- 'admins_selection' => ADD_OPTION_LINES('admins', "id", "login", $aid, "default_acl"),
+ 'admins_selection' => generateOptionList('admins', "id", "login", $aid, "default_acl"),
'action_selection' => ADMIN_MENU_SELECTION("action", $act, $id),
'what_selection' => ADMIN_MENU_SELECTION("what", $wht, $id),
- 'mode_options' => ADD_OPTION_LINES(
+ 'mode_options' => generateOptionList(
"/ARRAY/",
array("allow", "deny"),
array(constant('ADMINS_ALLOW_MODE'), constant('ADMINS_DENY_MODE')),
$id = bigintval($id);
// Update entries
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins_acls` SET admin_id=%s, action_menu='%s', what_menu='%s', access_mode='%s' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins_acls` SET admin_id=%s, action_menu='%s', what_menu='%s', access_mode='%s' WHERE `id`=%s LIMIT 1",
array(
REQUEST_POST('admin', $id),
REQUEST_POST('action_menu', $id),
if ($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) $GLOBALS['cache_instance']->destroyCacheFile();
// Purge menu cache
- CACHE_PURGE_ADMIN_MENU(REQUEST_POST('admin', $id));
+ cachePurgeAdminMenu(REQUEST_POST('admin', $id));
}
// Entries changed
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $selected) {
// Load data for the ID
- $result = SQL_QUERY_ESC("SELECT admin_id, action_menu, what_menu, access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT admin_id, action_menu, what_menu, access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($admin, $act, $wht, $mode) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
$mode = constant('ADMINS_'.strtoupper($mode).'_MODE');
// Generate link
- $admin = GENERATE_AID_LINK($admin);
+ $admin = generateAdminLink($admin);
// Prepare data for the row template
$content = array(
} elseif ((REQUEST_ISSET_POST('remove')) && ($SEL > 0)) {
// Remove entries
foreach (REQUEST_POST('sel') as $id => $selected) {
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE `id`=%s LIMIT 1",
array(bigintval($id)),__FILE__, __LINE__);
}
if ($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) $GLOBALS['cache_instance']->destroyCacheFile();
// @TODO This causes the whole (!) menu cache being rebuild
- CACHE_PURGE_ADMIN_MENU();
+ cachePurgeAdminMenu();
}
// Entries deleted
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_ADMINS_ENTRIES_DELETED'));
} elseif (REQUEST_ISSET_POST(('add'))) {
// Check if everything is fine...
- $mode = GET_ADMIN_DEFAULT_ACL(bigintval(REQUEST_POST('admin_id')));
+ $mode = getAdminDefaultAcl(bigintval(REQUEST_POST('admin_id')));
// Default ACL is false
$ACL = false;
if (REQUEST_ISSET_POST(('what_menu'))) {
// Check parent ACL
- $ACL = ADMINS_CHECK_ACL(GET_ACTION('admin', REQUEST_POST('what_menu')), '');
+ $ACL = adminsCheckAdminAcl(getModeAction('admin', REQUEST_POST('what_menu')), '');
}
if ($mode != REQUEST_POST('mode') || ($ACL)) {
$BOTH = ((REQUEST_ISSET_POST(('action_menu'))) && (REQUEST_ISSET_POST(('what_menu'))));
if (((REQUEST_ISSET_POST(('action_menu'))) || (REQUEST_ISSET_POST(('what_menu')))) && (!$BOTH)) {
// Main or sub menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE admin_id=%s AND action_menu='%s' AND what_menu='%s' LIMIT 1",
- array(bigintval(REQUEST_POST('admin_id')), REQUEST_POST('action_menu'), REQUEST_POST('what_menu')), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE admin_id=%s AND action_menu='%s' AND what_menu='%s' LIMIT 1",
+ array(bigintval(REQUEST_POST('admin_id')), REQUEST_POST('action_menu'), REQUEST_POST('what_menu')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// Finally add the new ACL
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_admins_acls` (admin_id, action_menu, what_menu, access_mode)
if ($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) $GLOBALS['cache_instance']->destroyCacheFile();
// Purge cache
- CACHE_PURGE_ADMIN_MENU(REQUEST_POST('admin_id'), REQUEST_POST('action_menu'), REQUEST_POST('what_menu'));
+ cachePurgeAdminMenu(REQUEST_POST('admin_id'), REQUEST_POST('action_menu'), REQUEST_POST('what_menu'));
} // END - if
} else {
// ACL does already exist!
$content = array(
'sw' => $SW,
'id' => $content['id'],
- 'admin' => GENERATE_AID_LINK($content['admin_id']),
+ 'admin' => generateAdminLink($content['admin_id']),
'action' => $content['action_menu'],
'what' => $content['what_menu'],
'mode' => $content['access_mode'],
}
// Prepare some constants for the template
- define('_ADMINS_SELECTION', ADD_OPTION_LINES('admins', "id", "login", '', "default_acl"));
+ define('_ADMINS_SELECTION', generateOptionList('admins', "id", "login", '', "default_acl"));
define('_ACTION_SELECTION', ADMIN_MENU_SELECTION("action"));
define('_WHAT_SELECTION' , ADMIN_MENU_SELECTION("what"));
define('_MODE_OPTIONS' ,
- ADD_OPTION_LINES(
+ generateOptionList(
"/ARRAY/",
array("allow", "deny"),
array(
define('__AP_NOTIFY_DEL_MAILS' , ADD_SELECTION('yn', getConfig('ap_dm_notify') , "ap_dm_notify"));
// Output time selection boxes
- define('__AP_IN_SINCE' , CREATE_TIME_SELECTIONS(getConfig('ap_inactive_since'), "ap_inactive_since" , "MWDh"));
- define('__AP_IN_TIME' , CREATE_TIME_SELECTIONS(getConfig('ap_in_time') , "ap_inactive_time" , "MWDh"));
- define('__AP_UN_TIME' , CREATE_TIME_SELECTIONS(getConfig('ap_un_time') , "ap_unconfirmed_time", "MWDh"));
- define('__AP_TASK_TIME' , CREATE_TIME_SELECTIONS(getConfig('ap_tasks_time') , "ap_tasks_time" , "MWDh"));
- define('__AP_DEL_MAILS_TIME', CREATE_TIME_SELECTIONS(getConfig('ap_dm_timeout') , "ap_dm_timeout" , "MWDh"));
+ define('__AP_IN_SINCE' , createTimeSelections(getConfig('ap_inactive_since'), "ap_inactive_since" , "MWDh"));
+ define('__AP_IN_TIME' , createTimeSelections(getConfig('ap_in_time') , "ap_inactive_time" , "MWDh"));
+ define('__AP_UN_TIME' , createTimeSelections(getConfig('ap_un_time') , "ap_unconfirmed_time", "MWDh"));
+ define('__AP_TASK_TIME' , createTimeSelections(getConfig('ap_tasks_time') , "ap_tasks_time" , "MWDh"));
+ define('__AP_DEL_MAILS_TIME', createTimeSelections(getConfig('ap_dm_timeout') , "ap_dm_timeout" , "MWDh"));
// Mail confirmation links
- define('_CFG_AUTO_PURGE', CREATE_TIME_SELECTIONS(getConfig('auto_purge'), "auto_purge", "MWD"));
+ define('_CFG_AUTO_PURGE', createTimeSelections(getConfig('auto_purge'), "auto_purge", "MWD"));
if (getConfig('auto_purge_active') != 'Y') {
define('_CFG_AP_ACTIVE_N', ' chkecked="checked"');
define('_CFG_AP_ACTIVE_Y', '');
if (IS_FORM_SENT()) {
// Translate german decimal commas to computer decimal dots
- REQUEST_SET_POST('beg_points' , REVERT_COMMA(REQUEST_POST('beg_points') ));
- REQUEST_SET_POST('beg_points_max' , REVERT_COMMA(REQUEST_POST('beg_points_max') ));
- REQUEST_SET_POST('beg_notify_bonus', REVERT_COMMA(REQUEST_POST('beg_notify_bonus')));
+ REQUEST_SET_POST('beg_points' , convertCommaToDot(REQUEST_POST('beg_points') ));
+ REQUEST_SET_POST('beg_points_max' , convertCommaToDot(REQUEST_POST('beg_points_max') ));
+ REQUEST_SET_POST('beg_notify_bonus', convertCommaToDot(REQUEST_POST('beg_notify_bonus')));
// Save settings
ADMIN_SAVE_SETTINGS_POST();
setConfigEntry('beg_ral_di_notify', REQUEST_POST('beg_ral_di_notify'));
} else {
// Prepare constants for the template
- define('__BEG_POINTS' , TRANSLATE_COMMA(getConfig('beg_points') , false));
- define('__BEG_POINTS_MAX' , TRANSLATE_COMMA(getConfig('beg_points_max') , false));
- define('__BEG_NOTIFY_BONUS' , TRANSLATE_COMMA(getConfig('beg_notify_bonus'), false));
- define('__BEG_TIMEOUT' , CREATE_TIME_SELECTIONS(getConfig('beg_timeout') , "beg_timeout" , "Dhm"));
- define('__BEG_UID_TIMEOUT' , CREATE_TIME_SELECTIONS(getConfig('beg_uid_timeout'), "beg_uid_timeout", "Dhm"));
- define('__BEG_REMOTE_IP_TIMEOUT', CREATE_TIME_SELECTIONS(getConfig('beg_ip_timeout') , "beg_ip_timeout" , "Dhm"));
- define('__WAIT_SELECTION' , CREATE_TIME_SELECTIONS(getConfig('beg_notify_wait'), "beg_notify_wait", "ms" ));
+ define('__BEG_POINTS' , translateComma(getConfig('beg_points') , false));
+ define('__BEG_POINTS_MAX' , translateComma(getConfig('beg_points_max') , false));
+ define('__BEG_NOTIFY_BONUS' , translateComma(getConfig('beg_notify_bonus'), false));
+ define('__BEG_TIMEOUT' , createTimeSelections(getConfig('beg_timeout') , "beg_timeout" , "Dhm"));
+ define('__BEG_UID_TIMEOUT' , createTimeSelections(getConfig('beg_uid_timeout'), "beg_uid_timeout", "Dhm"));
+ define('__BEG_REMOTE_IP_TIMEOUT', createTimeSelections(getConfig('beg_ip_timeout') , "beg_ip_timeout" , "Dhm"));
+ define('__WAIT_SELECTION' , createTimeSelections(getConfig('beg_notify_wait'), "beg_notify_wait", "ms" ));
define('__BEG_RANKS' , getConfig('beg_ranks'));
// Activate / Deactivate beg rallye (Y/N)
if (IS_FORM_SENT()) {
// Replace german decimal commas to computer decimal dots
- REQUEST_POST('login_bonus') = REVERT_COMMA(REQUEST_POST('login_bonus') );
- REQUEST_POST('turbo_bonus') = REVERT_COMMA(REQUEST_POST('turbo_bonus') );
- REQUEST_POST('bonus_ref') = REVERT_COMMA(REQUEST_POST('bonus_ref') );
- REQUEST_POST('bonus_order') = REVERT_COMMA(REQUEST_POST('bonus_order') );
- REQUEST_SET_POST('bonus_notify_points', REVERT_COMMA(REQUEST_POST('bonus_notify_points')));
+ REQUEST_POST('login_bonus') = convertCommaToDot(REQUEST_POST('login_bonus') );
+ REQUEST_POST('turbo_bonus') = convertCommaToDot(REQUEST_POST('turbo_bonus') );
+ REQUEST_POST('bonus_ref') = convertCommaToDot(REQUEST_POST('bonus_ref') );
+ REQUEST_POST('bonus_order') = convertCommaToDot(REQUEST_POST('bonus_order') );
+ REQUEST_SET_POST('bonus_notify_points', convertCommaToDot(REQUEST_POST('bonus_notify_points')));
// Generate string for saving ranks
REQUEST_SET_POST('turbo_rates', '');
$RATES = array();
foreach (REQUEST_POST('rate') as $rate) {
- $rate = trim(REVERT_COMMA($rate));
+ $rate = trim(convertCommaToDot($rate));
if (!empty($rate)) $RATES[] = $rate;
}
REQUEST_SET_POST('turbo_rates', trim(implode(';', $RATES)));
setConfigEntry('bonus_di_notify', REQUEST_POST('bonus_di_notify'));
} else {
// Prepare contants for the template
- define('__LOGIN_VALUE' , TRANSLATE_COMMA(getConfig('login_bonus') , false));
- define('__TURBO_VALUE' , TRANSLATE_COMMA(getConfig('turbo_bonus') , false));
- define('__ORDER_VALUE' , TRANSLATE_COMMA(getConfig('bonus_order') , false));
- define('__REF_VALUE' , TRANSLATE_COMMA(getConfig('bonus_ref') , false));
- define('__STATS_VALUE' , TRANSLATE_COMMA(getConfig('bonus_stats') , false));
- define('__NOTIFY_VALUE', TRANSLATE_COMMA(getConfig('bonus_notify_points'), false));
+ define('__LOGIN_VALUE' , translateComma(getConfig('login_bonus') , false));
+ define('__TURBO_VALUE' , translateComma(getConfig('turbo_bonus') , false));
+ define('__ORDER_VALUE' , translateComma(getConfig('bonus_order') , false));
+ define('__REF_VALUE' , translateComma(getConfig('bonus_ref') , false));
+ define('__STATS_VALUE' , translateComma(getConfig('bonus_stats') , false));
+ define('__NOTIFY_VALUE', translateComma(getConfig('bonus_notify_points'), false));
define('__TRANKS_VALUE', getConfig('bonus_ranks'));
define('__TLINES_VALUE', getConfig('bonus_lines'));
$RANKS = explode(';', getConfig('turbo_rates'));
// Automatically calculate bonus points for ranks 2 and 3 when not set
- if (getConfig('turbo_rates') == "") $RANKS = array(round(getConfig('turbo_bonus') / 2), round(getConfig('turbo_bonus') / 4));
+ if (getConfig('turbo_rates') == '') $RANKS = array(round(getConfig('turbo_bonus') / 2), round(getConfig('turbo_bonus') / 4));
// Generate list
$OUT = "<ol start=\"2\">\n";
$OUT .= "</ol>\n";
define('__TRATES_LIST', $OUT);
- define('__LOGIN_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS(getConfig('login_timeout') , "login_timeout" , "WDh"));
- define('__BONUS_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS(getConfig('bonus_timeout') , "bonus_timeout" , "WDh"));
- define('__WAIT_SELECTION' , CREATE_TIME_SELECTIONS(getConfig('bonus_notify_wait'), "bonus_notify_wait", "ms" ));
+ define('__LOGIN_TIMEOUT_SELECTION', createTimeSelections(getConfig('login_timeout') , "login_timeout" , "WDh"));
+ define('__BONUS_TIMEOUT_SELECTION', createTimeSelections(getConfig('bonus_timeout') , "bonus_timeout" , "WDh"));
+ define('__WAIT_SELECTION' , createTimeSelections(getConfig('bonus_notify_wait'), "bonus_notify_wait", "ms" ));
// Activate / Deactivate bonus active rallye (Y/N)
switch (getConfig('bonus_active'))
if (IS_FORM_SENT()) {
// Cache path has been not changed by default so don't test it again
- REQUEST_SET_POST('cache_tested', "N");
+ REQUEST_SET_POST('cache_tested', 'N');
// Check if path has been changed
if (REQUEST_POST('cache_path') != getConfig('cache_path')) {
// Okay, cache path has been altered so we have to test it again!
- REQUEST_SET_POST('cache_tested', "Y");
+ REQUEST_SET_POST('cache_tested', 'Y');
}
if ((REQUEST_POST('cache_admins') == 'N') && ($GLOBALS['cache_instance']->loadCacheFile('admins'))) {
if (REQUEST_ISSET_POST(('add'))) {
// Add a new category
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_cats` WHERE cat='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_cats` WHERE cat='%s' LIMIT 1",
array(REQUEST_POST('catname')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// Category does not exists, we simply add it...
// Display message
LOAD_TEMPLATE('admin_settings_saved', false, $content);
-} elseif ((IS_FORM_SENT()) && (REQUEST_ISSET_POST(('id'))) && (is_array(REQUEST_POST('id')))) {
+} elseif ((IS_FORM_SENT()) && (REQUEST_ISSET_POST('id')) && (is_array(REQUEST_POST('id')))) {
// Change or delete categories...
$TEXT = '';
foreach (REQUEST_POST('id') as $id => $cat) {
if (!empty($cat)) {
switch (REQUEST_GET('do'))
{
- case "edit": // Change categories
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_cats` SET cat='%s', `visible`='%s', sort=%s WHERE id=%s LIMIT 1",
+ case 'edit': // Change categories
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_cats` SET cat='%s', `visible`='%s', sort=%s WHERE `id`=%s LIMIT 1",
array(
$cat,
REQUEST_POST('vis', $id),
$TEXT = CATEGORIES_SAVED;
break;
- case "del": // Delete categories
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_cats` WHERE id=%s LIMIT 1",
+ case 'del': // Delete categories
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_cats` WHERE `id`=%s LIMIT 1",
array($id), __FILE__, __LINE__);
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s",
array($id), __FILE__, __LINE__);
// Display message
LOAD_TEMPLATE('admin_settings_saved', false, $TEXT);
}
-} elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+} elseif ((REQUEST_ISSET_POST('del')) && (countPostSelection() > 0)) {
// Delete categories
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $value) {
// Load data of category
- $result = SQL_QUERY_ESC("SELECT cat FROM `{!_MYSQL_PREFIX!}_cats` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT cat FROM `{!_MYSQL_PREFIX!}_cats` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($cat) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Load main template
LOAD_TEMPLATE("admin_del_cats");
-} elseif ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+} elseif ((REQUEST_ISSET_POST('edit')) && (countPostSelection() > 0)) {
// Edit categories
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $value)
{
// Load data from the category
- $result = SQL_QUERY_ESC("SELECT cat, visible, sort FROM `{!_MYSQL_PREFIX!}_cats` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT cat, visible, sort FROM `{!_MYSQL_PREFIX!}_cats` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($cat, $vis, $sort) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
while ($content = SQL_FETCHARRAY($result)) {
// Prepare data for the row template
$content['sw'] = $SW;
- $content['vis'] = TRANSLATE_YESNO($content['visible']);
+ $content['vis'] = translateYesNo($content['visible']);
// Put cat descriptions into variable for the selection box
if (strlen($content['cat']) > 20) $content['cat'] = substr($content['cat'], 0, 17)."...";
if (IS_FORM_SENT()) {
// Replace commata with decimal dot
- REQUEST_SET_POST('doubler_charge', REVERT_COMMA((REQUEST_POST('doubler_charge') / 100)));
- REQUEST_SET_POST('doubler_ref' , REVERT_COMMA((REQUEST_POST('doubler_ref') / 100)));
- REQUEST_SET_POST('doubler_min' , REVERT_COMMA(REQUEST_POST('doubler_min')));
- REQUEST_SET_POST('doubler_max' , REVERT_COMMA(REQUEST_POST('doubler_max')));
- REQUEST_SET_POST('doubler_left' , REVERT_COMMA(REQUEST_POST('doubler_left')));
+ REQUEST_SET_POST('doubler_charge', convertCommaToDot((REQUEST_POST('doubler_charge') / 100)));
+ REQUEST_SET_POST('doubler_ref' , convertCommaToDot((REQUEST_POST('doubler_ref') / 100)));
+ REQUEST_SET_POST('doubler_min' , convertCommaToDot(REQUEST_POST('doubler_min')));
+ REQUEST_SET_POST('doubler_max' , convertCommaToDot(REQUEST_POST('doubler_max')));
+ REQUEST_SET_POST('doubler_left' , convertCommaToDot(REQUEST_POST('doubler_left')));
// Save settings
ADMIN_SAVE_SETTINGS_POST();
} else {
// Prepare data for the template
// - Charge rate
- define('__DOUBLER_CHARGE', TRANSLATE_COMMA((getConfig('doubler_charge') * 100), false));
+ define('__DOUBLER_CHARGE', translateComma((getConfig('doubler_charge') * 100), false));
// - Referal rate
- define('__DOUBLER_REFERRAL', TRANSLATE_COMMA((getConfig('doubler_ref') * 100), false));
+ define('__DOUBLER_REFERRAL', translateComma((getConfig('doubler_ref') * 100), false));
// - Minimum points to double
- define('__DOUBLER_MINIMUM', TRANSLATE_COMMA(getConfig('doubler_min'), false));
+ define('__DOUBLER_MINIMUM', translateComma(getConfig('doubler_min'), false));
// - Maximum points to double
- define('__DOUBLER_MAXIMUM', TRANSLATE_COMMA(getConfig('doubler_max'), false));
+ define('__DOUBLER_MAXIMUM', translateComma(getConfig('doubler_max'), false));
// - Points left on users account after doubling
- define('__DOUBLER_LEFT', TRANSLATE_COMMA(getConfig('doubler_left'), false));
+ define('__DOUBLER_LEFT', translateComma(getConfig('doubler_left'), false));
// - Max payouts to check per click/reset
define('__DOUBLER_MAX_SENT', getConfig('doubler_max_sent'));
// - Group sending
define('__MEMBER_SELECTION', ADD_MEMBER_SELECTION_BOX(getConfig('doubler_uid'), false, true, true, "doubler_uid"));
// Number of rows to display (option lines!!!)
- define('__DOUBLER_DISPLAY_NEW', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_new')));
- define('__DOUBLER_DISPLAY_PAY', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_pay')));
- define('__DOUBLER_DISPLAY_OLD', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_old')));
+ define('__DOUBLER_DISPLAY_NEW', generateOptionList("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_new')));
+ define('__DOUBLER_DISPLAY_PAY', generateOptionList("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_pay')));
+ define('__DOUBLER_DISPLAY_OLD', generateOptionList("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_old')));
// Timeout selection box or input box?
- define('__DOUBLER_TIMEOUT', CREATE_TIME_SELECTIONS(getConfig('doubler_timeout') , "doubler_timeout" , "WDh"));
+ define('__DOUBLER_TIMEOUT', createTimeSelections(getConfig('doubler_timeout') , "doubler_timeout" , "WDh"));
// Load template
LOAD_TEMPLATE("admin_config_doubler");
if (REQUEST_ISSET_POST(('add_max'))) {
// Save all settings
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='%s' LIMIT 1",
array(bigintval(REQUEST_POST('max'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// Add this value (including comment)
switch (REQUEST_GET('do'))
{
- case "edit": // Change entries
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_max_receive` SET value='%s', comment='%s' WHERE id=%s LIMIT 1",
+ case 'edit': // Change entries
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_max_receive` SET value='%s', comment='%s' WHERE `id`=%s LIMIT 1",
array(
bigintval(REQUEST_POST('val', $id)),
REQUEST_POST('comm', $id),
$TEXT = MRECEIVE_SAVED;
break;
- case "del":
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE id=%s LIMIT 1",
+ case 'del':
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE `id`=%s LIMIT 1",
array($id), __FILE__, __LINE__);
$TEXT = MRECEIVE_DELETED;
break;
// Display message
LOAD_TEMPLATE('admin_settings_saved', false, $TEXT);
}
-} elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+} elseif ((REQUEST_ISSET_POST('del')) && (countPostSelection() > 0)) {
// Delete entries
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $value)
{
// Load data
- $result = SQL_QUERY_ESC("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($value, $comment) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Load main template
LOAD_TEMPLATE("admin_config_email_del");
-} elseif ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+} elseif ((REQUEST_ISSET_POST('edit')) && (countPostSelection() > 0)) {
// Edit entries
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $value) {
// Load data
- $result = SQL_QUERY_ESC("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($value, $comment) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
{
// Prepare constants for the template
define('__MAX_VALUE', getConfig('holiday_max'));
- define('__LOCKED' , CREATE_TIME_SELECTIONS(getConfig('holiday_lock') , "holiday_lock" , "WDh"));
+ define('__LOCKED' , createTimeSelections(getConfig('holiday_lock') , "holiday_lock" , "WDh"));
switch (getConfig('holiday_mode')) {
case "RESET":
$content = array_fill(-1, 60, '');
$content[getConfig('index_delay')] = ' selected="selected"';
- define('__INDEX_COOKIE_SELECTION', CREATE_TIME_SELECTIONS(getConfig('index_cookie'), "index_cookie", "YMWD"));
+ define('__INDEX_COOKIE_SELECTION', createTimeSelections(getConfig('index_cookie'), "index_cookie", "YMWD"));
LOAD_TEMPLATE("admin_config_home_settings", false, $content);
}
break;
case "target": // Set which what-file will be placed in home-page (only modules.php?module=index)
if (REQUEST_ISSET_GET(('home'))) {
// Set new home
- UPDATE_CONFIG("index_home", REQUEST_GET(('home')));
+ updateConfiguration('index_home', REQUEST_GET(('home')));
} // END - if
// Load all what menu points
// Convert some data
REQUEST_SET_POST('mt_stage', bigintval(REQUEST_POST('mt_stage')));
- if (REQUEST_POST('mt_stage') <= GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true)) {
+ if (REQUEST_POST('mt_stage') <= GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true)) {
// Not enougth!
REQUEST_UNSET_POST('ok');
}
// Start of this exchange
if (getConfig('mt_start') > 0) {
// Only show start
- define('__MT_START', "<strong>".MAKE_DATETIME(getConfig('mt_start'), "3")."</strong>");
+ define('__MT_START', "<strong>".generateDateTime(getConfig('mt_start'), "3")."</strong>");
} else {
// Make start editable
define('__MT_START',
- ADD_SELECTION("day" , date("d", time())).
- ADD_SELECTION("month", date("m", time())).
+ ADD_SELECTION("day" , date('d', time())).
+ ADD_SELECTION("month", date('m', time())).
ADD_SELECTION("year", -1)
);
}
$SEL = 0;
if (REQUEST_ISSET_POST('edit')) {
// Check if at least one module is selected
- $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+ $SEL = countPostSelection();
if ($SEL > 0) {
// Output header
$OUT = ''; $SW = 2;
// Edit selected modules
foreach (REQUEST_POST('sel') as $id => $sel) {
// Load module data
- $result = SQL_QUERY_ESC("SELECT module, title, locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT module, title, locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($mod, $title, $locked, $hidden, $admin, $mem) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
$id = bigintval($id);
// Update module
- ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `title`='%s', `locked`='%s', `hidden`='%s', `admin_only`='%s', `mem_only`='%s' WHERE id=%s LIMIT 1",
+ ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `title`='%s', `locked`='%s', `hidden`='%s', `admin_only`='%s', `mem_only`='%s' WHERE `id`=%s LIMIT 1",
array(
REQUEST_POST('title', $id),
REQUEST_POST('locked', $id),
'id' => $content['id'],
'mod' => $content['module'],
'title' => $content['title'],
- 'locked' => TRANSLATE_YESNO($content['locked']),
- 'hidden' => TRANSLATE_YESNO($content['hidden']),
- 'admin' => TRANSLATE_YESNO($content['admin_only']),
- 'mem' => TRANSLATE_YESNO($content['mem_only']),
+ 'locked' => translateYesNo($content['locked']),
+ 'hidden' => translateYesNo($content['hidden']),
+ 'admin' => translateYesNo($content['admin_only']),
+ 'mem' => translateYesNo($content['mem_only']),
);
// Load row template
if (IS_FORM_SENT()) {
// Save data
- REQUEST_SET_POST('nl_charge', REVERT_COMMA(REQUEST_POST('nl_charge')));
+ REQUEST_SET_POST('nl_charge', convertCommaToDot(REQUEST_POST('nl_charge')));
ADMIN_SAVE_SETTINGS_POST();
} else {
// Prepare contants for the template
- define('__CHARGE_VALUE' , TRANSLATE_COMMA(getConfig('nl_charge'), false));
+ define('__CHARGE_VALUE' , translateComma(getConfig('nl_charge'), false));
// Prepare constants and load template
LOAD_TEMPLATE("admin_config_newsletter", false);
}
switch (getConfig('repay_deleted_mails')) {
- case "REPAY":
+ case 'REPAY':
define('_CFG_REPAY_POINTS_REPAY' , ' selected="selected"');
define('_CFG_REPAY_POINTS_JACKPOT', '');
define('_CFG_REPAY_POINTS_SHRED' , '');
break;
- case "JACKPOT":
+ case 'JACKPOT':
define('_CFG_REPAY_POINTS_REPAY' , '');
define('_CFG_REPAY_POINTS_JACKPOT', ' selected="selected"');
define('_CFG_REPAY_POINTS_SHRED' , '');
break;
- case "SHRED":
+ case 'SHRED':
define('_CFG_REPAY_POINTS_REPAY' , '');
define('_CFG_REPAY_POINTS_JACKPOT', '');
define('_CFG_REPAY_POINTS_SHRED' , ' selected="selected"');
// Stop saving data if one input field is !isset
if (IS_FORM_SENT()) {
// Calculate stamps and set calculated stamps
- REQUEST_POST('online_timeout') = CREATE_TIMESTAMP_FROM_SELECTIONS('ip_timeout' , REQUEST_POST_ARRAY());
- REQUEST_POST('url_tlock') = CREATE_TIMESTAMP_FROM_SELECTIONS('url_tlock' , REQUEST_POST_ARRAY());
- REQUEST_POST('profile_lock') = CREATE_TIMESTAMP_FROM_SELECTIONS('profile_lock' , REQUEST_POST_ARRAY());
- REQUEST_POST('profile_update') = CREATE_TIMESTAMP_FROM_SELECTIONS('profile_update' , REQUEST_POST_ARRAY());
- REQUEST_SET_POST('resend_profile_update', CREATE_TIMESTAMP_FROM_SELECTIONS('resend_profile_update', REQUEST_POST_ARRAY()));
+ REQUEST_POST('online_timeout') = createTimestampFromSelections('ip_timeout' , REQUEST_POST_ARRAY());
+ REQUEST_POST('url_tlock') = createTimestampFromSelections('url_tlock' , REQUEST_POST_ARRAY());
+ REQUEST_POST('profile_lock') = createTimestampFromSelections('profile_lock' , REQUEST_POST_ARRAY());
+ REQUEST_POST('profile_update') = createTimestampFromSelections('profile_update' , REQUEST_POST_ARRAY());
+ REQUEST_SET_POST('resend_profile_update', createTimestampFromSelections('resend_profile_update', REQUEST_POST_ARRAY()));
// Online-Timeout shall be > 0 or your database will crow and crow and crow...
if (!REQUEST_ISSET_POST(('online_timeout'))) { REQUEST_UNSET_POST('ok'); }
define('_CFG_MIN_AGE' , getConfig('min_age'));
// Time selection boxes
- define('_CFG_ONLINE_TIMEOUT', CREATE_TIME_SELECTIONS(getConfig('online_timeout'), 'ip_timeout' , 'ms'));
- define('_CFG_URL_TLOCK' , CREATE_TIME_SELECTIONS(getConfig('url_tlock') , 'url_tlock' , 'WDh'));
- define('_CFG_PROFILE_LOCK' , CREATE_TIME_SELECTIONS(getConfig('profile_lock') , 'profile_lock' , 'WDh'));
- define('_CFG_PROFILE_UPDATE', CREATE_TIME_SELECTIONS(getConfig('profile_update'), 'profile_update' , 'YM'));
- define('_CFG_PROF_REUPDATE' , CREATE_TIME_SELECTIONS(getConfig('resend_profile_update') , 'resend_profile_update', 'MWD'));
+ define('_CFG_ONLINE_TIMEOUT', createTimeSelections(getConfig('online_timeout'), 'ip_timeout' , 'ms'));
+ define('_CFG_URL_TLOCK' , createTimeSelections(getConfig('url_tlock') , 'url_tlock' , 'WDh'));
+ define('_CFG_PROFILE_LOCK' , createTimeSelections(getConfig('profile_lock') , 'profile_lock' , 'WDh'));
+ define('_CFG_PROFILE_UPDATE', createTimeSelections(getConfig('profile_update'), 'profile_update' , 'YM'));
+ define('_CFG_PROF_REUPDATE' , createTimeSelections(getConfig('resend_profile_update') , 'resend_profile_update', 'MWD'));
if (getConfig('order_multi_page') != 'Y') {
define('_CFG_ORDER_MULTI_N', ' chkecked="checked"');
// Add description as navigation point
ADD_DESCR('admin', __FILE__);
-if (REQUEST_ISSET_POST(('rate'))) REQUEST_SET_POST('rate', REVERT_COMMA(REQUEST_POST('rate')));
+
+if (REQUEST_ISSET_POST(('rate'))) REQUEST_SET_POST('rate', convertCommaToDot(REQUEST_POST('rate')));
if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('title'))) && (REQUEST_POST('rate') > 0)) {
// Add new payout type
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE type='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE type='%s' LIMIT 1",
array(REQUEST_POST('title')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// Add now
}
// Payout requests by your members
-$result_mem = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE `status`='NEW' ORDER BY payout_timestamp DESC", __FILE__, __LINE__);
+$result_mem = SQL_QUERY("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE `status`='NEW' ORDER BY payout_timestamp DESC", __FILE__, __LINE__);
$display = true;
-if ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+if ((REQUEST_ISSET_POST('edit')) && (countPostSelection() > 0)) {
// Edit payout types
if ((REQUEST_ISSET_GET('ok')) && (REQUEST_GET('ok') == "ok")) {
// Init SQLs
rate=%s,
min_points=%s,
allow_url='%s'
-WHERE id='".$id."' LIMIT 1",
+WHERE `id`='".$id."' LIMIT 1",
array(
REQUEST_POST('title', $id),
- REVERT_COMMA(REQUEST_POST('rate', $id)),
- REVERT_COMMA(REQUEST_POST('mpoi' , $id)),
+ convertCommaToDot(REQUEST_POST('rate', $id)),
+ convertCommaToDot(REQUEST_POST('mpoi' , $id)),
REQUEST_POST('allow', $id),
),__FILE__, __LINE__, false));
}
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $sel) {
// Load data
- $result = SQL_QUERY_ESC("SELECT type, rate, min_points, allow_url FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT type, rate, min_points, allow_url FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($title, $rate, $mpoi, $allow) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
'sw' => $SW,
'id' => $id,
'title' => COMPILE_CODE($title),
- 'rate' => TRANSLATE_COMMA($rate),
- 'mpoi' => TRANSLATE_COMMA($mpoi),
+ 'rate' => translateComma($rate),
+ 'mpoi' => translateComma($mpoi),
'allow' => ADD_SELECTION('yn', $allow, "allow[".$id."]"),
);
// Load main template
LOAD_TEMPLATE("admin_config_payouts_edit");
}
-} elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+} elseif ((REQUEST_ISSET_POST('del')) && (countPostSelection() > 0)) {
// Delete payout types
if ((REQUEST_ISSET_GET('ok')) && (REQUEST_GET('ok') == "ok")) {
// Init SQLs
// Delete entries
foreach (REQUEST_POST('sel') as $id => $sel) {
- ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
+ ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__, false));
} // END - foreach
$id = bigintval($id);
// Load data
- $result = SQL_QUERY_ESC("SELECT type, rate, min_points FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT type, rate, min_points FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE `id`=%s LIMIT 1",
array($id), __FILE__, __LINE__);
list($title, $rate, $mpoi) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
'sw' => $SW,
'id' => $id,
'title' => COMPILE_CODE($title),
- 'rate' => TRANSLATE_COMMA($rate),
- 'mpoi' => TRANSLATE_COMMA($mpoi),
+ 'rate' => translateComma($rate),
+ 'mpoi' => translateComma($mpoi),
);
// Load row template and switch color
'id' => $content['id'],
'from' => COMPILE_CODE($content['from_account']),
'type' => COMPILE_CODE($content['type']),
- 'rate' => TRANSLATE_COMMA($content['rate']),
- 'mpoi' => TRANSLATE_COMMA($content['min_points']),
+ 'rate' => translateComma($content['rate']),
+ 'mpoi' => translateComma($content['min_points']),
);
// Load row template and switch color
ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_refdepths` (level, percents) VALUES ('".REQUEST_POST('lvl')."','".REQUEST_POST('perc')."')");
break;
- case "edit": // Change entries
+ case 'edit': // Change entries
foreach (REQUEST_POST('lvl') as $id => $value) {
// Secure ID
$id = bigintval($id);
// Revert german commata
- REQUEST_SET_POST(array('perc', $id), REVERT_COMMA(REQUEST_POST('perc', $id)));
+ REQUEST_SET_POST(array('perc', $id), convertCommaToDot(REQUEST_POST('perc', $id)));
// Update entry
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refdepths` SET level='%s', percents='%s' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refdepths` SET level='%s', percents='%s' WHERE `id`=%s LIMIT 1",
array(bigintval($value), REQUEST_POST('perc', $id), $id), __FILE__, __LINE__);
}
$message = getMessage('REF_DEPTHS_SAVED');
break;
- case "del":
+ case 'del':
foreach (REQUEST_POST('id') as $id => $value) {
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
}
$message = getMessage('REF_DEPTHS_DELETED');
if ((IS_SQLS_VALID()) && (IS_SQLS_VALID())) {
if (strpos($GLOBALS['sqls'][0], "INSERT") > -1) {
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level='%s' LIMIT 1",
array(bigintval(REQUEST_POST('lvl'))), __FILE__, __LINE__);
SQL_FREERESULT($result);
} // END - if
// One-time referal bonus add-mode
switch (getConfig('reg_points_mode')) {
- case "ref" : define('__MODE_REF', ' chkecked="checked"'); define('__MODE_DIRECT', ''); break;
- case "direct": define('__MODE_REF', ''); define('__MODE_DIRECT', ' chkecked="checked"'); break;
+ case 'ref' :
+ define('__MODE_REF', ' chkecked="checked"');
+ define('__MODE_DIRECT', '');
+ break;
+
+ case 'direct':
+ define('__MODE_REF', '');
+ define('__MODE_DIRECT', ' chkecked="checked"');
+ break;
}
// Referal payout value
LOAD_TEMPLATE("admin_config_point_settings");
} elseif (REQUEST_GET('sub') == "ref") {
// 12 3 32 2 3 32 2 3 4 43 21
- if ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST('sel')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+ if ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST('sel')) && (countPostSelection() > 0)) {
// Delete entries
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $value) {
- $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($lvl, $perc) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
'sw' => $SW,
'id' => $id,
'lvl' => $lvl,
- 'per' => TRANSLATE_COMMA($perc),
+ 'per' => translateComma($perc),
);
// Load row template and switch color
// Load main template
LOAD_TEMPLATE("admin_points_del");
- } elseif ((REQUEST_ISSET_POST('edit')) && (REQUEST_ISSET_POST('sel')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+ } elseif ((REQUEST_ISSET_POST('edit')) && (REQUEST_ISSET_POST('sel')) && (countPostSelection() > 0)) {
// Edit entries
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $value) {
- $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($lvl, $perc) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
'sw' => $SW,
'id' => $id,
'lvl' => $lvl,
- 'per' => TRANSLATE_COMMA($perc),
+ 'per' => translateComma($perc),
);
// Load row template and switch color
'sw' => $SW,
'id' => $content['id'],
'lvl' => $content['level'],
- 'per' => TRANSLATE_COMMA($content['percents']),
+ 'per' => translateComma($content['percents']),
);
// Load row template and switch color
if (REQUEST_ISSET_POST(('add'))) {
if ((REQUEST_ISSET_POST(('level'))) && ((REQUEST_ISSET_POST(('points'))) || (REQUEST_ISSET_POST(('info'))))) {
// Submitted data is valid, but maybe we already have this price level?
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s AND price_level='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s AND price_level='%s' LIMIT 1",
array(bigintval(REQUEST_GET('rallye')), bigintval(REQUEST_POST('level'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
}
} elseif (REQUEST_ISSET_POST('remove')) {
// Check if at last one line is selected
- $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+ $SEL = countPostSelection();
if ($SEL > 0) {
// Delete selected entries
foreach (REQUEST_POST('sel') as $id => $sel) {
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
}
$id = bigintval($id);
// Update entry
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_prices` SET rallye_id=%s, price_level='%s', points='%s', info='%s' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_prices` SET rallye_id=%s, price_level='%s', points='%s', info='%s' WHERE `id`=%s LIMIT 1",
array(
REQUEST_POST('rallye_id', $id),
bigintval($level),
if (REQUEST_ISSET_POST('edit')) {
// Check if at last one line is selected
- $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+ $SEL = countPostSelection();
if ($SEL > 0) {
// Make selected editable
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $sel) {
// Load data to selected rallye
- $result = SQL_QUERY_ESC("SELECT rallye_id, price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT rallye_id, price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($rallye, $level, $points, $infos) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
$content = array(
'sw' => $SW,
'id' => $id,
- 'rallyes' => ADD_OPTION_LINES("rallye_data", "id", "title", $rallye),
+ 'rallyes' => generateOptionList("rallye_data", "id", "title", $rallye),
'level' => $level,
'points' => $points,
'infos' => $infos,
}
} elseif (REQUEST_ISSET_POST('del')) {
// Check if at last one line is selected
- $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+ $SEL = countPostSelection();
if ($SEL > 0) {
// List all prices
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $sel) {
// Load data to selected rallye
- $result = SQL_QUERY_ESC("SELECT rallye_id, price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT rallye_id, price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($rallye, $level, $points, $infos) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
'select' => $select,
'title' => $content['title'],
'aid' => $content['admin_id'],
- 'email_link' => CREATE_EMAIL_LINK($content['admin_id']),
+ 'email_link' => generateMemberEmailLink($content['admin_id']),
'alogin' => $content['login'],
- 'start' => MAKE_DATETIME($content['start_time'], "3"),
- 'end' => MAKE_DATETIME($content['end_time'], "3"),
+ 'start' => generateDateTime($content['start_time'], "3"),
+ 'end' => generateDateTime($content['end_time'], "3"),
);
// Load row template and switch color
// Do we want to save changes?
if (IS_FORM_SENT()) {
foreach (REQUEST_POST('sel') as $id => $value) {
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_must_register` SET field_required='%s' WHERE id=%s AND field_required != '%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_must_register` SET field_required='%s' WHERE `id`=%s AND field_required != '%s' LIMIT 1",
array($value, bigintval($id), $value),__FILE__, __LINE__);
}
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('REGISTER_ADMIN_CHANGES_SAVED'));
if (IS_FORM_SENT()) {
// Calculate timestamp from selections...
- REQUEST_SET_POST('ip_timeout', CREATE_TIMESTAMP_FROM_SELECTIONS("ip_timeout", REQUEST_POST_ARRAY()));
+ REQUEST_SET_POST('ip_timeout', createTimestampFromSelections('ip_timeout', REQUEST_POST_ARRAY()));
REQUEST_SET_POST('least_cats', round(REQUEST_POST('least_cats')));
// Save settings
} else {
// Remember stuff in constants
define('LEAST_CATS_VALUE' , round(getConfig('least_cats')));
- define('__CFG_SHOW_REFID' , ADD_SELECTION('yn', getConfig('display_refid') , "display_refid"));
- define('__TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS(getConfig('ip_timeout') , "ip_timeout", "Dhm"));
- define('__CFG_DBL_EMAIL' , ADD_SELECTION('yn', getConfig('check_double_email') , "check_double_email"));
- define('__CFG_DBL_PASS' , ADD_SELECTION('yn', getConfig('check_double_pass') , "check_double_pass"));
- define('__CFG_CAT_DEFAULT' , ADD_SELECTION('yn', getConfig('register_default'), "register_default"));
+ define('__CFG_SHOW_REFID' , ADD_SELECTION('yn', getConfig('display_refid') , 'display_refid'));
+ define('__TIMEOUT_SELECTION', createTimeSelections(getConfig('ip_timeout') , 'ip_timeout', 'Dhm'));
+ define('__CFG_DBL_EMAIL' , ADD_SELECTION('yn', getConfig('check_double_email'), 'check_double_email'));
+ define('__CFG_DBL_PASS' , ADD_SELECTION('yn', getConfig('check_double_pass') , 'check_double_pass'));
+ define('__CFG_CAT_DEFAULT' , ADD_SELECTION('yn', getConfig('register_default') , 'register_default'));
// Load normal template
- LOAD_TEMPLATE("admin_config_register2");
+ LOAD_TEMPLATE('admin_config_register2');
}
//
}
// Implode array to string and remove posted mod array
- REQUEST_SET_POST('rewrite_skip', implode(":", $MODs));
+ REQUEST_SET_POST('rewrite_skip', implode(':', $MODs));
REQUEST_UNSET_POST('mod');
// Save settings
if (IS_FORM_SENT()) {
// If salt length is empty or null then we shall generate new passwords
- if (!REQUEST_ISSET_POST(('salt_length')) || (REQUEST_POST('salt_length') == "0")) {
+ if (!REQUEST_ISSET_POST(('salt_length')) || (REQUEST_POST('salt_length') == '0')) {
// Generate new passwords for all!
- LOAD_INC('inc/gen_sql_patches.php');
+ loadInclude('inc/gen_sql_patches.php');
// Forget the wrong number!
REQUEST_UNSET_POST(('salt_length'));
// Redirect to logout link
- LOAD_URL('modules.php?module=admin&logout=1');
+ redirectToUrl('modules.php?module=admin&logout=1');
} // END - if
// Save settings
// Was the form submitted?
if (IS_FORM_SENT()) {
// Replace german decimal comma with computer decimal dot
- if (REQUEST_ISSET_POST(('surfbar_static_reward'))) REQUEST_SET_POST('surfbar_static_reward' , REVERT_COMMA(REQUEST_POST('surfbar_static_reward')));
- if (REQUEST_ISSET_POST(('surfbar_static_costs'))) REQUEST_SET_POST('surfbar_static_costs' , REVERT_COMMA(REQUEST_POST('surfbar_static_costs')));
- if (REQUEST_ISSET_POST(('surfbar_dynamic_percent'))) REQUEST_SET_POST('surfbar_dynamic_percent', REVERT_COMMA(REQUEST_POST('surfbar_dynamic_percent')));
+ if (REQUEST_ISSET_POST(('surfbar_static_reward'))) REQUEST_SET_POST('surfbar_static_reward' , convertCommaToDot(REQUEST_POST('surfbar_static_reward')));
+ if (REQUEST_ISSET_POST(('surfbar_static_costs'))) REQUEST_SET_POST('surfbar_static_costs' , convertCommaToDot(REQUEST_POST('surfbar_static_costs')));
+ if (REQUEST_ISSET_POST(('surfbar_dynamic_percent'))) REQUEST_SET_POST('surfbar_dynamic_percent', convertCommaToDot(REQUEST_POST('surfbar_dynamic_percent')));
// Save settings
ADMIN_SAVE_SETTINGS_POST();
} else {
// Prepare content
$content = array(
- 'surfbar_static_reward' => TRANSLATE_COMMA(getConfig('surfbar_static_reward')),
- 'surfbar_static_costs' => TRANSLATE_COMMA(getConfig('surfbar_static_costs')),
- 'surfbar_static_time' => CREATE_TIME_SELECTIONS(getConfig('surfbar_static_time') , "surfbar_static_time" , "ms" , "left"),
- 'surfbar_static_lock' => CREATE_TIME_SELECTIONS(getConfig('surfbar_static_lock') , "surfbar_static_lock" , "hm" , "left"),
- 'surfbar_restart_time' => CREATE_TIME_SELECTIONS(getConfig('surfbar_restart_time') , "surfbar_restart_time" , "ms" , "left"),
- 'surfbar_dynamic_percent' => TRANSLATE_COMMA(getConfig('surfbar_dynamic_percent')),
+ 'surfbar_static_reward' => translateComma(getConfig('surfbar_static_reward')),
+ 'surfbar_static_costs' => translateComma(getConfig('surfbar_static_costs')),
+ 'surfbar_static_time' => createTimeSelections(getConfig('surfbar_static_time') , 'surfbar_static_time' , 'ms' , 'left'),
+ 'surfbar_static_lock' => createTimeSelections(getConfig('surfbar_static_lock') , 'surfbar_static_lock' , 'hm' , 'left'),
+ 'surfbar_restart_time' => createTimeSelections(getConfig('surfbar_restart_time') , 'surfbar_restart_time' , 'ms' , 'left'),
+ 'surfbar_dynamic_percent' => translateComma(getConfig('surfbar_dynamic_percent')),
'surfbar_max_order' => getConfig('surfbar_max_order'),
- 'surfbar_stats_reload' => CREATE_TIME_SELECTIONS(getConfig('surfbar_stats_reload') , "surfbar_stats_reload" , "ms" , "left"),
- 'surfbar_purge_deleted' => CREATE_TIME_SELECTIONS(getConfig('surfbar_purge_deleted') , "surfbar_purge_deleted" , "WDh", "left"),
- 'surfbar_purge_migrated' => CREATE_TIME_SELECTIONS(getConfig('surfbar_purge_migrated'), "surfbar_purge_migrated", "WDh", "left"),
+ 'surfbar_stats_reload' => createTimeSelections(getConfig('surfbar_stats_reload') , 'surfbar_stats_reload' , 'ms' , 'left'),
+ 'surfbar_purge_deleted' => createTimeSelections(getConfig('surfbar_purge_deleted') , 'surfbar_purge_deleted' , 'WDh', 'left'),
+ 'surfbar_purge_migrated' => createTimeSelections(getConfig('surfbar_purge_migrated'), 'surfbar_purge_migrated', 'WDh', 'left'),
'surfbar_pause_url' => getConfig('surfbar_pause_url'),
'surfbar_warn_low_points' => getConfig('surfbar_warn_low_points'),
- 'surfbar_low_interval' => CREATE_TIME_SELECTIONS(getConfig('surfbar_low_interval') , "surfbar_low_interval" , "WDh", "left"),
+ 'surfbar_low_interval' => createTimeSelections(getConfig('surfbar_low_interval') , 'surfbar_low_interval' , 'WDh', 'left'),
);
// Prepare payment model for template
- if (getConfig('surfbar_pay_model') == "STATIC") {
+ if (getConfig('surfbar_pay_model') == 'STATIC') {
// Static model
define('__CONFIG_SURFBAR_PAY_MODEL_STATIC' , ' chkecked="checked"');
define('__CONFIG_SURFBAR_PAY_MODEL_DYNAMIC', '');
}
// Pause URL mode
- if (getConfig('surfbar_pause_mode') == "INTERNAL") {
+ if (getConfig('surfbar_pause_mode') == 'INTERNAL') {
// Internal pause page
define('__CONFIG_SURFBAR_PAUSE_MODE_INTERNAL', ' chkecked="checked"');
define('__CONFIG_SURFBAR_PAUSE_MODE_EXTERNAL', '');
}
// Notification mode
- if (getConfig('surfbar_notification_mode') == "INSTANT") {
+ if (getConfig('surfbar_notification_mode') == 'INSTANT') {
// Instant notification
define('__CONFIG_SURFBAR_NOTIFICATION_MODE_INSTANT', ' selected="selected"');
define('__CONFIG_SURFBAR_NOTIFICATION_MODE_RESET' , '');
}
// Load template
- LOAD_TEMPLATE("admin_config_surfbar", false, $content);
+ LOAD_TEMPLATE('admin_config_surfbar', false, $content);
}
//
}
// Time selection box
-define('__TRANS_AGE_SELECTION' , CREATE_TIME_SELECTIONS(getConfig('transfer_age'), "transfer_age", "MWDh"));
-define('__TRANS_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS(getConfig('transfer_timeout'), "transfer_timeout", "MWDh"));
+define('__TRANS_AGE_SELECTION' , createTimeSelections(getConfig('transfer_age'), "transfer_age", "MWDh"));
+define('__TRANS_TIMEOUT_SELECTION', createTimeSelections(getConfig('transfer_timeout'), "transfer_timeout", "MWDh"));
// Load template
LOAD_TEMPLATE("admin_config_transfer");
if (WERNIS_TEST_API()) {
// Revert german commata
foreach (array('payout_factor', 'withdraw_factor', 'payout_fee_percent', 'withdraw_fee_percent') as $revert) {
- REQUEST_SET_POST('wernis_'.$revert, REVERT_COMMA(REQUEST_POST('wernis_'.$revert)));
+ REQUEST_SET_POST('wernis_'.$revert, convertCommaToDot(REQUEST_POST('wernis_'.$revert)));
} // END - if
// Hash the password and remove clear-text
'api_md5' => getConfig('wernis_api_md5'),
'api_url' => getConfig('wernis_api_url'),
'refid' => getConfig(('wernis_refid')),
- 'payout_factor' => TRANSLATE_COMMA(getConfig('wernis_payout_factor')),
- 'withdraw_factor' => TRANSLATE_COMMA(getConfig('wernis_withdraw_factor')),
- 'payout_fee_percent' => TRANSLATE_COMMA(getConfig('wernis_payout_fee_percent')),
- 'withdraw_fee_percent' => TRANSLATE_COMMA(getConfig('wernis_withdraw_fee_percent')),
+ 'payout_factor' => translateComma(getConfig('wernis_payout_factor')),
+ 'withdraw_factor' => translateComma(getConfig('wernis_withdraw_factor')),
+ 'payout_fee_percent' => translateComma(getConfig('wernis_payout_fee_percent')),
+ 'withdraw_fee_percent' => translateComma(getConfig('wernis_withdraw_fee_percent')),
'payout_fee_fix' => getConfig(('wernis_payout_fee_fix')),
'withdraw_fee_fix' => getConfig(('wernis_withdraw_fee_fix'))
);
if (REQUEST_ISSET_GET(('mid'))) {
// Load email data
- $result = SQL_QUERY_ESC("SELECT id, sender, subject, url, timestamp, payment_id FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id, sender, subject, url, timestamp, payment_id FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('mid'))), __FILE__, __LINE__);
// Delete mail only once
SQL_FREERESULT($result);
// Get points we shall pay back per mail
- $price = GET_PAY_POINTS($payId, "price");
+ $price = getPaymentPoints($payId, 'price');
// Prepare data for the template
define('__ID' , $id);
- define('__SENDER' , ADMIN_USER_PROFILE_LINK($sender));
+ define('__SENDER' , generateUserProfileLink($sender));
define('__SUBJECT', $subject);
define('__URL' , DEREFERER($url));
- define('__ORDERED', MAKE_DATETIME($timestamp, "0"));
+ define('__ORDERED', generateDateTime($timestamp, '0'));
// Load template
LOAD_TEMPLATE("admin_del_email_normal");
// Load email template and send the email away
$msg_user = LOAD_EMAIL_TEMPLATE("order-deleted", array(), $sender);
- SEND_EMAIL($sender, getMessage('MEMBER_ORDER_DELETED'), $msg_user);
+ sendEmail($sender, getMessage('MEMBER_ORDER_DELETED'), $msg_user);
// Fetch right stats_id from pool
$result_pool = SQL_QUERY_ESC("SELECT s.id FROM `{!_MYSQL_PREFIX!}_user_stats` AS s
$links = GET_TOTAL_DATA($stats_id, "user_links", 'userid', "stats_id", true);
// Reset sent mails for recipient(s)
- REDUCED_RECIPIENT_RECEIVED_MAILS("stats_id", REQUEST_GET('mid'), $links);
+ reduceRecipientReceivedMails("stats_id", REQUEST_GET('mid'), $links);
// Calc total points and pay them back
$totalPoints = $links * $price;
// Shall we pay the points back to the user?
- if (getConfig('repay_deleted_mails') != "SHRED") {
- //* DEBUG: */ echo $stats_id.":".$totalPoints."/".$links."/".$price."<br />\n";
+ if (getConfig('repay_deleted_mails') != 'SHRED') {
+ //* DEBUG: */ echo $stats_id.':'.$totalPoints.'/'.$links.'/'.$price."<br />\n";
if ($totalPoints > 0) {
// Shall we payback to user or jackpot?
- if (getConfig('repay_deleted_mails') == "JACKPOT") {
+ if (getConfig('repay_deleted_mails') == 'JACKPOT') {
// Set jackpot
$sender = 0;
} // END - if
// Pay back points
//* DEBUG: */ echo "PAYBACK:".$sender."<br />\n";
- ADD_POINTS_REFSYSTEM("mail_deleted", $sender, $totalPoints, true, "0", false,"direct");
+ ADD_POINTS_REFSYSTEM('mail_deleted', $sender, $totalPoints, true, '0', false,'direct');
// Output message
- if (getConfig('repay_deleted_mails') == "REPAY") {
+ if (getConfig('repay_deleted_mails') == 'REPAY') {
// Repayed
LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_REPAYED'),
- TRANSLATE_COMMA($totalPoints)
+ translateComma($totalPoints)
));
} else {
// To jackpot
LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_TO_JACKPOT'),
- TRANSLATE_COMMA($totalPoints)
+ translateComma($totalPoints)
));
}
} else {
SQL_FREERESULT($result_pool);
// Delete mail from queue
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('mid'))), __FILE__, __LINE__);
$cnt += SQL_AFFECTEDROWS();
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_USER_STATS_REMOVED'));
} elseif ((REQUEST_ISSET_GET(('bid'))) && (EXT_IS_ACTIVE('bonus'))) {
// Load data from bonus mail
- $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp, mails_sent FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id=%s",
+ $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp, mails_sent FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s",
array(bigintval(REQUEST_GET('bid'))), __FILE__, __LINE__);
// Delete mail only once
list ($id, $subject, $url, $timestamp, $sent) = SQL_FETCHROW($result);
// Reset sent mails for recipient(s)
- REDUCED_RECIPIENT_RECEIVED_MAILS('bonus_id', REQUEST_GET('bid'), $sent);
+ reduceRecipientReceivedMails('bonus_id', REQUEST_GET('bid'), $sent);
// Init counter for deleted mails
$cnt = 0;
// Delete bonus mail entirely from database
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('bid'))), __FILE__, __LINE__);
$cnt += SQL_AFFECTEDROWS();
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
define('__ID' , $id);
define('__SUBJECT', $subject);
define('__URL' , DEREFERER($url));
- define('__ORDERED', MAKE_DATETIME($timestamp, "0"));
+ define('__ORDERED', generateDateTime($timestamp, '0'));
define('__CNT' , $cnt);
// Load template
SQL_FREERESULT($result);
} elseif ((REQUEST_ISSET_GET(('nid'))) && (GET_EXT_VERSION('bonus') >= '0.8.7')) {
// Load data from bonus mail
- $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id=%s",
+ $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s",
array(bigintval(REQUEST_GET('nid'))), __FILE__, __LINE__);
// Delete mail only once
$cnt = 0;
// Delete bonus mail entirely from database
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('nid'))), __FILE__, __LINE__);
$cnt += SQL_AFFECTEDROWS();
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
define('__ID' , $id);
define('__SUBJECT', $subject);
define('__URL' , DEREFERER($url));
- define('__ORDERED', MAKE_DATETIME($timestamp, "0"));
+ define('__ORDERED', generateDateTime($timestamp, '0'));
define('__CNT' , $cnt);
// Load template
// Check for selected holidays
$SUM = 0;
-if (REQUEST_ISSET_POST('sel')) $SUM = SELECTION_COUNT(REQUEST_POST('sel'));
+if (REQUEST_ISSET_POST('sel')) $SUM = countPostSelection();
// Shall I delete selected holidays???
if ($SUM > 0)
// Get the userid
$result = SQL_QUERY_ESC("SELECT userid, holiday_start, holiday_end
FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE id=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
+WHERE `id`=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1)
{
// Load data and free memory
// Remove holiday
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE id=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
+WHERE `id`=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
// Prepare loaded data for the
$content = array(
- 'start' => MAKE_DATETIME($start, "3"),
- 'end' => MAKE_DATETIME($end , "3")
+ 'start' => generateDateTime($start, "3"),
+ 'end' => generateDateTime($end , "3")
);
// Send email to user
$msg = LOAD_EMAIL_TEMPLATE("member_holiday_removed", $content, $uid);
- SEND_EMAIL($uid, getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $msg);
+ sendEmail($uid, getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $msg);
$cnt++;
}
}
// Send email to user
$msg = LOAD_EMAIL_TEMPLATE("member_holiday_removed", $content, REQUEST_GET('uid'));
- SEND_EMAIL(REQUEST_GET('uid'), getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $msg);
+ sendEmail(REQUEST_GET('uid'), getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $msg);
// Set message
$message = getMessage('HOLIDAY_ADMIN_SINGLE_DELETED');
// Add description as navigation point
ADD_DESCR('admin', __FILE__);
-if (REQUEST_ISSET_GET(('id'))) {
+if (REQUEST_ISSET_GET('id')) {
// Check for selected sponsor
- $result = SQL_QUERY_ESC("SELECT email, gender, surname, family FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE id='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT email, gender, surname, family FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Remove sponsor
SQL_FREERESULT($result);
define('__EMAIL' , $email);
- define('__GENDER' , TRANSLATE_GENDER($gender));
+ define('__GENDER' , translateGender($gender));
define('__SURNAME', $surname);
define('__FAMILY' , $family);
// Prepare message and send it away
$msg = LOAD_EMAIL_TEMPLATE("del_sponsor", REQUEST_POST('reason'), bigintval(REQUEST_GET('id')));
- SEND_EMAIL($email, getMessage('ADMIN_SPONSOR_DEL_SUBJECT'), $msg);
+ sendEmail($email, getMessage('ADMIN_SPONSOR_DEL_SUBJECT'), $msg);
// Remove account
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE id='%s' LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
// Remove orders
LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_DELETED'), bigintval(REQUEST_GET('id'))));
} elseif (REQUEST_ISSET_POST(('no'))) {
// Do not delete him...
- LOAD_URL('modules.php?module=admin&what=list_sponsor&id='.bigintval(REQUEST_GET('id')));
+ redirectToUrl('modules.php?module=admin&what=list_sponsor&id='.bigintval(REQUEST_GET('id')));
} else {
// Load data
list ($email, $gender, $sname, $fname) = SQL_FETCHROW($result);
define('__EMAIL' , $email);
define('__SNAME' , $sname);
define('__FNAME' , $fname);
- define('__GENDER', TRANSLATE_GENDER($gender));
+ define('__GENDER', translateGender($gender));
define('__UID' , bigintval(REQUEST_GET('id')));
// Display form
if (REQUEST_ISSET_POST('del')) {
// Delete entries from tables
- $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+ $SEL = countPostSelection();
if ($SEL > 0) {
// Init SQLs
INIT_SQLS();
$content = array(
'sw' => $SW,
'idx' => $content['trans_id'],
- 'stamp' => MAKE_DATETIME($content['time_trans'], "3"),
- 'uid_from' => ADMIN_USER_PROFILE_LINK($content['userid']),
- 'uid_to' => ADMIN_USER_PROFILE_LINK($content['to_uid']),
+ 'stamp' => generateDateTime($content['time_trans'], "3"),
+ 'uid_from' => generateUserProfileLink($content['userid']),
+ 'uid_to' => generateUserProfileLink($content['to_uid']),
'reason' => $content['reason'],
- 'points' => TRANSLATE_COMMA($content['points']),
+ 'points' => translateComma($content['points']),
);
// Load row template
SQL_FREERESULT($result_user);
// Delete user account
- DELETE_USER_ACCOUNT(REQUEST_GET('uid'), REQUEST_POST('reason'));
+ deleteUserAccount(REQUEST_GET('uid'), REQUEST_POST('reason'));
// Output message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_DEL_COMPLETED'));
}
} elseif (REQUEST_ISSET_POST(('no'))) {
// Do not delete him...
- LOAD_URL(ADMIN_CREATE_USERID_LINK(REQUEST_GET('uid')));
+ redirectToUrl(ADMIN_CREATE_USERID_LINK(REQUEST_GET('uid')));
} elseif (!REQUEST_ISSET_GET('uid')) {
// Output selection form with all confirmed user accounts listed
ADD_MEMBER_SELECTION_BOX();
// Prepare content
$content = array(
- 'email' => CREATE_EMAIL_LINK($email, "user_data"),
+ 'email' => generateMemberEmailLink($email, "user_data"),
'surname' => $sname,
'family' => $fname,
'header' => sprintf(getMessage('ADMIN_HEADER_DEL_ACCOUNT'), REQUEST_GET('uid')),
// Add description as navigation point
ADD_DESCR('admin', __FILE__);
-if ((IS_FORM_SENT()) && (!REQUEST_ISSET_POST(('id')))) {
+if ((IS_FORM_SENT()) && (!REQUEST_ISSET_POST('id'))) {
REQUEST_UNSET_POST('ok');
}
if (SQL_NUMROWS($result) > 0) {
if (IS_FORM_SENT()) {
// Make mail editable...
- $result = SQL_QUERY_ESC("SELECT subject, text, url FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT subject, text, url FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_POST('id'))), __FILE__, __LINE__);
list($subj, $text, $url) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
subject='%s',
text='%s',
url='%s'
-WHERE id=%s LIMIT 1",
+WHERE `id`=%s LIMIT 1",
array(
REQUEST_POST('subj'),
REQUEST_POST('text'),
'sw' => $SW,
'id' => $content['id'],
'subj' => $content['subject'],
- 'uid' => ADMIN_USER_PROFILE_LINK($content['sender']),
- 'pay' => GET_PAYMENT($content['payment_id']),
- 'cat' => GET_CATEGORY($content['cat_id']),
+ 'uid' => generateUserProfileLink($content['sender']),
+ 'pay' => getPaymentTitlePrice($content['payment_id']),
+ 'cat' => getCategory($content['cat_id']),
);
// Load row template and switch colors
// Add description as navigation point
ADD_DESCR('admin', __FILE__);
-if ((REQUEST_ISSET_GET(('id'))) && (REQUEST_ISSET_GET(('mode')))) {
+if ((REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET(('mode')))) {
// Check for selected sponsor
- $result = SQL_QUERY_ESC("SELECT company, position, gender, surname, family, street_nr1, street_nr2, zip, city, country, phone, fax, cell, email, url, tax_ident, receive_warnings, warning_interval FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE id='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT company, position, gender, surname, family, street_nr1, street_nr2, zip, city, country, phone, fax, cell, email, url, tax_ident, receive_warnings, warning_interval FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load sponsor details
define('__URL' , $DATA['url']);
// Warning because low points
define('__REC_WARNING', ADD_SELECTION('yn', $DATA['receive_warnings'], "receive_warning"));
- define('__INTERVAL' , CREATE_TIME_SELECTIONS($DATA['warning_interval'], "warning_interval", "MWDh"));
+ define('__INTERVAL' , createTimeSelections($DATA['warning_interval'], "warning_interval", "MWDh"));
// Init variables here
$TPL = sprintf("admin_edit_sponsor_%s", REQUEST_GET(('mode')));
case "add_points": // Add points
if (strval(REQUEST_POST('points')) > 0) {
// Replace german decimal comma with computer's decimal dot
- $POINTS = strval(REVERT_COMMA(REQUEST_POST('points')));
+ $POINTS = strval(convertCommaToDot(REQUEST_POST('points')));
// Add points to account
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET points_amount=points_amount+%s WHERE id='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET points_amount=points_amount+%s WHERE `id`='%s' LIMIT 1",
array($POINTS, bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
// Remember points /reason for the template
- define('__POINTS' , TRANSLATE_COMMA($POINTS));
+ define('__POINTS' , translateComma($POINTS));
define('__REASON' , REQUEST_POST('reason'));
// Send email
$msg = LOAD_EMAIL_TEMPLATE("sponsor_add_points", REQUEST_POST('reason'), true);
- SEND_EMAIL(__EMAIL, ADMIN_SPONSOR_ADD_POINTS_SUBJ, $msg);
+ sendEmail(__EMAIL, ADMIN_SPONSOR_ADD_POINTS_SUBJ, $msg);
$message = ADMIN_SPONSOR_POINTS_ADDED;
} else {
// No points entered to add!
case "sub_points": // Subtract points
if (strval(REQUEST_POST('points')) > 0) {
// Replace german decimal comma with computer's decimal dot
- $POINTS = strval(REVERT_COMMA(REQUEST_POST('points')));
+ $POINTS = strval(convertCommaToDot(REQUEST_POST('points')));
// Add points to account
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET points_used=points_used+%s WHERE id='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET points_used=points_used+%s WHERE `id`='%s' LIMIT 1",
array($POINTS, bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
// Remember points /reason for the template
- define('__POINTS' , TRANSLATE_COMMA($POINTS));
+ define('__POINTS' , translateComma($POINTS));
define('__REASON' , REQUEST_POST('reason'));
// Send email
$msg = LOAD_EMAIL_TEMPLATE("sponsor_sub_points", REQUEST_POST('reason'), true);
- SEND_EMAIL(__EMAIL, ADMIN_SPONSOR_SUB_POINTS_SUBJ, $msg);
+ sendEmail(__EMAIL, ADMIN_SPONSOR_SUB_POINTS_SUBJ, $msg);
$message = ADMIN_SPONSOR_POINTS_SUBTRACTED;
} else {
// No points entered to add!
}
break;
- case "edit": // Edit sponsor account
+ case 'edit': // Edit sponsor account
$PASS = true;
if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) || ((!REQUEST_ISSET_POST(('pass1'))) && (!REQUEST_ISSET_POST(('pass1'))))) {
// Remove passwords
// Convert time selection
$DATA = array(); $id = "warning_interval_ye"; $skip = false;
- CONVERT_SELECTIONS_TO_TIMESTAMP(REQUEST_POST_ARRAY(), $DATA, $id, $skip);
+ convertSelectionsToTimestamp(REQUEST_POST_ARRAY(), $DATA, $id, $skip);
// Save the sponsor
SPONSOR_HANDLE_SPONSOR(REQUEST_POST_ARRAY());
// Convert some data for the email template
- REQUEST_POST('gender' , TRANSLATE_GENDER(REQUEST_POST('gender')));
- REQUEST_POST('warning_interval', CREATE_FANCY_TIME(REQUEST_POST('warning_interval')));
+ REQUEST_POST('gender' , translateGender(REQUEST_POST('gender')));
+ REQUEST_POST('warning_interval', createFancyTime(REQUEST_POST('warning_interval')));
if (!$PASS) REQUEST_SET_POST('pass1', getMessage('SPONSOR_PASS_UNCHANGED'));
// Load email template and send the mail away
$msg = LOAD_EMAIL_TEMPLATE("admin_sponsor_edit", REQUEST_POST_ARRAY(), false);
- SEND_EMAIL(REQUEST_POST('email'), getMessage('ADMIN_SPONSOR_EDIT_SUBJECT'), $msg);
+ sendEmail(REQUEST_POST('email'), getMessage('ADMIN_SPONSOR_EDIT_SUBJECT'), $msg);
break;
default: // Unknown mode
// Output message
LOAD_TEMPLATE('admin_settings_saved', false, $message);
} // END - if
- } elseif (FILE_READABLE(sprintf("%stemplates/%s/html/admin/%s.tpl", constant('PATH'), GET_LANGUAGE(), $TPL))) {
+ } elseif (isFileReadable(sprintf("%stemplates/%s/html/admin/%s.tpl", constant('PATH'), getLanguage(), $TPL))) {
// Create mailto link
define('__SPONSOR_VALUE', "<a href=\"mailto:{!__EMAIL!}\">{!__SURNAME!} {!__FAMILY!}</a>");
// Prepare data for the row template
$content = array(
'sw' => $SW,
- 'u_link' => ADMIN_USER_PROFILE_LINK($pool[1]),
+ 'u_link' => generateUserProfileLink($pool[1]),
'subj' => COMPILE_CODE($pool[2]),
'text' => COMPILE_CODE($pool[3]),
- 'pay' => GET_PAYMENT($pool[5]),
- 'cat' => GET_CATEGORY($pool[10]),
+ 'pay' => getPaymentTitlePrice($pool[5]),
+ 'cat' => getCategory($pool[10]),
'sent' => $sent,
'ruids' => str_replace(';', ", ", $pool[4]),
'unconfirmed' => $unconfirmed,
- 'type' => TRANSLATE_POOL_TYPE($pool[6]),
+ 'type' => translatePoolType($pool[6]),
'tsend' => $pool[9],
'frametester' => FRAMETESTER($pool[8]),
'url' => COMPILE_CODE($pool[8]),
- 'stamp' => MAKE_DATETIME($pool[7], "0"),
+ 'stamp' => generateDateTime($pool[7], '0'),
'mid' => $pool[0],
);
// 0 1 2 3 4 5 6 7 8 9 10
$sql = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id
FROM `{!_MYSQL_PREFIX!}_pool`
- WHERE id='".bigintval(REQUEST_GET('mid'))."'
+ WHERE `id`='".bigintval(REQUEST_GET('mid'))."'
LIMIT 1";
$WHO = MAIL_ID.": ".REQUEST_GET('mid');
} elseif (REQUEST_ISSET_GET('uid')) {
// Prepare content
$content = $pool;
- $content['sender_link'] = ADMIN_USER_PROFILE_LINK($pool['sender']);
+ $content['sender_link'] = generateUserProfileLink($pool['sender']);
$content['subject'] = COMPILE_CODE($pool['subject']);
$content['text'] = COMPILE_CODE($pool['text']);
- $content['payment'] = GET_PAYMENT($pool['payment_id']);
- $content['category'] = GET_CATEGORY($pool['cat_id']);
+ $content['payment'] = getPaymentTitlePrice($pool['payment_id']);
+ $content['category'] = getCategory($pool['cat_id']);
$content['receivers'] = str_replace(';', ", ", $pool['receivers']);
- $content['type'] = TRANSLATE_POOL_TYPE($pool['data_type']);
+ $content['type'] = translatePoolType($pool['data_type']);
$content['frametester'] = FRAMETESTER($pool['url']);
$content['url'] = COMPILE_CODE($pool['url']);
- $content['timestamp'] = MAKE_DATETIME($pool['timestamp'], "0");
+ $content['timestamp'] = generateDateTime($pool['timestamp'], '0');
// Load row template
$OUT .= LOAD_TEMPLATE("admin_list_emails_row", true, $content);
// Prepare content
$content = $bonus;
- $content['time'] = CREATE_FANCY_TIME($content['time']);
- $content['category'] = GET_CATEGORY($content['cat_id']);
+ $content['time'] = createFancyTime($content['time']);
+ $content['category'] = getCategory($content['cat_id']);
$content['receivers'] = str_replace(';', ", ", $content['receivers']);
- $content['type'] = TRANSLATE_POOL_TYPE($content['data_type']);
+ $content['type'] = translatePoolType($content['data_type']);
$content['frametester'] = FRAMETESTER($content['url']);
- $content['timestamp'] = MAKE_DATETIME($content['timestamp'], "0");
+ $content['timestamp'] = generateDateTime($content['timestamp'], '0');
// Load row template
$OUT .= LOAD_TEMPLATE("admin_list_bonus_emails_row", true, $content);
// Normally we want the overview of all registered extensions
$do = "overview";
$SEL = 0;
-if (REQUEST_ISSET_POST('sel')) $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+if (REQUEST_ISSET_POST('sel')) $SEL = countPostSelection();
if (REQUEST_ISSET_GET(('reg_ext'))) {
// We are about to register a new extension
// Keep this extension active!
} else {
// De/activate extension
- $ACT = "N"; $EXT_LOAD_MODE = 'deactivate';
- if ($active == 'N') { $ACT = "Y"; $EXT_LOAD_MODE = 'activate'; }
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_active='".$ACT."' WHERE id=%s AND ext_active='%s' LIMIT 1",
+ $ACT = 'N'; $EXT_LOAD_MODE = 'deactivate';
+ if ($active == 'N') { $ACT = 'Y'; $EXT_LOAD_MODE = 'activate'; }
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET `ext_active`='".$ACT."' WHERE `id`=%s AND `ext_active`='%s' LIMIT 1",
array(bigintval($ext_id), $active), __FILE__, __LINE__);
// Run embeded SQL commands
// Update extension's record
if (GET_EXT_VERSION('sql_patches') >= '0.0.6') {
// Update also CSS column when extensions sql_patches is newer or exact v0.0.6
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='%s', ext_active='%s' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='%s', `ext_active`='%s' WHERE `id`=%s LIMIT 1",
array(REQUEST_POST('css', $ext_id), $active, $ext_id), __FILE__, __LINE__);
} else {
// When extension is older than v0.0.6 there is no column for the CSS information
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_active='%s' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET `ext_active`='%s' WHERE `id`=%s LIMIT 1",
array($active, $ext_id), __FILE__, __LINE__);
}
if (($sel == 'Y') || ($sel == 'N')) {
// Load required data
if (GET_EXT_VERSION('sql_patches') >= '0.0.6') {
- $result = SQL_QUERY_ESC("SELECT ext_name, ext_has_css, ext_active FROM `{!_MYSQL_PREFIX!}_extensions` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT ext_name, ext_has_css, ext_active FROM `{!_MYSQL_PREFIX!}_extensions` WHERE `id`=%s LIMIT 1",
array(bigintval($ext_id)), __FILE__, __LINE__);
list($name, $css, $active) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
} else {
- $result = SQL_QUERY_ESC("SELECT ext_name, ext_active FROM `{!_MYSQL_PREFIX!}_extensions` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT ext_name, ext_active FROM `{!_MYSQL_PREFIX!}_extensions` WHERE `id`=%s LIMIT 1",
array(bigintval($ext_id)), __FILE__, __LINE__);
list($name, $active) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Load template
LOAD_TEMPLATE("admin_extensions_edit");
- $do = "edit";
+ $do = 'edit';
}
} elseif ((REQUEST_ISSET_POST('delete')) && ($SEL > 0) && (!IS_DEMO())) {
// List extensions and when verbose is enabled SQL statements which will be executed
// Shall we display active/inactive extensions?
$where = '';
if (REQUEST_ISSET_GET(('active'))) {
- $where = sprintf("WHERE ext_active = '%s'", SQL_ESCAPE(strip_tags(REQUEST_GET('active'))));
+ $where = sprintf("WHERE `ext_active`='%s'", SQL_ESCAPE(strip_tags(REQUEST_GET('active'))));
} // END - if
// Case selection
while ($content = SQL_FETCHARRAY($result)) {
// Prepare CSS selection output
$cssSelection = '---';
- if (GET_EXT_VERSION('sql_patches') >= '0.0.6') $cssSelection = TRANSLATE_YESNO($content['ext_css']);
+ if (GET_EXT_VERSION('sql_patches') >= '0.0.6') $cssSelection = translateYesNo($content['ext_css']);
// Prepare data for the row template
$content = array(
'sw' => $SW,
'id' => $content['ext_id'],
'name' => $content['ext_name'],
- 'active' => TRANSLATE_YESNO($content['ext_active']),
+ 'active' => translateYesNo($content['ext_active']),
'act_val' => $content['ext_active'],
'css' => $cssSelection,
'ver' => $content['ext_version'],
break;
case 'register': // Register new extension
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_task_system` WHERE assigned_admin=%s AND task_type='EXTENSION' LIMIT 1",
- array(GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `assigned_admin`=%s AND `task_type`='EXTENSION' LIMIT 1",
+ array(getCurrentAdminId()), __FILE__, __LINE__);
$task_found = SQL_NUMROWS($result);
// Free result
// Is the ID number valid and the task was found?
if (($ext_id > 0) && ($task_found == 1)) {
// ID is valid so begin with registration, we first want to it's real name from task management (subject column)
- $result = SQL_QUERY_ESC("SELECT subject FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT subject FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `id`=%s LIMIT 1",
array(bigintval($ext_id)), __FILE__, __LINE__);
list($subj) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
$cache_update = 0;
if (!empty($subj)) {
// Extract extension's name from subject...
- $ext_name = trim(substr($subj, 1, strpos($subj, ":") - 1));
+ $ext_name = trim(substr($subj, 1, strpos($subj, ':') - 1));
// Test the extension for deprecation
LOAD_EXTENSION($ext_name, 'test');
// Get count of (maybe) selected menu points
$chk = 0;
-if (REQUEST_ISSET_POST('sel')) $chk = SELECTION_COUNT(REQUEST_POST('sel'));
+if (REQUEST_ISSET_POST('sel')) $chk = countPostSelection();
// List all menu points and make them editable
if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
// An action is done...
switch (REQUEST_POST('ok'))
{
- case "edit": // Edit menu
+ case 'edit': // Edit menu
foreach (REQUEST_POST('sel') as $sel => $menu) {
// Secure selector
$sel = bigintval($sel);
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
break;
- case "del": // Delete menu
+ case 'del': // Delete menu
foreach (REQUEST_POST('sel') as $sel => $menu) {
// Delete enty
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE ".$AND." AND id=%s LIMIT 1",
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
break;
- case "status": // Change access levels
+ case 'status': // Change access levels
foreach (REQUEST_POST('sel') as $sel => $menu) {
// Secure selector
$sel = bigintval($sel);
// Get IDs
if (REQUEST_ISSET_GET(('w'))) {
// Sub menus selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
array(REQUEST_GET('act'), bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
array(REQUEST_GET('act'), bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
} else {
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// @TODO Rewritings: sname->surname,fname->family in templates
$content = array(
'sw' => $SW,
- 'uid' => ADMIN_USER_PROFILE_LINK($content['userid']),
- 'gender' => TRANSLATE_GENDER($content['gender']),
+ 'uid' => generateUserProfileLink($content['userid']),
+ 'gender' => translateGender($content['gender']),
'sname' => $content['surname'],
'fname' => $content['family'],
- 'email' => "<a href=\"".CREATE_EMAIL_LINK($content['email'], "user_data")."\">".$content['email']."</a>",
- 'joined' => MAKE_DATETIME($content['joined'], "2"),
- 'last' => MAKE_DATETIME($content['last_online'], "2"),
- 'notified' => MAKE_DATETIME($content['ap_notified'], "2"),
+ 'email' => "<a href=\"".generateMemberEmailLink($content['email'], "user_data")."\">".$content['email']."</a>",
+ 'joined' => generateDateTime($content['joined'], "2"),
+ 'last' => generateDateTime($content['last_online'], "2"),
+ 'notified' => generateDateTime($content['ap_notified'], "2"),
);
// Load row template
// Check if there is enougth selected
$show = true;
-if ((REQUEST_ISSET_POST(('id'))) && (is_array(REQUEST_POST('id'))) && (count(REQUEST_POST('id')) > 0)) {
+if ((REQUEST_ISSET_POST('id')) && (is_array(REQUEST_POST('id'))) && (count(REQUEST_POST('id')) > 0)) {
// Okay, which button was pressed?
if (REQUEST_ISSET_POST('change')) {
// Change permissions
- ADMIN_CHANGE_ACTIVATION_STATUS(REQUEST_POST('id'), "bank_packages", "package_active");
+ ADMIN_CHANGE_ACTIVATION_STATUS(REQUEST_POST('id'), 'bank_packages', 'package_active');
} elseif (REQUEST_ISSET_POST('edit')) {
// Delete entries (with confirmation)
ADMIN_EDIT_ENTRIES_CONFIRM(
REQUEST_POST('id'),
- "bank_packages",
- array("id", "title", "description", "account_fee", "free_transfers", "transfer_fee", "output_system_mode", "package_active", "free_months_no_fee", "interest_plus", "interest_minus", "first_payment", "free_account_income", "free_account_stuff", "tan_lock"),
- array("bigintval", '', '', "TRANSLATE_COMMA", "bigintval", "TRANSLATE_COMMA", '', '', "bigintval", "TRANSLATE_COMMA", "TRANSLATE_COMMA", "TRANSLATE_COMMA", "TRANSLATE_COMMA", '', "bigintval"),
- array("", '', '', '', '', '', '', '', '', '', '', '', '', '', '')
+ 'bank_packages',
+ array('id', 'title', 'description', 'account_fee', 'free_transfers', 'transfer_fee', 'output_system_mode', 'package_active', 'free_months_no_fee', 'interest_plus', 'interest_minus', 'first_payment', 'free_account_income', 'free_account_stuff', 'tan_lock'),
+ array('bigintval', '', '', 'translateComma', 'bigintval', 'translateComma', '', '', 'bigintval', 'translateComma', 'translateComma', 'translateComma', 'translateComma', '', 'bigintval'),
+ array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '')
);
$show = false;
} elseif (REQUEST_ISSET_POST(('do_edit'))) {
// Delete entries (with confirmation)
- ADMIN_EDIT_ENTRIES_CONFIRM(REQUEST_POST('id'), "bank_packages", array(), array(), array(), true);
+ ADMIN_EDIT_ENTRIES_CONFIRM(REQUEST_POST('id'), 'bank_packages', array(), array(), array(), true);
} elseif (REQUEST_ISSET_POST('delete')) {
// Delete entries (with confirmation)
- ADMIN_DELETE_ENTRIES_CONFIRM(REQUEST_POST('id'), "bank_packages", array("id", "title", "description", "account_fee"), array("bigintval", '', '', "TRANSLATE_COMMA"), array("", '', '', ''));
+ ADMIN_DELETE_ENTRIES_CONFIRM(REQUEST_POST('id'), 'bank_packages', array('id', 'title', 'description', 'account_fee'), array('bigintval', '', '', 'translateComma'), array('', '', '', ''));
$show = false;
} elseif (REQUEST_ISSET_POST('remove')) {
// Delete entries (with confirmation)
- ADMIN_DELETE_ENTRIES_CONFIRM(REQUEST_POST('id'), "bank_packages", array(), array(), array(), true);
+ ADMIN_DELETE_ENTRIES_CONFIRM(REQUEST_POST('id'), 'bank_packages', array(), array(), array(), true);
}
} // END - if
$OUT = ''; $SW = 2;
while ($content = SQL_FETCHARRAY($result)) {
// "Translate" some data
- $content['active'] = TRANSLATE_YESNO($content['active']);
- $content['fee'] = TRANSLATE_COMMA($content['fee']);
- $content['plus'] = TRANSLATE_COMMA($content['plus']);
- $content['minus'] = TRANSLATE_COMMA($content['minus']);
+ $content['active'] = translateYesNo($content['active']);
+ $content['fee'] = translateComma($content['fee']);
+ $content['plus'] = translateComma($content['plus']);
+ $content['minus'] = translateComma($content['minus']);
$content['sw'] = $SW;
// Load row template
- $OUT .= LOAD_TEMPLATE("admin_list_bank_package_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_list_bank_package_row', true, $content);
$SW = 3 - $SW;
} // END - while
define('__BANK_PACKAGE_ROWS', $OUT);
// Load main template
- LOAD_TEMPLATE("admin_list_bank_package");
+ LOAD_TEMPLATE('admin_list_bank_package');
} else {
// No packages found!
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_BANK_NO_PACKAGES_FOUND'));
// Shall I withdraw now?
if (REQUEST_ISSET_POST(('withdraw'))) {
// Okay, let's prepare...
- $curr = date("m", time()) - 1;
- if (strlen($curr) == 1) $curr = "0".$curr;
- UPDATE_CONFIG("last_month", $curr);
+ $curr = date('m', time()) - 1;
+ if (strlen($curr) == 1) $curr = '0'.$curr;
+ updateConfiguration('last_month', $curr);
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_BEG_WITHDRAW_PREPARED'));
} // END - if
$lastOnline = "%s"; $ONLINE = '';
if (EXT_IS_ACTIVE('autopurge')) {
// Use last online timestamp to keep inactive members away from here
- $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+ $lastOnline = " AND `last_online` >= (UNIX_TIMESTAMP() - %s)";
$ONLINE = getConfig('ap_inactive_since');
} // END - if
// @TODO to shorten this block. Please also do so with uid->userid
$content = array(
'uid' => $content['userid'],
- 'email' => CREATE_EMAIL_LINK($content['email'], "user_data"),
- 'gender' => TRANSLATE_GENDER($content['gender']),
+ 'email' => generateMemberEmailLink($content['email'], "user_data"),
+ 'gender' => translateGender($content['gender']),
'sname' => $content['surname'],
'fname' => $content['family'],
- 'turbo' => TRANSLATE_COMMA($content['beg_points']),
- 'last' => MAKE_DATETIME($content['last_online'], "2"),
+ 'turbo' => translateComma($content['beg_points']),
+ 'last' => generateDateTime($content['last_online'], "2"),
'sw' => $SW,
'win1' => $WIN1,
'win2' => $WIN2,
$SW = 3 - $SW; $cnt++; $total += $content['beg_points'];
}
define('__BEG_ROWS', $OUT);
- define('__TOTAL', TRANSLATE_COMMA($total));
+ define('__TOTAL', translateComma($total));
// Check if we need to display form or not with manuel withdraw
- if (getConfig('last_month') == date("m", time())) {
+ if (getConfig('last_month') == date('m', time())) {
// Load form
define('__BEG_WITHDRAW_FORM', LOAD_TEMPLATE("admin_list_beg_form", true));
} else {
// Prepare constant for timemark
if (EXT_IS_ACTIVE('autopurge')) {
- define('__AUTOPURGE_TIMEOUT', MAKE_DATETIME(time() - getConfig('ap_inactive_since'), "2"));
+ define('__AUTOPURGE_TIMEOUT', generateDateTime(time() - getConfig('ap_inactive_since'), "2"));
} else {
define('__AUTOPURGE_TIMEOUT', sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), 'autopurge'));
}
// Shall I withdraw now?
if (REQUEST_ISSET_POST(('withdraw'))) {
// Okay, let's prepare...
- $curr = date("m", time()) - 1;
- if (strlen($curr) == 1) $curr = "0".$curr;
- UPDATE_CONFIG("last_month", $curr);
+ $curr = date('m', time()) - 1;
+ if (strlen($curr) == 1) $curr = '0'.$curr;
+ updateConfiguration('last_month', $curr);
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_BONUS_WITHDRAW_PREPARED'));
- }
+ } // END - if
if (GET_EXT_VERSION('bonus') >= '0.6.9') {
// Add more bonus points here
$lastOnline = "%s"; $ONLINE = '';
if (EXT_IS_ACTIVE('autopurge')) {
// Use last online timestamp to keep inactive members away from here
- $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+ $lastOnline = " AND `last_online` >= (UNIX_TIMESTAMP() - %s)";
$ONLINE = getConfig('ap_inactive_since');
}
}
// Prepare content
- $content['uid'] = ADMIN_USER_PROFILE_LINK($content['uid']);
- $content['email'] = CREATE_EMAIL_LINK($content['email'], "user_data");
- $content['gender'] = TRANSLATE_GENDER($content['gender']);
- $content['points'] = TRANSLATE_COMMA($content['points']);
- $content['last'] = MAKE_DATETIME($content['last'], "2");
+ $content['uid'] = generateUserProfileLink($content['uid']);
+ $content['email'] = generateMemberEmailLink($content['email'], "user_data");
+ $content['gender'] = translateGender($content['gender']);
+ $content['points'] = translateComma($content['points']);
+ $content['last'] = generateDateTime($content['last'], "2");
$content['sw'] = $SW;
$content['win1'] = $WIN1;
$content['win2'] = $WIN2;
$SW = 3 - $SW; $cnt++;
}
define('__BONUS_ROWS', $OUT);
- define('__TOTAL', TRANSLATE_COMMA($total));
+ define('__TOTAL', translateComma($total));
// Check if we need to display form or not with manuel withdraw
- if (getConfig('last_month') == date("m", time())) {
+ if (getConfig('last_month') == date('m', time())) {
// Load form
define('__BONUS_WITHDRAW_FORM', LOAD_TEMPLATE("admin_list_bonus_form", true));
} else {
// Prepare constant for timemark
if (EXT_IS_ACTIVE('autopurge')) {
- define('__AUTOPURGE_TIMEOUT', MAKE_DATETIME(time() - getConfig('ap_inactive_since'), "2"));
+ define('__AUTOPURGE_TIMEOUT', generateDateTime(time() - getConfig('ap_inactive_since'), "2"));
} else {
define('__AUTOPURGE_TIMEOUT', sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), 'autopurge'));
}
// Prepare constants
define('__CATS_BASE' , "<a href=\"{!URL!}/modules.php?module=admin&uid=");
define('__UID' , bigintval(REQUEST_GET('uid')));
- define('__MEMBER_LINKS', MEMBER_ACTION_LINKS(constant('__UID')));
- define('__EMAIL' , "<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$sname." ".$fname."</a>");
+ define('__MEMBER_LINKS', generateMemberAdminActionLinks(constant('__UID')));
+ define('__EMAIL' , "<a href=\"".generateMemberEmailLink($email, "user_data")."\">".$sname." ".$fname."</a>");
// Ok, list categories of this user
$result_cats = SQL_QUERY("SELECT id, cat FROM `{!_MYSQL_PREFIX!}_cats` ORDER BY `sort`", __FILE__, __LINE__);
$cnt = 1; $OUT = ''; $SW = 2;
while ($content = SQL_FETCHARRAY($result_cats)) {
// Check user's selection
- $result_user = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s AND cat_id=%s LIMIT 1",
+ $result_user = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s AND cat_id=%s LIMIT 1",
array(bigintval(REQUEST_GET('uid')), bigintval($content['id'])), __FILE__, __LINE__);
// Set selection
// Add new code?
if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('code'))) && (REQUEST_ISSET_POST(('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(REQUEST_POST('code'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// Save entry
// Display message
LOAD_TEMPLATE('admin_settings_saved', false, $message);
-} elseif ((REQUEST_ISSET_POST('change')) && (REQUEST_ISSET_POST(('id')))) {
+} elseif ((REQUEST_ISSET_POST('change')) && (REQUEST_ISSET_POST('id'))) {
// Change all status
ADMIN_CHANGE_ACTIVATION_STATUS(REQUEST_POST('id'), "countries", "is_active");
'url' => 'modules.php?module=admin&what=list_country',
'title' => getMessage('ADMIN_COUNTRY_ACTIVATION_NEXT_LINK')
));
-} elseif (((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('delete'))) && (REQUEST_ISSET_POST(('id')))) {
+} elseif (((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('delete'))) && (REQUEST_ISSET_POST('id'))) {
if (count(REQUEST_POST('id')) > 0) {
if (REQUEST_ISSET_POST('edit')) {
// Edit template
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('id') as $id => $status) {
// Load data from DB
- $result = SQL_QUERY_ESC("SELECT code, descr FROM `{!_MYSQL_PREFIX!}_countries` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT code, descr FROM `{!_MYSQL_PREFIX!}_countries` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load data
if ($post == 'modify') {
// Generate default selection in edit-mode
- $content['status'] = ADD_OPTION_LINES('/ARRAY/', array('Y', 'N'), array(getMessage('YES'), getMessage('NO')), $status);
+ $content['status'] = generateOptionList('/ARRAY/', array('Y', 'N'), array(getMessage('YES'), getMessage('NO')), $status);
} else {
// Only display status when in delete-mode
- $content['status'] = TRANSLATE_YESNO($status);
+ $content['status'] = translateYesNo($status);
}
// Insert row template and switch color
} else {
// Shall we modify / remove entries now?
$message = ''; INIT_SQLS();
- if ((REQUEST_ISSET_POST(('modify'))) && (REQUEST_ISSET_POST(('id')))) {
+ if ((REQUEST_ISSET_POST(('modify'))) && (REQUEST_ISSET_POST('id'))) {
// Modify
foreach (REQUEST_POST('id') as $id => $sel) {
ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_countries` SET `code`='".REQUEST_POST('code', $id)."', `descr`='".REQUEST_POST('descr', $id)."', `is_active`='".REQUEST_POST('is_active', $id)."' WHERE `id`='".$id."' LIMIT 1");
// Create message
$message = getMessage('ADMIN_COUNTRIES_MODIFIED');
- } elseif ((REQUEST_ISSET_POST('remove')) && (REQUEST_ISSET_POST(('id')))) {
+ } elseif ((REQUEST_ISSET_POST('remove')) && (REQUEST_ISSET_POST('id'))) {
// Remove
$IDs = implode(',', array_keys(REQUEST_POST('id')));
ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_countries` WHERE `id` IN (".$IDs.") LIMIT ".count(REQUEST_POST('id'))."");
'id' => $content['id'],
'code' => $content['code'],
'name' => $content['descr'],
- 'active' => TRANSLATE_YESNO($content['is_active']),
+ 'active' => translateYesNo($content['is_active']),
'sw' => $SW,
'status' => $content['is_active'],
);
list($cnt) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- if ((empty($cnt)) || ($cnt == "0"))
+ if ((empty($cnt)) || ($cnt == '0'))
{
// Nothing payed out so far
- define('__DOUBLER_ALREADY_DIRECT_LINK', "0");
+ define('__DOUBLER_ALREADY_DIRECT_LINK', '0');
}
else
{
list($cnt) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- if ((empty($cnt)) || ($cnt == "0"))
+ if ((empty($cnt)) || ($cnt == '0'))
{
// Nothing payed out so far
- define('__DOUBLER_ALREADY_REF_LINK', "0");
+ define('__DOUBLER_ALREADY_REF_LINK', '0');
}
else
{
list($cnt) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- if ((empty($cnt)) || ($cnt == "0"))
+ if ((empty($cnt)) || ($cnt == '0'))
{
// Nothing payed out so far
- define('__DOUBLER_WAITING_DIRECT_LINK', "0");
+ define('__DOUBLER_WAITING_DIRECT_LINK', '0');
}
else
{
list($cnt) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- if ((empty($cnt)) || ($cnt == "0"))
+ if ((empty($cnt)) || ($cnt == '0'))
{
// Nothing payed out so far
- define('__DOUBLER_WAITING_REF_LINK', "0");
+ define('__DOUBLER_WAITING_REF_LINK', '0');
}
else
{
$content = array(
'sw' => $SW,
'id' => $content['id'],
- 'uid' => ADMIN_USER_PROFILE_LINK($content['userid']),
- 'start' => MAKE_DATETIME($content['holiday_start'], "3"),
- 'end' => MAKE_DATETIME($content['holiday_end'], "3"),
+ 'uid' => generateUserProfileLink($content['userid']),
+ 'start' => generateDateTime($content['holiday_start'], "3"),
+ 'end' => generateDateTime($content['holiday_end'], "3"),
'comments' => wordwrap($content['comments'], 15),
- 'status' => TRANSLATE_STATUS($content['status']),
- 'last' => MAKE_DATETIME($content['last_online'], "3"),
+ 'status' => translateUserStatus($content['status']),
+ 'last' => generateDateTime($content['last_online'], "3"),
);
// Load row template and switch color
// Prepare mail and send it away
$msg = LOAD_EMAIL_TEMPLATE("admin-del_links", $nums, bigintval(REQUEST_GET('uid')));
- SEND_EMAIL($email, getMessage('ADMIN_DEL_LINK_SUBJ'), $msg);
+ sendEmail($email, getMessage('ADMIN_DEL_LINK_SUBJ'), $msg);
// Display message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_LINKS_DELETED'));
switch ($type)
{
case "NORMAL":
- $result_data = SQL_QUERY_ESC("SELECT subject, timestamp_ordered, cat_id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE id=%s LIMIT 1",
+ $result_data = SQL_QUERY_ESC("SELECT subject, timestamp_ordered, cat_id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
$type = 'mailid'; $DATA = $id; $PROBLEM = getMessage('NORMAL_MAIL_PROBLEM');
$LINK = "<a href=\"{!URL!}/mailid.php?uid=".REQUEST_GET('uid')."&mailid=".$id."\" target=\"_blank\">".$id."</a>";
break;
case "BONUS":
- $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id=%s LIMIT 1",
+ $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
array(bigintval($id2)), __FILE__, __LINE__);
$type = 'bonusid'; $DATA = $id2; $PROBLEM = getMessage('BONUS_MAIL_PROBLEM');
$LINK = "<a href=\"{!URL!}/mailid.php?uid=".REQUEST_GET('uid')."&bonusid=".$id2."\" target=\"_blank\">".$id2."</a>";
'sw' => $SW,
'link' => $LINK,
'subj' => $subject,
- 'stamp' => MAKE_DATETIME($timestamp, "0"),
- 'cat' => GET_CATEGORY($cat),
+ 'stamp' => generateDateTime($timestamp, '0'),
+ 'cat' => getCategory($cat),
);
// Load row template
// Remember list in constant for the template
define('__SNAME_VALUE', $sname);
define('__FNAME_VALUE', $fname);
- define('__EMAIL_VALUE', "<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</a>");
+ define('__EMAIL_VALUE', "<a href=\"".generateMemberEmailLink($email, "user_data")."\">".$email."</a>");
define('__EMAIL_LIST' , $OUT);
define('__NUMS_VALUE' , $nums);
define('__UID' , bigintval(REQUEST_GET('uid')));
// Add description as navigation point
ADD_DESCR('admin', __FILE__);
-if ((REQUEST_ISSET_POST('uid')) && (REQUEST_ISSET_POST(('id')))) {
+if ((REQUEST_ISSET_POST('uid')) && (REQUEST_ISSET_POST('id'))) {
// Update database...
// First user's account
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET nl_until=(UNIX_TIMESTAMP() + nl_timespan), nl_receive='N', nl_timespan=0 WHERE userid=%s LIMIT 1",
// Send mail to user
$msg = LOAD_EMAIL_TEMPLATE("member_newsletter_done", true, bigintval(REQUEST_POST('uid')));
- SEND_EMAIL(bigintval(REQUEST_POST('uid')), NL_MEMBER_DONE_SUBJECT, $msg);
+ sendEmail(bigintval(REQUEST_POST('uid')), getMessage('NL_MEMBER_DONE_SUBJECT'), $msg);
// Output message to admin
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NL_MEMBER_DONE'));
// Prepare content
$content = $bonus;
- $content['time'] = CREATE_FANCY_TIME($content['time']);
- $content['category'] = GET_CATEGORY($content['cat_id']);
+ $content['time'] = createFancyTime($content['time']);
+ $content['category'] = getCategory($content['cat_id']);
$content['receivers'] = str_replace(';', ", ", $content['receivers']);
- $content['type'] = TRANSLATE_POOL_TYPE($content['data_type']);
+ $content['type'] = translatePoolType($content['data_type']);
$content['frametester'] = FRAMETESTER($content['url']);
- $content['timestamp'] = MAKE_DATETIME($content['timestamp'], "0");
+ $content['timestamp'] = generateDateTime($content['timestamp'], '0');
// Load row template
$OUT .= LOAD_TEMPLATE("admin_list_notify_emails_row", true, $content);
if (REQUEST_ISSET_GET(('pid'))) {
// First let's get the member's ID
- $result = SQL_QUERY_ESC("SELECT userid, target_account, payout_total, payout_timestamp, password FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT userid, target_account, payout_total, payout_timestamp, password FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE `id`=%s LIMIT 1",
array(REQUEST_GET('pid')), __FILE__, __LINE__);
list($uid, $tuid, $points, $tstamp, $tpass) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Obtain some data
if (!REQUEST_ISSET_GET(('task')) && (!empty($uid)) && ($uid > 0)) {
// Get task ID from database
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_task_system` WHERE userid=%s AND task_type='PAYOUT_REQUEST' AND task_created='".$tstamp."' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE userid=%s AND `task_type`='PAYOUT_REQUEST' AND task_created='".$tstamp."' LIMIT 1",
array(bigintval($uid)), __FILE__, __LINE__);
list($task) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if (empty($task)) $task = 0;
- } elseif ((empty($uid)) || ($uid == "0")) {
+ } elseif ((empty($uid)) || ($uid == '0')) {
// Cannot obtain member ID!
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PAYOUT_FAILED_OBTAIN_USERID'));
} else {
SQL_FREERESULT($result);
// Konstante bauen
- define('PAYOUT_USERDATA_VALUE', "<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".TRANSLATE_GENDER($gender)." ".$surname." ".$family."</a>");
+ define('PAYOUT_USERDATA_VALUE', "<a href=\"".generateMemberEmailLink($email, "user_data")."\">".translateGender($gender)." ".$surname." ".$family."</a>");
if ((REQUEST_GET('do') == "accept") && (!empty($email))) {
// Ok, now we can output the form or execute accepting
if (IS_FORM_SENT()) {
// Obtain payout type and other data
- $result = SQL_QUERY_ESC("SELECT payout_id FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT payout_id FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
list($ptype) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if (!empty($ptype)) {
// Obtain data from payout type
- $result = SQL_QUERY_ESC("SELECT from_account, from_pass, engine_url, engine_ret_ok, engine_ret_failed, pass_enc, allow_url FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT from_account, from_pass, engine_url, engine_ret_ok, engine_ret_failed, pass_enc, allow_url FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE `id`=%s LIMIT 1",
array(bigintval($ptype)), __FILE__, __LINE__);
list($fuid, $fpass, $eurl, $eok, $failed, $eenc, $allow) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
eval($eval);
// Execute transfer
- $ret = GET_URL($URL);
+ $ret = sendGetRequest($URL);
} else {
// No URL to run
$ret[0] = $eok;
}
// Clear payout request
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET `status`='ACCEPTED' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET `status`='ACCEPTED' WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
// Send out mail
}
// Finally send mail
- SEND_EMAIL($email, PAYOUT_ACCEPTED_SUBJECT, $msg);
+ sendEmail($email, getMessage('PAYOUT_ACCEPTED_SUBJECT'), $msg);
} else {
// Something goes wrong... :-(
$content = implode("<br />", $ret);
}
// Clear payout request
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET `status`='REJECTED' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET `status`='REJECTED' WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
// Send out mail
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PAYOUT_REJECTED_NOTIFIED'));
// Finally send mail
- SEND_EMAIL($email, getMessage('PAYOUT_REJECTED_SUBJECT'), $msg);
+ sendEmail($email, getMessage('PAYOUT_REJECTED_SUBJECT'), $msg);
} else {
// Prepare content
$content = array(
// Cannot load user data
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PAYOUT_FAILED_OBTAIN_USERDATA'));
}
- } elseif ((empty($task)) || ($task == "0")) {
+ } elseif ((empty($task)) || ($task == '0')) {
// Failed loading task ID
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PAYOUT_FAILED_OBTAIN_TASK_ID'));
}
// Remember data in array for the template
$content = array(
'sw' => $SW,
- 'ulink' => ADMIN_USER_PROFILE_LINK($content['userid']),
- 'ptype' => TRANSLATE_COMMA($content['payout_total'])." ".COMPILE_CODE($content['type']),
+ 'ulink' => generateUserProfileLink($content['userid']),
+ 'ptype' => translateComma($content['payout_total'])." ".COMPILE_CODE($content['type']),
'account' => $content['target_account'],
'bank' => $content['target_bank'],
- 'tstamp' => MAKE_DATETIME($content['payout_timestamp'], "2"),
+ 'tstamp' => generateDateTime($content['payout_timestamp'], "2"),
'status' => $content['status'],
);
while ($content = SQL_FETCHARRAY($result)) {
// Translate some data and add color
$content['sw'] = $SW;
- $content['link'] = ADMIN_USER_PROFILE_LINK($content['userid']);
- $content['primera_amount'] = TRANSLATE_COMMA($content['primera_amount']);
- $content['primera_timestamp'] = MAKE_DATETIME($content['primera_timestamp'], "2");
+ $content['link'] = generateUserProfileLink($content['userid']);
+ $content['primera_amount'] = translateComma($content['primera_amount']);
+ $content['primera_timestamp'] = generateDateTime($content['primera_timestamp'], "2");
$content['raw_type'] = strtolower($content['primera_type']);
$content['primera_type'] = PRIMERA_TRANSFER_STATUS($content['primera_type']);
switch (REQUEST_GET('activate'))
{
case "1": // Activate
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='Y' WHERE id=%s AND is_active='N' LIMIT 1");
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='Y' WHERE `id`=%s AND is_active='N' LIMIT 1");
break;
- case "0": // Deactivate
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='N' WHERE id=%s AND is_active='Y' LIMIT 1");
+ case '0': // Deactivate
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='N' WHERE `id`=%s AND is_active='Y' LIMIT 1");
break;
}
} elseif (REQUEST_ISSET_GET(('notify'))) {
switch (REQUEST_GET('notify'))
{
case "1": // Activate
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='Y' WHERE id=%s AND send_notify='N' LIMIT 1");
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='Y' WHERE `id`=%s AND send_notify='N' LIMIT 1");
break;
- case "0": // Deactivate
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='N' WHERE id=%s AND send_notify='Y' LIMIT 1");
+ case '0': // Deactivate
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='N' WHERE `id`=%s AND send_notify='Y' LIMIT 1");
break;
}
} elseif (REQUEST_ISSET_GET(('auto'))) {
switch (REQUEST_GET('auto'))
{
case "1": // Activate
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='Y' WHERE id=%s AND auto_add_new_user='N' LIMIT 1");
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='Y' WHERE `id`=%s AND auto_add_new_user='N' LIMIT 1");
break;
- case "0": // Deactivate
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='N' WHERE id=%s AND auto_add_new_user='Y' LIMIT 1");
+ case '0': // Deactivate
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='N' WHERE `id`=%s AND auto_add_new_user='Y' LIMIT 1");
break;
}
}
runFilterChain('run_sqls');
} elseif (REQUEST_ISSET_POST('remove')) {
// Delete rallyes
- $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+ $SEL = countPostSelection();
if ($SEL > 0) {
// Init SQLs
INIT_SQLS();
// Delete selected rallyes and all it's data
foreach (REQUEST_POST('sel') as $id => $selected) {
// Remove selected rallye entirely...
- ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE id=%s LIMIT 1",
+ ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__, false));
ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s",
array(bigintval($id)), __FILE__, __LINE__, false));
}
} elseif (REQUEST_ISSET_POST('change')) {
// Change rallye
- $SEL = SELECTION_COUNT(REQUEST_POST('title'));
+ $SEL = countSelection(REQUEST_POST('title'));
if ($SEL > 0) {
// Init SQLs
INIT_SQLS();
end_time='%s',
min_users='%s',
min_prices='%s'
-WHERE id='".$id."' LIMIT 1",
+WHERE `id`='".$id."' LIMIT 1",
array(
$title,
REQUEST_POST('descr', $id),
if (REQUEST_ISSET_POST('edit')) {
// Check for selections
- $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+ $SEL = countPostSelection();
if ($SEL > 0) {
// Make all selected and deactivated rallyes editable
$OUT = ''; $SW = 2;
SQL_FREERESULT($result);
// Starting day
- $content['s_sec'] = ADD_SELECTION("sec" , date("s", $content['start_time']), "start", $id);
- $content['s_min'] = ADD_SELECTION("min" , date("i", $content['start_time']), "start", $id);
- $content['s_hour'] = ADD_SELECTION("hour" , date("G", $content['start_time']), "start", $id);
- $content['s_day'] = ADD_SELECTION("day" , date("d", $content['start_time']), "start", $id);
- $content['s_month'] = ADD_SELECTION("month", date("m", $content['start_time']), "start", $id);
- $content['s_year'] = ADD_SELECTION("year" , date('Y', $content['start_time']), "start", $id);
+ $content['s_sec'] = ADD_SELECTION('sec' , date('s', $content['start_time']), 'start', $id);
+ $content['s_min'] = ADD_SELECTION('min' , date('i', $content['start_time']), 'start', $id);
+ $content['s_hour'] = ADD_SELECTION('hour' , date('G', $content['start_time']), 'start', $id);
+ $content['s_day'] = ADD_SELECTION('day' , date('d', $content['start_time']), 'start', $id);
+ $content['s_month'] = ADD_SELECTION('month', date('m', $content['start_time']), 'start', $id);
+ $content['s_year'] = ADD_SELECTION('year' , date('Y', $content['start_time']), 'start', $id);
// Ending day
- $content['e_sec'] = ADD_SELECTION("sec" , date("s", $content['end_time']) , "end" , $id);
- $content['e_min'] = ADD_SELECTION("min" , date("i", $content['end_time']) , "end" , $id);
- $content['e_hour'] = ADD_SELECTION("hour" , date("G", $content['end_time']) , "end" , $id);
- $content['e_day'] = ADD_SELECTION("day" , date("d", $content['end_time']) , "end" , $id);
- $content['e_month'] = ADD_SELECTION("month", date("m", $content['end_time']) , "end" , $id);
- $content['e_year'] = ADD_SELECTION("year" , date('Y', $content['end_time']) , "end" , $id);
+ $content['e_sec'] = ADD_SELECTION('sec' , date('s', $content['end_time']) , 'end' , $id);
+ $content['e_min'] = ADD_SELECTION('min' , date('i', $content['end_time']) , 'end' , $id);
+ $content['e_hour'] = ADD_SELECTION('hour' , date('G', $content['end_time']) , 'end' , $id);
+ $content['e_day'] = ADD_SELECTION('day' , date('d', $content['end_time']) , 'end' , $id);
+ $content['e_month'] = ADD_SELECTION('month', date('m', $content['end_time']) , 'end' , $id);
+ $content['e_year'] = ADD_SELECTION('year' , date('Y', $content['end_time']) , 'end' , $id);
// Remember other values
- $content['templ'] = RALLYE_TEMPLATE_SELECTION("templ[".$id."]", $content['template']);
+ $content['templ'] = RALLYE_TEMPLATE_SELECTION('templ['.$id.']', $content['template']);
$content['sw'] = $SW;
$content['id'] = $id;
// Output row
- $OUT .= LOAD_TEMPLATE("admin_edit_rallyes_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_edit_rallyes_row', true, $content);
// Color switching
$SW = 3 - $SW;
define('__RALLYE_ROWS', $OUT);
// Load final template
- LOAD_TEMPLATE("admin_edit_rallyes");
+ LOAD_TEMPLATE('admin_edit_rallyes');
} else {
// Nothing selected to edit
- LOAD_TEMPLATE('admin_settings_saved', false, LOAD_TEMPLATE("admin_list_rallye_noselect", true));
+ LOAD_TEMPLATE('admin_settings_saved', false, LOAD_TEMPLATE('admin_list_rallye_noselect', true));
}
-} elseif ((REQUEST_GET('sub') == "users") && (REQUEST_GET('rallye') > 0)) {
+} elseif ((REQUEST_GET('sub') == 'users') && (REQUEST_GET('rallye') > 0)) {
// List users and their refs before start and current
- $result = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s ORDER BY userid",
+ $result = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s ORDER BY `userid` ASC",
array(bigintval(REQUEST_GET('rallye'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
$OUT = ''; $SW = 2;
if (($content['curr_points'] > 0) && ($cnt > 0)) { $bl = "<strong>"; $br = "</strong>"; }
if (($content['refs'] > 0) || ($cnt > 0)) {
// Insert link to referal list
- //* DEBUG: */ echo "-".$content['userid']."/".$cnt."/".$content['refs']."-<br />";
- $cnt = ADMIN_USER_PROFILE_LINK($content['userid'], $cnt, "list_refs");
- $content['refs'] = ADMIN_USER_PROFILE_LINK($content['userid'], $content['refs'], "list_refs");
+ //* DEBUG: */ echo '-'.$content['userid'].'/'.$cnt.'/'.$content['refs']."-<br />";
+ $cnt = generateUserProfileLink($content['userid'], $cnt, "list_refs");
+ $content['refs'] = generateUserProfileLink($content['userid'], $content['refs'], "list_refs");
} // END - if
// Get user points
'bold_r' => $br ,
'old' => $content['refs'],
'cnt' => $cnt,
- 'opoints' => TRANSLATE_COMMA($points - $content['curr_points']),
+ 'opoints' => translateComma($points - $content['curr_points']),
);
// Load row template and switch color
- $OUT .= LOAD_TEMPLATE("admin_list_rallye_usr_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_list_rallye_usr_row', true, $content);
$SW = 3 - $SW;
} // END - while
define('__RALLYE_USER_ROWS', $OUT);
// Load template
- LOAD_TEMPLATE("admin_list_rallye_usr");
+ LOAD_TEMPLATE('admin_list_rallye_usr');
} else {
// No entries found?
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('RALLYE_ADMIN_USERS_404'));
$OUT = ''; $SW = 2;
while ($content = SQL_FETCHARRAY($result)) {
// Load admin login
- $content['alogin'] = GET_ADMIN_LOGIN($content['admin_id']);
+ $content['alogin'] = getAdminLogin($content['admin_id']);
// Count joined userids
$joined = GET_TOTAL_DATA($content['id'], "rallye_users", "id", "rallye_id", true);
} // END - if
// Alter some variables
- if (empty($content['alogin'])) $content['alogin'] = "???";
+ if (empty($content['alogin'])) $content['alogin'] = '???';
if (empty($content['template'])) $content['template'] = '---';
if (empty($content['descr'])) $content['descr'] = '---';
$content = array(
'select' => "<input type=\"checkbox\" name=\"sel[".$content['id']."]\" class=\"admin_normal\" value=\"1\" />",
'aid' => $content['admin_id'],
- 'email_link' => CREATE_EMAIL_LINK($content['admin_id']),
+ 'email_link' => generateMemberEmailLink($content['admin_id']),
'alogin' => $content['alogin'],
'id' => $content['id'],
'sw' => $SW,
'title' => $content['title'],
'template' => $content['template'],
'joined' => $joined,
- 'start_date' => MAKE_DATETIME($content['start_time'], "2"),
- 'end_date' => MAKE_DATETIME($content['end_time'] , "2"),
- 'active_lnk' => TRANSLATE_YESNO($content['is_active']),
- 'notify_lnk' => TRANSLATE_YESNO($content['send_notify']),
- 'auto_lnk' => TRANSLATE_YESNO($content['auto_add_new_user']),
- 'notified' => TRANSLATE_YESNO($content['notified']),
- 'prices_cnt' => TRANSLATE_COMMA(GET_TOTAL_DATA($content['id'], "rallye_prices", "id", "rallye_id", true)),
+ 'start_date' => generateDateTime($content['start_time'], '2'),
+ 'end_date' => generateDateTime($content['end_time'] , '2'),
+ 'active_lnk' => translateYesNo($content['is_active']),
+ 'notify_lnk' => translateYesNo($content['send_notify']),
+ 'auto_lnk' => translateYesNo($content['auto_add_new_user']),
+ 'notified' => translateYesNo($content['notified']),
+ 'prices_cnt' => translateComma(GET_TOTAL_DATA($content['id'], 'rallye_prices', 'id', 'rallye_id', true)),
'descr' => COMPILE_CODE($content['descr']),
'min_users' => $content['min_users'],
'min_prices' => $content['min_prices'],
case 'N':
$content['active_title'] = getMessage('RALLYE_ACTIVATE_NOW');
- $content['active'] = "1";
+ $content['active'] = '1';
break;
}
case 'N':
$content['notify_title'] = getMessage('RALLYE_START_NOTIFY_NOW');
- $content['notify'] = "1";
+ $content['notify'] = '1';
break;
}
case 'N':
$content['auto_title'] = getMessage('RALLYE_START_AUTO_ADD_NOW');
- $content['auto'] = "1";
+ $content['auto'] = '1';
break;
}
// Output row
- $OUT .= LOAD_TEMPLATE("admin_list_rallyes_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_list_rallyes_row', true, $content);
$SW = 3 - $SW;
}
define('__RALLYE_ROWS', $OUT);
// Load template
- LOAD_TEMPLATE("admin_list_rallyes");
+ LOAD_TEMPLATE('admin_list_rallyes');
} else {
// No rallyes setup so far
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('RALLYE_NO_RALLYES_SETUP'));
// Loads surname, family's name and the email address
$result = SQL_QUERY_ESC("SELECT COUNT(*) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE refid=%s",
array($uid), __FILE__, __LINE__);
- $result_lck = SQL_QUERY_ESC("SELECT COUNT(*) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE refid=%s AND status != 'CONFIRMED' ORDER BY userid",
+ $result_lck = SQL_QUERY_ESC("SELECT COUNT(*) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE refid=%s AND status != 'CONFIRMED' ORDER BY `userid` ASC",
array($uid), __FILE__, __LINE__);
$menge = SQL_RESULT($result , 0, 0);
$menge_lck = SQL_RESULT($result_lck, 0, 0);
array($uid), __FILE__, __LINE__);
// Output info message
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), ADMIN_USER_PROFILE_LINK(REQUEST_GET('uid')), $menge, $menge_lck));
+ LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink(REQUEST_GET('uid')), $menge, $menge_lck));
}
// Are there some levels (VERY BAD IF NONE!)
// Load all refs of this user
$result_refs = SQL_QUERY_ESC("SELECT refid FROM `{!_MYSQL_PREFIX!}_user_refs` WHERE userid=%s AND level='%s' ORDER BY refid ASC",
array($uid, $levels['level']), __FILE__, __LINE__);
- //* DEBUG: */ echo $uid."/".$levels['level']."/".SQL_NUMROWS($result_refs)."<br />\n";
+ //* DEBUG: */ echo $uid.'/'.$levels['level'].'/'.SQL_NUMROWS($result_refs)."<br />\n";
// Do we have levels?
if (SQL_NUMROWS($result_refs) > 0) {
// Loads surname, family's name and the email address
$result = SQL_QUERY_ESC("SELECT COUNT(*) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE refid=%s",
array($uid), __FILE__, __LINE__);
- $result_lck = SQL_QUERY_ESC("SELECT COUNT(*) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE refid=%s AND status != 'CONFIRMED' ORDER BY userid",
+ $result_lck = SQL_QUERY_ESC("SELECT COUNT(*) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE refid=%s AND status != 'CONFIRMED' ORDER BY `userid` ASC",
array($uid), __FILE__, __LINE__);
$menge = SQL_RESULT($result , 0, 0);
$menge_lck = SQL_RESULT($result_lck, 0, 0);
SQL_FREERESULT($result_lck);
// Output info message
- $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), ADMIN_USER_PROFILE_LINK($uid), $menge, $menge_lck);
+ $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink($uid), $menge, $menge_lck);
// Init variables
$OUT_REFS = ''; $SW = 2;
// Prepare data for the template
$content = array(
'sw' => $SW,
- 'u_link' => ADMIN_USER_PROFILE_LINK($data['userid']),
- 'gender' => TRANSLATE_GENDER($data['gender']),
- 'refs_link' => "0",
+ 'u_link' => generateUserProfileLink($data['userid']),
+ 'gender' => translateGender($data['gender']),
+ 'refs_link' => '0',
'surname' => $data['surname'],
'family' => $data['family'],
- 'email' => "[<a href=\"".CREATE_EMAIL_LINK($data['email'], "user_data")."\">".$data['email']."</a>]",
- 'status' => TRANSLATE_STATUS($data['status']),
- 'registered' => MAKE_DATETIME($data['joined'], "3"),
+ 'email' => "[<a href=\"".generateMemberEmailLink($data['email'], "user_data")."\">".$data['email']."</a>]",
+ 'status' => translateUserStatus($data['status']),
+ 'registered' => generateDateTime($data['joined'], "3"),
);
// Check if referal count is larger 0 and update link
- if ($refs_cnt > 0) $content['refs_link'] = ADMIN_USER_PROFILE_LINK($data['userid'], $refs_cnt, "list_refs");
+ if ($refs_cnt > 0) $content['refs_link'] = generateUserProfileLink($data['userid'], $refs_cnt, "list_refs");
// Load template for level one
$OUT_REFS .= LOAD_TEMPLATE("admin_list_refs_row", true, $content);
} // END - while
} else {
// Output info message
- $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), ADMIN_USER_PROFILE_LINK($uid), "0", "0");
+ $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink($uid), '0', '0');
// No refs found
$levels['rows'] = LOAD_TEMPLATE("admin_list_refs_norefs", true, array('uid' => $uid));
// Prepare data for the template
$content = array(
'sw' => $SW,
- 'u_link' => ADMIN_USER_PROFILE_LINK($levels['userid']),
- 'gender' => TRANSLATE_GENDER($levels['gender']),
- 'refs_link' => "0",
+ 'u_link' => generateUserProfileLink($levels['userid']),
+ 'gender' => translateGender($levels['gender']),
+ 'refs_link' => '0',
'surname' => $levels['surname'],
'family' => $levels['family'],
- 'email' => "[<a href=\"".CREATE_EMAIL_LINK($levels['email'], "user_data")."\">".$levels['email']."</a>]",
- 'status' => TRANSLATE_STATUS($levels['status']),
- 'registered' => MAKE_DATETIME($levels['joined'], "3"),
+ 'email' => "[<a href=\"".generateMemberEmailLink($levels['email'], "user_data")."\">".$levels['email']."</a>]",
+ 'status' => translateUserStatus($levels['status']),
+ 'registered' => generateDateTime($levels['joined'], "3"),
);
// Check if referal count is larger 0 and update link
- if ($refs_cnt > 0) $content['refs_link'] = ADMIN_USER_PROFILE_LINK($levels['userid'], $refs_cnt, "list_refs");
+ if ($refs_cnt > 0) $content['refs_link'] = generateUserProfileLink($levels['userid'], $refs_cnt, "list_refs");
// Load template for level one
$OUT .= LOAD_TEMPLATE("admin_list_refs_row", true, $content);
// Prepare content
$content = array(
'rows' => $OUT,
- 'uid' => ADMIN_USER_PROFILE_LINK(REQUEST_GET('uid'))
+ 'uid' => generateUserProfileLink(REQUEST_GET('uid'))
);
// Load main template
// Add description as navigation point
ADD_DESCR('admin', __FILE__);
-if (REQUEST_ISSET_GET(('id'))) {
+if (REQUEST_ISSET_GET('id')) {
// Show detailed informations to a sponsor
$result = SQL_QUERY_ESC("SELECT company, position, gender, surname, family, street_nr1, street_nr2, zip, city, country, phone, fax, cell, email, url, tax_ident, status, sponsor_created, last_online, last_change, receive_warnings, points_amount, points_used, remote_addr, warning_interval, refid, ref_count
FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE id='%s' LIMIT 1",
+WHERE `id`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
define('__SPONSOR_POSITION' , $DATA['position']);
define('__SPONSOR_TAX_IDENT' , $DATA['tax_ident']);
// Personal data
- define('__SPONSOR_GENDER' , TRANSLATE_GENDER($DATA['gender']));
+ define('__SPONSOR_GENDER' , translateGender($DATA['gender']));
define('__SPONSOR_SURNAME' , $DATA['surname']);
define('__SPONSOR_FAMILY' , $DATA['family']);
define('__SPONSOR_STREET1' , $DATA['street_nr1']);
define('__SPONSOR_EMAIL_VALUE', $DATA['email']);
define('__SPONSOR_URL' , DEREFERER($DATA['url']));
// Timestamps
- define('__SPONSOR_CREATED' , MAKE_DATETIME($DATA['sponsor_created'], "2"));
- define('__SPONSOR_LAST_ONLINE', MAKE_DATETIME($DATA['last_online'], "2"));
- define('__SPONSOR_LAST_CHANGE', MAKE_DATETIME($DATA['last_change'], "2"));
+ define('__SPONSOR_CREATED' , generateDateTime($DATA['sponsor_created'], "2"));
+ define('__SPONSOR_LAST_ONLINE', generateDateTime($DATA['last_online'], "2"));
+ define('__SPONSOR_LAST_CHANGE', generateDateTime($DATA['last_change'], "2"));
// Sponsor points
- define('__SPONSOR_AMOUNT' , TRANSLATE_COMMA($DATA['points_amount']));
- define('__SPONSOR_USED' , TRANSLATE_COMMA($DATA['points_used']));
+ define('__SPONSOR_AMOUNT' , translateComma($DATA['points_amount']));
+ define('__SPONSOR_USED' , translateComma($DATA['points_used']));
// Warning because low points
- define('__SPONSOR_REC_WARNING', TRANSLATE_YESNO($DATA['receive_warnings']));
- define('__SPONSOR_INTERVAL' , CREATE_FANCY_TIME($DATA['warning_interval']));
+ define('__SPONSOR_REC_WARNING', translateYesNo($DATA['receive_warnings']));
+ define('__SPONSOR_INTERVAL' , createFancyTime($DATA['warning_interval']));
// Orders total
define('__SPONSOR_ORDERS' , $orders);
// Other data
- define('__SPONSOR_STATUS' , SPONSOR_TRANSLATE_STATUS($DATA['status']));
+ define('__SPONSOR_STATUS' , sponsorTranslateUserStatus($DATA['status']));
define('__SPONSOR_REFID' , $DATA['refid']);
define('__SPONSOR_REMOTE_ADR' , $DATA['remote_addr']);
define('__SPONSOR_REFS' , $DATA['ref_count']);
}
} elseif (REQUEST_ISSET_GET(('rid'))) {
// Search for sponsor
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE id='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('rid'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Free memory
$content = array(
'id' => $content['id'],
'sw' => $SW,
- 'gender' => TRANSLATE_GENDER($content['gender']),
+ 'gender' => translateGender($content['gender']),
'sname' => $content['surname'],
'fname' => $content['family'],
'email' => "mailto:".$content['email'],
- 'status' => SPONSOR_TRANSLATE_STATUS($content['status']),
- 'created' => MAKE_DATETIME($content['sponsor_created'], "2"),
- 'last' => MAKE_DATETIME($content['last_online'], "2"),
- 'points' => TRANSLATE_COMMA($content['points_amount'] - $content['points_used']),
+ 'status' => sponsorTranslateUserStatus($content['status']),
+ 'created' => generateDateTime($content['sponsor_created'], "2"),
+ 'last' => generateDateTime($content['last_online'], "2"),
+ 'points' => translateComma($content['points_amount'] - $content['points_used']),
'ip' => $content['remote_addr'],
);
} elseif ((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('del')) || (REQUEST_ISSET_POST('change')) || (REQUEST_ISSET_POST('remove'))) {
// Check if at least one entry was selected
- if (!REQUEST_ISSET_POST(('id'))) {
+ if (!REQUEST_ISSET_POST('id')) {
// Nothing selected for editing / deleting???
REQUEST_UNSET_POST('edit');
REQUEST_UNSET_POST('del');
// Save entry
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_paytypes`
-SET pay_name='%s', pay_rate='%s', pay_min_count='%s', pay_currency='%s' WHERE id='%s' LIMIT 1",
+SET pay_name='%s', pay_rate='%s', pay_min_count='%s', pay_currency='%s' WHERE `id`='%s' LIMIT 1",
array(
REQUEST_POST('name', $id),
REQUEST_POST('rate', $id),
// Remove entries here...
foreach (REQUEST_POST('id') as $id => $sel) {
// Remove entry
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE id='%s' LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE `id`='%s' LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
}
if (REQUEST_ISSET_POST(('add'))) {
// Check if entry with same name does exists
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE pay_name='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE pay_name='%s' LIMIT 1",
array(REQUEST_POST('pay_name')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// No entry found so add this line
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_paytypes` (pay_name, pay_rate, pay_min_count, pay_currency) VALUES ('%s','%s','%s','%s')",
array(
htmlspecialchars(REQUEST_POST('pay_name')),
- REVERT_COMMA(REQUEST_POST('pay_rate')),
+ convertCommaToDot(REQUEST_POST('pay_rate')),
bigintval(REQUEST_POST('pay_min_count')),
htmlspecialchars(REQUEST_POST('pay_currency'))
), __FILE__, __LINE__);
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('id') as $id => $sel) {
// Load entry
- $result = SQL_QUERY_ESC("SELECT pay_name, pay_rate, pay_min_count, pay_currency FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE id='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT pay_name, pay_rate, pay_min_count, pay_currency FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE `id`='%s' LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load data
'id' => bigintval($id),
'sw' => bigintval($SW),
'name' => htmlspecialchars($name),
- 'rate' => TRANSLATE_COMMA($rate),
+ 'rate' => translateComma($rate),
'min' => bigintval($min),
'curr' => htmlspecialchars($curr)
);
'sw' => $SW,
'id' => $content['id'],
'name' => $content['pay_name'],
- 'rate' => TRANSLATE_COMMA($content['pay_rate']),
+ 'rate' => translateComma($content['pay_rate']),
'min' => $content['pay_min_count'],
'currency' => $content['pay_currency']
);
// Add description as navigation point
ADD_DESCR('admin', __FILE__);
-if (REQUEST_ISSET_GET(('id'))) {
+if (REQUEST_ISSET_GET('id')) {
// Check for selected sponsor
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE id='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// ...
$show = true;
// Check for 'id' element
-if ((REQUEST_POST_COUNT() > 0) && ((!REQUEST_ISSET_POST(('id'))) || (!is_array(REQUEST_POST('id'))) || (count(REQUEST_POST('id')) == 0))) {
+if ((REQUEST_POST_COUNT() > 0) && ((!REQUEST_ISSET_POST('id')) || (!is_array(REQUEST_POST('id'))) || (count(REQUEST_POST('id')) == 0))) {
// Not found so output message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_SURFBAR_NO_SELECTIONS'));
// Show entries for editing
ADMIN_EDIT_ENTRIES_CONFIRM(
REQUEST_POST('id'),
- "surfbar_urls",
- array("id", 'userid', "url"),
- array("bigintval", "ADD_MEMBER_SELECTION_BOX", ''),
- array("", array(false, true, true), '')
+ 'surfbar_urls',
+ array('id', 'userid', 'url'),
+ array('bigintval', 'ADD_MEMBER_SELECTION_BOX', ''),
+ array('', array(false, true, true), '')
);
$show = false;
} elseif (REQUEST_ISSET_POST(('do_edit'))) {
// Change data of entries
ADMIN_EDIT_ENTRIES_CONFIRM(
REQUEST_POST('id'),
- "surfbar_urls",
+ 'surfbar_urls',
array(),
array(),
array(),
// Show entries for deletion
ADMIN_DELETE_ENTRIES_CONFIRM(
REQUEST_POST('id'),
- "surfbar_urls",
- array("id", 'userid', "url", "registered"),
- array("bigintval", "ADMIN_USER_PROFILE_LINK", "FRAMETESTER", ''),
- array("", '', '', '')
+ 'surfbar_urls',
+ array('id', 'userid', 'url', 'registered'),
+ array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', ''),
+ array('', '', '', '')
);
$show = false;
} elseif (REQUEST_ISSET_POST(('do_delete'))) {
// Remove entries from database
- ADMIN_DELETE_ENTRIES_CONFIRM(REQUEST_POST('id'), "surfbar_urls", array(), array(), array(), true);
+ ADMIN_DELETE_ENTRIES_CONFIRM(REQUEST_POST('id'), 'surfbar_urls', array(), array(), array(), true);
} elseif (REQUEST_ISSET_POST(('lock'))) {
// Un-/lock selected URLs. This does not work for pending URLs
ADMIN_LOCK_ENTRIES_CONFIRM(
REQUEST_POST('id'),
- "surfbar_urls",
- array("id", 'userid', "url", "registered", "status"),
- array("bigintval", "ADMIN_USER_PROFILE_LINK", "FRAMETESTER", '', "SURFBAR_TRANSLATE_STATUS"),
- array("", '', '', '', '')
+ 'surfbar_urls',
+ array('id', 'userid', 'url', 'registered', 'status'),
+ array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'surfbarTranslateUserStatus'),
+ array('', '', '', '', '')
);
$show = false;
} elseif (REQUEST_ISSET_POST(('do_lock'))) {
// Un-/lock selected URLs. This does not work for pending URLs
ADMIN_LOCK_ENTRIES_CONFIRM(
REQUEST_POST('id'),
- "surfbar_urls",
+ 'surfbar_urls',
array(),
array(),
array(),
- array("status" => array("ACTIVE" => "LOCKED", "LOCKED" => "ACTIVE")),
+ array('status' => array('ACTIVE' => 'LOCKED', 'LOCKED' => 'ACTIVE')),
true
);
} elseif (REQUEST_ISSET_POST(('undelete'))) {
// Undelete selected URLs. This does only work for deleted URLs... ;-)
ADMIN_UNDELETE_ENTRIES_CONFIRM(
REQUEST_POST('id'),
- "surfbar_urls",
- array("id", 'userid', "url", "registered", "status"),
- array("bigintval", "ADMIN_USER_PROFILE_LINK", "FRAMETESTER", '', "SURFBAR_TRANSLATE_STATUS"),
- array("", '', '', '', '')
+ 'surfbar_urls',
+ array('id', 'userid', 'url', 'registered', 'status'),
+ array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'surfbarTranslateUserStatus'),
+ array('', '', '', '', '')
);
$show = false;
} elseif (REQUEST_ISSET_POST(('do_undelete'))) {
// Undelete selected URLs. This does only work for deleted URLs... ;-)
ADMIN_UNDELETE_ENTRIES_CONFIRM(
REQUEST_POST('id'),
- "surfbar_urls",
+ 'surfbar_urls',
array(),
array(),
array(),
- array("status" => array("DELETED" => "ACTIVE")),
+ array('status' => array('DELETED' => 'ACTIVE')),
true
);
}
while ($content = SQL_FETCHARRAY($result)) {
// "Translate"/add content
$content['sw'] = $SW;
- $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
+ $content['userid'] = generateUserProfileLink($content['userid']);
$content['url'] = FRAMETESTER($content['url']);
- $content['views_total'] = TRANSLATE_COMMA($content['views_total']);
- $content['status'] = SURFBAR_TRANSLATE_STATUS($content['status']);
- $content['registered'] = MAKE_DATETIME($content['registered'], 2);
- $content['last_locked'] = MAKE_DATETIME($content['last_locked'], 2);
+ $content['views_total'] = translateComma($content['views_total']);
+ $content['status'] = surfbarTranslateUserStatus($content['status']);
+ $content['registered'] = generateDateTime($content['registered'], 2);
+ $content['last_locked'] = generateDateTime($content['last_locked'], 2);
if (empty($content['lock_reason'])) $content['lock_reason'] = '---';
// Load row template
- $OUT .= LOAD_TEMPLATE("admin_list_surfbar_urls_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_list_surfbar_urls_row', true, $content);
// Switch color
$SW = 3 - $SW;
} // END - while
// Load main template
- LOAD_TEMPLATE("admin_list_surfbar_urls", false, $OUT);
+ LOAD_TEMPLATE('admin_list_surfbar_urls', false, $OUT);
} else {
// No URLs in surfbar
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_SURFBAR_NO_URLS_FOUND'));
switch (REQUEST_GET('type'))
{
case "your": // List only your own open (new) tasks
- $whereStatement = "assigned_admin='".GET_CURRENT_ADMIN_ID()."' AND `status`='NEW' AND task_type != 'EXTENSION_UPDATE'";
+ $whereStatement = "`assigned_admin`='".getCurrentAdminId()."' AND `status`='NEW' AND task_type != 'EXTENSION_UPDATE'";
break;
case "updates": // List only updates assigned to you
- $whereStatement = "assigned_admin=".GET_CURRENT_ADMIN_ID()." AND `status`='NEW' AND task_type = 'EXTENSION_UPDATE'";
+ $whereStatement = "`assigned_admin`=".getCurrentAdminId()." AND `status`='NEW' AND task_type = 'EXTENSION_UPDATE'";
break;
case "solved": // List only solved tasks assigned to you
- $whereStatement = "assigned_admin=".GET_CURRENT_ADMIN_ID()." AND `status`='SOLVED'";
+ $whereStatement = "`assigned_admin`=".getCurrentAdminId()." AND `status`='SOLVED'";
break;
case "unassigned": // List unassigned (but not deleted) tasks
- $whereStatement = "assigned_admin='0' AND status != 'DELETED'";
+ $whereStatement = "`assigned_admin`=0 AND `status` != 'DELETED'";
break;
case "deleted": // List all deleted
break;
case "closed": // List all closed
- $whereStatement = "assigned_admin=".GET_CURRENT_ADMIN_ID()." AND `status`='CLOSED'";
+ $whereStatement = "`assigned_admin`=".getCurrentAdminId()." AND `status`='CLOSED'";
break;
default: // Unknown type
if (!empty($whereStatement)) {
$SEL = 0;
- if (REQUEST_ISSET_POST(('task'))) $SEL = SELECTION_COUNT(REQUEST_POST('task'));
+ if (REQUEST_ISSET_POST(('task'))) $SEL = countSelection(REQUEST_POST('task'));
if ((REQUEST_ISSET_POST(('assign'))) && ($SEL > 0)) {
// Assign / do tasks
- LOAD_INC_ONCE("inc/modules/admin/overview-inc.php");
+ loadIncludeOnce("inc/modules/admin/overview-inc.php");
if (empty($dmy)) $dmy = '';
OUTPUT_SELECTED_TASKS(REQUEST_POST_ARRAY(), $dmy);
} else {
if (REQUEST_ISSET_POST(('unassign'))) {
// Unassign from tasks
foreach (REQUEST_POST('task') as $id => $sel) {
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET assigned_admin=0 WHERE id=%s AND assigned_admin=%s LIMIT 1",
- array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET `assigned_admin`=0 WHERE `id`=%s AND `assigned_admin`=%s LIMIT 1",
+ array(bigintval($id), getCurrentAdminId()), __FILE__, __LINE__);
}
} elseif (REQUEST_ISSET_POST('del')) {
// Delete tasks
foreach (REQUEST_POST('task') as $id => $sel) {
if (REQUEST_GET('type') == "deleted") {
// Delete task immediately
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `id`=%s LIMIT 1",
array(bigintval($id)),__FILE__, __LINE__);
} else {
// Mark task as to be deleted (purged by autppurge extension)
$content['infos'] = '---';
// Generate link
- $content['assigned_admin'] = GENERATE_AID_LINK($content['assigned_admin']);
+ $content['assigned_admin'] = generateAdminLink($content['assigned_admin']);
// Get admin task
$content['task_type_msg'] = getMessage('ADMIN_TASK_IS_'.strtoupper($content['task_type']).'');
// Generate infos
switch ($content['task_type'])
{
- case "EXTENSION":
- case "EXTENSION_UPDATE":
- $content['infos'] = substr($content['subject'], 1, strpos($content['subject'], ":") - 1);
+ case 'EXTENSION':
+ case 'EXTENSION_UPDATE':
+ $content['infos'] = substr($content['subject'], 1, strpos($content['subject'], ':') - 1);
break;
}
// Member assigned with task?
if ($content['userid'] > 0) {
// Member found otherwise it's a system task
- $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
+ $content['userid'] = generateUserProfileLink($content['userid']);
} else {
// Is a system task!
$content['userid'] = "<em>{--ADMIN_IS_SYSTEM_TASK--}</em>";
'admin' => $content['assigned_admin'],
'uid' => $content['userid'],
'type' => $content['task_type_msg'],
- 'created' => MAKE_DATETIME($content['task_created'], "2")
+ 'created' => generateDateTime($content['task_created'], "2")
));
// Do we have an extension task?
- if (($content['task_type'] == "EXTENSION") && (GET_EXT_VERSION($content['infos']) == "")) {
+ if (($content['task_type'] == 'EXTENSION') && (GET_EXT_VERSION($content['infos']) == '')) {
// Load extension row template
// @TODO Rewrite this to $OUT .= ..., true, ...
LOAD_TEMPLATE("admin_list_task_ext_rows", false, $content);
$content = array(
'sw' => $SW,
'idx' => $content['trans_id'],
- 'stamp' => MAKE_DATETIME($content['time_trans'], "3"),
- 'from_link' => ADMIN_USER_PROFILE_LINK($content['userid']),
- 'to_link' => ADMIN_USER_PROFILE_LINK($content['to_uid']),
+ 'stamp' => generateDateTime($content['time_trans'], "3"),
+ 'from_link' => generateUserProfileLink($content['userid']),
+ 'to_link' => generateUserProfileLink($content['to_uid']),
'reason' => wordwrap($content['reason'], 15),
- 'points' => TRANSLATE_COMMA($content['points']),
+ 'points' => translateComma($content['points']),
);
// Load row template add points and switch color
define('__TRANSFER_ROWS', $OUT);
// Remeber total amount
-define('__TRANSFER_TOTAL_VALUE', TRANSLATE_COMMA($total));
+define('__TRANSFER_TOTAL_VALUE', translateComma($total));
// Set title
define('__TRANSFER_TITLE', getMessage('TRANSFER_LIST_ALL'));
define('__LIST_UNCON_TITLE', getMessage('LIST_UNCONFIRMED_BONUS_LINKS'));
// SQL query for mail data (both ids are required for compatiblity to above normal mail
- $sql = "SELECT id, id, subject, text, url, timestamp, mails_sent FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id='".REQUEST_GET('bid')."' LIMIT 1";
+ $sql = "SELECT id, id, subject, text, url, timestamp, mails_sent FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`='".REQUEST_GET('bid')."' LIMIT 1";
// Column, type and ID for member's mail
$col = 'bonus_id'; $type = "BONUS"; $ID = REQUEST_GET('bid');
// @TODO Rewritings: uid->userid
$content = array(
'sw' => $SW,
- 'u_link' => ADMIN_USER_PROFILE_LINK($content['userid']),
+ 'u_link' => generateUserProfileLink($content['userid']),
'uid' => $content['userid'],
'link' => $LINK,
'id' => $ID,
- 'email' => "<a href=\"".CREATE_EMAIL_LINK($content['email'], "user_data")."\">".TRANSLATE_GENDER($content['gender'])." ".$content['surname']." ".$content['family']."</a>",
- 'status' => TRANSLATE_STATUS($content['status']),
+ 'email' => "<a href=\"".generateMemberEmailLink($content['email'], "user_data")."\">".translateGender($content['gender'])." ".$content['surname']." ".$content['family']."</a>",
+ 'status' => translateUserStatus($content['status']),
);
// Load row template and switch colors
'text' => COMPILE_CODE($text),
'url' => FRAMETESTER($url),
'unconfirmed' => $unconfirmed,
- 'stamp' => MAKE_DATETIME($stamp, "2"),
+ 'stamp' => generateDateTime($stamp, "2"),
'rows' => $OUT
);
LOAD_TEMPLATE("admin_list_unconfirmed", false, $content);
} elseif (REQUEST_GET('mid') > 0) {
// Data in pool or in user_stats not found, so let's find out where data is missing
- $result1 = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s LIMIT 1",
+ $result1 = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
array(bigintval($ID)), __FILE__, __LINE__);
- $result2 = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s LIMIT 1",
+ $result2 = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s LIMIT 1",
array(bigintval($ID)), __FILE__, __LINE__);
if (SQL_NUMROWS($result1) == 1) {
// pool table
if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
-} elseif ((!EXT_IS_ACTIVE('user')) || (GET_EXT_VERSION('user') == "")) {
+} elseif ((!EXT_IS_ACTIVE('user')) || (GET_EXT_VERSION('user') == '')) {
// Missing extension!
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'user'));
return;
// Init title with "all accounts"
$listHeader = getMessage('ADMIN_ALL_ACCOUNTS');
if (REQUEST_ISSET_GET(('status'))) {
- // Set title according to the "status"
+ // Set title according to the 'status'
$listHeader = getMessage(sprintf("ADMIN_LIST_STATUS_%s_ACCOUNTS", strtoupper(REQUEST_GET(('status')))));
} elseif (REQUEST_ISSET_GET(('mode'))) {
// Set title according to the "mode"
// Is this above zero?
if ($stamp > 0) {
// Then use it
- define('_BIRTHDAY', MAKE_DATETIME($stamp, "3"));
+ define('_BIRTHDAY', generateDateTime($stamp, "3"));
} else {
// Zero or below so set zero!
- define('_BIRTHDAY', MAKE_DATETIME(0, "3"));
+ define('_BIRTHDAY', generateDateTime(0, "3"));
}
// Prepare data for template
define('_REFS' , $REFS);
define('_CATS' , $CATS);
define('_LINKS', $LINKS);
- define('_ADMIN_LINKS', MEMBER_ACTION_LINKS($uid, $DATA['status']));
- $DATA['gender'] = TRANSLATE_GENDER($DATA['gender']);
- $DATA['email_link'] = CREATE_EMAIL_LINK($DATA['email'], "user_data");
- $DATA['status'] = TRANSLATE_STATUS($DATA['status']);
- $DATA['last_online'] = MAKE_DATETIME($DATA['last_online'], "0");
- $DATA['used_points'] = TRANSLATE_COMMA($DATA['used_points']);
- if ($DATA['emails_sent'] > 0) $DATA['emails_sent'] = $base."&what=email_details&uid=".$uid."\">".TRANSLATE_COMMA($DATA['emails_sent'])."</a>]";
- $DATA['joined'] = MAKE_DATETIME($DATA['joined'], "0");
- $DATA['last_update'] = MAKE_DATETIME($DATA['last_update'], "0");
- $DATA['last_profile_sent'] = MAKE_DATETIME($DATA['last_profile_sent'], "0");
- $DATA['total'] = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "points"));
- $DATA['locked'] = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "locked_points"));
- $DATA['lock_timestamp'] = MAKE_DATETIME($DATA['lock_timestamp'], "2");
+ define('_ADMIN_LINKS', generateMemberAdminActionLinks($uid, $DATA['status']));
+ $DATA['gender'] = translateGender($DATA['gender']);
+ $DATA['email_link'] = generateMemberEmailLink($DATA['email'], "user_data");
+ $DATA['status'] = translateUserStatus($DATA['status']);
+ $DATA['last_online'] = generateDateTime($DATA['last_online'], '0');
+ $DATA['used_points'] = translateComma($DATA['used_points']);
+ if ($DATA['emails_sent'] > 0) $DATA['emails_sent'] = $base."&what=email_details&uid=".$uid."\">".translateComma($DATA['emails_sent'])."</a>]";
+ $DATA['joined'] = generateDateTime($DATA['joined'], '0');
+ $DATA['last_update'] = generateDateTime($DATA['last_update'], '0');
+ $DATA['last_profile_sent'] = generateDateTime($DATA['last_profile_sent'], '0');
+ $DATA['total'] = translateComma(GET_TOTAL_DATA($uid, "user_points", "points"));
+ $DATA['locked'] = translateComma(GET_TOTAL_DATA($uid, "user_points", "locked_points"));
+ $DATA['lock_timestamp'] = generateDateTime($DATA['lock_timestamp'], "2");
// Is the lock reason not set?
if (!isset($DATA['lock_reason'])) $DATA['lock_reason'] = '---';
// Is the user extension newer?
if (GET_EXT_VERSION('user') >= '0.3.4') {
// Then "translate" the number
- $DATA['rand_confirmed'] = TRANSLATE_COMMA($DATA['rand_confirmed']);
+ $DATA['rand_confirmed'] = translateComma($DATA['rand_confirmed']);
} // END - if
// Clickrate
$DATA['click_rate'] = 0;
if ($DATA['emails_received'] > 0) {
- $DATA['click_rate'] = TRANSLATE_COMMA($DATA['mails_confirmed'] / $DATA['emails_received'] * 100);
+ $DATA['click_rate'] = translateComma($DATA['mails_confirmed'] / $DATA['emails_received'] * 100);
} // END - if
// "Translate" more data
- $DATA['mails_confirmed'] = TRANSLATE_COMMA($DATA['mails_confirmed']);
- $DATA['emails_received'] = TRANSLATE_COMMA($DATA['emails_received']);
+ $DATA['mails_confirmed'] = translateComma($DATA['mails_confirmed']);
+ $DATA['emails_received'] = translateComma($DATA['emails_received']);
// Is the extension 'country' installed?
if (EXT_IS_ACTIVE('country')) {
$DATA['country'] = COUNTRY_GENERATE_INFO($DATA['country_code']);
} elseif ($DATA['country'] == 0) {
// Zero ID???
- $DATA['country'] = "???";
+ $DATA['country'] = '???';
}
// Load user-details template
$OUT = ''; $SW = 2;
while ($content = SQL_FETCHARRAY($result)) {
// Set refid link
- if ($content['refid'] > 0) $content['refid'] = ADMIN_USER_PROFILE_LINK($content['refid']);
+ if ($content['refid'] > 0) $content['refid'] = generateUserProfileLink($content['refid']);
// Get number of unconfirmed mails
$LINKS = GET_TOTAL_DATA($content['userid'], "user_links", "id", 'userid', true);
- if ($LINKS > 0) $LINKS = $base."&what=list_links&uid=".$content['userid']."\">".TRANSLATE_COMMA($LINKS)."</a>]";
+ if ($LINKS > 0) $LINKS = $base."&what=list_links&uid=".$content['userid']."\">".translateComma($LINKS)."</a>]";
// Set link to sent mails if present
- if ($content['emails_sent'] > 0) $content['emails_sent'] = $base."&what=email_details&uid=".$content['userid']."\">".TRANSLATE_COMMA($content['emails_sent'])."</a>]";
+ if ($content['emails_sent'] > 0) $content['emails_sent'] = $base."&what=email_details&uid=".$content['userid']."\">".translateComma($content['emails_sent'])."</a>]";
// Add nickname
if (empty($content['nickname']) || $content['nickname'] == $content['userid']) $content['nickname'] = '---';
// Transfer data to array
$content['sw'] = $SW;
- $content['uid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
- $content['gender'] = TRANSLATE_GENDER($content['gender']);
- $content['email'] = "[<a href=\"".CREATE_EMAIL_LINK($content['email'], "user_data")."\">".$content['email']."</a>]";
+ $content['uid'] = generateUserProfileLink($content['userid']);
+ $content['gender'] = translateGender($content['gender']);
+ $content['email'] = "[<a href=\"".generateMemberEmailLink($content['email'], "user_data")."\">".$content['email']."</a>]";
$content['addr'] = $content['REMOTE_ADDR'];
$content['links'] = $LINKS;
- $content['alinks'] = MEMBER_ACTION_LINKS($content['userid'], $content['status']);
- $content['points'] = TRANSLATE_COMMA($pointsTotal);
- $content['rate'] = TRANSLATE_COMMA($clickRate);
- $content['locked'] = TRANSLATE_COMMA(GET_TOTAL_DATA($content['userid'], "user_points", "locked_points"));
- $content['lock_timestamp'] = MAKE_DATETIME($content['lock_timestamp'], "2");
- $content['status'] = TRANSLATE_STATUS($content['status']);
+ $content['alinks'] = generateMemberAdminActionLinks($content['userid'], $content['status']);
+ $content['points'] = translateComma($pointsTotal);
+ $content['rate'] = translateComma($clickRate);
+ $content['locked'] = translateComma(GET_TOTAL_DATA($content['userid'], "user_points", "locked_points"));
+ $content['lock_timestamp'] = generateDateTime($content['lock_timestamp'], "2");
+ $content['status'] = translateUserStatus($content['status']);
// Is the lock reason not set?
if (!isset($content['lock_reason'])) $content['lock_reason'] = '---';
if (EXT_IS_ACTIVE('country')) {
// Then overwrite country information
$content['country'] = COUNTRY_GENERATE_INFO($content['country_code']);
- } elseif ($content['country'] == "") {
+ } elseif ($content['country'] == '') {
// Zero ID???
- $content['country'] = "???";
+ $content['country'] = '???';
}
// Load row template and switch colors
while ($content = SQL_FETCHARRAY($result)) {
// Translate some data and add color
$content['sw'] = $SW;
- $content['link'] = ADMIN_USER_PROFILE_LINK($content['userid']);
- $content['wernis_amount'] = TRANSLATE_COMMA($content['wernis_amount']);
- $content['wernis_timestamp'] = MAKE_DATETIME($content['wernis_timestamp'], "2");
+ $content['link'] = generateUserProfileLink($content['userid']);
+ $content['wernis_amount'] = translateComma($content['wernis_amount']);
+ $content['wernis_timestamp'] = generateDateTime($content['wernis_timestamp'], "2");
$content['raw_type'] = strtolower($content['wernis_type']);
$content['wernis_type'] = WERNIS_TRANSFER_STATUS($content['wernis_type']);
$code = $code[0];
// Output message
- LOAD_TEMPLATE('admin_yoomedia_error', false, sprintf("{--ADMIN_YOOMEDIA_ERROR_%s--}", strtoupper(YOOMEDIA_TRANSLATE_ERROR($code))));
+ LOAD_TEMPLATE('admin_yoomedia_error', false, sprintf("{--ADMIN_YOOMEDIA_ERROR_%s--}", strtoupper(yoomediaTranslateError($code))));
return false;
}
$OUT = ''; $SW = 2;
foreach ($result as $entry) {
// Translate some data
- $entry['pay'] = TRANSLATE_COMMA($entry['pay'], true, 5);
- $entry['remain'] = TRANSLATE_COMMA($entry['remain']);
+ $entry['pay'] = translateComma($entry['pay'], true, 5);
+ $entry['remain'] = translateComma($entry['remain']);
$entry['sw'] = $SW;
// Check reload lock
} // END - if
// Add reload lock
- $entry['already'] = sprintf(getMessage('ADMIN_YOOMEDIA_TEXTMAIL_SEND_AGAIN'), CREATE_FANCY_TIME($countdown));
+ $entry['already'] = sprintf(getMessage('ADMIN_YOOMEDIA_TEXTMAIL_SEND_AGAIN'), createFancyTime($countdown));
} else {
// Never resentable unless manual removal
$entry['already'] = getMessage('ADMIN_YOOMEDIA_TEXTMAIL_MANUALLY_LOCKED');
ADD_DESCR('admin', __FILE__);
$message = '';
-if (REQUEST_ISSET_GET(('id'))) {
+if (REQUEST_ISSET_GET('id')) {
// Check for selected sponsor
- $result = SQL_QUERY_ESC("SELECT gender, surname, family, email, status FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE id='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT gender, surname, family, email, status FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Get sponsor's current status and let only confirmed and locked status pass
list($gender, $sname, $fname, $email, $status) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- if (($status == "CONFIRMED") || ($status == "LOCKED")) {
+ if (($status == 'CONFIRMED') || ($status == "LOCKED")) {
// Transfer data to constants
- define('__GENDER' , TRANSLATE_GENDER($gender));
+ define('__GENDER' , translateGender($gender));
define('__SURNAME', $sname);
define('__FAMILY' , $fname);
define('__ID' , bigintval(REQUEST_GET('id')));
if (IS_FORM_SENT()) {
// Create messages
- if ($status == "CONFIRMED") {
+ if ($status == 'CONFIRMED') {
// Message when sponsor's account got lock
define('__EMAIL_MSG', getMessage('SPONSOR_ACCOUNT_LOCKED'));
$subject = getMessage('SPONSOR_SUBJECT_LOCKED');
// Message when sponsor's account got unlock
define('__EMAIL_MSG', getMessage('SPONSOR_ACCOUNT_UNLOCKED'));
$subject = getMessage('SPONSOR_SUBJECT_UNLOCKED');
- $status = "CONFIRMED";
+ $status = 'CONFIRMED';
}
// Load email message
$msg = LOAD_EMAIL_TEMPLATE("lock_sponsor", REQUEST_POST('reason'), bigintval(REQUEST_GET('id')));
// And send it away
- SEND_EMAIL($email, $subject, $msg);
+ sendEmail($email, $subject, $msg);
// Update sponsor's account
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='".$status."' WHERE id='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='".$status."' WHERE `id`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
} elseif (REQUEST_ISSET_POST(('no'))) {
// No don't lock / unlock now!
- LOAD_URL('modules.php?module=admin&what=list_sponsor&id='.bigintval(REQUEST_GET('id')));
+ redirectToUrl('modules.php?module=admin&what=list_sponsor&id='.bigintval(REQUEST_GET('id')));
} else {
// Create header and text messages
if ($status == 'CONFIRMED') {
if (REQUEST_ISSET_GET('uid')) {
// Load user's data
$result_user = SQL_QUERY_ESC("SELECT status, gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+ array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
$ACT = false;
if (SQL_NUMROWS($result_user) == 1) {
// User found
$msg = LOAD_EMAIL_TEMPLATE("lock-user", array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid')));
// Send away...
- SEND_EMAIL(bigintval(REQUEST_GET('uid')), ADMIN_LOCKED_SUBJ, $msg);
+ sendEmail(bigintval(REQUEST_GET('uid')), ADMIN_LOCKED_SUBJ, $msg);
} // END - if
// Prepare message
$msg = LOAD_EMAIL_TEMPLATE("unlock-user", array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid')));
// Send away...
- SEND_EMAIL(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_UNLOCKED_SUBJ'), $msg);
+ sendEmail(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_UNLOCKED_SUBJ'), $msg);
if (EXT_IS_ACTIVE('rallye')) {
RALLYE_AUTOADD_USER(REQUEST_GET('uid'));
} // END - if
} elseif (REQUEST_ISSET_POST('del')) {
// Delete the account
$ACT = true;
- LOAD_INC_ONCE("inc/modules/admin/what-del_user.php");
+ loadIncludeOnce("inc/modules/admin/what-del_user.php");
} elseif (REQUEST_ISSET_POST(('no'))) {
// Do not lock him...
$URL = ADMIN_CREATE_USERID_LINK(REQUEST_GET('uid'));
// Transfer data to constants for the template
// @TODO Rewrite these all constants
- define('__EMAIL', CREATE_EMAIL_LINK($email, "user_data"));
+ define('__EMAIL', generateMemberEmailLink($email, 'user_data'));
define('__SNAME', $sname);
define('__FNAME', $fname);
define('__UID' , bigintval(REQUEST_GET('uid')));
// Realy want to lock?
switch ($status)
{
- case "CONFIRMED": // Yes, lock him down... ;-)
- define('__OK_VALUE' , "lock");
+ case 'CONFIRMED': // Yes, lock him down... ;-)
+ define('__OK_VALUE' , 'lock');
define('__HEADER_VALUE', sprintf(getMessage('ADMIN_HEADER_LOCK_ACCOUNT'), constant('__UID')));
define('__TEXT_VALUE' , sprintf(getMessage('ADMIN_TEXT_LOCK_ACCOUNT'), constant('__UID')));
break;
- case "LOCKED": // Unlock the user
- define('__OK_VALUE' , "unlock");
+ case 'LOCKED': // Unlock the user
+ define('__OK_VALUE' , 'unlock');
define('__HEADER_VALUE', sprintf(getMessage('ADMIN_HEADER_UNLOCK_ACCOUNT'), constant('__UID')));
define('__TEXT_VALUE' , sprintf(getMessage('ADMIN_TEXT_UNLOCK_ACCOUNT'), constant('__UID')));
break;
- case "UNCONFIRMED": // Unconfirmed accounts cannot be unlocked!
- define('__OK_VALUE' , "del");
+ case 'UNCONFIRMED': // Unconfirmed accounts cannot be unlocked!
+ define('__OK_VALUE' , 'del');
define('__HEADER_VALUE', sprintf(getMessage('ADMIN_HEADER_DEL_ACCOUNT'), constant('__UID')));
define('__TEXT_VALUE' , sprintf(getMessage('ADMIN_TEXT_DEL_ACCOUNT'), constant('__UID')));
break;
}
// Output form
- LOAD_TEMPLATE("admin_lock_user");
+ LOAD_TEMPLATE('admin_lock_user');
} else {
// Account does not exists!
LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
// Is an URL set?
if (!empty($URL)) {
// Reload and die...
- LOAD_URL($URL);
+ redirectToUrl($URL);
} elseif ($ACT) {
// An action was performed...
if (!empty($message)) {
$target = sprintf("%slogs/%s", constant('PATH'), $access);
// Is the file valid and readable?
- if (FILE_READABLE($target)) {
+ if (isFileReadable($target)) {
// Load it directly
- $content = READ_FILE($target);
+ $content = readFromFile($target);
// Save old content
$OUTPUT = ob_get_contents();
}
} else {
// List access logfiles
- $dir = constant('PATH') . getConfig('logs_base') . "/";
+ $dir = constant('PATH') . getConfig('logs_base') . '/';
if (isDirectory($dir)) {
// logs directory does exist
OUTPUT_HTML("<ol>");
- $handle = opendir($dir) or app_die(__FILE__, __LINE__, "Cannot open directory ".getConfig('logs_base')."!");
+ $handle = opendir($dir) or app_die(__FILE__, __LINE__, "Cannot open directory ".getConfig('logs_base').'!');
while ($file = readdir($handle)) {
// We currenly only like files with "access" as prefix, should be more flexible!
if (substr($file, 0, 6) == "access") {
switch (getConfig('maintenance'))
{
case 'Y':
- $target_mode = "N";
+ $target_mode = 'N';
$out = getMessage('ADMIN_MAINTENANCE_DEACTIVATED');
break;
case 'N':
- $target_mode = "Y";
+ $target_mode = 'Y';
$out = getMessage('ADMIN_MAINTENANCE_ACTIVATED');
break;
}
// Update config
- UPDATE_CONFIG('maintenance', $target_mode);
+ updateConfiguration('maintenance', $target_mode);
// Load template
LOAD_TEMPLATE('admin_settings_saved', false, $out);
// Get count of (maybe) selected menu points
$chk = 0;
-if (REQUEST_ISSET_POST('sel')) $chk = SELECTION_COUNT(REQUEST_POST('sel'));
+if (REQUEST_ISSET_POST('sel')) $chk = countPostSelection();
// List all menu points and make them editable
if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) {
if ($confirm == 1) {
$cnt++;
$result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND id=%s LIMIT 1",
- array(bigintval($sel)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ array(bigintval($sel)), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
// Entry found so we load the stuff...
list($title) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
'title' => $title
);
$OUT .= LOAD_TEMPLATE("admin_mmenu_delete_row", true, $content);
- }
- else
- {
+ } else {
// Entry not found?
$content = array(
'sw' => $SW,
if (!empty($SUB)) $AND = "`action`='".$SUB."'";
switch (REQUEST_POST('ok'))
{
- case "edit": // Edit menu
+ case 'edit': // Edit menu
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `title`='%s', `action`='%s', `what`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
array($menu, REQUEST_POST('sel_act', $sel), REQUEST_POST('sel_what', $sel), $sel), __FILE__, __LINE__);
break;
- case "del": // Delete menu
+ case 'del': // Delete menu
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND id=%s LIMIT 1",
array($sel), __FILE__, __LINE__);
break;
- case "status": // Change status of menus
+ case 'status': // Change status of menus
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='%s', `locked`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
array(REQUEST_POST('visible', $sel), REQUEST_POST('locked', $sel), $sel), __FILE__, __LINE__);
break;
// Get IDs
if (REQUEST_ISSET_GET(('w'))) {
// Sub menus selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
- array(bigintval(REQUEST_GET('act')), bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ array(bigintval(REQUEST_GET('act')), bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
- array(bigintval(REQUEST_GET('act')), bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ array(bigintval(REQUEST_GET('act')), bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
} else {
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
- array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
- array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
}
'tpl' => $row_array[0],
'rep' => $REP,
'opt' => $OPT,
- 'sum' => TRANSLATE_COMMA($row_array[3]),
- 'sav' => TRANSLATE_COMMA($row_array[4]),
+ 'sum' => translateComma($row_array[3]),
+ 'sav' => translateComma($row_array[4]),
);
// Load row template and switch color
// Prepare data for the template
define('__TOTAL_TABS' , $DATA['total_tabs']);
-define('__TOTAL_SIZE' , TRANSLATE_COMMA($DATA['total_size']));
+define('__TOTAL_SIZE' , translateComma($DATA['total_size']));
define('__TOTAL_CALLS' , $DATA['total_rows']);
-define('__TOTAL_OPTIMIZED', TRANSLATE_COMMA($DATA['total_opti']));
+define('__TOTAL_OPTIMIZED', translateComma($DATA['total_opti']));
define('__NOW_OPTIMIZED' , $gain_tabs);
-define('__NOW_SAVED' , TRANSLATE_COMMA($DATA['total_gain']));
+define('__NOW_SAVED' , translateComma($DATA['total_gain']));
// Load main template
LOAD_TEMPLATE("admin_optimize");
// In Opera browsers the menu is being displayed double: ADD_DESCR('admin', __FILE__);
// Otherwise load include file 'overview-inc' (old standard overview page)
-LOAD_INC_ONCE("inc/modules/admin/overview-inc.php");
+loadIncludeOnce('inc/modules/admin/overview-inc.php');
$jobsDone = true;
$taskExt = false; // Default is that 'task' is not installed
switch (REQUEST_GET('do')) {
case 'add':
ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_payments` (time, payment, mail_title, price) VALUES ('".REQUEST_POST('t_wait')."','".REQUEST_POST('payment')."','".REQUEST_POST('title')."','".REQUEST_POST('price')."')");
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_payments` WHERE time='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_payments` WHERE time='%s' LIMIT 1",
array(REQUEST_POST('t_wait')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Re-init the array here
}
break;
- case "edit":
+ case 'edit':
foreach (REQUEST_POST('time') as $id => $value) {
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_payments` SET time='".$value."', payment='".REQUEST_POST('pay', $id)."', price='".REQUEST_POST('price', $id)."', mail_title='".REQUEST_POST('title', $id)."' WHERE id='".$id."' LIMIT 1");
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_payments` SET time='".$value."', payment='".REQUEST_POST('pay', $id)."', price='".REQUEST_POST('price', $id)."', mail_title='".REQUEST_POST('title', $id)."' WHERE `id`='".$id."' LIMIT 1");
}
break;
- case "del":
+ case 'del':
foreach (REQUEST_POST('id') as $id => $value) {
- ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_payments` WHERE id='".$id."' LIMIT 1");
+ ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_payments` WHERE `id`='".$id."' LIMIT 1");
}
break;
}
// Output template
LOAD_TEMPLATE('admin_settings_saved', false, $content);
-} elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+} elseif ((REQUEST_ISSET_POST('del')) && (countPostSelection() > 0)) {
// Delete entries here
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $value) {
- $result = SQL_QUERY_ESC("SELECT time, mail_title FROM `{!_MYSQL_PREFIX!}_payments` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT time, mail_title FROM `{!_MYSQL_PREFIX!}_payments` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($time, $title) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Load main template
LOAD_TEMPLATE("admin_del_payments");
-} elseif ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+} elseif ((REQUEST_ISSET_POST('edit')) && (countPostSelection() > 0)) {
// Edit entries
$OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $id => $value) {
- $result = SQL_QUERY_ESC("SELECT time, payment, mail_title, price FROM `{!_MYSQL_PREFIX!}_payments` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT time, payment, mail_title, price FROM `{!_MYSQL_PREFIX!}_payments` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($time, $pay, $title, $price) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
'id' => $content['id'],
'time' => $content['time'],
'title' => $content['mail_title'],
- 'pay' => TRANSLATE_COMMA($content['payment']),
- 'price' => TRANSLATE_COMMA($content['price'])
+ 'pay' => translateComma($content['payment']),
+ 'price' => translateComma($content['price'])
);
// Load row template and switch colors
}
// Check selection count
-if (REQUEST_ISSET_POST('sel')) $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+if (REQUEST_ISSET_POST('sel')) $SEL = countPostSelection();
if (IS_FORM_SENT()) {
// Fix older calls from add-new-banner-form
{
case 'add':
// Check if banner is already added
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE url='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE url='%s' LIMIT 1",
array(REQUEST_POST('url')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// Add banner
}
break;
- case "edit": // Update banner
+ case 'edit': // Update banner
foreach (REQUEST_POST('sel') as $id => $sel) {
// Secure ID
$id = bigintval($id);
// Update entry
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refbanner` SET url='%s', alternate='%s', `visible`='%s' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refbanner` SET url='%s', alternate='%s', `visible`='%s' WHERE `id`=%s LIMIT 1",
array(
REQUEST_POST('url', $id),
REQUEST_POST('alternate', $id),
$SW = ''; $OUT = '';
foreach (REQUEST_POST('sel') as $id => $sel) {
// Load data
- $result = SQL_QUERY_ESC("SELECT url, alternate, visible FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT url, alternate, visible FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
list($url, $alt, $vis) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if (($SEL > 0) && (REQUEST_ISSET_POST('del'))) {
// Delete banner
foreach (REQUEST_POST('sel') as $id => $sel) {
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
}
}
'id' => $content['id'],
'url' => $content['url'],
'alt' => $content['alternate'],
- 'vis' => TRANSLATE_YESNO($content['visible']),
+ 'vis' => translateYesNo($content['visible']),
'cnt' => $content['counter'],
'clx' => $content['clicks']
);
$ACTIONS = array();
-// First fix all main menus (what="")...
+// First fix all main menus (what = '')...
$result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
$cnt = 0; $REP = 0;
while ($content = SQL_FETCHARRAY($result_fix)) {
$ACTIONS[] = $content['action'];
// Fix weight
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET sort=%s WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET sort=%s WHERE `id`=%s LIMIT 1",
array($cnt, $content['id']), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
// Now sort every each menu
foreach ($ACTIONS as $act) {
- $result_fix = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
+ $result_fix = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
array($act), __FILE__, __LINE__);
$cnt = 1;
while ($content = SQL_FETCHARRAY($result_fix)) {
// Fix weight
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET sort=%s WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET sort=%s WHERE `id`=%s LIMIT 1",
array($cnt, $content['id']), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
}
// @TODO This causes the whole (!) menu cache being rebuilded
-CACHE_PURGE_ADMIN_MENU();
+cachePurgeAdminMenu();
// Repair finished
if ($REP > 0) {
// Add description as navigation point
ADD_DESCR('admin', __FILE__);
-$result = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` ORDER BY userid", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` ORDER BY `userid` ASC", __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Check if found userid is also found in user_data table
$REMOVED = 0; // Nothing is removed for now... ;-)
ADD_DESCR('admin', __FILE__);
$ACTIONS = array();
-// First fix all main menus (what="")...
+// First fix all main menus (what = '')...
$result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
$cnt = 0; $REP = 0;
while ($content = SQL_FETCHARRAY($result_fix)) {
$ACTIONS[] = $content['action'];
// Fix weight
- $result_sort = SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET sort='".$cnt."' WHERE id='".$content['id']."' LIMIT 1", __FILE__, __LINE__);
+ $result_sort = SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET sort='".$cnt."' WHERE `id`='".$content['id']."' LIMIT 1", __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
// Count one up
// Now sort every each menu
foreach ($ACTIONS as $act) {
- $result_fix = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
+ $result_fix = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
array($act), __FILE__, __LINE__);
$cnt = 1;
while ($content = SQL_FETCHARRAY($result_fix)) {
// Fix weight
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET sort=%s WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET sort=%s WHERE `id`=%s LIMIT 1",
array($cnt, $content['id']), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
$ACTIONS = array();
-// First fix all main menus (what="")...
+// First fix all main menus (what = '')...
$result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
$cnt = 0; $REP = 0;
while ($content = SQL_FETCHARRAY($result_fix)) {
$ACTIONS[] = $content['action'];
// Fix weight
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET sort=%s WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET sort=%s WHERE `id`=%s LIMIT 1",
array($cnt, $content['id']), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
// Now sort every each menu
foreach ($ACTIONS as $act) {
- $result_fix = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
+ $result_fix = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
array($act), __FILE__, __LINE__);
$cnt = 1;
while ($content = SQL_FETCHARRAY($result_fix)) {
// Fix weight
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET sort=%s WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET sort=%s WHERE `id`=%s LIMIT 1",
array($cnt, $content['id']), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
if (IS_FORM_SENT()) {
// Deliver bonus mail
- ADD_NEW_BONUS_MAIL(REQUEST_POST_ARRAY(), REQUEST_GET('mode'));
+ addNewBonusMail(REQUEST_POST_ARRAY(), REQUEST_GET('mode'));
} else {
// Get all available users
- define('__ALL_VALUE', TRANSLATE_COMMA(GET_TOTAL_RECEIVERS(REQUEST_GET('mode'))));
+ define('__ALL_VALUE', translateComma(getTotalReceivers(REQUEST_GET('mode'))));
// Prepare option lines
- define('__OPTION_LINES', ADD_CATEGORY_OPTIONS(REQUEST_GET('mode')));
+ define('__OPTION_LINES', generateCategoryOptionsList(REQUEST_GET('mode')));
// Store send mode
define('__MODE', REQUEST_GET(('mode')));
} else {
// Copy data into constants for the template and load it
// @TODO Rewrite this constant
- define('_DATESTAMP', MAKE_DATETIME(time(), "3"));
+ define('_DATESTAMP', generateDateTime(time(), "3"));
if (EXT_IS_ACTIVE('html_mail')) {
// Load template with HTML mode
LOAD_TEMPLATE("admin_newsletter");
// Is the form sent?
if ((IS_FORM_SENT()) && (REQUEST_POST('points') > 0)) {
- $result_main = SQL_QUERY("SELECT userid, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY userid",
+ $result_main = SQL_QUERY("SELECT userid, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY `userid` ASC",
__FILE__, __LINE__);
while ($content = SQL_FETCHARRAY($result_main)) {
// Ok, add points to used points and send an email to him...
// Load message and send it away
$msg = LOAD_EMAIL_TEMPLATE("sub-points", $content, bigintval($content['userid']));
- SEND_EMAIL($content['email'], getMessage('ADMIN_SUB_SUBJ'), $msg);
+ sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $msg);
} // END - while
// Free memory
// Load email and send it away
$msg = LOAD_EMAIL_TEMPLATE("sub-points", $content, bigintval(REQUEST_GET('uid')));
- SEND_EMAIL($content['email'], getMessage('ADMIN_SUB_SUBJ'), $msg);
+ sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $msg);
// Output message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_POINTS_SUBTRACTED'));
} else {
// @TODO Rewrite these constants
- define('__USER_VALUE', "<a href=\"".CREATE_EMAIL_LINK($content['email'], "user_data")."\">".$content['surname']." ".$content['family']."</a>");
+ define('__USER_VALUE', "<a href=\"".generateMemberEmailLink($content['email'], "user_data")."\">".$content['surname']." ".$content['family']."</a>");
define('__UID', bigintval(REQUEST_GET('uid')));
// Load form
SQL_FREERESULT($result);
} else {
// Output selection form with all confirmed user accounts listed
- ADD_MEMBER_SELECTION_BOX("0", true);
+ ADD_MEMBER_SELECTION_BOX('0', true);
}
//
$visits += $content['total_visits'];
// "Translate" some data
- $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
- $content['total_visits'] = TRANSLATE_COMMA($content['total_visits']);
- $content['last_online'] = MAKE_DATETIME($content['last_online'], "2");
+ $content['userid'] = generateUserProfileLink($content['userid']);
+ $content['total_visits'] = translateComma($content['total_visits']);
+ $content['last_online'] = generateDateTime($content['last_online'], "2");
$content['sw'] = $SW;
// Load row template
$visits += $content['total_visits'];
// "Translate" some data
- $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
- $content['visited_urls'] = TRANSLATE_COMMA($content['visited_urls']);
- $content['total_visits'] = TRANSLATE_COMMA($content['total_visits']);
+ $content['userid'] = generateUserProfileLink($content['userid']);
+ $content['visited_urls'] = translateComma($content['visited_urls']);
+ $content['total_visits'] = translateComma($content['total_visits']);
$content['sw'] = $SW;
// Load row template
$SEL = 0;
// Get response from our server
-$response = GET_URL("check-themes.php");
+$response = sendGetRequest('check-themes.php');
// Are theme_check found?
if (($response[count($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) {
$cver = THEME_GET_VERSION($name);
// Is the theme already installed or not?
- if (($ver != $cver) && ($cver != "?") && ($cver != "!")) {
+ if (($ver != $cver) && ($cver != '?') && ($cver != '!')) {
// No, it isn't. So let's add this one!
$THEMES['fname'][] = $name;
$THEMES['fsize'][] = $response[$idx + 1];
// Trim every data line
foreach ($LANG_DUMMY as $k => $v) {
$v = trim($v);
- if (substr($v, 3) == "") $v = '---';
+ if (substr($v, 3) == '') $v = '---';
$LANG_DUMMY[$k] = $v;
if ($v == "xx:xx") break;
$LANG[] = $v;
// If language is found stop searching on matching line
foreach($LANG as $search) {
- if (substr($search, 0, 3) == (GET_LANGUAGE().":")) { $INFO = substr($search, 3); break; }
+ if (substr($search, 0, 3) == (getLanguage().':')) { $INFO = substr($search, 3); break; }
} // END - foreach
// Add informations to array
$OUT .= "<tr>
<td align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".($idx + 1).".</td>
<td align=\"center\" class=\"switch_sw".$SW." bottom2 right2\"><a href=\"".$LINK."\">".$name."</a></td>
- <td align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".MAKE_DATETIME($THEMES['fctime'][$idx], "2")."</td>
- <td align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".TRANSLATE_COMMA(round($THEMES['fsize'][$idx] / 1.024) / 1000)." ".KBYTES."</td>
+ <td align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".generateDateTime($THEMES['fctime'][$idx], "2")."</td>
+ <td align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".translateComma(round($THEMES['fsize'][$idx] / 1.024) / 1000)." ".KBYTES."</td>
<td align=\"center\" class=\"switch_sw".$SW." bottom2\">".$THEMES['ver'][$idx]." (".$THEMES['cver'][$idx].")</td>
</tr>
<tr>
$SW = 3 - $SW;
}
define('__THEMES_ROWS', $OUT);
- define('__TKBYTES_VALUE', TRANSLATE_COMMA(round($TSIZE / 1.024) / 1000));
+ define('__TKBYTES_VALUE', translateComma(round($TSIZE / 1.024) / 1000));
define('__TTHEME_VALUE', count($THEMES['fname']));
// Load template
// Check for selected themes
$SEL = 0;
-if (REQUEST_ISSET_POST('sel')) $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+if (REQUEST_ISSET_POST('sel')) $SEL = countPostSelection();
if ($SEL > 0) {
$OUT = '';
foreach (REQUEST_POST('sel') as $id => $sel) {
if (REQUEST_ISSET_POST(('status'))) {
// Change status
if (REQUEST_POST('active', $id) == 'Y') {
- $sql = "UPDATE `{!_MYSQL_PREFIX!}_themes` SET theme_active='N' WHERE id='".$id."' LIMIT 1";
+ $sql = "UPDATE `{!_MYSQL_PREFIX!}_themes` SET theme_active='N' WHERE `id`='".$id."' LIMIT 1";
} else {
- $sql = "UPDATE `{!_MYSQL_PREFIX!}_themes` SET theme_active='Y' WHERE id='".$id."' LIMIT 1";
+ $sql = "UPDATE `{!_MYSQL_PREFIX!}_themes` SET theme_active='Y' WHERE `id`='".$id."' LIMIT 1";
}
$OUT = getMessage('ADMIN_THEMES_UPDATED');
} elseif (REQUEST_ISSET_POST('del')) {
// Delete themes
- $sql = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_themes` WHERE id='".$id."' LIMIT 1";
+ $sql = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_themes` WHERE `id`='".$id."' LIMIT 1";
$OUT = getMessage('ADMIN_THEMES_DELETED');
}
$POST['default_theme'] = REQUEST_GET(('default_theme'));
// Set session
- set_session('mxchange_theme', $POST['default_theme']);
+ setSession('mxchange_theme', $POST['default_theme']);
// Set it in config and current theme as well
$GLOBALS['curr_theme'] = $POST['default_theme'];
$INC = sprintf("theme/%s/theme.php", $content['theme_path']);
// Load theme in test mode
- LOAD_INC($INC);
+ loadInclude($INC);
// Is the loaded theme name != current theme name?
$LINK = $content['theme_path'];
- if ($content['theme_path'] != GET_CURR_THEME()) $LINK = "<a href=\"{!URL!}/modules.php?module=admin&what=theme_edit&default_theme=".$content['theme_path']."\" title=\"{--ADMIN_SET_AS_NEW_THEME--}\">".$content['theme_path']."</a>";
+ if ($content['theme_path'] != getCurrentTheme()) $LINK = "<a href=\"{!URL!}/modules.php?module=admin&what=theme_edit&default_theme=".$content['theme_path']."\" title=\"{--ADMIN_SET_AS_NEW_THEME--}\">".$content['theme_path']."</a>";
// Prepare data for the row template
$content = array(
'active' => $content['theme_active'],
'link' => $LINK,
'name' => $content['theme_name'],
- 'is_act' => TRANSLATE_YESNO($content['theme_active']),
- 'email' => "<a href=\"mailto:".$GLOBALS['theme_data']['email']."?Subject=[Theme:] ".$GLOBALS['theme_data']['name']." (".$content['theme_path'].")"."\">".$GLOBALS['theme_data']['author']."</a>",
+ 'is_act' => translateYesNo($content['theme_active']),
+ 'email' => "<a href=\"mailto:".$GLOBALS['theme_data']['email']."?Subject=[Theme:] ".$GLOBALS['theme_data']['name']." (".$content['theme_path'].")'.'\">".$GLOBALS['theme_data']['author']."</a>",
'url_link' => DEREFERER($GLOBALS['theme_data']['url']),
'url_title' => $GLOBALS['theme_data']['url'],
'ver' => $content['theme_ver'],
// Import selected theme if not present
if (REQUEST_ISSET_POST('theme')) {
// Check if theme is there
- if (!THEME_CHECK_EXIST(REQUEST_POST('theme'))) {
+ if (!ifThemeExists(REQUEST_POST('theme'))) {
// Import theme
$INC = sprintf("theme/%s/theme.php", SQL_ESCAPE(REQUEST_POST('theme')));
- if (INCLUDE_READABLE($INC)) {
+ if (isIncludeReadable($INC)) {
// Load the theme header file
- LOAD_INC($INC);
+ loadInclude($INC);
// Register it ith the exchange
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_themes` (`theme_path`,`theme_active`,`theme_ver`,`theme_name`)
$INC = sprintf("theme/%s/theme.php", $dir);
// Test it...
- if (($dir != ".") && ($dir != "..") && (INCLUDE_READABLE($INC))) {
+ if ((!isDirectory($dir)) && (isIncludeReadable($INC))) {
// Found a valid directory so let's load it's theme.php file
- LOAD_INC($INC);
+ loadInclude($INC);
// Add found theme to array
$THEMES['theme_unix'][] = $dir;
$FOUND = "<div class=\"admin_note\">{--ADMIN_THEME_ALREADY_INSTALLED--}</div>";
// Check if current theme is already imported or not
- if (!THEME_CHECK_EXIST($unix)) {
+ if (!ifThemeExists($unix)) {
// Theme not installed
$FOUND = LOAD_TEMPLATE("admin_theme_import_form", true, $unix);
} // END - if
// Are there checked boxes?
if (count(REQUEST_POST('sel')) > 0) {
// Count now... We use an own function for now
- $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+ $SEL = countPostSelection();
} // END - if
} // END - if
$msg_user = LOAD_EMAIL_TEMPLATE("order-accept", array(), $DATA['sender']);
// Send email
- SEND_EMAIL($DATA['sender'], MEMBER_ORDER_ACCEPTED, $msg_user);
+ sendEmail($DATA['sender'], MEMBER_ORDER_ACCEPTED, $msg_user);
// Unlock selected email
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='NEW' WHERE id=%s AND data_type='ADMIN' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='NEW' WHERE `id`=%s AND data_type='ADMIN' LIMIT 1",
array($id), __FILE__, __LINE__);
} // END - if
} // END - foreach
// Set message
- $message = ADMIN_MAILS_ACTIVATED;
+ $message = getMessage('ADMIN_MAILS_ACTIVATED');
} else {
// Nothing checked!
- $message = ADMIN_MAILS_NOTHING_CHECKED;
+ $message = getMessage('ADMIN_MAILS_NOTHING_CHECKED');
}
// Mails unlocked for mail delivery
$id = bigintval($id);
// Load URL and subject from pool
- $result = SQL_QUERY_ESC("SELECT url, subject, sender FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT url, subject, sender FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
array($id), __FILE__, __LINE__);
// Load data
// Load email template and send it away
$msg_user = LOAD_EMAIL_TEMPLATE("order-reject", array(), $DATA['sender']);
- SEND_EMAIL($DATA['sender'], MEMBER_ORDER_REJECTED, $msg_user);
+ sendEmail($DATA['sender'], getMessage('MEMBER_ORDER_REJECTED'), $msg_user);
// If you do not enter an URL to redirect to, your URL will be set!
if ((!REQUEST_ISSET_POST(('redirect'))) || (REQUEST_POST('redirect') == "http://")) REQUEST_SET_POST('redirect', constant('URL'));
// Redirect URL
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET url='%s', data_type='NEW' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET url='%s', data_type='NEW' WHERE `id`=%s LIMIT 1",
array(REQUEST_POST('redirect'), $id),__FILE__, __LINE__);
// Prepare data for the row template
'sw' => $SW,
'id' => $content['id'],
'sender' => $content['sender'],
- 'u_link' => ADMIN_USER_PROFILE_LINK($content['sender']),
+ 'u_link' => generateUserProfileLink($content['sender']),
'subj' => COMPILE_CODE($content['subject']),
'tester' => FRAMETESTER($content['url']),
'url' => $content['url'],
- 'cat_title' => str_replace("\"", """, GET_CATEGORY($content['category'])),
+ 'cat_title' => str_replace("\"", """, getCategory($content['category'])),
'cat_link' => $content['category'],
- 'pay_title' => str_replace("\"", """, GET_PAYMENT($content['payment'], true)),
+ 'pay_title' => str_replace("\"", """, getPaymentTitlePrice($content['payment'], true)),
'pay_link' => $content['payment'],
- 'ordered' => MAKE_DATETIME($content['timestamp'], "2"),
+ 'ordered' => generateDateTime($content['timestamp'], "2"),
'tsend' => $content['target_send'],
);
// Check if admin has submitted form
if (IS_FORM_SENT()) {
// Does he have selected at least one sponsor?
- if (SELECTION_COUNT(REQUEST_POST('id')) > 0) {
+ if (countSelection(REQUEST_POST('id')) > 0) {
// At least one entry selected
foreach (REQUEST_POST('id') as $id => $selected) {
// Secure ID number and init $content
// Set default email
$content['email'] = getMessage('SPONSOR_NO_ADMIN');
- if ($content['aid'] > "0") {
+ if ($content['aid'] > '0') {
// Load admin's email address for contact
- $content['email'] = GET_ADMIN_EMAIL($content['aid']);
+ $content['email'] = getAdminEmail($content['aid']);
} // END - if
// Transfer data to array
$data = array(
'aid' => $content['email'],
'order' => ($content['pay_count'] * $content['pay_rate'])." ".$content['pay_currency'],
- 'stamp' => MAKE_DATETIME($content['pay_ordered'], "2"),
+ 'stamp' => generateDateTime($content['pay_ordered'], "2"),
'pname' => $content['pay_name'],
);
// Unlock sponsor account
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='CONFIRMED'
-WHERE id='%s' AND `status`='PENDING' LIMIT 1",
+WHERE `id`='%s' AND `status`='PENDING' LIMIT 1",
array($content['id']), __FILE__, __LINE__);
// Update, if applyable, referal count and points
// Update referal account
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data`
SET points_amount=points_amount+%s, ref_count=ref_count+1
-WHERE id='%s' LIMIT 1",
+WHERE `id`='%s' LIMIT 1",
array(getConfig('sponsor_ref_points'), bigintval($content['refid'])), __FILE__, __LINE__);
// Whas that update fine?
$result = SQL_QUERY_ESC("SELECT id, gender, surname, family, email,
(points_amount - points_used) AS points, receive_warnings, ref_count AS refs
FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE id='%s' LIMIT 1",
+WHERE `id`='%s' LIMIT 1",
array(bigintval($content['refid'])), __FILE__, __LINE__);
$REFERRAL = SQL_FETCHARRAY($result);
// Send warnings out?
if ($REFERRAL['receive_warnings'] == 'Y') {
// Translate some data
- $REFERRAL['points'] = TRANSLATE_COMMA($REFERRAL['points']);
- $REFERRAL['ref_points'] = TRANSLATE_COMMA(getConfig('sponsor_ref_points'));
- $REFERRAL['gender'] = TRANSLATE_GENDER($REFERRAL['gender']);
+ $REFERRAL['points'] = translateComma($REFERRAL['points']);
+ $REFERRAL['ref_points'] = translateComma(getConfig('sponsor_ref_points'));
+ $REFERRAL['gender'] = translateGender($REFERRAL['gender']);
// Send notification to referal
$REF_MSG = LOAD_EMAIL_TEMPLATE("sponsor_ref_notify", $REFERRAL);
- SEND_EMAIL($REFERRAL['email'], getMessage('SPONSOR_REF_NOTIFY_SUBJ'), $REF_MSG);
+ sendEmail($REFERRAL['email'], getMessage('SPONSOR_REF_NOTIFY_SUBJ'), $REF_MSG);
}
// Free memory
}
// Transfer data to array
- $content['gender'] = TRANSLATE_GENDER($content['gender']);
+ $content['gender'] = translateGender($content['gender']);
$content['sponsor'] = $content['id'];
- $content['points'] = TRANSLATE_COMMA($content['points_amount']);
+ $content['points'] = translateComma($content['points_amount']);
// So let's send the email away
$msg = LOAD_EMAIL_TEMPLATE("sponsor_unlocked", $content);
- SEND_EMAIL($content['email'], getMessage('SPONSOR_UNLOCKED_SUBJ'), $msg);
+ sendEmail($content['email'], getMessage('SPONSOR_UNLOCKED_SUBJ'), $msg);
}
} else {
// Nothing selected
$content = array(
'sw' => $SW,
'id' => $content['id'],
- 'gender' => TRANSLATE_GENDER($content['gender']),
+ 'gender' => translateGender($content['gender']),
'surname' => $content['surname'],
'family' => $content['family'],
'email' => "mailto:".$content['email'],
'remote' => $content['remote_addr'],
- 'created' => MAKE_DATETIME($content['sponsor_created'], "2"),
+ 'created' => generateDateTime($content['sponsor_created'], "2"),
);
// Load row template and switch colors
while ($content = SQL_FETCHARRAY($result)) {
// "Translate"/add content
$content['sw'] = $SW;
- $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
+ $content['userid'] = generateUserProfileLink($content['userid']);
$content['framekiller'] = FRAMETESTER($content['url']);
- $content['registered'] = MAKE_DATETIME($content['registered'], 2);
+ $content['registered'] = generateDateTime($content['registered'], 2);
// Load row template
$OUT .= LOAD_TEMPLATE("admin_unlock_surfbar_urls_row", true, $content);
ADD_DESCR('admin', __FILE__);
// Init array
-$ONLINE['code'] = "???";
+$ONLINE['code'] = '???';
// Get response from our server in an array
-$response = GET_URL("check-updates3.php");
+$response = sendGetRequest('check-updates3.php');
if (empty($response[0]) && empty($response[1]) && empty($response[2]) && empty($response[3])) {
// Error!
- $response = array("", '', '');
+ $response = array('', '', '');
} else {
// Analyse header for response code
if (eregi("200 OK", $response[0])) {
$PATCHES['fname'][] = str_replace("\n", '', $response[$idx * 5 + 2]);
$PATCHES['fsize'][] = str_replace("\n", '', $response[$idx * 5 + 3]);
$PATCHES['ctime'][] = str_replace("\n", '', $response[$idx * 5 + 4]);
- switch (GET_LANGUAGE()) {
- case "de": $PATCHES['descr'][] = str_replace("\n", '', $response[$idx * 5 + 5]); break; // Load german description
+ switch (getLanguage()) {
+ case 'de': $PATCHES['descr'][] = str_replace("\n", '', $response[$idx * 5 + 5]); break; // Load german description
default : $PATCHES['descr'][] = str_replace("\n", '', $response[$idx * 5 + 6]); break; // Load english description as default
}
} elseif (($ONLINE['version'] != constant('FULL_VERSION')) || ($ONLINE['revision'] != constant('CURR_SVN_REVISION'))) {
// New full-version available (all previous released patches are included in this version!)
define('__ONLINE_VERSION', $ONLINE['version']);
- define('__ONLINE_CHANGE' , MAKE_DATETIME($ONLINE['changed'], "2"));
+ define('__ONLINE_CHANGE' , generateDateTime($ONLINE['changed'], "2"));
define('__ONLINE_REVISION', $ONLINE['revision']);
// Load template
ADD_DESCR('admin', __FILE__);
// Base directory (should be moved to database)
-$usage = getConfig('usage_base')."/";
+$usage = getConfig('usage_base').'/';
if (REQUEST_ISSET_GET(('image'))) {
if (REQUEST_GET('type') == 'usage') {
);
}
- if (FILE_READABLE($FQFN)) {
+ if (isFileReadable($FQFN)) {
$image = imagecreatefrompng($FQFN);
header("Content-type: image/png");
imagepng($image);
);
}
-if ((!empty($FQFN)) && (FILE_READABLE($FQFN))) {
+if ((!empty($FQFN)) && (isFileReadable($FQFN))) {
// @TODO This code is double, see LOAD_TEMPLATE and LOAD_EMAIL_TEMPLATE in functions.php
- $tmpl_file = READ_FILE($FQFN);
+ $tmpl_file = readFromFile($FQFN);
$tmpl_file = SQL_ESCAPE($tmpl_file);
$tmpl_file = "\$content=\"".$tmpl_file."\";";
eval($tmpl_file);
// Send contact form out
$msg = LOAD_EMAIL_TEMPLATE("member_contct", $content);
- SEND_EMAIL($content['email'], getMessage('ADMIN_CONTACT_USER_SUBJECT'), $msg);
+ sendEmail($content['email'], getMessage('ADMIN_CONTACT_USER_SUBJECT'), $msg);
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_USER_CONTACTED'));
} else {
// Load contact form template
}
} else {
// Not found?
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(USER_ACCOUNT_404, bigintval(REQUEST_GET('uid'))));
+ LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('USER_ACCOUNT_404'), bigintval(REQUEST_GET('uid'))));
}
// Free result
// Count guests, members and admins
// @TODO Rewrite these constants
// @TODO Add a filter for sponsor
- define('_GUESTS_ONLINE' , GET_TOTAL_DATA("N", 'online', "id", "is_admin", true, " AND is_member='N'"));
- define('_ADMINS_ONLINE' , GET_TOTAL_DATA("N", 'online', "id", "is_admin", true, " AND is_member='Y'"));
- define('_MEMBERS_ONLINE', GET_TOTAL_DATA("N", 'online', "id", "is_admin", true));
+ define('_GUESTS_ONLINE' , GET_TOTAL_DATA('N', 'online', 'id', 'is_admin', true, " AND `is_member`='N'"));
+ define('_ADMINS_ONLINE' , GET_TOTAL_DATA('N', 'online', 'id', 'is_admin', true, " AND `is_member`='Y'"));
+ define('_MEMBERS_ONLINE', GET_TOTAL_DATA('N', 'online', 'id', 'is_admin', true));
// Load template
- LOAD_TEMPLATE("admin_mini_online");
+ LOAD_TEMPLATE('admin_mini_online');
// Check for online users
$result = SQL_QUERY("SELECT id, ip, userid, refid, module, action, what, is_member, is_admin, timestamp FROM `{!_MYSQL_PREFIX!}_online` ORDER by timestamp DESC",
__FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Load header template
- LOAD_TEMPLATE("admin_online_header");
+ LOAD_TEMPLATE('admin_online_header');
// List all online users
$SW = 2;
$content['userid'] = getMessage('_IS_GUEST');
} elseif ($content['userid'] > 0) {
// Add profile link to userid
- $content['userid'] = ADMIN_USER_PROFILE_LINK($content['userid']);
+ $content['userid'] = generateUserProfileLink($content['userid']);
} // END - if
// Is the refid set?
if ($content['refid'] > 0) {
// Add profile link to referer id
- $content['refid'] = ADMIN_USER_PROFILE_LINK($content['refid']);
+ $content['refid'] = generateUserProfileLink($content['refid']);
} // END - if
OUTPUT_HTML("<tr>
<td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$content['module']."</td>
<td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$content['action']."</td>
<td align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$content['what']."</td>
- <td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom\">".MAKE_DATETIME($content['timestamp'], "2")."</td>
+ <td align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom\">".generateDateTime($content['timestamp'], '2')."</td>
</tr>");
$SW = 3 - $SW;
} // END - while
SQL_FREERESULT($result);
// @TODO Rewrite this constant
- define('__FANCY_ONLINE_TIMEOUT', CREATE_FANCY_TIME(getConfig('online_timeout')));
+ define('__FANCY_ONLINE_TIMEOUT', createFancyTime(getConfig('online_timeout')));
// Load footer template
- LOAD_TEMPLATE("admin_online_footer");
+ LOAD_TEMPLATE('admin_online_footer');
} // END - if
} else {
// Online statistics deactivated!
SQL_FREERESULT($result);
// Change to new theme
- set_session('mxchange_theme', $data['curr_theme']);
+ setSession('mxchange_theme', $data['curr_theme']);
// Remmeber login failures if available
if (GET_EXT_VERSION('sql_patches') >= '0.6.1') {
array(getUserId()), __FILE__, __LINE__);
// Store it in session
- set_session('mxchange_member_failures', $data['login_failures']);
- set_session('mxchange_member_last_fail', $data['last_failure']);
+ setSession('mxchange_member_failures', $data['login_failures']);
+ setSession('mxchange_member_last_fail', $data['last_failure']);
} // END - if
// Bonus is not given by default ;-)
if (($bonus) && (REQUEST_GET('mode') == 'bonus') && (EXT_IS_ACTIVE('bonus'))) {
// Output message with added points
$message .= "<div class=\"tiny\">
- ".sprintf(getMessage('BONUS_LOGIN_BONUS_ADDED'), TRANSLATE_COMMA(getConfig('login_bonus')))."
+ ".sprintf(getMessage('BONUS_LOGIN_BONUS_ADDED'), translateComma(getConfig('login_bonus')))."
</div>";
} elseif (EXT_IS_ACTIVE('bonus')) {
// No login bonus added!
// Order number placed, is he also logged in?
if (IS_MEMBER()) {
// Ok, test passed... :)
- $result = SQL_QUERY_ESC("SELECT subject, url FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s AND sender=%s AND data_type='TEMP' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT subject, url FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s AND sender=%s AND data_type='TEMP' LIMIT 1",
array(bigintval(REQUEST_GET('order')), getUserId()), __FILE__, __LINE__);
// Finally is the entry valid?
$mode = 'member';
} else {
// Matching line not found!
- LOAD_URL('modules.php?module=index&what=login');
+ redirectToUrl('modules.php?module=index&what=login');
}
// Free memory
SQL_FREERESULT($result);
} else {
// He is no longer logged in
- LOAD_URL('modules.php?module=index&what=login');
+ redirectToUrl('modules.php?module=index&what=login');
}
}
}
} else {
// Go away...
- LOAD_URL('modules.php?module=login');
+ redirectToUrl('modules.php?module=login');
}
//
?>
// Load the include file
$INC = sprintf("inc/modules/guest/what-%s.php", $GLOBALS['what']);
-if (FILE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the guest action module
- LOAD_INC($INC);
+ loadInclude($INC);
} elseif ($IS_VALID) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('GUEST_404_ACTION'), SQL_ESCAPE($GLOBALS['what'])));
} else {
// Only when one admin link is clicked...
$INC = sprintf("inc/modules/guest/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the guest action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('GUEST_404_ACTION'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/guest/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the guest action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('GUEST_404_ACTION'), $GLOBALS['what']);
}
// Load the include file
$INC = sprintf("inc/modules/guest/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the guest action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('GUEST_404_ACTION'), $GLOBALS['what']);
}
}
// Total visitors online
-$total = GET_TOTAL_DATA("", 'online', "id", 'userid', true);
+$total = GET_TOTAL_DATA('', 'online', 'id', 'userid', true);
if (getConfig('mad_count') < $total) {
// Update counter
- UPDATE_CONFIG(array("mad_timestamp", "mad_count"), array(time(), $total));
+ updateConfiguration(array('mad_timestamp', 'mad_count'), array(time(), $total));
} // END - if
// Prepare content
$content = array(
- 'guests' => TRANSLATE_COMMA(GET_TOTAL_DATA("N", 'online', "id", "is_admin", true, " AND is_member='N'")),
- 'members' => TRANSLATE_COMMA(GET_TOTAL_DATA("N", 'online', "id", "is_admin", true, " AND is_member='Y'")),
- 'admins' => TRANSLATE_COMMA(GET_TOTAL_DATA("Y", 'online', "id", "is_admin", true)),
- 'total' => TRANSLATE_COMMA($total)
+ 'guests' => translateComma(GET_TOTAL_DATA('N', 'online', 'id', 'is_admin', true, " AND `is_member`='N'")),
+ 'members' => translateComma(GET_TOTAL_DATA('N', 'online', 'id', 'is_admin', true, " AND `is_member`='Y'")),
+ 'admins' => translateComma(GET_TOTAL_DATA('Y', 'online', 'id', 'is_admin', true)),
+ 'total' => translateComma($total)
);
// Output table
-LOAD_TEMPLATE("online_now", false, $content);
+LOAD_TEMPLATE('online_now', false, $content);
// Add more links in this block
runFilterChain('online_extra_links');
// Load the include file
$INC = sprintf("inc/modules/guest/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the guest action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, getMessage('GUEST_404_ACTION'), $GLOBALS['what']);
}
// If more than 1 is installed output selection box
$act = '';
if (!empty($GLOBALS['action'])) $act = SQL_ESCAPE($GLOBALS['action']);
- $OUT = THEME_SELECTION_BOX('index', $act, $GLOBALS['what'], $result_themes);
+ $OUT = generateThemeSelectionBox('index', $act, $GLOBALS['what'], $result_themes);
} elseif (($num_themes == 1) || ((!IS_ADMIN()) && ($num_themes == 0))) {
// If there's only one just print it's name
- define('__THEME_NAME', GET_CURR_THEME_NAME());
+ define('__THEME_NAME', getCurrentThemeName());
$OUT = LOAD_TEMPLATE("theme_one", true);
} elseif (IS_ADMIN()) {
// If there is no theme installed and there's an admin notify him!
'sw' => $SW,
'uid' => $uid,
'nick' => $nick2,
- 'points' => TRANSLATE_COMMA(GET_TOTAL_DATA($uid, 'user_points', 'points') - GET_TOTAL_DATA($uid, 'user_data', 'used_points')),
- 'last' => MAKE_DATETIME($last, '2'),
+ 'points' => translateComma(GET_TOTAL_DATA($uid, 'user_points', 'points') - GET_TOTAL_DATA($uid, 'user_data', 'used_points')),
+ 'last' => generateDateTime($last, '2'),
);
// Load template
}
// A simple redirect...
-LOAD_URL('modules.php?module=admin');
+redirectToUrl('modules.php?module=admin');
//
?>
ADD_DESCR('guest', __FILE__);
// Prepare constants
-define('__BEG_POINTS' , TRANSLATE_COMMA(getConfig('beg_points')));
-define('__BEG_POINTS_MAX', TRANSLATE_COMMA(getConfig('beg_points_max')));
+define('__BEG_POINTS' , translateComma(getConfig('beg_points')));
+define('__BEG_POINTS_MAX', translateComma(getConfig('beg_points_max')));
if ($GLOBALS['refid'] > 0) {
// Take referal ID from URL/Cookie
define('__BEG_UID' , $GLOBALS['refid']);
}
// Selection boxes are now the default
-define('__BEG_TIMEOUT' , CREATE_FANCY_TIME(getConfig('beg_timeout')));
-define('__BEG_UID_TIMEOUT', CREATE_FANCY_TIME(getConfig('beg_uid_timeout')));
+define('__BEG_TIMEOUT' , createFancyTime(getConfig('beg_timeout')));
+define('__BEG_UID_TIMEOUT', createFancyTime(getConfig('beg_uid_timeout')));
// Load final template
LOAD_TEMPLATE("guest_".substr(basename(__FILE__), 5, -4));
$msg = LOAD_EMAIL_TEMPLATE("confirm-member", array('points' => getConfig('points_register')), bigintval($uid));
// And send him right away the confirmation mail
- SEND_EMAIL($email, getMessage('GUEST_THANX_CONFIRM'), $msg);
+ sendEmail($email, getMessage('GUEST_THANX_CONFIRM'), $msg);
// Maybe he got "referaled"?
if (($rid > 0) && ($rid != $uid)) {
array(bigintval($rid)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Update ref counter...
- UPDATE_REF_COUNTER($rid);
+ updateReferalCounter($rid);
// Ok, write the ref-points to this user and his parent-ref
unset($GLOBALS['ref_level']);
// Shall I "pay" the referal points imidiately?
- if (getConfig('ref_payout') == "0") {
+ if (getConfig('ref_payout') == '0') {
// Yes, "pay" it now
$locked = false;
} else {
// Account confirmed!
if (defined('LEAD_CODE_ENABLED') && defined('LEAD_EXPIRY_TIME')) {
// Set special lead cookie
- set_session('lead_uid', bigintval($uid));
+ setSession('lead_uid', bigintval($uid));
// Lead-Code mode enabled
- LOAD_URL("lead-confirm.php");
+ redirectToUrl("lead-confirm.php");
} else {
define('__CONFIRM_MSG', getMessage('GUEST_CONFIRMED_DONE'));
define('__UID', bigintval($uid));
}
} elseif (defined('LEAD_CODE_ENABLED') && defined('LEAD_EXPIRY_TIME')) {
// Set special lead cookie
- set_session('lead_uid', bigintval($uid));
+ setSession('lead_uid', bigintval($uid));
// Lead-Code mode enabled
- LOAD_URL("lead-confirm.php");
+ redirectToUrl("lead-confirm.php");
} else {
// Nobody was found unter this hash key... or our new member want's to confirm twice?
define('__CONFIRM_MSG', getMessage('GUEST_CONFIRMED_TWICE'));
- define('__UID', "0");
+ define('__UID', '0');
LOAD_TEMPLATE("guest_confirm_table");
}
} else {
// Nobody was found unter this hash key... or our new member want's to confirm twice?
define('__CONFIRM_MSG', getMessage('GUEST_CONFIRMED_TWICE'));
- define('__UID', "0");
+ define('__UID', '0');
LOAD_TEMPLATE("guest_confirm_table");
}
} elseif ((IS_FORM_SENT()) && (REQUEST_ISSET_POST(('email')))) {
{
case "UNCONFIRMED": // Account not confirmed
$msg = LOAD_EMAIL_TEMPLATE("guest_request_confirm", array('hash' => $DATA[2]), $DATA[0]);
- SEND_EMAIL(REQUEST_POST('email'), getMessage('REQUEST_CONFIRM_LINK_SUBJ'), $msg);
+ sendEmail(REQUEST_POST('email'), getMessage('REQUEST_CONFIRM_LINK_SUBJ'), $msg);
$content = getMessage('CONFIRM_LINK_SENT');
break;
- case "CONFIRMED": // Account already confirmed
+ case 'CONFIRMED': // Account already confirmed
$content = getMessage('LOGIN_ID_CONFIRMED');
break;
ADD_DESCR('guest', __FILE__);
// Percent values etc.
-define('__CHARGE_VALUE', TRANSLATE_COMMA(getConfig('doubler_charge') * 100));
-define('__REF_VALUE' , TRANSLATE_COMMA(getConfig('doubler_ref') * 100));
-define('__TOTAL_VALUE' , TRANSLATE_COMMA(getConfig('doubler_points')));
-define('__MIN_VALUE' , TRANSLATE_COMMA(getConfig('doubler_min')));
-define('__MAX_VALUE' , TRANSLATE_COMMA(getConfig('doubler_max')));
+define('__CHARGE_VALUE', translateComma(getConfig('doubler_charge') * 100));
+define('__REF_VALUE' , translateComma(getConfig('doubler_ref') * 100));
+define('__TOTAL_VALUE' , translateComma(getConfig('doubler_points')));
+define('__MIN_VALUE' , translateComma(getConfig('doubler_min')));
+define('__MAX_VALUE' , translateComma(getConfig('doubler_max')));
// Transfer referal ID
define('__REFID', $GLOBALS['refid']);
}
// Generate table with already payed out doubles
-define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE("0", "Y", "N", "DESC"));
+define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE('0', 'Y', 'N', "DESC"));
// Generate table with next-to-run payouts
define('__DOUBLER_PAYOUT_NEXT', DOUBLER_GENERATE_TABLE());
// Generate timemark
-define('__TIMEOUT_MARK', CREATE_FANCY_TIME(getConfig('doubler_timeout')));
+define('__TIMEOUT_MARK', createFancyTime(getConfig('doubler_timeout')));
// Points left to double
define('__LEFT_VALUE', DOUBLER_GET_TOTAL_POINTS_LEFT());
if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
// Maybe, then continue with it
$uid = getUserId();
-} elseif ((REQUEST_ISSET_POST(('id'))) && (REQUEST_ISSET_POST(('password'))) && (IS_FORM_SENT())) {
+} elseif ((REQUEST_ISSET_POST('id')) && (REQUEST_ISSET_POST(('password'))) && (IS_FORM_SENT())) {
// Set userid and crypt password when login data was submitted
if ((EXT_IS_ACTIVE('nickname')) && (NICKNAME_PROBE_ON_USERID(REQUEST_POST('id')))) {
// Nickname entered
} elseif (REQUEST_ISSET_POST(('new_pass'))) {
// New password requested
$uid = 0;
- if (REQUEST_ISSET_POST(('id'))) $uid = REQUEST_POST('id');
+ if (REQUEST_ISSET_POST('id')) $uid = REQUEST_POST('id');
} else {
// Not logged in
$uid = 0; $hash = '';
// URL was constructed
if (getTotalFatalErrors()) {
// Fatal errors!
- LOAD_INC_ONCE('inc/fatal_errors.php');
+ loadIncludeOnce('inc/fatal_errors.php');
} else {
// Load URL
- LOAD_URL($URL);
+ redirectToUrl($URL);
}
} // END - if
ADD_DESCR('guest', __FILE__);
// @TODO Rewrite all constants
-define('value', "value");
-define('lang', "lang");
-define('rows', "rows");
+define('value', 'value');
+define('lang', 'lang');
+define('rows', 'rows');
// Get total confirmed user IDs...
-define('user_confirmed' , round(GET_TOTAL_DATA("CONFIRMED" , "user_data", 'userid', "status", true)));
-define('user_unconfirmed', round(GET_TOTAL_DATA("UNCONFIRMED", "user_data", 'userid', "status", true)));
-define('user_locked' , round(GET_TOTAL_DATA("LOCKED" , "user_data", 'userid', "status", true)));
+define('user_confirmed' , round(GET_TOTAL_DATA('CONFIRMED' , 'user_data', 'userid', 'status', true)));
+define('user_unconfirmed', round(GET_TOTAL_DATA('UNCONFIRMED', 'user_data', 'userid', 'status', true)));
+define('user_locked' , round(GET_TOTAL_DATA('LOCKED' , 'user_data', 'userid', 'status', true)));
define('user_count' , (constant('user_confirmed') + constant('user_unconfirmed') + constant('user_locked')));
// Start of this exchange
-define('__MT_START', MAKE_DATETIME(getConfig('mt_start'), "3"));
+define('__MT_START', generateDateTime(getConfig('mt_start'), '3'));
// Projected number of members
define('__MT_STAGE', getConfig('mt_stage'));
}
// Generate timestamp
-$TEST = MAKE_TIME(0, 0, 0, $PROJECTED);
+$TEST = makeTime(0, 0, 0, $PROJECTED);
if ($TEST > time()) {
- define('__MT_PROJECTED', MAKE_DATETIME($PROJECTED, "3"));
+ define('__MT_PROJECTED', generateDateTime($PROJECTED, '3'));
} else {
define('__MT_PROJECTED', getMessage('USER_PROJECTION_UNKNOWN'));
}
define('user_max_rec', $dummy);
// Max mails per day
-define('max', GET_TOTAL_DATA("CONFIRMED", "user_data", "max_mails", "status", false, " AND `max_mails` > 0"));
+define('max', GET_TOTAL_DATA('CONFIRMED', 'user_data', 'max_mails', 'status', false, " AND `max_mails` > 0"));
// Max mails for this day
-define('rec', GET_TOTAL_DATA("CONFIRMED", "user_data", "receive_mails", "status", false, " AND `receive_mails` > 0"));
+define('rec', GET_TOTAL_DATA('CONFIRMED', 'user_data', 'receive_mails', 'status', false, " AND `receive_mails` > 0"));
// Initial lots of variables
$bmails = 0; $sent = 0; $max = 0; $rec = 0; $clicks = 0;
// Mail orders (only current)
-$nmails = MEDIA_GET_ENTRY("normal_orders");
+$nmails = MEDIA_GET_ENTRY('normal_orders');
if (empty($nmails)) $nmails = 0;
// Mails sent so far
-$clicks = MEDIA_GET_ENTRY("normal_clicks");
-$sent = MEDIA_GET_ENTRY("normal_send");
+$clicks = MEDIA_GET_ENTRY('normal_clicks');
+$sent = MEDIA_GET_ENTRY('normal_send');
if (empty($sent)) $sent = 0;
if (empty($clicks)) $clicks = 0;
// Bonus mails
if (EXT_IS_ACTIVE('bonus')) {
- $bmails = MEDIA_GET_ENTRY("bonus_orders");
+ $bmails = MEDIA_GET_ENTRY('bonus_orders');
if (empty($bmails)) $bmails = 0;
// Count bonus mails clicks / sent mails
- $dmy = MEDIA_GET_ENTRY("bonus_clicks");
- $dmy2 = MEDIA_GET_ENTRY("bonus_send");
+ $dmy = MEDIA_GET_ENTRY('bonus_clicks');
+ $dmy2 = MEDIA_GET_ENTRY('bonus_send');
if (empty($dmy)) $dmy = 0;
if (empty($dmy2)) $dmy2 = 0;
$sent += $dmy2; $clicks += $dmy;
// All clicks
define('user_links', abs($sent - $clicks));
-$clr = "0.00000";
+$clr = '0.00000';
if ($sent > 0) $clr = $clicks / $sent * 100;
-define('_clr', TRANSLATE_COMMA($clr)."%");
+define('_clr', translateComma($clr).'%');
// Load jackpot
$result = SQL_QUERY("SELECT points FROM `{!_MYSQL_PREFIX!}_jackpot` WHERE ok='ok' LIMIT 1", __FILE__, __LINE__);
list($jackpot) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if (empty($jackpot)) $jackpot = 0;
-define('jackpot', TRANSLATE_COMMA($jackpot));
+define('jackpot', translateComma($jackpot));
// Total referal link clicks, total logins
$result = SQL_QUERY("SELECT DISTINCT SUM(d.ref_clicks), SUM(d.total_logins)
if (empty($ref)) $ref = 0;
if (empty($logins)) $logins = 0;
-define('__TOTAL_POINTS' , TRANSLATE_COMMA($points));
+define('__TOTAL_POINTS' , translateComma($points));
define('__TOTAL_REFCLICKS', $ref);
define('__TOTAL_LOGINS' , $logins);
'lang' => MEDIA_BEG_CLICKS,
'value' => $extra
);
- $OUT_EXTRA .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
+ $OUT_EXTRA .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
$ROWS_EXTRA++;
}
if (empty($points2)) $points2 = 0;
// Add header
- $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_hrow", true, getMessage('MEDIA_DOUBLER_HEADER'));
+ $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_hrow', true, getMessage('MEDIA_DOUBLER_HEADER'));
// Add first line (count)
$content = array(
'lang' => getMessage('MEDIA_DOUBLER_COUNT'),
'value' => $count1,
- 'rows' => "4"
+ 'rows' => '4'
);
// Add points
- $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row2", true, $content);
+ $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row2', true, $content);
$content = array(
'lang' => getMessage('MEDIA_DOUBLER_CPOINTS'),
- 'value' => TRANSLATE_COMMA($points1)
+ 'value' => translateComma($points1)
);
- $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
+ $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
$content = array(
'lang' => getMessage('MEDIA_DOUBLER_WAITING'),
- 'value' => TRANSLATE_COMMA($count2)
+ 'value' => translateComma($count2)
);
- $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
+ $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
$content = array(
'lang' => getMessage('MEDIA_DOUBLER_WPOINTS'),
- 'value' => TRANSLATE_COMMA($points2)
+ 'value' => translateComma($points2)
);
- $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
+ $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
}
if (EXT_IS_ACTIVE('holiday')) {
'lang' => getMessage('MEDIA_HOLIDAY_COUNT'),
'value' => $holiday
);
- $OUT_USER .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
+ $OUT_USER .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
$ROWS_USER++;
}
if (empty($points_out)) $points_out = 0;
// Add header
- $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_hrow", true, getMessage('MEDIA_TRANSFER_HEADER'));
+ $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_hrow', true, getMessage('MEDIA_TRANSFER_HEADER'));
$content = array(
'lang' => getMessage('MEDIA_TRANSFER_IN_COUNT'),
'value' => $count_in,
- 'rows' => "4"
+ 'rows' => '4'
);
- $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row2", true, $content);
+ $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row2', true, $content);
$content = array(
'lang' => getMessage('MEDIA_TRANSFER_IN_POINTS'),
- 'value' => TRANSLATE_COMMA($points_in)
+ 'value' => translateComma($points_in)
);
- $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
+ $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
$content = array(
'lang' => getMessage('MEDIA_TRANSFER_OUT_COUNT'),
'value' => $count_out
);
- $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
+ $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
$content = array(
'lang' => getMessage('MEDIA_TRANSFER_OUT_POINTS'),
- 'value' => TRANSLATE_COMMA($points_out)
+ 'value' => translateComma($points_out)
);
- $OUT_SPECIAL .= LOAD_TEMPLATE("mediadata_extra_row", true, $content);
+ $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
}
define('__EXTRA_MEDIADATA' , $OUT_EXTRA);
// Patch level and it's timespamp
define('__PATCH_LEVEL', getConfig('patch_level'));
-define('__PATCH_CTIME', MAKE_DATETIME(getConfig('patch_ctime'), "2"));
+define('__PATCH_CTIME', generateDateTime(getConfig('patch_ctime'), '2'));
// Load template
LOAD_TEMPLATE('mediadata');
// Add description as navigation point
ADD_DESCR('guest', __FILE__);
+// Open div tag
OUTPUT_HTML("<div align=\"center\">");
// Check for possible running rallyes
WHERE d.admin_id=a.id".$ADMIN." AND d.notified='Y'
ORDER BY d.end_time LIMIT 1", __FILE__, __LINE__);
-if (SQL_NUMROWS($result) == 1)
-{
+if (SQL_NUMROWS($result) == 1) {
// Found some (normally one...
list($id, $aid, $login, $title, $descr, $templ, $start, $end, $min_users, $min_prices) = SQL_FETCHROW($result);
$expired = false;
- if ($end < time())
- {
+ if ($end < time()) {
// Rallye is expired
- define('__RALLYE_EXTRAS', RALLYE_HAS_EXPIRED);
+ define('__RALLYE_EXTRAS', getMessage('RALLYE_HAS_EXPIRED'));
$expired = true;
- }
- elseif (time() >= ($end - getConfig('one_day')))
- {
+ } elseif (time() >= ($end - getConfig('one_day'))) {
// Rallye will expire in less one day!
- define('__RALLYE_EXTRAS', RALLYE_EXPIRE_ONE_DAY);
- }
- else
- {
- define('__RALLYE_EXTRAS', "<a href=\"{!URL!}/modules.php?module=index&what=register\">".RALLYE_REGISTER_NOW."</a>");
+ define('__RALLYE_EXTRAS', getMessage('RALLYE_EXPIRE_ONE_DAY'));
+ } else {
+ define('__RALLYE_EXTRAS', "<a href=\"{!URL!}/modules.php?module=index&what=register\">{--RALLYE_REGISTER_NOW--}</a>");
}
// Set admin line (currently set to impressum, later to contact form)
define('__RALLYE_ADMIN', "<a href=\"{!URL!}/modules.php?module=index&what=impressum&admin=".$aid."\">".$login."</a>");
}
// Set start and end time
- define('__RALLYE_START', MAKE_DATETIME($start, "1"));
- define('__RALLYE_END' , MAKE_DATETIME($end , "1"));
+ define('__RALLYE_START', generateDateTime($start, "1"));
+ define('__RALLYE_END' , generateDateTime($end , "1"));
// Determine min_users
define('__RALLYE_MAX_USERS', RALLYE_DETERMINE_MIN_USERS($min_users));
if ($min_prices == 0) {
// Rallye ends without user limitation
- define('__RALLYE_MIN_PRICES', RALLYE_END_NO_PRICE_LIMITATION);
+ define('__RALLYE_MIN_PRICES', getMessage('RALLYE_END_NO_PRICE_LIMITATION'));
} else {
// Rallye ends when X members are totally in your exchange
- define('__RALLYE_MIN_PRICES', RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2);
+ define('__RALLYE_MIN_PRICES', getMessage('RALLYE_END_PRICES_1') . ' ' . $min_prices . ' ' . getMessage('RALLYE_END_PRICES_2'));
}
if ($expired === true) {
define('__RALLYE_PRICES', RALLYE_LIST_WINNERS($id));
- define('__RALLYE_TOP_USERS', "<div align=\"center\" class=\"big\">".__RALLYE_EXTRAS."</div>");
- define('__RALLYE_CAN_WIN_THIS', RALLYE_OUR_WINNERS_ARE);
+ define('__RALLYE_TOP_USERS', "<div align=\"center\" class=\"big\">{!__RALLYE_EXTRAS!}</div>");
+ define('__RALLYE_CAN_WIN_THIS', getMessage('RALLYE_OUR_WINNERS_ARE'));
} else {
define('__RALLYE_PRICES', RALLYE_ADD_PRICES($id, 'html'));
define('__RALLYE_TOP_USERS', RALLYE_ADD_TOPUSERS($id, getUserId()));
- define('__RALLYE_CAN_WIN_THIS', RALLYE_YOU_CAN_WIN);
+ define('__RALLYE_CAN_WIN_THIS', getMessage('RALLYE_YOU_CAN_WIN'));
}
// And load final template
LOAD_TEMPLATE("guest_rallye_show");
-}
- else
-{
+} else {
// No rallye found so far
LOAD_TEMPLATE("guest_no_rallyes");
}
-//
+
+// Close the div tag
OUTPUT_HTML("</div>");
+
//
?>
if (SQL_NUMROWS($result) == 0) {
// Not found so we set your refid!
REQUEST_SET_POST('refid', getConfig('def_refid'));
- set_session('refid', getConfig('def_refid'));
+ setSession('refid', getConfig('def_refid'));
} else {
// Use the refid here
REQUEST_SET_POST('refid', $GLOBALS['refid']);
//
// Did he agree to our Terms Of Usage?
if (REQUEST_POST('agree') != 'Y') {
- REQUEST_SET_POST('agree', "!");
+ REQUEST_SET_POST('agree', '!');
$FAILED = true;
} // END - if
// Did he enter a valid email address? (we really don't care about
// that, he has to click on a confirmation link :P )
if ((!REQUEST_ISSET_POST(('addy'))) || (!VALIDATE_EMAIL(REQUEST_POST('addy')))) {
- REQUEST_SET_POST('addy', "!");
+ REQUEST_SET_POST('addy', '!');
$FAILED = true;
} // END - if
// And what about surname and family's name?
if (!REQUEST_ISSET_POST(('surname'))) {
- REQUEST_SET_POST('surname', "!");
+ REQUEST_SET_POST('surname', '!');
$FAILED = true;
} // END - if
if (!REQUEST_ISSET_POST(('family'))) {
- REQUEST_SET_POST('family', "!");
+ REQUEST_SET_POST('family', '!');
$FAILED = true;
} // END - if
// Did he enter his password twice?
if (((!REQUEST_ISSET_POST(('pass1'))) || (!REQUEST_ISSET_POST(('pass2')))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))))) {
if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2')))) {
- REQUEST_SET_POST('pass1', "!");
- REQUEST_SET_POST('pass2', "!");
+ REQUEST_SET_POST('pass1', '!');
+ REQUEST_SET_POST('pass2', '!');
} else {
- if (!REQUEST_ISSET_POST(('pass1'))) { REQUEST_SET_POST('pass1', "!"); } else { REQUEST_SET_POST('pass1', ''); }
- if (!REQUEST_ISSET_POST(('pass2'))) { REQUEST_SET_POST('pass2', "!"); } else { REQUEST_SET_POST('pass2', ''); }
+ if (!REQUEST_ISSET_POST(('pass1'))) { REQUEST_SET_POST('pass1', '!'); } else { REQUEST_SET_POST('pass1', ''); }
+ if (!REQUEST_ISSET_POST(('pass2'))) { REQUEST_SET_POST('pass2', '!'); } else { REQUEST_SET_POST('pass2', ''); }
}
$FAILED = true;
} // END - if
} // END - if
} // END - if
- if ((REQUEST_POST('addy') != "!") && (getConfig('check_double_email') == 'Y')) {
+ if ((REQUEST_POST('addy') != '!') && (getConfig('check_double_email') == 'Y')) {
// Does the email address already exists in our database?
- $CHK = SEARCH_EMAIL_USERTAB(REQUEST_POST('addy'));
- if ($CHK) { REQUEST_SET_POST('addy', "?"); $FAILED = true; }
+ $CHK = isEmailTaken(REQUEST_POST('addy'));
+ if ($CHK === true) {
+ REQUEST_SET_POST('addy', '?');
+ $FAILED = true;
+ } // END - if
} // END - if
// Check for IP timeout?
if (getConfig('ip_timeout') > 0) {
// Check his IP number
$result = SQL_QUERY_ESC("SELECT joined, last_update FROM `{!_MYSQL_PREFIX!}_user_data` WHERE REMOTE_ADDR='%s' AND (joined > (UNIX_TIMESTAMP() - %s) OR last_update > (UNIX_TIMESTAMP() - %s)) LIMIT 1",
- array(GET_REMOTE_ADDR(), getConfig('ip_timeout'), getConfig('ip_timeout')), __FILE__, __LINE__);
+ array(detectRemoteAddr(), getConfig('ip_timeout'), getConfig('ip_timeout')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Same IP in timeout range and different email address entered... Eat this, faker! ;-)
// But admins are allowed to fake their own exchange service.
if ((IS_FORM_SENT()) && ((!$FAILED) || (IS_ADMIN()))) {
// Prepapre month and day of birth
- if (strlen(REQUEST_POST('day')) == 1) REQUEST_SET_POST('day' , "0".REQUEST_POST('day'));
- if (strlen(REQUEST_POST('month')) == 1) REQUEST_SET_POST('month', "0".REQUEST_POST('month'));
+ if (strlen(REQUEST_POST('day')) == 1) REQUEST_SET_POST('day' , '0'.REQUEST_POST('day'));
+ if (strlen(REQUEST_POST('month')) == 1) REQUEST_SET_POST('month', '0'.REQUEST_POST('month'));
// Get total ...
// ... confirmed, ...
- $confirmedUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true);
+ $confirmedUsers = GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true);
// ... unconfirmed ...
- $unconfirmedUsers = GET_TOTAL_DATA("UNCONFIRMED", "user_data", 'userid', "status", true);
+ $unconfirmedUsers = GET_TOTAL_DATA('UNCONFIRMED', 'user_data', 'userid', 'status', true);
// ... and locked users!
- $lockedUsers = GET_TOTAL_DATA("LOCKED", "user_data", 'userid', "status", true);
+ $lockedUsers = GET_TOTAL_DATA('LOCKED', 'user_data', 'userid', 'status', true);
// Generate hash which will be inserted into confirmation mail
- $hash = generateHash(sha1($confirmedUsers.":".$unconfirmedUsers.":".$lockedUsers.":".REQUEST_POST('month')."-".REQUEST_POST('day')."-".REQUEST_POST('year').":".getenv('SERVER_NAME').":".GET_REMOTE_ADDR().":".GET_USER_AGENT()."/".constant('SITE_KEY')."/".constant('DATE_KEY')."/".constant('RAND_NUMBER')));
+ $hash = generateHash(sha1($confirmedUsers.constant('ENCRYPT_SEPERATOR').$unconfirmedUsers.constant('ENCRYPT_SEPERATOR').$lockedUsers.constant('ENCRYPT_SEPERATOR').REQUEST_POST('month').'-'.REQUEST_POST('day').'-'.REQUEST_POST('year').constant('ENCRYPT_SEPERATOR').getenv('SERVER_NAME').constant('ENCRYPT_SEPERATOR').detectRemoteAddr().constant('ENCRYPT_SEPERATOR').detectUserAgent().'/'.constant('SITE_KEY').'/'.constant('DATE_KEY').'/'.constant('RAND_NUMBER')));
// Add design when extension sql_patches is v0.2.7 or greater
+ // @TODO Rewrite these all to a single filter
$ADD1 = ''; $ADD2 = '';
if (GET_EXT_VERSION('sql_patches') >= '0.2.7') {
// Okay, add design here
- $ADD1 = ", curr_theme";
- $ADD2 = ", '".GET_CURR_THEME()."'";
+ $ADD1 = ", `curr_theme`";
+ $ADD2 = ", '".getCurrentTheme()."'";
} // END - if
// Check if I shall disable sending mail to newly registered members out about active/begging rallye
- // @TODO Rewrite this to a single filter
//
// First comes first: begging rallye
if (GET_EXT_VERSION('beg') >= '0.1.7') {
// Okay, shall I disable now?
if (getConfig('beg_new_mem_notify') != 'Y') {
- $ADD1 .= ", beg_ral_notify, beg_ral_en_notify";
+ $ADD1 .= ", `beg_ral_notify`, `beg_ral_en_notify`";
$ADD2 .= ", UNIX_TIMESTAMP(), UNIX_TIMESTAMP()";
} // END - if
} // END - if
if (GET_EXT_VERSION('bonus') >= '0.7.7') {
// Okay, shall I disable now?
if (getConfig('bonus_new_mem_notify') != 'Y') {
- $ADD1 .= ", bonus_ral_notify, bonus_ral_en_notify";
+ $ADD1 .= ", `bonus_ral_notify`, `bonus_ral_en_notify`";
$ADD2 .= ", UNIX_TIMESTAMP(), UNIX_TIMESTAMP()";
} // END - if
} // END - if
// Write user data to table
if (EXT_IS_ACTIVE('country')) {
// Save with new selectable country code
- $countryRow = "country_code";
+ $countryRow = "`country_code`";
$countryData = bigintval(REQUEST_POST('country_code'));
} else {
// Old way with enterable two-char-code
- $countryRow = 'country';
+ $countryRow = "`country`";
$countryData = substr(REQUEST_POST('cntry'), 0, 2);
}
bigintval(REQUEST_POST('max_mails')),
bigintval(REQUEST_POST('refid')),
$hash,
- GET_REMOTE_ADDR(),
+ detectRemoteAddr(),
), __FILE__, __LINE__);
// Get his userid
// @TODO Rewrite this to a filter
if (EXT_IS_ACTIVE('refback')) {
// Update refback table
- UPDATE_REFBACK_TABLE($userid);
+ updateRefbackTable($userid);
} // END - if
// Write his welcome-points
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s AND ref_depth=0 LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s AND ref_depth=0 LIMIT 1",
array(bigintval($userid)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// Add only when the line was not found (maybe some more secure?)
} // END - if
// Rewrite gender
- $gender = TRANSLATE_GENDER(REQUEST_POST('gender'));
+ $gender = translateGender(REQUEST_POST('gender'));
// ... rewrite a zero referal ID to the main title
- if (REQUEST_POST('refid') == "0") REQUEST_SET_POST('refid', constant('MAIN_TITLE'));
+ if (REQUEST_POST('refid') == '0') REQUEST_SET_POST('refid', constant('MAIN_TITLE'));
// Is ZIP code set?
if (REQUEST_ISSET_POST('zip')) {
}
// Continue with birthday...
- switch (GET_LANGUAGE())
+ switch (getLanguage())
{
- case "de":
- $DATA['birthday'] = bigintval(REQUEST_POST('day')).".".bigintval(REQUEST_POST('month')).".".bigintval(REQUEST_POST('year'));
+ case 'de':
+ $DATA['birthday'] = bigintval(REQUEST_POST('day')).'.'.bigintval(REQUEST_POST('month')).'.'.bigintval(REQUEST_POST('year'));
break;
default:
- $DATA['birthday'] = bigintval(REQUEST_POST('month'))."/".bigintval(REQUEST_POST('day'))."/".bigintval(REQUEST_POST('year'));
+ $DATA['birthday'] = bigintval(REQUEST_POST('month')).'/'.bigintval(REQUEST_POST('day')).'/'.bigintval(REQUEST_POST('year'));
break;
}
// Display information to the user that he got mail and send it away
- $msg_guest = LOAD_EMAIL_TEMPLATE("register-member", $DATA, $userid);
+ $msg_guest = LOAD_EMAIL_TEMPLATE('register-member', $DATA, $userid);
// Send mail to user (confirmation link!)
$EMAIL = $DATA['email'];
- SEND_EMAIL ($DATA['email'], getMessage('GUEST_CONFIRM_LINK'), $msg_guest);
+ sendEmail ($DATA['email'], getMessage('GUEST_CONFIRM_LINK'), $msg_guest);
$DATA['email'] = $EMAIL;
// Send mail to admin
- SEND_ADMIN_NOTIFICATION(getMessage('ADMIN_NEW_ACCOUNT'), "register-admin", $DATA, $userid);
+ sendAdminNotification(getMessage('ADMIN_NEW_ACCOUNT'), 'register-admin', $DATA, $userid);
// Output success registration
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('REGISTRATION_DONE'));
} else {
- if (REQUEST_POST('agree') == "!") {
- OUTPUT_HTML("<div class=\"register_failed\">{--HAVE_TO_AGREE--}</div>");
+ if (REQUEST_POST('agree') == '!') {
+ registerOutputFailedMessage('HAVE_TO_AGREE');
} // END - if
- if (REQUEST_POST('addy') == "!") {
- OUTPUT_HTML("<div class=\"register_failed\">{--ENTER_EMAIL--}</div>");
+ if (REQUEST_POST('addy') == '!') {
+ registerOutputFailedMessage('ENTER_EMAIL');
REQUEST_SET_POST('addy', '');
- } elseif (REQUEST_POST('addy') == "?") {
- OUTPUT_HTML("<div class=\"register_failed\">{--EMAIL_ALREADY_DB--}</div>");
+ } elseif (REQUEST_POST('addy') == '?') {
+ registerOutputFailedMessage('EMAIL_ALREADY_DB');
REQUEST_SET_POST('addy', '');
}
- if (REQUEST_POST('surname') == "!") {
- OUTPUT_HTML("<div class=\"register_failed\">{--ENTER_SURNAME--}</div>");
+ if (REQUEST_POST('surname') == '!') {
+ registerOutputFailedMessage('ENTER_SURNAME');
REQUEST_SET_POST('surname', '');
} // END - if
- if (REQUEST_POST('family') == "!") {
- OUTPUT_HTML("<div class=\"register_failed\">{--ENTER_FAMILY--}</div>");
+ if (REQUEST_POST('family') == '!') {
+ registerOutputFailedMessage('ENTER_FAMILY');
REQUEST_SET_POST('family', '');
} // END - if
- if ((REQUEST_POST('pass1') == "!") && (REQUEST_POST('pass2') == "!")) {
- OUTPUT_HTML("<div class=\"register_failed\">{--ENTER_BOTH_PASSWORDS--}</div>");
- } elseif (REQUEST_POST('pass1') == "!") {
- OUTPUT_HTML("<div class=\"register_failed\">{--ENTER_PASS1--}</div>");
- } elseif (REQUEST_POST('pass2') == "!") {
- OUTPUT_HTML("<div class=\"register_failed\">{--ENTER_PASS2--}</div>");
+ if ((REQUEST_POST('pass1') == '!') && (REQUEST_POST('pass2') == '!')) {
+ registerOutputFailedMessage('ENTER_BOTH_PASSWORDS');
+ } elseif (REQUEST_POST('pass1') == '!') {
+ registerOutputFailedMessage('ENTER_PASS1');
+ } elseif (REQUEST_POST('pass2') == '!') {
+ registerOutputFailedMessage('ENTER_PASS2');
}
if ($SHORT_PASS === true) {
- OUTPUT_HTML("<div class=\"register_failed\">{--SHORT_PASS--}: ".getConfig('pass_len')."</div>");
+ registerOutputFailedMessage('SHORT_PASS', ": ".getConfig('pass_len'));
} // END - if
if ($IP_TIMEOUT === true) {
- OUTPUT_HTML("<div class=\"register_failed\">{--REMOTE_ADDR_TIMEOUT--}</div>");
+ registerOutputFailedMessage('REMOTE_ADDR_TIMEOUT');
} // END - if
if ((!empty($cats)) && ($cats < getConfig('least_cats'))) {
- OUTPUT_HTML("<div class=\"register_failed\">".sprintf(getMessage('CATS_LEAST'), getConfig('least_cats'))."</div>");
+ registerOutputFailedMessage(sprintf(getMessage('CATS_LEAST'), getConfig('least_cats')));
} // END - if
// Generate birthday selection
- switch (GET_LANGUAGE())
+ switch (getLanguage())
{
- case "de": // German date format
- define('BIRTHDAY_SELECTION', ADD_SELECTION("day", REQUEST_POST('day')).ADD_SELECTION("month", REQUEST_POST('month')).ADD_SELECTION("year", REQUEST_POST('year')));
+ case 'de': // German date format
+ define('BIRTHDAY_SELECTION', ADD_SELECTION('day', REQUEST_POST('day')).ADD_SELECTION('month', REQUEST_POST('month')).ADD_SELECTION('year', REQUEST_POST('year')));
break;
default: // Default is the US date format... :)
- define('BIRTHDAY_SELECTION', ADD_SELECTION("month", REQUEST_POST('month')).ADD_SELECTION("day", REQUEST_POST('day')).ADD_SELECTION("year", REQUEST_POST('year')));
+ define('BIRTHDAY_SELECTION', ADD_SELECTION('month', REQUEST_POST('month')).ADD_SELECTION('day', REQUEST_POST('day')).ADD_SELECTION('year', REQUEST_POST('year')));
break;
}
// Adds a table for the guests with all visible categories
- define('CATEGORY_SELECTION', REGISTER_ADD_CATEGORY_TABLE('guest', true));
+ define('CATEGORY_SELECTION', registerGenerateCategoryTable('guest', true));
// Adds maximum receiveable mails list... :)
- define('MAX_RECEIVE_LIST', ADD_MAX_RECEIVE_LIST('guest', '', true));
+ define('MAX_RECEIVE_LIST', addMaxReceiveList('guest', '', true));
// Shall I display the refid or shall I make it editable?
if (getConfig('display_refid') == 'Y') {
// Load "hide" form template
- define('REFID_CONTENT', LOAD_TEMPLATE("guest_register_refid_hide", true, $GLOBALS['refid']));
+ define('REFID_CONTENT', LOAD_TEMPLATE('guest_register_refid_hide', true, $GLOBALS['refid']));
} else {
// Load template to enter it
- define('REFID_CONTENT', LOAD_TEMPLATE("guest_register_refid", true, $GLOBALS['refid']));
+ define('REFID_CONTENT', LOAD_TEMPLATE('guest_register_refid', true, $GLOBALS['refid']));
}
// You may want to modify the register_header.tpl.xx file and not this script when you add your scripts etc. :-)
- define('REGISTER_HEADER_CONTENT', LOAD_TEMPLATE("register_header", true));
+ define('REGISTER_HEADER_CONTENT', LOAD_TEMPLATE('register_header', true));
// Please select at least x categories
define('LEAST_CATS_VALUE', getConfig('least_cats'));
$OUT = "<select name=\"country_code\" class=\"guest_select\" size=\"1\">\n";
$whereStatement = "WHERE is_active='Y'";
if (IS_ADMIN()) $whereStatement = '';
- $OUT .= ADD_OPTION_LINES("countries", "id", "descr", REQUEST_POST('country_code'), "code", $whereStatement);
+ $OUT .= generateOptionList('countries', 'id', 'descr', REQUEST_POST('country_code'), 'code', $whereStatement);
$OUT .= "</select>";
define('__COUNTRY_CONTENT', $OUT);
} else {
}
// Set MUST_??? constants
- if ((EXT_IS_ACTIVE('register')) && (GET_EXT_VERSION('register') > '0.0')) REGISTER_FILL_MUST_CONSTANTS();
+ if ((EXT_IS_ACTIVE('register')) && (GET_EXT_VERSION('register') > '0.0')) registerMustFillout();
// Display registration form
- LOAD_TEMPLATE("guest_register");
+ LOAD_TEMPLATE('guest_register');
}
//
$content = array(
'sw' => $SW,
'name' => $content['pay_name'],
- 'rate' => TRANSLATE_COMMA($content['pay_rate']),
+ 'rate' => translateComma($content['pay_rate']),
'min' => $content['pay_min_count'],
'curr' => $content['pay_currency'],
- 'price' => TRANSLATE_COMMA($content['pay_min_count']),
+ 'price' => translateComma($content['pay_min_count']),
);
// Load row template and switch color
$SPONSOR = SQL_FETCHARRAY($result);
// Translate gender and comma
- $SPONSOR['gender'] = TRANSLATE_GENDER($SPONSOR['gender']);
- $SPONSOR['points'] = TRANSLATE_COMMA($SPONSOR['points']);
- $SPONSOR['pay'] = TRANSLATE_COMMA($SPONSOR['pay']);
+ $SPONSOR['gender'] = translateGender($SPONSOR['gender']);
+ $SPONSOR['points'] = translateComma($SPONSOR['points']);
+ $SPONSOR['pay'] = translateComma($SPONSOR['pay']);
// Unconfirmed account or changed email address?
if ($SPONSOR['status'] == 'UNCONFIRMED') {
// Set account to pending
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='PENDING'
-WHERE id='%s' AND hash='%s' AND `status`='UNCONFIRMED' LIMIT 1",
+WHERE `id`='%s' AND hash='%s' AND `status`='UNCONFIRMED' LIMIT 1",
array(bigintval($SPONSOR['id']), REQUEST_GET('hash')), __FILE__, __LINE__);
// Check on success
if (SQL_AFFECTEDROWS() == 1) {
// Prepare mail and send it to the sponsor
$message = LOAD_EMAIL_TEMPLATE('sponsor_pending', $SPONSOR);
- SEND_EMAIL($SPONSOR['email'], getMessage('SPONSOR_ACCOUNT_PENDING_SUBJ'), $message);
+ sendEmail($SPONSOR['email'], getMessage('SPONSOR_ACCOUNT_PENDING_SUBJ'), $message);
// Send email to admin
- SEND_ADMIN_NOTIFICATION(getMessage('ADMIN_NEW_SPONSOR'), 'admin_sponsor_pending', $SPONSOR);
+ sendAdminNotification(getMessage('ADMIN_NEW_SPONSOR'), 'admin_sponsor_pending', $SPONSOR);
// Sponsor account set to pending
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SPONSOR_ACCOUNT_IS_PENDING'));
} elseif ($SPONSOR['status'] == 'EMAIL') {
// Changed email adress need to be confirmed
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='CONFIRMED'
-WHERE id='%s' AND hash='%s' AND `status`='EMAIL' LIMIT 1",
+WHERE `id`='%s' AND hash='%s' AND `status`='EMAIL' LIMIT 1",
array(bigintval($SPONSOR['id']), REQUEST_GET('hash')), __FILE__, __LINE__);
// Check on success
$SPONSOR = SQL_FETCHARRAY($result);
// Translate some data
- $SPONSOR['gender'] = TRANSLATE_GENDER($SPONSOR['gender']);
- $SPONSOR['sponsor_created'] = MAKE_DATETIME($SPONSOR['sponsor_created']);
+ $SPONSOR['gender'] = translateGender($SPONSOR['gender']);
+ $SPONSOR['sponsor_created'] = generateDateTime($SPONSOR['sponsor_created']);
// Prepare email and send it to the sponsor
if ($SPONSOR['status'] == 'UNCONFIRMED') {
// Confirmed email address
$msg_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_email', $SPONSOR);
}
- SEND_EMAIL(REQUEST_POST('email'), SPONSOR_ACTIVATION_LINK_SUBJ, $msg_sponsor);
+ sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_ACTIVATION_LINK_SUBJ'), $msg_sponsor);
// Output message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SPONSOR_ACTIVATION_LINK_SENT'));
$SPONSOR = SQL_FETCHARRAY($result);
// Translate some data
- $SPONSOR['gender'] = TRANSLATE_GENDER($SPONSOR['gender']);
- $SPONSOR['sponsor_created'] = MAKE_DATETIME($SPONSOR['sponsor_created']);
+ $SPONSOR['gender'] = translateGender($SPONSOR['gender']);
+ $SPONSOR['sponsor_created'] = generateDateTime($SPONSOR['sponsor_created']);
// Generate password
- $SPONSOR['password'] = GEN_PASS();
+ $SPONSOR['password'] = generatePassword();
// Prepare email and send it to the sponsor
$msg_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_lost', $SPONSOR);
- SEND_EMAIL(REQUEST_POST('email'), SPONSOR_LOST_PASSWORD_SUBJ, $msg_sponsor);
+ sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_LOST_PASSWORD_SUBJ'), $msg_sponsor);
// Update password
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET password='%s'
-WHERE id='%s' LIMIT 1",
+WHERE `id`='%s' LIMIT 1",
array(md5($SPONSOR['password']), bigintval($SPONSOR['id'])), __FILE__, __LINE__);
// Output message
} elseif (IS_FORM_SENT()) {
// Check status and login data ...
$result = SQL_QUERY_ESC("SELECT status FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE id='%s' AND password='%s' LIMIT 1",
+WHERE `id`='%s' AND password='%s' LIMIT 1",
array(bigintval(REQUEST_POST('sponsorid')), md5(REQUEST_POST('pass'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
list($status) = SQL_FETCHROW($result);
if ($status == 'CONFIRMED') {
// Is confirmed so both is fine and we can continue with login procedure
- $login = ((set_session('sponsorid' , bigintval(REQUEST_POST('sponsorid')))) &&
- (set_session('sponsorpass', md5(REQUEST_POST('pass')) ))
+ $login = ((setSession('sponsorid' , bigintval(REQUEST_POST('sponsorid')))) &&
+ (setSession('sponsorpass', md5(REQUEST_POST('pass')) ))
);
if ($login === true) {
// Cookie setup successfull so we can forward to sponsor area
- LOAD_URL('modules.php?module=sponsor');
+ redirectToUrl('modules.php?module=sponsor');
} else {
// Cookie setup failed!
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SPONSPOR_COOKIE_SETUP_FAILED'));
if (!REQUEST_ISSET_POST(('url'))) {
// Homepage URL is empty
$FORM_ERRORS[] = getMessage('SPONSOR_URL_IS_EMPTY');
- } elseif (!VALIDATE_URL(REQUEST_POST('url'))) {
+ } elseif (!isUrlValid(REQUEST_POST('url'))) {
// Homepage URL is invalid
$FORM_ERRORS[] = getMessage('SPONSOR_URL_IS_INVALID');
REQUEST_SET_POST('url', '');
// Calulate points
$result = SQL_QUERY_ESC("SELECT (pay_rate * pay_min_count) AS points, pay_min_count AS pay, pay_currency AS curr
FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes`
-WHERE id='%s' LIMIT 1", array(REQUEST_POST('pay_type')), __FILE__, __LINE__);
+WHERE `id`='%s' LIMIT 1", array(REQUEST_POST('pay_type')), __FILE__, __LINE__);
list($points, $pay, $curr) = SQL_FETCHROW($result);
// Free memory
define('__EMAIL' , REQUEST_POST('email'));
define('__SURNAME' , REQUEST_POST('surname'));
define('__FAMILY' , REQUEST_POST('family'));
- define('__GENDER' , TRANSLATE_GENDER(REQUEST_POST('gender')));
- define('__TIMESTAMP', MAKE_DATETIME(time(), 0));
+ define('__GENDER' , translateGender(REQUEST_POST('gender')));
+ define('__TIMESTAMP', generateDateTime(time(), 0));
define('__PASSWORD' , REQUEST_POST('pass1'));
// Generate email and send it to the new sponsor
$EMAIL_MSG = LOAD_EMAIL_TEMPLATE("sponsor_confirm", $hash);
- SEND_EMAIL(REQUEST_POST('email'), getMessage('SPONSOR_PLEASE_CONFIRM_SUBJ'), $EMAIL_MSG);
+ sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_PLEASE_CONFIRM_SUBJ'), $EMAIL_MSG);
// Send mail to admin
- SEND_ADMIN_NOTIFICATION(getMessage('ADMIN_NEW_SPONSOR'), "admin_sponsor_reg", $hash);
+ sendAdminNotification(getMessage('ADMIN_NEW_SPONSOR'), "admin_sponsor_reg", $hash);
// Output message: DONE
$message = $messageArray['added'];
while ($content = SQL_FETCHARRAY($result)) {
// Prepare content for output
$content['sw'] = $SW;
- $content['res'] = TRANSLATE_COMMA($content['pay_rate'] * $content['pay_min_count']);
+ $content['res'] = translateComma($content['pay_rate'] * $content['pay_min_count']);
// Load row template and switch color
$OUT .= LOAD_TEMPLATE("guest_sponsor_payment_row", false, $content);
// Prepare referal things
if (!REQUEST_ISSET_GET(('refid'))) {
// No referal link
- define('__SPONSOR_REFID', "0");
+ define('__SPONSOR_REFID', '0');
} else {
// Referal ID transmitted, we don't care here if it is right or not
define('__SPONSOR_REFID', bigintval(REQUEST_GET('refid')));
if (!REQUEST_ISSET_GET(('mode'))) REQUEST_SET_GET('mode', strtolower(getConfig('guest_stats')));
switch (REQUEST_GET('mode')) {
- case "members" :
- setConfigEntry('guest_stats', "MEMBERS");
- $lmode = "modules";
+ case 'members' :
+ setConfigEntry('guest_stats', 'MEMBERS');
+ $lmode = 'modules';
$ltitle = getMessage('GUEST_STATS_MODULES');
break;
- case "modules" :
- setConfigEntry('guest_stats', "MODULES");
- $lmode = "members";
+ case 'modules' :
+ setConfigEntry('guest_stats', 'MODULES');
+ $lmode = 'members';
$ltitle = getMessage('GUEST_STATS_MEMBERS');
break;
- case "inactive":
- setConfigEntry('guest_stats', "INACTIVE");
- $lmode = "inactive";
+ case 'inactive':
+ setConfigEntry('guest_stats', 'INACTIVE');
+ $lmode = 'inactive';
$ltitle = getMessage('GUEST_STATS_INACTIVE');
break;
}
switch (getConfig('guest_stats'))
{
-case "MEMBERS": // Statistics about your members
+case 'MEMBERS': // Statistics about your members
// Members yesterday / today online
- $ymem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".constant('START_YDAY')." AND last_online < ".constant('START_TDAY')." AND `status`='CONFIRMED'", __FILE__, __LINE__));
+ $ymem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".constant('START_YDAY')." AND `last_online` < ".constant('START_TDAY')." AND `status`='CONFIRMED'", __FILE__, __LINE__));
$tmem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".constant('START_TDAY')." AND `status`='CONFIRMED'", __FILE__, __LINE__));
// Yesterday / today registered
$treg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".constant('START_TDAY'), __FILE__, __LINE__));
// Only males / females
- $male = GET_TOTAL_DATA("M", "user_data", 'userid', "gender", true, " AND `status`='CONFIRMED'");
- $female = GET_TOTAL_DATA("F", "user_data", 'userid', "gender", true, " AND `status`='CONFIRMED'");
+ $male = GET_TOTAL_DATA('M', 'user_data', 'userid', 'gender', true, " AND `status`='CONFIRMED'");
+ $female = GET_TOTAL_DATA('F', 'user_data', 'userid', 'gender', true, " AND `status`='CONFIRMED'");
// Unconfirmed accounts
$unconfirmed = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status != 'CONFIRMED'", __FILE__, __LINE__));
$month = $idx;
// Append leading zero
- if ($idx < 10) $month = "0".$idx;
+ if ($idx < 10) $month = '0'.$idx;
// Count months
- $months[$month] = GET_TOTAL_DATA(bigintval($month), "user_data", 'userid', "birth_month", true, " AND `status`='CONFIRMED'");
+ $months[$month] = GET_TOTAL_DATA(bigintval($month), 'user_data', 'userid', 'birth_month', true, " AND `status`='CONFIRMED'");
}
// Members in categories
// Now we have all categories loaded, count members
foreach ($cats as $id => $dummy) {
// We only need id and nothing more to count...
- $cat_cnt[$id] = GET_TOTAL_DATA(bigintval($id), "user_cats", "id", "cat_id", true);
+ $cat_cnt[$id] = GET_TOTAL_DATA(bigintval($id), 'user_cats', 'id', 'cat_id', true);
}
// Prepare data for the template
define('__LINK_TITLE' , $ltitle);
// Generate monthly stats
- $SW = 2; $r2 = " right2"; $l = "ll"; $r = "lr"; $OUT = '';
+ $SW = 2; $r2 = ' right2'; $l = 'll'; $r = 'lr'; $OUT = '';
foreach ($months as $month => $cnt) {
if ($SW == 2) $OUT .= "<tr>\n";
if ($SW == 2) {
$r2 = '';
- $l = "rl"; $r = "rr";
+ $l = 'rl'; $r = 'rr';
} else {
$OUT .= "</tr>\n";
- $r2 = " right2";
- $l = "ll"; $r = "lr";
+ $r2 = ' right2';
+ $l = 'll'; $r = 'lr';
}
$SW = 3 - $SW;
}
);
// Load row template and switch colors
- $OUT .= LOAD_TEMPLATE("guest_stats_cats_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('guest_stats_cats_row', true, $content);
$SW = 3 - $SW;
}
define('__CATS_STATS_ROWS', $OUT);
// Load final template
- LOAD_TEMPLATE("guest_stats_member");
+ LOAD_TEMPLATE('guest_stats_member');
break;
-case "MODULES": // TOP10 module clicks
+case 'MODULES': // TOP10 module clicks
$AND = '';
if (!IS_ADMIN()) $AND = " AND `locked`='N' AND `visible`='Y'";
$guest_t10 = SQL_QUERY("SELECT counter, title FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE counter > 0".$AND." ORDER BY counter DESC LIMIT 0,10", __FILE__, __LINE__);
}
break;
-case "INACTIVE": // Deactivated stats
+case 'INACTIVE': // Deactivated stats
LOAD_TEMPLATE('admin_settings_saved', false, "<strong>{--GUEST_STATS_DEACTIVATED--}</strong>");
break;
}
'uid' => $content['userid'],
'nick' => $content['nickname'],
'logins' => $content['total_logins'],
- 'points' => TRANSLATE_COMMA(GET_TOTAL_DATA($content['userid'], "user_points", "points")),
- 'last' => MAKE_DATETIME($content['last_online'], "3"),
+ 'points' => translateComma(GET_TOTAL_DATA($content['userid'], "user_points", "points")),
+ 'last' => generateDateTime($content['last_online'], "3"),
);
// Load row template
'cnt' => $cnt,
'uid' => $content['userid'],
'nick' => $content['nickname'],
- 'points' => TRANSLATE_COMMA($content['points']),
- 'last' => MAKE_DATETIME($content['last_online'], "3")
+ 'points' => translateComma($content['points']),
+ 'last' => generateDateTime($content['last_online'], "3")
);
// Load row template
'uid' => $content['userid'],
'refs' => $content['refs'],
'nick' => $content['nickname'],
- 'points' => TRANSLATE_COMMA(GET_TOTAL_DATA($content['userid'], "user_points", "points")),
- 'last' => MAKE_DATETIME($content['last_online'], "3")
+ 'points' => translateComma(GET_TOTAL_DATA($content['userid'], "user_points", "points")),
+ 'last' => generateDateTime($content['last_online'], "3")
);
// Load row template
// Prepare content
$content = array(
- 'register' => TRANSLATE_COMMA(getConfig('points_register')),
+ 'register' => translateComma(getConfig('points_register')),
'ref_levels' => $cnt,
- 'ref_points' => TRANSLATE_COMMA(getConfig('points_ref'))
+ 'ref_points' => translateComma(getConfig('points_ref'))
);
// Load default template
}
// Special file
-LOAD_INC_ONCE("inc/rdf.class.php");
+loadIncludeOnce('inc/rdf.class.php');
// Add description as navigation point
ADD_DESCR('guest', __FILE__);
);
// Use proxy?
-if ((getConfig('proxy_host') != "") && (getConfig('proxy_port') > 0)) {
+if ((getConfig('proxy_host') != '') && (getConfig('proxy_port') > 0)) {
// Set proxy data
$rdf->set_proxy(getConfig('proxy_host'), getConfig('proxy_port'));
// Use auth?
- if (getConfig('proxy_username') != "") {
+ if (getConfig('proxy_username') != '') {
// Set auth data
$rdf->set_proxy_auth(getConfig('proxy_username'), getConfig('proxy_password'));
} // END - if
require($INC);
} elseif (!EXT_IS_ACTIVE('sql_patches')) {
// The extension 'sql_patches' *MUST* be activated or you have lot's of problems!
- LOAD_URL('admin.php');
+ redirectToUrl('admin.php');
}
// Load adverstising template
// Adding the main content module here
if (empty($GLOBALS['action'])) {
// Get action value from what value
- $GLOBALS['action'] = GET_ACTION('guest', $GLOBALS['what']);
+ $GLOBALS['action'] = getModeAction('guest', $GLOBALS['what']);
} // END - if
// Add the guest's menu here...
$INC = sprintf("inc/modules/guest/action-%s.php", $GLOBALS['action']);
// Is the file there?
-if ((INCLUDE_READABLE($INC)) && (VALIDATE_MENU_ACTION('guest', $GLOBALS['action'], $GLOBALS['what']))) {
+if ((isIncludeReadable($INC)) && (isMenuActionValid('guest', $GLOBALS['action'], $GLOBALS['what']))) {
// Requested module is available so we load it
- LOAD_INC_ONCE($INC);
+ loadIncludeOnce($INC);
} else {
// Invalid module specified or not found...
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
if ((getConfig('guest_menu') == 'Y') || (!EXT_IS_ACTIVE('sql_patches', true))) {
if (REQUEST_ISSET_GET(('url'))) {
// Decode URL
- $url = decodeString(str_replace(" ", "+", compileUriCode(urldecode(REQUEST_GET('url')))));
+ $url = decodeString(str_replace(' ', '+', compileUriCode(urldecode(REQUEST_GET('url')))));
// Validate the URL
- if (VALIDATE_URL($url)) {
+ if (isUrlValid($url)) {
// Prepare data for the template
define('__URL', $url);
// Generate a JavaScript that redirects us
- LOAD_TEMPLATE("loader");
+ LOAD_TEMPLATE('loader');
} else {
// URL invalid
- LOAD_URL("index.php");
+ redirectToUrl('index.php');
}
} else {
// Invalid or no URL entered!
- LOAD_URL("index.php");
+ redirectToUrl('index.php');
}
//
} elseif (!IS_MEMBER()) {
$URL = 'modules.php?module=index';
if ($check == 'mem_only') $URL .= '&msg='.getCode('MODULE_MEM_ONLY').'&mod='.$GLOBALS['module'];
- LOAD_URL($URL);
+ redirectToUrl($URL);
}
if ($status != 'CONFIRMED') {
// If the status is different than confirmed move the user away from here
- $errorCode = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
+ $errorCode = generateErrorCodeFromUserStatus($status);
// Load URL
- LOAD_URL('modules.php?module=index&what=login&login='.$errorCode);
+ redirectToUrl('modules.php?module=index&what=login&login=' . $errorCode);
} // END - if
// Load adverstising template
// Add the member's menu here...
if ((getConfig('member_menu') == 'Y') || (!EXT_IS_ACTIVE('sql_patches', true))) {
- ADD_MENU('member', GET_ACTION('member', $GLOBALS['what']), $GLOBALS['what']);
+ ADD_MENU('member', getModeAction('member', $GLOBALS['what']), $GLOBALS['what']);
} // END - if
// Menu -> content
<td valign=\"top\" align=\"center\" rowspan=\"3\" class=\"member_content\">");
$INC = sprintf("inc/modules/member/action-%s.php", $act);
-if ((INCLUDE_READABLE($INC)) && (VALIDATE_MENU_ACTION('member', $GLOBALS['action'], $GLOBALS['what']))) {
+if ((isIncludeReadable($INC)) && (isMenuActionValid('member', $GLOBALS['action'], $GLOBALS['what']))) {
// Requested module is available so we load it
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
// Invalid module specified or not found...
- LOAD_URL('modules.php?module=login');
+ redirectToUrl('modules.php?module=login');
}
if ((getConfig('member_menu') == 'Y') || (!EXT_IS_ACTIVE('sql_patches', true))) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_LOGGED_IN()) {
- LOAD_URL(URL."/modules.php?module=index");
+ redirectToUrl(URL."/modules.php?module=index");
} elseif ((!EXT_IS_ACTIVE("")) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, EXTENSION_PROBLEM_EXT_INACTIVE, "");
return;
// Load the include file
$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (FILE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the member action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('MEMBER_404_ACTION'), $GLOBALS['what']));
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ($GLOBALS['block_mode']) {
// Block mode detected
return;
// Load the include file
$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the member action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('MEMBER_404_ACTION'), $GLOBALS['what']));
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('bank')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'bank'));
return;
// Load the include file
$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the member action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('MEMBER_404_ACTION'), $GLOBALS['what']));
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ($GLOBALS['block_mode']) {
// Block mode detected
return;
// Load the include file
$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the member action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('MEMBER_404_ACTION'), $GLOBALS['what']));
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ($GLOBALS['block_mode']) {
// Block mode detected
return;
// Load the include file
$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the member action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('MEMBER_404_ACTION'), $GLOBALS['what']));
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ($GLOBALS['block_mode']) {
// Block mode detected
return;
// Load the include file
$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the member action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('MEMBER_404_ACTION'), $GLOBALS['what']));
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('order')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'order'));
return;
// Load the include file
$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the member action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('MEMBER_404_ACTION'), $GLOBALS['what']));
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ($GLOBALS['block_mode']) {
// Block mode detected
return;
// Load the include file
$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the member action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('MEMBER_404_ACTION'), $GLOBALS['what']));
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ($GLOBALS['block_mode']) {
// Block mode detected
return;
// Load the include file
$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the member action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('MEMBER_404_ACTION'), $GLOBALS['what']));
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('surfbar')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'surfbar'));
return;
// Load the include file
$INC = sprintf("inc/modules/member/what-%s.php", SQL_ESCAPE($GLOBALS['what']));
-if (INCLUDE_READABLE($INC)) {
+if (isIncludeReadable($INC)) {
// Ok, we finally load the member action module
- LOAD_INC($INC);
+ loadInclude($INC);
} else {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('MEMBER_404_ACTION'), $GLOBALS['what']));
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('theme')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'theme'));
return;
$act = ''; $wht = '';
if (!empty($GLOBALS['action'])) $act = SQL_ESCAPE($GLOBALS['action']);
if (!empty($GLOBALS['what'])) $wht = SQL_ESCAPE($GLOBALS['what']);
- $OUT = THEME_SELECTION_BOX("login", $act, $wht, $result_themes);
+ $OUT = generateThemeSelectionBox("login", $act, $wht, $result_themes);
} elseif (($num_themes == 1) || ((!IS_ADMIN()) && ($num_themes == 0))) {
// If there's only one just print it's name
- define('__THEME_NAME', GET_CURR_THEME_NAME());
+ define('__THEME_NAME', getCurrentThemeName());
$OUT = LOAD_TEMPLATE("theme_one", true);
} elseif (IS_ADMIN()) {
// If there is no theme installed and there's an admin notify him!
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_LOGGED_IN()) {
- LOAD_URL(URL."/modules.php?module=index");
+ redirectToUrl(URL."/modules.php?module=index");
}
// Add description as navigation point
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'bank'));
return;
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
// Add description as navigation point
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('bank')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'bank'));
return;
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('bank')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'bank'));
return;
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('bank')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'bank'));
return;
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('bank')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'bank'));
return;
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('beg')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'beg'));
return;
// Prepare constants
define('__BEG_UID' , $uid);
define('__BEG_CLICKS' , $clicks);
-define('__BEG_POINTS' , TRANSLATE_COMMA(getConfig('beg_points')));
-define('__BEG_POINTS_MAX' , TRANSLATE_COMMA(getConfig('beg_points_max')));
-define('__BEG_TIMEOUT' , CREATE_FANCY_TIME(getConfig('beg_timeout')));
-define('__BEG_UID_TIMEOUT', CREATE_FANCY_TIME(getConfig('beg_uid_timeout')));
+define('__BEG_POINTS' , translateComma(getConfig('beg_points')));
+define('__BEG_POINTS_MAX' , translateComma(getConfig('beg_points_max')));
+define('__BEG_TIMEOUT' , createFancyTime(getConfig('beg_timeout')));
+define('__BEG_UID_TIMEOUT', createFancyTime(getConfig('beg_uid_timeout')));
// Load template
LOAD_TEMPLATE("member_".substr(basename(__FILE__), 5, -4));
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('beg')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'beg'));
return;
$lastOnline = "%s"; $ONLINE = '';
if (EXT_IS_ACTIVE('autopurge')) {
// Use last online timestamp to keep inactive members away from here
- $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+ $lastOnline = " AND `last_online` >= (UNIX_TIMESTAMP() - %s)";
$ONLINE = getConfig('ap_inactive_since');
}
'sw' => $SW,
'cnt' => $cnt,
'uid' => bigintval($content['userid']),
- 'points' => TRANSLATE_COMMA($content['beg']),
- 'last' => MAKE_DATETIME($content['last_online'], "2"),
+ 'points' => translateComma($content['beg']),
+ 'last' => generateDateTime($content['last_online'], "2"),
);
// Load row template
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('bonus')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'bonus'));
return;
$lastOnline = "%s"; $ONLINE = '';
if (EXT_IS_ACTIVE('autopurge')) {
// Use last online timestamp to keep inactive members away from here
- $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+ $lastOnline = " AND `last_online` >= (UNIX_TIMESTAMP() - %s)";
$ONLINE = getConfig('ap_inactive_since');
}
$content['sw'] = $SW;
$content['cnt'] = $cnt;
$content['uid'] = bigintval($content['uid']);
- $content['points'] = TRANSLATE_COMMA($content['points']);
- $content['last'] = MAKE_DATETIME($content['last'], "2");
+ $content['points'] = translateComma($content['points']);
+ $content['last'] = generateDateTime($content['last'], "2");
// Load row template
$OUT .= LOAD_TEMPLATE("member_bonus_row", true, $content);
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
// Add description as navigation point
switch ($joined) {
case 'Y':
$sql = '';
- $result_user = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s AND cat_id=%s LIMIT 1",
+ $result_user = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s AND cat_id=%s LIMIT 1",
array($UID, bigintval($cat)), __FILE__, __LINE__);
if (SQL_NUMROWS($result_user) == 0) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('doubler')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'doubler'));
return;
ADD_DESCR('member', __FILE__);
// Percent values etc.
-define('__CHARGE_VALUE', TRANSLATE_COMMA(getConfig('doubler_charge') * 100));
-define('__REF_VALUE' , TRANSLATE_COMMA(getConfig('doubler_ref') * 100));
-define('__TOTAL_VALUE' , TRANSLATE_COMMA(getConfig('doubler_points')));
-define('__MIN_VALUE' , TRANSLATE_COMMA(getConfig('doubler_min')));
-define('__MAX_VALUE' , TRANSLATE_COMMA(getConfig('doubler_max')));
+define('__CHARGE_VALUE', translateComma(getConfig('doubler_charge') * 100));
+define('__REF_VALUE' , translateComma(getConfig('doubler_ref') * 100));
+define('__TOTAL_VALUE' , translateComma(getConfig('doubler_points')));
+define('__MIN_VALUE' , translateComma(getConfig('doubler_min')));
+define('__MAX_VALUE' , translateComma(getConfig('doubler_max')));
// Transfer referal ID
if (EXT_IS_ACTIVE('nickname')) {
}
// Usage counter
-define('__DOUBLER_COUNTER', TRANSLATE_COMMA(getConfig('doubler_counter')));
+define('__DOUBLER_COUNTER', translateComma(getConfig('doubler_counter')));
// Which mail-send-mode did the admin setup?
switch (getConfig('doubler_send_mode')) {
}
// Generate table with already payed out doubles
-define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE(getUserId(), "Y", "N", "DESC"));
+define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE(getUserId(), 'Y', 'N', "DESC"));
// Generate table with next-to-run payouts
define('__DOUBLER_PAYOUT_NEXT', DOUBLER_GENERATE_TABLE(getUserId()));
// Generate table with refferal payouts
-define('__DOUBLER_PAYOUT_REF', DOUBLER_GENERATE_TABLE(getUserId(), "N", "Y", "DESC"));
+define('__DOUBLER_PAYOUT_REF', DOUBLER_GENERATE_TABLE(getUserId(), 'N', 'Y', "DESC"));
// Generate timemark
-define('__TIMEOUT_MARK', CREATE_FANCY_TIME(getConfig('doubler_timeout')));
+define('__TIMEOUT_MARK', createFancyTime(getConfig('doubler_timeout')));
// Points left to double
-define('__LEFT_VALUE', TRANSLATE_COMMA(DOUBLER_GET_TOTAL_POINTS_LEFT()));
+define('__LEFT_VALUE', translateComma(DOUBLER_GET_TOTAL_POINTS_LEFT()));
// Load template
LOAD_TEMPLATE("member_doubler");
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
// Add description as navigation point
ADD_DESCR('member', __FILE__);
// Simply redirect...
-LOAD_URL('modules.php?module=index');
+redirectToUrl('modules.php?module=index');
//
?>
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('holiday')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'holiday'));
return;
}
// Display message and exit here
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('HOLIDAY_MEMBER_ORDER'), MAKE_DATETIME($stamp, '1')));
+ LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('HOLIDAY_MEMBER_ORDER'), generateDateTime($stamp, '1')));
return;
}
}
// Send mail to member
$msg = LOAD_EMAIL_TEMPLATE('member_holiday_request', REQUEST_POST('comments'), getUserId());
- SEND_EMAIL(getUserId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $msg);
+ sendEmail(getUserId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $msg);
// Send mail to all admins
- SEND_ADMIN_NOTIFICATION(getMessage('HOLIDAY_ADMIN_SUBJECT'), 'admin_holiday_request', REQUEST_POST('comments'), getUserId());
+ sendAdminNotification(getMessage('HOLIDAY_ADMIN_SUBJECT'), 'admin_holiday_request', REQUEST_POST('comments'), getUserId());
// Create task
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (userid, assigned_admin, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','HOLIDAY_REQUEST','{--HOLIDAY_ADMIN_SUBJECT--}','%s', UNIX_TIMESTAMP())",
SQL_FREERESULT($result);
// Prepare it for the template
- define('__HOLIDAY_START', MAKE_DATETIME($start, "3"));
- define('__HOLIDAY_END' , MAKE_DATETIME($end , "3"));
+ define('__HOLIDAY_START', generateDateTime($start, "3"));
+ define('__HOLIDAY_END' , generateDateTime($end , "3"));
// Deactivate it now
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
// Send email to admin
- SEND_ADMIN_NOTIFICATION(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), 'admin_holiday_deactivated', array(), getUserId());
+ sendAdminNotification(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), 'admin_holiday_deactivated', array(), getUserId());
// Display message to user
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_DEACTIVATED_NOW'));
SQL_FREERESULT($result);
// Prepare it for the template
- define('__HOLIDAY_START', MAKE_DATETIME($start , '3'));
- define('__HOLIDAY_END' , MAKE_DATETIME($end , '3'));
- define('__HOLIDAY_LOCK' , MAKE_DATETIME($locked, '1'));
+ define('__HOLIDAY_START', generateDateTime($start , '3'));
+ define('__HOLIDAY_END' , generateDateTime($end , '3'));
+ define('__HOLIDAY_LOCK' , generateDateTime($locked, '1'));
// Load template
LOAD_TEMPLATE('member_holiday_deactivate');
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
SET `holiday_active`='N'
WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
- LOAD_URL('modules.php?module=login&what=holiday');
+ redirectToUrl('modules.php?module=login&what=holiday');
return;
}
break;
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('html_mail')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'html_mail'));
return;
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
// Base URL for redirection (both cases)
$URL = 'modules.php?module=index&msg=';
-if (destroy_user_session()) {
+if (destroyUserSession()) {
// Remove theme cookie as well
- set_session('mxchange_theme', '');
+ setSession('mxchange_theme', '');
// Logout completed
$URL .= getCode('LOGOUT_DONE');
}
// Load the URL
-LOAD_URL($URL);
+redirectToUrl($URL);
//
?>
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('mydata')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'mydata'));
return;
define('UID_VALUE', getUserId()); $URL = '';
// Detect what the member wants to do
-$mode = "show"; // Show his data
-if (REQUEST_ISSET_POST(('save'))) $mode = "save"; // Save entered data
-if (REQUEST_ISSET_POST('edit')) $mode = "edit"; // Edit data
-if (REQUEST_ISSET_POST(('notify'))) $mode = "notify"; // Switch off notification
+$mode = 'show'; // Show his data
+if (REQUEST_ISSET_POST(('save'))) $mode = 'save'; // Save entered data
+if (REQUEST_ISSET_POST('edit')) $mode = 'edit'; // Edit data
+if (REQUEST_ISSET_POST(('notify'))) $mode = 'notify'; // Switch off notification
switch ($mode)
{
-case "show": // Show his data
+case 'show': // Show his data
if (EXT_IS_ACTIVE('country', true)) {
// New way 0 1 2 3 4 5 6 7 8 9 10 11 12 13
$result = SQL_QUERY_ESC("SELECT surname, family, street_nr, country_code, zip, city, email, birth_day, birth_month, birth_year, gender, max_mails, receive_mails, last_update FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array(UID_VALUE), __FILE__, __LINE__);
+ array(getUserId()), __FILE__, __LINE__);
} else {
// Old way 0 1 2 3 4 5 6 7 8 9 10 11 12 13
$result = SQL_QUERY_ESC("SELECT surname, family, street_nr, country, zip, city, email, birth_day, birth_month, birth_year, gender, max_mails, receive_mails, last_update FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array(UID_VALUE), __FILE__, __LINE__);
+ array(getUserId()), __FILE__, __LINE__);
}
$DATA = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Translate / add some things
- $DATA[10] = TRANSLATE_GENDER($DATA[10]);
- $DATA[13] = MAKE_DATETIME($DATA[13], "0");
+ $DATA[10] = translateGender($DATA[10]);
+ $DATA[13] = generateDateTime($DATA[13], '0');
// How far is last change on his profile away from now?
if ((($DATA[13] + getConfig('profile_lock')) > time()) && (!IS_ADMIN()) && (getConfig('profile_lock') > 0)) {
// You cannot change your account
- define('CHANGE', "<div class=\"member_failed\">".sprintf(getMessage('MEMBER_PROFILE_LOCKED'), MAKE_DATETIME($DATA[13] + getConfig('profile_lock'), "0"))."</div>");
+ define('CHANGE', "<div class=\"member_failed\">".sprintf(getMessage('MEMBER_PROFILE_LOCKED'), generateDateTime($DATA[13] + getConfig('profile_lock'), '0'))."</div>");
} else {
// He is allowed to change his profile
define('CHANGE', LOAD_TEMPLATE("member_mydata_button", true));
}
- if (strlen($DATA[7]) == 1) $DATA[7] = "0".$DATA[7];
- if (strlen($DATA[8]) == 1) $DATA[8] = "0".$DATA[8];
+ if (strlen($DATA[7]) == 1) $DATA[7] = '0'.$DATA[7];
+ if (strlen($DATA[8]) == 1) $DATA[8] = '0'.$DATA[8];
- switch (GET_LANGUAGE()) {
- case "de": define('DOB', $DATA[7].".".$DATA[8].".".$DATA[9]); break;
- default : define('DOB', $DATA[8]."-".$DATA[7]."-".$DATA[9]); break;
+ switch (getLanguage()) {
+ case 'de': define('DOB', $DATA[7].'.'.$DATA[8].'.'.$DATA[9]); break;
+ default : define('DOB', $DATA[8].'-'.$DATA[7].'-'.$DATA[9]); break;
}
if (EXT_IS_ACTIVE('country')) {
}
// Load template
- LOAD_TEMPLATE("member_mydata_overview");
+ LOAD_TEMPLATE('member_mydata_overview');
break;
-case "edit": // Edit data
+case 'edit': // Edit data
if (EXT_IS_ACTIVE('country', true)) {
// New way 0 1 2 3 4 5 6 7 8 9 10 11 12 13
$result = SQL_QUERY_ESC("SELECT surname, family, street_nr, country_code, zip, city, email, birth_day, birth_month, birth_year, gender, max_mails, receive_mails, last_update
// How far is last change on his profile away from now?
if (($DATA[13] > time()) && (!IS_ADMIN()) && (getConfig('profile_lock') > 0)) {
- $DATA[13] = MAKE_DATETIME($DATA[13] + getConfig('profile_lock'), "0");
+ $DATA[13] = generateDateTime($DATA[13] + getConfig('profile_lock'), '0');
// You cannot change your account
- LOAD_TEMPLATE("member_mydata_locked");
+ LOAD_TEMPLATE('member_mydata_locked');
} else {
// He is allowed to change his profile
switch ($DATA[10])
{
- case "M":
+ case 'M':
define('M_DEFAULT', ' selected="selected"');
define('F_DEFAULT', '');
define('C_DEFAULT', '');
break;
- case "F":
+ case 'F':
define('M_DEFAULT', '');
define('F_DEFAULT', ' selected="selected"');
define('C_DEFAULT', '');
break;
- case "C":
+ case 'C':
define('M_DEFAULT', '');
define('F_DEFAULT', '');
define('C_DEFAULT', ' selected="selected"');
break;
}
$DOB = '';
- switch (GET_LANGUAGE())
+ switch (getLanguage())
{
- case "de": // German date format
+ case 'de': // German date format
// Day
- $DOB .= ADD_SELECTION("day", $DATA[7]);
+ $DOB .= ADD_SELECTION('day', $DATA[7]);
// Month
- $DOB .= ADD_SELECTION("month", $DATA[8]);
+ $DOB .= ADD_SELECTION('month', $DATA[8]);
// Year
- $DOB .= ADD_SELECTION("year", $DATA[9]);
+ $DOB .= ADD_SELECTION('year', $DATA[9]);
break;
default: // Default is the US date format... :)
}
define('DOB', $DOB);
- define('MAX_REC_LIST', ADD_MAX_RECEIVE_LIST('member', $DATA[11], true));
+ define('MAX_REC_LIST', addMaxReceiveList('member', $DATA[11], true));
if (EXT_IS_ACTIVE('country')) {
// Generate selection box
$OUT = "<select name=\"country_code\" class=\"member_select\" size=\"1\">\n";
$whereStatement = "WHERE is_active='Y'";
if (IS_ADMIN()) $whereStatement = '';
- $OUT .= ADD_OPTION_LINES("countries", "id", "descr", $DATA[3], "code", $whereStatement);
+ $OUT .= generateOptionList("countries", "id", "descr", $DATA[3], "code", $whereStatement);
$OUT .= "</select>";
define('__COUNTRY_CONTENT', $OUT);
} else {
}
// Load template
- LOAD_TEMPLATE("member_mydata_edit");
+ LOAD_TEMPLATE('member_mydata_edit');
}
break;
-case "save": // Save entered data
+case 'save': // Save entered data
// Load old email / password: 0 1 2
$result = SQL_QUERY_ESC("SELECT email, password, last_update FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array(UID_VALUE), __FILE__, __LINE__);
+ array(getUserId()), __FILE__, __LINE__);
$DATA = SQL_FETCHROW($result);
SQL_FREERESULT($result);
$DATA[3] = $DATA[2] + getConfig('profile_lock');
// How far is last change on his profile away from now?
if (($DATA[3] > time()) && (!IS_ADMIN()) && (getConfig('profile_lock') > 0)) {
- $DATA[3] = MAKE_DATETIME($DATA[3] + getConfig('profile_lock'), "0");
+ $DATA[3] = generateDateTime($DATA[3] + getConfig('profile_lock'), '0');
// You cannot change your account
LOAD_TEMPLATE("member_mydata_locked");
} elseif (!VALIDATE_EMAIL(REQUEST_POST('addy'))) {
bigintval(REQUEST_POST('year')),
bigintval(REQUEST_POST('max_mails')),
UID_VALUE,
- get_session('u_hash')
+ getSession('u_hash')
), __FILE__, __LINE__);
} else {
// Old way
bigintval(REQUEST_POST('year')),
bigintval(REQUEST_POST('max_mails')),
UID_VALUE,
- get_session('u_hash')
+ getSession('u_hash')
), __FILE__, __LINE__);
}
$modes = explode(';', $mode);
// ... and run them through
- SEND_MODE_MAILS ('mydata', $modes);
+ sendModeMails ('mydata', $modes);
} else {
// Entered wrong pass for updating profile
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MEBER_UPDATE_PWD_WRONG'));
}
break;
-case "notify": // Switch off notfication
+case 'notify': // Switch off notfication
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET notified='N', last_update=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
array(getUserId()), __FILE__, __LINE__);
$URL = 'modules.php?module=login&what=welcome&msg=' . urlencode(getMessage('PROFILE_UPDATED'));
if (!empty($URL)) {
// Load generated URL
- LOAD_URL($URL);
+ redirectToUrl($URL);
}
//
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('newsletter')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'newsletter'));
return;
SQL_FREERESULT($result);
// Remember charge value
-define('__CHARGE_VALUE', TRANSLATE_COMMA(getConfig('nl_charge')));
+define('__CHARGE_VALUE', translateComma(getConfig('nl_charge')));
-if ((IS_FORM_SENT()) && ($status == 'Y') && ($span == "0")) {
+if ((IS_FORM_SENT()) && ($status == 'Y') && ($span == '0')) {
// Save request
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET nl_timespan='".(getConfig('one_day') * 30)."' WHERE userid=%s LIMIT 1",
array(getUserId()), __FILE__, __LINE__);
// Send mail to member
$msg = LOAD_EMAIL_TEMPLATE("member_newsletter_request", array(), getUserId());
- SEND_EMAIL(getUserId(), getMessage('NL_MEMBER_SUBJECT'), $msg);
+ sendEmail(getUserId(), getMessage('NL_MEMBER_SUBJECT'), $msg);
// Send mail to all admins
- SEND_ADMIN_NOTIFICATION(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_request", array(), getUserId());
+ sendAdminNotification(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_request", array(), getUserId());
// Display message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('NL_MEMBER_REQUEST_DONE'));
case 'N': // Does not receive the newsletter
define('__STATUS_VALUE', getMessage('NL_MEMBER_OFF'));
- define('__UNTIL_VALUE' , MAKE_DATETIME($until, "2"));
+ define('__UNTIL_VALUE' , generateDateTime($until, "2"));
define('NL_SUBMIT' , getMessage('NL_MEMBER_SUBMIT_ON'));
break;
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('nickname')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'nickname'));
return;
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('order')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'order'));
return;
} // END - if
// Validate URL
- if (!VALIDATE_URL(REQUEST_POST('url'))) {
+ if (!isUrlValid(REQUEST_POST('url'))) {
// URL is invalid!
$URL = 'modules.php?module=login&what=order&msg=' . getCode('INVALID_URL');
} // END - if
while ($content = SQL_FETCHARRAY($result)) {
if ($HOLIDAY) {
// Check for his holiday status
- $result_holiday = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_holidays`
+ $result_holiday = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_holidays`
WHERE userid=%s AND holiday_start < UNIX_TIMESTAMP() AND holiday_end > UNIX_TIMESTAMP() LIMIT 1",
array(bigintval($content['userid'])), __FILE__, __LINE__);
if (SQL_NUMROWS($result_holiday) == 1) $content['userid'] = 0; // Exclude user who are in holiday
if ($MAX_SEND > REQUEST_POST('receiver')) $MAX_SEND = REQUEST_POST('receiver');
// Calculate used points
- $USED = $MAX_SEND * GET_PAY_POINTS(bigintval(REQUEST_POST('type')));
+ $USED = $MAX_SEND * getPaymentPoints(bigintval(REQUEST_POST('type')));
// Fix empty zip code
- if (!REQUEST_ISSET_POST('zip')) REQUEST_SET_POST('zip', "0");
+ if (!REQUEST_ISSET_POST('zip')) REQUEST_SET_POST('zip', '0');
// Check if he has enougth points for this order and selected more than 0 receivers
if (($USED > 0) && ($USED <= $total) && ($MAX_SEND > 0)) {
// Gettings points is okay, so we can add $USED later from
$TIME = time();
- if (($id == "0") || ($type != "TEMP")) {
+ if (($id == '0') || ($type != "TEMP")) {
// New order
$id = 0;
if (EXT_IS_ACTIVE('html_mail')) {
target_send=%s,
zip=%s,
html_msg='%s'
-WHERE id=%s LIMIT 1",
+WHERE `id`=%s LIMIT 1",
array(
REQUEST_POST('subject'),
REQUEST_POST('text'),
cat_id=%s,
target_send=%s,
zip=%s
-WHERE id=%s LIMIT 1",
+WHERE `id`=%s LIMIT 1",
array(
REQUEST_POST('subject'),
REQUEST_POST('text'),
// Do we need to get the ID number?
if ($id == 0) {
// Order is placed as temporary. We need to get it's id for the frametester
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_pool` WHERE sender=%s AND subject='%s' AND payment_id=%s AND data_type='TEMP' AND timestamp=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_pool` WHERE sender=%s AND subject='%s' AND payment_id=%s AND data_type='TEMP' AND timestamp=%s LIMIT 1",
array(
getUserId(),
REQUEST_POST('subject'),
$CATS['name'][] = $content['cat'];
// Select users in current category
- $result_uids = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s AND userid != '%s' ORDER BY userid",
+ $result_uids = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s AND userid != '%s' ORDER BY `userid` ASC",
array(bigintval($content['id']), getUserId()), __FILE__, __LINE__);
$uid_cnt = 0;
switch (REQUEST_GET('msg'))
{
case getCode('URL_TLOCK'):
- $result = SQL_QUERY_ESC("SELECT timestamp FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT timestamp FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
// Load timestamp from last order
list($LORDER) = SQL_FETCHROW($result);
- $LORDER = MAKE_DATETIME($LORDER, "1");
+ $LORDER = generateDateTime($LORDER, "1");
// Free memory
SQL_FREERESULT($result);
break;
case getCode('BLIST_URL'):
- $message = "{--MEMBER_URL_BLACK_LISTED--}<br />\n{--MEMBER_BLIST_TIME--}: ".MAKE_DATETIME(REQUEST_GET('blist'), "0");
+ $message = "{--MEMBER_URL_BLACK_LISTED--}<br />\n{--MEMBER_BLIST_TIME--}: ".generateDateTime(REQUEST_GET('blist'), '0');
break;
case getCode('NO_RECS_LEFT'):
SQL_FREERESULT($result);
// Output user's points
- $total = TRANSLATE_COMMA($total);
+ $total = translateComma($total);
// Check how many mail orders he has placed today and how many he's allowed to send
switch (getConfig('order_max_full'))
// Free result
SQL_FREERESULT($result);
- // 01 2 21 12 2 23 443 3 3210
if ((REQUEST_ISSET_POST(('data'))) || ((getConfig('order_multi_page') != 'Y') && ((!IS_ADMIN()) && (!EXT_IS_ACTIVE('html_mail'))))) {
// Pre-output categories
$CAT = '';
// Mail type
$type = '';
foreach ($typeS as $key => $value) {
- $P = TRANSLATE_COMMA($typeS[$key][1]);
+ $P = translateComma($typeS[$key][1]);
if (is_array($value)) {
// Output option line
$type .= " <option value=\"".$typeS[$key][0]."\"";
// No cateogries are defined yet
LOAD_TEMPLATE('admin_settings_saved', false, "<span class=\"member_failed\">{--MEMBER_NO_CATS--}</span>");
}
-} elseif ($mmails == "0") {
+} elseif ($mmails == '0') {
// Please set more than 0 mails per day
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MEMBER_HAS_ZERO_MMAILS'));
} else {
if (!empty($URL)) {
// Redirect to requested URL
- LOAD_URL($URL);
+ redirectToUrl($URL);
} // END - if
//
require($INC);
} elseif (!IS_MEMBER()) {
// Not logged in
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('payout')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'payout'));
return;
$USED = GET_TOTAL_DATA(getUserId(), "user_data", "used_points");
// Translate point into comma
-$TPTS = TRANSLATE_COMMA($TPTS - $USED);
+$TPTS = translateComma($TPTS - $USED);
// Sanity check...
if (empty($TPTS)) $TPTS = "0.00000";
$result = SQL_QUERY_ESC("SELECT id, type, rate, min_points, allow_url
FROM `{!_MYSQL_PREFIX!}_payout_types`
WHERE %s >= min_points
-ORDER BY type", array(REVERT_COMMA($TPTS)), __FILE__, __LINE__);
+ORDER BY type ASC",
+ array(convertCommaToDot($TPTS)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Free memory
SQL_FREERESULT($result);
$content = array(
'sw' => $SW,
'acc' => $content['target_account'],
- 'points' => TRANSLATE_COMMA($content['payout_total'])." ".COMPILE_CODE($content['type']),
+ 'points' => translateComma($content['payout_total'])." ".COMPILE_CODE($content['type']),
'bank' => $content['target_bank'],
- 'stamp' => MAKE_DATETIME($content['payout_timestamp'], "2"),
+ 'stamp' => generateDateTime($content['payout_timestamp'], "2"),
'status' => $content['status']
);
}
} else {
// Chedk if he can get paid by selected type
- $result = SQL_QUERY_ESC("SELECT type, rate, min_points, allow_url AS allow FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT type, rate, min_points, allow_url AS allow FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('payout'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
define('PAYOUT_MAX_VALUE' , $max);
define('PAYOUT_TYPE_VALUE', COMPILE_CODE($content['type']));
- if (REVERT_COMMA($TPTS) >= $content['min_points']) {
+ if (convertCommaToDot($TPTS) >= $content['min_points']) {
// Ok, he can get be paid
if ((IS_FORM_SENT()) && ($PAYOUT <= $PAY_MAX) && ($PAYOUT >= $content['min_points'])) {
// Calculate exact value
$msg_mem = LOAD_EMAIL_TEMPLATE("member_payout_request", array(), getUserId());
$msg_adm = LOAD_EMAIL_TEMPLATE("admin_payout_request", array(), getUserId());
$admin_tpl = '';
- if (GET_EXT_VERSION('admins') >= '0.4.1')
- {
+
+ // @TODO Rewrite this to a filter
+ if (GET_EXT_VERSION('admins') >= '0.4.1') {
$admin_tpl = "admin_payout_request";
}
}
), __FILE__, __LINE__);
// Send out mails
- SEND_EMAIL(getUserId(), getMessage('PAYOUT_REQUEST_MEMBER'), $msg_mem);
+ sendEmail(getUserId(), getMessage('PAYOUT_REQUEST_MEMBER'), $msg_mem);
// To admin(s)
- SEND_ADMIN_NOTIFICATION(getMessage('PAYOUT_REQUEST_ADMIN'), $admin_tpl, array(), getUserId());
+ sendAdminNotification(getMessage('PAYOUT_REQUEST_ADMIN'), $admin_tpl, array(), getUserId());
// Load template and output it
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PAYOUT_REQUEST_SENT'));
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
// Add description as navigation point
// Transfer data to array for template
$content = array(
'lvl' => $content['level'],
- 'per' => TRANSLATE_COMMA($content['percents']),
- 'points' => TRANSLATE_COMMA($points),
- 'refs' => TRANSLATE_COMMA($REFS),
+ 'per' => translateComma($content['percents']),
+ 'points' => translateComma($points),
+ 'refs' => translateComma($REFS),
);
// Output row
}
// If TLOCK is 0 add 3 zeros for floating
-if ($TLOCK == "0") $TLOCK = "0.00000";
+if ($TLOCK == '0') $TLOCK = "0.00000";
// Remember several values in constants
-define('__USED_VALUE' , TRANSLATE_COMMA($USED));
-define('__TPTS_VALUE' , TRANSLATE_COMMA($TPTS - $USED));
+define('__USED_VALUE' , translateComma($USED));
+define('__TPTS_VALUE' , translateComma($TPTS - $USED));
define('__TREF_VALUE' , $TREF);
-define('__TLOCK_VALUE', TRANSLATE_COMMA($TLOCK));
+define('__TLOCK_VALUE', translateComma($TLOCK));
// Fixes a bug when there is no bonus extension installed
if (EXT_VERSION_IS_OLDER('bonus', '0.4.4')) setConfigEntry('bonus_active', "X");
SQL_FREERESULT($result);
// Prepare constants
- define('__TURBO_VALUE', TRANSLATE_COMMA($turbo));
- define('__LOGIN_VALUE', TRANSLATE_COMMA($login));
+ define('__TURBO_VALUE', translateComma($turbo));
+ define('__LOGIN_VALUE', translateComma($login));
if (GET_EXT_VERSION('bonus') >= '0.4.4') {
// Add referal, stats and order bonys
- define('__REF_VALUE' , TRANSLATE_COMMA($ref));
- define('__ORDER_VALUE', TRANSLATE_COMMA($order));
- define('__STATS_VALUE', TRANSLATE_COMMA($stats));
+ define('__REF_VALUE' , translateComma($ref));
+ define('__ORDER_VALUE', translateComma($order));
+ define('__STATS_VALUE', translateComma($stats));
}
// Total bonus points
- define('__TTOTAL_VALUE', TRANSLATE_COMMA($turbo + $login + $ref + $order + $stats));
+ define('__TTOTAL_VALUE', translateComma($turbo + $login + $ref + $order + $stats));
// Output rows
define('__SPECIAL_ROWS', LOAD_TEMPLATE("member_points_bonus_rows", true));
if (EXT_IS_ACTIVE('payout')) {
// Payput extension is installed and active so we can check if the user has enougth points
- PAYOUT_OUTPUT_PAYOUT_LIST(REVERT_COMMA(($TPTS - $USED)));
+ PAYOUT_OUTPUT_PAYOUT_LIST(convertCommaToDot(($TPTS - $USED)));
}
//
require($INC);
} elseif (!IS_MEMBER()) {
// User is not logged in
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('primera')) && (!IS_ADMIN())) {
// Extension 'primera' is not activated
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'primera'));
ADD_DESCR('member', __FILE__);
// Check if the admin has entered the data
-if ((getConfig('primera_api_name') == "") || (getConfig('primera_api_md5') == "")) {
+if ((getConfig('primera_api_name') == '') || (getConfig('primera_api_md5') == '')) {
// Something important is missing...
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PRIMERA_MEMBER_API_DATA_MISSING'));
return;
while ($data = SQL_FETCHARRAY($result)) {
// Prepare data for output
$rowContent = array(
- 'stamp' => MAKE_DATETIME($data['primera_timestamp'], "2"),
- 'points' => TRANSLATE_COMMA($data['primera_amount']),
+ 'stamp' => generateDateTime($data['primera_timestamp'], "2"),
+ 'points' => translateComma($data['primera_amount']),
'acc' => SQL_ESCAPE($data['primera_account']),
'status' => PRIMERA_TRANSFER_STATUS($data['primera_type']),
'raw_type' => strtolower($data['primera_type']),
$points = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");
// No dots here...
- $points = explode(".", $points);
+ $points = explode('.', $points);
$points = bigintval($points[0]);
// Remove the registration fee
// Is this enougth for a payout?
if ($points < getConfig('primera_min_payout')) {
// No, then abort here
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('PRIMERA_MEMBER_MIN_PAYOUT_PAYOUT'), TRANSLATE_COMMA(getConfig('primera_min_payout'))));
+ LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('PRIMERA_MEMBER_MIN_PAYOUT_PAYOUT'), translateComma(getConfig('primera_min_payout'))));
return;
}
// Add points to content array
$content['points'] = $points;
- $content['min_points'] = TRANSLATE_COMMA(getConfig('primera_min_payout'));
+ $content['min_points'] = translateComma(getConfig('primera_min_payout'));
// Get Primera id
$content['primera_nickname'] = '';
$locked = true;
// Shall I "pay" the referal points imidiately?
- if (getConfig('ref_payout') == "0") {
+ if (getConfig('ref_payout') == '0') {
// Yes, "pay" it now
$locked = false;
} // END - if
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('rallye')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'rallye'));
return;
define('__RALLYE_MAX_PRICES', RALLYE_DETERMINE_MIN_PRICES($min_prices));
// Set start and end time
- define('__RALLYE_START', MAKE_DATETIME($start, "1"));
- define('__RALLYE_END' , MAKE_DATETIME($end , "1"));
+ define('__RALLYE_START', generateDateTime($start, "1"));
+ define('__RALLYE_END' , generateDateTime($end , "1"));
if ($expired === true) {
define('__RALLYE_PRICES', RALLYE_LIST_WINNERS($id));
require($INC);
} elseif (!IS_MEMBER()) {
// User is not logged in
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('refback')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'refback'));
return;
ADD_DESCR('member', __FILE__);
// Was the form submitted?
-if ((REQUEST_ISSET_POST('edit')) && (REQUEST_ISSET_POST(('id')))) {
+if ((REQUEST_ISSET_POST('edit')) && (REQUEST_ISSET_POST('id'))) {
// Okay, has the user entered some values?
if (REQUEST_ISSET_POST(('percents'))) {
// Revert german commta for testing
- $percents = REVERT_COMMA(REQUEST_POST('percents'));
+ $percents = convertCommaToDot(REQUEST_POST('percents'));
// Validate percents
if ((($percents >= getConfig('refback_min_perc')) || (round($percents) == 0)) && ($percents <= getConfig('refback_max_perc'))) {
$content = GET_USER_REF_ENTRY(REQUEST_POST('id'));
// Translate comma
- $content['refback'] = TRANSLATE_COMMA($content['refback']);
- $content['min'] = TRANSLATE_COMMA(getConfig('refback_min_perc').".0");
- $content['max'] = TRANSLATE_COMMA(getConfig('refback_max_perc').".0");
+ $content['refback'] = translateComma($content['refback']);
+ $content['min'] = translateComma(getConfig('refback_min_perc').".0");
+ $content['max'] = translateComma(getConfig('refback_max_perc').".0");
// Load form for editing
LOAD_TEMPLATE("member_refback_edit", false, $content);
// Add/"translate" more content
$refRow['sw'] = $SW;
- $refRow['points'] = TRANSLATE_COMMA($refRow['points']);
- $refRow['refback'] = TRANSLATE_COMMA($refRow['refback']);
- $refRow['status'] = TRANSLATE_STATUS($refRow['status']);
+ $refRow['points'] = translateComma($refRow['points']);
+ $refRow['refback'] = translateComma($refRow['refback']);
+ $refRow['status'] = translateUserStatus($refRow['status']);
if (empty($refRow['nickname'])) $refRow['nickname'] = '---';
// Load row template
} // END - foreach
// Remember the content
- $content['counter'] = TRANSLATE_COMMA($counter);
- $content['percents'] = TRANSLATE_COMMA($content['percents']);
+ $content['counter'] = translateComma($counter);
+ $content['percents'] = translateComma($content['percents']);
$content['rows'] = $rows;
// Load level template
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
// Add description as navigation point
$test = str_replace(constant('URL'), constant('PATH'), $content['url']); $size = 0;
if ($test == $content['url']) {
// Download banner (I hope you keep the banner on same server???)
- $fp = GET_URL($content['url']); $bannerContent = '';
+ $fp = sendGetRequest($content['url']); $bannerContent = '';
if ((!empty($fp)) && (is_array($fp)) && (count($fp) > 0) {
// Loads only found banner, when there is a 404 error this foreach() command
// will cause an "Invalid argument supplied for foreach()" error
}
}
$size = strlen($bannerContent);
- } elseif (FILE_READABLE($test)) {
+ } elseif (isFileReadable($test)) {
$size = filesize($test);
}
- if ($size > 0) $content['alternate'] .= " (".TRANSLATE_COMMA(round($size/102.4)/10)." {--KBYTES--})";
+ if ($size > 0) $content['alternate'] .= " (".translateComma(round($size/102.4)/10)." {--KBYTES--})";
// Load banner data
// @TODO Rewritings: alt->alternate,cnt->counter,cks->clicks,uid->userid in template
require($INC);
} elseif (!IS_MEMBER()) {
// User is not logged in
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
// Add description as navigation point
$SW = 2;
// Check for users ref in this level
- foreach (GET_USER_REF_POINTS(getUserId(), $content['level']) as $refRow) {
+ foreach (getUserReferalPoints(getUserId(), $content['level']) as $refRow) {
// Add/"translate" more content
$refRow['sw'] = $SW;
- $refRow['points'] = TRANSLATE_COMMA($refRow['points']);
- $refRow['status'] = TRANSLATE_STATUS($refRow['status']);
- $refRow['unconfirmed'] = TRANSLATE_COMMA($refRow['unconfirmed']);
- $refRow['clickrate'] = TRANSLATE_COMMA($refRow['clickrate'], true, 1);
+ $refRow['points'] = translateComma($refRow['points']);
+ $refRow['status'] = translateUserStatus($refRow['status']);
+ $refRow['unconfirmed'] = translateComma($refRow['unconfirmed']);
+ $refRow['clickrate'] = translateComma($refRow['clickrate'], true, 1);
if (empty($refRow['nickname'])) $refRow['nickname'] = '---';
// Load row template
} // END - foreach
// Remember the content
- $content['counter'] = TRANSLATE_COMMA($counter);
- $content['percents'] = TRANSLATE_COMMA($content['percents'], true, 1);
+ $content['counter'] = translateComma($counter);
+ $content['percents'] = translateComma($content['percents'], true, 1);
$content['rows'] = $rows;
// Load level template
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('sponsor')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'sponsor'));
return;
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
// Add description as navigation point
$content = array(
'sw' => $SW,
'id' => $data['id'],
- 'cat' => GET_CATEGORY($data['cat_id']),
- 'pay' => GET_PAYMENT($data['payment_id']),
+ 'cat' => getCategory($data['cat_id']),
+ 'pay' => getPaymentTitlePrice($data['payment_id']),
'subj' => COMPILE_CODE($data['subject']),
'url' => DEREFERER($data['url']),
- 'stamp' => MAKE_DATETIME($data['timestamp'], "2"),
+ 'stamp' => generateDateTime($data['timestamp'], "2"),
'recs' => $data['target_send'],
- 'type' => TRANSLATE_POOL_TYPE($data['data_type']),
+ 'type' => translatePoolType($data['data_type']),
'zip' => $data['zip']
);
// Prepare data for the template
$content = array(
'sw' => $SW,
- 'cat' => GET_CATEGORY($data[1]),
- 'pay' => GET_PAYMENT($data[2]),
+ 'cat' => getCategory($data[1]),
+ 'pay' => getPaymentTitlePrice($data[2]),
'subj' => COMPILE_CODE($data[3]),
'url' => DEREFERER($data[4]),
- 'stamp' => MAKE_DATETIME($data[5], "2"),
+ 'stamp' => generateDateTime($data[5], "2"),
'recs' => $data[6],
- 'sent' => MAKE_DATETIME($data[7], "2"),
+ 'sent' => generateDateTime($data[7], "2"),
'clix' => $data[8],
'perc' => COMPILE_CODE($data[8] / $data[6] * 100)."%",
);
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()){
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('support')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'support'));
return;
} // END - switch
// Send mail to admin
- SEND_ADMIN_NOTIFICATION($subj_a, $a_tpl, array('text' => REQUEST_POST('qdetails')), getUserId());
+ sendAdminNotification($subj_a, $a_tpl, array('text' => REQUEST_POST('qdetails')), getUserId());
// Send mail to user
- SEND_EMAIL(getUserId(), $subj_m, $msg_m);
+ sendEmail(getUserId(), $subj_m, $msg_m);
// Drop a message in the admin's area
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (userid, assigned_admin, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','SUPPORT_MEMBER','%s','%s', UNIX_TIMESTAMP())",
- array(getUserId(), $subj_a, REQUEST_POST('qsummary').":".array('text' => REQUEST_POST('qdetails'))), __FILE__, __LINE__);
+ array(getUserId(), $subj_a, REQUEST_POST('qsummary').':'.array('text' => REQUEST_POST('qdetails'))), __FILE__, __LINE__);
// Form sent
LOAD_TEMPLATE("member_support_contcted");
require($INC);
} elseif (!IS_MEMBER()) {
// Redirect
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('surfbar')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'surfbar'));
return;
} else {
// Prepare some content
$content = array(
- 'reward' => TRANSLATE_COMMA(SURFBAR_DETERMINE_REWARD(true)),
- 'costs' => TRANSLATE_COMMA(SURFBAR_DETERMINE_COSTS(true)),
+ 'reward' => translateComma(SURFBAR_DETERMINE_REWARD(true)),
+ 'costs' => translateComma(SURFBAR_DETERMINE_COSTS(true)),
'max_order' => getConfig('surfbar_max_order'),
'curr_order' => SURFBAR_GET_TOTAL_USER_URLS()
);
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('surfbar')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'surfbar'));
return;
$URLs = SURFBAR_GET_USER_URLS();
// Are there entries or form is submitted?
-if ((IS_FORM_SENT()) && (REQUEST_ISSET_POST(('action'))) && (REQUEST_ISSET_POST(('id')))) {
+if ((IS_FORM_SENT()) && (REQUEST_ISSET_POST(('action'))) && (REQUEST_ISSET_POST('id'))) {
// Process the form
if (SURFBAR_MEMBER_DO_FORM(REQUEST_POST_ARRAY(), $URLs)) {
// Action performed but shall we display it?
- if (((REQUEST_POST('action') != "edit") && (REQUEST_POST('action') != "delete")) || (REQUEST_ISSET_POST(('execute')))) {
+ if (((REQUEST_POST('action') != 'edit') && (REQUEST_POST('action') != "delete")) || (REQUEST_ISSET_POST(('execute')))) {
// Display "action done" message if action is wether 'edit' nor 'delete' or has been executed
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MEMBER_SURFBAR_ACTION_DONE'));
} // END - if
$content['url'] = DEREFERER($content['url']);
if ($content['views_total'] > 0) {
// Include link to stats
- $content['views_total'] = "[<a href=\"{!URL!}/modules.php?module=login&what=surfbar_list\">".TRANSLATE_COMMA($content['views_total'])."</a>]";
+ $content['views_total'] = "[<a href=\"{!URL!}/modules.php?module=login&what=surfbar_list\">".translateComma($content['views_total'])."</a>]";
} // END - if
- $content['registered'] = MAKE_DATETIME($content['registered'], "2");
- $content['last_locked'] = MAKE_DATETIME($content['last_locked'], "2");
+ $content['registered'] = generateDateTime($content['registered'], "2");
+ $content['last_locked'] = generateDateTime($content['last_locked'], "2");
$content['actions'] = SURFBAR_MEMBER_ACTIONS($content['id'], $content['status']);
- $content['status'] = SURFBAR_TRANSLATE_STATUS($content['status']);
+ $content['status'] = surfbarTranslateUserStatus($content['status']);
if (empty($content['lock_reason'])) {
// Fixes some HTML problems with empty cells
$content['lock_reason'] = '---';
require($INC);
} elseif (!IS_MEMBER()) {
// Not logged in
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('surfbar')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'surfbar'));
return;
// Prepare content for output
$content = array(
- 'surfbar_static_reward' => TRANSLATE_COMMA(getConfig('surfbar_static_reward')),
- 'surfbar_static_time' => CREATE_FANCY_TIME(getConfig('surfbar_static_time')),
- 'surfbar_static_lock' => CREATE_FANCY_TIME(getConfig('surfbar_static_lock')),
- 'surfbar_total_urls' => SURFBAR_GET_TOTAL_URLS("ACTIVE", "0")
+ 'surfbar_static_reward' => translateComma(getConfig('surfbar_static_reward')),
+ 'surfbar_static_time' => createFancyTime(getConfig('surfbar_static_time')),
+ 'surfbar_static_lock' => createFancyTime(getConfig('surfbar_static_lock')),
+ 'surfbar_total_urls' => SURFBAR_GET_TOTAL_URLS('ACTIVE', '0')
);
// In dynamic mode we need some more data
-if (getConfig('surfbar_pay_model') == "DYNAMIC") {
+if (getConfig('surfbar_pay_model') == 'DYNAMIC') {
// Total URLs
$content = array(
- 'surfbar_dynamic_percent' => TRANSLATE_COMMA(getConfig('surfbar_dynamic_percent')),
- 'surfbar_total_urls' => SURFBAR_GET_TOTAL_URLS("ACTIVE", "0"),
+ 'surfbar_dynamic_percent' => translateComma(getConfig('surfbar_dynamic_percent')),
+ 'surfbar_total_urls' => SURFBAR_GET_TOTAL_URLS('ACTIVE', '0'),
'surfbar_user_urls' => SURFBAR_GET_TOTAL_USER_URLS(),
'surfbar_total_online' => SURFBAR_DETERMINE_TOTAL_ONLINE(),
- 'surfbar_total_users' => TRANSLATE_COMMA(GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true)),
- 'surfbar_min_reward' => TRANSLATE_COMMA(SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE()),
- 'surfbar_max_reward' => TRANSLATE_COMMA(SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE()),
- 'surfbar_min_time' => CREATE_FANCY_TIME(SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE()),
- 'surfbar_max_time' => CREATE_FANCY_TIME(SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE()),
- 'surfbar_dynamic_lock' => CREATE_FANCY_TIME(SURFBAR_CALCULATE_DYNAMIC_LOCK()),
- 'surfbar_static_reward' => TRANSLATE_COMMA(getConfig('surfbar_static_reward')),
- 'surfbar_static_time' => CREATE_FANCY_TIME(getConfig('surfbar_static_time'))
+ 'surfbar_total_users' => translateComma(GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true)),
+ 'surfbar_min_reward' => translateComma(SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE()),
+ 'surfbar_max_reward' => translateComma(SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE()),
+ 'surfbar_min_time' => createFancyTime(SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE()),
+ 'surfbar_max_time' => createFancyTime(SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE()),
+ 'surfbar_dynamic_lock' => createFancyTime(SURFBAR_CALCULATE_DYNAMIC_LOCK()),
+ 'surfbar_static_reward' => translateComma(getConfig('surfbar_static_reward')),
+ 'surfbar_static_time' => createFancyTime(getConfig('surfbar_static_time'))
);
} // END - if
// Load the template
-LOAD_TEMPLATE("member_surfbar_start_".strtolower(getConfig('surfbar_pay_model')), false, $content);
+LOAD_TEMPLATE('member_surfbar_start_' . strtolower(getConfig('surfbar_pay_model')), false, $content);
// Load surfbar link template
-LOAD_TEMPLATE("member_surfbar_link");
+LOAD_TEMPLATE('member_surfbar_link');
//
?>
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('surfbar')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'surfbar'));
return;
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('theme')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'theme'));
return;
$newTheme = SQL_ESCAPE(REQUEST_POST('member_theme'));
// Change to new theme
- set_session('mxchange_theme', $newTheme);
+ setSession('mxchange_theme', $newTheme);
// Theme saved!
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MEMBER_THEME_SAVED'));
// Construct absolute theme.php file name
$INC = sprintf("theme/%s/theme.php", $entry);
- if (($entry != ".") && ($entry != "..") && (INCLUDE_READABLE($INC)) && (THEME_IS_ACTIVE($entry))) {
+ if ((!isDirectory($entry)) && (isIncludeReadable($INC)) && (isThemeActive($entry))) {
// Found a valid directory so let's load it's theme.php file
- LOAD_INC($INC);
+ loadInclude($INC);
// Add found theme to array
$THEMES['theme_unix'][] = $entry;
$OUT = ''; $SW = 2;
foreach ($THEMES['theme_unix'] as $key => $unix) {
$default = '';
- if (get_session('mxchange_theme') == $unix) $default = ' selected="selected"';
+ if (getSession('mxchange_theme') == $unix) $default = ' selected="selected"';
// Add row
$OUT .= "<tr>
</td>
<td class=\"switch_sw".$SW." bottom2 right2\" align=\"center\">".$THEMES['theme_name'][$key]."</td>
<td class=\"switch_sw".$SW." bottom2 right2\" align=\"center\">
- <a href=\"mailto:".$THEMES['theme_email'][$key]."?Subject=[Theme:] ".$THEMES['theme_name'][$key]." (".$unix.")"."\">".$THEMES['theme_author'][$key]."</a>
+ <a href=\"mailto:".$THEMES['theme_email'][$key]."?Subject=[Theme:] ".$THEMES['theme_name'][$key]." (".$unix.")'.'\">".$THEMES['theme_author'][$key]."</a>
</td>
<td class=\"switch_sw".$SW." bottom2 right2\" align=\"center\">
<a href=\"".DEREFERER($THEMES['theme_url'][$key])."\" target=\"_blank\">".$THEMES['theme_url'][$key]."</a>
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('transfer')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'transfer'));
return;
// @TODO Rewrite all these constants to array elements
if ($uid1 == getUserId()) {
// Data row 1 is sender's data
- define('__SENDER_GENDER' , TRANSLATE_GENDER($gender1));
+ define('__SENDER_GENDER' , translateGender($gender1));
define('__SENDER_NICK' , $nick1);
define('__SENDER_SNAME' , $sname1);
define('__SENDER_FNAME' , $fname1);
define('__SENDER_EMAIL' , $email1);
// Data row 2 is recpient's data
- define('__RECIPIENT_GENDER', TRANSLATE_GENDER($gender2));
+ define('__RECIPIENT_GENDER', translateGender($gender2));
define('__RECIPIENT_NICK' , $nick2);
define('__RECIPIENT_SNAME' , $sname2);
define('__RECIPIENT_FNAME' , $fname2);
$TEST_NICK_REC = $nick2;
} else {
// Data row 2 is sender's data
- define('__SENDER_GENDER' , TRANSLATE_GENDER($gender2));
+ define('__SENDER_GENDER' , translateGender($gender2));
define('__SENDER_NICK' , $nick2);
define('__SENDER_SNAME' , $sname2);
define('__SENDER_FNAME' , $fname2);
define('__SENDER_EMAIL' , $email2);
// Data row 1 is recpient's data
- define('__RECIPIENT_GENDER', TRANSLATE_GENDER($gender1));
+ define('__RECIPIENT_GENDER', translateGender($gender1));
define('__RECIPIENT_NICK' , $nick1);
define('__RECIPIENT_SNAME' , $sname1);
define('__RECIPIENT_FNAME' , $fname1);
// Remember transfer reason and fancy date/time in constants
define('__TRANSFER_REASON', REQUEST_POST('reason'));
- define('__TRANSFER_EXPIRES', CREATE_FANCY_TIME(getConfig('transfer_age')));
+ define('__TRANSFER_EXPIRES', createFancyTime(getConfig('transfer_age')));
// Generate tranafer id
define('__TRANS_ID', bigintval(generateRandomCodde("10", mt_rand(0, 99999), getUserId(), REQUEST_POST('reason'))));
__FILE__, __LINE__);
// Add points to account *directly* ...
- ADD_POINTS_REFSYSTEM("member_transfer", bigintval(REQUEST_POST('to_uid')), bigintval(REQUEST_POST('points')), false, "0", false, "direct");
+ ADD_POINTS_REFSYSTEM_DIRECT('member_transfer', bigintval(REQUEST_POST('to_uid')), bigintval(REQUEST_POST('points')));
// ... and add it to current user's used points
SUB_POINTS('transfer', getUserId(), REQUEST_POST('points'));
// First send email to recipient
$msg = LOAD_EMAIL_TEMPLATE("member_transfer_recipient", '', constant('__RECIPIENT_UID'));
- SEND_EMAIL(constant('__RECIPIENT_EMAIL'), getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ').": ".$SENDER, $msg);
+ sendEmail(constant('__RECIPIENT_EMAIL'), getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ').": ".$SENDER, $msg);
// Second send email to sender
$msg = LOAD_EMAIL_TEMPLATE("member_transfer_sender", '', constant('__SENDER_UID'));
- SEND_EMAIL(constant('__SENDER_EMAIL'), getMessage('TRANSFER_MEMBER_SENDER_SUBJ').": ".$RECIPIENT, $msg);
+ sendEmail(constant('__SENDER_EMAIL'), getMessage('TRANSFER_MEMBER_SENDER_SUBJ').": ".$RECIPIENT, $msg);
// At last send admin mail(s)
$ADMIN_SUBJ = sprintf("%s (%s->%s)", getMessage('TRANSFER_ADMIN_SUBJECT'), $SENDER, $RECIPIENT);
- SEND_ADMIN_NOTIFICATION($ADMIN_SUBJ, "admin_transfer_points");
+ sendAdminNotification($ADMIN_SUBJ, "admin_transfer_points");
// Transfer is completed
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('TRANSFER_COMPLETED')."<br /><a href=\"{!URL!}/modules.php?module=login&what=transfer\">{--TRANSFER_CONTINUE_OVERVIEW--}</a>");
// Load member list
if (EXT_IS_ACTIVE('nickname')) {
// Load userid and nickname
- $result = SQL_QUERY_ESC("SELECT userid, nickname FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY userid",
+ $result = SQL_QUERY_ESC("SELECT userid, nickname FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY `userid` ASC",
array(getUserId()), __FILE__, __LINE__);
} else {
// Load only userid
- $result = SQL_QUERY_ESC("SELECT userid, userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY userid",
+ $result = SQL_QUERY_ESC("SELECT userid, userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY `userid` ASC",
array(getUserId()), __FILE__, __LINE__);
}
// @TODO This should be somehow rewritten to $content = SQL_FETCHARRAY(), see switch() block above for SQL queries
while (list($tid, $uid, $points, $reason, $stamp) = SQL_FETCHROW($result)) {
// Rewrite points
- if ($type == "OUT") $points = $points."-";
+ if ($type == "OUT") $points = $points.'-';
// Prepare content for template
$content = array(
'sw' => $SW,
'tid' => $id,
- 'stamp' => MAKE_DATETIME($stamp, "3"),
+ 'stamp' => generateDateTime($stamp, "3"),
'uid' => $uid,
'reason' => $reason,
- 'points' => TRANSLATE_COMMA($points)
+ 'points' => translateComma($points)
);
// Load row template
$OUT = ''; $SW = 2;
while ($content = SQL_FETCHARRAY($result)) {
// Rewrite points
- if ($content['trans_type'] == "OUT") $content['points'] = "-".$content['points']."";
+ if ($content['trans_type'] == "OUT") $content['points'] = '-'.$content['points']."";
// Prepare content for template
$content['sw'] = $SW;
- $content['time'] = MAKE_DATETIME($content['time_trans'], "3");
- $content['points'] = TRANSLATE_COMMA($content['points']);
+ $content['time'] = generateDateTime($content['time_trans'], "3");
+ $content['points'] = translateComma($content['points']);
// Load row template
$OUT .= LOAD_TEMPLATE("member_transfer_row", true, $content);
// Check for latest out-transfers
$result = SQL_QUERY_ESC("SELECT time_trans
FROM `{!_MYSQL_PREFIX!}_user_transfers_out`
-WHERE time_trans > (UNIX_TIMESTAMP() - %s) AND userid=%s
+WHERE time_trans > (UNIX_TIMESTAMP() - %s) AND `userid`=%s
ORDER BY time_trans DESC
LIMIT 1", array(getConfig('transfer_timeout'), getUserId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// Load newest transaction
list($newest) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- define('__TRANSFER_SETTINGS_CONTENT', sprintf(getMessage('TRANSFER_LATEST_IS'), MAKE_DATETIME($newest, "3")));
+ define('__TRANSFER_SETTINGS_CONTENT', sprintf(getMessage('TRANSFER_LATEST_IS'), generateDateTime($newest, "3")));
}
// Load template
LOAD_TEMPLATE("member_transfer_overview");
break;
}
+
//
?>
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('mailid')) && (!IS_ADMIN())) {
- LOAD_URL('modules.php?module=login');
+ redirectToUrl('modules.php?module=login');
}
// Add description as navigation point
// Display bonus mail by loading it's full data
$result_data = SQL_QUERY_ESC("SELECT id, subject, timestamp, cat_id, points, text, is_notify, data_type, time, url
FROM `{!_MYSQL_PREFIX!}_bonus`
-WHERE id=%s LIMIT 1",
+WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('bonusid'))), __FILE__, __LINE__);
// Load data
// Translate some data
$content['subject'] = COMPILE_CODE($content['subject']);
$content['text'] = COMPILE_CODE($content['text']);
- $content['timestamp'] = MAKE_DATETIME($content['timestamp'], '2');
- $content['category'] = GET_CATEGORY($content['cat_id']);
- $content['points'] = TRANSLATE_COMMA($content['points']);
- $content['is_notify'] = TRANSLATE_YESNO($content['is_notify']);
- $content['sender'] = _ADMIN_SHORT;
- $content['time'] = CREATE_FANCY_TIME($content['time']);
+ $content['timestamp'] = generateDateTime($content['timestamp'], '2');
+ $content['category'] = getCategory($content['cat_id']);
+ $content['points'] = translateComma($content['points']);
+ $content['is_notify'] = translateYesNo($content['is_notify']);
+ $content['sender'] = getMessage('_ADMIN_SHORT');
+ $content['time'] = createFancyTime($content['time']);
$content['uid'] = getUserId();
// Get timestamp from insert
$content['user_status'] = sprintf(getMessage('MEMBER_MAIL_BONUS_CONFIRMED_ON'),
- MAKE_DATETIME(USER_STATS_GET_TIMESTAMP('bonusid', $content['id']), '2')
+ generateDateTime(getTimestampFromUserStats('bonusid', $content['id']), '2')
);
// Display it depending on mail (data) type
// Translate some data
$content['subject'] = COMPILE_CODE($content['subject']);
$content['text'] = COMPILE_CODE($content['text']);
- $content['timestamp'] = MAKE_DATETIME($content['timestamp'], '2');
- $content['category'] = GET_CATEGORY($content['cat_id']);
- $content['points'] = TRANSLATE_COMMA($content['points']);
- $content['time'] = CREATE_FANCY_TIME($content['time']);
+ $content['timestamp'] = generateDateTime($content['timestamp'], '2');
+ $content['category'] = getCategory($content['cat_id']);
+ $content['points'] = translateComma($content['points']);
+ $content['time'] = createFancyTime($content['time']);
$content['uid'] = getUserId();
// Get timestamp from insert
$content['user_status'] = sprintf(getMessage('MEMBER_MAIL_NORMAL_CONFIRMED_ON'),
- MAKE_DATETIME(USER_STATS_GET_TIMESTAMP('mailid', $content['id']), '2')
+ generateDateTime(getTimestampFromUserStats('mailid', $content['id']), '2')
);
// Display it depending on mail (data) type
break;
case 'BONUS':
- $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id, points, 0 FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id=%s LIMIT 1",
+ $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id, points, 0 FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
array(bigintval($id2)), __FILE__, __LINE__);
$type = 'bonusid'; $DATA = $id2; $PROBLEM = getMessage('BONUS_MAIL_PROBLEM');
break;
'type' => $type,
'subject' => $subject,
'sender' => $sender,
- 'stamp' => MAKE_DATETIME($timestamp, '2'),
- 'cat' => GET_CATEGORY($cat),
- 'points' => TRANSLATE_COMMA($pay),
+ 'stamp' => generateDateTime($timestamp, '2'),
+ 'cat' => getCategory($cat),
+ 'points' => translateComma($pay),
);
// Load row template
SQL_FREERESULT($result);
// Remember total points
- define('__TOTAL_POINTS', TRANSLATE_COMMA($sum));
+ define('__TOTAL_POINTS', translateComma($sum));
// Remember all generated rows in constant for the template
define('__UNCONFIRMED_ROWS', $OUT);
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
// Add description as navigation point
ADD_DESCR ('member', basename(__FILE__));
// Export data for template
-define('_LAST_ONLINE_VALUE', MAKE_DATETIME($GLOBALS['last']['online']));
-define('_LAST_MODULE_VALUE', GET_MOD_DESCR('member', $GLOBALS['last']['module']));
+$content = array(
+ 'last_online' => generateDateTime($GLOBALS['last']['online']),
+ 'last_module' => getModuleDescription('member', $GLOBALS['last']['module'])
+);
// Load header template
-LOAD_TEMPLATE("member_welcome_header");
+LOAD_TEMPLATE("member_welcome_header", false, $content);
// Chedk if he is returning from a profile update notification
-$result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE notified='Y' AND userid=%s LIMIT 1",
+$result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE notified='Y' AND `userid`=%s LIMIT 1",
array(getUserId()), __FILE__, __LINE__);
if ((SQL_NUMROWS($result) == 1) && (EXT_IS_ACTIVE('profile'))) {
require($INC);
} elseif (!IS_MEMBER()) {
// User is not logged in
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} elseif ((!EXT_IS_ACTIVE('wernis')) && (!IS_ADMIN())) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'wernis'));
return;
ADD_DESCR('member', __FILE__);
// Check if the admin has entered the data
-if ((getConfig('wernis_api_id') == "") || (getConfig('wernis_api_md5') == "")) {
+if ((getConfig('wernis_api_id') == '') || (getConfig('wernis_api_md5') == '')) {
// Something important is missing...
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('WERNIS_MEMBER_API_DATA_MISSING'));
return;
while ($data = SQL_FETCHARRAY($result)) {
// Prepare data for output
$rowContent = array(
- 'stamp' => MAKE_DATETIME($data['wernis_timestamp'], "2"),
- 'points' => TRANSLATE_COMMA($data['wernis_amount']),
+ 'stamp' => generateDateTime($data['wernis_timestamp'], "2"),
+ 'points' => translateComma($data['wernis_amount']),
'acc' => bigintval($data['wernis_account']),
'status' => WERNIS_TRANSFER_STATUS($data['wernis_type']),
'raw_type' => strtolower($data['wernis_type']),
// Is this enougth for a payout?
if ($points < getConfig('wernis_min_payout')) {
// No, then abort here
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('WERNIS_MEMBER_MIN_PAYOUT'), TRANSLATE_COMMA(getConfig('wernis_min_payout'))));
+ LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('WERNIS_MEMBER_MIN_PAYOUT'), translateComma(getConfig('wernis_min_payout'))));
return;
} // END - if
// No dots here...
- $points = explode(".", $points);
+ $points = explode('.', $points);
$points = bigintval($points[0]);
// Add points to content array
- $content['points'] = TRANSLATE_COMMA($points);
- $content['min_points'] = TRANSLATE_COMMA(getConfig('wernis_min_payout'));
+ $content['points'] = translateComma($points);
+ $content['min_points'] = translateComma(getConfig('wernis_min_payout'));
// Add fees to array
WERNIS_ADD_FEES_TO_ARRAY($content);
$points = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");
// Prepare data for the template
- $content['points'] = TRANSLATE_COMMA($points);
- $content['min_points'] = TRANSLATE_COMMA(getConfig('wernis_min_withdraw'));
+ $content['points'] = translateComma($points);
+ $content['min_points'] = translateComma(getConfig('wernis_min_withdraw'));
$content['wds66_id'] = '';
// Add fees to array
if ($success) {
// Add it to this amount
unset($GLOBALS['ref_level']);
- ADD_POINTS_REFSYSTEM("wernis_withdraw", getUserId(), bigintval(REQUEST_POST('amount')), false, 0, false, "direct");
+ ADD_POINTS_REFSYSTEM_DIRECT('wernis_withdraw', getUserId(), bigintval(REQUEST_POST('amount')));
// Update the user data as well..
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `wernis_userid`=%s WHERE userid=%s LIMIT 1",
}
// Update sending pool
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='%s' WHERE id=%s AND sender=%s AND data_type='TEMP' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='%s' WHERE `id`=%s AND sender=%s AND data_type='TEMP' LIMIT 1",
array($type, bigintval(REQUEST_GET('order')), getUserId()), __FILE__, __LINE__);
// Finally is the entry valid?
SQL_FREERESULT($result);
// Load mail again... 0 1 2 3 4 5 6 7
- $result = SQL_QUERY_ESC("SELECT subject, text, receivers, payment_id, timestamp, url, cat_id, target_send FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s AND sender=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT subject, text, receivers, payment_id, timestamp, url, cat_id, target_send FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s AND sender=%s LIMIT 1",
array(bigintval(REQUEST_GET('order')), getUserId()), __FILE__, __LINE__);
$DATA = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if (empty($DATA[0])) $DATA[0] = getMessage('DEFAULT_SUBJECT_LINE');
// Calculate used points
- $USED = $DATA[7] * GET_PAY_POINTS($DATA[3]);
+ $USED = $DATA[7] * getPaymentPoints($DATA[3]);
// Update used points
$add = '';
'blocks' => getConfig('max_send'),
'subject' => $DATA[0],
'text' => $DATA[1],
- 'payment' => GET_PAYMENT($DATA[3]),
- 'category' => GET_CATEGORY($DATA[6]),
+ 'payment' => getPaymentTitlePrice($DATA[3]),
+ 'category' => getCategory($DATA[6]),
'url' => $DATA[5]
);
// Send an email to the user
$msg_mem = LOAD_EMAIL_TEMPLATE('order-member', $content, getUserId());
- SEND_EMAIL($email, getMessage('MEMBER_NEW_QUEUE'), $msg_mem);
+ sendEmail($email, getMessage('MEMBER_NEW_QUEUE'), $msg_mem);
// Notify admins about this
- SEND_ADMIN_NOTIFICATION(getMessage('ADMIN_NEW_QUEUE'), 'order-admin', $content, getUserId());
+ sendAdminNotification(getMessage('ADMIN_NEW_QUEUE'), 'order-admin', $content, getUserId());
// Output back bottom
LOAD_TEMPLATE('member_order-back', false);
} else {
// Matching line not found or already 'placed' in send queue
- LOAD_URL('modules.php?module=login');
+ redirectToUrl('modules.php?module=login');
}
} else {
// Redirect...
- LOAD_URL($URL);
+ redirectToUrl($URL);
}
//
phone, fax, cell, email, url,
status, receive_warnings
FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE id='%s' AND password='%s' LIMIT 1",
- array(bigintval(get_session('sponsorid')), get_session('sponsorpass')), __FILE__, __LINE__);
+WHERE `id`='%s' AND password='%s' LIMIT 1",
+ array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FILE__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
// Load sponsor data
$content = SQL_FETCHARRAY($result);
- if ($content['status'] == "CONFIRMED") {
+ if ($content['status'] == 'CONFIRMED') {
// Check if form was submitted or not
if (IS_FORM_SENT()) {
// Check passwords
if (!REQUEST_ISSET_POST(('pass_old'))) {
// No current password entered
$message = getMessage('SPONSOR_NO_CURRENT_PASSWORD_ENTERED');
- } elseif (md5(REQUEST_POST('pass_old')) != get_session('sponsorpass')) {
+ } elseif (md5(REQUEST_POST('pass_old')) != getSession('sponsorpass')) {
// Entered password didn't match password in DB
$message = getMessage('SPONSOR_CURRENT_PASSWORD_DIDNOT_MATCH_DB');
} elseif ((REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))) && (REQUEST_POST('pass1') != REQUEST_POST('pass2'))) {
}
} else {
// Locked or so?
- $STATUS = SPONSOR_TRANSLATE_STATUS($content['status']);
+ $STATUS = sponsorTranslateUserStatus($content['status']);
$OUT = LOAD_TEMPLATE('admin_settings_saved', true, sprintf(getMessage('SPONSOR_ACCOUNT_FAILED'), $STATUS));
}
} else {
// Sponsor account not found!
- $OUT = LOAD_TEMPLATE('admin_settings_saved', true, sprintf(getMessage('SPONSOR_ACCOUNT_404'), get_session('sponsorid')));
+ $OUT = LOAD_TEMPLATE('admin_settings_saved', true, sprintf(getMessage('SPONSOR_ACCOUNT_404'), getSession('sponsorid')));
}
// Free memory
// Data for the formular
$result = SQL_QUERY_ESC("SELECT status, receive_warnings, warning_interval, email, surname, family, gender
FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE id='%s' AND password='%s' LIMIT 1",
- array(bigintval(get_session('sponsorid')), get_session('sponsorpass')), __FILE__, __LINE__);
+WHERE `id`='%s' AND password='%s' LIMIT 1",
+ array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load sponsor data
$content = SQL_FETCHARRAY($result);
- if ($content['status'] == "CONFIRMED") {
+ if ($content['status'] == 'CONFIRMED') {
// Check if form was submitted or not
if (IS_FORM_SENT()) {
// Check passwords
if (!REQUEST_ISSET_POST(('password'))) {
// No current password entered
$message = SPONSOR_NO_CURRENT_PASSWORD_ENTERED;
- } elseif (md5(REQUEST_POST('password')) != get_session('sponsorpass')) {
+ } elseif (md5(REQUEST_POST('password')) != getSession('sponsorpass')) {
// Entered password didn't match password in DB
$message = SPONSOR_CURRENT_PASSWORD_DIDNOT_MATCH_DB;
} else {
}
// Translate current interval into fancy string
- define('__CURRENT', CREATE_FANCY_TIME($content['warning_interval']));
+ define('__CURRENT', createFancyTime($content['warning_interval']));
// Output formular
$OUT = LOAD_TEMPLATE("sponsor_settings_form", true, $content);
}
} else {
// Locked or so?
- $STATUS = SPONSOR_TRANSLATE_STATUS($content['status']);
+ $STATUS = sponsorTranslateUserStatus($content['status']);
$OUT = LOAD_TEMPLATE('admin_settings_saved', true, sprintf(getMessage('SPONSOR_ACCOUNT_FAILED'), $STATUS));
}
} else {
// Sponsor account not found!
- $OUT = LOAD_TEMPLATE('admin_settings_saved', true, sprintf(getMessage('SPONSOR_ACCOUNT_404'), get_session('sponsorid')));
+ $OUT = LOAD_TEMPLATE('admin_settings_saved', true, sprintf(getMessage('SPONSOR_ACCOUNT_404'), getSession('sponsorid')));
}
// Free memory
// Load some data
$result = SQL_QUERY_ESC("SELECT gender, surname, family, (points_amount - points_used) AS points
FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE id='%s' AND password='%s' LIMIT 1",
- array(bigintval(get_session('sponsorid')), get_session('sponsorpass')), __FILE__, __LINE__);
+WHERE `id`='%s' AND password='%s' LIMIT 1",
+ array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FILE__, __LINE__);
list($gender, $surname, $family, $points) = SQL_FETCHROW($result);
// Free memory
SQL_FREERESULT($result);
// Prepare data for the template
-define('__GENDER' , TRANSLATE_GENDER($gender));
+define('__GENDER' , translateGender($gender));
define('__SURNAME', $surname);
define('__FAMILY' , $family);
-define('__POINTS' , TRANSLATE_COMMA($points));
+define('__POINTS' , translateComma($points));
// Load main template
$OUT = LOAD_TEMPLATE("sponsor_welcome", true);
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Get current month (2 digits)
-$curr = date("m", time());
+$curr = date('m', time());
// Check if month is done
if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getConfig('beg_ranks') > 0) && ($GLOBALS['output_mode'] != 1)) {
// Use last online stamp only when autopurge for inactive members is activated
if ((getConfig('ap_inactive_since') > 0) && (getConfig('beg_active') == 'Y')) {
// Okay, include last online timestamp
- $whereStatement1 .= sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig(('ap_inactive_since')));;
+ $whereStatement1 .= sprintf(" AND `last_online` >= (UNIX_TIMESTAMP() - %s)", getConfig(('ap_inactive_since')));;
} // END - if
} // END - if
// Load our winners...
while ($content = SQL_FETCHARRAY($result_main)) {
// Add points to user's account directly
- ADD_POINTS_REFSYSTEM("monthly_beg", $content['userid'], $content['points'], false, "0", false, "direct");
+ ADD_POINTS_REFSYSTEM_DIRECT('monthly_beg', $content['userid'], $content['points']);
// Translate gender/points
- $content['gender'] = TRANSLATE_GENDER($content['gender']);
- $content['points'] = TRANSLATE_COMMA($content['points']);
+ $content['gender'] = translateGender($content['gender']);
+ $content['points'] = translateComma($content['points']);
// Load email template and email it away
$msg = LOAD_EMAIL_TEMPLATE("member_beg", $content, bigintval($content['userid']));
- SEND_EMAIL($content['email'], BEG_MONTHLY_RALLYE, $msg);
+ sendEmail($content['email'], getMessage('BEG_MONTHLY_RALLYE'), $msg);
} // END - while
// Reset accounts
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Get current month (2 digits)
-$curr = date("m", time());
+$curr = date('m', time());
if (($curr != getConfig('last_month')) && (getConfig('bonus_ranks') > 0) && ($GLOBALS['output_mode'] != 1)) {
// Extension 'autopurge' is inactive or purging of inactive accounts is deactivated
// Use last online stamp only when autopurge for inactive members is activated
if (getConfig('ap_inactive_since') > 0) {
// Okay, include last online timestamp
- $whereStatement1 = sprintf("WHERE `status`='CONFIRMED' AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
+ $whereStatement1 = sprintf("WHERE `status`='CONFIRMED' AND `last_online` >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
$whereStatement2 = getConfig(('bonus_ranks'));
} // END - if
} // END - if
// Make sure zero points are not mailed
if ($content['points'] > 0) {
// Add points to user's account directly
- ADD_POINTS_REFSYSTEM("monthly_bonus", $content['uid'], $content['points'], false, "0", false, "direct");
+ ADD_POINTS_REFSYSTEM_DIRECT('monthly_bonus', $content['uid'], $content['points']);
// Translate gender/points
- $content['gender'] = TRANSLATE_GENDER($content['gender']);
- $content['points'] = TRANSLATE_COMMA($content['points']);
+ $content['gender'] = translateGender($content['gender']);
+ $content['points'] = translateComma($content['points']);
// Load email template and email it away
$msg = LOAD_EMAIL_TEMPLATE("member_bonus", $content['points'], bigintval($content['uid']));
- SEND_EMAIL($content['email'], BONUS_MONTHLY_ONLINE_BONUS, $msg);
+ sendEmail($content['email'], getMessage('BONUS_MONTHLY_ONLINE_BONUS'), $msg);
} // END - if
} // END - while
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Get current month (2 digits)
-$curr = date("m", time());
+$curr = date('m', time());
if (getConfig('last_month') != $curr) {
// Check for unsubscribed members
- $result = SQL_QUERY("SELECT userid, email, nl_until FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nl_receive='N' ORDER BY userid", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT `userid`, `email`, `nl_until` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nl_receive`='N' ORDER BY `userid` ASC", __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Some unsubscriptions are found so we reset them to receive newsletters
while ($content = SQL_FETCHARRAY($result)) {
// Update account
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET nl_receive='Y', nl_until='0' WHERE userid=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `nl_receive`='Y', `nl_until`=0 WHERE `userid`=%s LIMIT 1",
array(bigintval($content['userid'])), __FILE__, __LINE__);
// Send email to him
$msg = LOAD_EMAIL_TEMPLATE("member_newsletter_reset", true, bigintval($content['userid']));
- SEND_EMAIL($content['email'], getMessage('NL_MEMBER_RESET_SUBJECT'), $msg);
+ sendEmail($content['email'], getMessage('NL_MEMBER_RESET_SUBJECT'), $msg);
// Send email to admin
- SEND_ADMIN_NOTIFICATION(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_reset", array(), getUserId());
+ sendAdminNotification(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_reset", array(), getUserId());
} // END - if
// Free memory
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Reset surfbar counter
-UPDATE_CONFIG("surfbar_monthly_counter", "0");
+updateConfiguration('surfbar_monthly_counter', '0');
//
?>
// Load more function libraries or includes
foreach (array('request-functions', 'session-functions', 'config-functions', 'code-functions', 'inc-functions', 'filters', 'mysql-manager', 'extensions', 'db/lib', 'handler', 'hooks') as $lib) {
// Load special functions
- LOAD_INC_ONCE('inc/' . $lib . '.php');
+ loadIncludeOnce('inc/' . $lib . '.php');
} // END - foreach
// Set error handler
loadConfiguration();
// Load "databases" aka static arrays
- LOAD_INC_ONCE('inc/databases.php');
+ loadIncludeOnce('inc/databases.php');
// Init session
- LOAD_INC_ONCE('inc/session.php');
+ loadIncludeOnce('inc/session.php');
// Load versions
- LOAD_INC_ONCE('inc/versions.php');
+ loadIncludeOnce('inc/versions.php');
// Loading patching system is required here...
- LOAD_INC_ONCE('inc/patch-system.php'); // Initialize patch system
+ loadIncludeOnce('inc/patch-system.php'); // Initialize patch system
// Run daily reset
- LOAD_INC_ONCE('inc/check-reset.php');
+ loadIncludeOnce('inc/check-reset.php');
// Load admin include file if he is admin
if (IS_ADMIN()) {
// Administrative functions
- LOAD_INC_ONCE('inc/modules/admin/admin-inc.php');
+ loadIncludeOnce('inc/modules/admin/admin-inc.php');
} // END - if
//* DEBUG: */ ADD_POINTS_REFSYSTEM('test', 36, 1000);
//* DEBUG: */ die();
// Get all values
if (($GLOBALS['output_mode'] != 1) && ($GLOBALS['output_mode'] != -1)) {
if (empty($GLOBALS['module'])) $GLOBALS['module'] = 'empty';
- if (empty($GLOBALS['what'])) $GLOBALS['what'] = GET_WHAT($GLOBALS['module']);
- if (empty($GLOBALS['action'])) $GLOBALS['action'] = GET_ACTION($GLOBALS['module'], $GLOBALS['what']);
+ if (empty($GLOBALS['what'])) $GLOBALS['what'] = getWhatFromModule($GLOBALS['module']);
+ if (empty($GLOBALS['action'])) $GLOBALS['action'] = getModeAction($GLOBALS['module'], $GLOBALS['what']);
} else {
// Set action/what to empty
$GLOBALS['action'] = '';
runFilterChain('init');
// Set default 'what' value
- //* DEBUG: */ OUTPUT_HTML("-".$GLOBALS['module']."/".$GLOBALS['what']."-<br />");
+ //* DEBUG: */ OUTPUT_HTML('-'.$GLOBALS['module'].'/'.$GLOBALS['what']."-<br />");
if ((empty($GLOBALS['what'])) && (empty($GLOBALS['action'])) && ($GLOBALS['output_mode'] != 1) && ($GLOBALS['output_mode'] != -1)) {
if ($GLOBALS['module'] == 'admin') {
// Set 'action' value to 'login' in admin menu
- $GLOBALS['action'] = GET_ACTION($GLOBALS['module'], $GLOBALS['what']);
+ $GLOBALS['action'] = getModeAction($GLOBALS['module'], $GLOBALS['what']);
} elseif (($GLOBALS['module'] == 'index') || ($GLOBALS['module'] == 'login')) {
// Set 'what' value to 'welcome' in guest and member menu
$GLOBALS['what'] = 'welcome';
} // END - if
// Update sending pool
- if (($GLOBALS['output_mode'] != '1') && ($GLOBALS['output_mode'] != '-1')) LOAD_INC_ONCE('inc/pool-update.php'); // Sends out mails in configureable steps
+ if (($GLOBALS['output_mode'] != '1') && ($GLOBALS['output_mode'] != '-1')) loadIncludeOnce('inc/pool-update.php'); // Sends out mails in configureable steps
// Load all active extension including language files when not upgrading.
// Check module for testing and count one click
if (!isset($GLOBALS['output_mode'])) $GLOBALS['output_mode'] = '0';
// Include databases.php
- LOAD_INC_ONCE('inc/databases.php');
+ loadIncludeOnce('inc/databases.php');
// Init session
- LOAD_INC_ONCE('inc/session.php');
+ loadIncludeOnce('inc/session.php');
// Load versions
- LOAD_INC_ONCE('inc/versions.php');
+ loadIncludeOnce('inc/versions.php');
// Check if we are in installation routine
if ((!isInstalling()) && ($GLOBALS['output_mode'] != '1') && ($GLOBALS['output_mode'] != -1)) {
// Redirect to the installation system
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
} // END - if
// Double-check installation mode
if ((!isInstalled()) || (!isAdminRegistered())) {
// Check for file permissions
- if (!IS_INC_WRITEABLE('config')) {
+ if (!isIncludeWriteable('config')) {
addFatalMessage(__FILE__, __LINE__, getMessage('CONFIG_IS_WRITE_PROTECTED'));
} // END - if
- if (!IS_INC_WRITEABLE('dummy')) {
+ if (!isIncludeWriteable('dummy')) {
addFatalMessage(__FILE__, __LINE__, getMessage('DUMMY_IS_WRITE_PROTECTED'));
} // END - if
- if (!IS_INC_WRITEABLE('.secret/dummy')) {
+ if (!isIncludeWriteable('.secret/dummy')) {
addFatalMessage(__FILE__, __LINE__, getMessage('SECRET_IS_WRITE_PROTECTED'));
} // END - if
} // END - if
if ((getTotalFatalErrors() > 0) && (isInstalled()) && (!isInstalling()) && ($GLOBALS['output_mode'] != '1')) {
// One or more fatal error(s) occur during connect...
- LOAD_INC_ONCE('inc/header.php');
- LOAD_INC_ONCE('inc/fatal_errors.php');
- LOAD_INC_ONCE('inc/footer.php');
+ loadIncludeOnce('inc/header.php');
+ loadIncludeOnce('inc/fatal_errors.php');
+ loadIncludeOnce('inc/footer.php');
} // END - if
//
require($INC);
}
-// Returns the title for given module
-function ADD_MODULE_TITLE ($mod) {
+// "Getter" for module title
+function getModuleTitle ($mod) {
// Init variables
$name = '';
$result = false;
return $name;
}
+// "Getter" for module description
+function getModuleDescription ($mode, $wht, $column = 'what') {
+ // Fix empty "what"
+ if (empty($wht)) {
+ $wht = "welcome";
+ if (getConfig('index_home') != '') $wht = getConfig('index_home');
+ } // END - if
+
+ // Default is not found
+ $ret = "??? (".$wht.")";
+
+ // Look for title
+ $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE %s='%s' LIMIT 1",
+ array($mode, $column, $wht), __FUNCTION__, __LINE__);
+
+ // Is there an entry?
+ if (SQL_NUMROWS($result) == 1) {
+ // Fetch the title
+ list($ret) = SQL_FETCHROW($result);
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+ return $ret;
+}
+
// Check validity of a given module name (no file extension)
function checkModulePermissions ($mod) {
// Filter module name (names with low chars and underlines are fine!)
// Major error in module registry is the default
$ret = "major";
- // Check if script is installed if not return a "done" to prevent some errors
+ // Check if script is installed if not return a 'done' to prevent some errors
if ((!isInstalled()) || (isInstalling()) || (!isAdminRegistered())) {
// Not installed or no admin registered or in installation phase
- return "done";
+ return 'done';
} // END - if
// Init variables
- $locked = "Y";
- $hidden = "N";
- $admin = "N";
- $mem = "N";
+ $locked = 'Y';
+ $hidden = 'N';
+ $admin = 'N';
+ $mem = 'N';
$found = false;
// Check if cache is latest version
// Admin access ----- Guest access ----- --- Guest or member? ---
if ((IS_ADMIN()) || (($locked == 'N') && ($admin == 'N') && (($mem == 'N') || (IS_MEMBER())))) {
// If you are admin you are welcome for everything!
- $ret = "done";
+ $ret = 'done';
} elseif ($locked == 'Y') {
// Module is locked
$ret = "locked";
// Still no luck or not found?
if (($ret == "cache_miss") || (!$found)) {
// ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name ---
- if ((FILE_READABLE(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) {
+ if ((isFileReadable(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) {
// Data is missing so we add it
if (GET_EXT_VERSION('sql_patches') >= '0.3.6') {
// Since 0.3.6 we have a has_menu column, this took me a half hour
break;
}
$dummy = substr($search, 0, -4);
- $AND .= " AND `action`='".GET_ACTION($ACC_LVL, $dummy)."'";
+ $AND .= " AND `action`='".getModeAction($ACC_LVL, $dummy)."'";
} elseif (($ACC_LVL == 'sponsor') || ($ACC_LVL == "engine")) {
// Sponsor / engine menu
$type = "what";
return $ret;
} elseif (((GET_EXT_VERSION('sql_patches') >= '0.2.3') && (getConfig('youre_here') == 'Y')) || ((IS_ADMIN()) && ($modCheck == 'admin'))) {
// Output HTML code
- $OUT = $prefix."<strong><a class=\"you_are_here\" href=\"{!URL!}/modules.php?module=".$modCheck."&".$type."=".$search.$LINK_ADD."\">".$ret."</a></strong>\n";
+ $OUT = $prefix."<strong><a class=\"you_are_here\" href=\"{!URL!}/modules.php?module=".$modCheck.'&'.$type.'='.$search.$LINK_ADD."\">".$ret."</a></strong>\n";
// Can we close the you-are-here navigation?
- //* DEBUG: */ echo __LINE__."*".$type."/".$GLOBALS['what']."*<br />\n";
+ //* DEBUG: */ echo __LINE__."*".$type.'/'.$GLOBALS['what']."*<br />\n";
if (($type == "what") || (($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview")))) {
- //* DEBUG: */ echo __LINE__."+".$type."+<br />\n";
+ //* DEBUG: */ echo __LINE__.'+'.$type."+<br />\n";
// Add closing div and br-tag
$OUT .= "</div><br />\n";
- $GLOBALS['nav_depth'] = "0";
+ $GLOBALS['nav_depth'] = '0';
// Run the filter chain
$ret = runFilterChain('post_youhere_line', array('access_level' => $ACC_LVL, 'type' => $type, 'content' => ""));
$sub_what = '';
// is the menu action valid?
- if (!VALIDATE_MENU_ACTION($mode, $act, $wht, true)) {
+ if (!isMenuActionValid($mode, $act, $wht, true)) {
return getCode('MENU_NOT_VALID');
} // END - if
// Load SQL data and add the menu to the output stream...
$result_main = SQL_QUERY_ESC("SELECT title, action FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$AND." ORDER BY `sort`",
array($mode), __FUNCTION__, __LINE__);
- //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
+ //* DEBUG: */ echo __LINE__.'/'.$main_cnt.'/'.$main_action.'/'.$sub_what.':'.$GLOBALS['what']."*<br />\n";
if (SQL_NUMROWS($result_main) > 0) {
OUTPUT_HTML("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"".$mode."_menu\">");
// There are menus available, so we simply display them... :)
while ($content = SQL_FETCHARRAY($result_main)) {
- //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
+ //* DEBUG: */ echo __LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$sub_what.':'.$GLOBALS['what']."*<br />\n";
// Init variables
$GLOBALS['block_mode'] = false;
$act = $content['action'];
// Full file name for checking menu
//* DEBUG: */ echo __LINE__.":!!!!".$content['sub_what']."!!!<br />\n";
$INC = sprintf("inc/modules/%s/what-%s.php", $mode, $content['sub_what']);
- if (INCLUDE_READABLE($INC)) {
+ if (isIncludeReadable($INC)) {
if ((!empty($wht)) && (($wht == $content['sub_what']))) {
$OUT = "<strong>";
}
// Navigation link
- $OUT .= "<a name=\"menu\" class=\"menu_blur\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module']."&what=".$content['sub_what'].ADD_URL_DATA("")."\" target=\"_self\">";
+ $OUT .= "<a name=\"menu\" class=\"menu_blur\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module']."&what=".$content['sub_what'].addUrlData("")."\" target=\"_self\">";
} else {
$OUT .= "<em>";
}
// Menu title
$OUT .= getConfig('menu_blur_spacer') . $content['sub_title'];
- if (INCLUDE_READABLE($INC)) {
+ if (isIncludeReadable($INC)) {
$OUT .= "</a>";
} else {
$OUT .= "</em>";
// This is a menu block... ;-)
$GLOBALS['block_mode'] = true;
$INC_BLOCK = sprintf("inc/modules/%s/action-%s.php", $mode, $content['action']);
- if (FILE_READABLE($INC_BLOCK)) {
+ if (isFileReadable($INC_BLOCK)) {
// Load include file
if ((!EXT_IS_ACTIVE($content['action'])) || ($content['action'] == 'online')) OUTPUT_HTML("<tr>
<td class=\"".$mode."_menu_whats\">");
- //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
- LOAD_INC($INC_BLOCK);
- //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
+ //* DEBUG: */ echo __LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.$GLOBALS['what']."*<br />\n";
+ loadInclude($INC_BLOCK);
+ //* DEBUG: */ echo __LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.$GLOBALS['what']."*<br />\n";
if ((!EXT_IS_ACTIVE($content['action'])) || ($content['action'] == 'online')) OUTPUT_HTML(" </td>
</tr>");
}
- //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
+ //* DEBUG: */ echo __LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.$GLOBALS['what']."*<br />\n";
}
$main_cnt++;
- //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
+ //* DEBUG: */ echo __LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.$GLOBALS['what']."*<br />\n";
if (SQL_NUMROWS($result_main) > $main_cnt) {
OUTPUT_HTML("<tr><td class=\"".$mode."_menu_seperator\"></td></tr>");
} // END - if
SQL_FREERESULT($result_main);
// Close table
- //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
+ //* DEBUG: */ echo __LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.$GLOBALS['what']."*<br />\n";
OUTPUT_HTML("</table>");
}
}
+// Checks wether the current user is a member
+function IS_MEMBER () {
+ // @TODO Why is this global??? #100
+ global $status;
+
+ if (!is_array($GLOBALS['last'])) $GLOBALS['last'] = array();
+ $ret = false;
+
+ // is the cache entry there?
+ if (isset($GLOBALS['cache_array']['is_member'])) {
+ // Then return it
+ return $GLOBALS['cache_array']['is_member'];
+ } // END - if
+
+ // Fix "deleted" cookies first
+ fixDeletedCookies(array('userid', 'u_hash'));
+
+ // Are cookies set?
+ if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
+ // Cookies are set with values, but are they valid?
+ $result = SQL_QUERY_ESC("SELECT password, status, last_module, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+ array(getUserId()), __FUNCTION__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
+ // Load data from cookies
+ list($password, $status, $mod, $onl) = SQL_FETCHROW($result);
+
+ // Validate password by created the difference of it and the secret key
+ $valPass = generatePassString($password);
+
+ // Transfer last module and online time
+ if ((!empty($mod)) && (empty($GLOBALS['last']['module']))) {
+ $GLOBALS['last']['module'] = $mod;
+ $GLOBALS['last']['online'] = $onl;
+ } // END - if
+
+ // So did we now have valid data and an unlocked user?
+ //* DEBUG: */ echo $valPass."<br />".getSession('u_hash')."<br />";
+ if (($status == 'CONFIRMED') && ($valPass == getSession('u_hash'))) {
+ // Account is confirmed and all cookie data is valid so he is definely logged in! :-)
+ $ret = true;
+ } else {
+ // Maybe got locked etc.
+ //* DEBUG: */ echo __LINE__."!!!<br />";
+ destroyUserSession();
+ }
+ } else {
+ // Cookie data is invalid!
+ //* DEBUG: */ echo __LINE__."***<br />";
+ destroyUserSession();
+ }
+
+ // Free memory
+ SQL_FREERESULT($result);
+ } else {
+ // Cookie data is invalid!
+ //* DEBUG: */ echo __LINE__."///<br />";
+ destroyUserSession();
+ }
+
+ // Cache status
+ $GLOBALS['cache_array']['is_member'] = $ret;
+
+ // Return status
+ return $ret;
+}
+
// This patched function will reduce many SELECT queries for the specified or current admin login
-function IS_ADMIN ($admin="") {
+function IS_ADMIN ($admin = '') {
// Init variables
$ret = false; $passCookie = ''; $valPass = '';
//* DEBUG: */ echo __LINE__."ADMIN:".$admin."<br />";
// If admin login is not given take current from cookies...
if ((empty($admin)) && (isSessionVariableSet('admin_login')) && (isSessionVariableSet('admin_md5'))) {
// Get admin login and password from session/cookies
- $admin = get_session('admin_login');
- $passCookie = get_session('admin_md5');
+ $admin = getSession('admin_login');
+ $passCookie = getSession('admin_md5');
}
- //* DEBUG: */ echo __LINE__."ADMIN:".$admin."/".$passCookie."<br />";
+ //* DEBUG: */ echo __LINE__."ADMIN:".$admin.'/'.$passCookie."<br />";
// Search in array for entry
if (isset($GLOBALS['cache_array']['admin_hash'])) {
if (!empty($valPass)) {
// Check if password is valid
- //* DEBUG: */ print __FUNCTION__."*".$valPass."/".$passCookie."*<br />\n";
+ //* DEBUG: */ print __FUNCTION__."*".$valPass.'/'.$passCookie."*<br />\n";
$ret = (($valPass == $passCookie) || ((strlen($valPass) == 32) && ($valPass == md5($passCookie))) || (($valPass == "*FAILED*") && (!EXT_IS_ACTIVE('cache'))));
}
}
// Generates a list of "max receiveable emails per day"
-function ADD_MAX_RECEIVE_LIST ($mode, $default = "", $return = false) {
+function addMaxReceiveList ($mode, $default = '', $return = false) {
$OUT = '';
$result = false;
}
// Checks wether the given email address is used.
-function SEARCH_EMAIL_USERTAB ($email) {
+function isEmailTaken ($email) {
// Query the database
$result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE email LIKE '{PER}%s{PER}' LIMIT 1",
array($email), __FUNCTION__, __LINE__);
return $ret;
}
-// Checks wether the current user is a member
-function IS_MEMBER () {
- // @TODO Why is this global??? #100
- global $status;
-
- if (!is_array($GLOBALS['last'])) $GLOBALS['last'] = array();
- $ret = false;
-
- // is the cache entry there?
- if (isset($GLOBALS['cache_array']['is_member'])) {
- // Then return it
- return $GLOBALS['cache_array']['is_member'];
- } // END - if
-
- // Fix "deleted" cookies first
- FIX_DELETED_COOKIES(array('userid', 'u_hash'));
-
- // Are cookies set?
- if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
- // Cookies are set with values, but are they valid?
- $result = SQL_QUERY_ESC("SELECT password, status, last_module, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array(getUserId()), __FUNCTION__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
- // Load data from cookies
- list($password, $status, $mod, $onl) = SQL_FETCHROW($result);
-
- // Validate password by created the difference of it and the secret key
- $valPass = generatePassString($password);
-
- // Transfer last module and online time
- if ((!empty($mod)) && (empty($GLOBALS['last']['module']))) {
- $GLOBALS['last']['module'] = $mod;
- $GLOBALS['last']['online'] = $onl;
- } // END - if
-
- // So did we now have valid data and an unlocked user?
- //* DEBUG: */ echo $valPass."<br />".get_session('u_hash')."<br />";
- if (($status == "CONFIRMED") && ($valPass == get_session('u_hash'))) {
- // Account is confirmed and all cookie data is valid so he is definely logged in! :-)
- $ret = true;
- } else {
- // Maybe got locked etc.
- //* DEBUG: */ echo __LINE__."!!!<br />";
- destroy_user_session();
- }
- } else {
- // Cookie data is invalid!
- //* DEBUG: */ echo __LINE__."***<br />";
- destroy_user_session();
- }
-
- // Free memory
- SQL_FREERESULT($result);
- } else {
- // Cookie data is invalid!
- //* DEBUG: */ echo __LINE__."///<br />";
- destroy_user_session();
- }
-
- // Cache status
- $GLOBALS['cache_array']['is_member'] = $ret;
-
- // Return status
- return $ret;
-}
-
// Validate the given menu action
-function VALIDATE_MENU_ACTION ($mode, $act, $wht, $UPDATE=false) {
+function isMenuActionValid ($mode, $act, $wht, $UPDATE=false) {
// Is the cache entry there and we shall not update?
if ((isset($GLOBALS['cache_array']['action_valid'][$mode][$act][$wht])) && ($UPDATE === false)) {
// Count cache hit
$add = '';
if ((!IS_ADMIN()) && ($mode != 'admin')) $add = " AND `locked`='N'";
- //* DEBUG: */ echo __LINE__.":".$mode."/".$act."/".$wht."*<br />\n";
+ //* DEBUG: */ echo __LINE__.':'.$mode.'/'.$act.'/'.$wht."*<br />\n";
if (($mode != 'admin') && ($UPDATE === true)) {
// Update guest or member menu
$sql = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_%s_menu` SET counter=counter+1 WHERE `action`='%s' AND `what`='%s'".$add." LIMIT 1",
}
//
-function GET_MOD_DESCR($mode, $wht, $column="what") {
- // Fix empty "what"
- if (empty($wht)) {
- $wht = "welcome";
- if (getConfig('index_home') != "") $wht = getConfig('index_home');
- } // END - if
-
- // Default is not found
- $ret = "??? (".$wht.")";
-
- // Look for title
- $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE %s='%s' LIMIT 1",
- array($mode, $column, $wht), __FUNCTION__, __LINE__);
-
- // Is there an entry?
- if (SQL_NUMROWS($result) == 1) {
- // Fetch the title
- list($ret) = SQL_FETCHROW($result);
- } // END - if
-
- // Free result
- SQL_FREERESULT($result);
- return $ret;
-}
-//
-function SEND_MODE_MAILS($mod, $modes) {
+function sendModeMails ($mod, $modes) {
global $DATA;
// Load hash
list($hashDB) = SQL_FETCHROW($result_main);
// Extract salt from cookie
- $salt = substr(get_session('u_hash'), 0, -40);
+ $salt = substr(getSession('u_hash'), 0, -40);
// Now let's compare passwords
$hash = generatePassString($hashDB);
- if (($hash == get_session('u_hash')) || (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
+ if (($hash == getSession('u_hash')) || (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
// Load user's data
$result = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, country, zip, city, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND password='%s' LIMIT 1",
array(getUserId(), $hashDB), __FUNCTION__, __LINE__);
SQL_FREERESULT($result);
// Translate gender
- $DATA[0] = TRANSLATE_GENDER($DATA[0]);
+ $DATA[0] = translateGender($DATA[0]);
// Clear/init the content variable
$content = '';
case 'normal': break; // Do not add any special lines
case 'email': // Email was changed!
- $content = MEMBER_CHANGED_EMAIL.": ".REQUEST_POST('old_addy')."\n";
+ $content = getMessage('MEMBER_CHANGED_EMAIL').": ".REQUEST_POST('old_addy')."\n";
break;
case 'pass': // Password was changed
- $content = MEMBER_CHANGED_PASS."\n";
+ $content = getMessage('MEMBER_CHANGED_PASS')."\n";
break;
default:
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown mode %s detected.", $mode));
- $content = MEMBER_UNKNOWN_MODE.": ".$mode."\n\n";
+ $content = getMessage('MEMBER_UNKNOWN_MODE').": ".$mode."\n\n";
break;
} // END - switch
} // END - if
if (getConfig('admin_notify') == 'Y') {
// The admin needs to be notified about a profile change
$msg_admin = "admin_mydata_notify";
- $sub_adm = ADMIN_CHANGED_DATA;
+ $sub_adm = getMessage('ADMIN_CHANGED_DATA');
} else {
// No mail to admin
$msg_admin = '';
}
// Set subject lines
- $sub_mem = MEMBER_CHANGED_DATA;
+ $sub_mem = getMessage('MEMBER_CHANGED_DATA');
// Output success message
- $content = "<span class=\"member_done\">".MYDATA_MAIL_SENT."</span>";
+ $content = "<span class=\"member_done\">{--MYDATA_MAIL_SENT--}</span>";
break;
default:
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unsupported module %s detected.", $mod));
- $content = "<span class=\"member_failed\">".UNKNOWN_MODULE."</span>";
+ $content = "<span class=\"member_failed\">{--UNKNOWN_MODULE--}</span>";
break;
} // END - switch
} else {
// Send email to user if required
if ((!empty($sub_mem)) && (!empty($msg))) {
// Send member mail
- SEND_EMAIL($DATA[7], $sub_mem, $msg);
+ sendEmail($DATA[7], $sub_mem, $msg);
} // END - if
// Send only if no other error has occured
if (empty($content)) {
if ((!empty($sub_adm)) && (!empty($msg_admin))) {
// Send admin mail
- SEND_ADMIN_NOTIFICATION($sub_adm, $msg_admin, $content, getUserId());
+ sendAdminNotification($sub_adm, $msg_admin, $content, getUserId());
} elseif (getConfig('admin_notify') == 'Y') {
// Cannot send mails to admin!
$content = getMessage('CANNOT_SEND_ADMIN_MAILS');
}
// Get action value from mode (admin/guest/member) and what-value
-function GET_ACTION ($mode, &$wht) {
+function getModeAction ($mode, &$wht) {
// Init status
$ret = '';
- //* DEBUG: */ echo __LINE__."=".$mode."/".$wht."/".$GLOBALS['action']."=<br />";
+ //* DEBUG: */ echo __LINE__.'='.$mode.'/'.$wht.'/'.$GLOBALS['action']."=<br />";
if ((empty($wht)) && ($mode != 'admin')) {
$wht = "welcome";
- if (getConfig('index_home') != "") $wht = getConfig('index_home');
+ if (getConfig('index_home') != '') $wht = getConfig('index_home');
} // END - if
if ($mode == 'admin') {
// Free memory
SQL_FREERESULT($result);
- } elseif ((GET_EXT_VERSION('sql_patches') == "") && ($mode != 'admin')) {
+ } elseif ((GET_EXT_VERSION('sql_patches') == '') && ($mode != 'admin')) {
// No sql_patches installed, but maybe we need to register an admin?
if (isAdminRegistered()) {
// Redirect
// @TODO Why does this lead into an endless loop but we still need it???
- // @TODO Commented out LOAD_URL('admin.php');
+ // @TODO Commented out redirectToUrl('admin.php');
} // END - if
}
}
// Get category name back
-function GET_CATEGORY ($cid) {
+function getCategory ($cid) {
// Default is not found
$ret = getMessage('_CATEGORY_404');
$ret = getMessage('_CATEGORY_NONE');
} elseif ($cid > 0) {
// Lookup the category in database
- $result = SQL_QUERY_ESC("SELECT cat FROM `{!_MYSQL_PREFIX!}_cats` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT cat FROM `{!_MYSQL_PREFIX!}_cats` WHERE `id`=%s LIMIT 1",
array(bigintval($cid)), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Category found... :-)
}
// Get a string of "mail title" and price back
-function GET_PAYMENT ($pid, $full=false) {
+function getPaymentTitlePrice ($pid, $full=false) {
// Default is not found
$ret = getMessage('_PAYMENT_404');
// Load payment data
- $result = SQL_QUERY_ESC("SELECT mail_title, price FROM `{!_MYSQL_PREFIX!}_payments` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT mail_title, price FROM `{!_MYSQL_PREFIX!}_payments` WHERE `id`=%s LIMIT 1",
array(bigintval($pid)), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Payment type found... :-)
} else {
// Return title and price
list($t, $p) = SQL_FETCHROW($result);
- $ret = $t.' / '.TRANSLATE_COMMA($p).' {!POINTS!}';
+ $ret = $t.' / '.translateComma($p).' {!POINTS!}';
}
}
}
// Get (basicly) the price of given payment id
-function GET_PAY_POINTS ($pid, $lookFor = 'price') {
+function getPaymentPoints ($pid, $lookFor = 'price') {
+ // Default value...
$ret = '-1';
- $result = SQL_QUERY_ESC("SELECT %s FROM `{!_MYSQL_PREFIX!}_payments` WHERE id=%s LIMIT 1",
+
+ // Search for it in database
+ $result = SQL_QUERY_ESC("SELECT %s FROM `{!_MYSQL_PREFIX!}_payments` WHERE `id`=%s LIMIT 1",
array($lookFor, $pid), __FUNCTION__, __LINE__);
+
+ // Is the entry there?
if (SQL_NUMROWS($result) == 1) {
// Payment type found... :-)
list($ret) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- }
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Return value
return $ret;
}
// Remove a receiver's ID from $receivers and add a link for him to confirm
-function REMOVE_RECEIVER (&$receivers, $key, $uid, $pool_id, $stats_id='', $bonus=false) {
+function removeReceiver (&$receivers, $key, $uid, $pool_id, $stats_id='', $bonus=false) {
// Default is not removed
$ret = 'failed';
if ($bonus) { $type = 'BONUS'; $rowName = 'bonus_id'; }
// Try to look the entry up
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_links` WHERE %s='%s' AND userid=%s AND link_type='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE %s='%s' AND `userid`=%s AND link_type='%s' LIMIT 1",
array($rowName, $stats_id, bigintval($uid), $type), __FUNCTION__, __LINE__);
// Was it *not* found?
return $ret;
}
// Getter fro ref level percents
-function GET_REF_LEVEL_PERCENTS ($level) {
+function getReferalLevelPercents ($level) {
// Default is zero
$per = 0;
// Return percent
return $per;
}
+
/**
*
* Dynamic referal system, can also send mails!
* send_notify = shall I send the referal an email or not?
* rid = inc/modules/guest/what-confirm.php need this (DEPRECATED???)
* locked = Shall I pay it to normal (false) or locked (true) points ammount?
- * add_mode = Add points only to $uid or also refs? (WARNING! Changing "ref" to "direct"
+ * add_mode = Add points only to $uid or also refs? (WARNING! Changing 'ref' to 'direct'
* for default value will cause no referal will get points ever!!!)
*/
-function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid='0', $locked=false, $add_mode='ref') {
+function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify = false, $rid = '0', $locked = false, $add_mode = 'ref') {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
global $DATA;
$GLOBALS['cache_array']['add_uid'][$ref] = $uid;
// Get percents
- $per = GET_REF_LEVEL_PERCENTS($GLOBALS['ref_level']);
+ $per = getReferalLevelPercents($GLOBALS['ref_level']);
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},points={$points},depth={$GLOBALS['ref_level']},per={$per},mode={$add_mode}<br />\n";
// Some percents found?
// Load email template
$msg = LOAD_EMAIL_TEMPLATE('confirm-referal', $content, bigintval($uid));
- SEND_EMAIL($email, THANX_REFERRAL_ONE, $msg);
- } elseif (($send_notify) && ($ref == 0) && (!$locked) && ($add_mode == "direct") && (!defined('__POINTS_VALUE'))) {
+ sendEmail($email, THANX_REFERRAL_ONE, $msg);
+ } elseif (($send_notify) && ($ref == 0) && (!$locked) && ($add_mode == 'direct') && (!defined('__POINTS_VALUE'))) {
// Direct payment shall be notified about
define('__POINTS_VALUE', $ref_points);
// Prepare content
$content = array(
'text' => getMessage('REASON_DIRECT_PAYMENT'),
- 'points' => TRANSLATE_COMMA($ref_points)
+ 'points' => translateComma($ref_points)
);
// Load message
$msg = LOAD_EMAIL_TEMPLATE('add-points', $content, $uid);
// And sent it away
- SEND_EMAIL($email, getMessage('SUBJECT_DIRECT_PAYMENT'), $msg);
+ sendEmail($email, getMessage('SUBJECT_DIRECT_PAYMENT'), $msg);
if (!REQUEST_ISSET_GET(('mid'))) LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
}
SQL_FREERESULT($result_user);
//* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
}
-//
-function UPDATE_REF_COUNTER ($uid) {
+
+// Wrapper function for ADD_POINTS_REFSYSTEM()
+function ADD_POINTS_REFSYSTEM_DIRECT ($subject, $uid, $points) {
+ return ADD_POINTS_REFSYSTEM($subject, $uid, $points, false, 0, false, 'direct');
+}
+
+// Updates the referal counter
+function updateReferalCounter ($uid) {
// Make it sure referal level zero (member him-/herself) is at least selected
if (empty($GLOBALS['cache_array']['ref_level'][$uid])) $GLOBALS['cache_array']['ref_level'][$uid] = 1;
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$GLOBALS['cache_array']['ref_level'][$uid]}<br />\n";
if (($ref > 0) && ($ref != $uid)) {
// Move to next referal level and count his counter one up!
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - ADVANCE!<br />\n";
- $GLOBALS['cache_array']['ref_level'][$uid]++; UPDATE_REF_COUNTER($ref);
+ $GLOBALS['cache_array']['ref_level'][$uid]++; updateReferalCounter($ref);
} elseif ((($ref == $uid) || ($ref == 0)) && (GET_EXT_VERSION('cache') >= '0.1.2')) {
// Remove cache here
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - CACHE!<br />\n";
// Handle refback here if extension is installed
if (EXT_IS_ACTIVE('refback')) {
- UPDATE_REFBACK_table($uid);
+ updateRefbackTable($uid);
} // END - if
}
$result = SQL_QUERY("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id` ASC", __FUNCTION__, __LINE__);
while ($content = SQL_FETCHARRAY($result)) {
// Send the email out
- SEND_EMAIL($content['email'], $subj, $msg);
+ sendEmail($content['email'], $subj, $msg);
} // END - if
// Free result
incrementConfigEntry('cache_hits');
} elseif (!EXT_IS_ACTIVE('cache')) {
// Load from database
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
array($login), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
list($ret) = SQL_FETCHROW($result);
}
// "Getter" for current admin id
-function GET_CURRENT_ADMIN_ID () {
+function getCurrentAdminId () {
// Get the admin login from session
- $adminLogin = get_session('admin_login');
+ $adminLogin = getSession('admin_login');
// "Solve" it into an id
$adminId = GET_ADMIN_ID($adminLogin);
incrementConfigEntry('cache_hits');
} elseif (!EXT_IS_ACTIVE('cache')) {
// Load from database
- $result = SQL_QUERY_ESC("SELECT password FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT password FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
array($aid), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Fetch data
}
return $ret;
}
-//
-function GET_ADMIN_LOGIN ($aid) {
+
+// "Getter" for admin login
+function getAdminLogin ($aid) {
// By default a non-existent login is returned (other functions react on this!)
$ret = '***';
incrementConfigEntry('cache_hits');
} elseif (!EXT_IS_ACTIVE('cache')) {
// Load from database
- $result = SQL_QUERY_ESC("SELECT login FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT login FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
array(bigintval($aid)), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Fetch data
}
return $ret;
}
+
// Get email address of admin id
-function GET_ADMIN_EMAIL ($aid) {
+function getAdminEmail ($aid) {
// By default an invalid emails is returned
$ret = '***';
incrementConfigEntry('cache_hits');
} elseif (!EXT_IS_ACTIVE('cache')) {
// Load from database
- $result_aid = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
+ $result_aid = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
array(bigintval($aid)), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result_aid) == 1) {
// Get data
// Return email
return $ret;
}
+
// Get default ACL of admin id
-function GET_ADMIN_DEFAULT_ACL ($aid) {
+function getAdminDefaultAcl ($aid) {
// By default an invalid ACL value is returned
$ret = '***';
incrementConfigEntry('cache_hits');
} elseif (!EXT_IS_ACTIVE('cache')) {
// Load from database
- $result_aid = SQL_QUERY_ESC("SELECT default_acl FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
+ $result_aid = SQL_QUERY_ESC("SELECT default_acl FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
array(bigintval($aid)), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result_aid) == 1) {
// Fetch data
// Return email
return $ret;
}
-//
-function ADD_OPTION_LINES ($table, $id, $name, $default='', $special='', $where='') {
+
+// Generates an option list from various parameters
+function generateOptionList ($table, $id, $name, $default='', $special='', $where='') {
$ret = '';
if ($table == '/ARRAY/') {
// Selection from array
} else {
// Data from database
$SPEC = ', '.$id;
- if (!empty($special)) $SPEC = ', '.$special;
+ if (!empty($special)) $SPEC = ', ' . $special;
$ORDER = $name.$SPEC;
if ($table == 'country') $ORDER = $special;
$result = SQL_QUERY_ESC("SELECT %s, %s".$SPEC." FROM `{!_MYSQL_PREFIX!}_%s` ".$where." ORDER BY %s",
// Activate System
SET_SQLS(array(
"UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', `hidden`='N', `mem_only`='Y' WHERE `module`='order' LIMIT 1",
- "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what='order' OR `what`='unconfirmed' LIMIT 2",
- "UPDATE `{!_MYSQL_PREFIX!}_config` SET activate_xchange='0' WHERE config=0 LIMIT 1"
+ "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='order' OR `what`='unconfirmed' LIMIT 2",
+ "UPDATE `{!_MYSQL_PREFIX!}_config` SET `activate_xchange`=0 WHERE `config`=0 LIMIT 1"
));
// Run SQLs
} // END - if
}
-//
-function DELETE_USER_ACCOUNT ($uid, $reason) {
+// Deletes a user account with given reason
+function deleteUserAccount ($uid, $reason) {
$points = 0;
$result = SQL_QUERY_ESC("SELECT (SUM(p.points) - d.used_points) AS points
FROM `{!_MYSQL_PREFIX!}_user_points` AS p
// Now a mail to the user and that's all...
$msg = LOAD_EMAIL_TEMPLATE("del-user", array('text' => $reason), $uid);
- SEND_EMAIL($uid, getMessage('ADMIN_DEL_ACCOUNT'), $msg);
+ sendEmail($uid, getMessage('ADMIN_DEL_ACCOUNT'), $msg);
// Ok, delete the account!
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
}
-//
-function META_DESCRIPTION ($mod, $wht) {
+// Generates meta description for given module and 'what' value
+function generateMetaDescriptionCode ($mod, $wht) {
// Exclude admin and member's area
if (($mod != 'admin') && ($mod != 'login')) {
// Construct dynamic description
// Remove depth
unset($GLOBALS['ref_level']);
}
-//
+
+// Adds points to the jackpot
function ADD_JACKPOT($points) {
$result = SQL_QUERY("SELECT points FROM `{!_MYSQL_PREFIX!}_jackpot` WHERE ok='ok' LIMIT 1", __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
array($points), __FUNCTION__, __LINE__);
}
}
-//
+
+// Subtracts points from the jackpot
function SUB_JACKPOT($points) {
// First failed
$ret = '-1';
// Checks wether the extension demo is actuve and the admin login is demo (password needs to be demo, too!)
function IS_DEMO () {
- return ((EXT_IS_ACTIVE('demo')) && (get_session('admin_login') == 'demo'));
+ return ((EXT_IS_ACTIVE('demo')) && (getSession('admin_login') == 'demo'));
}
// Gets the matching what name from module
-function GET_WHAT ($modCheck) {
+function getWhatFromModule ($modCheck) {
// Is the request element set?
if (REQUEST_ISSET_GET('what')) {
// Then return this!
} // END - if
$wht = '';
- //* DEBUG: */ echo __LINE__."!".$modCheck."!<br />\n";
+ //* DEBUG: */ echo __LINE__.'!'.$modCheck."!<br />\n";
switch ($modCheck)
{
case 'admin':
}
// Update config entries
-function UPDATE_CONFIG ($entries, $values, $updateMode='') {
+function updateConfiguration ($entries, $values, $updateMode='') {
// Do not update config in CSS mode
if (($GLOBALS['output_mode'] == '1') || ($GLOBALS['output_mode'] == -1)) {
return;
}
// Prepares an SQL statement part for HTML mail and/or holiday depency
+// @TODO Can this be rewritten to a filter?
function PREPARE_SQL_HTML_HOLIDAY ($mode) {
// Exclude no users by default
$MORE = '';
}
// "Getter" for total available receivers
-function GET_TOTAL_RECEIVERS ($mode='normal') {
+function getTotalReceivers ($mode='normal') {
// Query database
$result_all = SQL_QUERY("SELECT userid
FROM `{!_MYSQL_PREFIX!}_user_data`
}
// Returns HTML code with an "<option> list" of all categories
-function ADD_CATEGORY_OPTIONS ($mode) {
+function generateCategoryOptionsList ($mode) {
// Prepare WHERE statement
$whereStatement = " WHERE `visible`='Y'";
if (IS_ADMIN()) $whereStatement = '';
}
// Add bonus mail to queue
-function ADD_BONUS_MAIL_TO_QUEUE ($subject, $text, $receiverList, $points, $seconds, $url, $cat, $mode='normal', $receiver=0) {
+function addBonusMailToQueue ($subject, $text, $receiverList, $points, $seconds, $url, $cat, $mode='normal', $receiver=0) {
// Is admin or bonus extension there?
if (!IS_ADMIN()) {
// Abort here
}
// Calculcate target sent
- $target = SELECTION_COUNT(explode(';', $receiverList));
+ $target = countSelection(explode(';', $receiverList));
// Receiver is zero?
if ($receiver == 0) {
}
// Generate a receiver list for given category and maximum receivers
-function GENERATE_RECEIVER_LIST ($cat, $receiver, $mode="") {
+function generateReceiverList ($cat, $receiver, $mode = '') {
// Init variables
$CAT_TABS = "%s";
$CAT_WHERE = '';
// Is the receiver zero and mode set?
if (($receiver == 0) && (!empty($mode))) {
// Auto-fix receiver maximum
- $receiver = GET_TOTAL_RECEIVERS($mode);
+ $receiver = getTotalReceivers($mode);
} // END - if
// Category given?
}
// Get timestamp for given stats type and data
-function USER_STATS_GET_TIMESTAMP ($type, $data, $uid = 0) {
+function getTimestampFromUserStats ($type, $data, $uid = 0) {
// Default timestamp is zero
$stamp = 0;
}
// Inserts user stats
-function USER_STATS_INSERT_RECORD ($uid, $type, $data) {
+function insertUserStatsRecord ($uid, $type, $data) {
// Is the extension installed and updated?
if ((!EXT_IS_ACTIVE('sql_patches')) || (EXT_VERSION_IS_OLDER('sql_patches', '0.5.6'))) {
// Return zero here
} // END - if
// Does it exist?
- if ((!USER_STATS_GET_TIMESTAMP($type, $data, $uid)) && (!is_array($data))) {
+ if ((!getTimestampFromUserStats($type, $data, $uid)) && (!is_array($data))) {
// Then insert it!
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_stats_data` (`userid`,`stats_type`,`stats_data`) VALUES (%s,'%s','%s')",
array(bigintval($uid), $type, $data), __FUNCTION__, __LINE__);
}
// "Getter" for array for user refs and points in given level
-function GET_USER_REF_POINTS ($uid, $level) {
+function getUserReferalPoints ($uid, $level) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
// Default is no refs and no nickname
$add = '';
} // END - if
// Activity is 'active' by default because if autopurge is not installed
- $row['activity'] = MEMBER_ACTIVITY_ACTIVE;
+ $row['activity'] = getMessage('MEMBER_ACTIVITY_ACTIVE');
// Is autopurge installed and the user inactive?
if ((EXT_IS_ACTIVE('autopurge')) && ((time() - getConfig('ap_inactive_since')) >= $row['last_online'])) {
// Inactive user!
- $row['activity'] = MEMBER_ACTIVITY_INACTIVE;
+ $row['activity'] = getMessage('MEMBER_ACTIVITY_INACTIVE');
} // END - if
// Remove some entries
return $refs;
}
-// Recuced the amount of received emails for the receipients for given email
-function REDUCED_RECIPIENT_RECEIVED_MAILS ($column, $id, $count) {
+// Recuce the amount of received emails for the receipients for given email
+function reduceRecipientReceivedMails ($column, $id, $count) {
// Search for mail in database
$result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `%s`=%s ORDER BY `userid` ASC LIMIT %s",
array($column, bigintval($id), $count), __FUNCTION__, __LINE__);
// Check for patch level differences between databases and current hard-coded
if ((constant('CURR_SVN_REVISION') > getConfig('patch_level')) || (getConfig('patch_level') == "CURR_SVN_REVISION") || (getConfig('patch_ctime') == "UNIX_TIMES")) {
// Update database and CONFIG array
- UPDATE_CONFIG(array("patch_level", "patch_ctime"), array(constant('CURR_SVN_REVISION'), "UNIX_TIMESTAMP()"));
+ updateConfiguration(array("patch_level", "patch_ctime"), array(constant('CURR_SVN_REVISION'), "UNIX_TIMESTAMP()"));
setConfigEntry('patch_level', constant('CURR_SVN_REVISION'));
setConfigEntry('patch_ctime', time());
} // END - if
// Init & set the include pool
INIT_INC_POOL();
-SET_INC_POOL(GET_DIR_AS_ARRAY('inc/pool/', 'pool-'));
+SET_INC_POOL(getArrayFromDirectory('inc/pool/', 'pool-'));
// Run the filter
runFilterChain('load_includes');
$DATA['url'] = COMPILE_CODE($DATA['url']);
// Message is active in queue
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='QUEUE' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='QUEUE' WHERE `id`=%s LIMIT 1",
array(bigintval($DATA['id'])), __FILE__, __LINE__);
// "Explode" all receivers into an array
$RECEIVERS = array($DATA['receivers']);
} else {
// No users left
- $RECEIVERS = array("0");
+ $RECEIVERS = array('0');
}
$dummy = $RECEIVERS;
// We can now send mails to them...
foreach ($RECEIVERS as $key => $uid) {
// Load personal data
- //* DEBUG: */ echo "*L:".__LINE__."/".$uid."*<br />";
+ //* DEBUG: */ echo "*L:".__LINE__.'/'.$uid."*<br />";
$result_user = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
array(bigintval($uid)), __FILE__, __LINE__);
//* DEBUG: */ echo "OK!/L:".__LINE__."<br />";
// Mark this user as "spammed" ;-) And place a line for him...
- if (REMOVE_RECEIVER($dummy, $key, $uid, $DATA['id'], $DATA['id'], true) == "done") {
+ if (removeReceiver($dummy, $key, $uid, $DATA['id'], $DATA['id'], true) == 'done') {
// Replace text variables
foreach ($GLOBALS['replacer'] as $key => $value) {
if (isset($DATA[$key])) $DATA['text'] = str_replace($value, $DATA[$key], $DATA['text']);
$content = array(
'id' => $DATA['id'],
'url' => $DATA['url'],
- 'time' => CREATE_FANCY_TIME($DATA['time']),
- 'points' => TRANSLATE_COMMA($DATA['points']),
- 'category' => GET_CATEGORY($DATA['cat_id']),
+ 'time' => createFancyTime($DATA['time']),
+ 'points' => translateComma($DATA['points']),
+ 'category' => getCategory($DATA['cat_id']),
'text' => $DATA['text']
);
// Send mail away
if (isset($DATA['html_msg'])) {
// Send HTML?
- SEND_EMAIL($email, $DATA['subject'], $mailText, $DATA['html_msg']);
+ sendEmail($email, $DATA['subject'], $mailText, $DATA['html_msg']);
} else {
// No HTML mail!
- SEND_EMAIL($email, $DATA['subject'], $mailText);
+ sendEmail($email, $DATA['subject'], $mailText);
}
// Count one up and remove entry from dummy array
} // END - if
// Do we have send maximum mails?
- if (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || (SELECTION_COUNT($dummy) == 0)) {
+ if (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || (countSelection($dummy) == 0)) {
// Yes, we have
//* DEBUG: */ echo "*EXIT/L:".__LINE__."<br />";
break;
// Update entry (or add missing
$P = $GLOBALS['pool_cnt'];
if (!empty($cnt2) && empty($GLOBALS['pool_cnt'])) $P = $cnt2;
- //* DEBUG: */ echo "+MEDIA/L:".__LINE__."/".$P."+<br />";
+ //* DEBUG: */ echo "+MEDIA/L:".__LINE__.'/'.$P."+<br />";
MEDIA_UPDATE_ENTRY(array("total_send", "bonus_send"), 'add', $P);
} // END - if
// Close sending system
- //* DEBUG: */ echo "-L:".__LINE__."/".SELECTION_COUNT($dummy)."-<br />";
- if (SELECTION_COUNT($dummy) == 0) {
+ //* DEBUG: */ echo "-L:".__LINE__.'/'.countSelection($dummy)."-<br />";
+ if (countSelection($dummy) == 0) {
// Queue reached!
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='SEND', target_send='0', receivers='' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET `data_type`='SEND', `target_send`=0, `receivers`='' WHERE `id`=%s LIMIT 1",
array(bigintval($DATA['id'])), __FILE__, __LINE__);
//* DEBUG: */ echo "*L:".__LINE__."*<br />";
} // END - if
} elseif ($GLOBALS['pool_cnt'] >= getConfig('max_send')) {
// Update bonus pool
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='NEW', target_send=%s, receivers='%s' WHERE id=%s LIMIT 1",
- array(SELECTION_COUNT($dummy), implode(';', $dummy), bigintval($DATA['id'])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET `data_type`='NEW', `target_send`=%s, `receivers`='%s' WHERE `id`=%s LIMIT 1",
+ array(countSelection($dummy), implode(';', $dummy), bigintval($DATA['id'])), __FILE__, __LINE__);
//* DEBUG: */ echo "*L:".__LINE__."<pre>";
//* DEBUG: */ print_r($dummy);
//* DEBUG: */ echo "</pre>\n!!!<br />";
}
// Reset variables
-$cnt2 = 0; $lastSentId = 0; $cnt_back = array("0"); $pointsBack = array("0");
+$cnt2 = 0; $lastSentId = 0; $cnt_back = array('0'); $pointsBack = array('0');
if (SQL_NUMROWS($result_main) > 0) {
// Parse all mails
while ($DATA = SQL_FETCHROW($result_main)) {
// Set mail order as 'active'. That means it will be sent out
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='ACTIVE' WHERE id=%s AND data_type='NEW' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='ACTIVE' WHERE `id`=%s AND data_type='NEW' LIMIT 1",
array($DATA[0]), __FILE__, __LINE__);
// Check fetched data for HTML
- $HTML = $DATA[10]; if ($HTML == $DATA[0]) $HTML = "N";
+ $HTML = $DATA[10]; if ($HTML == $DATA[0]) $HTML = 'N';
// Compile URL and subject line
$DATA[7] = COMPILE_CODE($DATA[7]);
$RECEIVERS = array($DATA[4]);
} else {
// No users left
- $RECEIVERS = array("0");
+ $RECEIVERS = array('0');
}
$dummy = $RECEIVERS;
array(bigintval($uid)), __FILE__, __LINE__);
// Is his data available?
- //* DEBUG: */ echo "*L:".__LINE__."/".SQL_NUMROWS($result_user)."*<br />";
+ //* DEBUG: */ echo "*L:".__LINE__.'/'.SQL_NUMROWS($result_user)."*<br />";
if (SQL_NUMROWS($result_user) == 1) {
// The final receiver does exists so we can continue...
list($gender, $sname, $fname, $email) = SQL_FETCHROW($result_user);
SQL_FREERESULT($result_user);
// Do we have a stats entry?
- $result_stats = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s AND userid=%s AND timestamp_ordered='%s' LIMIT 1",
+ $result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
array($DATA[0], $DATA[1], $DATA[6]), __FILE__, __LINE__);
// If there's no stats entry add it!
- //* DEBUG: */ echo "!L:".__LINE__."/".SQL_NUMROWS($result_stats)."!<br />";
+ //* DEBUG: */ echo "!L:".__LINE__.'/'.SQL_NUMROWS($result_stats)."!<br />";
if (SQL_NUMROWS($result_stats) == 0) {
// No entry was found, so we add him!
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_stats` (pool_id , userid, cat_id, payment_id, subject, url , max_rec , timestamp_ordered, timestamp_sstart) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s' , UNIX_TIMESTAMP())",
array(bigintval($DATA[0]), bigintval($DATA[1]), bigintval($DATA[9]), bigintval($DATA[5]), $DATA[2], $DATA[7], $DATA[8], bigintval($DATA[6])), __FILE__, __LINE__);
// Receive it's ID for the links table
- $result_stats = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s AND userid=%s AND timestamp_ordered='%s' LIMIT 1",
+ $result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
array(bigintval($DATA[0]), bigintval($DATA[1]), bigintval($DATA[6])), __FILE__, __LINE__);
} // END - if
- //* DEBUG: */ echo "!L:".__LINE__."/".SQL_NUMROWS($result_stats)."!<br />";
+ //* DEBUG: */ echo "!L:".__LINE__.'/'.SQL_NUMROWS($result_stats)."!<br />";
if (SQL_NUMROWS($result_stats) == 1) {
// We got one!
list($stats_id) = SQL_FETCHROW($result_stats);
// Mark this user as "spammed" ;-) And place a line for him...
- //* DEBUG: */ echo "?L:".__LINE__."/".$dummy."/".$key."/".$uid."(".$DATA[1].")/".$DATA[0]."/".$stats_id."?<br />";
- switch (REMOVE_RECEIVER($dummy, $key, bigintval($uid), bigintval($DATA[0]), bigintval($stats_id)))
+ //* DEBUG: */ echo "?L:".__LINE__.'/'.$dummy.'/'.$key.'/'.$uid."(".$DATA[1].")/".$DATA[0].'/'.$stats_id."?<br />";
+ switch (removeReceiver($dummy, $key, bigintval($uid), bigintval($DATA[0]), bigintval($stats_id)))
{
- case "done":
+ case 'done':
// Prepare the mail
$DATA[11] = bigintval($stats_id);
$DATA[12] = $sname;
$DATA[13] = $fname;
- $DATA[14] = TRANSLATE_GENDER($gender);
+ $DATA[14] = translateGender($gender);
// Replace text variables
foreach ($GLOBALS['replacer'] as $key => $value) {
'id' => $DATA[11],
'url' => $DATA[7],
'sender_uid' => $DATA[1],
- 'category' => GET_CATEGORY($DATA[9]),
- 'time' => CREATE_FANCY_TIME(GET_PAY_POINTS($DATA[5], "time")),
- 'points' => TRANSLATE_COMMA(GET_PAY_POINTS($DATA[5], "payment")),
+ 'category' => getCategory($DATA[9]),
+ 'time' => createFancyTime(getPaymentPoints($DATA[5], "time")),
+ 'points' => translateComma(getPaymentPoints($DATA[5], "payment")),
'text' => $DATA[3]
);
$mailText = LOAD_EMAIL_TEMPLATE("normal-mail", $content, bigintval($uid));
// Send mail away
- SEND_EMAIL($email, $DATA[2], $mailText, $HTML);
+ sendEmail($email, $DATA[2], $mailText, $HTML);
// Count sent mails...
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET emails_sent=emails_sent+1 WHERE userid=%s LIMIT 1",
// And count up the mail
$GLOBALS['pool_cnt']++;
- //* DEBUG: */ echo"*EXIT/L:".__LINE__."/".$GLOBALS['pool_cnt']."*<br />";
+ //* DEBUG: */ echo"*EXIT/L:".__LINE__.'/'.$GLOBALS['pool_cnt']."*<br />";
break;
case "already":
// Entry already found, but we still count one up!
$GLOBALS['pool_cnt']++;
- //* DEBUG: */ echo"*EXIT/L:".__LINE__."/".$GLOBALS['pool_cnt']."<br />";
+ //* DEBUG: */ echo"*EXIT/L:".__LINE__.'/'.$GLOBALS['pool_cnt']."<br />";
break;
}
}
// Do we have reached the maximum to send mails? || (getConfig('max_send') >= $GLOBALS['pool_cnt'])
- //* DEBUG: */ echo "*L:".__LINE__."/".$GLOBALS['pool_cnt'].">=".$DATA[8]."/".getConfig('max_send').">=".$GLOBALS['pool_cnt']."/".$lastSentId."!=".$DATA[0]."*<br />";
+ //* DEBUG: */ echo "*L:".__LINE__.'/'.$GLOBALS['pool_cnt'].">=".$DATA[8].'/'.getConfig('max_send').">=".$GLOBALS['pool_cnt'].'/'.$lastSentId."!=".$DATA[0]."*<br />";
if ((($GLOBALS['pool_cnt'] >= $DATA[8])) && ($lastSentId != $DATA[0])) {
// Prepare content
$content = array(
'sender_uid' => $DATA[1],
- 'category' => GET_CATEGORY($DATA[9]),
+ 'category' => getCategory($DATA[9]),
'text' => $DATA[3],
'url' => $DATA[7],
- 'expiration' => CREATE_FANCY_TIME(GET_PAY_POINTS($DATA[5], "time"))
+ 'expiration' => createFancyTime(getPaymentPoints($DATA[5], "time"))
);
// Yes we do, so we notify admin and sender about fully sent mail!
- SEND_ADMIN_NOTIFICATION(ADMIN_SUBJ_SEND_DONE, "done-admin", $content, $uid);
+ sendAdminNotification(ADMIN_SUBJ_SEND_DONE, "done-admin", $content, $uid);
// Get sender's data
$result_sender = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
$mailText = LOAD_EMAIL_TEMPLATE("done-member", $content, $DATA[1]);
// Send it also waway
- SEND_EMAIL($email, MEMBER_SUBJ_SEND_DONE, $mailText);
+ sendEmail($email, MEMBER_SUBJ_SEND_DONE, $mailText);
} // END - if
// Free result
SQL_FREERESULT($result_sender);
// Set status to SEND because we completely send it away
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='SEND', target_send='0', receivers='' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='SEND', `target_send`=0, `receivers`='' WHERE `id`=%s LIMIT 1",
array(bigintval($DATA[0])), __FILE__, __LINE__);
// Update send-completed-time
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET timestamp_send=UNIX_TIMESTAMP() WHERE pool_id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET `timestamp_send`=UNIX_TIMESTAMP() WHERE `pool_id`=%s LIMIT 1",
array(bigintval($DATA[0])), __FILE__, __LINE__);
$lastSentId = $DATA[0]; $GLOBALS['pool_cnt'] = 0;
MEDIA_UPDATE_ENTRY(array("total_orders", "normal_orders"), 'add', 1);
} // END - if
- //* DEBUG: */ echo"*EXIT/L:".__LINE__."/".$P."<br />";
+ //* DEBUG: */ echo"*EXIT/L:".__LINE__.'/'.$P."<br />";
break;
}
// Do we have send maximum mails?
// There are some mails left to send for next round, so we reset the status back to NEW (=still not fully delivered)
$add = '';
if ($GLOBALS['pool_cnt'] <= $DATA[8]) $add = ", target_send=target_send-".$GLOBALS['pool_cnt'];
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='NEW', receivers='%s'".$add." WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='NEW', receivers='%s'".$add." WHERE `id`=%s LIMIT 1",
array(implode(';', $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
//* DEBUG: */ echo"*EXIT/L:".__LINE__."*<br />";
SQL_FREERESULT($result_stats);
} else {
// User does not exists so we have add the sender's points back to sender's account
- if (($RECEIVERS[0] == "0") || (empty($RECEIVERS[0]))) {
+ if (($RECEIVERS[0] == '0') || (empty($RECEIVERS[0]))) {
// List was empty
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='SEND' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='SEND' WHERE `id`=%s LIMIT 1",
array(bigintval($DATA[0])), __FILE__, __LINE__);
} else {
// Is the userid set?
if ($uid > 0) {
// User does not exists, pay points back
- $points = GET_PAY_POINTS($DATA[5]);
- ADD_POINTS_REFSYSTEM("pool_payback", $DATA[1], $points, false, "0", false, "direct");
+ $points = getPaymentPoints($DATA[5]);
+ ADD_POINTS_REFSYSTEM_DIRECT('pool_payback', $DATA[1], $points);
// Add points together and remove user
$pointsBack[$DATA[1]] += $points;
unset($dummy[$key]);
// Update receivers
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET receivers='%s' WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET receivers='%s' WHERE `id`=%s LIMIT 1",
array(implode(';', $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
}
}
if (($PB > 0) && ($uid > 0)) {
// Prepare content
$content = array(
- 'points' => TRANSLATE_COMMA($DATA[10])
+ 'points' => translateComma($DATA[10])
);
// We have to pay back some points to the sender (we add them directly :-P)
$mailText = LOAD_EMAIL_TEMPLATE("back-member", $content, bigintval($uid));
// Send mail out to member
- SEND_EMAIL($email, MEMBER_BACK_JACKPOT." (".$uid.")", $mailText);
+ sendEmail($email, getMessage('MEMBER_BACK_JACKPOT')." (".$uid.")", $mailText);
} else {
// Add to jackpot
ADD_JACKPOT($PB);
// Send mail out to admin
- SEND_ADMIN_NOTIFICATION(ADMIN_BACK_JACKPOT." (".$uid.")", "back-admin", $content, 'admin');
+ sendAdminNotification(getMessage('ADMIN_BACK_JACKPOT')." (".$uid.")", "back-admin", $content, 'admin');
}
} // END - if
} // END - foreach
(last_update < (UNIX_TIMESTAMP() - %s) AND last_update != 0 AND last_profile_sent < (UNIX_TIMESTAMP() - %s))
OR
(last_update=0 AND last_profile_sent=0 AND joined < (UNIX_TIMESTAMP() - %s))
-ORDER BY userid", array(getConfig('profile_update'), getConfig('resend_profile_update'), getConfig('profile_update')), __FILE__, __LINE__);
+ORDER BY `userid` ASC", array(getConfig('profile_update'), getConfig('resend_profile_update'), getConfig('profile_update')), __FILE__, __LINE__);
// Do we have some notifications to sent?
if (SQL_NUMROWS($result) > 0) {
// We need to send-out notifications...
while ($content = SQL_FETCHARRAY($result)) {
// Translate timestamp
- $content['joined'] = MAKE_DATETIME($content['joined'], "0");
+ $content['joined'] = generateDateTime($content['joined'], '0');
- if (round($content['last_update']) == "0") {
+ if (round($content['last_update']) == '0') {
// Has never changed his accont
$content['last_update'] = getMessage('PROFILE_NEVER_CHANGED');
} else {
// Has changed his account
- $content['last_update'] = MAKE_DATETIME($content['last_update'], "0");
+ $content['last_update'] = generateDateTime($content['last_update'], '0');
}
// Load email template and send mail away
$msg = LOAD_EMAIL_TEMPLATE("profile-updte", '', bigintval($content['userid']));
- SEND_EMAIL($content['email'], getMessage('PROFILE_OUTDATED'), $msg);
+ sendEmail($content['email'], getMessage('PROFILE_OUTDATED'), $msg);
// Update profile data
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET last_profile_sent=UNIX_TIMESTAMP(), notified='Y' WHERE userid=%s LIMIT 1",
}
// Checks if an element in $_GET exists
-function REQUEST_ISSET_GET ($element, $subElement="") {
+function REQUEST_ISSET_GET ($element, $subElement = '') {
if (empty($subElement)) {
return ((isset($_GET[$element])) && (!empty($_GET[$element])));
} else {
}
// Transfer points from locked_points to points
-$result_daily = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE ref_payout=0 AND `status`='CONFIRMED' ORDER BY userid", __FILE__, __LINE__);
+$result_daily = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE ref_payout=0 AND `status`='CONFIRMED' ORDER BY `userid` ASC", __FILE__, __LINE__);
//* DEBUG: */ echo basename(__FILE__).":payout=0;daily|numRows=".SQL_NUMROWS($result_daily)."<br />\n";
if (SQL_NUMROWS($result_daily) > 0) {
// Prepare all data for the template
$content = array(
- 'activated' => MAKE_DATETIME($content['holiday_activated'], "1"),
- 'start' => MAKE_DATETIME($content['holiday_start'] , "1"),
- 'end' => MAKE_DATETIME($content['holiday_end'] , "1")
+ 'activated' => generateDateTime($content['holiday_activated'], "1"),
+ 'start' => generateDateTime($content['holiday_start'] , "1"),
+ 'end' => generateDateTime($content['holiday_end'] , "1")
);
// Send email to user
$msg = LOAD_EMAIL_TEMPLATE("member_holiday_activated", $content, $content['userid']);
- SEND_EMAIL($content['userid'], getMessage('HOLIDAY_MEMBER_ACTIVATED_SUBJ'), $msg);
+ sendEmail($content['userid'], getMessage('HOLIDAY_MEMBER_ACTIVATED_SUBJ'), $msg);
// Update account
ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Reset surfbar counter
-UPDATE_CONFIG(array("surfbar_daily_counter", "surfbar_yester_counter"), array(0, getConfig('surfbar_daily_counter')));
+updateConfiguration(array("surfbar_daily_counter", "surfbar_yester_counter"), array(0, getConfig('surfbar_daily_counter')));
setConfigEntry('surfbar_yester_counter', getConfig('surfbar_daily_counter'));
setConfigEntry('surfbar_daily_counter' , 0);
if (($GLOBALS['output_mode'] == 1) || (!isResetModeEnabled())) return;
// Simply reset the requests here
-UPDATE_CONFIG("yoomedia_requests_remain", getConfig('yoomedia_requests_total'));
+updateConfiguration('yoomedia_requests_remain', getConfig('yoomedia_requests_total'));
//
?>
<tr><td height=\"10\"></td></tr>
<tr>
<td align=\"center\">
- <strong>".GET_REMOTE_ADDR()."</strong>
+ <strong>".detectRemoteAddr()."</strong>
</td>
</tr>
</table>
}
// Unset/set session variables
-function set_session ($var, $value) {
+function setSession ($var, $value) {
// Abort in CSS mode here
if ($GLOBALS['output_mode'] == 1) return true;
$var = trim(SQL_ESCAPE($var)); $value = trim($value);
// Is the session variable set?
- if (("".$value."" == "") && (isSessionVariableSet($var))) {
+ if (("".$value."" == '') && (isSessionVariableSet($var))) {
// Remove the session
- //* DEBUG: */ echo "UNSET:".$var."=".get_session($var)."<br />\n";
+ //* DEBUG: */ echo "UNSET:".$var.'='.getSession($var)."<br />\n";
unset($_SESSION[$var]);
return session_unregister($var);
} elseif (("".$value."" != '') && (!isSessionVariableSet($var))) {
// Set session
- //* DEBUG: */ echo "SET:".$var."=".$value."<br />\n";
+ //* DEBUG: */ echo "SET:".$var.'='.$value."<br />\n";
$_SESSION[$var] = $value;
return session_register($var);
} elseif (!empty($value)) {
// Update session
- //* DEBUG: */ echo "UPDATE:".$var."=".$value."<br />\n";
+ //* DEBUG: */ echo "UPDATE:".$var.'='.$value."<br />\n";
$_SESSION[$var] = $value;
return true;
}
// Ignored (but valid)
- //* DEBUG: */ echo "IGNORED:".$var."=".$value."<br />\n";
+ //* DEBUG: */ echo "IGNORED:".$var.'='.$value."<br />\n";
return true;
}
}
// Returns wether the value of the session variable or NULL if not set
-function get_session ($var) {
+function getSession ($var) {
// Default is not found! ;-)
$value = null;
}
// Destroy user session
-function destroy_user_session () {
+function destroyUserSession () {
// Reset userid
setUserId(0);
// Remove all user data from session
- return ((set_session('userid', '')) && (set_session('u_hash', '')));
+ return ((setSession('userid', '')) && (setSession('u_hash', '')));
}
// Destroys the admin session
function destroyAdminSession ($destroy = true) {
// Kill maybe existing session variables including array elements
- set_session('admin_login', '');
- set_session('admin_md5' , '');
- set_session('admin_last' , '');
- set_session('admin_to' , '');
+ setSession('admin_login', '');
+ setSession('admin_md5' , '');
+ setSession('admin_last' , '');
+ setSession('admin_to' , '');
// Destroy session and return status
if ($destroy) {
}
// Set session save path if set
-if (getConfig('session_save_path') != "") {
+if (getConfig('session_save_path') != '') {
// Please make sure this valid!
session_save_path(getConfig('session_save_path'));
} // END - if
session_start();
// Load language system
-LOAD_INC_ONCE("inc/language.php");
+loadIncludeOnce('inc/language.php');
// Load extensions here
-LOAD_INC_ONCE("inc/load_extensions.php");
+loadIncludeOnce('inc/load_extensions.php');
// Determine and set referal id
DETERMINE_REFID();
// Is it valid?
if (!IS_MEMBER()) {
// Then destroy the user id
- destroy_user_session();
+ destroyUserSession();
// Kill userid
setUserId(0);
}
} // END - if
-//* DEBUG: */ print("<pre>".print_r($_SESSION, true)."</pre>");
+//* DEBUG: */ print('<pre>'.print_r($_SESSION, true).'</pre>');
//
?>
$result_bonus = SQL_QUERY("SELECT id, userid, subject, timestamp_ordered, clicks, url
FROM `{!_MYSQL_PREFIX!}_user_stats`
WHERE max_rec=clicks AND clicks>0 AND bonus_stats_active='N'
-ORDER BY userid", __FILE__, __LINE__);
+ORDER BY `userid` ASC", __FILE__, __LINE__);
if (SQL_NUMROWS($result_bonus) > 0) {
// Remember stats bonus in constant
- define('__STATS_BONUS', TRANSLATE_COMMA(getConfig('bonus_stats')));
+ define('__STATS_BONUS', translateComma(getConfig('bonus_stats')));
// We found some mail orders...
while ($content = SQL_FETCHARRAY($result_bonus)) {
array(getConfig('bonus_stats'), bigintval($content['userid'])), __FILE__, __LINE__);
// Translate some data
- $content['timestamp'] MAKE_DATETIME($content['timestamp_ordered'], "2");
+ $content['timestamp'] generateDateTime($content['timestamp_ordered'], "2");
// Load email template and send email
$msg = LOAD_EMAIL_TEMPLATE("member_stats_bonus", $content, bigintval($content['userid']));
- SEND_EMAIL($content['userid'], getMessage('BONUS_MEMBER_STATS_SUBJECT'), $msg);
+ sendEmail($content['userid'], getMessage('BONUS_MEMBER_STATS_SUBJECT'), $msg);
// Update database
- $result_update = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET bonus_stats_active='Y' WHERE id=%s LIMIT 1",
+ $result_update = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET bonus_stats_active='Y' WHERE `id`=%s LIMIT 1",
array(bigintval($content['id'])), __FILE__, __LINE__);
} // END - while
// Output inclusion lines
foreach ($STYLES as $value) {
// Only include found CSS files (to reduce 404 requests)
- $basePath = sprintf("%stheme/%s/css/", constant('PATH'), GET_CURR_THEME());
+ $basePath = sprintf("%stheme/%s/css/", constant('PATH'), getCurrentTheme());
$FQFN = $basePath . $value;
// Do include only existing files and whose are not empty
- if ((FILE_READABLE($FQFN)) && (filesize($FQFN) > 0)) {
+ if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
switch (getConfig('css_php')) {
case 'DIRECT':
- OUTPUT_HTML('<link rel="stylesheet" type="text/css" href="{!URL!}/theme/' . GET_CURR_THEME() . '/' . $value . '" />');
+ OUTPUT_HTML('<link rel="stylesheet" type="text/css" href="{!URL!}/theme/' . getCurrentTheme() . '/' . $value . '" />');
break;
case 'FILE':
- OUTPUT_HTML(READ_FILE($FQFN));
+ OUTPUT_HTML(readFromFile($FQFN));
break;
} // END - switch
} // END - if
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Reset the surfbar counter
-UPDATE_CONFIG("surfbar_weekly_counter", "0");
+updateConfiguration('surfbar_weekly_counter', '0');
//
?>
// Is the script installed?
if (isInstalled()) {
// Header
- LOAD_INC('inc/header.php');
+ loadInclude('inc/header.php');
// Fix missing array elements here
if (!isConfigEntrySet('index_delay')) setConfigEntry('index_delay' , 0);
// Is the index page configured for redirect pr not?
if (getConfig('index_cookie') > 0) {
// Set cookie and remeber it for specified time
- set_session('visited', 'true');
+ setSession('visited', 'true');
} elseif (isSessionVariableSet('visited')) {
// Remove cookie when admin set 0 in setup
- set_session('visited', '');
+ setSession('visited', '');
}
// Template laden
- LOAD_TEMPLATE('index', false, ADD_URL_DATA(''));
+ LOAD_TEMPLATE('index', false, addUrlData(''));
// Shall I insert an automated forward?
if (getConfig('index_delay') > 0) {
// This will be a JavaScript-redirect!
define('__DELAY_VALUE', (getConfig('index_delay') * 1000 + 500));
- define('__MOD_VALUE' , ADD_URL_DATA('index'));
+ define('__MOD_VALUE' , addUrlData('index'));
LOAD_TEMPLATE('index_forward');
} // END - if
} else {
// Redirect to main page
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
}
// Footer
- LOAD_INC('inc/footer.php');
+ loadInclude('inc/footer.php');
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// All done here...
require('inc/config.php');
// Header
-LOAD_INC('inc/header.php');
+loadInclude('inc/header.php');
// Reload page to page=welcome when it is not specified
if (!REQUEST_ISSET_GET('page')) {
- LOAD_URL('install.php?page=welcome');
+ redirectToUrl('install.php?page=welcome');
} // END - if
// Already installed?
LOAD_TEMPLATE('install_header');
// Here start's our installtion stuff
- LOAD_INC_ONCE('inc/install-inc.php');
+ loadIncludeOnce('inc/install-inc.php');
// Close main installation table
LOAD_TEMPLATE('install_footer');
}
// Footer
-LOAD_INC('inc/footer.php');
+loadInclude('inc/footer.php');
//
?>
header('Content-type: text/javascript');
// Load header
- LOAD_INC_ONCE('inc/header.php');
+ loadIncludeOnce('inc/header.php');
// Prepare include file for looking
$INC = sprintf("inc/js/tag-%s.php",
);
// Is that file readable?
- if (INCLUDE_READABLE($INC)) {
+ if (isIncludeReadable($INC)) {
// Include it
- LOAD_INC_ONCE($INC);
+ loadIncludeOnce($INC);
} // END - if
// Load footer
- LOAD_INC_ONCE('inc/footer.php');
+ loadIncludeOnce('inc/footer.php');
} // END - if
// Shutdown
// Is the script installed?
if (isInstalled()) {
// Header
- LOAD_INC('inc/header.php');
+ loadInclude('inc/header.php');
// Initialize the array for the template
$content = array(
if (isSessionVariableSet('lead_uid')) {
// Is the user-account unlocked and valid?
$result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
- array(bigintval(get_session('lead_uid'))), __FILE__, __LINE__);
+ array(bigintval(getSession('lead_uid'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Secure the ID number
- $content['lead_uid'] = bigintval(get_session('lead_uid'));
+ $content['lead_uid'] = bigintval(getSession('lead_uid'));
// Load the email address
list($email) = SQL_FETCHROW($result);
LOAD_TEMPLATE('lead_code', false, $content);
// Footer
- LOAD_INC('inc/footer.php');
+ loadInclude('inc/footer.php');
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// All done here...
// Is this a member?
if (IS_MEMBER()) {
// Then redirect into login area
- LOAD_URL('modules.php?module=login');
+ redirectToUrl('modules.php?module=login');
} else {
// Guests will be redirected to login form
- LOAD_URL('modules.php?module=index&what=login');
+ redirectToUrl('modules.php?module=index&what=login');
}
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
// Maybe he wants to confirm an email?
if ($url_mid > 0) {
// Normal-Mails
- $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND `userid`=%s LIMIT 1",
array($url_mid, $url_uid), __FILE__, __LINE__);
$type = 'mailid'; $urlId = $url_mid;
} elseif ($url_bid > 0) {
// Bonus-Mail
- $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND `userid`=%s LIMIT 1",
array($url_bid, $url_uid), __FILE__, __LINE__);
$type = 'bonusid'; $urlId = $url_bid;
} else {
// Problem: No ID entered
- LOAD_URL('index.php');
+ redirectToUrl('index.php');
}
if (SQL_NUMROWS($result) == 1) {
{
case 'NORMAL':
// Is the stats ID valid?
- $result = SQL_QUERY_ESC("SELECT pool_id, url, subject FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT pool_id, url, subject FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1",
array($url_mid), __FILE__, __LINE__);
break;
REDIRECT_ON_UNINSTALLED_EXTENSION('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($url_bid), __FILE__, __LINE__);
break;
}
array(bigintval($pool)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
list($pay) = SQL_FETCHROW($result);
- $time = GET_PAY_POINTS($pay, 'time');
- $payment = GET_PAY_POINTS($pay, 'payment');
+ $time = getPaymentPoints($pay, 'time');
+ $payment = getPaymentPoints($pay, 'payment');
$isValid = true;
}
break;
case 'BONUS':
- $result = SQL_QUERY_ESC("SELECT points, time FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT points, time FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
array($url_bid), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
list($points, $time) = SQL_FETCHROW($result);
}
// Add header
- LOAD_INC_ONCE('inc/header.php');
+ loadIncludeOnce('inc/header.php');
// Was that mail a valid one?
if ($isValid === true) {
if (!empty($msg)) {
switch (getConfig('mailid_error_redirect')) {
case 'INDEX': // Redirect to index page
- LOAD_URL('modules.php?module=index&msg='.$msg.'&ext=mailid');
+ redirectToUrl('modules.php?module=index&msg='.$msg.'&ext=mailid');
break;
case 'REJECT': // Redirect to rejection page
default:
DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown status %s detected in mailid_error_redirect.", getConfig('mailid_error_redirect')));
- LOAD_URL('modules.php?module=index&msg=' . getCode('UNKNOWN_STATUS') . '&ext=mailid');
+ redirectToUrl('modules.php?module=index&msg=' . getCode('UNKNOWN_STATUS') . '&ext=mailid');
break;
}
} else {
// Include footer
- LOAD_INC_ONCE('inc/footer.php');
+ loadIncludeOnce('inc/footer.php');
}
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Shutdown
// 01 1 12 2 2 21 1 22 10
if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors() == 0)) {
// No image? Then output header
- if ($mode != 'img') LOAD_INC_ONCE('inc/header.php');
+ if ($mode != 'img') loadIncludeOnce('inc/header.php');
// Maybe he wants to confirm an email?
if ($url_mid > 0) {
- $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND `userid`=%s LIMIT 1",
array($url_mid, $url_uid), __FILE__, __LINE__);
$type = 'mailid'; $urlId = $url_mid;
} elseif ($url_bid > 0) {
- $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND `userid`=%s LIMIT 1",
array($url_bid, $url_uid), __FILE__, __LINE__);
$type = 'bonusid'; $urlId = $url_bid;
}
switch ($ltype)
{
case 'NORMAL':
- $result_mailid = SQL_QUERY_ESC("SELECT pool_id, userid, id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE id=%s LIMIT 1",
+ $result_mailid = SQL_QUERY_ESC("SELECT pool_id, userid, id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1",
array($url_mid), __FILE__, __LINE__);
break;
case 'BONUS':
- $result_mailid = SQL_QUERY_ESC("SELECT id, id, is_notify FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id=%s LIMIT 1",
+ $result_mailid = SQL_QUERY_ESC("SELECT id, id, is_notify FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
array($url_bid), __FILE__, __LINE__);
break;
}
// Entry found?
if (SQL_NUMROWS($result) == 1) {
list($pay) = SQL_FETCHROW($result);
- $time = GET_PAY_POINTS($pay, 'time');
- $payment = GET_PAY_POINTS($pay, 'payment');
+ $time = getPaymentPoints($pay, 'time');
+ $payment = getPaymentPoints($pay, 'payment');
$isValid = true;
} // END - if
break;
case 'BONUS':
- $result = SQL_QUERY_ESC("SELECT time, points FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT time, points FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
array(bigintval($pool)), __FILE__, __LINE__);
// Entry found?
switch ($ltype)
{
case 'NORMAL':
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET clicks=clicks + 1 WHERE `id`=%s LIMIT 1",
array($url_mid), __FILE__, __LINE__);
// Update mediadata as well
break;
case 'BONUS':
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET clicks=clicks + 1 WHERE `id`=%s LIMIT 1",
array($url_bid), __FILE__, __LINE__);
// Update mediadata as well
}
// Export data into constants for the template
- define('_POINTS_VALUE' , TRANSLATE_COMMA($payment));
+ define('_POINTS_VALUE' , translateComma($payment));
define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true));
// Only when user extension = v0.1.2: Update mails-confirmed counter
} // END - if
// Insert stats record
- USER_STATS_INSERT_RECORD($url_uid, $type, $stats_data);
+ insertUserStatsRecord($url_uid, $type, $stats_data);
// Right code entered?
if (bigintval(REQUEST_POST('gfx_check')) == $img_code) {
if ($locked) $template = 'mailid_points_locked2';
define('_UID_VALUE' , $url_uid);
define('_TYPE_VALUE', $type);
- define('_DATA_VALUE', TRANSLATE_COMMA($urlId));
+ define('_DATA_VALUE', translateComma($urlId));
} // END - if
} // END - if
} // END - if
// Load total points
- define('__TOTAL_POINTS', TRANSLATE_COMMA(
+ define('__TOTAL_POINTS', translateComma(
GET_TOTAL_DATA($url_uid, 'user_points', 'points') -
GET_TOTAL_DATA($url_uid, 'user_data', 'used_points'))
);
} else {
// Wrong image code! So add points to sender's account
unset($GLOBALS['ref_level']);
- ADD_POINTS_REFSYSTEM('mailid_payback', $sender, $payment, false, 0, false, 'direct');
+ ADD_POINTS_REFSYSTEM_DIRECT('mailid_payback', $sender, $payment);
// Load template
LOAD_TEMPLATE('mailid_points_failed');
}
// Remove link from table
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `id`=%s LIMIT 1",
array(bigintval($lid)), __FILE__, __LINE__);
break;
define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true));
if (getConfig('code_length') > 0) {
// Generate Code
- define('_IMAGE_CODE', IMG_CODE($code, $type, $urlId, $url_uid));
+ define('_IMAGE_CODE', generateCaptchaCode($code, $type, $urlId, $url_uid));
$templ = 'mailid_enter_code';
} else {
// Disabled code
// Insert footer if no image
if ($mode != 'img') {
// Write footer
- LOAD_INC_ONCE('inc/footer.php');
+ loadIncludeOnce('inc/footer.php');
} // END - if
}
} elseif ($mode != 'img') {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
$username = '<em>{--_UNKNOWN--}</em>';
// Destroy session
- destroy_user_session();
+ destroyUserSession();
// Kill userid
setUserId(0);
}
// The header file
-LOAD_INC_ONCE('inc/header.php');
+loadIncludeOnce('inc/header.php');
// Modules are by default not valid!
$MOD_VALID = false; $check = 'failed';
case 'mem_only':
case 'done':
// Does the module exists on local file system?
- if ((FILE_READABLE(constant('__MODULE'))) && (getTotalFatalErrors() == 0)) {
+ if ((isFileReadable(constant('__MODULE'))) && (getTotalFatalErrors() == 0)) {
// Module is valid, active and located on the local disc...
$MOD_VALID = true;
} elseif (!empty($URL)) {
// An URL was specified so we load the de-referrer module
- LOAD_URL(DEREFERER($URL));
+ redirectToUrl(DEREFERER($URL));
} elseif (getTotalFatalErrors() == 0) {
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('LANG_MOD_REG_404'), $GLOBALS['module']));
}
break;
case 'locked':
- if (!FILE_READABLE(constant('__MODULE'))) {
+ if (!isFileReadable(constant('__MODULE'))) {
// Module does addionally not exists
addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('LANG_MOD_REG_404'), $GLOBALS['module']));
} // END - if
/////////////////////////////////////////////
//
// Everything is okay so we can load the module
- LOAD_INC_ONCE(constant('__MODULE'));
+ loadIncludeOnce(constant('__MODULE'));
} // END - if
// Next-to-end add the footer
-LOAD_INC_ONCE('inc/footer.php');
+loadIncludeOnce('inc/footer.php');
//
?>
if (empty($ref)) $ref = 0;
// Update session
- set_session('refid', $ref);
+ setSession('refid', $ref);
// We have an refid here. So we simply add it
$URL .= bigintval($ref);
}
// Load the URL
- LOAD_URL($URL);
+ redirectToUrl($URL);
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
// List only rankings when script is installed
if (isInstalled()) {
// Include header
- LOAD_INC('inc/header.php');
+ loadInclude('inc/header.php');
if ((REQUEST_GET('uid') > 0) && (REQUEST_GET('d') > 0) && (REQUEST_ISSET_GET(('t')))) {
// Set row name
$content = SQL_FETCHARRAY($result);
// Prepare constants for the pre-template
- define('__GENDER' , TRANSLATE_GENDER($content['gender']));
+ define('__GENDER' , translateGender($content['gender']));
define('__SNAME' , $content['surname']);
define('__FNAME' , $content['family']);
define('__RANK' , BIGINTVAL($content['level']));
- define('__POINTS' , TRANSLATE_COMMA($content['points']));
+ define('__POINTS' , translateComma($content['points']));
define('__MAILID' , bigintval(REQUEST_GET('d')));
define('__RANK_ROWS', BONUS_MAKE_RANK_ROWS(bigintval(REQUEST_GET('d')), $t, bigintval(REQUEST_GET('uid'))));
LOAD_TEMPLATE('show_bonus');
// Include footer
- LOAD_INC('inc/footer.php');
+ loadInclude('inc/footer.php');
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
}
// Load the URL
- LOAD_URL($URL);
+ redirectToUrl($URL);
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
}
// Load the URL
- LOAD_URL($URL);
+ redirectToUrl($URL);
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
if (!IS_MEMBER()) {
// Redirect
// @TODO Display quick login form here or redirect as configured
- LOAD_URL('modules.php?module=index');
+ redirectToUrl('modules.php?module=index');
} // END - if
// Handle tasks on self-maintenance
if ((SURFBAR_CHECK_RELOAD_FULL()) || ((REQUEST_ISSET_GET(('frame'))) && (in_array(REQUEST_GET('frame'), array('stop', 'stop2', 'stats', 'textlinks'))))) {
// Reload-lock is full, surfbar stopped so...
// Load header
- LOAD_INC_ONCE('inc/header.php');
+ loadIncludeOnce('inc/header.php');
// Load template
if (((REQUEST_ISSET_GET(('frame'))) && (REQUEST_GET('frame') == 'stop')) || (!REQUEST_ISSET_GET(('frame')))) {
// Prepare content
$content = array(
- 'points' => TRANSLATE_COMMA($points),
+ 'points' => translateComma($points),
'online' => SURFBAR_DETERMINE_TOTAL_ONLINE(),
'reload' => (getConfig('surfbar_stats_reload') * 1000),
- 'c_total' => TRANSLATE_COMMA(getConfig('surfbar_total_counter')),
- 'c_today' => TRANSLATE_COMMA(getConfig('surfbar_daily_counter')),
- 'c_yester' => TRANSLATE_COMMA(getConfig('surfbar_yester_counter')),
- 'c_week' => TRANSLATE_COMMA(getConfig('surfbar_weekly_counter')),
- 'c_month' => TRANSLATE_COMMA(getConfig('surfbar_monthly_counter')),
+ 'c_total' => translateComma(getConfig('surfbar_total_counter')),
+ 'c_today' => translateComma(getConfig('surfbar_daily_counter')),
+ 'c_yester' => translateComma(getConfig('surfbar_yester_counter')),
+ 'c_week' => translateComma(getConfig('surfbar_weekly_counter')),
+ 'c_month' => translateComma(getConfig('surfbar_monthly_counter')),
);
// Load template for "stats" page
// Load template for stopped surfbar
LOAD_TEMPLATE('surfbar_stopped', false, $content);
}
- } elseif ((REQUEST_ISSET_GET(('check'))) && (REQUEST_ISSET_GET(('id'))) && (REQUEST_ISSET_GET(('salt')))) {
+ } elseif ((REQUEST_ISSET_GET(('check'))) && (REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET(('salt')))) {
// Dummy next id get
SURFBAR_DETERMINE_NEXT_ID(REQUEST_GET('id'));
'id' => $nextId,
'check' => SURFBAR_GENERATE_VALIDATION_CODE($nextId),
'salt' => SURFBAR_GET_SALT(),
- 'reward' => TRANSLATE_COMMA(SURFBAR_GET_REWARD($nextId)),
+ 'reward' => translateComma(SURFBAR_GET_REWARD($nextId)),
'url' => SURFBAR_GET_URL($nextId),
'curr_reload' => SURFBAR_GET_USER_LOCKS(),
'max_urls' => SURFBAR_GET_TOTAL_URLS(),
}
// Load header
- LOAD_INC_ONCE('inc/header.php');
+ loadIncludeOnce('inc/header.php');
// Load that template
//* DEBUG: */ die("templateName={$templateName}<br />\n<strong>content</strong>=<pre>".print_r($content, true)."</pre>");
}
// Load footer
- LOAD_INC_ONCE('inc/footer.php');
+ loadIncludeOnce('inc/footer.php');
} else {
// You have to install first!
- LOAD_URL('install.php');
+ redirectToUrl('install.php');
}
// Really all done here... ;-)
<td align="right">{--ENTER_MAX_VALUE--}:</td>
<td class="seperator" width="10"> </td>
<td><input type="text" name="max" class="admin_normal" size="5"
- maxlength="5" value=""></td>
+ maxlength="5" /></td>
<td class="seperator" width="10"> </td>
</tr>
<tr>
<td align="right">{--ENTER_MAX_COMMENT--}:</td>
<td class="seperator" width="10"> </td>
<td><input type="text" name="comment" class="admin_normal"
- size="10" maxlength="255" value=""></td>
+ size="10" maxlength="255" /></td>
<td class="seperator" width="10"> </td>
</tr>
<tr>
<input type="hidden" name="id[$content[id]]" class="admin_normal" value="1" />
</td>
<td class="switch_sw$content[sw] bottom2 right2">
- <input type="text" name="name[$content[id]]" class="admin_normal" size="16" maxlength="" value="$content[name]" />
+ <input type="text" name="name[$content[id]]" class="admin_normal" size="16" maxlength="255" value="$content[name]" />
</td>
<td class="switch_sw$content[sw] bottom2 right2">
- <input type="text" name="rate[$content[id]]" class="admin_normal" size="19" maxlength="" value="$content[rate]" />
+ <input type="text" name="rate[$content[id]]" class="admin_normal" size="19" maxlength="255" value="$content[rate]" />
</td>
<td class="switch_sw$content[sw] bottom2 right2">
<input type="text" name="min[$content[id]]" class="admin_normal" size="3" maxlength="20" value="$content[min]" />
</td>
<td class="switch_sw$content[sw] bottom2">
- <input type="text" name="curr[$content[id]]" class="admin_normal" size="5" maxlength="" value="$content[curr]" />
+ <input type="text" name="curr[$content[id]]" class="admin_normal" size="5" maxlength="255" value="$content[curr]" />
</td>
</tr>
\ No newline at end of file
<td align="right">{--SELECT_CATEGORY--}:</td>
<td width="10" class="seperator"> </td>
<td><select name="cat" size="1" class="admin_select">
- <option value="" disabled>{--PLEASE_SELECT--}</option>
+ <option value="X" disabled="disabled">{--PLEASE_SELECT--}</option>
<option value="0">{--ALL_MEMBERS--} ({!__ALL_VALUE!})</option>
{!__OPTION_LINES!}
</select></td>
<td align="right" style="padding-right:5px">{--SELECT_CATEGORY--}:</td>
<td>
<select name="cat" size="1" class="admin_select">
- <option value="" disabled>{--PLEASE_SELECT--}</option>
+ <option value="X" disabled="disabled">{--PLEASE_SELECT--}</option>
<option value="0">{--ALL_MEMBERS--} ($content[all])</option>
$content[categories]
</select>
<div>Gelinkte Seiten, die sich ausserhalb von {!URL!} befinden,
mache ich mich nicht mit verantwortlich und distanziere mich hiermit
ausdrücklich von diesen und deren Inhalten! Bitte beachte den <a
- href="" target="_blank">Disclaimer</a>!<br />
+ href="#" target="_blank">Disclaimer</a>!<br />
</div></td>
</tr>
</table>
\ No newline at end of file
<td align="right">{--SELECT_MAIL_TYPE--}:</td>
<td width="10" class="seperator"> </td>
<td><select name="type" size="1" class="member_select">
- <option value="" disabled>{--PLEASE_SELECT--}</option>
+ <option value="X" disabled="disabled">{--PLEASE_SELECT--}</option>
{--TYPE_SELECTION--}
</select></td>
<td width="10" class="seperator"> </td>
<td align="right">{--SELECT_CATEGORY--}:</td>
<td width="10" class="seperator"> </td>
<td><select name="cat" size="1" class="member_select">
- <option value="" disabled>{--PLEASE_SELECT--}</option>
+ <option value="X" disabled="disabled">{--PLEASE_SELECT--}</option>
{!CATEGORY_SELECTION!}
</select></td>
<td width="10" class="seperator"> </td>
<td align="center" class="left2 right2">
<div align="left"><pre style="margin-bottom: 5px">Ich habe eine Frage zu folgendem:</pre></div>
<select name="qsummary" size="1" class="member_select">
- <option value="" disabled>- - - Bitte auswählen! - - -</option>
+ <option value="X" disabled="disabled">- - - Bitte auswählen! - - -</option>
<option value="ordr">Alles rund um die Mailbuchung</option>
<option value="unconfirmed">Nicht bestätigte Mails</option>
<option value="reflink">Referal-Link (und Werbebanner)</option>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="10" class="seperator"> </td>
- <td class="member_content">{--LAST_ONLINE--}: <strong>{!_LAST_ONLINE_VALUE!}</strong><br />
- {--LAST_MODULE--}: <strong>{!_LAST_MODULE_VALUE!}</strong></td>
+ <td class="member_content">
+ {--LAST_ONLINE--}: <strong>$content[last_online]</strong><br />
+ {--LAST_MODULE--}: <strong>$content[last_module]</strong>
+ </td>
</tr>
<tr>
<td colspan="2" height="7" class="seperator"> </td>
-<NOSCRIPT>{--LOAD_URL_ERROR_1--}<a href="$content" rel="external" title="$content">$content</a>{--LOAD_URL_ERROR_2--}</NOSCRIPT>
-<SCRIPT language="JavaScript" type="text/javascript">
+<noscript>{--LOAD_URL_ERROR_1--}<a href="$content" rel="external" title="$content">$content</a>{--LOAD_URL_ERROR_2--}</noscript>
+<script language="JavaScript" type="text/javascript">
<!--
document.location.href='$content';
//-->
-</SCRIPT>
+</script>
Es wurde die Erweiterung <strong>$content</strong> in Ihrem {!MT_WORD!}
automatisch deaktiviert, da sie veraltet ist und bald von mxchange.org nicht
mehr unterstützt wird. Bitte schauen Sie in <a
- href="" title="Direktlink zu den Forenankündigungen" target="_blank">den
+ href="http://forum.mxchange.org/forum-6.html" title="Direktlink zu den Forenankündigungen" target="_blank">den
Forenankündigungen</a> nach, ob bereits ein Eintrag zu der deaktivierten
Erweiterung existiert. Dort sollte immer eine Ersatzerweiterung angegeben sein.
if (((REQUEST_ISSET_GET(('user'))) || (REQUEST_ISSET_GET(('reseller')))) && (REQUEST_ISSET_GET(('banner')))) {
// for later things... ;-)
- $result = SQL_QUERY_ESC("SELECT url FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT url FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('banner'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
list($url) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refbanner` SET counter=counter+1 WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refbanner` SET counter=counter+1 WHERE `id`=%s LIMIT 1",
array(bigintval(REQUEST_GET('banner'))), __FILE__, __LINE__);
$type = substr($url, -3);
header ('Content-Type: image/' . $type);
- LOAD_URL($url, false);
+ redirectToUrl($url, false);
} else {
// Free memory
SQL_FREERESULT($result);
}
} else {
// Do nothing for now
- LOAD_URL('index.php');
+ redirectToUrl('index.php');
}
// Shutdown