./inc/config-functions.php:326: // @TODO Call setConfigEntry() somehow
./inc/config-functions.php:354: // @TODO Call setConfigEntry() somehow
./inc/daily/daily_beg.php:52:// @TODO This should be converted in a daily beg rallye
-./inc/daily/daily_birthday.php:99: // @TODO 4 is hard-coded here, should we move it out in config?
+./inc/daily/daily_birthday.php:107: // @TODO 4 is hard-coded here, should we move it out in config?
+./inc/daily/daily_birthday.php:68:// @TODO Rewrite these if() blocks to a filter
./inc/email-functions.php:113: * @TODO Rewrite this to an extension 'smtp'
./inc/email-functions.php:209:// @TODO $rawUserId is currently unused
./inc/expression-functions.php:173:// @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
./inc/filter/forced_filter.php:73: // @TODO This part is unfinished
./inc/filter-functions.php:119: // @TODO Remove this forced removal after a year or so
./inc/filters.php:1380: // @TODO No banner found, output some default banner
-./inc/functions.php:1131: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
-./inc/functions.php:1217: // @TODO Are these convertions still required?
-./inc/functions.php:1238:// @TODO Rewrite this function to use readFromFile() and writeToFile()
-./inc/functions.php:1865: // @TODO Find a way to cache this
-./inc/functions.php:1969: // @TODO This is still very static, rewrite it somehow
-./inc/functions.php:2173: // @TODO Rename column data_type to e.g. mail_status
-./inc/functions.php:2523:// @TODO cacheFiles is not yet supported
+./inc/functions.php:1210: // @TODO Are these convertions still required?
+./inc/functions.php:1231:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./inc/functions.php:1858: // @TODO Find a way to cache this
+./inc/functions.php:1962: // @TODO This is still very static, rewrite it somehow
+./inc/functions.php:2166: // @TODO Rename column data_type to e.g. mail_status
+./inc/functions.php:2516:// @TODO cacheFiles is not yet supported
./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter
./inc/header.php:66:// @TODO Find a way to not use direct module comparison
./inc/install-functions.php:446: // @TODO Comparing with DEFAULT_MAIN_TITLE doesn't work
./inc/language/refback_de.php:51: // @TODO Rewrite these constants to one
./inc/libs/admins_functions.php:537: // @TODO This can be, somehow, rewritten
./inc/libs/bonus_functions.php:115: // @TODO Rewrite this to a filter
-./inc/libs/bonus_functions.php:199: // @TODO Move this HTML to a template
+./inc/libs/bonus_functions.php:201: // @TODO Move this HTML to a template
./inc/libs/doubler_functions.php:130:// @TODO This could be rewritten to a filter
./inc/libs/doubler_functions.php:44:// @TODO Lame description
./inc/libs/doubler_functions.php:96: // @TODO Can't this be moved into EL?
./inc/libs/surfbar_functions.php:1696: // @TODO This can be somehow rewritten
./inc/libs/surfbar_functions.php:479: // @TODO if (($urlData['url_views_allowed'] != $urlData['edit']['limit']) || ($url1 != $url2)) {
./inc/libs/surfbar_functions.php:790:// @TODO Can't we use our new expression language instead of this ugly code?
-./inc/libs/task_functions.php:256: // @TODO These can be rewritten to filter
+./inc/libs/task_functions.php:258: // @TODO This can be rewritten to filter
./inc/libs/task_functions.php:51:// @TODO Move all extension-dependent queries into filters
./inc/libs/theme_functions.php:96: // @TODO Can't this be rewritten to an API function?
./inc/libs/user_functions.php:325: // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
./inc/libs/yoomedia_functions.php:108: $response = YOOMEDIA_QUERY_API('out_textmail.php', TRUE); // @TODO Ask Yoo!Media for test script
./inc/load_config.php:75: // @TODO Rewrite them to avoid this else block
./inc/loader/load-extension.php:13: * @TODO Rewrite this whole file *
+./inc/mails/beg_mails.php:84: // @TODO Rewrite these if() blocks to a filter
+./inc/mails/bonus_mails.php:84: // @TODO Rewrite these if() blocks to a filter
./inc/mails/doubler_mails.php:53:// @TODO Can this be rewritten to a filter?
+./inc/mails/doubler_mails.php:75:// @TODO Rewrite these if() blocks to a filter
./inc/module-functions.php:273: // @TODO Nothing helped???
./inc/module-functions.php:314: // @TODO Rewrite this to a filter
./inc/modules/admin/admin-inc.php:1055:// @TODO rawUserId/content is not yet supported
./inc/modules/admin/what-guest_add.php:80: // @TODO This can be somehow rewritten to a function
./inc/modules/admin/what-holiday_list.php:46:// @TODO Unused at the moment
./inc/modules/admin/what-list_admins_acls.php:126: // @TODO Rewrite this to filter 'run_sqls'
-./inc/modules/admin/what-list_autopurge.php:47:// @TODO Rewrite those lines to filter
+./inc/modules/admin/what-list_autopurge.php:54:// @TODO Rewrite this as a filter
./inc/modules/admin/what-list_bonus.php:136: // @TODO Can't this be moved into our expression language?
./inc/modules/admin/what-list_links.php:96: // @TODO Rewrite this to includes/filter
./inc/modules/admin/what-list_mods.php:55: // @TODO This can be moved into mysql-function.php, see checkModulePermissions() function
./inc/modules/admin/what-list_rallye_prices.php:222: // @TODO Rewrite these two constants
./inc/modules/admin/what-list_refs.php:101: // @TODO Try to rewrite some to EL
-./inc/modules/admin/what-list_unconfirmed.php:118: // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
-./inc/modules/admin/what-list_unconfirmed.php:89: // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}');
-./inc/modules/admin/what-list_unconfirmed.php:92: // @TODO `id` has been used two times???
+./inc/modules/admin/what-list_unconfirmed.php:115: // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
./inc/modules/admin/what-list_user_cats.php:54: // @TODO No longer needed? define('__CATEGORIES_BASE' , '<a href="{%url=modules.php?module=admin&userid=');
./inc/modules/admin/what-list_user_cats.php:68: // @TODO Rewrite this to countSum.....() function
./inc/modules/admin/what-list_user.php:104: // @TODO Refacture these old link generation to functions
./inc/modules/member/what-logout.php:17: * @TODO Rewrite the code to a filter *
./inc/modules/member/what-logout.php:52: // @TODO Move this in a filter, e.g. member_logout
./inc/modules/member/what-mydata.php:82: // @TODO Move this to a function (for better EL code)
-./inc/modules/member/what-order.php:464: // @TODO Rewrite this to a filter
+./inc/modules/member/what-order.php:362: // @TODO Rewrite this to a filter
./inc/modules/member/what-order.php:72: // @TODO Try to move out url_tlock to a filter for extra SQL statements
./inc/modules/member/what-payout.php:208: // @TODO Rewrite this to a filter
./inc/modules/member/what-points.php:61:// @TODO Should we rewrite this to a filter?
./inc/modules/member/what-rallyes.php:99: // @TODO Reactivate this: $content['admin'] = '<a href="{%url=modules.php?module=index&what=impressum&id=' . $content['admin_id'] . '%}">' . $content['login'] . '</a>';
./inc/modules/member/what-reflinks.php:52:// @TODO Move this into a filter
./inc/modules/member/what-transfer.php:128: // @TODO Rewrite this to a filter
-./inc/modules/member/what-unconfirmed.php:130: // @TODO This call cannot be saved as EL code cannot be "framed" in other EL code
-./inc/modules/member/what-unconfirmed.php:174: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/modules/member/what-unconfirmed.php:241: // @TODO cat_id is unused
-./inc/modules/member/what-unconfirmed.php:244: // @TODO This 'userid' cannot be saved because of encapsulated EL code
+./inc/modules/member/what-unconfirmed.php:124: // @TODO This call cannot be saved as EL code cannot be "framed" in other EL code
+./inc/modules/member/what-unconfirmed.php:168: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
+./inc/modules/member/what-unconfirmed.php:235: // @TODO cat_id is unused
+./inc/modules/member/what-unconfirmed.php:238: // @TODO This 'userid' cannot be saved because of encapsulated EL code
./inc/modules/order.php:71: // @TODO Unused: timestamp
+./inc/monthly/monthly_beg.php:58: // @TODO Rewrite these if() blocks to a filter
+./inc/monthly/monthly_bonus.php:57: // @TODO Rewrite these if() blocks to a filter
./inc/mysql-manager.php:1509: // @TODO Rewrite these lines to a filter
./inc/mysql-manager.php:1533: // @TODO Rewrite this to a filter
./inc/mysql-manager.php:1849: // @TODO Rewrite this to a filter
return $res;
}
-// Get id from last INSERT command
-function SQL_INSERTID () {
+// Get id from last INSERT command and secure id
+function SQL_INSERT_ID () {
if (!SQL_IS_LINK_UP()) return FALSE;
- return mysql_insert_id();
+ return bigintval(mysql_insert_id());
}
// Escape a string for the database
* Use the insert id as extension id and "cache" all data for
* this extension for early usage.
*/
- copyExtensionDataToCacheArray($currentName, SQL_INSERTID());
+ copyExtensionDataToCacheArray($currentName, SQL_INSERT_ID());
// Mark it as installed
$GLOBALS['ext_is_installed'][$currentName] = TRUE;
), __FUNCTION__, __LINE__);
// Add insert id for other filters
- $filterData['insert_id'] = SQL_INSERTID();
+ $filterData['insert_id'] = SQL_INSERT_ID();
// Register sub id in filter
setSession('subid', $subId);
__FUNCTION__, __LINE__);
// Remember insert id for other filters
- $filterData['history_id'] = SQL_INSERTID();
+ $filterData['history_id'] = SQL_INSERT_ID();
// Return data
return $filterData;
break;
case getCode('URL_TIME_LOCK'):
- // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
- $result = SQL_QUERY_ESC("SELECT `timestamp` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1",
- array(bigintval(getRequestElement('id'))), __FUNCTION__, __LINE__);
-
// Load timestamp from last order
- $content = SQL_FETCHARRAY($result);
-
- // Free memory
- SQL_FREERESULT($result);
+ $content = getPoolDataFromId(getRequestElement('id'));
// Translate it for templates
$content['timestamp'] = generateDateTime($content['timestamp'], 1);
'MEMBER_BONUS_STATS_SUBJECT' => "Ihr Aktiv-Bonus wegen 100% Klickrate",
'MEMBER_BONUS_LOGIN_BONUS_ADDED' => "Login-Bonus mit <strong>{%config,translateComma=login_bonus%} {?POINTS?}</strong> vergütet.",
'MEMBER_BONUS_LOGIN_BONUS_NOT_ADDED' => "Login-Bonus nicht vergütet.",
- 'ADMIN_LIST_UNCONFIRMED_BONUS_LINKS' => "Unbest. Bonus-Mail",
'ADMIN_BONUS_MAIL_ALREADY_DELETED' => "Bonus-Mail bereits gelöscht.",
'ADMIN_CONFIG_BONUS_RALLYE_TITLE' => "Einstellungen an der Aktiv-Rallye",
'ADMIN_TOTAL_MEMBER_BONUS' => "Gesamtbonus aller teilnehmenden Mitglieder",
// Prepare content
$content = array(
- 'insert_id' => SQL_INSERTID(),
+ 'insert_id' => SQL_INSERT_ID(),
'earning_id' => bigintval($earningId),
'daily_amount' => bigintval($dailyAmount),
'is_active' => $isActive
SQL_QUERY(getInsertSqlFromArray(postRequestArray(), 'network_data'), __FUNCTION__, __LINE__);
// Add the id for output only
- setPostRequestElement('network_id', SQL_INSERTID());
+ setPostRequestElement('network_id', SQL_INSERT_ID());
// Output message
if (!SQL_HASZEROAFFECTED()) {
), __FUNCTION__, __LINE__);
// Get his userid
- $filterData['register_insert_id'] = bigintval(SQL_INSERTID());
+ $filterData['register_insert_id'] = SQL_INSERT_ID();
// Did this work?
if (!isValidId($filterData['register_insert_id'])) {
), __FUNCTION__, __LINE__
);
- // Return insert id
- return SQL_INSERTID();
+ // Return secured insert id
+ return SQL_INSERT_ID();
}
// Notify admin(s) with a selected message and content
// Ask the database
$result = SQL_QUERY_ESC("SELECT
- COUNT(l.`locks_id`) AS `cnt`
+ COUNT(`l`.`locks_id`) AS `cnt`
FROM
`{?_MYSQL_PREFIX?}_surfbar_locks` AS `l`
INNER JOIN
`{?_MYSQL_PREFIX?}_surfbar_urls` AS `u`
ON
- `u`.`url_id`=l.`locks_url_id`
+ `u`.`url_id`=`l`.`locks_url_id`
WHERE
- l.`locks_userid`=%s AND
- (UNIX_TIMESTAMP() - {%%pipe,getSurfbarSurfLock%%}) < UNIX_TIMESTAMP(l.`locks_last_surfed`) AND
+ `l`.`locks_userid`=%s AND
+ (UNIX_TIMESTAMP() - {%%pipe,getSurfbarSurfLock%%}) < UNIX_TIMESTAMP(`l`.`locks_last_surfed`) AND
(
- ((UNIX_TIMESTAMP(l.`locks_last_surfed`) - `u`.`url_fixed_reload`) < 0 AND `u`.`url_fixed_reload` > 0) OR
+ ((UNIX_TIMESTAMP(`l`.`locks_last_surfed`) - `u`.`url_fixed_reload`) < 0 AND `u`.`url_fixed_reload` > 0) OR
`u`.`url_fixed_reload` = 0
)
LIMIT 1",
LEFT JOIN
`{?_MYSQL_PREFIX?}_surfbar_locks` AS `l`
ON
- `sbu`.`url_id`=l.`locks_url_id`
+ `sbu`.`url_id`=`l`.`locks_url_id`
WHERE
`sbu`.`url_userid` NOT IN (" . implode(',', $userids) . ") AND
(`sbu`.`url_views_allowed`=0 OR (`sbu`.`url_views_allowed` > 0 AND `sbu`.`url_views_max` > 0)) AND
`sbu`.`url_views_total`,
`sbu`.`url_views_max`,
`sbu`.`url_views_allowed`,
- UNIX_TIMESTAMP(l.`locks_last_surfed`) AS `last_surfed`,
+ UNIX_TIMESTAMP(`l`.`locks_last_surfed`) AS `last_surfed`,
`sbu`.`url_fixed_reload`
FROM
`{?_MYSQL_PREFIX?}_surfbar_urls` AS `sbu`
LEFT JOIN
`{?_MYSQL_PREFIX?}_surfbar_locks` AS `l`
ON
- `sbu`.`url_id`=l.`locks_url_id`
+ `sbu`.`url_id`=`l`.`locks_url_id`
WHERE
(`sbu`.`url_userid` NOT IN (" . implode(',', $userids['url_userid']) . ") OR `sbu`.`url_userid` IS NULL) AND
`sbu`.`url_status`='ACTIVE' AND
GROUP BY
`sbu`.`url_id`
ORDER BY
- l.`locks_last_surfed` ASC,
+ `l`.`locks_last_surfed` ASC,
`sbu`.`url_id` ASC
LIMIT %s,1",
array($randNum), __FUNCTION__, __LINE__
`sbu`.`url_views_total`,
`sbu`.`url_views_max`,
`sbu`.`url_views_allowed`,
- UNIX_TIMESTAMP(l.`locks_last_surfed`) AS `last_surfed`,
+ UNIX_TIMESTAMP(`l`.`locks_last_surfed`) AS `last_surfed`,
`sbu`.`url_fixed_reload`
FROM
`{?_MYSQL_PREFIX?}_surfbar_urls` AS `sbu`
LEFT JOIN
`{?_MYSQL_PREFIX?}_surfbar_locks` AS `l`
ON
- `sbu`.`url_id`=l.`locks_url_id`
+ `sbu`.`url_id`=`l`.`locks_url_id`
WHERE
(`sbu`.`url_userid` != %s OR `sbu`.`url_userid` IS NULL) AND
`sbu`.`url_status`='ACTIVE' AND
), __FILE__, __LINE__);
// Load id
- $id = SQL_INSERTID();
+ $id = SQL_INSERT_ID();
if (!empty($id)) {
// Reload to prices...
} // END - if
// Form sent or anything else? ;-)
-if ((isFormSent()) && (isPostRequestElementSet('id')) && (isGetRequestElementSet('type')) && (postRequestElement('type') == 'normal')) {
- // Make mail editable...
- $result = SQL_QUERY_ESC('SELECT
- `id`,
- `sender` AS `userid`,
- `subject`,
- `text`,
- `url`
-FROM
- `{?_MYSQL_PREFIX?}_pool`
-WHERE
- `id`=%s
-LIMIT 1',
- array(bigintval(postRequestElement('id'))), __FILE__, __LINE__);
-
- // Fetch row
- $content = SQL_FETCHARRAY($result);
-
- // Free result
- SQL_FREERESULT($result);
-
- // Load template
- loadTemplate('admin_edit_email', FALSE, $content);
-} elseif ((isPostRequestElementSet('id')) && (isGetRequestElementSet('type')) && (postRequestElement('type') == 'normal')) {
- // Make also this email editable
- $result = SQL_QUERY_ESC('SELECT
- `id`,
- `sender` AS `userid`,
- `subject`,
- `text`,
- `url`
-FROM
- `{?_MYSQL_PREFIX?}_pool`
-WHERE
- `id`=%s
-LIMIT 1',
- array(bigintval(getRequestElement('id'))), __FILE__, __LINE__);
-
- // Fetch row
- $content = SQL_FETCHARRAY($result);
-
- // Free result
- SQL_FREERESULT($result);
+if ((isFormSent('edit')) && (isPostRequestElementSet('id')) && (isGetRequestElementSet('type')) && (postRequestElement('type') == 'normal')) {
+ // Get data
+ $content = getPoolDataFromId(postRequestElement('id'));
// Load template
loadTemplate('admin_edit_email', FALSE, $content);
// Save changes
if ((isPostRequestElementSet('id')) && (isGetRequestElementSet('type')) && (postRequestElement('type') == 'normal')) {
// Update pool
- SQL_QUERY_ESC("UPDATE
- `{?_MYSQL_PREFIX?}_pool`
-SET
- `subject`='%s',
- `text`='%s',
- `url`='%s'
-WHERE
- `id`=%s
-LIMIT 1",
- array(
- postRequestElement('subject'),
- postRequestElement('text'),
- postRequestElement('url'),
- bigintval(postRequestElement('id')),
- ), __FILE__, __LINE__);
-
- if (!SQL_HASZEROAFFECTED()) {
+ $isUpdated = updatePoolDataById(postRequestElement('id'), NULL, array('subject' => postRequestElement('subject'), 'text' => postRequestElement('text'), 'url' => postRequestElemenet('url')));
+ if ($isUpdated === TRUE) {
$content = '{--ADMIN_EMAIL_CHANGES_SAVED--}';
} else {
$content = '<span class="bad">{--ADMIN_EMAIL_CHANGES_NOT_SAVED--}</span>';
// Query the pool
$result = SQL_QUERY('SELECT
`id`,
- `sender` AS `userid`,
+ `sender`,
`subject`,
`payment_id`,
`cat_id`
FROM
`{?_MYSQL_PREFIX?}_pool`
ORDER BY
+ `sender` ASC,
`timestamp` ASC', __FILE__, __LINE__);
// Entries found?
ON
`p`.`id`=`s`.`pool_id`
WHERE
- `p`.`id`=%s
+ `s`.`pool_id`=%s
LIMIT 1",
bigintval(getRequestElement('id'))
);
$listed = TRUE;
$DATA = getRequestElement('id');
} elseif (((isPostRequestElementSet('id')) && (isGetRequestElementSet('type')) && (postRequestElement('type') == 'bonus')) && (isExtensionActive('bonus'))) {
- // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}');
-
// SQL query for mail data (both ids are required for compatiblity to above normal mail
- // @TODO `id` has been used two times???
$sql = sprintf("SELECT
`id`,
- `id` AS `sender`,
+ NULL AS `sender`,
`subject`,
`text`,
`url`,
// but it does only show unconfirmed mail links from existing user
// accounts. So if you have delete one you did not see those links
$result = SQL_QUERY_ESC("SELECT
- l.`userid`,
+ `l`.`userid`,
`u`.`status`,
`u`.`surname`,
`u`.`family`,
LEFT JOIN
`{?_MYSQL_PREFIX?}_user_data` AS `u`
ON
- l.`userid`=`u`.`userid`
+ `l`.`userid`=`u`.`userid`
WHERE
- l.`%s`=%s
+ `l`.`%s`=%s
ORDER BY
- l.`userid` ASC
+ `l`.`userid` ASC
LIMIT %s",
array(
$col,
);
// Get the insert id from the table
- $couponId = SQL_INSERTID();
+ $couponId = SQL_INSERT_ID();
// Init userid array
$adminUserids = array();
SQL_FREERESULT($result);
if ($data['data_type'] == 'TEMP') {
- // No entry found, so we need to check out the stats table as well... :)
- // We have to add that suff here, now we continue WITHOUT checking and check the text and subject against some filters
+ /*
+ * No entry found, so we need to check out the stats table as well...
+ * :) We have to add that suff here, now we continue WITHOUT checking
+ * and check the text and subject against some filters
+ */
$data['url'] = '';
if (getConfig('allow_url_in_text') == 'Y') {
// Test submitted text against some filters (length, URLs in text etc.)
if (($usedPoints > 0) && ($usedPoints <= $totalPoints) && ($content['target_send'] > 0)) {
// Gettings points is okay, so we can add $usedPoints later from
if ((!isValidId($data['id'])) || ($data['data_type'] != 'TEMP')) {
- // New order
- $data['id'] = '0';
+ // New order, init data array elements
+ $data = array(
+ 'sender' => getMemberId(),
+ 'subject' => postRequestElement('subject'),
+ 'text' => postRequestElement('text'),
+ 'receivers' => $receiver
+ 'payment_id' => bigintval(postRequestElement('mail_type')),
+ 'data_type' => 'TEMP',
+ 'timestamp' => 'UNIX_TIMESTAMP()',
+ 'url' => postRequestElement('url'),
+ 'cat_id' => bigintval(postRequestElement('cat')),
+ 'target_send' => bigintval($content['target_send']),
+ 'zip' => bigintval(postRequestElement('zip'), TRUE, FALSE),
+ );
+
+ // Is ext-html_mail active?
if (isExtensionActive('html_mail')) {
// HTML extension is active
- SQL_QUERY_ESC("INSERT INTO
- `{?_MYSQL_PREFIX?}_pool`
-(
- `sender`,
- `subject`,
- `text`,
- `receivers`,
- `payment_id`,
- `data_type`,
- `timestamp`,
- `url`,
- `cat_id`,
- `target_send`,
- `zip`,
- `html_msg`
-) VALUES (
- %s,
- '%s',
- '%s',
- '%s',
- %s,
- 'TEMP',
- UNIX_TIMESTAMP(),
- '%s',
- %s,
- %s,
- %s,
- '%s'
-)",
- array(
- getMemberId(),
- postRequestElement('subject'),
- postRequestElement('text'),
- $receiver,
- bigintval(postRequestElement('mail_type')),
- postRequestElement('url'),
- bigintval(postRequestElement('cat')),
- bigintval($content['target_send']),
- bigintval(postRequestElement('zip'), TRUE, FALSE),
- postRequestElement('html')
- ), __FILE__, __LINE__);
- } else {
- // No HTML extension is active
- SQL_QUERY_ESC("INSERT INTO
- `{?_MYSQL_PREFIX?}_pool`
-(
- `sender`,
- `subject`,
- `text`,
- `receivers`,
- `payment_id`,
- `data_type`,
- `timestamp`,
- `url`,
- `cat_id`,
- `target_send`,
- `zip`
-) VALUES (
- %s,
- '%s',
- '%s',
- '%s',
- %s,
- 'TEMP',
- UNIX_TIMESTAMP(),
- '%s',
- %s,
- %s,
- %s
-)",
- array(
- getMemberId(),
- postRequestElement('subject'),
- postRequestElement('text'),
- $receiver,
- bigintval(postRequestElement('mail_type')),
- postRequestElement('url'),
- bigintval(postRequestElement('cat')),
- bigintval($content['target_send']),
- bigintval(postRequestElement('zip'), TRUE, FALSE),
- ), __FILE__, __LINE__);
- }
+ $data['html_msg'] = postRequestElement('html');
+ } // END - if
// Get insert id
- $data['id'] = SQL_INSERTID();
+ $data['id'] = insertDataIntoPool($data);
} else {
- // Change current order
+ // Update this data
+ $data = array(
+ 'subject' => postRequestElement('subject'),
+ 'text' => postRequestElement('text'),
+ 'receivers' => $receiver
+ 'payment_id' => bigintval(postRequestElement('mail_type')),
+ 'timestamp' => 'UNIX_TIMESTAMP()',
+ 'url' => postRequestElement('url'),
+ 'cat_id' => bigintval(postRequestElement('cat')),
+ 'target_send' => bigintval($content['target_send']),
+ 'zip' => bigintval(postRequestElement('zip'), TRUE, FALSE),
+ );
+
+ // Is ext-html_mail active?
if (isExtensionActive('html_mail')) {
// HTML extension is active
- SQL_QUERY_ESC("UPDATE
- `{?_MYSQL_PREFIX?}_pool`
-SET
- `subject`='%s',
- `text`='%s',
- `receivers`='%s',
- `payment_id`=%s,
- `timestamp`=UNIX_TIMESTAMP(),
- `url`='%s',
- `cat_id`=%s,
- `target_send`=%s,
- `zip`=%s,
- `html_msg`='%s'
-WHERE
- `id`=%s
-LIMIT 1",
- array(
- postRequestElement('subject'),
- postRequestElement('text'),
- $receiver,
- bigintval(postRequestElement('mail_type')),
- postRequestElement('url'),
- bigintval(postRequestElement('cat')),
- $content['target_send'],
- bigintval(postRequestElement('zip')),
- postRequestElement('html'),
- bigintval($data['id'])
- ), __FILE__, __LINE__);
- } else {
- // No HTML extension is active
- SQL_QUERY_ESC("UPDATE
- `{?_MYSQL_PREFIX?}_pool`
-SET
- `subject`='%s',
- `text`='%s',
- `receivers`='%s',
- `payment_id`=%s,
- `timestamp`=UNIX_TIMESTAMP(),
- `url`='%s',
- `cat_id`=%s,
- `target_send`=%s,
- `zip`=%s
-WHERE
- `id`=%s
-LIMIT 1",
- array(
- postRequestElement('subject'),
- postRequestElement('text'),
- $receiver,
- bigintval(postRequestElement('mail_type')),
- postRequestElement('url'),
- bigintval(postRequestElement('cat')),
- $content['target_send'],
- bigintval(postRequestElement('zip')),
- bigintval($data['id'])
- ), __FILE__, __LINE__);
- }
+ $data['html_msg'] = postRequestElement('html');
+ } // END - if
+
+ // Update pool data
+ updatePoolDataById($data['id'], NULL, $data);
}
// Make sure only valid id numbers can pass
assert(isValidId($data['id']));
// Id is received so we can redirect the user, used points will be added when he send's out the mail
- $data['url'] = 'modules.php?module=frametester&order=' . $data['id'];
+ $data['url'] = 'modules.php?module=frametester&order=' . bigintval($data['id']);
} elseif ($content['target_send'] == '0') {
// Not enougth receivers found which can receive mails
$data['url'] = 'modules.php?module=login&what=order&code=' . getCode('MORE_RECEIVERS2');
} elseif (isGetRequestElementSet('mailid')) {
// Display regular member mail by loading its full data
$result_data = SQL_QUERY_ESC("SELECT
- `s`.`id`,
- `s`.`subject`,
- `p`.`text`,
- `s`.`timestamp_ordered` AS `timestamp`,
- `s`.`cat_id`,
- `p`.`payment_id`,
- `p`.`sender`,
- `p`.`data_type`
+ `id` AS `stats_id`,
+ `pool_id`,
+ `subject`,
+ `timestamp_ordered`,
+ `cat_id`,
FROM
`{?_MYSQL_PREFIX?}_user_stats` AS `s`
-LEFT JOIN
- `{?_MYSQL_PREFIX?}_pool` AS `p`
-ON
- s.pool_id=p.id
WHERE
- `s`.`id`=%s
+ `id`=%s
LIMIT 1",
array(bigintval(getRequestElement('mailid'))), __FILE__, __LINE__);
// Load data
$content = SQL_FETCHARRAY($result_data);
+ $content = merge_array($content, getPoolDataFromId($content['pool_id']));
// Translate some data
- $content['timestamp'] = generateDateTime($content['timestamp'], '2');
+ $content['timestamp_ordered'] = generateDateTime($content['timestamp_ordered'], '2');
// @TODO This call cannot be saved as EL code cannot be "framed" in other EL code
$content['userid'] = getMemberId();
$content['user_mail_status'] = '{%message,MEMBER_MAIL_NORMAL_CONFIRMED_UNKNOWN=' . $content['id'] . '%}';
), __FUNCTION__, __LINE__, TRUE, $strip);
// Return insert id which is the task id
- return SQL_INSERTID();
+ return SQL_INSERT_ID();
}
// Updates last module / online time
SQL_QUERY($sql, __FUNCTION__, __LINE__);
// Add id number
- setPostRequestElement('id', SQL_INSERTID());
+ setPostRequestElement('id', SQL_INSERT_ID());
// Prepare filter data array
$filterData = array(
'mode' => 'add',
'table_name' => $tableName,
'content' => postRequestArray(),
- 'id' => SQL_INSERTID(),
+ 'id' => SQL_INSERT_ID(),
'subject' => '',
// @TODO Used generic 'userid' here
'userid_column' => array('userid'),
return (SQL_AFFECTEDROWS() == 1);
}
+// Insert data into pool and return its insert id
+function insertDataIntoPool ($data) {
+ // Construct SQL query
+ $sql = 'INSERT INTO `{?_MYSQL_PREFIX?}_pool (`' . implode('`,`', array_map('SQL_ESCAPE', array_keys($data))) . "`) VALUES ('" . implode("','", array_values($data)) . "')";
+
+ // Run the query
+ SQL_QUERY($sql, __FUNCTION__, __LINE__);
+
+ // Return insert id
+ return SQL_INSERT_ID();
+}
+
// [EOF]
?>
<td class="{%template,ColorSwitch%} bottom">
$content[subject]
({--EMAIL_SENDER--}:
- {%pipe,generateUserProfileLink=$content[userid]%};
+ {%pipe,generateUserProfileLink=$content[sender]%};
{%pipe,getPaymentTitlePrice=$content[payment_id]%};
{%pipe,getCategory=$content[cat_id]%})
</td>
<tr>
<td align="center" class="switch_sw1 bottom right">{--EMAIL_TIMESTAMP--}:</td>
<td align="center" class="switch_sw1 bottom">
- $content[timestamp]
+ $content[timestamp_ordered]
</td>
</tr>
<tr>
<tr>
<td align="center" class="switch_sw1 bottom right">{--EMAIL_TIMESTAMP--}:</td>
<td align="center" class="switch_sw1 bottom">
- $content[timestamp]
+ $content[timestamp_ordered]
</td>
</tr>
<tr>
<tr>
<td align="center" class="switch_sw1 bottom right">{--EMAIL_TIMESTAMP--}:</td>
<td align="center" class="switch_sw1 bottom">
- $content[timestamp]
+ $content[timestamp_ordered]
</td>
</tr>
<tr>
<tr>
<td align="center" class="switch_sw1 bottom right">{--EMAIL_TIMESTAMP--}:</td>
<td align="center" class="switch_sw1 bottom">
- $content[timestamp]
+ $content[timestamp_ordered]
</td>
</tr>
<tr>
<tr>
<td align="center" class="switch_sw1 bottom right">{--EMAIL_TIMESTAMP--}:</td>
<td align="center" class="switch_sw1 bottom">
- $content[timestamp]
+ $content[timestamp_ordered]
</td>
</tr>
<tr>
<tr>
<td align="center" class="switch_sw1 bottom right">{--EMAIL_TIMESTAMP--}:</td>
<td align="center" class="switch_sw1 bottom">
- $content[timestamp]
+ $content[timestamp_ordered]
</td>
</tr>
<tr>