function check_plain($s) {
return utf8_encode($s);
}
$link=mysql_connect("www.iiia.csic.es","webread","83KfRe4Hrwjx4qjV");
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$author_id=45950;
$out=mysql_select_db("web2016");
$sql="SELECT DISTINCT year from publications_table WHERE drupales_nid LIKE '%;" . $author_id . ";%' order by year desc";
$res=mysql_query($sql,$link);
$output="";
$current_year=$_POST["sel"];
$today = getdate();
$year=$today["year"];
if (!isset($_POST["sel"])) {
// if ($today["mon"]>2) $current_year=$year;
// else $current_year=$year-1 . "+";
$current_year=$year . "+";
}
if ($today["mon"]>2) { $year++; }
$output .='
';
$output .= '
';
$output .= '
';
if (strpos($current_year,"+"))
$sql="SELECT * from publications_table WHERE drupales_nid LIKE '%;" . $author_id . ";%' and year >= " . ($year-1) . " order by year desc ";
else
$sql="SELECT * from publications_table WHERE drupales_nid LIKE '%;" . $author_id . ";%' and year = " . ($current_year) . " order by year desc ";
$res=mysql_query($sql);
for ($i=0;$i
' . ($name) . '';
else $autline[] = '' . ($name) . '';
}
$output .= implode($autline,", ") . " ";
// Publication Title
$output .= '"' . $row["title"] . "\"";
$output .=', ';
if ($row["second_title"]) {
$output .= ''.check_plain($row["second_title"]).'';
}
$output .="";
if (!empty($row["year"])) {
if ($row["year"]=="9998") $output .= ', In Press' ;
else if ($row["year"]=="9999") $output .= ', Submitted ';
else $output .= ', ' . check_plain($row["year"]) . '' ;
}
$fquery=mysql_query("select * from file_managed as f left join file_usage as u on f.fid=u.fid where u.id=" . $row["id"]);
$result_pdf=mysql_fetch_assoc($fquery);
if ($result_pdf["filename"]) {
$output .= ' ';
} else {
$output .= '
';
}
$output .= '
' ;
}
echo $output;
mysql_close();
?>