<commit_before><?php 
include("../../../config/settings.inc.php");
define("IEM_APPID", 55);
define("FBEXTRA", True); 
include("../../../include/myview.php");
$t = new MyView();

include("../../../include/database.inc.php");
include("../../../include/feature.php");
$day = isset($_GET["day"]) ? substr($_GET["day"],0,10) : null;
$offset = isset($_GET["offset"]) ? $_GET["offset"] : 0;
if ($day == null){
	$day = Date("Y-m-d");
	$offset = -1;
}

$dbconn = iemdb("mesosite");
$rs = pg_prepare($dbconn, "yesterday", "SELECT *, date(valid) as d,
              to_char(valid, 'YYYY/MM/YYMMDD') as imageref, 
              to_char(valid, 'DD Mon YYYY HH:MI AM') as webdate from feature
              WHERE valid < $1 ORDER by valid DESC limit 1");
$rs = pg_prepare($dbconn, "today", "SELECT *, date(valid) as d,
              to_char(valid, 'YYYY/MM/YYMMDD') as imageref, 
              to_char(valid, 'DD Mon YYYY HH:MI AM') as webdate from feature
              WHERE date(valid) = $1");
$rs = pg_prepare($dbconn, "tomorrow", "SELECT *, date(valid) as d,
              to_char(valid, 'YYYY/MM/YYMMDD') as imageref, 
              to_char(valid, 'DD Mon YYYY HH:MI AM') as webdate from feature
              WHERE valid > ($1::date + '1 day'::interval) 
              ORDER by valid ASC limit 1");

$q = "today";
if ($offset == "-1"){ $q = "yesterday"; }
else if ($offset == "+1") {$q = "tomorrow";}
$result = pg_execute($dbconn, $q, Array($day));

if (pg_num_rows($result) == 0){ die("Feature Not Found"); }

$row = pg_fetch_array($result,0);
$valid = strtotime( $row["valid"] );
$fmt = "gif";
if ($valid > strtotime("2010-02-19")){ $fmt = "png"; }

if ($row["fbid"] == null){
	$row["fbid"] = $valid;
}

$day = $row["d"];
$thumb = sprintf("http://mesonet.agron.iastate.edu/onsite/features/%s_s.%s", $row["imageref"], $fmt);
$big = sprintf("http://mesonet.agron.iastate.edu/onsite/features/%s.%s", $row["imageref"], $fmt);

$t->title = "$day Feature - ". $row["title"]; 
$t->thispage = "iem-feature";

$content = <<<EOF
<button type="button" class="btn btn-default btn-lg">
  <span class="glyphicon glyphicon-arrow-left"></span> <a href="cat.php?day={$day}&offset=-1">Previous Feature by Date</a> 
</button>
<strong>IEM Daily Feature for {$day}</strong>
<button type="button" class="btn btn-default btn-lg">
  <span class="glyphicon glyphicon-arrow-left"></span> <a href="cat.php?day={$day}&offset=1">Next Feature by Date</a> 
</button>

<!-- Begin Feature Display -->

<table cellpadding="2" cellspacing="0" border="1"><commit_msg>fix right arrow <commit_after><?php 
include("../../../config/settings.inc.php");
define("IEM_APPID", 55);
define("FBEXTRA", True); 
include("../../../include/myview.php");
$t = new MyView();

include("../../../include/database.inc.php");
include("../../../include/feature.php");
$day = isset($_GET["day"]) ? substr($_GET["day"],0,10) : null;
$offset = isset($_GET["offset"]) ? $_GET["offset"] : 0;
if ($day == null){
	$day = Date("Y-m-d");
	$offset = -1;
}

$dbconn = iemdb("mesosite");
$rs = pg_prepare($dbconn, "yesterday", "SELECT *, date(valid) as d,
              to_char(valid, 'YYYY/MM/YYMMDD') as imageref, 
              to_char(valid, 'DD Mon YYYY HH:MI AM') as webdate from feature
              WHERE valid < $1 ORDER by valid DESC limit 1");
$rs = pg_prepare($dbconn, "today", "SELECT *, date(valid) as d,
              to_char(valid, 'YYYY/MM/YYMMDD') as imageref, 
              to_char(valid, 'DD Mon YYYY HH:MI AM') as webdate from feature
              WHERE date(valid) = $1");
$rs = pg_prepare($dbconn, "tomorrow", "SELECT *, date(valid) as d,
              to_char(valid, 'YYYY/MM/YYMMDD') as imageref, 
              to_char(valid, 'DD Mon YYYY HH:MI AM') as webdate from feature
              WHERE valid > ($1::date + '1 day'::interval) 
              ORDER by valid ASC limit 1");

$q = "today";
if ($offset == "-1"){ $q = "yesterday"; }
else if ($offset == "+1") {$q = "tomorrow";}
$result = pg_execute($dbconn, $q, Array($day));

if (pg_num_rows($result) == 0){ die("Feature Not Found"); }

$row = pg_fetch_array($result,0);
$valid = strtotime( $row["valid"] );
$fmt = "gif";
if ($valid > strtotime("2010-02-19")){ $fmt = "png"; }

if ($row["fbid"] == null){
	$row["fbid"] = $valid;
}

$day = $row["d"];
$thumb = sprintf("http://mesonet.agron.iastate.edu/onsite/features/%s_s.%s", $row["imageref"], $fmt);
$big = sprintf("http://mesonet.agron.iastate.edu/onsite/features/%s.%s", $row["imageref"], $fmt);

$t->title = "$day Feature - ". $row["title"]; 
$t->thispage = "iem-feature";

$content = <<<EOF
<button type="button" class="btn btn-default btn-lg">
  <span class="glyphicon glyphicon-arrow-left"></span> <a href="cat.php?day={$day}&offset=-1">Previous Feature by Date</a> 
</button>
<strong>IEM Daily Feature for {$day}</strong>
<button type="button" class="btn btn-default btn-lg">
  <a href="cat.php?day={$day}&offset=1">Next Feature by Date</a> 
  <span class="glyphicon glyphicon-arrow-right"></span> 
</button>

<!-- Begin Feature Display -->

<table cellpadding="2" cellspacing="0" border="1">
{'fraction_non_alphanumeric': 0.2281083218027278, 'fraction_numerical': 0.011860051393556038, 'mean_word_length': 3.715750232991612, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3926496', 'n_tokens_mistral': 1887, 'n_tokens_neox': 1811, 'n_words': 428}