earning_name renamed to earning_provider
authorRoland Häder <roland@mxchange.org>
Fri, 5 Aug 2011 07:43:47 +0000 (07:43 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 5 Aug 2011 07:43:47 +0000 (07:43 +0000)
17 files changed:
.gitattributes
inc/db/lib.php
inc/extensions/ext-earning.php
inc/extensions/ext-forced.php
inc/filter/earning_filter.php
inc/filter/forced_filter.php
inc/functions.php
inc/language/earning_de.php
inc/language/forced_de.php
inc/libs/earning_functions.php
inc/libs/forced_functions.php
inc/modules/admin/what-list_forced_campaigns.php [new file with mode: 0644]
inc/modules/member/what-earning.php
inc/xml-functions.php
templates/de/html/member/member_earning_data_invalid.tpl
templates/de/html/member/member_earning_popup_form_row.tpl
templates/de/html/member/member_earning_popup_row.tpl

index f93f232..60f5bfe 100644 (file)
@@ -533,6 +533,7 @@ inc/modules/admin/what-list_coupon.php svneol=native#text/plain
 inc/modules/admin/what-list_doubler.php svneol=native#text/plain
 inc/modules/admin/what-list_email_max_rec.php svneol=native#text/plain
 inc/modules/admin/what-list_forced_ads.php svneol=native#text/plain
+inc/modules/admin/what-list_forced_campaigns.php svneol=native#text/plain
 inc/modules/admin/what-list_holiday.php svneol=native#text/plain
 inc/modules/admin/what-list_links.php svneol=native#text/plain
 inc/modules/admin/what-list_network_api_translation.php svneol=native#text/plain
index d703948..c18c0ad 100644 (file)
@@ -48,7 +48,7 @@ if (isIncludeReadable($inc)) {
        loadIncludeOnce($inc);
 } else {
        // Bye, bye...
-       die('Cannot load database abstraction layer <u>' . getConfig('_DB_TYPE') . '</u> -&gt; R.I.P.');
+       debug_report_bug(__FILE__, __LINE__, 'Cannot load database abstraction layer <u>' . getConfig('_DB_TYPE') . '</u> -&gt; R.I.P.');
 }
 
 // [EOF]
index 4934f2a..52f103d 100644 (file)
@@ -62,10 +62,10 @@ switch (getExtensionMode()) {
                addCreateTableSql('earning_data', "
 `earning_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `earning_group` VARCHAR(255) NOT NULL DEFAULT 'INVALID',
-`earning_name` VARCHAR(255) NOT NULL DEFAULT 'INVALID',
+`earning_provider` VARCHAR(255) NOT NULL DEFAULT 'INVALID',
 `earning_sorting` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 PRIMARY KEY (`earning_id`),
-UNIQUE `earning_group_name` (`earning_group`,`earning_name`)",
+UNIQUE `earning_group_name` (`earning_group`,`earning_provider`)",
                        'Registered (extra) earnings');
 
                // User->earnings connection table
index fc0eb66..1c8c17f 100644 (file)
@@ -134,7 +134,7 @@ INDEX (`forced_stats_userid`)",
                addMemberMenuSql('extras', 'book_forced', 'Forced-Kampagne buchen', 3);
 
                // Register Forced-PopUps with earning_data table
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_earning_data` (`earning_group`,`earning_name`,`earning_sorting`) VALUES ('POPUP','FORCED_POPUP',1)");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_earning_data` (`earning_group`,`earning_provider`,`earning_sorting`) VALUES ('POPUP','FORCED_POPUP',1)");
 
                // Register filters
                registerFilter('add_forced_ads_types', 'FORCED_AD_TYPE_DEFAULTS', false, true, isExtensionDryRun());
@@ -152,8 +152,11 @@ INDEX (`forced_stats_userid`)",
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='forced'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` IN ('forced_banner','forced_textlink','book_forced') LIMIT 3");
 
-               // Unregister Forced-PopUps from earning_data
-               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_earning_data` WHERE `earning_name`='FORCED_POPUP' LIMIT 1");
+               // Is earning_data there?
+               if (isSqlTableCreated('earning_data')) {
+                       // Unregister Forced-PopUps from earning_data
+                       addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_earning_data` WHERE `earning_provider`='FORCED_POPUP' LIMIT 1");
+               } // END - if
 
                // Remove filter
                unregisterFilter(__FUNCTION__, __LINE__, 'add_forced_ads_types', 'FORCED_AD_TYPE_DEFAULTS', true, isExtensionDryRun());
index 3378375..1c93328 100644 (file)
@@ -52,7 +52,7 @@ function FILTER_ADD_EARNING_GROUP_POPUP ($filterData) {
        // Now check if the user has subscription and amount left
        $result = SQL_QUERY_ESC("SELECT
        d.`earning_id`,
-       d.`earning_name`,
+       d.`earning_provider`,
        u.`earning_current_amount`,
        u.`earning_daily_amount`
 FROM
@@ -80,7 +80,7 @@ ORDER BY
                        $content = merge_array($content, $filterData);
 
                        // Construct callback function name
-                       $callbackName = 'get' . capitalizeUnderscoreString($content['earning_name']) . 'DataByEarningArray';
+                       $callbackName = 'get' . capitalizeUnderscoreString($content['earning_provider']) . 'DataByEarningArray';
 
                        // And call it
                        $content = call_user_func($callbackName, $content);
index 2ddd254..7b9bb28 100644 (file)
@@ -65,11 +65,12 @@ function FILTER_FORCED_AD_TYPE_DEFAULTS ($data) {
 function FILTER_FORCED_POPUP_TABLE_DATA ($filterData) {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
        // Is this the right filter?
-       if ($filterData['earning_name'] == 'FORCED_POPUP') {
+       if ($filterData['earning_provider'] == 'FORCED_POPUP') {
                // Set group
                $filterData['earning_group'] = 'POPUP';
 
                // Get max/min/count of all popups
+               // @TODO This part is unfinished
                //die(__FUNCTION__.':OK!');
        } // END - if
 
index df40ef0..26d0baf 100644 (file)
@@ -2173,7 +2173,7 @@ function handleFieldWithBraces ($field) {
 // Converts a zero or NULL to word 'NULL'
 function makeZeroToNull ($number) {
        // Is it a valid username?
-       if ((!is_null($number)) && ($number > 0)) {
+       if ((!is_null($number)) && (!empty($number)) && ($number > 0)) {
                // Always secure it
                $number = bigintval($number);
        } else {
index 96a721c..37411a4 100644 (file)
@@ -44,7 +44,7 @@ if (!defined('__SECURITY')) {
 addMessages(array(
        // Member strings
        'MEMBER_EARNINGS_404' => "Es wurden noch keine Zusatzverdienste durch die Administratoren eingerichtet. Bitte kommen Sie sp&auml;ter hier erneut vorbei.",
-       'MEMBER_EARNING_POPUP_FORM_TITLE' => "Zusatzverdienst durch PopUps - Kategorie: {%%pipe,translateEarningName=%s%%}",
+       'MEMBER_EARNING_POPUP_FORM_TITLE' => "Zusatzverdienst durch PopUps - Kategorie: {%%pipe,translateEarningProvider=%s%%}",
        'MEMBER_EARNING_ENTER_DAILY_POPUP_AMOUNT' => "Wie viele PopUps wollen Sie im Login t&auml;glich maximal sehen?",
        'MEMBER_EARNING_SUBSCRIBE_SUBMIT' => "Zusatzverdienst aktivieren",
        'MEMBER_EARNING_DATA_MIN_POINTS' => "Mindestens verdienbar:",
@@ -52,7 +52,7 @@ addMessages(array(
        'MEMBER_EARNING_DATA_COUNT' => "Anzahl Verdiensteintr&auml;ge:",
        'MEMBER_EARNING_DATA_EXCLUDE_USERID' => "Ausgeschlossene Mitgliedsnummer:",
        'MEMBER_EARNING_DATA_GROUP' => "Gruppe Zusatzverdienst:",
-       'MEMBER_EARNING_DATA_NAME' => "Bezeichnung Zusatzverdienst:",
+       'MEMBER_EARNING_DATA_PROVIDER' => "Bezeichnung Zusatzverdienst:",
        'MEMBER_EARNING_CHANGE_DAILY_POPUP_AMOUNT' => "&Auml;ndern von t&auml;glich maximal eingeblendeten PopUps:",
        'MEMBER_EARNING_CHANGE_IS_ACTIVE' => "Zusatzverdienst aktiv?",
        'MEMBER_EARNING_POINTS' => "Bereits erzielter Zusatzverdienst:",
index cad4041..09cf5c3 100644 (file)
@@ -68,7 +68,7 @@ addMessages(array(
        'ADMIN_FORCED_ADS_ADDED' => "Hinzugef&uuml;gt",
 
        // Earning names
-       'EARNING_NAME_FORCED_POPUP' => "Forced-PopUp",
+       'EARNING_PROVIDER_FORCED_POPUP' => "Forced-PopUp",
 ));
 
 // [EOF]
index 809fda2..b0300db 100644 (file)
@@ -46,18 +46,18 @@ function translateEarningGroup ($earningGroup) {
 }
 
 // Translates the "earning name" into human-readable
-function translateEarningName ($earningName) {
-       return sprintf("{--EARNING_NAME_%s--}", $earningName);
+function translateEarningProvider ($earningProvider) {
+       return sprintf("{--EARNING_PROVIDER_%s--}", $earningProvider);
 }
 
 /*
  * Generates a table (with templates) to display data for extra earnings (to
  * the member) by given "earning name".
  *
- * @param      $earningName    Name of the earning
+ * @param      $earningProvider        Name of the earning
  * @return     $output                 Generated HTML output
  */
-function generateMemberEarningDataTable ($earningName) {
+function generateMemberEarningDataTable ($earningProvider) {
        // Init array for filter
        $filterData = array(
                // Minimum points to get
@@ -72,7 +72,7 @@ function generateMemberEarningDataTable ($earningName) {
                // "earning group"
                'earning_group'          => 'INVALID',
                // "earning name" again
-               'earning_name'           => $earningName
+               'earning_provider'       => $earningProvider
        );
 
        // Run the filter chain to get the data
index cd2aba8..84dceb8 100644 (file)
@@ -54,8 +54,12 @@ function doTemplateForcedAdTypeSelectionBox ($templateName, $clear = false, $def
 
 // Translate the status IN/OUT
 function translateForcedAdType ($status) {
-       // Is the status empty?
-       if (empty($status)) {
+       // Is the status null or empty?
+       if (is_null($status)) {
+               // Is NULL
+               $status = 'NULL';
+       } elseif (empty($status)) {
+               // Is empty (string)
                $status = 'EMPTY';
        } // END - if
 
@@ -77,7 +81,7 @@ function translateForcedAdType ($status) {
 
 // "Getter" for an array of data from all Forced-PopUps
 function getForcedPopupDataByEarningArray ($content) {
-       die(__FUNCTION__ . ':content=<pre>'.print_r($content,true).'</pre>');
+       debug_report_bug(__FUNCTION__, __LINE__, 'content=' . print_r($content, true));
 }
 
 // [EOF]
diff --git a/inc/modules/admin/what-list_forced_campaigns.php b/inc/modules/admin/what-list_forced_campaigns.php
new file mode 100644 (file)
index 0000000..4656edd
--- /dev/null
@@ -0,0 +1,95 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 08/04/2011 *
+ * ===================                          Last change: 08/04/2011 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-list_forced_campaigns.php                   *
+ * -------------------------------------------------------------------- *
+ * Short description : List/add Forced-Ads                              *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Auflisten/Hinzufuegen von Forced-Werbemitteln    *
+ * -------------------------------------------------------------------- *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+       die();
+} // END - if
+
+// Add description as navigation point
+addYouAreHereLink('admin', __FILE__);
+
+// By default show the list...
+$show = true;
+
+// Check for 'url_id' element
+if ((countRequestPost() > 0) && ((!isPostRequestElementSet('forced_campaigns_id')) || (!is_array(postRequestElement('forced_campaigns_id'))) || (count(postRequestElement('forced_campaigns_id')) == 0))) {
+       // Not found so output message
+       displayMessage('{--ADMIN_FORCED_CAMPAIGNS_NO_SELECTIONS--}');
+
+       // Abort here
+       return;
+} // END - if
+
+// Edit or delete button hit?
+if (isFormSent('add')) {
+       // Add new forced ad
+       showEntriesByXmlCallback('admin_add_do_forced_campaigns');
+} elseif (isFormSent('edit')) {
+       // Show entries for editing
+       showEntriesByXmlCallback('admin_edit_show_forced_campaigns');
+
+       // Do not show the list of URLs after this template
+       $show = false;
+} elseif (isFormSent('do_edit')) {
+       // Change data of entries
+       showEntriesByXmlCallback('admin_edit_do_forced_campaigns');
+} elseif (isFormSent('delete')) {
+       // Show entries for deletion
+       showEntriesByXmlCallback('admin_delete_show_forced_campaigns');
+
+       // Do not show the list of URLs after this template
+       $show = false;
+} elseif (isFormSent('do_delete')) {
+       // Remove entries from database
+       showEntriesByXmlCallback('admin_delete_do_forced_campaigns');
+}
+
+// Show entries?
+if ($show === false) {
+       // No, a form has already been show
+       return false;
+} // END - if
+
+// List all URLs
+showEntriesByXmlCallback('admin_list_forced_campaigns');
+
+// Display form for adding a forced-ad
+loadTemplate('admin_add_forced_campaign');
+
+// [EOF]
+?>
index a9ffe4f..27c2a9a 100644 (file)
@@ -59,7 +59,7 @@ if (isFormSent()) {
 $result = SQL_QUERY('SELECT
        d.`earning_id`,
        d.`earning_group`,
-       d.`earning_name`
+       d.`earning_provider`
 FROM
        `{?_MYSQL_PREFIX?}_earning_data` AS d
 ORDER BY
index 0937359..6011378 100644 (file)
@@ -185,7 +185,9 @@ function xmlCharacterHandler ($resource, $characters) {
                // Nothing to handle
                return;
        } // END - if
-       die('characters[]='.strlen($characters));
+
+       // @TODO Handle characters
+       die(__FUNCTION__ . ':characters[]='.strlen($characters));
 }
 
 // Checks if given type is valid, makes all lower-case
index 3033575..e3aefaf 100644 (file)
@@ -23,8 +23,8 @@
                <strong>{%pipe,translateEarningGroup=$content[earning_group]%}</strong>
        </div>
        <div style="padding-top:3px;padding-bottom:3px" class="bottom">
-               {--MEMBER_EARNING_DATA_NAME--}<br />
-               <strong>{%pipe,translateEarningName=$content[earning_name]%}</strong>
+               {--MEMBER_EARNING_DATA_PROVIDER--}<br />
+               <strong>{%pipe,translateEarningProvider=$content[earning_provider]%}</strong>
        </div>
        <div class="table_footer notice">
                {--MEMBER_EARNING_DATA_INVALID_NOTE--}
index 267e31f..dda9314 100644 (file)
@@ -2,14 +2,14 @@
 <form accept-charset="UTF-8" id="earning_$content[earning_id]" action="{%url=modules.php?module=login&amp;what=earning%}" method="post">
 <div class="table dashed">
 <div class="table_header bottom">
-       <strong>{%message,MEMBER_EARNING_POPUP_FORM_TITLE=$content[earning_name]%}</strong>
+       <strong>{%message,MEMBER_EARNING_POPUP_FORM_TITLE=$content[earning_provider]%}</strong>
 </div>
 <div class="bottom" style="height:25px;padding-top:5px">
        {--MEMBER_EARNING_ENTER_DAILY_POPUP_AMOUNT--}
        <input type="text" class="form_field" name="earning_daily_amount" size="5" maxlength="20" />
 </div>
 <div class="bottom">
-       {%pipe,generateMemberEarningDataTable=$content[earning_name]%}
+       {%pipe,generateMemberEarningDataTable=$content[earning_provider]%}
 </div>
 <div class="table_footer">
        <input type="hidden" name="earning_id" value="$content[earning_id]" />
index 20d763b..fe10b6e 100644 (file)
@@ -2,7 +2,7 @@
 <form accept-charset="UTF-8" id="earning_$content[earning_id]" action="{%url=modules.php?module=login&amp;what=earning%}" method="post">
 <div class="table dashed">
 <div class="table_header bottom">
-       <strong>{%message,MEMBER_EARNING_POPUP_FORM_TITLE=$content[earning_name]%}</strong>
+       <strong>{%message,MEMBER_EARNING_POPUP_FORM_TITLE=$content[earning_provider]%}</strong>
 </div>
 <div class="bottom" style="padding-top:5px;padding-bottom:5px">
        {--MEMBER_EARNING_CHANGE_DAILY_POPUP_AMOUNT--}