Skip to content
Extraits de code Groupes Projets
Valider 829d0d9b rédigé par esj's avatar esj
Parcourir les fichiers

Suite de l'unification autour de tranche_requete. En plus l'affichage des...

Suite de l'unification autour de tranche_requete. En plus l'affichage des logos de sites syndiqués ne se faisait plus
parent d7b7388f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -696,7 +696,7 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a
$jjscript["requete"] = $requete;
$jjscript["afficher_visites"] = $afficher_visites;
$jjscript["afficher_auteurs"] = $afficher_auteurs;
$jjscript = addslashes(serialize($jjscript));
$jjscript = (serialize($jjscript));
$hash = "0x".substr(md5($connect_id_auteur.$jjscript), 0, 16);
$tmp_var = substr($hash, 2, 6);
......@@ -725,7 +725,7 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a
$id_ajax_fonc = $row["id_ajax_fonc"];
} else {
include_spip('base/abstract_sql');
$id_ajax_fonc = spip_abstract_insert("spip_ajax_fonc", "(id_auteur, variables, hash, date)", "($connect_id_auteur, '$jjscript', $hash, NOW())");
$id_ajax_fonc = spip_abstract_insert("spip_ajax_fonc", "(id_auteur, variables, hash, date)", "($connect_id_auteur, '" . addslashes($jjscript) . "', $hash, NOW())");
}
if (!$deb_aff) {
......@@ -1369,7 +1369,6 @@ function afficher_auteurs ($titre_table, $requete) {
$table[]= affiche_auteur_boucle($row, &$tous_id);
}
spip_free_result($result);
spip_log("afautu");
$largeurs = array('');
$styles = array('arial2');
echo afficher_liste($largeurs, $table, $styles);
......
......@@ -41,33 +41,45 @@ function afficher_sites($titre_table, $requete) {
$result = spip_query("SELECT " . $requete['SELECT'] . " FROM " . $requete['FROM'] . ($requete['WHERE'] ? (' WHERE ' . $requete['WHERE']) : '') . ($requete['GROUP BY'] ? (' GROUP BY ' . $requete['GROUP BY']) : '') . ($requete['ORDER BY'] ? (' ORDER BY ' . $requete['ORDER BY']) : '') . " LIMIT " . ($deb_aff >= 0 ? "$deb_aff, $nb_aff" : ($requete['LIMIT'] ? $requete['LIMIT'] : "99999")));
$ifond = 0;
$premier = true;
$voir_logo = ($spip_display != 1 AND $spip_display != 4 AND $GLOBALS['meta']['image_process'] != "non");
if ($voir_logo) include_spip('inc/logos');
$compteur_liste = 0;
$table = array();
while ($row = spip_fetch_array($result)) {
$vals = '';
$id_syndic=$row["id_syndic"];
$id_rubrique=$row["id_rubrique"];
$nom_site=sinon(typo($row["nom_site"]), _T('info_sans_titre'));
$url_site=$row["url_site"];
$url_syndic=$row["url_syndic"];
$description=propre($row["description"]);
$syndication=$row["syndication"];
$statut=$row["statut"];
$date=$row["date"];
$moderation=$row['moderation'];
$table[]= afficher_sites_boucle($row, $tous_id);
}
spip_free_result($result);
$largeurs = array('','','');
$styles = array('arial11', 'arial1', 'arial1');
echo afficher_liste($largeurs, $table, $styles);
echo "</table>";
echo "</div>\n";
return $tous_id;
}
function afficher_sites_boucle($row, &$tous_id)
{
$vals = '';
$id_syndic=$row["id_syndic"];
$id_rubrique=$row["id_rubrique"];
$nom_site=sinon(typo($row["nom_site"]), _T('info_sans_titre'));
$url_site=$row["url_site"];
$url_syndic=$row["url_syndic"];
$description=propre($row["description"]);
$syndication=$row["syndication"];
$statut=$row["statut"];
$date=$row["date"];
$moderation=$row['moderation'];
$tous_id[] = $id_syndic;
$tous_id[] = $id_syndic;
//echo "<tr bgcolor='$couleur'>";
//echo "<td class='arial2'>";
switch ($statut) {
case 'publie':
switch ($statut) {
case 'publie':
if (acces_restreint_rubrique($id_rubrique))
$puce = 'puce-verte-anim.gif';
else
......@@ -88,57 +100,47 @@ function afficher_sites($titre_table, $requete) {
$puce='puce-poubelle-breve.gif';
$title = _T('info_site_refuse');
break;
}
if ($syndication == 'off' OR $syndication == 'sus') {
}
if ($syndication == 'off' OR $syndication == 'sus') {
$puce = 'puce-orange-anim.gif';
$title = _T('info_panne_site_syndique');
}
$s = "<a href=\"".generer_url_ecrire("sites","id_syndic=$id_syndic")."\" title=\"$title\">";
$s = "<a href=\"".generer_url_ecrire("sites","id_syndic=$id_syndic")."\" title=\"$title\">";
if ($voir_logo);
$s .= baliser_logo("site", $id_syndic, 26, 20) ;
if ($voir_logo) $s .= baliser_logo("site", $id_syndic, 26, 20) ;
$s .= http_img_pack($puce, $statut, "width='7' height='7' border='0'") ."&nbsp;&nbsp;";
$s .= http_img_pack($puce, $statut, "width='7' height='7' border='0'") ."&nbsp;&nbsp;";
$s .= typo($nom_site);
$s .= "</a> &nbsp;&nbsp; <font size='1'>[<a href='$url_site'>"._T('lien_visite_site')."</a>]</font>";
$vals[] = $s;
$s .= typo($nom_site);
$s .= "</a> &nbsp;&nbsp; <font size='1'>[<a href='$url_site'>"._T('lien_visite_site')."</a>]</font>";
$vals[] = $s;
//echo "</td>";
$s = "";
$s = "";
//echo "<td class='arial1' align='right'> &nbsp;";
if ($syndication == 'off' OR $syndication == 'sus') {
if ($syndication == 'off' OR $syndication == 'sus') {
$s .= "<font color='red'>"._T('info_probleme_grave')." </font>";
}
if ($syndication == "oui" or $syndication == "off" OR $syndication == 'sus'){
$s .= "<font color='red'>"._T('info_syndication')."</font>";
}
$vals[] = $s;
}
if ($syndication == "oui" or $syndication == "off" OR $syndication == 'sus'){
$s .= "<font color='red'>"._T('info_syndication')."</font>";
}
$vals[] = $s;
//echo "</td>";
//echo "<td class='arial1'>";
if ($syndication == "oui" OR $syndication == "off" OR $syndication == "sus") {
$total_art = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_syndic_articles WHERE id_syndic='$id_syndic'"));
$s = " " . $total_art['n'] . " " . _T('info_syndication_articles');
} else {
$s = "&nbsp;";
}
$vals[] = $s;
if ($syndication == "oui" OR $syndication == "off" OR $syndication == "sus") {
$total_art = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_syndic_articles WHERE id_syndic='$id_syndic'"));
$s = " " . $total_art['n'] . " " . _T('info_syndication_articles');
} else {
$s = "&nbsp;";
}
$vals[] = $s;
//echo "</td>";
//echo "</tr></n>";
$table[] = $vals;
}
spip_free_result($result);
$largeurs = array('','','');
$styles = array('arial11', 'arial1', 'arial1');
echo afficher_liste($largeurs, $table, $styles);
echo "</table>";
echo "</div>\n";
return $tous_id;
return $vals;
}
function afficher_syndic_articles($titre_table, $requete, $id = 0) {
......@@ -146,9 +148,9 @@ function afficher_syndic_articles($titre_table, $requete, $id = 0) {
if (!$requete["SELECT"]) $requete["SELECT"].= "*";
if (!$requete['FROM']) $requete['FROM']= 'spip_syndic_articles';
$tous_id = array();
$cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM " . $requete['FROM'] . ($requete['WHERE'] ? (' WHERE ' . $requete['WHERE']) : '') . ($requete['GROUP BY'] ? (' GROUP BY ' . $requete['GROUP BY']) : '')));
if (! ($obligatoire OR ($cpt = $cpt['n']))) return $tous_id ;
if (! ($obligatoire OR ($cpt = $cpt['n']))) return ;
if ($requete['LIMIT']) $cpt = min($requete['LIMIT'], $cpt);
......@@ -175,107 +177,14 @@ function afficher_syndic_articles($titre_table, $requete, $id = 0) {
$result = spip_query("SELECT " . $requete['SELECT'] . " FROM " . $requete['FROM'] . ($requete['WHERE'] ? (' WHERE ' . $requete['WHERE']) : '') . ($requete['GROUP BY'] ? (' GROUP BY ' . $requete['GROUP BY']) : '') . ($requete['ORDER BY'] ? (' ORDER BY ' . $requete['ORDER BY']) : '') . " LIMIT " . ($deb_aff >= 0 ? "$deb_aff, $nb_aff" : ($requete['LIMIT'] ? $requete['LIMIT'] : "99999")));
$table = '';
while ($row = spip_fetch_array($result)) {
$vals = '';
$id_syndic_article=$row["id_syndic_article"];
$id_syndic=$row["id_syndic"];
$titre=safehtml($row["titre"]);
$url=$row["url"];
$date=$row["date"];
$lesauteurs=typo($row["lesauteurs"]);
$statut=$row["statut"];
$descriptif=safehtml($row["descriptif"]);
if ($statut=='publie') {
if (acces_restreint_rubrique($id_rubrique))
$puce = 'puce-verte-anim.gif';
else
$puce='puce-verte.gif';
}
else if ($statut == "refuse") {
$puce = 'puce-poubelle.gif';
}
else if ($statut == "dispo") { // moderation : a valider
$puce = 'puce-rouge.gif';
}
else if ($statut == "off") { // feed d'un site en mode "miroir"
$puce = 'puce-rouge-anim.gif';
}
$vals[] = http_img_pack($puce, $statut, "width='7' height='7' border='0'");
$s = "<a href='$url'>$titre</a>";
$date = affdate_court($date);
if (strlen($lesauteurs) > 0) $date = $lesauteurs.', '.$date;
$s.= " ($date)";
$redirect = generer_url_ecrire($GLOBALS['exec'], ('t_' .$tmp_var . '=' . $deb_aff) . (!$id ? '' : "&id_syndic=$id"), true);
// Tags : d'un cote les enclosures, de l'autre les liens
if($e = afficher_enclosures($row['tags']))
$s .= ' '.$e;
// descriptif
if (strlen($descriptif) > 0)
$s .= "<div class='arial1'>".safehtml($descriptif)."</div>";
// tags
if ($tags = afficher_tags($row['tags']))
$s .= "<div style='float:$spip_lang_right;'>&nbsp;<em>"
. $tags . '</em></div>';
// source
if (strlen($row['url_source']))
$s .= "<div style='float:$spip_lang_right;'>"
. propre("[".$row['source']."->".$row['url_source']."]")
. "</div>";
else if (strlen($row['source']))
$s .= "<div style='float:$spip_lang_right;'>"
. typo($row['source'])
. "</div>";
$vals[] = $s;
// $my_sites cache les resultats des requetes sur les sites
if (!$my_sites[$id_syndic])
$my_sites[$id_syndic] = spip_fetch_array(spip_query("SELECT nom_site, moderation, miroir FROM spip_syndic WHERE id_syndic=$id_syndic"));
if (!$id) {
$aff = $my_sites[$id_syndic]['nom_site'];
if ($my_sites[$id_syndic]['moderation'] == 'oui')
$aff = "<i>$aff</i>";
$s = "<a href='" . generer_url_ecrire("sites","id_syndic=$id_syndic") . "'>$aff</a>";
$vals[] = $s;
}
if ($connect_statut == '0minirezo'){
if ($statut == "publie"){
$s = "[<a href='". generer_action_auteur("instituer", "syndic_article $id_syndic_article refuse", generer_url_ecrire($GLOBALS['exec'], ('t_' .$tmp_var . '=' . $deb_aff) . (!$id ? '' : "&id_syndic=$id"), true)) . "'><font color='black'>"._T('info_bloquer_lien')."</font></a>]";
}
else if ($statut == "refuse"){
$s = "[<a href='". generer_action_auteur("instituer", "syndic_article $id_syndic_article publie", generer_url_ecrire($GLOBALS['exec'], ('t_' .$tmp_var . '=' . $deb_aff) . (!$id ? '' : "&id_syndic=$id"), true)) . "'>"._T('info_retablir_lien')."</a>]";
}
else if ($statut == "off"
AND $my_sites[$id_syndic]['miroir'] == 'oui') {
$s = '('._T('syndic_lien_obsolete').')';
}
else /* 'dispo' ou 'off' (dans le cas ancien site 'miroir') */
{
$s = "[<a href='". generer_action_auteur("instituer", "syndic_article $id_syndic_article publie", generer_url_ecrire($GLOBALS['exec'], ('t_' .$tmp_var . '=' . $deb_aff) . (!$id ? '' : "&id_syndic=$id"), true)) . "'>"._T('info_valider_lien')."</a>]";
}
$vals[] = $s;
}
$table[] = $vals;
}
$my_sites = array();
$table = array();
while ($row = spip_fetch_array($result)) {
$table[]= afficher_syndic_articles_boucle($row, $my_sites, $redirect);
}
spip_free_result($result);
if (!$id) {
$largeurs = array(7, '', '100');
......@@ -294,7 +203,104 @@ function afficher_syndic_articles($titre_table, $requete, $id = 0) {
echo "</TABLE>";
//fin_cadre_relief();
echo "</div>";
}
return $tous_id;
function afficher_syndic_articles_boucle($row, &$my_sites, $redirect)
{
global $connect_statut, $spip_lang_right;
$vals = '';
$id_syndic_article=$row["id_syndic_article"];
$id_syndic=$row["id_syndic"];
$titre=safehtml($row["titre"]);
$url=$row["url"];
$date=$row["date"];
$lesauteurs=typo($row["lesauteurs"]);
$statut=$row["statut"];
$descriptif=safehtml($row["descriptif"]);
if ($statut=='publie') {
$puce='puce-verte.gif';
}
else if ($statut == "refuse") {
$puce = 'puce-poubelle.gif';
}
else if ($statut == "dispo") { // moderation : a valider
$puce = 'puce-rouge.gif';
}
else if ($statut == "off") { // feed d'un site en mode "miroir"
$puce = 'puce-rouge-anim.gif';
}
$vals[] = http_img_pack($puce, $statut, "width='7' height='7' border='0'");
$s = "<a href='$url'>$titre</a>";
$date = affdate_court($date);
if (strlen($lesauteurs) > 0) $date = $lesauteurs.', '.$date;
$s.= " ($date)";
// Tags : d'un cote les enclosures, de l'autre les liens
if($e = afficher_enclosures($row['tags']))
$s .= ' '.$e;
// descriptif
if (strlen($descriptif) > 0)
$s .= "<div class='arial1'>".safehtml($descriptif)."</div>";
// tags
if ($tags = afficher_tags($row['tags']))
$s .= "<div style='float:$spip_lang_right;'>&nbsp;<em>"
. $tags . '</em></div>';
// source
if (strlen($row['url_source']))
$s .= "<div style='float:$spip_lang_right;'>"
. propre("[".$row['source']."->".$row['url_source']."]")
. "</div>";
else if (strlen($row['source']))
$s .= "<div style='float:$spip_lang_right;'>"
. typo($row['source'])
. "</div>";
$vals[] = $s;
// $my_sites cache les resultats des requetes sur les sites
if (!$my_sites[$id_syndic])
$my_sites[$id_syndic] = spip_fetch_array(spip_query("SELECT nom_site, moderation, miroir FROM spip_syndic WHERE id_syndic=$id_syndic"));
if (!$id) {
$aff = $my_sites[$id_syndic]['nom_site'];
if ($my_sites[$id_syndic]['moderation'] == 'oui')
$aff = "<i>$aff</i>";
$s = "<a href='" . generer_url_ecrire("sites","id_syndic=$id_syndic") . "'>$aff</a>";
$vals[] = $s;
}
if ($connect_statut == '0minirezo'){
if ($statut == "publie"){
$s = "[<a href='". generer_action_auteur("instituer", "syndic_article $id_syndic_article refuse", $redirect) . "'><font color='black'>"._T('info_bloquer_lien')."</font></a>]";
}
else if ($statut == "refuse"){
$s = "[<a href='". generer_action_auteur("instituer", "syndic_article $id_syndic_article publie", $redirect) . "'>"._T('info_retablir_lien')."</a>]";
}
else if ($statut == "off"
AND $my_sites[$id_syndic]['miroir'] == 'oui') {
$s = '('._T('syndic_lien_obsolete').')';
}
else /* 'dispo' ou 'off' (dans le cas ancien site 'miroir') */
{
$s = "[<a href='". generer_action_auteur("instituer", "syndic_article $id_syndic_article publie", $redirect) . "'>"._T('info_valider_lien')."</a>]";
}
$vals[] = $s;
}
return $vals;
}
?>
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter