From 7cfec287d338c5b3af01b1a79881302505b3a795 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 27 Sep 2010 12:35:24 +0000 Subject: [PATCH] Empty module added, 2 internal TODOs closed - Empty module for ext-booking added - Internal TODOs closed: Rewrite some array elements, rewrite SQL_FETCHROW() to SQL_FETCHARRAY() - TODOs.txt updated --- .gitattributes | 1 + DOCS/TODOs.txt | 10 ++-- inc/extensions/ext-booking.php | 1 + inc/loader/load_cache- | 2 +- inc/modules/member/what-booking.php | 49 +++++++++++++++++++ inc/modules/member/what-transfer.php | 34 ++++++------- .../de/html/member/member_transfer_row.tpl | 2 +- 7 files changed, 71 insertions(+), 28 deletions(-) create mode 100644 inc/modules/member/what-booking.php diff --git a/.gitattributes b/.gitattributes index d08344b75d..554eb648f6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -569,6 +569,7 @@ inc/modules/member/what-bank_withdraw.php -text svneol=unset#text/plain inc/modules/member/what-beg.php -text svneol=unset#text/plain inc/modules/member/what-beg2.php -text svneol=unset#text/plain inc/modules/member/what-bonus.php -text svneol=unset#text/plain +inc/modules/member/what-booking.php -text svneol=unset#text/plain inc/modules/member/what-categories.php -text svneol=unset#text/plain inc/modules/member/what-doubler.php -text svneol=unset#text/plain inc/modules/member/what-guest.php -text svneol=unset#text/plain diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 3135e5d234..ef407804c6 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -33,7 +33,7 @@ ./inc/extensions/ext-network.php:37: * @TODO Yoo!Media: What is LayerAd compared to Layer click? * ./inc/extensions/ext-network.php:91: // @TODO network_type_handle is an internal name and needs documentation ./inc/extensions/ext-newsletter.php:218: // @TODO Move these into configuration -./inc/extensions/ext-order.php:342: // @TODO This should be moved out to inc/reset/ +./inc/extensions/ext-order.php:335: // @TODO This should be moved out to inc/reset/ ./inc/extensions/ext-rallye.php:329: // @TODO Move this code into rallye_functions.php ./inc/extensions/ext-rallye.php:92: // @TODO Fix config_rallye_prices to list_rallye_prices ./inc/extensions/ext-yoomedia.php:121: // @TODO Can this be moved into a database table? @@ -53,7 +53,7 @@ ./inc/language/de.php:1104:// @TODO Rewrite these three constants ./inc/language/de.php:286: // @TODO Following two are unused? ./inc/language/de.php:789:// @TODO Are these constants longer used? -./inc/language-functions.php:232: // @TODO These are all valid languages, again hard-coded +./inc/language-functions.php:241: // @TODO These are all valid languages, again hard-coded ./inc/language-functions.php:44:// @TODO Rewrite all language constants to this function. ./inc/language/newsletter_de.php:13: * @TODO This language file is completely out-dated, please do no * ./inc/language/rallye_de.php:13: * @TODO Naming convention not applied for language strings * @@ -92,8 +92,8 @@ ./inc/libs/yoomedia_functions.php:114: $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_cache-extension.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php * -./inc/module-functions.php:225: // @TODO Nothing helped??? -./inc/module-functions.php:266: // @TODO Rewrite this to a filter +./inc/module-functions.php:267: // @TODO Nothing helped??? +./inc/module-functions.php:308: // @TODO Rewrite this to a filter ./inc/modules/admin/admin-inc.php:262: // @TODO Rewrite this to $content = SQL_FETCHARRAY() ./inc/modules/admin/admin-inc.php:267: // @TODO ACL is 'allow'... hmmm ./inc/modules/admin/admin-inc.php:333: // @TODO Rewrite this to $content = SQL_FETCHARRAY() @@ -169,8 +169,6 @@ ./inc/modules/member/what-reflinks.php:52:// @TODO Move this into a filter ./inc/modules/member/what-transfer.php:130: // @TODO Rewrite this to a filter ./inc/modules/member/what-transfer.php:220: // @TODO Try to rewrite his to $content = SQL_FETCHARRAY(), see some lines above for two different queries -./inc/modules/member/what-transfer.php:302: // @TODO This should be somehow rewritten to $row = SQL_FETCHARRAY(), see switch() block above for SQL queries -./inc/modules/member/what-transfer.php:308: // @TODO Rewrite: tid->trans_id,stamp->time_trans ./inc/modules/member/what-transfer.php:92: // @TODO Rewrite this to a filter ./inc/modules/member/what-unconfirmed.php:141: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() ./inc/modules/member/what-unconfirmed.php:206: // @TODO This 'userid' cannot be saved because of encapsulated EL code diff --git a/inc/extensions/ext-booking.php b/inc/extensions/ext-booking.php index 2e530227ce..e201416f83 100644 --- a/inc/extensions/ext-booking.php +++ b/inc/extensions/ext-booking.php @@ -63,6 +63,7 @@ switch (getExtensionMode()) { `subject` VARCHAR(255) NOT NULL DEFAULT 'missing', `mode` ENUM('add','sub') NOT NULL DEFAULT 'add', `points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.0000, +`recorded` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, INDEX (`userid`), PRIMARY KEY (`id`) ) TYPE={?_TABLE_TYPE?} COMMENT='Member points booking table'"); diff --git a/inc/loader/load_cache- b/inc/loader/load_cache- index d874649834..e8ce4032e5 100644 --- a/inc/loader/load_cache- +++ b/inc/loader/load_cache- @@ -55,7 +55,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('foo')) && ($GLOBALS['cache_insta $add = runFilterChain('sql_admin_extra_data'); // Query the database about this - $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_table` ORDER BY `some_column` ASC', __FILE__, __LINE__); + $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_foos` ORDER BY `some_bar` ASC', __FILE__, __LINE__); while ($dummy = SQL_FETCHARRAY($result)) { // Save row $GLOBALS['cache_instance']->addRow($dummy); diff --git a/inc/modules/member/what-booking.php b/inc/modules/member/what-booking.php new file mode 100644 index 0000000000..af404ee4ef --- /dev/null +++ b/inc/modules/member/what-booking.php @@ -0,0 +1,49 @@ + diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php index 0970463dd0..b5b2ad4772 100644 --- a/inc/modules/member/what-transfer.php +++ b/inc/modules/member/what-transfer.php @@ -123,7 +123,7 @@ switch ($mode) { $TEST_NICK_REC = $content['recipient']['nickname']; // Default is userids for subject line - $SENDER = getMemberId(); + $SENDER = getMemberId(); $RECIPIENT = bigintval(postRequestParameter('to_userid')); // If nickname is installed we can set the nickname @@ -131,11 +131,11 @@ switch ($mode) { if (isExtensionActive('nickname')) { if (($TEST_NICK_SENDER != getMemberId()) && (!empty($TEST_NICK_SENDER))) { $SENDER = $content['sender']['nickname']; - } + } // END - if if (($TEST_NICK_REC != postRequestParameter('to_userid')) && (!empty($TEST_NICK_REC))) { $RECIPIENT = $content['recipient']['nickname']; - } + } // END - if } // END - if // Remember transfer reason and fancy date/time in constants @@ -146,13 +146,13 @@ switch ($mode) { $content['trans_id'] = bigintval(generateRandomCode('10', mt_rand(0, 99999), getMemberId(), postRequestParameter('reason'))); // Add entries to both tables - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_transfers_in` (`userid`, `from_userid`, `points`, `reason`, `time_trans`, `trans_id`) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP(),'%s')", + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_transfers_in` (`userid`, `from_userid`, `points`, `reason`, `time_trans`, `trans_id`) VALUES (%s,%s,%s,'%s', UNIX_TIMESTAMP(),%s)", array(bigintval(postRequestParameter('to_userid')), getMemberId(), bigintval(postRequestParameter('points')), postRequestParameter('reason'), $content['trans_id']), __FILE__, __LINE__); - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_transfers_out` (`userid`, `to_userid`, `points`, `reason`, `time_trans`, `trans_id`) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP(),'%s')", + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_transfers_out` (`userid`, `to_userid`, `points`, `reason`, `time_trans`, `trans_id`) VALUES (%s,%s,%s,'%s', UNIX_TIMESTAMP(),%s)", array(getMemberId(), bigintval(postRequestParameter('to_userid')), bigintval(postRequestParameter('points')), postRequestParameter('reason'), $content['trans_id']), __FILE__, __LINE__); // Add points to account *directly* ... - addPointsDirectly('member_transfer', bigintval(postRequestParameter('to_userid')), bigintval(postRequestParameter('points'))); + addPointsDirectly('transfer', bigintval(postRequestParameter('to_userid')), bigintval(postRequestParameter('points'))); // ... and add it to current user's used points subtractPoints('transfer', getMemberId(), postRequestParameter('points')); @@ -299,26 +299,20 @@ switch ($mode) { // Do we have entries? if (!SQL_HASZERONUMS($result)) { $OUT = ''; - // @TODO This should be somehow rewritten to $row = SQL_FETCHARRAY(), see switch() block above for SQL queries - while (list($tid, $userid, $points, $reason, $stamp) = SQL_FETCHROW($result)) { - // Rewrite points - if ($type == 'OUT') $points = $points . '-'; + while ($content = SQL_FETCHARRAY($result)) { + // Rewrite points, out is subtracted + if ($type == 'OUT') { + $content['points'] = $content['points'] * -1; + } // END - if // Prepare content for template - // @TODO Rewrite: tid->trans_id,stamp->time_trans - $row = array( - 'trans_id' => $tid, - 'stamp' => generateDateTime($stamp, 3), - 'userid' => $userid, - 'reason' => $reason, - 'points' => $points - ); + $$content['time_trans'] = generateDateTime($content['time_trans'], 3); // Load row template - $OUT .= loadTemplate('member_transfer_row2', true, $row); + $OUT .= loadTemplate('member_transfer_row2', true, $content); // Add points and switch color - $totalPoints += $points; + $totalPoints += $content['points']; } // END - while // Free memory diff --git a/templates/de/html/member/member_transfer_row.tpl b/templates/de/html/member/member_transfer_row.tpl index c187488181..ea95d1cb0a 100644 --- a/templates/de/html/member/member_transfer_row.tpl +++ b/templates/de/html/member/member_transfer_row.tpl @@ -3,7 +3,7 @@
$content[trans_id]
-
$content[time]
+
$content[time_trans]
$content[party_userid]
-- 2.39.5