2,6d1 < // geo_chart.php < // Google Geo Chart supervisor < // RJM Programming < // November, 2015 < // 12,17d6 < if (file_exists("bigemail.php")) { < include "bigemail.php"; < } else if (file_exists("../bigemail.php")) { < include "../bigemail.php"; < } < 19,23d7 < $top=""; < if (isset($_POST['area']) || isset($_GET['area'])) $top=" "; < $ntop="1"; < $roff="0"; < $mtop="1"; 28a13,37 > > function make_data_zero() { > $inurl="http://www.rjmprogramming.com.au/PHP/PieChart/pie_chart_diff.php?" . $_SERVER['QUERY_STRING']; > $inbits=explode("&data=", $inurl); > $newd=""; > $newdata="&data="; > $newdata0="&data0="; > if (isset($_GET['data0'])) return str_replace("&country=", "&label=", str_replace("&popularity=", "&desc=", $inurl)); > if (isset($_POST['data0'])) return str_replace("&country=", "&label=", str_replace("&popularity=", "&desc=", $inurl)); > if (isset($_GET['data'])) $newd=$_GET['data']; > if (isset($_POST['data'])) $newd=$_POST['data']; > $pnewds=str_replace(",%20[",",[",str_replace(", [",",[",("," . urldecode($newd)))); > $newds=explode(',[', $pnewds); > $newdata.=$newds[0]; > $newdata0.=$newds[0]; > for ($iu=1; $iu $newcs=explode(",", str_replace("]",",",$newds[$iu])); > $newdata.=',[' . $newcs[0] . ',' . $newcs[1] . str_replace($newcs[0] . ',' . $newcs[1] . ',' . $newcs[2], '', $newds[$iu]); > $newdata0.=',[' . $newcs[0] . ',' . $newcs[2] . ']'; > } > //$outurl=str_replace('data=' + $newd, $newdata . $newdata0, $inurl); > $outurl=str_replace("&country=", "&label=", str_replace("&popularity=", "&desc=", $inbits[0])) . $newdata . $newdata0; > return urlencode($outurl); > } > 132,149c141,142 < if ($GETr != "") { < if (substr($GETr,0,1) == "0" && strlen($GETr) > 1) { < $top="top."; < $ntop="2"; < $mtop="1"; < $roff="1"; < } < echo "\n ir=eval('" . $GETr . "'); \n"; < } < if ($GETc != "") { < if (substr($GETc,0,1) == "0" && strlen($GETc) > 1) { < $top="top."; < $ntop="2"; < $mtop="1"; < $roff="1"; < } < echo "\n ic=eval('" . $GETc . "'); \n"; < } --- > if ($GETr != "") echo "\n ir=eval('" . $GETr . "'); \n"; > if ($GETc != "") echo "\n ic=eval('" . $GETc . "'); \n"; 167d159 < $GETarea=""; 169,172d160 < if (isset($_GET['area'])) { < if ($top == "") $top=" "; < $GETarea = str_replace("~","",str_replace(",~~", "", ",~" . $_GET['area'] . "~")); < } 195,198d182 < if (isset($_GET['area'])) { < if ($top == "") $top=" "; < $GETarea = str_replace("~","",str_replace(",~~", "", ",~" . $_GET['area'] . "~")); < } 206,209d189 < if (isset($_POST['area'])) { < if ($top == "") $top=" "; < $GETarea = str_replace("~","",str_replace(",~~", "", ",~" . urldecode($_POST['area']) . "~")); < } 230,233d209 < if (isset($_POST['area'])) { < if ($top == "") $top=" "; < $GETarea = str_replace("~","",str_replace(",~~", "", ",~" . urldecode($_POST['area']) . "~")); < } 236c212 < echo " var colnames= '" . $GETcountry . "," . str_replace("'", "", $GETpopularity) . $GETarea . "'; \n"; --- > echo " var colnames= '" . $GETcountry . "," . str_replace("'", "", $GETpopularity) . "'; \n"; 240,241c216 < < echo " var sliceid = 0; /" . "/ thanks to https://gist.github.com/alexrainman/bb8d49357250df0859c0 \n"; --- > 242a218,225 > if (strpos(urldecode($GETpopularity), ",") === false) { > echo " var pcd=''; \n"; > } else { > echo " var pcd='Show this as Pie Chart Differences=S' + String.fromCharCode(10) + String.fromCharCode(10); \n"; > } > > echo ' var mdz=decodeURIComponent("' . make_data_zero() . '"); ' . "\n"; > 246,250c229 < if ($GETarea == '') { < echo "\nfunction unzero(cin) { return cin; } \n"; < } else { < echo "\nfunction unzero(cin) { return cin.replace('.0000000000', ' and " . str_replace(","," ",$GETarea) . " of '); } \n"; < } --- > echo " function makedatazero(inurl) { return mdz; } "; 295a275 > echo " var sliceid = 0; /" . "/ thanks to https://gist.github.com/alexrainman/bb8d49357250df0859c0 \n"; 305c285 < echo " selection = chart.getSelection(); \n"; --- > echo " selection = chart.getSelection(); \n "; 319c299 < echo " selection = chart.getSelection(); \n"; --- > echo " selection = chart.getSelection(); \n "; 345c325 < selection = chart.getSelection(); --- > selection = chart.getSelection(); 347a328,330 > //alert(selection.length); > > 353c336 < item.row=eval(ir + " . $roff . "); --- > item.row=ir; 359a343 > //alert(1); 362,365d345 < if ('" . $top . "' == ' ') { < top.document.location=top.document.URL.replace('&r=','&xr=').replace('?','?r=' + ir + '&'); < return; < } 368,370c348,350 < message=" . $top . "document.head.innerHTML.replace(/, \[/g,',' + '[').replace('[' + String.fromCharCode(39),'[ ' + String.fromCharCode(39)).replace('[' + String.fromCharCode(39),', [' + String.fromCharCode(39)).substring(ioffset); < while (message.indexOf(',' + ' [') != -1) { < message=message.replace(',' + ' [',',' + '['); --- > message=document.head.innerHTML.replace('[' + String.fromCharCode(39),'[ ' + String.fromCharCode(39)).replace('[' + String.fromCharCode(39),', [' + String.fromCharCode(39)).substring(ioffset); > while (message.indexOf(', [') != -1) { > message=message.replace(', [',',['); 372d351 < //alert(message); 376,377c355 < for (kl=" . $ntop . "; kl thisnum=dparts[lk].replace(']',',').split(','); 388,390c365 < //alert(dparts[lk].replace(']',',') + ' 77 ' + thisnum.length + ' vs ' + kl); < colav[kl] = eval(eval(colav[kl] * eval(-1 + num)) + eval(thisnum[kl])) / eval(0.0 + num); < //alert(777); --- > colav[kl] = eval(eval(colav[kl] * eval(-1 + num)) + eval(thisnum[kl])) / eval(0.0 + num); 396d370 < //alert(7); 404d377 < //alert(dparts.length + ' bigger than ' + eval(1 + item.row)); 406d378 < //alert(97); 408,412c380,381 < //alert(977); < if (eval(postdparts.length) >= eval(1 + item.column)) { < //alert(197); < if (eval(colparts.length) >= 2) { < //alert(397); --- > if (eval(postdparts.length) >= eval(1 + item.column)) { > if (eval(colparts.length) == 2) { 414c383 < avblurb+=String.fromCharCode(10) + String.fromCharCode(10) + 'Show this as Pie Chart=P' + String.fromCharCode(10) + String.fromCharCode(10); --- > avblurb+='Show this as Pie Chart=P' + String.fromCharCode(10) + String.fromCharCode(10) + pcd; 417c386 < ans=prompt(unzero('For ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[1] + ' of ' + postdparts[1].replace(']','')) + avblurb, paramdata); --- > ans=prompt('For ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[1] + ' of ' + postdparts[1].replace(']','') + avblurb, paramdata); 460a430,431 > } else if (ans.substring(0,1).toLowerCase() == 's') { > location.href=makedatazero(document.URL.replace('/GeoChart', '/PieChart').replace('geo_chart.php', 'pie_chart_diff.php')); 474,475c445,446 < //alert(999); < item.row=eval(ir + " . $roff . "); --- > //alert(2999); > item.row=ir; 477c448 < //alert(9999); --- > //alert(29999); 483c454,455 < //document.title=ir + ',' + ic; --- > //alert(2); > //document.title=ir + ',' + ic; 489c461 < //alert(999); --- > //alert(3999); 492c464 < //alert(9999); --- > //alert(39999); 496a469,470 > item.column=0; > //alert(22); 499,502d472 < if ('" . $top . "' == ' ') { < top.document.location=top.document.URL.replace('&r=','&xr=').replace('?','?r=' + ir + '&'); < return; < } 507,509c477,479 < message=" . $top . "document.head.innerHTML.replace(/, \[/g,',' + '[').replace('[' + String.fromCharCode(39),'[ ' + String.fromCharCode(39)).replace('[' + String.fromCharCode(39),', [' + String.fromCharCode(39)).substring(ioffset); < while (message.indexOf(',' + ' [') != -1) { < message=message.replace(',' + ' [',',' + '['); --- > message=document.head.innerHTML.replace('[' + String.fromCharCode(39),'[ ' + String.fromCharCode(39)).replace('[' + String.fromCharCode(39),', [' + String.fromCharCode(39)).substring(ioffset); > while (message.indexOf(', [') != -1) { > message=message.replace(', [',',['); 514c484 < for (kl=" . $ntop . "; kl for (kl=1; kl for (lk=1; lk avblurb+='Show this as Pie Chart=P' + String.fromCharCode(10) + String.fromCharCode(10) + pcd; 547c515 < ans=prompt(unzero('For ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[1] + ' of ' + postdparts[1].replace(']','')) + avblurb, paramdata); --- > ans=prompt('For ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[1] + ' of ' + postdparts[1].replace(']','') + avblurb, paramdata); 590a559,560 > } else if (ans.substring(0,1).toLowerCase() == 's') { > location.href=makedatazero(document.URL.replace('/GeoChart', '/PieChart').replace('geo_chart.php', 'pie_chart_diff.php')); 605c575 < //alert(999); --- > //alert(7999); 608c578 < //alert(9999); --- > //alert(79999); 613a584 > //alert(3); 713c684 < echo ' var extra = "", four; ' . "\n"; --- > echo ' var extra = ""; ' . "\n";