Added support for Thunderball Lucky Dip
Added support for Thunderball Lucky Dip

file:a/helper.php -> file:b/helper.php
--- a/helper.php
+++ b/helper.php
@@ -28,6 +28,58 @@
       return $this->place_request('UserCheck',$game,"ball1=$ball1&ball2=$ball2&ball3=$ball3&ball4=$ball4&ball5=$ball5&ball6=$ball6&ball7=$ball7&draws=$draws");
 
       }
+
+
+
+
+     function generateTBluckydip($number){
+      // Are we using the API or generating on site?
+      if ($this->params->get('useLDAPI')){
+
+      return $this->place_request('TLD','2',"no=$number");
+	  }else{
+
+	// This is not as random as the method use by the API, but someone could still win!
+
+
+	// Generate the numbers
+
+	  $x = 1;
+
+	// Enforce the 10 limit to avoid accidental DoS
+	if ($number > 10){ $number = 10; }
+	 while ($x <= $number){
+	      
+	      $a = 1;
+	      $str = ".";
+		      // Generate 6 numbers
+			while ($a <= 5){
+			    $no = rand(1,39);
+			    if (strpos($str,".". $no . ".") == false){
+			    $str .= $no;
+			    if ($a != 5){ $str .= "."; }
+			    $a++;
+			    }
+			    }
+
+	      // Numbers generated, now add them to an object
+
+	      $str = substr($str,1,strlen($str) - 1);
+	      $balls = explode(".",$str);
+	      sort($balls);
+
+	      $balls[5] = rand(1,14);
+
+	      $LDs["dip$x"] = $balls;
+
+	      $x++;
+	      }
+	return $LDs;
+
+	}
+      }
+
+
 
 
 

file:b/helper.php~ (new)
--- /dev/null
+++ b/helper.php~
@@ -1,1 +1,397 @@
-
+<?php
+/**
+ * @subpackage	mod_lotto
+ * @copyright	Copyright (C) 2012 Ben Tasker . All rights reserved.
+ * @license		GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+
+// no direct access
+defined('_JEXEC') or die;
+
+class modLottoHelper
+{
+	
+function setparams($params){
+$this->params = $params;
+}
+
+function getAPIKey(){
+
+
+return $this->params->get('APIKEY', '9c59922ab287d59d06011a4c91a21fcf');
+
+
+}
+
+      function checkuserResults($game,$draws,$ball1,$ball2,$ball3,$ball4,$ball5,$ball6,$ball7 = null){
+      return $this->place_request('UserCheck',$game,"ball1=$ball1&ball2=$ball2&ball3=$ball3&ball4=$ball4&ball5=$ball5&ball6=$ball6&ball7=$ball7&draws=$draws");
+
+      }
+
+
+
+
+       function generateEuroluckydip($number){
+      // Are we using the API or generating on site?
+      if ($this->params->get('useLDAPI')){
+
+      return $this->place_request('ELD','3',"no=$number");
+	  }else{
+
+	// This is not as random as the method used by the API, but someone could still win!
+
+
+	// Generate the numbers
+
+	  $x = 1;
+
+	// Enforce the 10 limit to avoid accidental DoS
+	if ($number > 10){ $number = 10; }
+	 while ($x <= $number){
+	      
+	      $a = 1;
+	      $str = ".";
+		      // Generate 6 numbers
+			while ($a <= 5){
+			    $no = rand(1,49);
+			    if (strpos($str,".". $no . ".") == false){
+			    $str .= $no;
+			    if ($a != 5){ $str .= "."; }
+			    $a++;
+			    }
+			    }
+
+	      // Numbers generated, now add them to an object
+
+	      $str = substr($str,1,strlen($str) - 1);
+	      $balls = explode(".",$str);
+	      sort($balls);
+	      
+
+	      $star1 = rand(1,11);
+	      $star2 = rand(1,11);
+
+	      while ($star1 == $star2){
+	      $star2 = rand(1,11);
+	      }
+
+	      if ($star1 < $star2){
+
+	    $balls[5] = "$star1";
+	    $balls[6] = "$star2";
+	    }else{
+	    $balls[5] = "$star2";
+	    $balls[6] = "$star1";
+	    }
+
+
+	      $LDs["dip$x"] = $balls;
+
+	      $x++;
+	      }
+	return $LDs;
+
+	}
+      }
+
+
+
+
+
+      function generateLottoluckydip($number){
+      // Are we using the API or generating on site?
+      if ($this->params->get('useLDAPI')){
+
+      return $this->place_request('LD','1',"no=$number");
+	  }else{
+
+	// This is not as random as the method use by the API, but someone could still win!
+
+
+	// Generate the numbers
+
+	  $x = 1;
+
+	// Enforce the 10 limit to avoid accidental DoS
+	if ($number > 10){ $number = 10; }
+	 while ($x <= $number){
+	      
+	      $a = 1;
+	      $str = ".";
+		      // Generate 6 numbers
+			while ($a <= 6){
+			    $no = rand(1,49);
+			    if (strpos($str,".". $no . ".") == false){
+			    $str .= $no;
+			    if ($a != 6){ $str .= "."; }
+			    $a++;
+			    }
+			    }
+
+	      // Numbers generated, now add them to an object
+
+	      $str = substr($str,1,strlen($str) - 1);
+	      $balls = explode(".",$str);
+	      sort($balls);
+
+	      $LDs["dip$x"] = $balls;
+
+	      $x++;
+	      }
+	return $LDs;
+
+	}
+      }
+
+
+      function checklottoresults($month){
+
+      $shortcache = $this->params->get('shortcache') * 60;
+      $shortcache = $this->params->get('longcache') * 60;
+       // Get the config object from factory
+        $conf =& JFactory::getConfig();
+        // Get the current cachetime value
+        $cachetime = $conf->getValue('config.cachetime');
+        
+	$datecheck = strtotime($month."-01");
+	$now = strtotime(date('Y-m')."-01");
+	if ($datecheck < $now){
+	// Looking at historic results, we can cache for much longer
+        $conf->setValue('config.cachetime', $longcache);
+
+	}else{
+	// Set the cache time to 8 hours i.e. 8 * 60 mins
+        $conf->setValue('config.cachetime', $shortcache);
+	}
+
+
+
+        // Get the Cache object
+        $cache =& JFactory::getCache('mod_lotto_latest_results'.$month, 'output');
+        // Enable caching (if disabled in global configuration)
+        $cache->setCaching( 1 );
+        // Try to get the results from cache
+
+
+    if (!($json = $cache->get('mod_lotto_latest_results_json'.$month))) {
+            $uri =& JFactory::getURI();
+            
+           
+            if ($json = $this->place_request('retrieve','1',"month=$month")) {
+                // Store the data in cache
+                if (!$cache->store($json, 'mod_lotto_latest_results_json'.$month)) {
+                    // If storing in cache failed then we will return the error
+                    $error = 'cache';
+                }
+            } else {
+                $error = 'Could not retrieve';
+            }
+        }
+
+return $json;
+
+
+
+
+
+
+
+
+      //return $this->place_request('retrieve','1',"month=$month");
+
+      }
+
+
+function getlatestLottoResults(){
+
+
+
+$shortcache = $this->params->get('shortcache') * 60;
+$str = "draws=" . $this->params->get('LottoResultsDrawDays');
+
+    
+        // Get the config object from factory
+        $conf =& JFactory::getConfig();
+        // Get the current cachetime value
+        $cachetime = $conf->getValue('config.cachetime');
+        // Set the cache time 
+        $conf->setValue('config.cachetime', $shortcache);
+        // Get the Cache object
+        $cache =& JFactory::getCache('mod_lotto_latest_results', 'output');
+        // Enable caching (if disabled in global configuration)
+        $cache->setCaching( 1 );
+        // Try to get the results from cache
+
+
+    if (!($json = $cache->get('mod_lotto_latest_results_json'))) {
+            $uri =& JFactory::getURI();
+            
+           
+            if ($json = $this->place_request('LatestResults','1',$str)) {
+                // Store the data in cache
+                if (!$cache->store($json, 'mod_lotto_latest_results_json')) {
+                    // If storing in cache failed then we will return the error
+                    $error = 'cache';
+                }
+            } else {
+                $error = 'Could not retrieve';
+            }
+        }
+$conf->setValue('config.cachetime', $origcachetime);
+return $json;
+
+}
+
+
+
+function getlatestEuroResults(){
+
+
+
+$shortcache = $this->params->get('shortcache') * 60;
+$str = "draws=" . $this->params->get('EuroResultsDrawDays');
+
+    
+        // Get the config object from factory
+        $conf =& JFactory::getConfig();
+        // Get the current cachetime value
+        $cachetime = $conf->getValue('config.cachetime');
+        // Set the cache time 
+        $conf->setValue('config.cachetime', $shortcache);
+        // Get the Cache object
+        $cache =& JFactory::getCache('mod_lotto_latest_results', 'output');
+        // Enable caching (if disabled in global configuration)
+        $cache->setCaching( 1 );
+        // Try to get the results from cache
+
+
+    if (!($json = $cache->get('mod_lotto_latest_results_euro_json'))) {
+            $uri =& JFactory::getURI();
+            
+           
+            if ($json = $this->place_request('LatestResults','3',$str)) {
+                // Store the data in cache
+                if (!$cache->store($json, 'mod_lotto_latest_results_euro_json')) {
+                    // If storing in cache failed then we will return the error
+                    $error = 'cache';
+                }
+            } else {
+                $error = 'Could not retrieve';
+            }
+        }
+$conf->setValue('config.cachetime', $origcachetime);
+return $json;
+
+}
+
+
+
+
+
+
+function getlatestTBResults(){
+
+$str = "draws=" . $this->params->get('TBResultsDrawDays');
+
+    $shortcache = $this->params->get('shortcache') * 60;
+        // Get the config object from factory
+        $conf =& JFactory::getConfig();
+        // Get the current cachetime value
+        $origcachetime = $conf->getValue('config.cachetime');
+        // Set the cache time to 8 hours i.e. 6 * 60 mins
+        $conf->setValue('config.cachetime', $shortcache);
+        // Get the Cache object
+        $cache =& JFactory::getCache('mod_lotto_latest_results', 'output');
+        // Enable caching (if disabled in global configuration)
+        $cache->setCaching( 1 );
+        // Try to get the results from cache
+
+
+    if (!($json = $cache->get('mod_lotto_latest_results_tb_json'))) {
+            $uri =& JFactory::getURI();
+            
+           
+            if ($json = $this->place_request('LatestResults','2',$str)) {
+                // Store the data in cache
+                if (!$cache->store($json, 'mod_lotto_latest_results_tb_json')) {
+                    // If storing in cache failed then we will return the error
+                    $error = 'cache';
+                }
+            } else {
+                $error = 'Could not retrieve';
+            }
+        }
+$conf->setValue('config.cachetime', $origcachetime);
+
+return $json;
+
+}
+
+
+function place_request($action,$game,$additional = null){
+
+// Cache time is sent so that abuse can be detected and prevented.
+// Site admin will be notified in first instance if they've left cache set at 0
+
+ $shortcache = $this->params->get('shortcache');
+ $longcache = $this->params->get('shortcache');
+
+unset($this->result);
+// Check whether we can use File or if we need to resort to Curl
+if (ini_get('allow_url_fopen')){
+$results = $this->placefilerequest($action,$game,$additional."&shortcache=$shortcache&longcache=$longcache");
+}else{
+$results = $this->placecurlrequest($action,$game,$additional."&shortcache=$shortcache&longcache=$longcache");
+
+}
+
+
+// Process the response
+$X=0;
+foreach ($results as $result){
+
+$result = json_decode($result);
+
+$key = "row$X";
+$this->result->$key = $result;
+$X++;
+}
+
+
+
+
+return $this->result;
+}
+
+
+
+
+
+
+
+
+function placefilerequest($action,$game,$additional = null){
+$key = $this->getAPIKey();
+$results = file("http://api.bentasker.co.uk/lottopredict/?game=$game&action=$action&key=$key&$additional");
+
+return $results;
+}
+
+
+function placecurlrequest($action,$game,$additional){
+$key = $this->getAPIKey();
+ $ch = curl_init("http://api.bentasker.co.uk/lottopredict/?game=$game&action=$action&key=$key&$additional");
+    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ 
+    $data = curl_exec($ch);
+ 
+    curl_close($ch);
+$data = explode("\n",$data);
+
+return $data;
+}
+
+
+}
+

--- a/mod_lotto.xml
+++ b/mod_lotto.xml
@@ -10,7 +10,7 @@
 	<license>GNU General Public License version 2</license>
 	<authorEmail>LottoPredict@bentasker.co.uk</authorEmail>
 	<authorUrl>bentasker.co.uk</authorUrl>
-	<version>1.0</version>
+	<version>1.3</version>
 	<description>A Module designed to show results from the UK National Lottery. Also allows users to generate Lucky Dips and to check their numbers against past draws</description>
 	<!-- Runs on install/uninstall/update; New in 1.6 -->
 	<!--<scriptfile>script.php</scriptfile>-->
@@ -310,6 +310,47 @@
 											
 				</field>
 				
+				
+				
+				
+				
+				<field
+					name="DispTLDs"
+					type="list"
+					default="0"
+					label="Automatically Generate A Lucky Dip"
+					description="Display a Lucky Dip to the user" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				
+				
+				<field
+					name="GenTLDs"
+					type="list"
+					default="0"
+					label="Display Lucky Dip Form"
+					description="Display a form allowing user to generate up to 10 Lucky Dips" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				
+				
+				
 				</fieldset>
 				
 				

file:b/mod_lotto.xml~ (new)
--- /dev/null
+++ b/mod_lotto.xml~
@@ -1,1 +1,499 @@
+<?xml version="1.0" encoding="utf-8"?>
+<extension
+	type="module"
+	version="2.5"
+	client="site"
+	method="upgrade">
+	<name>LottoPredict</name>
+	<author>Ben Tasker</author>
+	<creationDate>July 2012</creationDate>
+	<license>GNU General Public License version 2</license>
+	<authorEmail>LottoPredict@bentasker.co.uk</authorEmail>
+	<authorUrl>bentasker.co.uk</authorUrl>
+	<version>1.0</version>
+	<description>A Module designed to show results from the UK National Lottery. Also allows users to generate Lucky Dips and to check their numbers against past draws</description>
+	<!-- Runs on install/uninstall/update; New in 1.6 -->
+	<!--<scriptfile>script.php</scriptfile>-->
+	<files>
+		<filename module="mod_lotto">mod_lotto.php</filename>
+		<filename>mod_lotto.xml</filename>
+		<folder>tmpl</folder>
+		<folder>assets</folder>
+		<filename>helper.php</filename>
+		
+		<filename>index.html</filename>				
+	</files>
+	<config>
+		<fields name="params">
+			<fieldset name="basic">
+				
+				<field
+					name="Size"
+					type="list"
+					default="small"
+					label="Icon Size"
+					description="The size to use when displaying results" >
+				
+						
+						<option 
+						value="normal">Normal</option>
+						
+						<option 
+						value="small">Small</option>
+						
+						<option 
+						value="xsmall">X-Small</option>
+											
+				</field>
+				
+				
+					<field
+					name="Ballstyle"
+					type="list"
+					default="plain"
+					label="Ball Style"
+					description="Should we use plain or multicoloured balls?" >
+				
+						
+						<option 
+						value="color">Colourful</option>
+						
+						<option 
+						value="plain">Plain</option>
+						
+											
+				</field>
+				
+				
+					<field
+					name="DispPurchaseLink"
+					type="list"
+					default="1"
+					label="Display Purchase Link"
+					description="Display a link allowing the user to buy tickets?" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				
+				
+				<field
+					name="PurchaseLink"
+					type="text"
+					default="http://www.national-lottery.co.uk"
+					size="30"
+					label="Purchase URL"
+					description="Enter the URL to use when directing visitors to purchase tickets (you can use your affiliate ID if you have one)" />
+					
+					
+			
+			
+			</fieldset>
+				
+				
+				<fieldset
+				name="Lotto"
+				label="Lotto"
+				description="Settings relating to Lotto"
+				>
+				
+				
+				<field
+					name="DispLatestLottoResults"
+					type="list"
+					default="1"
+					label="Display Latest Lotto Results"
+					description="Should we display the latest lotto results?" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				
+				
+				
+				
+				<field
+					name="LottoResultsDrawDays"
+					type="list"
+					default="Any"
+					label="Display latest results for"
+					description="Which draw days to show the latest Lotto Results for" >
+				
+						
+						<option 
+						value="Any">Any</option>
+						
+						<option 
+						value="Sun">Sun</option>
 
+						<option 
+						value="Mon">Mon</option>
+						
+						<option 
+						value="Tue">Tue</option>
+						
+						<option 
+						value="Wed">Wed</option>
+						
+						<option 
+						value="Thu">Thu</option>
+						
+						<option 
+						value="Fri">Fri</option>
+						
+						<option 
+						value="Sat">Sat</option>
+						
+											
+				</field>
+				
+				<field
+					name="DispLDs"
+					type="list"
+					default="0"
+					label="Automatically Generate A Lucky Dip"
+					description="Display a Lucky Dip to the user" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				<field
+					name="GenLDs"
+					type="list"
+					default="0"
+					label="Display Lucky Dip Form"
+					description="Display a form allowing user to generate up to 10 Lucky Dips" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				
+					<field
+					name="DispLottoResults"
+					type="list"
+					default="0"
+					label="Display Lotto Results for current month"
+					description="Display results of all Lotto Draws for this month" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				<field
+					name="SelLottoResults"
+					type="list"
+					default="0"
+					label="Allow user to select month for results"
+					description="Display form allowing user to select month to display all Lotto Draw results for" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				<field
+					name="CheckUserLotto"
+					type="list"
+					default="1"
+					label="Check User Numbers"
+					description="Display form allowing user to enter their Lotto Numbers for checking" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				<field
+					name="divWidth"
+					type="Text"
+					default="289"
+					size="30"
+					label="Div Size"
+					description="Width of the coloured div surrounding the number checker in pixels." />
+			
+				
+				
+				</fieldset>
+			
+			
+			<fieldset
+				name="Thunderball"
+				label="Thunderball"
+				description="Settings relating to Thunderball Support"
+				>
+				
+					<field
+					name="DispLatestTBResults"
+					type="list"
+					default="1"
+					label="Display Latest Thunderball Results"
+					description="Should we display the latest Thunderball results?" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				<field
+					name="TBResultsDrawDays"
+					type="list"
+					default="Any"
+					label="Display latest results for"
+					description="Which draw days to show the latest Lotto Results for" >
+				
+						
+						<option 
+						value="Any">Any</option>
+						
+						<option 
+						value="Sun">Sun</option>
+
+						<option 
+						value="Mon">Mon</option>
+						
+						<option 
+						value="Tue">Tue</option>
+						
+						<option 
+						value="Wed">Wed</option>
+						
+						<option 
+						value="Thu">Thu</option>
+						
+						<option 
+						value="Fri">Fri</option>
+						
+						<option 
+						value="Sat">Sat</option>
+						
+											
+				</field>
+				
+				</fieldset>
+				
+				
+					<fieldset
+				name="EuroMillions"
+				label="EuroMillions"
+				description="Settings relating to EuroMillions Results"
+				>
+				
+				<field
+					name="DispLatestEuroResults"
+					type="list"
+					default="1"
+					label="Display Latest Euro Results"
+					description="Should we display the latest EuroMillions results?" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				<field
+					name="EuroResultsDrawDays"
+					type="list"
+					default="Any"
+					label="Display latest results for"
+					description="Which draw days to show the latest EuroMillions Results for" >
+				
+						
+						<option 
+						value="Any">Any</option>
+						
+						<option 
+						value="Sun">Sun</option>
+
+						<option 
+						value="Mon">Mon</option>
+						
+						<option 
+						value="Tue">Tue</option>
+						
+						<option 
+						value="Wed">Wed</option>
+						
+						<option 
+						value="Thu">Thu</option>
+						
+						<option 
+						value="Fri">Fri</option>
+						
+						<option 
+						value="Sat">Sat</option>
+						
+											
+				</field>
+				
+				
+				<field
+					name="DispELDs"
+					type="list"
+					default="0"
+					label="Automatically Generate A Lucky Dip"
+					description="Display a Lucky Dip to the user" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				<field
+					name="GenELDs"
+					type="list"
+					default="0"
+					label="Display Lucky Dip Form"
+					description="Display a form allowing user to generate up to 10 Lucky Dips" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				
+				<field
+					name="CheckUserEur"
+					type="list"
+					default="1"
+					label="Check User Numbers"
+					description="Display form allowing user to enter their EuroMillions Numbers for checking" >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				
+				<field
+					name="EurdivWidth"
+					type="Text"
+					default="289"
+					size="30"
+					label="Div Size"
+					description="Width of the coloured div surrounding the number checker in pixels." />
+			
+				
+			      </fieldset>
+			
+				<fieldset
+				name="API"
+				label="LottoPredict API"
+				description="Settings relating to the LottoPredict API"
+				>
+				
+				
+				<field
+					name="APIKEY"
+					type="text"
+					default="9c59922ab287d59d06011a4c91a21fcf"
+					size="30"
+					label="API Key"
+					description="Lotto Predict API Key. Change this if you decide to purchase a unique key" />
+				
+				
+				
+					<field
+					name="useLDAPI"
+					type="list"
+					default="0"
+					label="Use Lucky Dip API"
+					description="Use the LottoPredict API to generate Lucky Dips. Selecting No will utilise the built in logic, although numbers may be less random. Selecting Yes may adversely effect page load times." >
+				
+						
+						<option 
+						value="1">Yes</option>
+						
+						<option 
+						value="0">No</option>
+						
+											
+				</field>
+				</fieldset>
+				
+				
+				<fieldset
+				name="Caching"
+				label="Caching"
+				description="mod_lotto uses caching to avoid slow page load times. Setting any of these to 0 for a prolonged period may lead to your API Key being banned"
+				>
+				
+				
+				<field
+					name="shortcache"
+					type="text"
+					default="8"
+					size="10"
+					label="Ordinary Results"
+					description="Enter a cache time in hours, this affects most results that are likely to change (Does not effect number checking or Lucky Dips)" />
+					
+					<field
+					name="longcache"
+					type="text"
+					default="120"
+					size="10"
+					label="Historic Results"
+					description="Enter a cache time in hours. This will only effect the historic result checking functionality" />
+				
+				
+				</fieldset>
+
+		</fields>
+	</config>
+</extension>

--- a/tmpl/default.php
+++ b/tmpl/default.php
@@ -50,6 +50,13 @@
 }
 
 
+
+if ($params->get('DispTLDs')){
+
+require_once('default_dispTLDS.php');
+}
+
+
 // Should we display the latest Euro results?
 if ($params->get('DispLatestEuroResults')){
 

file:b/tmpl/default.php~ (new)
--- /dev/null
+++ b/tmpl/default.php~
@@ -1,1 +1,90 @@
+<?php
+/**
+ * @subpackage	mod_lotto
+ * @copyright	Copyright (C) 2012 Ben Tasker . All rights reserved.
+ * @license		GNU General Public License version 2 or later; see LICENSE.txt
+ */
 
+// no direct access
+defined('_JEXEC') or die;
+JHtml::_('behavior.keepalive');
+
+
+
+?>
+
+<div class="modLottoPredictHolder">
+<?php
+// Should we display the latest Lotto Results?
+if ($params->get('DispLatestLottoResults')){
+require_once('default_lottolatestres.php');
+
+}
+
+
+if ($params->get('DispLDs')){
+
+require_once('default_dispLDS.php');
+}
+
+
+
+
+if ($params->get('DispLottoResults')){
+
+require_once('default_bulklottoresults.php');
+
+}
+
+
+
+if ($params->get('CheckUserLotto')){
+require_once('default_checkuserlotto.php');
+}
+
+// Should we display the latest ThunderBall results?
+if ($params->get('DispLatestTBResults')){
+
+require_once('default_tblatestres.php');
+
+}
+
+
+// Should we display the latest Euro results?
+if ($params->get('DispLatestEuroResults')){
+
+require_once('default_eurolatestres.php');
+
+}
+
+
+if ($params->get('DispELDs')){
+
+require_once('default_dispELDS.php');
+}
+
+
+if ($params->get('CheckUserEur')){
+
+require_once('default_checkusereuro.php');
+
+}
+
+
+if ($params->get('DispPurchaseLink')){
+
+
+
+?>
+<div class="LottoPurchaseLink">
+<a href="<?php echo $params->get('PurchaseLink'); ?>" target=_blank title="Buy tickets for the UK National Lottery">Buy Tickets</a>
+</div>
+<?php
+
+
+}
+
+
+?>
+
+</div>

--- /dev/null
+++ b/tmpl/default_dispTDS.php~
@@ -1,1 +1,84 @@
+<?php
+/**
+ * @subpackage	mod_lotto
+ * @copyright	Copyright (C) 2012 Ben Tasker . All rights reserved.
+ * @license		GNU General Public License version 2 or later; see LICENSE.txt
+ */
 
+
+// no direct access
+defined('_JEXEC') or die;
+JHtml::_('behavior.keepalive');
+
+
+
+
+?>
+<div id="dispLDs">
+<?php
+
+if (!empty($_POST['modlottoLuckyDips'])){
+$luckdips = $_POST['modlottoLuckyDips'];
+}else{
+$luckdips = 1;
+}
+
+
+// Output LuckyDips
+$LuckyDips = $lotto->generateTBluckydip($luckdips);
+?>
+
+<h3>Thunderball Lucky Dip</h3>
+
+<table class="modlottoLDs">
+
+<?php
+// Cycle through each one
+foreach ($LuckyDips as $dip){
+  if (empty($dip)){ continue; }
+echo "<tr class=\"latestresult\">";
+  // Cycle through the array
+
+    foreach ($dip as $ball){
+	    $class = rand(1,6);
+	    echo "<td class=\"TBball$class\">$ball</td>";
+	    }
+	  
+echo "</tr>\n";
+
+	      
+  }
+unset($LuckyDips);
+
+?>
+</table>
+
+
+<?php if ($params->get('GenLDs')){?>
+<form name="modlottoLDs" method="POST">
+
+Generate <select class="LottoSelect" id="LuckyDipsSelect" name="modlottoLuckyDips">
+<?php
+$X = 1;
+while ($X <= 10){
+
+echo "<option value=\"$X\">$X</option>";
+$X++;
+}
+
+?>
+</select> Lucky Dips.
+<input type="submit" class="LottoSubmit" value="Generate">
+
+<input type="hidden" name="option" value="<?php echo JRequest::getVar('option');?>">
+<input type="hidden" name="task" value="<?php echo JRequest::getVar('task');?>">
+<input type="hidden" name="view" value="<?php echo JRequest::getVar('view');?>">
+<input type="hidden" name="layout" value="<?php echo JRequest::getVar('layout');?>">
+
+
+</form>
+<?php 
+// End Gen Lucky Dip
+}
+?> 
+</div>

--- /dev/null
+++ b/tmpl/default_dispTLDS.php
@@ -1,1 +1,84 @@
+<?php
+/**
+ * @subpackage	mod_lotto
+ * @copyright	Copyright (C) 2012 Ben Tasker . All rights reserved.
+ * @license		GNU General Public License version 2 or later; see LICENSE.txt
+ */
 
+
+// no direct access
+defined('_JEXEC') or die;
+JHtml::_('behavior.keepalive');
+
+
+
+
+?>
+<div id="dispLDs">
+<?php
+
+if (!empty($_POST['modlottoTBLuckyDips'])){
+$luckdips = $_POST['modlottoTBLuckyDips'];
+}else{
+$luckdips = 1;
+}
+
+
+// Output LuckyDips
+$LuckyDips = $lotto->generateTBluckydip($luckdips);
+?>
+
+<h3>Thunderball Lucky Dip</h3>
+
+<table class="modlottoLDs">
+
+<?php
+// Cycle through each one
+foreach ($LuckyDips as $dip){
+  if (empty($dip)){ continue; }
+echo "<tr class=\"latestresult\">";
+  // Cycle through the array
+
+    foreach ($dip as $ball){
+	    $class = rand(1,6);
+	    echo "<td class=\"TBball$class\">$ball</td>";
+	    }
+	  
+echo "</tr>\n";
+
+	      
+  }
+unset($LuckyDips);
+
+?>
+</table>
+
+
+<?php if ($params->get('GenTLDs')){?>
+<form name="modlottoLDs" method="POST">
+
+Generate <select class="LottoSelect" id="LuckyDipsSelect" name="modlottoTBLuckyDips">
+<?php
+$X = 1;
+while ($X <= 10){
+
+echo "<option value=\"$X\">$X</option>";
+$X++;
+}
+
+?>
+</select> Lucky Dips.
+<input type="submit" class="LottoSubmit" value="Generate">
+
+<input type="hidden" name="option" value="<?php echo JRequest::getVar('option');?>">
+<input type="hidden" name="task" value="<?php echo JRequest::getVar('task');?>">
+<input type="hidden" name="view" value="<?php echo JRequest::getVar('view');?>">
+<input type="hidden" name="layout" value="<?php echo JRequest::getVar('layout');?>">
+
+
+</form>
+<?php 
+// End Gen Lucky Dip
+}
+?> 
+</div>

--- /dev/null
+++ b/tmpl/default_dispTLDS.php~
@@ -1,1 +1,84 @@
+<?php
+/**
+ * @subpackage	mod_lotto
+ * @copyright	Copyright (C) 2012 Ben Tasker . All rights reserved.
+ * @license		GNU General Public License version 2 or later; see LICENSE.txt
+ */
 
+
+// no direct access
+defined('_JEXEC') or die;
+JHtml::_('behavior.keepalive');
+
+
+
+
+?>
+<div id="dispLDs">
+<?php
+
+if (!empty($_POST['modlottoLuckyDips'])){
+$luckdips = $_POST['modlottoLuckyDips'];
+}else{
+$luckdips = 1;
+}
+
+
+// Output LuckyDips
+$LuckyDips = $lotto->generateTBluckydip($luckdips);
+?>
+
+<h3>Thunderball Lucky Dip</h3>
+
+<table class="modlottoLDs">
+
+<?php
+// Cycle through each one
+foreach ($LuckyDips as $dip){
+  if (empty($dip)){ continue; }
+echo "<tr class=\"latestresult\">";
+  // Cycle through the array
+
+    foreach ($dip as $ball){
+	    $class = rand(1,6);
+	    echo "<td class=\"TBball$class\">$ball</td>";
+	    }
+	  
+echo "</tr>\n";
+
+	      
+  }
+unset($LuckyDips);
+
+?>
+</table>
+
+
+<?php if ($params->get('GenTLDs')){?>
+<form name="modlottoLDs" method="POST">
+
+Generate <select class="LottoSelect" id="LuckyDipsSelect" name="modlottoLuckyDips">
+<?php
+$X = 1;
+while ($X <= 10){
+
+echo "<option value=\"$X\">$X</option>";
+$X++;
+}
+
+?>
+</select> Lucky Dips.
+<input type="submit" class="LottoSubmit" value="Generate">
+
+<input type="hidden" name="option" value="<?php echo JRequest::getVar('option');?>">
+<input type="hidden" name="task" value="<?php echo JRequest::getVar('task');?>">
+<input type="hidden" name="view" value="<?php echo JRequest::getVar('view');?>">
+<input type="hidden" name="layout" value="<?php echo JRequest::getVar('layout');?>">
+
+
+</form>
+<?php 
+// End Gen Lucky Dip
+}
+?> 
+</div>