Initial Commit
Initial Commit

file:b/about.php (new)
--- /dev/null
+++ b/about.php
@@ -1,1 +1,6 @@
+sourced from austender

+Government Agency Information (2009-07-10): National Archives of Australia, http://www.naa.gov.au under Creative Commons - Attribution 2.5 Australia (CC-BY)

+jpgraph for php

+ABR

+Redhat Liberation fonts

 

--- /dev/null
+++ b/admin/abr-example.php
@@ -1,1 +1,23 @@
+<?php
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($ch, CURLOPT_REFERER, "http://contractdashboard.lambdacomplex.org");
+$guid = "5f2f943e-15f4-4782-8fad-9a0fe83a2f47";
+$orgname = "Department of Foreign Affairs and Trade";
 
+//foreach $agency
+$url = "http://abr.business.gov.au/ABRXMLSearchRPC/ABRXMLSearch.asmx/ABRSearchByNameSimpleProtocol?name=".urlencode($orgname)."&postcode=&legalName=Y&tradingName=Y&NSW=Y&SA=Y&ACT=Y&VIC=Y&WA=Y&NT=Y&QLD=Y&TAS=Y&authenticationGuid=$guid";
+curl_setopt($ch, CURLOPT_URL, $url);
+$body = curl_exec($ch);
+$xml = new SimpleXMLElement($body);
+echo "<pre>";
+$result = $xml->response->searchResultsList->searchResultsRecord[0];
+var_dump($result);
+echo "</pre>";
+echo "<b> Organisation:</b>" . $result->mainName->organisationName;
+echo "<b> ABN:</b>".$result->ABN->identifierValue;
+// fi
+
+curl_close($ch);
+
+?>

file:b/admin/cmd.exe.lnk (new)
 Binary files /dev/null and b/admin/cmd.exe.lnk differ
--- /dev/null
+++ b/admin/convertToThematicMapping.php
@@ -1,1 +1,64 @@
+<?php
 
+include_once("../common.inc.php");
+$year = $_REQUEST['year'];
+$query = "SELECT supplierCountry, sum(value) FROM `contractnotice` where childCN = 0 AND (YEAR(contractStart) = $year) AND supplierCountry != 'Australia' GROUP BY supplierCountry ";
+
+$result = mysql_query($query);
+if (!$result) echo mysql_error().$query;
+$countryValues = Array();
+while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
+ $supplierCountry = strtoupper($row['supplierCountry']);
+if ($supplierCountry == "MYANMAR") $supplierCountry = "BURMA";
+if ($supplierCountry == "RUSSIAN FEDERATION") $supplierCountry = "RUSSIA";
+if ($supplierCountry == "TAIWAN, PROVINCE OF CHINA") $supplierCountry = "TAIWAN";
+$countryValues[$supplierCountry] = $row['sum(value)'];
+}
+mysql_free_result($result);
+
+$query = "SELECT supplierPostcode, sum(value) FROM `contractnotice` where childCN = 0 AND (YEAR(contractStart) = $year) AND supplierCountry = 'Australia' GROUP BY supplierPostcode ";
+
+$result = mysql_query($query);
+if (!$result) echo mysql_error().$query;
+$postcodeValues = Array();
+while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
+$postcodeValues[$row['supplierPostcode']] = $row['sum(value)'];
+}
+mysql_free_result($result);
+
+
+@mysql_select_db("tme") or die( "Unable to select database tme");
+$query = "SELECT un, name
+FROM `country_simpl`";
+
+$result = mysql_query($query);
+if (!$result) echo mysql_error().$query;
+$countryUN = Array();
+while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
+$countryUN[strtoupper($row['name'])] = $row['un'];
+}
+mysql_free_result($result);
+
+echo "<table>";
+
+// drop from table existing values
+//$result = mysql_query('insert into indicator_values ( "variable", "area", "year", "value" ) VALUES (2107, '.$countryUN[strtoupper($countryName)].', '.$year.','.$countryValue.');');
+//if (!$result) echo mysql_error().$query;
+
+
+foreach ($countryValues as $countryName => $countryValue) {
+echo "<tr><td>$countryName<td>".$countryUN[strtoupper($countryName)]."<td>$countryValue</tr>";
+$query = 'insert into indicator_values ( `variable`, `area`, `year`, `value` ) VALUES (\'2107\', \''.$countryUN[strtoupper($countryName)].'\', \''.$year.'\',\''.$countryValue.'\');';
+$result = mysql_query($query);
+if (!$result) echo mysql_error();
+}
+
+foreach ($postcodeValues as $postcode => $postcodeValue) {
+echo "<tr><td>Australia<td>$postcode<td>$postcodeValue</tr>";
+$query = 'INSERT into indicator_values ( `variable`, `area`, `year`, `value` ) VALUES (\'2107\', \''.($postcode*1000).'\', \''.$year.'\',\''.$countryValue.'\');';
+$result = mysql_query($query);
+if (!$result) echo mysql_error();
+}
+
+echo "</table>";
+?>

--- /dev/null
+++ b/admin/google-example.htm
@@ -1,1 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <title>My Google AJAX Search API Application - http://contractdashboard.lambdacomplex.org</title>
+    <script src="http://www.google.com/jsapi?key=ABQIAAAA95XYXN0cki3Yj_Sb71CFvBSgIPe2k9-DRgEVQvbvQDV8xmTiXRTBpHxrD7bSh5rl2lswY56769CyQQ" type="text/javascript"></script>
+    <script language="Javascript" type="text/javascript">
+    //<![CDATA[
 
+    google.load("search", "1");
+
+    function OnLoad() {
+      // Create a search control
+      var searchControl = new google.search.SearchControl();
+
+      // Add in a full set of searchers
+      var localSearch = new google.search.LocalSearch();
+      searchControl.addSearcher(localSearch);
+      searchControl.addSearcher(new google.search.WebSearch());
+      searchControl.addSearcher(new google.search.VideoSearch());
+      searchControl.addSearcher(new google.search.BlogSearch());
+
+      // Set the Local Search center point
+      localSearch.setCenterPoint("New York, NY");
+
+      // Tell the searcher to draw itself and tell it where to attach
+      searchControl.draw(document.getElementById("searchcontrol"));
+
+      // Execute an inital search
+      searchControl.execute("Google");
+    }
+    google.setOnLoadCallback(OnLoad);
+
+    //]]>
+    </script>
+  </head>
+  <body>
+    <div id="searchcontrol">Loading...</div>
+  </body>
+</html>

--- /dev/null
+++ b/admin/google-example.php
@@ -1,1 +1,25 @@
+<?php
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($ch, CURLOPT_REFERER, "http://contractdashboard.lambdacomplex.org");
 
+$agency = "Department of Foreign Affairs and Trade";
+
+//foreach $agency
+$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&key=ABQIAAAA95XYXN0cki3Yj_Sb71CFvBSgIPe2k9-DRgEVQvbvQDV8xmTiXRTBpHxrD7bSh5rl2lswY56769CyQQ&rsz=small&filter=1&gl=au&q=".urlencode($agency)."%20ABN%20site:.gov.au";
+curl_setopt($ch, CURLOPT_URL, $url);
+$body = curl_exec($ch);
+$json = json_decode($body);
+echo "<pre>";
+$result = $json->responseData->results[0];
+print_r($result);
+echo "</pre>";
+echo "<b> Agency:</b> $agency";
+echo "<b> URL:</b> http://".$result->visibleUrl;
+preg_match('/\d{2} \d{3} \d{3} \d{3}/i', $result->content,$abn);
+echo "<b> ABN:</b> {$abn[0]}";
+// fi
+
+curl_close($ch);
+
+?>

file:b/admin/import.bat (new)
--- /dev/null
+++ b/admin/import.bat
@@ -1,1 +1,1 @@
-
+c:\wamp\bin\php\php5.3.0\php.exe import.php

file:b/admin/import.php (new)
--- /dev/null
+++ b/admin/import.php
@@ -1,1 +1,119 @@
+<?php
+include_once("../lib/common.inc.php");
+$path = '../data/';
+if ($_REQUEST["fname"] == "") {
+echo "Get files from: https://www.tenders.gov.au/?event=public.reports.list<br>";
+$dhandle = opendir($path);
+// define an array to hold the files
+$files = array();
 
+if ($dhandle) {
+   // loop through all of the files
+   while (false !== ($fname = readdir($dhandle))) {
+      if (($fname != '.') && ($fname != '..')) {
+	  echo "<a href=\"import.php?fname=$fname\">$fname</a>".filesize($path.$fname)."<br/>";
+	  }
+	}
+}
+
+} else {
+$success =0;
+$fname = $_REQUEST["fname"];
+echo " ============== $fname  ============== <br>";
+$row = 1;
+$handle = fopen($path.$fname, "r"); 
+//"t" mode string translates windows line breaks to unix
+$datamapping0709 = Array("Agency" => "agencyName", "Parent CN ID" => "parentCN", "CN ID" => "CNID", "Publish Date" => "publishDate", "Amendment Date" => "amendDate", "Status" => "", "StartDate" => "contractStart" , "EndDate" => "contractEnd", "Value" => "value", "Description" => "description",  "Agency Ref Id" => "agencyID", "Category" => "category", "Procurement Method" => "procurementMethod", "ATM ID" => "atmID", "SON ID" => "SONID","Confidentiality - Contract" => "confidentialityContract", "Confidentiality - Contract Reason(s)" => "confidentialityContractReason", "Confidentiality - Outputs" => "confidentialityOutputs", "Confidentiality - Outputs Reason(s)" => "confidentialityOutputsReason", "Consultancy" => "consultancy", "Consultancy Reason(s)" => "consultancyReason", "Amendment Reason" => "amendmentReason",  "Supplier Name" => "supplierName", "Supplier Address" => "supplierAddress", "Supplier City" => "supplierCity", "Supplier Postcode" => "supplierPostcode", "Supplier Country" => "supplierCountry" , "Supplier ABNExempt" => "supplierABNExempt", "Supplier ABN" => "supplierABN" , "Agency Branch" => "contactBranch","Agency Divison" => "contactDivision", "Agency Postcode" => "contactPostcode" , "" => "");
+$headers;
+$contractNoticeFields = Array("agencyName",  "parentCN", "CNID", "publishDate",  "amendDate", "contractStart" , "contractEnd", "value", "description",   "agencyID",  "category", "procurementMethod", "atmID", "SONID", "confidentialityContract", "confidentialityContractReason", "confidentialityOutputs", "confidentialityOutputsReason", "consultancy", "consultancyReason",  "amendmentReason",  "supplierName", "supplierAddress", "supplierCity",  "supplierPostcode",  "supplierCountry" , "supplierABNExempt",  "supplierABN", "contactBranch","contactDivision","contactPostcode" );
+$agencyFields = Array("agencyName");
+$supplierFields = Array("supplierName", "supplierAddress", "supplierCity",  "supplierPostcode",  "supplierCountry" , "supplierABNExempt",  "supplierABN" );
+
+while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) {
+    $num = count($data);
+
+	if ($row == 3)
+	{
+	$headers = $data;
+	}
+	else if ($row > 3)
+	{
+			if ($num > count($datamapping0709))
+		{
+		die ("<font color=red>Error in data import; data mapping fields out of bounds or changed</font><br>".$fname.print_r($data));
+		}
+	$firstCN= false;
+    $firstSupplier= true;
+    $firstAgency= true;
+    $contractNoticeInsert = "INSERT INTO contractnotice (importFile, ".implode(" , ",$contractNoticeFields). ") VALUES ( \"$fname\" ";
+    $supplierInsert = "INSERT INTO supplierdetails (".implode(" , ",$supplierFields). ") VALUES (";
+    $agencyInsert = "INSERT INTO agency (".implode(" , ",$agencyFields). ") VALUES (";
+	
+	$keys = array_keys($datamapping0709);
+    for ($c=0; $c < $num; $c++) {
+	$data[$c] = trim($data[$c],"=");
+	$data[$c] = trim($data[$c], "\"");
+	
+	if (in_array(($datamapping0709[$headers[$c]]),$contractNoticeFields))
+	{
+	if (($datamapping0709[$headers[$c]]) == "parentCN" || ($datamapping0709[$headers[$c]]) == "CNID")
+	{
+		$data[$c] = substr($data[$c],2);
+		if ($data[$c] >0)
+		{
+		$contractNoticeInsert .= ($firstCN ? "" : ","). mysql_real_escape_string($data[$c]);
+		} else
+		{
+		$contractNoticeInsert .= ($firstCN ? "" : ",")."''";
+		}
+	} else 	if (($datamapping0709[$headers[$c]]) == "amendDate" || ($datamapping0709[$headers[$c]]) == "publishDate" || ($datamapping0709[$headers[$c]]) == "contractStart" || ($datamapping0709[$headers[$c]]) == "contractEnd")
+	{
+		$contractNoticeInsert .= ($firstCN ? "" : ","). "'".date( 'Y-m-d H:i:s', strtotime($data[$c])). "'";
+	} else
+	{
+		if (strstr("\" =",$data[$c] > 0))
+			{
+				die ("Invalid Description field" . $contractNoticeInsert); 
+			}
+        $contractNoticeInsert .= ($firstCN ? "" : ",") .  "'". mysql_real_escape_string($data[$c])."'";
+		
+		}
+		$firstCN = false;
+    }
+		if (in_array(($datamapping0709[$headers[$c]]),$supplierFields))
+	{
+        $supplierInsert .= ($firstSupplier ? "" : ",") .  "'". mysql_real_escape_string($data[$c])."'";
+		$firstSupplier = false;
+    }
+			if (in_array(($datamapping0709[$headers[$c]]),$agencyFields))
+	{
+        $agencyInsert .= ($firstAgency ? "" : ",") .  "'". mysql_real_escape_string($data[$c])."'";
+		$firstAgency = false;
+    }
+	
+	}
+	$contractNoticeInsert .= ");";
+	$supplierInsert .= ");";
+	$agencyInsert .= ");";
+	
+$result = mysql_query($contractNoticeInsert);
+if ($result) $success++;
+else echo $data[2] . " failed CN insert.<br>". mysql_error() ." <br>  $contractNoticeInsert <br><br>\n";
+	
+	//$result = mysql_query($agencyInsert);
+if ($result) $success++;
+else echo $data[2] . " failed agency insert.<br>". mysql_error() ." <br> $agencyInsert <br><br>\n";
+	
+	$result = mysql_query($supplierInsert);
+if ($result) $success++;
+else echo $data[2] . " failed supplier insert.<br>". mysql_error() ." <br> $supplierInsert <br><br>\n";
+
+echo "<hr>\n";
+	}
+	
+    $row++;
+}
+echo "<br> $success records successfully created";
+fclose($handle);
+}
+?>

--- /dev/null
+++ b/admin/linkAmendments.php
@@ -1,1 +1,15 @@
-
+<?php
+include_once ("../lib/common.inc.php");
+$query = "SELECT CNID,parentCN,amendmentReason FROM `contractnotice` WHERE
+parentCN > 0 ";
+$result = mysql_query($query);
+while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
+  $result2 = mysql_query("UPDATE contractnotice SET childCN = '" .
+			 $row['CNID'] . "', amendmentReason = '" .
+			 $row['amendmentReason'] . "' where CNID = '" .
+			 $row['parentCN'] . "';");
+  if ($result2) echo $row['CNID'] . " linked to parent " . $row['parentCN'] .
+  "<br>\n";
+  else "error" . mysql_error();
+}
+?>

--- /dev/null
+++ b/admin/recordsperweek.txt
@@ -1,1 +1,7 @@
+ SELECT min( `publishDate` ) AS w, week( `publishDate` ) AS wk, count( 1 )
+FROM `contractnotice`
+WHERE YEAR( `publishDate` ) =2009
+GROUP BY wk
+ORDER BY w
+LIMIT 0 , 30 
 

--- /dev/null
+++ b/admin/setAgencyStatus.php
@@ -1,1 +1,18 @@
+<?php
+include_once("../lib/common.inc.php");
 
+$active = Array('Administrative Appeals Tribunal','Aged Care Standards and Accreditation Agency Ltd','Airservices Australia','Attorney-General\'s Department','Auditing and Assurance Standards Board','AusAid','Austrade','Australia Council for the Arts','Australian Accounting Standards Board','Australian Antarctic Division','Australian Broadcasting Corporation','Australian Bureau of Statistics','Australian Centre for International Agricultural Research','Australian Commission for Law Enforcement Integrity','Australian Communications and Media Authority (ACMA)','Australian Competition and Consumer Commission','Australian Crime Commission','Australian Customs Service','Australian Electoral Commission','Australian Fair Pay Commission','Australian Federal Police','Australian Film Commission','Australian Film Television and Radio School','Australian Fisheries Management Authority','Australian Hearing Services','Australian Industrial Registry','Australian Institute of Aboriginal and Torres Strait Islander Studies (AIATSIS)','Australian Institute of Criminology','Australian Institute of Family Studies','Australian Institute of Health and Welfare','Australian Institute of Marine Science','Australian Law Reform Commission','Australian Maritime Safety Authority','Australian National Audit Office (ANAO)','Australian National Maritime Museum','Australian Nuclear Science and Technology Organisation (ANSTO)','Australian Office of Financial Management','Australian Organ and Tissue Donation and Transplantation Authority','Australian Pesticides and Veterinary Medicines Authority','Australian Prudential Regulation Authority (APRA)','Australian Public Service Commission','Australian Radiation Protection and Nuclear Safety Agency (ARPANSA)','Australian Research Council','Australian Reward Investment Alliance (ARIA)','Australian Securities and Investments Commission','Australian Security Intelligence Organisation','Australian Sports Anti-Doping Authority (ASADA)','Australian Taxation Office','Australian Transaction Reports and Analysis Centre (AUSTRAC)','Australian Transport Safety Bureau','Australian War Memorial','Biosecurity Australia','Bureau of Meteorology','Cancer Australia','Centrelink','Civil Aviation Safety Authority','Comcare','Commonwealth Grants Commission','Comsuper','Corporations and Markets Advisory Committee','Crimtrac','CRS Australia','CSIRO','Defence Housing Australia','Defence Materiel Organisation','Department of Agriculture, Fisheries and Forestry','Department of Broadband, Communications and the Digital Economy','Department of Climate Change','Department of Defence','Department of Education, Employment and Workplace Relations','Department of Families, Housing, Community Services and Indigenous Affairs','Department of Finance and Deregulation','Department of Foreign Affairs and Trade','Department of Health and Ageing','Department of Human Services','Department of Immigration & Citizenship','Department of Infrastructure, Transport, Regional Development and Local Government','Department of Innovation, Industry, Science and Research','Department of Parliamentary Services','Department of Resources, Energy and Tourism','Department of the Environment, Water, Heritage and the Arts','Department of the House of Representatives','Department of the Prime Minister and Cabinet','Department of the Senate','Department of the Treasury','Department of Veterans\' Affairs','Director of National Parks','Emergency Management Australia','Equal Opportunity for Women in the Workplace Agency','Export Finance and Insurance Corporation (EFIC)','Fair Work Australia','Family Court of Australia','Federal Court of Australia','Federal Magistrates Court','Future Fund Management Agency','Geoscience Australia','Grains Research and Development Corporation','Great Barrier Reef Marine Park Authority','Human Rights and Equal Opportunity Commission','Insolvency and Trustee Service Australia (ITSA)','Inspector-General of Taxation','IP Australia','Land and Water Australia','Medicare Australia','Migration Review Tribunal and Refugee Review Tribunal (MRT-RRT)','Murray-Darling Basin Authority','National Archives of Australia','National Blood Authority','National Capital Authority','National Competition Council','National Film and Sound Archive','National Gallery of Australia','National Health and Medical Research Council','National Library of Australia','National Museum of Australia','National Native Title Tribunal','National Offshore Petroleum Safety Authority','National Water Commission','Office of National Assessments','Office of Parliamentary Counsel','Office of the Australian Building and Construction Commissioner (ABCC)','Office of the Commonwealth Ombudsman','Office of the Director of Public Prosecutions','Office of the Fair Work Ombudsman','Office of the Inspector-General of Intelligence and Security','Office of the Official Secretary to the Governor-General','Office of the Privacy Commissioner','Office of the Renewable Energy Regulator','Old Parliament House','Private Health Insurance Ombudsman','Productivity Commission','Professional Services Review','Questacon','Reserve Bank of Australia','Royal Australian Mint','Seacare','Social Security Appeals Tribunal','Sydney Harbour Federation Trust','Therapeutic Goods Administration','Tourism Australia','Workplace Authority','Workplace Ombudsman');
+
+$suspended = Array('Airservices Australia','Australia Council for the Arts','Australia-Japan Foundation','Australian Antarctic Division','Australian Broadcasting Corporation','Australian Communications and Media Authority (ACMA)','Australian Electoral Commission','Australian Fair Pay Commission','Australian Film Commission','Australian Film Television and Radio School','Australian Industrial Registry','Australian Institute of Aboriginal and Torres Strait Islander Studies (AIATSIS)','Australian Institute of Family Studies','Australian Institute of Marine Science','Australian Maritime Safety Authority','Australian National Maritime Museum','Australian Nuclear Science and Technology Organisation (ANSTO)','Australian Research Council','Australian Reward Investment Alliance (ARIA)','Australian Sports Anti-Doping Authority (ASADA)','Bureau of Meteorology','Child Support Agency','Civil Aviation Safety Authority','Comcare','Commonwealth Grants Commission','Comsuper','CSIRO','Dairy Adjustment Authority','Department of Communications, Information Technology and the Arts','Department of Education, Science and Training','Department of Employment and Workplace Relations','Department of Families, Community Services & Indigenous Affairs','Department of Finance and Administration','Department of Industry, Tourism and Resources','Department of the Environment and Water Resources','Department of Transport and Regional Services','Director of National Parks','Equal Opportunity for Women in the Workplace Agency','Export Wheat Commission','Future Fund Management Agency','Geoscience Australia','Great Barrier Reef Marine Park Authority','IP Australia','National Archives of Australia','National Archives of Australia','National Capital Authority','National Gallery of Australia','National Library of Australia','National Museum of Australia','National Offshore Petroleum Safety Authority','National Water Commission','National Water Commission','Office of Film and Literature Classification','Office of the Australian Building and Construction Commissioner (ABCC)','Office of the Privacy Commissioner','Office of the Renewable Energy Regulator','Office of Workplace Services','Questacon','Refugee Review Tribunal','Seacare','Social Security Appeals Tribunal','Sydney Harbour Federation Trust','The National Institute of Clinical Studies Ltd','Tourism Australia','Workplace Ombudsman');
+
+foreach ($active as $agency ) {
+	$result = mysql_query("UPDATE agency SET status = 'active' where agencyName = '".mysql_real_escape_string($agency)."';") ;
+	if ($result) echo $agency. " set to active in ". mysql_affected_rows() . " divisions/branches <br>\n";
+	else echo "error".mysql_error();
+}
+foreach ($suspended as $agency) {
+	$result = mysql_query("UPDATE agency SET status = 'suspended' where agencyName = '".mysql_real_escape_string($agency)."';") ;
+	if ($result) echo $agency. " set to suspended in ". mysql_affected_rows() . " divisions/branches <br>\n";
+	else echo "error".mysql_error();
+}
+?>

--- /dev/null
+++ b/admin/setAgencyURLABN.php
@@ -1,1 +1,37 @@
-
+<?php
+include_once ("../lib/common.inc.php");
+// to reset: update agency set abn = 0, website = ''
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($ch, CURLOPT_REFERER, "http://contractdashboard.lambdacomplex.org");
+$querySel = sprintf("SELECT * FROM `agency` where ABN = 0 OR website = ''");
+$resultSel = mysql_query($querySel);
+while ($row = mysql_fetch_array($resultSel, MYSQL_ASSOC)) {
+  $agency = $row['agencyName'];
+  //foreach $agency
+  $url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&key=ABQIAAAA95XYXN0cki3Yj_Sb71CFvBSgIPe2k9-DRgEVQvbvQDV8xmTiXRTBpHxrD7bSh5rl2lswY56769CyQQ&rsz=small&filter=1&gl=au&q=" . urlencode($agency) . "%20ABN%20site:.gov.au%20-site:www.abr.business.gov.au";
+  curl_setopt($ch, CURLOPT_URL, $url);
+  $body = curl_exec($ch);
+  $json = json_decode($body);
+  echo "<pre>";
+  $result = $json->responseData->results[0];
+  print_r($result);
+  echo "</pre>";
+  echo "<b> Agency:</b> $agency";
+  echo "<b> URL:</b> http://" . $result->visibleUrl;
+  preg_match('/\d{2} \d{3} \d{3} \d{3}/i', $result->content, $abn);
+  $abn[0] = str_replace(" ","",$abn[0]);
+  echo "<b> ABN:</b> {$abn[0]}";
+  if ($abn[0] > 1000) {
+  $result = mysql_query("UPDATE agency SET website = 'http://" . $result->visibleUrl . "', abn = '{$abn[0]}' WHERE agencyName = '$agency';");
+  if ($result) echo $agency . " set in " . mysql_affected_rows() . " <br>\n";
+  } else {
+	echo "invalid ABN";
+	$result = mysql_query("UPDATE agency SET website = 'http://" . $result->visibleUrl . "' WHERE agencyName = '$agency';");
+  if ($result) echo $agency . " set in " . mysql_affected_rows() . " <br>\n";
+  }
+  // fi
+  
+}
+curl_close($ch);
+?>

--- /dev/null
+++ b/contractDashboard.kpf
@@ -1,1 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Komodo Project File - DO NOT EDIT -->
+<project id="78e0995e-1430-4891-9aa9-b41f9d082425" kpf_version="4" name="contractDashboard.kpf">
+<preference-set idref="78e0995e-1430-4891-9aa9-b41f9d082425">
+  <string id="import_exclude_matches">*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;.svn;*%*;tmp*.html;.DS_Store</string>
+  <string id="import_include_matches"></string>
+  <boolean id="import_live">1</boolean>
+  <boolean id="import_recursive">1</boolean>
+  <string id="import_type">useFolders</string>
+  <string id="mappedPaths"></string>
+</preference-set>
+</project>
 

--- /dev/null
+++ b/cutenews/LICENSE.txt
@@ -1,1 +1,60 @@
-
+CutePHP.com Software License Agreement

+

+1. This Software License Agreement is a legal agreement between you,

+the end-user ("Licensee"), and Authors of software ("Authors"). By

+using our software or storing it on a computer hard drive (or other

+type of media), you are agreeing to be bound by the terms of this

+Agreement.

+

+2. CutePHP Software IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS

+EXPRESSED OR IMPLIED. You Use our software AT YOUR OWN RISK. CutePHP

+Author hereby disclaims all warranties and guarantees regarding the

+use, or the results of use, of the software in terms of correctness,

+accuracy, reliability or otherwise. The Author will not be responsible

+for any incidental, consequential, direct or indirect damages. You

+also agree that the disclaimer is the complete and exclusive statement

+of agreement between the parties and supersede all proposals or prior

+agreements, oral or written, and any other communications between the

+parties relating to the subject matter of the disclaimer.

+

+3. All copyrights to "CutePHP.com" are exclusively owned by the author

+- Georgi Avramov.

+

+4. You can use CutePHP.com Software for free (non-commercial needs) as

+long as you do not remove / edit, and keep visible the "Powered by..."

+line (displayed on every page where the script is included) without

+the explicit written permission of CutePHP.com or payed registration.

+The Software is licensed only to you. You may not rent, lease,

+sublicense, sell, assign, pledge, transfer or otherwise dispose of the

+Software in any form, on a temporary or permanent basis, without the

+prior written consent of CutePHP.com

+

+5. Users may modify software code for their personal use (at their own

+risk), but any altered code must not be redistributed or resold in any

+form without the explicit written permission of CutePHP.com

+

+6. Registered Users/Customers (purchased-license holders) are allowed

+to remove the 'Powered by...' line.

+

+6.1 All customers must include the URL of the domain where the Script

+will be used. This is done through the Customer Area at CutePHP.com

+

+6.2 Customers are allowed to install the script only on the domain

+stated in their license. This means that the Licensee can install the

+script only on one domain per license purchased. Multiple instances of

+the script (installations) are allowed in the scope of the licensed

+domain.

+

+6.3 Once you are in receipt of our software, License fees are

+non-refundable. We encourage you to verify (by installing the free

+version) that the software is working on your server and no problems

+are occurring.

+

+6.4 Un-Official technical support will be provided in our forums from

+voluntary members to both Registered and Un-Registered Users.

+

+TERMINATION

+This Agreement will terminate automatically upon failure to comply

+with the limitations described herein or on written notice from an

+authorized representative of CutePHP.com. On termination, you must

+destroy all copies of the Software within 48 hours.

--- /dev/null
+++ b/cutenews/README.htm
@@ -1,1 +1,433 @@
-
+<html><head><title>CuteNews README</title>

+<meta content="text/html; charset=iso-8859-1" http-equiv=Content-Type>

+<style type=text/css>

+A:link    { color:#3E749F; text-decoration:none}

+A:visited { color:#3E749F; text-decoration:none}

+A:hover   { color:#3E749F; text-decoration:underline}

+A:active  { color:#3E749F; text-decoration:underline}

+

+A.menu:hover, A.menu:active{ color:black; text-decoration:none}

+A.menu:link, A.menu:visited{ color:#305367; text-decoration:none}

+

+BODY, P, LI, TD {

+        COLOR: #000000; FONT-FAMILY: verdana; FONT-SIZE: 11px; LINE-HEIGHT: 16px

+}

+</STYLE>

+</head>

+<body aLink=#cccccc bgColor=lightsteelblue link=#333333 vLink=#555555>

+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

+<table align=center border=0 cellPadding=1 cellSpacing=0 width=733 height="1">

+  <tbody>

+  <tr>

+    <td bgColor=#000000 width="744" height="1">

+

+      <table border=0 cellSpacing=0 width="735" height="1">

+        <tbody>

+        <tr>

+          <td bgColor=#ffffff width="731" colspan="4" align="center" valign="top" height="18">

+            <b><font size="4" color="#7BA0DD">CuteNews README</font></b></td></tr>

+        <tr>

+          <td bgColor=#ffffff width="731" valign="top" align="center" height="4" colspan="4">

+

+

+&nbsp;

+

+            </td>

+        </tr>

+        <tr>

+          <td bgColor=#C2E4DB width="731" valign="top" align="center" height="6" colspan="4">

+

+

+<p align="left">&nbsp;<font size="2"><b>Information About The Script</b></font>

+

+            </td>

+        </tr>

+        <tr>

+          <td bgColor=#ffffff width="10" valign="top" align="center" height="9">

+

+

+&nbsp;

+

+            </td>

+          <td bgColor=#ffffff width="721" valign="top" align="center" height="9" colspan="3">

+

+

+<p align="left">CuteNews v1.4.6 by <a href="http://cutephp.com">CutePHP</a>

+Team.<br />

+<br />

+Cute news is a powerful and easy for using news management system that use flat files to store its database. It supports<br />

+&nbsp;comments and archives that can be organized by months.<br />

+Please read the provided license.txt file to get familiar with the legal usage

+of this script.<br>

+&nbsp;<a href="http://cutephp.com/cutenews/register/">Registered</a> Customers can seek support on at <a href="mailto:support%20[at]%2