Rewritten to make usage of newly introduced math EL code
authorRoland Häder <roland@mxchange.org>
Sat, 24 Jul 2010 02:58:18 +0000 (02:58 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 24 Jul 2010 02:58:18 +0000 (02:58 +0000)
.gitattributes
DOCS/prop-set.sh
inc/expression-functions.php
inc/math-functions.php [new file with mode: 0644]
templates/de/html/admin/admin_add_sponsor.tpl
templates/de/html/guest/guest_sponsor_reg.tpl
templates/de/html/sponsor/sponsor_settings_form.tpl

index f7c06ae41c663821e80df97c46c61371c52a3a4d..abe684db01526e06f08decfec3d9caf32a1059d5 100644 (file)
@@ -336,6 +336,7 @@ inc/mails/_mails.php -text svneol=unset#text/plain
 inc/mails/beg_mails.php -text svneol=unset#text/plain
 inc/mails/bonus_mails.php -text svneol=unset#text/plain
 inc/mails/doubler_mails.php -text svneol=unset#text/plain
+inc/math-functions.php svneol=native#text/plain
 inc/module-functions.php svneol=native#text/plain
 inc/modules/.htaccess -text svneol=unset#text/plain
 inc/modules/admin.php -text svneol=unset#text/plain
index 1df2b4ca7dd928d1a9fbb4d9d157f78cb07eada2..d78be893164487edae02936675d3e1ecc3975a62 100755 (executable)
@@ -13,3 +13,5 @@ find -type f -name "*.png" -exec svn propset svn:mime-type "image/png" {} \;
 find -type f -name "*.gif" -exec svn propset svn:mime-type "image/gif" {} \;
 find -type f -name "*.txt" -exec svn propset svn:mime-type "text/plain" {} \;
 find -type f -name "*.tpl" -exec svn propset svn:mime-type "text/plain" {} \;
+
+find inc/phpmailer/ -type f -name "*.php" -exec svn propdel svn:keywords {} \;
index 6d393659b1f49371ddbfa2a5c03ebb3293402191..47da9de13818aff53d7dc1bfbf76f85613678ac5 100644 (file)
@@ -285,5 +285,21 @@ function doExpressionTemplate ($data) {
        return $code;
 }
 
+// Expression call-back for math functions
+function doExpressionMath ($data) {
+       // Do the replacement
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template='.$GLOBALS['current_template']);
+       $replacer = '{DQUOTE} . doCalculate' . $data['callback'] . '(' . $data['value'] . ') . {DQUOTE}';
+
+       // Replace the code
+       $code = replaceExpressionCode($data, $replacer);
+
+       // Load include once
+       loadIncludeOnce('inc/math-functions.php');
+
+       // Return the (maybe) replaced code
+       return $code;
+}
+
 // [EOF]
 ?>
diff --git a/inc/math-functions.php b/inc/math-functions.php
new file mode 100644 (file)
index 0000000..13d5a36
--- /dev/null
@@ -0,0 +1,58 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 07/24/2010 *
+ * ===================                          Last change: 07/24/2010 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : math-functions.php                               *
+ * -------------------------------------------------------------------- *
+ * Short description : Expression callback functions                    *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Expression-Callback-Funktionen                   *
+ * -------------------------------------------------------------------- *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 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')) {
+       die();
+} // END - if
+
+// Math function for x day(s) in seconds
+function doCalculateDay ($days) {
+       // Calculate it
+       return '{DQUOTE} . (getOneDay() * ' . $days . ') . {DQUOTE}';
+}
+
+// Math function for x weeks(s) in seconds
+function doCalculateWeek ($weeks) {
+       // Calculate it
+       return '{DQUOTE} . (getOneDay() * 7 * ' . $weeks . ') . {DQUOTE}';
+}
+
+// [EOF]
+?>
index 4728050631a3938201c54134aa2e028239b83fc3..61bc5cdbe602f22f0b0aea28611476224b840dd6 100644 (file)
   <td>
     <select name="warning_interval" class="admin_select" size="1">
       <option value="0">{--SELECT_NONE--}</option>
-      <option value="{--({?ONE_DAY?}*1)--}">1 {--DAYS--}</option>
-      <option value="{--({?ONE_DAY?}*3)--}">3 {--DAYS--}</option>
-      <option value="{--({?ONE_DAY?}*7)--}" selected="selected">1 {--LIFE_WEEKS--}</option>
-      <option value="{--({?ONE_DAY?}*14)--}">2 {--LIFE_WEEKS--}</option>
-      <option value="{--({?ONE_DAY?}*28)--}">4 {--LIFE_WEEKS--}</option>
-      <option value="{--({?ONE_DAY?}*56)--}">8 {--LIFE_WEEKS--}</option>
+      <option value="{%math,Day=1%}">1 {--DAYS--}</option>
+      <option value="{%math,Day=3%}">3 {--DAYS--}</option>
+      <option value="{%math,Week=1)%}" selected="selected">1 {--LIFE_WEEKS--}</option>
+      <option value="{%math,Week=2)%}">2 {--LIFE_WEEKS--}</option>
+      <option value="{%math,Week=4)%}">4 {--LIFE_WEEKS--}</option>
+      <option value="{%math,Week=8)%}">8 {--LIFE_WEEKS--}</option>
     </select>
   </td>
 </tr>
index e783c4e9acdc3f3e3bb1e373dc3c85241024158c..67dc40c24870664ba8137f1a5f88a52fc2c3cf1d 100644 (file)
   <td class="bottom">
     <select name="warning_interval" class="guest_select" size="1">
       <option value="0">{--SELECT_NONE--}</option>
-      <option value="{--({?ONE_DAY?}*1)--}">1 {--DAYS--}</option>
-      <option value="{--({?ONE_DAY?}*3)--}">3 {--DAYS--}</option>
-      <option value="{--({?ONE_DAY?}*7)--}" selected="selected">1 {--LIFE_WEEKS--}</option>
-      <option value="{--({?ONE_DAY?}*14)--}">2 {--LIFE_WEEKS--}</option>
-      <option value="{--({?ONE_DAY?}*28)--}">4 {--LIFE_WEEKS--}</option>
-      <option value="{--({?ONE_DAY?}*56)--}">8 {--LIFE_WEEKS--}</option>
+      <option value="{%math,Day=1%}">1 {--DAYS--}</option>
+      <option value="{%math,Day=3%}">3 {--DAYS--}</option>
+      <option value="{%math,Week=1%}" selected="selected">1 {--LIFE_WEEKS--}</option>
+      <option value="{%math,Week=2%}">2 {--LIFE_WEEKS--}</option>
+      <option value="{%math,Week=4%}">4 {--LIFE_WEEKS--}</option>
+      <option value="{%math,Week=8%}">8 {--LIFE_WEEKS--}</option>
     </select>
   </td>
 </tr>
index b3ac13cf053751967bfd60079e43c30cefc9b7c7..32d0a9949ee4977040459b9646e7fa749bcb9484 100644 (file)
   </td>
   <td class="bottom" align="center">
     <select name="warning_interval" class="guest_select" size="1">
-      <option value="$content[warning_interval]">{%pipe,createFancyTime=$content[current]%}</option>
-      <option value="{--({?ONE_DAY?}*1)--}">1 {--DAYS--}</option>
-      <option value="{--({?ONE_DAY?}*3)--}">3 {--DAYS--}</option>
-      <option value="{--({?ONE_DAY?}*7)--}">1 {--LIFE_WEEKS--}</option>
-      <option value="{--({?ONE_DAY?}*14)--}">2 {--LIFE_WEEKS--}</option>
-      <option value="{--({?ONE_DAY?}*28)--}">4 {--LIFE_WEEKS--}</option>
-      <option value="{--({?ONE_DAY?}*56)--}">8 {--LIFE_WEEKS--}</option>
+      <option value="$content[warning_interval]">{%pipe,createFancyTime=$content[warning_interval]%}</option>
+      <option value="{%math,Day=1%}">1 {--DAYS--}</option>
+      <option value="{%math,Day=3%}">3 {--DAYS--}</option>
+      <option value="{%math,Week=1%}">1 {--LIFE_WEEKS--}</option>
+      <option value="{%math,Week=2%}">2 {--LIFE_WEEKS--}</option>
+      <option value="{%math,Week=4%}">4 {--LIFE_WEEKS--}</option>
+      <option value="{%math,Week=8%}">8 {--LIFE_WEEKS--}</option>
     </select>
   </td>
 </tr>
@@ -35,7 +35,7 @@
   <td class="bottom right" align="right" height="32">
     {--SPONSOR_ENTER_PASSWORD--}:
   </td>
-  <td class="bottom">
+  <td class="bottom" align="center">
     <input type="password" name="password" class="guest_normal" size="10" maxlength="255" />
   </td>
 </tr>