Skip to content

Commit

Permalink
fix of fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard Rieder authored and Bernhard Rieder committed Jun 2, 2017
1 parent a8b2308 commit e83cb80
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions index.php
Expand Up @@ -289,7 +289,7 @@
$phrases[$query] = array();
}

$timescale = (isset($_GET["timescale"])) ? $_GET["timescale"]:"week";
$timescale = ($_GET["timescale"] != "undefined") ? $_GET["timescale"]:"week";

$col_date = urldecode($_GET["col_date"]);
$cols_text = explode(",", urldecode($_GET["cols_text"]));
Expand All @@ -306,7 +306,7 @@

$showfull = ($_GET["showfull"] == "true") ? true:false;
$getcontext = ($_GET["getcontext"] == "true") ? true:false;
$dowordtree = ($_GET["dowordtree"] == "true") ? true:false;
$dowordtree = ($_GET["dowordtree"] == "true" && $query != "") ? true:false;
$dooutput = ($_GET["dooutput"] == "true") ? true:false;
$dosummary = ($_GET["dosummary"] == "true") ? true:false;

Expand All @@ -322,7 +322,7 @@
$startdate .= $_GET["startdate"] . " 00:00:00";
}

$_GET["enddate"] = ($_GET["enddate"] != "") ? $_GET["enddate"]:date("Y-m-d");
$_GET["enddate"] = ($_GET["enddate"] != "") ? $_GET["enddate"]:date("Y-m-d");
if(preg_match("/ [0-9]{2}:[0-9]{2}:[0-9]{2}$/", $_GET["enddate"])) {
$enddate = $_GET["enddate"];
} else if(preg_match("/ [0-9]{2}:[0-9]{2}$/", $_GET["enddate"])) {
Expand Down Expand Up @@ -364,8 +364,8 @@
$fr = fopen($datadir . $datafile,"r");
if($dooutput) { $fw = fopen($outdir . $filename_out,"w"); }
$counter = 0;
$oldestdate = strtotime($enddate);
$newestdate = strtotime($startdate);
$oldestdate = 1000000000000;
$newestdate = 0;


// --------------------------
Expand All @@ -374,7 +374,9 @@

while(($rawbuffer = fgets($fr)) !== false) {

if($counter == 0) { // first line is different
$counter++;

if($counter == 1) { // first line is different

if($dooutput) { fwrite($fw, $rawbuffer); }

Expand All @@ -387,14 +389,15 @@
if(isset($cols_score[$buffer[$i]])) { $collocs_score[] = array($i,$cols_score[$buffer[$i]]); }
}

$counter++;

continue;
}



// separate line to work on
$buffer = str_getcsv($rawbuffer,$delimiter,'"');



// time filter
$unixdate = strtotime($buffer[$colloc_date]);
if($unixdate < strtotime($startdate) || $unixdate > strtotime($enddate)) { continue; }
Expand Down Expand Up @@ -453,7 +456,7 @@

//print_r($buffer);
//echo $content;
//print_r($queries); print_r($queries_found); exit;
//print_r($queries); print_r($queries_found);

foreach($queries as $query) {

Expand Down Expand Up @@ -530,6 +533,7 @@
fclose($fw);
fclose($fr);


// fill empty dates and create date list
$start = $oldestdate;
$stop = $newestdate;
Expand Down Expand Up @@ -897,8 +901,8 @@

<script>

if(_params.dowordtree == false) {
throw "";
if(_params.dowordtree == false || _params.query == "") {
throw "no d3 at this time";
}

var _nodesep = 200;
Expand Down

0 comments on commit e83cb80

Please sign in to comment.