...
 
Commits (1)
config.php
configuration.sh
Outil de revue de presse
GPL v2
2006-2009
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
require_once("config.php");
$id=intval($_REQUEST["id"]);
$c=@mysql_fetch_array(mysql_query("SELECT * FROM presse WHERE id='$id';"));
?>
<a href="<?=$c["url"]; ?>" target="_blank"><?=substr($c["url"],0,80); ?></a><br />
<h2><?=$c["title"]; ?></h2>
<?php if (is_file("ssc/".$id.".jpg")) { ?>
<img src="/rp/ssc/<?=$id; ?>.jpg" alt="" title="" id="ssc<?=$id; ?>"/><a href="javascript:regenerate('<?=$id; ?>');" title="Cliquer ici pour supprimer la vignette actuelle" accesskey="x">X</a><br />
<?php } ?>
<?php if (is_file("txt/".$id.".txt")) {
echo str_replace("\n\n","\n<br /><br />\n",iconv("ISO-8859-1","UTF-8",file_get_contents("txt/".$id.".txt")));
} ?>
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
require_once("config.php");
$action=trim($_REQUEST["action"]);
$id=intval($_REQUEST["id"]);
$HOME="/html/p/pi/site/rp/";
if ($action=="regenerate") {
@unlink($HOME."sc/".$id.".jpg");
@unlink($HOME."ssc/".$id.".jpg");
mysql_query("UPDATE presse SET screenshot=0 WHERE id='$id';");
exit();
}
if ($action=="note") {
mysql_query("UPDATE presse SET note=note+ '".intval($_REQUEST["note"])."' WHERE id='$id';");
list($note)=@mysql_fetch_array(mysql_query("SELECT note FROM presse WHERE id='$id';"));
echo $note;
exit();
}
$field=trim($_REQUEST["field"]);
if ($field!="published" && $field!="cite") {
echo "-1"; exit();
}
$status=intval($_REQUEST["status"]);
list($res)=@mysql_fetch_array(mysql_query("SELECT $field FROM presse WHERE id = $id ;"));
if ($res==$status) {
$status=0;
}
mysql_query("UPDATE presse SET $field = $status WHERE id = $id ;");
echo mysql_error();
list($res)=@mysql_fetch_array(mysql_query("SELECT $field FROM presse WHERE id = $id ;"));
echo $res;
?>
\ No newline at end of file
<?php
mysql_connect("localhost","root","password");
mysql_select_db("pi");
require_once("functions.php");
$HOME="/html/p/pi/site/rp/";
?>
\ No newline at end of file
#!/bin/bash
HTTP_USER=""
HTTP_PWD=""
en.png

319 Bytes

exec.png

854 Bytes

fr.png

267 Bytes

This diff is collapsed.
ham.gif

551 Bytes

ham2.gif

348 Bytes

<?php
require_once("config.php");
function is_utf8($string) {
// From http://w3.org/International/questions/qa-forms-utf-8.html
return preg_match('%^(?:
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
)*$%xs', $string);
}
if(!function_exists('mb_detect_encoding')) {
function mb_detect_encoding($string, $enc=null) {
static $list = array('utf-8', 'iso-8859-1', 'windows-1251');
foreach ($list as $item) {
$sample = iconv($item, $item, $string);
if (md5($sample) == md5($string)) {
if ($enc == $item) { return true; } else { return $item; }
}
}
return false;
}
}
function extractURL($url)
{
// On set le titre avec la fin de l'url
$cleanUrl = $url;
$cleanUrl = str_replace(".html", "", $cleanUrl);
$cleanUrl = str_replace(".htm", "", $cleanUrl);
$cleanUrl = str_replace(".asp", "", $cleanUrl);
$cleanUrl = str_replace(".aspx", "", $cleanUrl);
$cleanUrl = str_replace(".php", "", $cleanUrl);
return substr($cleanUrl, -60);
}
function importTitre()
{
$mysqli = LQDNConnect();
// Requête d'un seul article sans titre en commençant par le plus récent
// On ne récupère pas les pdf, ni les webm, ni les mp3 qu'on ne sait pas lire
// TODO: S'il y en a plusieurs, on ne crée les titres d'article qu'un par un...
$lineWithoutTitle = "SELECT * FROM `presse` WHERE `url` NOT REGEXP '(webm|pdf|mp3)$' AND `title` = '' ORDER BY `id` DESC LIMIT 0, 1";
$result = $mysqli->query($lineWithoutTitle);
$row = $result->fetch_assoc();
$url = $row['url'];
// Ouverture de l'url
// TODO: pour éviter les blocages, il faudrait avoir un timeout là-dessus
$handle = fopen($url, "r");
if ($handle)
{
//echo "fopen ok<br>";
while(!feof($handle))
$data .= fgets($handle, 5000000);
if ($data)
{
$DOM = new DOMDocument;
$DOM->loadHTML($data);
$items = $DOM->getElementsByTagName('title');
if ($items->length > 0)
$title = $items->item(0)->nodeValue;
}
if($title == "")
$title = extractURL($url);
// Si le titre est trouvé, on préfixe par le nom du média
// TODO: Pourquoi on ne fait pas la même chose lors des erreurs d'ouverture plus bas ?
if ($title != "")
{
// grab the website uri then split it on "."
eregi("https?://([^/]*)/", $url, $tabreponse);
$split_response = explode(".", $tabreponse[1]);
// TODO: Cette partie passe la première lettre de chaque mot en majuscule de manière crade...
// remove "www" and "com"
// this piece of code is a crape
$working_array = array();
for ($i = 0; $i < sizeof($split_response); ++$i)
if ($split_response[$i] != "www" and $split_response[$i] != "com")
array_push($working_array, $split_response[$i]);
$result = "";
for ($i = 0; $i < sizeof($working_array); ++$i)
{
// ucfirst to upper the first char of the string
$result = $result . ucfirst($working_array[$i]);
// if this isn't the last element add a "." (ie: Elpais.Es)
if ($i < sizeof($working_array) - 1)
$result = $result . ".";
}
// format
$title = "[" . $result . "] " . $title;// . "\r\n";
}
// TODO: Ici, on finit avec un titre vide, on va donc bloquer sur cet article indéfiniment...
else
$title = "";
}
else
{
// Dans les cas non fonctionnels (erreur 404 par exemple),
// on remplit le titre avec la fin de l'url
$title = extractURL($url);
// TODO: Pourquoi faire un echo ici ? Ça finit par s'afficher sur la page web...
echo $title."<br>";
}
$title = str_replace(array("\r","\n"), "", $title);
$title = addslashes($title);
// On affecte le titre à l'article
$sqlUpdate = "UPDATE `presse` set `title` = '".$title."' WHERE `id` = '".$row["id"]."'";
$mysqli->query($sqlUpdate);
}
?>
This diff is collapsed.
<?php
require_once("config.php");
require_once("importTitrePi.php");
//TODO: non utilisé !
$privileged=array("benjamin","jz","siltaar","nca","guyzmo","felix","darkknow","nahuel");
// Force le rafraichissement à chaque fois
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
//TODO: non utilisé !
$alang=array("fr","en","de","it","es","se","ru","fi","XX");
// TODO: non utilisé !
$apublished=array(0=>"Unknown", 1=>"Publish", 2=>"DO NOT publish");
// TODO: même commande plus bas : inutile ici
if (!isset($_REQUEST["cite"])) $_REQUEST["cite"]=-1;
$torder=array(
0=>"Note",
1=>"Date",
);
$aorder=array(
0=>"note DESC,datec DESC,id DESC",
1=>"datec DESC"
);
// TODO: Voir ce que signifient exactement ces champs...
// default : http://www.laquadrature.net/rp/?nid=1&cite=-1&order=1&q=&count=20
if (!isset($_REQUEST["order"])) $_REQUEST["order"]=1;
if (!isset($_REQUEST["cite"])) $_REQUEST["cite"]=-1;
if (!isset($_REQUEST["count"])) $_REQUEST["count"]=20;
if (!isset($_REQUEST["nid"])) $_REQUEST["nid"]=1;
// DEBUG
if (!isset($_REQUEST["published"])) $_REQUEST["published"]=-1;
$order=intval($_REQUEST["order"]);
// Mise à jour du titre de l'article enregistré le plus récent
// DEBUG
//importTitre();
// TODO: Globalement, refaire le html au propre, a minima que le code html soit clair
?>
<html>
<head>
<meta charset="utf-8" />
<title>Press Report Management</title>
<script src="main.js">
</script>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" title="Normal" />
<link rel="stylesheet" type="text/css" href="style1.css" media="screen" title="Normal" />
</head>
<body>
<table><tr><td style="width: 70%; vertical-align: top">
<form method="get" action="" name="f1" id="f1">
<table class="box">
<!-- Partie permettant de filtrer -->
<tr><th colspan="4">Result filtering</th></tr>
<tr>
<td>
<!-- TODO: Commande php ci-dessous effectuée quand même, à nettoyer -->
<!-- Show by published status: <select class="inl" name="published" onchange="document.forms['f1'].submit();" ><?php
$filter_published=array(-1=>"Everything",0=>"Only Unknown URL",1=>"Only Published URL",2=>"Only URL which are not a PR");
eoption($filter_published,$_REQUEST["published"]);
?></select> -->
Afficher <select class="inl" name="nid" onchange="document.forms['f1'].submit();" ><?php
$filter_nid=array(0=>"Tout",1=>"Le non trait&eacute;");
eoption($filter_nid,$_REQUEST["nid"]);
?></select>
</td>
<td>Afficher <select class="inl" name="cite" onchange="document.forms['f1'].submit();" ><?php
$filter_cite=array(-1=>"Tout",0=>"Les cite inconnus",1=>"Ceux qui nous citent",2=>"Ceux qui ne nous citent pas");
eoption($filter_cite,$_REQUEST["cite"]);
?></select>
Trier par <select class="inl" name="order" id="order" onchange="document.forms['f1'].submit();">
<?php
eoption($torder,$_REQUEST["order"]);
?>
</td>
<td>Search: <input class="int" type="text" name="q" value="<?php eher("q"); ?>" size="30"/>
</td>
<?php
// TODO: Risque d'injection SQL ?
// TODO: Pourquoi la requête n'est pas construite plus haut dans le script ? Ça serait plus propre
// Création de la requête de recherche des articles
// Les articles de moins de 2 mois
$wh="WHERE DATE_SUB(NOW(), INTERVAL 2 MONTH)<datec ";
// Les articles avec un statut 'published' spécifique
// TODO: published n'est pas vérifié dans les valeurs passées en requête en début de script
if ($_REQUEST["published"]!=-1) {
$wh.=" AND published=".intval($_REQUEST["published"])." ";
}
// Les articles à publier
if ($_REQUEST["nid"]==1) {
$wh.=" AND nid=0 AND note>=3 ";
}
// TODO: Que signifie une note à 7 ?
// Les articles avec une note à 7
if ($_REQUEST["nid"]==2) {
$wh.=" AND note=7 ";
}
// Les articles avec un statut 'cite' spécifique
if ($_REQUEST["cite"]!=-1) {
$wh.=" AND cite=".intval($_REQUEST["cite"])." ";
}
// Recherche de texte sur l'url ou l'id
$q=trim($_REQUEST["q"]);
if ($q) {
$wh.=" AND (url LIKE '%".addslashes($q)."%' OR id ='".addslashes($q)."') ";
}
// TODO: le nombre d'articles forcé n'est pas cohérent avec le nombre par défaut
// si le nombre d'articles à afficher est inférieur à 10, on force l'affichage à 100
$count=intval($_REQUEST["count"]);
if (!$count || $count<10) $count=100;
// TODO: offset n'est pas vérifié dans les valeurs passées en requête en début de script
$offset=intval($_REQUEST["offset"]);
if (!$offset) $offset=0;
list($total)=@mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM presse $wh ;"));
$r=mysql_query("SELECT * FROM presse $wh ORDER BY ".$aorder[$order]." LIMIT $offset,$count");
//DEBUG
echo "<!-- SELECT * FROM presse $wh ORDER BY ".$aorder[$order]." LIMIT $offset,$count -->";
?>
</tr>
<tr>
<td colspan="2">
Afficher <select class="inl" name="count" id="count" onchange="document.forms['f1'].submit();">
<?php
$acount=array(10=>10,20=>20,50=>50,100=>100,200=>200,500=>500,1000=>1000,2000=>2000,5000=>5000,10000=>10000);
// TODO: La variable count n'est pas prise en compte ici...
eoption($acount,$_REQUEST["count"]);
?>
</select> par page. &nbsp; | &nbsp;
<?php pager($offset,$count,$total,"/rp/?offset=%%offset%%&count=".$count."&q=".urlencode($q)."&cite=".intval($_REQUEST["cite"])."&published=".intval($_REQUEST["published"])."&nid=".intval($_REQUEST["nid"])."&order=".intval($_REQUEST["order"]).""); ?>
</td>
<td colspan="2">Showing URL <?=$offset; ?> to <?=($offset+$count); ?>. on a total of <?=$total; ?></td>
</tr>
</table>
</form>
<!-- Fin de la partie gérant l'affichage -->
<!-- TODO: Définir à quoi sert ceci -->
<div id="smallbox" style="display:none; position: absolute; " >
<img src="/rp/ssc/1250.jpg" alt="" title="" id="ssc" />
</div>
<table class="box"><tr>
<th>ID</th>
<th>Date</th>
<th>Action</th>
<th>Titre</th>
<th colspan="2">Note</th>
<th>Node</th>
<th>From</th>
</tr>
<?php
$col=1;
$ids=array();
while ($c=mysql_fetch_array($r)) {
$ids[]=$c["id"];
$urls[$c["id"]]=$c["url"];
$title[$c["id"]]=$c["title"];
$col=3-$col;
echo "<tr class=\"c$col\">\n";
echo "<td>";
if ($c["seemscite"]) echo "<b>";
echo "".$c["id"]."";
if ($c["seemscite"]) echo "</b>";
echo "</td>\n";
echo "<td>".date_my2fr($c["datec"],1)."</td>\n";
echo "<td>";
echo "<a href=\"javascript:rswap(".$c["id"].");\"><img src=\"exec.png\" alt=\"Open the thumbnail\" title=\"Open the thumbnail\" /></a> &nbsp; ";
if ($c["note"]>2 && !$c["nid"]) {
echo "<a href=\"javascript:id(".$c["id"].",1)\"><img src=\"en.png\" alt=\"Send this to drupal IN ENGLISH\" title=\"Send this to drupal IN ENGLISH\" /></a>";
echo "<a href=\"javascript:id(".$c["id"].",2)\"><img src=\"fr.png\" alt=\"Send this to drupal EN FRANCAIS\" title=\"Send this to drupal EN FRANCAIS\" /></a>";
}
echo "</td>";
$infoTitre = ($c["title"] == "") ? substr($c["url"],0,60) : str_replace(" »", "&nbsp;»", str_replace("« ", "«&nbsp;", $c["title"]));
$infoTitre = html_entity_decode($infoTitre);
//if(is_utf8($infoTitre))
// $infoTitre = utf8_decode($infoTitre)."*";
//if (mb_detect_encoding($infoTitre, 'UTF-8') === true)
//$infoTitre = utf8_decode($infoTitre);
echo "<td><a target=\"_blank\" id=\"link".$c["id"]."\" href=\"".$c["url"]."\">".$infoTitre."</a></td>\n";
echo "<td>";
echo "<span id=\"note_".$c["id"]."\">";
echo $c["note"];
echo "</span>";
echo "</td><td>";
/*
<a href="javascript:publish(1,<?=$c["id"]; ?>)"><img id="py<?=$c["id"]; ?>" src="ham<?php if ($c["published"]==1) { echo "2"; } ?>.gif" alt="Mark as 'Published'" title="Mark as 'Published'"/></a>
<a href="javascript:publish(2,<?=$c["id"]; ?>)"><img id="pn<?=$c["id"]; ?>" src="spam<?php if ($c["published"]==2) { echo "2"; } ?>.gif" alt="Mark as 'Not a PR'" title="Mark as 'Not a PR'"/></a>
*/
// if (in_array($_SERVER["REMOTE_USER"],$privileged)) {
?>
<a href="javascript:note(1,<?=$c["id"]; ?>)"><img id="ny<?=$c["id"]; ?>" src="ham<?php if ($c["note"]>0) { echo "2"; } ?>.gif" alt="Add a point" title="Add a point"/></a>
<a href="javascript:note(-1,<?=$c["id"]; ?>)"><img id="nn<?=$c["id"]; ?>" src="spam<?php if ($c["note"]<0) { echo "2"; } ?>.gif" alt="Remove a point" title="Remove a point"/></a>
<?php
// }
echo "</td>\n";
echo "<td>";
if ($c["nid"]) {
echo "<a target=\"_blank\" href=\"/fr/node/".$c["nid"]."/edit\"><img src=\"modifier.png\" alt=\"Edit this node\" title=\"Edit this node\" /></a> &nbsp; ";
echo "<a target=\"_blank\" href=\"/fr/node/".$c["nid"]."\"><img src=\"exec.png\" alt=\"Got to this node\" title=\"Go to this node\" /></a> (".$c["nid"].")";
}
echo "&nbsp;";
echo "</td>\n";
echo "<td>".$c["provenance"]."</td>\n";
echo "</tr>\n";
}
?>
</table>
</td><td style="width: 30%; vertical-align: top">
<?php
foreach($ids as $id) {
?>
<div id="t<?=$id; ?>" class="smallbox"><?php
/*
<a href="<?=$urls[$id]; ?>" target="_blank"><?=substr($urls[$id],0,80); ?></a><br />
<h2><?=$title[$id]; ?></h2>
<?php if (is_file("ssc/".$id.".jpg")) { ?>
<img src="/rp/ssc/<?=$id; ?>.jpg" alt="" title="" id="ssc<?=$id; ?>"/><br />
<?php } ?>
<?php if (is_file("txt/".$id.".txt")) {
echo str_replace("\n\n","\n<br /><br />\n",file_get_contents("txt/".$id.".txt"));
}
*/
?></div>
<?php
}
?>
</td></tr></table>
</body>
</html>
getAbsolutePos = function(el) {
var SL = 0, ST = 0;
var is_div = /^div$/i.test(el.tagName);
if (is_div && el.scrollLeft)
SL = el.scrollLeft;
if (is_div && el.scrollTop)
ST = el.scrollTop;
var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
if (el.offsetParent) {
var tmp = this.getAbsolutePos(el.offsetParent);
r.x += tmp.x;
r.y += tmp.y;
}
return r;
};
function moveat(src,dst) {
src=document.getElementById(src);
dst=document.getElementById(dst);
r=getAbsolutePos(dst);
src.style.left=(r.x+20)+"px";
src.style.top=(r.y+20)+"px";
}
/*******************************************************/
/* Afficher et Cacher les composants. */
function hide(s) {
if (document.all) {
if (document.all[s]) {
document.all[s].visibility="invisible";
eval("document.all."+s+".style.display=\"none\"");
}
} else {
if (document.getElementById(s)) {
document.getElementById(s).visibility="invisible";
document.getElementById(s).style.display="none";
}
}
}
function show(s,shm) {
if (!shm) shm="block";
if (document.all) {
if (document.all[s]) {
document.all[s].visibility="visible";
eval("document.all."+s+".style.display=\"block\"");
}
} else {
if (document.getElementById(s)) {
document.getElementById(s).visibility="visible";
document.getElementById(s).style.display=shm;
}
}
}
/*******************************************************/
/* XMLHTTPREQUEST compatible IE/Mozilla. */
var group=false;
function openxml() {
var xmlhttp;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
var cid=0;
function cite(status,id) {
x=openxml();
x.open("GET", "http://www.laquadrature.net/rp/ajx.php?field=cite&status="+status+"&id="+id+"",true);
cid=id;
x.onreadystatechange=function() {
if (x.readyState==4) {
st=parseInt(x.responseText,10);
if (st==0) {
document.getElementById('cy'+cid).src="/rp/ham.gif";
document.getElementById('cn'+cid).src="/rp/spam.gif";
} else if (st==1) {
document.getElementById('cy'+cid).src="/rp/ham2.gif";
document.getElementById('cn'+cid).src="/rp/spam.gif";
} else if (st==2) {
document.getElementById('cy'+cid).src="/rp/ham.gif";
document.getElementById('cn'+cid).src="/rp/spam2.gif";
}
delete x;
}
}
x.send(null);
}
var pid=0;
function publish(status,id) {
x=openxml();
x.open("GET", "http://www.laquadrature.net/rp/ajx.php?field=published&status="+status+"&id="+id+"",true);
cid=id;
x.onreadystatechange=function() {
if (x.readyState==4) {
st=parseInt(x.responseText,10);
if (st==0) {
document.getElementById('py'+cid).src="/rp/ham.gif";
document.getElementById('pn'+cid).src="/rp/spam.gif";
} else if (st==1) {
document.getElementById('py'+cid).src="/rp/ham2.gif";
document.getElementById('pn'+cid).src="/rp/spam.gif";
} else if (st==2) {
document.getElementById('py'+cid).src="/rp/ham.gif";
document.getElementById('pn'+cid).src="/rp/spam2.gif";
}
delete x;
}
}
x.send(null);
}
function regenerate(id) {
x=openxml();
x.open("GET", "http://www.laquadrature.net/rp/ajx.php?action=regenerate&id="+id+"",true);
x.send(null);
hide('ssc'+id);
}
function rin(i) {
/*
hide('smallbox');
document.getElementById('ssc').src="/rp/ssc/"+i+".jpg";
moveat('smallbox','link'+i);
show('smallbox');
*/
}
function rout(i) {
hide('t'+i);
/*
hide('smallbox');
document.getElementById('ssc').src="/rp/loading.png";
*/
}
var rid=0;
function rswap(i) {
if (rid!=i && rid!=0) {
hide('t'+rid);
rid=0;
}
if (rid==i) {
hide('t'+rid);
rid=0;
} else {
show('t'+i);
rid=i;
if (document.getElementById('t'+i).innerHTML=='') {
// ok, let's load it ...
x=openxml();
x.open("GET", "http://www.laquadrature.net/rp/ajcontent.php?id="+i,true);
x.onreadystatechange=function() {
if (x.readyState==4) {
document.getElementById('t'+i).innerHTML=x.responseText,10;
delete x;
}
}
x.send(null);
}
}
}
function id(i,lang) {
if (confirm("Voulez-vous vraiment importer cet article dans drupal (s'il n'existe pas deja...) ?")) {
window.open("http://www.laquadrature.net/rp/import_drupal.php?id="+i+"&lang="+lang);
}
}
function note(note,id) {
x=openxml();
x.open("GET", "/rp/ajx.php?action=note&note="+note+"&id="+id+"",true);
cid=id;
x.onreadystatechange=function() {
if (x.readyState==4) {
st=parseInt(x.responseText,10);
document.getElementById('note_'+cid).innerHTML=st;
if (st<0) {
document.getElementById('ny'+cid).src="/rp/ham.gif";
document.getElementById('nn'+cid).src="/rp/spam2.gif";
} else if (st>3) {
document.getElementById('ny'+cid).src="/rp/ham2.gif";
document.getElementById('nn'+cid).src="/rp/spam.gif";
} else if (st>=0) {
document.getElementById('ny'+cid).src="/rp/ham.gif";
document.getElementById('nn'+cid).src="/rp/spam.gif";
}
delete x;
}
}
x.send(null);
}
modifier.png

691 Bytes

DROP TABLE IF EXISTS `presse`;
CREATE TABLE `presse` (
`id` int(10) unsigned NOT NULL auto_increment,
`url` varchar(255) NOT NULL,
`cite` tinyint(3) unsigned NOT NULL,
`lang` varchar(2) NOT NULL,
`published` tinyint(3) unsigned NOT NULL,
`datec` datetime NOT NULL,
`nid` int(10) unsigned NOT NULL,
`screenshot` tinyint(3) unsigned NOT NULL,
`title` varchar(255) NOT NULL,
`fetched` tinyint(4) NOT NULL,
`seemscite` tinyint(4) NOT NULL,
`provenance` varchar(128) NOT NULL,
`note` tinyint(4) NOT NULL default '0' COMMENT 'Note (urgence)',
`date_publi` datetime default NULL,
PRIMARY KEY (`id`),
KEY `note` (`note`)
) DEFAULT CHARSET=latin1;
#!/bin/sh
source configuration.sh
set -e
while true
do
LINE=`wget http://www.laquadrature.net/rp/shots_needed.php --http-user $HTTP_USER --http-passwd $HTTP_PWD -O - -q`
URL=`echo "$LINE"|sed -e's/^[^ ]* \(.*\)$/\1/'`
LID=`echo "$LINE"|sed -e's/^\([^ ]*\) .*$/\1/'`
if [ -z "$LID" ]
then
echo "Nothing..."
sleep 60
fi
if [ "$LID" ]
then
echo "link $LID has url $URL, capturing ..."
name="/tmp/shot_$$"
xvfb-run --server-args="-screen 0, 1024x768x24" cutycapt --url="$URL" --out=${name}croptmp.png
convert ${name}croptmp.png -crop 1020x1000 ${name}crop.png
if [ -f ${name}crop-0.png ]; then
mv -f ${name}crop-0.png ${name}.png
fi
if [ -f ${name}crop.png ]; then
mv -f ${name}crop.png ${name}.png
fi
rm -f ${name}crop*
convert ${name}.png -quality 80% ${name}.jpg
wput ${name}.jpg ftp://pi_sc:shots@pi.serverside.fr/${LID}.jpg
sleep 5
wget "http://www.laquadrature.net/rp/shots_done.php?lid=${LID}" --http-user ${HTTP_USER} --http-passwd ${HTTP_PWD} -q -O -
fi
done
<?php
require_once("config.php");
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Content-Type: text/plain");
$lid=intval($_REQUEST["lid"]);
$r=mysql_query("SELECT id,screenshot FROM presse WHERE id=$lid;");
$c=mysql_fetch_array($r);
if ($c["screenshot"]==0 && is_file("sc/".$lid.".jpg")) {
mysql_query("UPDATE presse SET screenshot=1 WHERE id=$lid;");
}
if ($c["screenshot"]==0 && !is_file("sc/".$lid.".jpg")) {
mysql_query("UPDATE presse SET screenshot=2 WHERE id=$lid;");
}
if (is_file("sc/".$lid.".jpg") && !is_file("ssc/".$lid.".jpg")) {
passthru("convert ".escapeshellarg($HOME."sc/".$lid.".jpg")." -resize 200x ".escapeshellarg($HOME."ssc/".$lid.".jpg")."");
}
?>
\ No newline at end of file
<?php
require_once("config.php");
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Content-Type: text/plain");
$r=mysql_query("SELECT id,url FROM presse WHERE screenshot=0 ORDER BY id DESC ;");
$c=mysql_fetch_array($r);
echo $c["id"]." ";
echo $c["url"]."\n";
?>
\ No newline at end of file
spam.gif

550 Bytes

spam2.gif

347 Bytes

/****************************************************************************/
/* BALISES HTML GLOBALES */
/****************************************************************************/
/****************************************************************************/
/* GENERIQUE */
/****************************************************************************/
.error, .warning, .info {
background: white;
padding: 4px; border: 1px solid black;
font-weight: bold;
font-size: 12px;
}
.warning {
color: #C09000;
}
.error {
color: red;
}
.info {
color: green;
}
/****************************************************************************/
/* LIST TABLES */
/****************************************************************************/
.tlist {
border-collapse: collapse;
padding: 0;
margin: 0;
border: 1px solid #94928C;
}
.tlist th {
padding-left: 3px;
font-weight: normal;
text-align: left;
font-family: Verdana, Arial, sans-serif;
font-size: 9px;
background: #e2ddd3 url(ch_back.gif) repeat-x;
border: 1px solid #94928C;
}
.tlist th img {
margin-bottom: 1px;
}
.tlist td {
border: 0px;
border-right: 1px solid #94928C;
border-left: 1px solid #94928C;
font-weight: normal;
text-align: left;
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
}
.tlist td div {
overflow: hidden;
height: 14px;
}
.tlist form input {
padding: 0;
margin: 0;
border: 1px solid #A0A0A0;
background: #F0F0F0;
font-family: Verdana, Arial, sans-serif;
font-size: 9px;
padding-left: 2px;
}
.chmenu {
cursor: pointer;
position: absolute;
width: 120px;
overflow: hidden;
border: 1px solid #A0A0A0;
background: #e2ddd3;
}
.chmenu div {
background: #e2ddd3;
}
.chmenu div:hover {
background: #b2ada3;
}
.searchmotor {
padding: 6px;
padding-bottom: 0;
background: white;
margin: 0px;
border: 1px solid #e67643;
z-index: 1;
}
.searchmotor th {
text-align: right;
font-size: 11px;
padding: 3px;
}
.searchmotor td {
text-align: left;
font-size: 11px;
padding: 3px;
}
.searchmotor_pref {
padding-bottom: 0;
background: white;
margin: 0px;
border: 1px solid black;
z-index: 1;
}
.searchmotor_pref td {
text-align: left;
font-size: 11px;
width: 200px;
}
/****************************************************************************/
/* TEMPORARY STYLES */
/****************************************************************************/
.TODO-ACODER {
background: #303030;
}
/****************************************************************************/
/* FORUMS */
/****************************************************************************/
.forumthreads p {
padding: 0;
margin: 0;
}
.forumthreads img {
border: 0;
padding: 0; margin: 0;
vertical-align: middle;
}
p.ft {
padding: 0; margin: 0;
padding-left: 15px;
}
p.fm1, p.fm {
padding: 0; margin: 0;
padding-left: 30px;
color: #900090;
font-style: italic;
font-size: 11px;
}
p.fm1 {
background: #D5D5D5;
}
/*****************************************************/
/* FORUM :
Anchor des messages, lu ou non lu (r ou non r)
courant ou non courant (c ou non c)
*/
/* Pseudo : */
.fp {
font-style: italic;
}
/* Pseudo dans les messages : */
.fmps {
font-size: 12px;
font-style: italic;
padding-top: 0px;
margin-top: 0px;
}
a.fa, a.fa:link, a.fa:hover {
font-weight: bold;
color: black;
text-decoration: none;
}
a.far, a.far:link, a.fa:visited, a.far:visited, a.far:hover {
font-weight: bold;
text-decoration: none;
color: #707070;
}
a.fac, a.fac:link, a.fac:visited, a.fac:hover {
font-weight: bold;
text-decoration: underline;
color: #600060;
}
a.farc, a.farc:link, a.farc:visited, a.farc:hover {
font-weight: bold;
text-decoration: underline;
color: #B070B0;
}
.fquote {
font-size: 12px;
border: 1px solid #909090;
padding: 2px;
background: #F0F0F0;
}
.fquote .fquote {
font-size: 12px;
border: 1px solid #909090;
padding: 2px;
background: #D0D0D0;
}
.fquote .fquote .fquote {
font-size: 12px;
border: 1px solid #909090;
padding: 2px;
background: #B0B0B0;
}
.ftx {
font-size: 12px;
}
.ftx a, .ftx a:visited, .ftx a:link, .ftx a:hover, .ftx a:active {
text-decoration: underline;
}
/*****************************************************/
/* Forum Post : */
.forump {
width: 150px;
border: 1px solid #000030;
border-collapse: collapse;
}
.forump td {
text-align: left;
color: #000030;
background: #FFF8E0;
padding: 2px;
padding-left: 6px;
padding-right: 6px;
}
.ln2 {
color: #900090;
}
/*****************************************************/
/* DOCUMENTHEQUE */
/*****************************************************/
.docgrp {
font-size: 12px;
font-weight: bold;
color: #603000;
}
.docfold a {
text-decoration: none;
}
.docfold a:hover {
text-decoration: underline;
}
.docfold img {
vertical-align: middle;
}
.docfold td {
padding-bottom: 3px;
}
.vignette {
vertical-align:top;
padding:5px;
margin:10px;
border:solid 1px black;
width:190px;
}
.vignette_doc {
text-align:center;
padding:5px;
margin:5px;
border:solid 1px black;
width:190px;
background-color:#aaaaaa;
}
.optiongras {
font-weight: bold;
color: green;
}
.ongleton {
background: #9678C0;
font-weight: bold;
border:solid 1px black;
border-bottom-width: 0px;
margin-top: 10px;
padding: 2px;
padding-left: 6px;
padding-right: 6px;
}
.ongletoff {
background: #90AEEA;
font-weight: bold;
border-width: 0px;
border-bottom:solid 1px black;
margin-top: 10px;
padding: 2px;
padding-left: 6px;
padding-right: 6px;
}
.col2, .c2 {
background: #ABBAED;
vertical-align: top;
padding-right: 10px;
padding-top: 0;
}
/**********************************************************/
/* Formulaires VERTICAUX (type liste de resultat ...)
sous forme de table avec th en 1er ligne */
.formv {
border: 1px solid #000030;
border-collapse: collapse;
}
.formh {
border: 1px solid #000030;
border-collapse: collapse;
}
.formh th, .formv th {
font-size: 12px;
text-align: center;
color: #000030;
background: #ABBAED;
padding: 3px;
padding-left: 6px;
padding-right: 6px;
}
.formh a {
color: black;
text-decoration: none;
}
.formh a:hover {
color: black;
text-decoration: underline;
}
.formv td {
padding: 3px;
background: white;
font-size: 12px;
}
.formv .vc {
border-right: 1px solid #300000;
width: 16%;
}
.formv .hc {
border-bottom: 1px solid #300000;
}
.bred {
background: red;
}
.bgreen {
background: green;
}
.formh {
border: 1px solid #000030;
border-collapse: collapse;
}
.formh td {
padding: 3px;
background: white;
font-size: 12px;
}
.formh .vc {
border-right: 1px solid #000030;
}
.vcst {
position: absolute;
width: 500px;
height: 300px;
overflow: scroll;
display: none;
background: white;
padding: 6px;
border: 1px solid black;
font-size: 12px;
}
.edc {
width: 420px;
overflow: hidden;
}
.formv .syndis a, .formv .syndis {
color: #606060;
}
#help {
position: absolute;
display: none;
border: 2px outset #ABBAED;
background: #F8F8E0;
padding: 10px;
width: 500px;
top: 80px;
left: 80px;
z-index: 1000;
font-size: 12px;
}
#help a {
color: black; text-decoration: none;
}
#help p {
margin: 0;
padding: 0;
padding-top: 4px;
}
#help h2 {
font-size: 18px;
font-weight: bold;
padding-left: 20px;
}
#closehelp {
float: right;
padding: 4px;
}
body {
background: #ABBAED;
font: 11px "Trebuchet MS", Verdana, "Lucida Grande", Tahoma, Helvetica, Sans-Serif;
padding: 0;
margin: 2px;
margin-top: 9px;
margin-left: 10px; margin-right: 10px;
}
.forummsg {
margin: 0; padding: 0;
}
img {
border: 0;
vertical-align: middle;
}
td, .int, .inb, .inl {
font: 10px Verdana, "Lucida Grande", Tahoma, Helvetica, Sans-Serif;
}
.int, .inl {
padding: 1; margin: 0;
padding-left: 2px;
border: 1px solid #7F7F7F;
background: #FFFFFF;
}
.inb {
padding: 0;
margin: 1px;
margin-left: 1px; margin-right: 1px;
border: 1px solid #7F7F7F;
background: #ABBAED;
font-weight: bold;
}
form {
padding: 0; margin: 0;
padding-bottom: 4px; padding-top: 4px;
}
/***********************************************/
/* LE MENU */
/***********************************************/
#menu {
background: #E5E5E5;
border: 1px solid #818590;
width: 100%;
border-collapse: collapse;
padding: 0;
margin: 0;
}
#mt1 {
padding-top: 3px; padding-left: 7px;
font-size: 12px;
}
#mt2 {
padding-top: 6px;
padding-left: 7px;
}
td.mt3, #mt3 { text-align: right; width: 240px;}
#menu td {
font-size: 9px;
}
#menu a {
text-decoration: none;
color: black;
}
#menu a:hover {
text-decoration: underline;
color: black;
}
#menu a.selected, #menu a:hover.selected, h3 {
background: #9678C0;
color: white;
font-weight: bold;
padding-left: 3px; padding-right: 3px;
margin-left: 2px; margin-right: 2px;
padding-top: 1px; padding-bottom: 1px;
margin-top: 0; margin-bottom: 0;
}
h3 {
font-size: 10px;
margin-top: 10px;
}
#menu form {
padding: 0;
}
/***********************************************/
/* MARQUEE DES TAGS */
/***********************************************/
#mtaggued {
width: 92%;
padding: 2px;
font-size: 10px;
font-family: Verdana, Helvetica, Sans-serif;
margin-left: 4%;
margin-right: 4%;
margin-top: 0; margin-bottom: 0;
padding-top: 9px;
padding-bottom: 9px;
}
#mtaggued a {
text-decoration: none;
color: #202020;
}
#mtaggued a:hover {
text-decoration: underline;
color: #202020;
}
#mtaggued marquee {
width: 100%;
background: #BFCCF5;
padding-bottom: 0;
margin: 0;
}
/***********************************************/
/* EN TETE CENTRAL */
/***********************************************/
h1 {
position: relative;
padding: 4px;
padding-left: 10px; padding-right: 10px;
text-align: center;
font-size: 17px;
font-family: Arial, Helvetica, Sans-serif;
font-weight: bold;
width: 50%;
margin: 0;
margin-top: 10px;
margin-bottom: 5px;
left: 25%;
background: #E5E5E5;
border: 1px solid #7F7F7F;
}
h2 {
font-size: 14px;
font-family: Arial, Helvetica, Sans-serif;
font-weight: bold;
padding: 0; margin: 0;
}
/***********************************************/
/* LES BOITES */
/* box = normales, box2 = grises */
/* box3 = administrateur */
/* alignes au centre si sous boxlist */
/* sinon alignes gauche (twocol) */
/***********************************************/
#boxlist {
width: 100%;
padding: 0; margin: 0;
border-collapse: collapse;
}
#boxlist td.blcol {
width: 31%;
padding-left: 10px;
padding-right: 10px;
vertical-align: top;
margin: 0;
}
.box3, .box2, .box {
width: 100%;
padding: 2px;
border-collapse: collapse;
border: 0;
margin-top: 6px;
margin-bottom: 6px;
border: 1px solid #7F7F7F;
}
.box3 th, .box2 th, .box th {
color: white;
font-weight: bold;
font-size: 11px;
font-family: Verdana, Helvetica, Sans-serif;
padding-top: 4px;
padding-bottom: 5px;
padding-left: 5px;
text-align: left;
}
.boxlist .box3 th, .boxlist .box2 th, .boxlist .box th {
text-align: center;
}
.twocol .box3 th, .twocol .box2 th, .twocol .box th {
text-align: left;
padding-left: 6px;
}
.box3 th {
background: #CCCCCC 0 100% repeat-x;
border-bottom: 1px solid black;
color: black;
}
.box3 .inb {
background: #7F7F7F;
color: white;
font-weight: bold;
}
.box2 th {
background: #7F7F7F url(simg/fond_bte.gif) 0 100% repeat-x;
}
.box th {
background: #9678C0 url(simg/fond_bte.gif) 0 100% repeat-x;
}
.box3 td, .box2 td, .box td {
color: black;
font-weight: normal;
font-size: 11px;
font-family: Verdana, Helvetica, Sans-serif;
text-align: left;
padding-left: 5px;
}
.box td.nopad {
padding-top: 4px;
padding-bottom: 0;
}
.box3 td {
background: #CCCCCC;
}
.box td, .box2 td {
background: #E5E5E5;
}
.box2 ul, .box ul {
list-style: url(simg/bullet.gif);
padding-left: 5px; margin: 0;
margin-left: 12px;
padding-top: 0; padding-bottom: 0;
}
.box li, .box2 li, .box3 li {
padding-bottom: 3px; padding-top: 3px;
}
.box .selected, .box2 .selected, .box3 .selected {
font-weight: bold;
}
.box3 a, .box2 a, .box a {
text-decoration: none;
}
.box3 a:hover, .box2 a:hover, .box a:hover {
text-decoration: underline;
}
.box3 th a, .box2 th a, .box th a {
color: white;
}
.box3 td a, .box2 td a, .box td a {
color: black;
}
.box3 td a.selected, .box2 td a.selected, .box td a.selected {
font-weight: bold;
}
.box p, .box2 p, .box3 p {
padding-top: 4px;
padding-bottom: 4px;
}
/* Element that has not been read : purple */
.unread {
color: #9678C0;
font-weight: bold;
}
/* Textarea that are invisible :) */
.inv, .inv1, .inv2 {
border: 0;
padding: 0;
margin: 4px;
font-family: "Trebuchet MS", Verdana, "Lucida Grande", Tahoma, Helvetica, Sans-Serif;
width: 98%;