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 f93f232da85b8cd0de841a457a428ca7d0d54499..60f5bfe0fc4b3520b751c2ff428a259eed99fc19 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 d703948c98a4c55732acb9f2048cd3d5d60bb4a4..c18c0adaa1e78ed87cf76c30fa766005b296344e 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 4934f2a78ce3d958a5914ad9a842c666c47a73ae..52f103d50be8d4b7b14b43f77775940b332df054 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 fc0eb66b93419d760619a5d43b6d0e13bec3dd94..1c8c17f75932906b4ddee5d96495909d0ab2ac69 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 3378375c5fd0cc65091cb4c1a848d5082769bef4..1c93328607e512815a58064dc930cd8adfbda886 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 2ddd254bdf16d629c5d6b5d2bf280f637b2cafbf..7b9bb2893139ba6c7506e2c8530aa1a2ad1b582d 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 df40ef0d65e9ea9caa5b8d0686909c58056b41b5..26d0bafc5a4533f87a0c095a510cacd14dd94d43 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 96a721c987ef45babc8eb83b2531e695b45023dc..37411a49e92b18858ec6f22d3e44b4efccf5c4b0 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 cad4041102b53c878eabec7afab8a4cbf257db91..09cf5c39e0770511f83e80e05d6afe17ffdadc8a 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 809fda2563c617ad79a660d61af1799b6e33f0d5..b0300dbcf0c790030776f9eb93215261d6e4a7c3 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 cd2aba8ba11613ea587c8ac7e292ffc5f75b50c5..84dceb8851ee22b5f5e049f6657c6f9be3ed2d7c 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 a9ffe4f708c19ae0b3de23532af8fca1c17220f5..27c2a9a3aef063dd1679d4717c665388aa7146f7 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 09373597f1b5e8b1e8aed563caeca0264cfda4e3..601137807380afd475edfebdc27761db630a832f 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 303357540f341bbb2ec962a500dc3c2f17865d46..e3aefafe1592d580e46fec486e96de5a05d6be1d 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 267e31f130413321c1220e98e3c235ddfb5a977d..dda93148414da790f133d2cf8866469da613b7fe 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 20d763be3c144dd587a1f5c8b7a62bc390bae3bd..fe10b6e4f6b08509af44c8bb237540bc3b9ca8e5 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--}