From 32933a97e4462c232a794fc33bd91f01ff997cb9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 28 Jun 2010 03:47:11 +0000 Subject: [PATCH] New function isValidUserid() introduced, more rewrites to EL: - New function isValidUserId() introduced, see ticket #147. This function just validates a given user id if it not null, not empty and larget than zero. - More rewrites to make use of EL - 'surfbar_counter' is now a CSS class, not id - TODOs.txt updated --- DOCS/TODOs.txt | 20 +++++----- inc/libs/doubler_functions.php | 4 +- inc/mails/doubler_mails.php | 10 ++--- inc/modules/admin/overview-inc.php | 2 +- inc/modules/admin/what-chk_regs.php | 7 +--- inc/modules/admin/what-del_email.php | 18 ++++----- inc/modules/admin/what-edit_emails.php | 39 +++++++++---------- inc/modules/admin/what-list_autopurge.php | 20 ++++------ inc/modules/admin/what-list_bonus.php | 21 ++++++---- inc/modules/admin/what-list_holiday.php | 33 +++++++++------- inc/modules/admin/what-list_refs.php | 14 +++---- inc/modules/admin/what-list_task.php | 4 +- inc/modules/admin/what-list_unconfirmed.php | 17 ++++---- inc/modules/admin/what-list_user.php | 11 ++---- inc/modules/admin/what-sub_points.php | 2 +- inc/modules/admin/what-unlock_emails.php | 19 ++------- inc/modules/admin/what-unlock_sponsor.php | 2 +- .../admin/what-unlock_surfbar_urls.php | 2 - inc/modules/admin/what-usr_online.php | 10 +---- inc/wrapper-functions.php | 12 ++++++ .../de/html/admin/admin_del_email_normal.tpl | 12 +++--- .../de/html/admin/admin_edit_email_row.tpl | 2 +- .../html/admin/admin_list_autopurge_row.tpl | 4 +- .../de/html/admin/admin_list_bonus_rows.tpl | 6 +-- .../de/html/admin/admin_list_chk_reg_row.tpl | 6 +-- .../de/html/admin/admin_list_holiday_row.tpl | 4 +- .../de/html/admin/admin_list_online_row.tpl | 2 +- templates/de/html/admin/admin_list_refs.tpl | 2 +- templates/de/html/admin/admin_list_refs2.tpl | 2 +- .../de/html/admin/admin_list_refs_row.tpl | 6 +-- .../de/html/admin/admin_list_unconfirmed.tpl | 4 +- .../html/admin/admin_list_unconfirmed_row.tpl | 4 +- .../de/html/admin/admin_list_user_row.tpl | 2 +- .../de/html/admin/admin_unlock_emails_row.tpl | 10 ++--- .../admin/admin_unlock_surfbar_urls_row.tpl | 4 +- templates/de/html/js/js_surfbar_stopped.tpl | 2 +- .../de/html/surfbar/surfbar_frame_stats.tpl | 12 +++--- .../html/surfbar/surfbar_frame_textlinks.tpl | 2 +- .../de/html/surfbar/surfbar_frame_top.tpl | 2 +- templates/de/html/surfbar/surfbar_stopped.tpl | 2 +- theme/business/css/surfbar.css | 2 +- theme/default/css/surfbar.css | 2 +- theme/desert/css/surfbar.css | 6 +-- theme/org/css/surfbar.css | 4 +- 44 files changed, 178 insertions(+), 193 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 334942e56b..99787c597e 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -90,10 +90,10 @@ ./inc/libs/task_functions.php:53:// @TODO Move all extension-dependent queries into filters ./inc/libs/theme_functions.php:95: // @TODO Can't this be rewritten to an API function? ./inc/libs/user_functions.php:146: // @TODO These two constants are no longer used, maybe we reactivate this code? -./inc/libs/user_functions.php:233:// @TODO Double-check configuration entry here -./inc/libs/user_functions.php:325: // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content); -./inc/libs/user_functions.php:345: // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON)); -./inc/libs/user_functions.php:421: // @TODO We should try to rewrite this to fetchUserData() somehow +./inc/libs/user_functions.php:234:// @TODO Double-check configuration entry here +./inc/libs/user_functions.php:326: // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content); +./inc/libs/user_functions.php:346: // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON)); +./inc/libs/user_functions.php:422: // @TODO We should try to rewrite this to fetchUserData() somehow ./inc/libs/yoomedia_functions.php:116: $response = YOOMEDIA_QUERY_API('out_textmail.php', true); // @TODO Ask Yoo!Media for test script ./inc/load_config.php:77: // @TODO Rewrite them to avoid this else block ./inc/loader/load_cache-extension.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php * @@ -122,6 +122,8 @@ ./inc/modules/admin/what-config_rallye_prices.php:209: // @TODO Rewritings: level->price_level, infos->info in template ./inc/modules/admin/what-config_rallye_prices.php:226: // @TODO Rewrite these two constants ./inc/modules/admin/what-config_register.php:78: // @TODO Move this HTML code into a template +./inc/modules/admin/what-del_email.php:60: // @TODO Unused: $price = getPaymentPoints($content['payment_id'], 'price'); +./inc/modules/admin/what-del_email.php:61: // @TODO Unused: cat_id, payment_id ./inc/modules/admin/what-edit_user.php:20: * @TODO Add support for ext-country * ./inc/modules/admin/what-email_stats.php:48:// @TODO Unused at the moment ./inc/modules/admin/what-extensions.php:362: // @TODO Rewrite this to a filter @@ -130,8 +132,7 @@ ./inc/modules/admin/what-guest_add.php:85: // @TODO This can be somehow rewritten to a function ./inc/modules/admin/what-holiday_list.php:48:// @TODO Unused at the moment ./inc/modules/admin/what-list_autopurge.php:49:// @TODO Rewrite those lines to filter -./inc/modules/admin/what-list_autopurge.php:85: // @TODO Rewritings: surname->surname,family->family in templates -./inc/modules/admin/what-list_bonus.php:131: // @TODO Can't this be moved into our expression language? +./inc/modules/admin/what-list_bonus.php:136: // @TODO Can't this be moved into our expression language? ./inc/modules/admin/what-list_cats.php:56: // @TODO No longer needed? define('__CATS_BASE' , ' 0) { $content['userid'] = generateUserProfileLink($content['userid']); } else { $content['userid'] = '---'; } - if ($content['refid'] > 0) { $content['refid'] = generateUserProfileLink($content['refid']); } else { $content['refid'] = '---'; } + if (isValidUserId($content['userid'])) { $content['userid'] = generateUserProfileLink($content['userid']); } else { $content['userid'] = '---'; } + if (isValidUserId($content['refid'])) { $content['refid'] = generateUserProfileLink($content['refid']); } else { $content['refid'] = '---'; } } // END - if // Prepare data for the row template diff --git a/inc/mails/doubler_mails.php b/inc/mails/doubler_mails.php index 975fae07e9..d2cca8e044 100644 --- a/inc/mails/doubler_mails.php +++ b/inc/mails/doubler_mails.php @@ -48,8 +48,8 @@ if (!defined('__SECURITY')) { if (getOutputMode() != 0) return; // Initialize variables -$jackpot = '0'; $user = '0'; -if (isExtensionActive('jackpot')) $jackpot = getJackpotPoints(); +$jackpotPoints = '0'; $userPoints = '0'; +if (isExtensionActive('jackpot')) $jackpotPoints = getJackpotPoints(); // Get total points of the doubler itself $DOUBLER_POINTS = DOUBLER_GET_TOTAL_POINTS_LEFT(); @@ -146,17 +146,17 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == 'Y')) $okay = false; // Check for jackpot inclusion in doubling process - if (($jackpot > 0) && ($jackpot >= $content['points']) && (getConfig('doubler_jackpot') == 'Y')) { + if (($jackpotPoints > 0) && ($jackpotPoints >= $content['points']) && (getConfig('doubler_jackpot') == 'Y')) { // Subtract points from jackpot subtractPointsFromJackpot($content['points']); - $jackpot -= $content['points']; + $jackpotPoints -= $content['points']; // Okay, done! $okay = true; } // END - if // Exclude also webmaster's id in taking points from webmaster's account - if (($user > 0) && ($user >= $content['points']) && ($okay === false) && (getConfig('doubler_userid') > 0) && ($content['userid'] != getConfig('doubler_userid'))) { + if (($userPoints > 0) && ($userPoints >= $content['points']) && ($okay === false) && (getConfig('doubler_userid') > 0) && ($content['userid'] != getConfig('doubler_userid'))) { // Add points to used points subtractPoints('doubler_payout', getConfig('doubler_userid'), $content['points']); diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index 81719aadbe..0b83fa2923 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -450,7 +450,7 @@ LIMIT 1", // Get task type $content['task_type_msg'] = getMessage('ADMIN_TASK_IS_'.strtoupper($content['task_type']).''); - if ($content['userid'] > 0) { + if (isValidUserId($content['userid'])) { // Member found otherwise it's a system task $content['userid'] = generateUserProfileLink($content['userid']); } else { diff --git a/inc/modules/admin/what-chk_regs.php b/inc/modules/admin/what-chk_regs.php index 6c3ca60aac..a21d404b95 100644 --- a/inc/modules/admin/what-chk_regs.php +++ b/inc/modules/admin/what-chk_regs.php @@ -59,20 +59,17 @@ if (SQL_NUMROWS($result) > 0) { // We have some (new?) registrations! $OUT = ''; $SW = 2; while ($content = SQL_FETCHARRAY($result)) { - // Add link to refid - if ($content['refid'] > 0) $content['refid'] = generateUserProfileLink($content['refid']); - // Prepare array for the row template $content = array( 'sw' => $SW, - 'gender' => translateGender($content['gender']), + 'gender' => $content['gender'], 'surname' => $content['surname'], 'family' => $content['family'], 'email' => '' . $content['email'] . '', 'remote_addr' => $content['REMOTE_ADDR'], 'refid' => $content['refid'], 'user_hash' => $content['user_hash'], - 'link' => generateUserProfileLink($content['userid']), + 'userid' => $content['userid'], ); // Load row template and switch color diff --git a/inc/modules/admin/what-del_email.php b/inc/modules/admin/what-del_email.php index 11de7d3bb7..c5abb43616 100644 --- a/inc/modules/admin/what-del_email.php +++ b/inc/modules/admin/what-del_email.php @@ -48,25 +48,20 @@ $cnt = '0'; if (isGetRequestParameterSet('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`, `cat_id`, `payment_id` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1", array(bigintval(getRequestParameter('mid'))), __FILE__, __LINE__); // Delete mail only once if (SQL_NUMROWS($result) == 1) { // Load data - list ($id, $sender, $subject, $url, $timestamp, $payId) = SQL_FETCHROW($result); - SQL_FREERESULT($result); + $content = SQL_FETCHARRAY($result); // Get points we shall pay back per mail - $price = getPaymentPoints($payId, 'price'); + // @TODO Unused: $price = getPaymentPoints($content['payment_id'], 'price'); + // @TODO Unused: cat_id, payment_id // Prepare data for the template - $content['id'] = $id; - $content['sender'] = generateUserProfileLink($sender); - $content['subject'] = $subject; - $content['url'] = generateDerefererUrl($url); - $content['url_raw'] = $url; - $content['timestamp'] = generateDateTime($timestamp, 0); + $content['timestamp'] = generateDateTime($content['timestamp'], 0); // Load template loadTemplate('admin_del_email_normal', false, $content); @@ -157,6 +152,9 @@ LIMIT 1", // Mail already deleted! loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NORMAL_MAIL_ALREADY_DELETED')); } + + // Free result + SQL_FREERESULT($result); } elseif (isGetRequestParameterSet('pid')) { // Remove stats entries SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1", diff --git a/inc/modules/admin/what-edit_emails.php b/inc/modules/admin/what-edit_emails.php index 29bb65f1a2..b18689ddeb 100644 --- a/inc/modules/admin/what-edit_emails.php +++ b/inc/modules/admin/what-edit_emails.php @@ -49,20 +49,26 @@ if ((isFormSent()) && (!isPostRequestParameterSet('id'))) { unsetPostRequestParameter('ok'); } // END - if -$result = SQL_QUERY("SELECT id, sender, subject, payment_id, cat_id FROM `{?_MYSQL_PREFIX?}_pool` ORDER BY timestamp", __FILE__, __LINE__); +// Query the pool +$result = SQL_QUERY("SELECT + `id`, `sender`, `subject`, `payment_id`, `cat_id` +FROM + `{?_MYSQL_PREFIX?}_pool` +ORDER BY + `timestamp` ASC", __FILE__, __LINE__); + +// Entries found? if (SQL_NUMROWS($result) > 0) { if (isFormSent()) { // Make mail editable... - $result = SQL_QUERY_ESC("SELECT subject, text, url FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1", - array(bigintval(postRequestParameter('id'))), __FILE__, __LINE__); - list($subj, $text, $url) = SQL_FETCHROW($result); - SQL_FREERESULT($result); + $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `text`, `url` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1", + array(bigintval(postRequestParameter('id'))), __FILE__, __LINE__); - // Prepare constant for template - $content['id'] = bigintval(postRequestParameter('id')); - $content['url'] = $url; - $content['subject'] = $subj; - $content['text'] = $text; + // Fetch row + $content = SQL_FETCHARRAY($result); + + // Free result + SQL_FREERESULT($result); // Load template loadTemplate('admin_edit_email', false, $content); @@ -96,20 +102,13 @@ LIMIT 1", // There are mail orders available $OUT = ''; $SW = 2; while ($content = SQL_FETCHARRAY($result)) { - // Prepare data for the row template - $content = array( - 'sw' => $SW, - 'id' => $content['id'], - 'subject' => $content['subject'], - 'userid' => generateUserProfileLink($content['sender']), - 'pay' => getPaymentTitlePrice($content['payment_id']), - 'cat' => getCategory($content['cat_id']), - ); + // Add color swapping + $content['sw'] = $SW; // Load row template and switch colors $OUT .= loadTemplate('admin_edit_email_row', true, $content); $SW = 3 - $SW; - } + } // END - while // Free memory SQL_FREERESULT($result); diff --git a/inc/modules/admin/what-list_autopurge.php b/inc/modules/admin/what-list_autopurge.php index 5cbd509693..50b09a99be 100644 --- a/inc/modules/admin/what-list_autopurge.php +++ b/inc/modules/admin/what-list_autopurge.php @@ -59,34 +59,28 @@ if (isExtensionActive('doubler')) $EXCLUDE_LIST .= ' AND d.userid ! if (isExtensionInstalledAndNewer('holiday', '0.1.3')) $EXCLUDE_LIST .= " AND d.holiday_active='N'"; // Check for all accounts -$result = SQL_QUERY_ESC("SELECT +$result = SQL_QUERY("SELECT d.userid, d.gender, d.surname, d.family, d.email, d.joined, d.last_online, d.ap_notified FROM `{?_MYSQL_PREFIX?}_user_data` AS d WHERE d.`status`='CONFIRMED' AND - d.joined < (UNIX_TIMESTAMP() - %s) AND - d.last_online < (UNIX_TIMESTAMP() - %s) AND - d.ap_notified < (UNIX_TIMESTAMP() - %s) + d.joined < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND + d.last_online < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND + d.ap_notified < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) ".$EXCLUDE_LIST." ORDER BY - d.userid ASC", - array( - getConfig('ap_inactive_since'), - getConfig('ap_inactive_since'), - getConfig('ap_inactive_since') - ), __FILE__, __LINE__); + d.userid ASC", __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // Ok, we have found some inactive accounts $OUT = ''; $SW = 2; while ($content = SQL_FETCHARRAY($result)) { // Prepare data for the row template - // @TODO Rewritings: surname->surname,family->family in templates $content = array( 'sw' => $SW, - 'userid' => generateUserProfileLink($content['userid']), - 'gender' => translateGender($content['gender']), + 'userid' => $content['userid'], + 'gender' => $content['gender'], 'surname' => $content['surname'], 'family' => $content['family'], 'email' => '' . $content['email'] . '', diff --git a/inc/modules/admin/what-list_bonus.php b/inc/modules/admin/what-list_bonus.php index 38c8ee8f84..021a2e8638 100644 --- a/inc/modules/admin/what-list_bonus.php +++ b/inc/modules/admin/what-list_bonus.php @@ -78,11 +78,19 @@ if (getConfig('bonus_active') == 'Y') { } // Check if at least one is in the active rallye - $result = SQL_QUERY_ESC("SELECT `userid`, `email`, `gender`, `surname`, `family`, ".$USE." AS points, `last_online` -FROM `{?_MYSQL_PREFIX?}_user_data` -WHERE `status`='CONFIRMED' AND ".$USE." > 0".$lastOnline." -ORDER BY `points` DESC, `last_online` DESC, `userid` ASC", - array($ONLINE), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT + `userid`, `email`, `gender`, `surname`, `family`, ".$USE." AS points, `last_online` +FROM + `{?_MYSQL_PREFIX?}_user_data` +WHERE + `status`='CONFIRMED' AND + ".$USE." > 0 + ".$lastOnline." +ORDER BY + `points` DESC, + `last_online` DESC, + `userid` ASC", + array($ONLINE), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // List users @@ -100,10 +108,7 @@ ORDER BY `points` DESC, `last_online` DESC, `userid` ASC", } // END - if // Prepare content - $content['userid'] = generateUserProfileLink($content['userid']); $content['email'] = generateEmailLink($content['email'], 'user_data'); - $content['gender'] = translateGender($content['gender']); - $content['points'] = translateComma($content['points']); $content['last_online'] = generateDateTime($content['last_online'], 2); $content['sw'] = $SW; $content['win1'] = $WIN1; diff --git a/inc/modules/admin/what-list_holiday.php b/inc/modules/admin/what-list_holiday.php index 2947ae1129..9845488bc9 100644 --- a/inc/modules/admin/what-list_holiday.php +++ b/inc/modules/admin/what-list_holiday.php @@ -46,11 +46,16 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { addMenuDescription('admin', __FILE__); // Start listing holiday requests -$result = SQL_QUERY("SELECT h.id, h.userid, h.holiday_start, h.holiday_end, h.comments, d.status, d.last_online -FROM `{?_MYSQL_PREFIX?}_user_holidays` AS h -LEFT JOIN `{?_MYSQL_PREFIX?}_user_data` AS d -ON h.userid=d.userid -ORDER BY h.userid", __FILE__, __LINE__); +$result = SQL_QUERY("SELECT + h.id, h.userid, h.holiday_start, h.holiday_end, h.comments, d.status, d.last_online +FROM + `{?_MYSQL_PREFIX?}_user_holidays` AS h +LEFT JOIN + `{?_MYSQL_PREFIX?}_user_data` AS d +ON + h.userid=d.userid +ORDER BY + h.userid ASC", __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // List all holiday requests @@ -61,20 +66,20 @@ if (SQL_NUMROWS($result) > 0) { // Prepare data for the row template $content = array( - 'sw' => $SW, - 'id' => $content['id'], - 'userid' => generateUserProfileLink($content['userid']), - 'start' => generateDateTime($content['holiday_start'], 3), - 'end' => generateDateTime($content['holiday_end'], 3), - 'comments' => wordwrap($content['comments'], 15), - 'status' => translateUserStatus($content['status']), - 'last_online' => generateDateTime($content['last_online'], 3), + 'sw' => $SW, + 'id' => $content['id'], + 'userid' => $content['userid'], + 'start' => generateDateTime($content['holiday_start'], 3), + 'end' => generateDateTime($content['holiday_end'], 3), + 'comments' => wordwrap($content['comments'], 15), + 'status' => $content['status'], + 'last_online' => generateDateTime($content['last_online'], 3), ); // Load row template and switch color $OUT .= loadTemplate('admin_list_holiday_row', true, $content); $SW = 3 - $SW; - } + } // END - while // Free memory SQL_FREERESULT($result); diff --git a/inc/modules/admin/what-list_refs.php b/inc/modules/admin/what-list_refs.php index 4451dc6480..a763a391b4 100644 --- a/inc/modules/admin/what-list_refs.php +++ b/inc/modules/admin/what-list_refs.php @@ -110,13 +110,13 @@ ORDER BY // @TODO Try to rewrite some to EL $content = array( 'sw' => $SW, - 'u_link' => generateUserProfileLink(getUserData('userid')), - 'gender' => translateGender(getUserData('gender')), + 'userid' => getUserData('userid'), + 'gender' => getUserData('gender'), 'refs_link' => 0, 'surname' => getUserData('surname'), 'family' => getUserData('family'), 'email' => '[' . getUserData('email') . ']', - 'status' => translateUserStatus(getUserData('status')), + 'status' => getUserData('status'), 'registered' => generateDateTime(getUserData('joined'), 3), ); @@ -156,13 +156,13 @@ ORDER BY // Prepare data for the template $content = array( 'sw' => $SW, - 'u_link' => generateUserProfileLink($levels['userid']), - 'gender' => translateGender($levels['gender']), + 'userid' => $levels['userid'], + 'gender' => $levels['gender'], 'refs_link' => 0, 'surname' => $levels['surname'], 'family' => $levels['family'], 'email' => '[' . $levels['email'] . ']', - 'status' => translateUserStatus($levels['status']), + 'status' => $levels['status'], 'registered' => generateDateTime($levels['joined'], 3), ); @@ -180,7 +180,7 @@ ORDER BY // Prepare content $content = array( 'rows' => $OUT, - 'userid' => generateUserProfileLink(getRequestParameter('userid')) + 'userid' => getRequestParameter('userid') ); // Load main template diff --git a/inc/modules/admin/what-list_task.php b/inc/modules/admin/what-list_task.php index 206b4777e5..97957c0b8b 100644 --- a/inc/modules/admin/what-list_task.php +++ b/inc/modules/admin/what-list_task.php @@ -168,7 +168,7 @@ ORDER BY } // END - switch // Member assigned with task? - if ($content['userid'] > 0) { + if (isValidUserId($content['userid'])) { // Member found otherwise it's a system task $content['userid'] = generateUserProfileLink($content['userid']); } else { @@ -177,7 +177,7 @@ ORDER BY } // Prepare content - // @TODO Rewritings: admin->assigned_admin,userid->userid,type->task_type_msg in template + // @TODO Rewritings: admin->assigned_admin,type->task_type_msg in template $content = merge_array($content, array( 'sw' => $SW, 'admin' => $content['assigned_admin'], diff --git a/inc/modules/admin/what-list_unconfirmed.php b/inc/modules/admin/what-list_unconfirmed.php index 32aa9857ab..679b5bc7e1 100644 --- a/inc/modules/admin/what-list_unconfirmed.php +++ b/inc/modules/admin/what-list_unconfirmed.php @@ -138,12 +138,11 @@ LIMIT %s", // Prepare data for the row template $content = array( 'sw' => $SW, - 'u_link' => generateUserProfileLink($content['userid']), 'userid' => $content['userid'], 'link' => $LINK, 'id' => $ID, 'email' => '' . translateGender($content['gender']) . ' ' . $content['surname'] . ' ' . $content['family'] . '', - 'status' => translateUserStatus($content['status']), + 'status' => $content['status'], ); // Load row template and switch colors @@ -172,13 +171,13 @@ LIMIT %s", // Prepare content $content = array( - 'sender_link' => generateUserProfileLink($sender), - 'subject' => $subj, - 'text' => $text, - 'url' => generateFrametesterUrl($url), - 'unconfirmed' => $unconfirmed, - 'stamp' => generateDateTime($stamp, 2), - 'rows' => $OUT + 'sender' => $sender, + 'subject' => $subj, + 'text' => $text, + 'url' => $url, + 'unconfirmed' => $unconfirmed, + 'stamp' => generateDateTime($stamp, 2), + 'rows' => $OUT ); // Load final template diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php index 61ace388a9..87e9901869 100644 --- a/inc/modules/admin/what-list_user.php +++ b/inc/modules/admin/what-list_user.php @@ -119,9 +119,9 @@ LIMIT 1", // Add links to the numbers if ($content['links'] > 0) $content['links'] = $base . '&what=list_links&userid=' . $userid . '%}">' . $content['links'] . ']'; - if ($content['refid'] > 0) $content['refid'] = $base . '&what=list_user&userid=' . $content['refid'] . '%}">'.$content['refid'] . ']'; - if ($content['refs'] > 0) $content['refs'] = $base . '&what=list_refs&userid=' . $userid . '%}">' . $content['refs'] . ']'; - if ($content['cats'] > 0) $content['cats'] = $base . '&what=list_cats&userid=' . $userid . '%}">' . $content['cats'] . ']'; + if (isValidUserId($content['refid'])) $content['refid'] = $base . '&what=list_user&userid=' . $content['refid'] . '%}">'.$content['refid'] . ']'; + if ($content['refs'] > 0) $content['refs'] = $base . '&what=list_refs&userid=' . $userid . '%}">' . translateComma($content['refs']) . ']'; + if ($content['cats'] > 0) $content['cats'] = $base . '&what=list_cats&userid=' . $userid . '%}">' . translateComma($content['cats']) . ']'; // Fix empty module if (empty($content['last_module'])) $content['last_module'] = '---'; @@ -285,9 +285,6 @@ LIMIT 1", // Merge more data in $content = merge_array($content, $templateContent); - // Set refid link - if ($content['refid'] > 0) $content['refid'] = generateUserProfileLink($content['refid']); - // Get number of unconfirmed mails $content['links'] = countSumTotalData($content['userid'], 'user_links', 'id', 'userid', true); if ($content['links'] > 0) $content['links'] = $base . '&what=list_links&userid=' . $content['userid'] . '%}">' . translateComma($content['links']) . ']'; @@ -316,7 +313,7 @@ LIMIT 1", $content['locked'] = countSumTotalData($content['userid'], 'user_points', 'locked_points'); // If we have at least one referal, make it clickable to referal list - if ($content['refs'] > 0) $content['refs'] = $base . '&what=list_refs&userid=' . $content['userid'] . '%}">' . $content['refs'] . ']'; + if ($content['refs'] > 0) $content['refs'] = $base . '&what=list_refs&userid=' . $content['userid'] . '%}">' . translateComma($content['refs']) . ']'; // Is the lock reason not set? if (!isset($content['lock_reason'])) $content['lock_reason'] = '---'; diff --git a/inc/modules/admin/what-sub_points.php b/inc/modules/admin/what-sub_points.php index 4b72569767..651bd116ec 100644 --- a/inc/modules/admin/what-sub_points.php +++ b/inc/modules/admin/what-sub_points.php @@ -101,7 +101,7 @@ if (getRequestParameter('userid') == 'all') { loadTemplate('admin_settings_saved', false, getMessage('ADMIN_POINTS_SUBTRACTED')); } else { // Prepare content - $content['user'] = '' . $content['surname'] . ' ' . $content['family'] . ''; + $content['user'] = '' . translateGender($content['gender']) . ' ' . $content['surname'] . ' ' . $content['family'] . ''; $content['userid'] = bigintval(getRequestParameter('userid')); // Load form diff --git a/inc/modules/admin/what-unlock_emails.php b/inc/modules/admin/what-unlock_emails.php index 75bddbb453..947f16fe9c 100644 --- a/inc/modules/admin/what-unlock_emails.php +++ b/inc/modules/admin/what-unlock_emails.php @@ -47,7 +47,7 @@ addMenuDescription('admin', __FILE__); // Check for mails $result_main = SQL_QUERY("SELECT - `id`,`sender`,`subject`,`payment_id` AS `payment`,`timestamp`,`url`,`target_send`,`cat_id` AS category + `id`, `sender`, `subject`, `payment_id`, `timestamp`, `url`, `target_send`, `cat_id` FROM `{?_MYSQL_PREFIX?}_pool` WHERE @@ -196,21 +196,8 @@ LIMIT 1", $OUT = ''; $SW = 2; while ($content = SQL_FETCHARRAY($result_main)) { // Prepare data for the template - $content = array( - 'sw' => $SW, - 'id' => $content['id'], - 'sender' => $content['sender'], - 'u_link' => generateUserProfileLink($content['sender']), - 'subject' => $content['subject'], - 'tester' => generateFrametesterUrl($content['url']), - 'url' => $content['url'], - 'cat_title' => str_replace('"', '"', getCategory($content['category'])), - 'cat_link' => $content['category'], - 'pay_title' => str_replace('"', '"', getPaymentTitlePrice($content['payment'], true)), - 'pay_link' => $content['payment'], - 'timestamp' => generateDateTime($content['timestamp'], 2), - 'target_send' => $content['target_send'], - ); + $content['sw'] = $SW; + $content['timestamp'] = generateDateTime($content['timestamp'], 2); // Load row template and switch colors $OUT .= loadTemplate('admin_unlock_emails_row', true, $content); diff --git a/inc/modules/admin/what-unlock_sponsor.php b/inc/modules/admin/what-unlock_sponsor.php index d25521cfe9..94d606139e 100644 --- a/inc/modules/admin/what-unlock_sponsor.php +++ b/inc/modules/admin/what-unlock_sponsor.php @@ -135,7 +135,7 @@ LIMIT 1", array($content['id']), __FILE__, __LINE__); // Update, if applyable, referal count and points - if (($content['refid'] > 0) && ($content['refid'] != $content['id'])) { + if ((isValidUserId($content['refid'])) && ($content['refid'] != $content['id'])) { // Update referal account SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` diff --git a/inc/modules/admin/what-unlock_surfbar_urls.php b/inc/modules/admin/what-unlock_surfbar_urls.php index d41b8acc65..f902b379cf 100644 --- a/inc/modules/admin/what-unlock_surfbar_urls.php +++ b/inc/modules/admin/what-unlock_surfbar_urls.php @@ -86,8 +86,6 @@ if (SQL_NUMROWS($result) > 0) { while ($content = SQL_FETCHARRAY($result)) { // "Translate"/add content $content['sw'] = $SW; - $content['userid'] = generateUserProfileLink($content['userid']); - $content['framekiller'] = generateFrametesterUrl($content['url']); $content['url_registered'] = generateDateTime($content['url_registered'], 2); // Load row template diff --git a/inc/modules/admin/what-usr_online.php b/inc/modules/admin/what-usr_online.php index dd4f51cb7d..3a1043a4ee 100644 --- a/inc/modules/admin/what-usr_online.php +++ b/inc/modules/admin/what-usr_online.php @@ -73,16 +73,10 @@ if (isExtensionActive('online')) { } elseif (($row['is_member'] != 'Y') && ($row['is_admin'] != 'Y')) { // Is a guest $row['userid'] = getMessage('_IS_GUEST'); - } elseif ($row['userid'] > 0) { + } elseif (isValidUserId($row['userid'])) { // Add profile link to userid $row['userid'] = generateUserProfileLink($row['userid']); - } // END - if - - // Is the refid set? - if ($row['refid'] > 0) { - // Add profile link to referer id - $row['refid'] = generateUserProfileLink($row['refid']); - } // END - if + } // Add more content $row['sw'] = $SW; diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 9615ce1fc9..8e7ae4c14e 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1049,5 +1049,17 @@ function debugOutput ($message) { outputHtml('
' . $message . '
'); } +// Is given userid valid? +function isValidUserId ($userid) { + // Do we have cache? + if (!isset($GLOBALS['is_valid_userid'][$userid])) { + // Check it out + $GLOBALS['is_valid_userid'][$userid] = ((!is_null($userid)) && (!empty($userid)) && ($userid > 0)); + } // END - if + + // Return cache + return $GLOBALS['is_valid_userid'][$userid]; +} + // [EOF] ?> diff --git a/templates/de/html/admin/admin_del_email_normal.tpl b/templates/de/html/admin/admin_del_email_normal.tpl index cd3215e5c8..064f70aed1 100644 --- a/templates/de/html/admin/admin_del_email_normal.tpl +++ b/templates/de/html/admin/admin_del_email_normal.tpl @@ -1,5 +1,5 @@ - +
+
- + - +
{--ADMIN_EMAIL_DELETED--}
@@ -14,10 +14,12 @@
$content[id]$content[sender]{%pipe,generateUserProfileLink=$content[sender]%} $content[subject]{--ADMIN_TEST_URL--} + {--ADMIN_TEST_URL--} + $content[timestamp]
+ diff --git a/templates/de/html/admin/admin_edit_email_row.tpl b/templates/de/html/admin/admin_edit_email_row.tpl index c29c14b281..abc760f688 100644 --- a/templates/de/html/admin/admin_edit_email_row.tpl +++ b/templates/de/html/admin/admin_edit_email_row.tpl @@ -5,6 +5,6 @@ $content[subject] - ({--EMAIL_SENDER--}: $content[userid]; {%pipe,translateComma=$content[pay]%}; $content[cat]) + ({--EMAIL_SENDER--}: {%pipe,generateUserProfileLink=$content[userid]%}; {%pipe,getPaymentTitlePrice=$content[payment_id]%}; {%pipe,getCategory=$content[cat_id]%}) diff --git a/templates/de/html/admin/admin_list_autopurge_row.tpl b/templates/de/html/admin/admin_list_autopurge_row.tpl index c2e12e065c..4f1e3c707d 100644 --- a/templates/de/html/admin/admin_list_autopurge_row.tpl +++ b/templates/de/html/admin/admin_list_autopurge_row.tpl @@ -1,6 +1,6 @@ - $content[userid] - $content[gender] + {%pipe,generateUserProfileLink=$content[userid]%} + {%pipe,translateGender=$content[gender]%} $content[surname] $content[family] $content[email] diff --git a/templates/de/html/admin/admin_list_bonus_rows.tpl b/templates/de/html/admin/admin_list_bonus_rows.tpl index 61169443d7..04b8a9fafb 100644 --- a/templates/de/html/admin/admin_list_bonus_rows.tpl +++ b/templates/de/html/admin/admin_list_bonus_rows.tpl @@ -1,7 +1,7 @@ $content[win1]$content[cnt]$content[win2] - $content[win1]$content[userid]$content[win2] - $content[win1]$content[gender] $content[surname] $content[family]$content[win2] - $content[points] {?POINTS?} + $content[win1]{%pipe,generateUserProfileLink=$content[userid]%}$content[win2] + $content[win1]{%pipe,translateGender$content[gender]%} $content[surname] $content[family]$content[win2] + {%pipe,translateComma=$content[points]%} {?POINTS?} $content[last_online] diff --git a/templates/de/html/admin/admin_list_chk_reg_row.tpl b/templates/de/html/admin/admin_list_chk_reg_row.tpl index cb77fb43fc..ac7f678484 100644 --- a/templates/de/html/admin/admin_list_chk_reg_row.tpl +++ b/templates/de/html/admin/admin_list_chk_reg_row.tpl @@ -1,11 +1,11 @@ - $content[link] - $content[gender] + {%pipe,generateUserProfileLink=$content[userid]%} + {%pipe,translateGender=$content[gender]%} $content[surname] $content[family] $content[email] $content[remote_addr] - $content[refid] + {%pipe,generateUserProfileLink=$content[refid]%} {--CONFIRMATION_LINK--} diff --git a/templates/de/html/admin/admin_list_holiday_row.tpl b/templates/de/html/admin/admin_list_holiday_row.tpl index 680a54b6d2..8603de0e38 100644 --- a/templates/de/html/admin/admin_list_holiday_row.tpl +++ b/templates/de/html/admin/admin_list_holiday_row.tpl @@ -3,7 +3,7 @@ - $content[userid] + {%pipe,generateUserProfileLink=$content[userid]%} $content[start] @@ -15,7 +15,7 @@
$content[comments]
- $content[status] + {%pipe,translateUserStatus=$content[status]%} $content[last_online] diff --git a/templates/de/html/admin/admin_list_online_row.tpl b/templates/de/html/admin/admin_list_online_row.tpl index 4db0933a1b..ff714862b1 100644 --- a/templates/de/html/admin/admin_list_online_row.tpl +++ b/templates/de/html/admin/admin_list_online_row.tpl @@ -2,7 +2,7 @@ $content[id] $content[userid] $content[ip] - $content[refid] + {%pipe,generateUserProfileLink=$content[refid]%} $content[module] $content[action] $content[what] diff --git a/templates/de/html/admin/admin_list_refs.tpl b/templates/de/html/admin/admin_list_refs.tpl index d2a02e1d0c..3828f7a880 100644 --- a/templates/de/html/admin/admin_list_refs.tpl +++ b/templates/de/html/admin/admin_list_refs.tpl @@ -2,7 +2,7 @@ diff --git a/templates/de/html/admin/admin_list_refs2.tpl b/templates/de/html/admin/admin_list_refs2.tpl index 69f853c96b..788378e3c7 100644 --- a/templates/de/html/admin/admin_list_refs2.tpl +++ b/templates/de/html/admin/admin_list_refs2.tpl @@ -2,7 +2,7 @@
- {%message,ADMIN_LIST_REFERALS=$content[userid]%} + {%message,ADMIN_LIST_REFERALS={%pipe,generateUserProfileLink=$content[userid]%}%}
$content[rows] diff --git a/templates/de/html/admin/admin_list_refs_row.tpl b/templates/de/html/admin/admin_list_refs_row.tpl index a427d59da2..cd177e0859 100644 --- a/templates/de/html/admin/admin_list_refs_row.tpl +++ b/templates/de/html/admin/admin_list_refs_row.tpl @@ -1,8 +1,8 @@ - + - + - + diff --git a/templates/de/html/admin/admin_list_unconfirmed.tpl b/templates/de/html/admin/admin_list_unconfirmed.tpl index 9ed6e26a60..3590924e30 100644 --- a/templates/de/html/admin/admin_list_unconfirmed.tpl +++ b/templates/de/html/admin/admin_list_unconfirmed.tpl @@ -3,7 +3,7 @@ - + - + diff --git a/templates/de/html/admin/admin_list_user_row.tpl b/templates/de/html/admin/admin_list_user_row.tpl index 5239cf9138..7dba30c6b3 100644 --- a/templates/de/html/admin/admin_list_user_row.tpl +++ b/templates/de/html/admin/admin_list_user_row.tpl @@ -22,7 +22,7 @@ - + diff --git a/templates/de/html/admin/admin_unlock_emails_row.tpl b/templates/de/html/admin/admin_unlock_emails_row.tpl index 9dfec03ed5..38985524d5 100644 --- a/templates/de/html/admin/admin_unlock_emails_row.tpl +++ b/templates/de/html/admin/admin_unlock_emails_row.tpl @@ -5,24 +5,24 @@ diff --git a/templates/de/html/admin/admin_unlock_surfbar_urls_row.tpl b/templates/de/html/admin/admin_unlock_surfbar_urls_row.tpl index f07c40608b..ef0368729b 100644 --- a/templates/de/html/admin/admin_unlock_surfbar_urls_row.tpl +++ b/templates/de/html/admin/admin_unlock_surfbar_urls_row.tpl @@ -3,13 +3,13 @@
- {%message,ADMIN_LIST_REFERALS=$content[userid]%} + {%message,ADMIN_LIST_REFERALS={%pipe,generateUserProfileLink=$content[userid]%}%}
$content[u_link]  {%pipe,generateUserProfileLink=$content[userid]%} $content[refs_link]$content[gender] $content[surname] $content[family]{%pipe,translateGender=$content[gender]%} $content[surname] $content[family] $content[email]$content[status]{%pipe,translateUserStatus=$content[status]%} $content[registered]
{--EMAIL_SENDER--}:
- $content[sender_link] + {%pipe,generateUserProfileLink=$content[sender]%}
{--EMAIL_SUBJECT--}:
@@ -12,7 +12,7 @@
{--EMAIL_URL--}:
- {--ADMIN_TEST_URL--} + {--ADMIN_TEST_URL--}
{--EMAIL_TIMESTAMP--}:
diff --git a/templates/de/html/admin/admin_list_unconfirmed_row.tpl b/templates/de/html/admin/admin_list_unconfirmed_row.tpl index f8b6f8b351..35d691db96 100644 --- a/templates/de/html/admin/admin_list_unconfirmed_row.tpl +++ b/templates/de/html/admin/admin_list_unconfirmed_row.tpl @@ -1,8 +1,8 @@
$content[u_link]{%pipe,generateUserProfileLink=$content[userid]%} {--CLICK_NOW--} $content[email]$content[status]{%pipe,translateUserStatus=$content[status]%}
$content[email] $content[REMOTE_ADDR]$content[refid]{%pipe,generateUserProfileLink=$content[refid]%} {%pipe,translateUserStatus=$content[status]%} $content[links]
- $content[u_link] + {%pipe,generateUserProfileLink=$content[sender]%} $content[subject] - {--ADMIN_TEST_URL--} + {--ADMIN_TEST_URL--} - $content[cat_link] + $content[cat_link] - $content[pay_link] + $content[pay_link] $content[timestamp] - $content[target_send] + {%pipe,translateComma=$content[target_send]%}
- $content[url_userid] + {%pipe,generateUserProfileLink=$content[url_userid]%} $content[url] - {--ADMIN_TEST_URL--} + {--ADMIN_TEST_URL--} $content[url_registered] diff --git a/templates/de/html/js/js_surfbar_stopped.tpl b/templates/de/html/js/js_surfbar_stopped.tpl index 4234cf4a4b..003585d4a6 100644 --- a/templates/de/html/js/js_surfbar_stopped.tpl +++ b/templates/de/html/js/js_surfbar_stopped.tpl @@ -1,5 +1,5 @@ var interval = null; -var countDown = "$content[restart]"; +var countDown = "$content[restart]"; var timer = document.getElementById("surfbar_counter"); var buttonDiv = document.getElementById("surfbar_button"); diff --git a/templates/de/html/surfbar/surfbar_frame_stats.tpl b/templates/de/html/surfbar/surfbar_frame_stats.tpl index 56d990f74a..7f946266aa 100644 --- a/templates/de/html/surfbar/surfbar_frame_stats.tpl +++ b/templates/de/html/surfbar/surfbar_frame_stats.tpl @@ -2,12 +2,12 @@
Guthaben: {%pipe,translateComma=$content[points]%} {?POINTS?} - - Jetzt Online: {%pipe,SURFBAR_DETERMINE_TOTAL_ONLINE%} - - Seitenaufrufe: Heute:{%config,translateComma=surfbar_daily_counter%} - - Gestern:{%config,translateComma=surfbar_yester_counter%} - - Woche:{%config,translateComma=surfbar_weekly_counter%} - - Monat:{%config,translateComma=surfbar_monthly_counter%} - - Gesamt:{%config,translateComma=surfbar_total_counter%} + Jetzt Online: {%pipe,SURFBAR_DETERMINE_TOTAL_ONLINE%} - + Seitenaufrufe: Heute:{%config,translateComma=surfbar_daily_counter%} - + Gestern:{%config,translateComma=surfbar_yester_counter%} - + Woche:{%config,translateComma=surfbar_weekly_counter%} - + Monat:{%config,translateComma=surfbar_monthly_counter%} - + Gesamt:{%config,translateComma=surfbar_total_counter%}
diff --git a/templates/de/html/surfbar/surfbar_frame_textlinks.tpl b/templates/de/html/surfbar/surfbar_frame_textlinks.tpl index 5aafa18023..6ddacb2fb1 100644 --- a/templates/de/html/surfbar/surfbar_frame_textlinks.tpl +++ b/templates/de/html/surfbar/surfbar_frame_textlinks.tpl @@ -1,7 +1,7 @@
- Jetzt Online: {%pipe,SURFBAR_DETERMINE_TOTAL_ONLINE%} - + Jetzt Online: {%pipe,SURFBAR_DETERMINE_TOTAL_ONLINE%} - Ihr Textlink hier? - Ihr Textlink hier? - diff --git a/templates/de/html/surfbar/surfbar_frame_top.tpl b/templates/de/html/surfbar/surfbar_frame_top.tpl index 5ac130021b..6574dedf7f 100644 --- a/templates/de/html/surfbar/surfbar_frame_top.tpl +++ b/templates/de/html/surfbar/surfbar_frame_top.tpl @@ -4,7 +4,7 @@
»$content[xxx]=$content[xxx] {?POINTS?} in - $content[xxx] + $content[xxx] Sekunden« »X von X im Reload« diff --git a/templates/de/html/surfbar/surfbar_stopped.tpl b/templates/de/html/surfbar/surfbar_stopped.tpl index 0631f355b1..74c27aa545 100644 --- a/templates/de/html/surfbar/surfbar_stopped.tpl +++ b/templates/de/html/surfbar/surfbar_stopped.tpl @@ -6,7 +6,7 @@
Keine URLs mehr verfügbar oder Datenbankfehler liegt vor.
- Neustart in $content[start] Sekunden + Neustart in $content[start] Sekunden
diff --git a/theme/business/css/surfbar.css b/theme/business/css/surfbar.css index 7338f48b98..c6f5adf594 100644 --- a/theme/business/css/surfbar.css +++ b/theme/business/css/surfbar.css @@ -10,7 +10,7 @@ } -#surfbar_counter { +.surfbar_counter { } diff --git a/theme/default/css/surfbar.css b/theme/default/css/surfbar.css index afbd84ed13..5d1f23247c 100644 --- a/theme/default/css/surfbar.css +++ b/theme/default/css/surfbar.css @@ -14,7 +14,7 @@ } -#surfbar_counter { +.surfbar_counter { } diff --git a/theme/desert/css/surfbar.css b/theme/desert/css/surfbar.css index 413f6d481b..8706ca5cb0 100644 --- a/theme/desert/css/surfbar.css +++ b/theme/desert/css/surfbar.css @@ -14,11 +14,11 @@ } -#surfbar_counter { +.surfbar_counter { } -#surfar_counter_word { +#surfbar_counter_word { } @@ -32,4 +32,4 @@ #surfbar_points { font-weight: bold; -} \ No newline at end of file +} diff --git a/theme/org/css/surfbar.css b/theme/org/css/surfbar.css index bcf9250285..c6f5adf594 100644 --- a/theme/org/css/surfbar.css +++ b/theme/org/css/surfbar.css @@ -10,7 +10,7 @@ } -#surfbar_counter { +.surfbar_counter { } @@ -32,4 +32,4 @@ #surfbar_points { font-weight: bold; -} \ No newline at end of file +} -- 2.39.5