From 992a3780f0517a61d548bbcaa5b538cb3822815a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 21 Jul 2010 00:21:38 +0000 Subject: [PATCH] New template helper function doTemplateExtensionRegistrationLink() introduced --- inc/expression-functions.php | 11 ++++++++- inc/modules/admin/overview-inc.php | 5 +--- inc/modules/admin/what-extensions.php | 4 +++- inc/modules/admin/what-list_task.php | 5 +--- inc/template-functions.php | 15 ++++++++++++ mailid.php | 12 +++++++--- mailid_top.php | 6 +++-- .../html/admin/admin_extension_reg_form.tpl | 2 +- .../html/admin/admin_list_task_ext2_rows.tpl | 24 +------------------ .../html/admin/admin_list_task_ext_rows.tpl | 2 +- .../admin/admin_overview_list_ext_rows.tpl | 2 +- 11 files changed, 47 insertions(+), 41 deletions(-) diff --git a/inc/expression-functions.php b/inc/expression-functions.php index b5f92fc07d..9f309b9d86 100644 --- a/inc/expression-functions.php +++ b/inc/expression-functions.php @@ -303,7 +303,16 @@ function doExpressionMessage ($data) { function doExpressionTemplate ($data) { // Do the replacement //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template='.$GLOBALS['current_template']); - $replacer = '{DQUOTE} . doTemplate' . $data['callback'] . "('" . $GLOBALS['current_template'] . "', true) . {DQUOTE}"; + $replacer = '{DQUOTE} . doTemplate' . $data['callback'] . "('" . $GLOBALS['current_template'] . "', true"; + + // Is 'value' set? + if (!empty($data['value'])) { + // Then include it as well + $replacer .= ", '" . $data['value'] . "'"; + } // END - if + + // Replacer is ready + $replacer .= ') . {DQUOTE}'; // Replace the code $code = replaceExpressionCode($data, $replacer); diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index c0fc4eef70..39aa0dcc48 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -447,12 +447,9 @@ LIMIT 1", $content['task_created'] = generateDateTime($content['task_created'], 2); // Do we have extension task? - if ((isExtensionTask($content)) && (isExtensionProductive($content['infos']))) { + if (isExtensionTask($content)) { // Load extension row template $OUT .= loadTemplate('admin_overview_list_ext_rows', true, $content); - } elseif ((isExtensionTask($content)) && (!isExtensionProductive($content['infos']))) { - // Load extension row template - $OUT .= loadTemplate('admin_overview_list_ext2_rows', true, $content); } else { // Load default row template $OUT .= loadTemplate('admin_overview_list_rows', true, $content); diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index 5001a82579..9df38198ab 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -50,7 +50,9 @@ $do = 'overview'; if (isGetRequestParameterSet('reg_ext')) { // We are about to register a new extension - $do = 'register'; $taskId = bigintval(getRequestParameter('reg_ext')); + $do = 'register'; + $taskId = determineExtensionTaskId(getRequestParameter('reg_ext')); + // The id comes from task management and it is - of course - *not* the extension's name! } elseif ((isFormSent('change')) && (ifPostContainsSelections()) && (!isDemoModeActive())) { // De-/activate extensions diff --git a/inc/modules/admin/what-list_task.php b/inc/modules/admin/what-list_task.php index aba8d887a8..dc82a683bd 100644 --- a/inc/modules/admin/what-list_task.php +++ b/inc/modules/admin/what-list_task.php @@ -176,12 +176,9 @@ ORDER BY )); // Do we have an extension task? - if ((isExtensionTask($content)) && (isExtensionProductive($content['infos']))) { + if (isExtensionTask($content)) { // Load extension row template $OUT .= loadTemplate('admin_list_task_ext_rows', true, $content); - } elseif ((isExtensionTask($content)) && (!isExtensionProductive($content['infos']))) { - // Load extension row template - $OUT .= loadTemplate('admin_list_task_ext2_rows', true, $content); } else { // Load default row template $OUT .= loadTemplate('admin_list_task_rows', true, $content); diff --git a/inc/template-functions.php b/inc/template-functions.php index 77fb6bf78b..8f1a88c2dc 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -101,6 +101,21 @@ function doTemplateColorSwitch ($template, $clear = false, $return = true) { } // END - if } +// Helper function for extension registration link +function doTemplateExtensionRegistrationLink ($template, $dummy, $ext_name) { + // Default is all productive + $OUT = '{--ADMIN_REGISTER_EXTENSION--}'; + + // Is the given extension non-productive? + if (!isExtensionProductive($ext_name)) { + // Non-productive code + $OUT = '{--ADMIN_EXTENSION_IS_NON_PRODUCTIVE_LINK--}'; + } // END - if + + // Return code + return $OUT; +} + // Init color switch function initTemplateColorSwitch ($template) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'INIT:' . $template); diff --git a/mailid.php b/mailid.php index d0c4dbf7d7..b7d50bf0b4 100644 --- a/mailid.php +++ b/mailid.php @@ -77,12 +77,14 @@ if ((isValidUserId($url_userid)) && (($url_mid > 0) || ($url_bid > 0)) && (!ifFa // Normal-Mails $result_link = SQL_QUERY_ESC("SELECT `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1", array($url_mid, $url_userid), __FILE__, __LINE__); - $type = 'mailid'; $urlId = $url_mid; + $type = 'mailid'; + $urlId = $url_mid; } elseif ($url_bid > 0) { // Bonus-Mail $result_link = SQL_QUERY_ESC("SELECT `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1", array($url_bid, $url_userid), __FILE__, __LINE__); - $type = 'bonusid'; $urlId = $url_bid; + $type = 'bonusid'; + $urlId = $url_bid; } else { // Problem: No id entered redirectToUrl('modules.php?module=index'); @@ -175,7 +177,11 @@ if ((isValidUserId($url_userid)) && (($url_mid > 0) || ($url_bid > 0)) && (!ifFa // Was that mail a valid one? if ($isValid === true) { // If time is zero seconds we have a sponsor mail. 1 Second shall be set to avoid problems - if (($time == '0') && ($payment > 0)) { $URL = getUrl(); $time = 1; } + if (($time == '0') && ($payment > 0)) { + $URL = getUrl(); + $time = 1; + } // END - if + if (($time > 0) && (($payment > 0) || ($points > 0))) { // Export data into constants for the template $content = array( diff --git a/mailid_top.php b/mailid_top.php index ba47505ab9..5c4b8afecb 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -82,11 +82,13 @@ if ((isValidUserId($url_userid)) && (($url_mid > 0) || ($url_bid > 0)) && (!ifFa if ($url_mid > 0) { $result_main = 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_userid), __FILE__, __LINE__); - $type = 'mailid'; $urlId = $url_mid; + $type = 'mailid'; + $urlId = $url_mid; } elseif ($url_bid > 0) { $result_main = 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_userid), __FILE__, __LINE__); - $type = 'bonusid'; $urlId = $url_bid; + $type = 'bonusid'; + $urlId = $url_bid; } if (SQL_NUMROWS($result_main) == 1) { diff --git a/templates/de/html/admin/admin_extension_reg_form.tpl b/templates/de/html/admin/admin_extension_reg_form.tpl index 44d772e387..7d981c2758 100644 --- a/templates/de/html/admin/admin_extension_reg_form.tpl +++ b/templates/de/html/admin/admin_extension_reg_form.tpl @@ -1,4 +1,4 @@ -
+
diff --git a/templates/de/html/admin/admin_list_task_ext2_rows.tpl b/templates/de/html/admin/admin_list_task_ext2_rows.tpl index da5f5936c8..11f5d85d80 100644 --- a/templates/de/html/admin/admin_list_task_ext2_rows.tpl +++ b/templates/de/html/admin/admin_list_task_ext2_rows.tpl @@ -1,23 +1 @@ - - - - - - {%pipe,generateAdminLink=$content[assigned_admin]%} - - - {--ADMIN_EXTENSION_IS_NON_PRODUCTIVE_LINK--} - - - {%pipe,fixEmptyContentToDashes=$content[infos]%} - - - $content[userid] - - - $content[task_type_msg] - - - $content[task_created] - - + diff --git a/templates/de/html/admin/admin_list_task_ext_rows.tpl b/templates/de/html/admin/admin_list_task_ext_rows.tpl index da740827c6..fcc88cf5a6 100644 --- a/templates/de/html/admin/admin_list_task_ext_rows.tpl +++ b/templates/de/html/admin/admin_list_task_ext_rows.tpl @@ -6,7 +6,7 @@ {%pipe,generateAdminLink=$content[assigned_admin]%} - {--ADMIN_REGISTER_EXTENSION--} + {%template,ExtensionRegistrationLink=$content[infos]%} {%pipe,fixEmptyContentToDashes=$content[infos]%} diff --git a/templates/de/html/admin/admin_overview_list_ext_rows.tpl b/templates/de/html/admin/admin_overview_list_ext_rows.tpl index d6f07292b6..543ddae0be 100644 --- a/templates/de/html/admin/admin_overview_list_ext_rows.tpl +++ b/templates/de/html/admin/admin_overview_list_ext_rows.tpl @@ -6,7 +6,7 @@ {%pipe,generateAdminLink=$content[assigned_admin]%} - {--ADMIN_REGISTER_EXTENSION--} + {%template,ExtensionRegistrationLink=$content[infos]%} {%pipe,fixEmptyContentToDashes=$content[infos]%} -- 2.39.5