From 03ee32f676c2deef52508bad5de79dfc29ea5829 Mon Sep 17 00:00:00 2001 From: "Committo,Ergo:sum" <esj@rezo.net> Date: Wed, 31 Aug 2005 21:36:33 +0000 Subject: [PATCH] je dirais meme plus: compatibilite Postgres (LIMIT OFFSET) --- ecrire/articles.php3 | 6 +++--- ecrire/articles_forum.php3 | 4 ++-- ecrire/articles_page.php3 | 2 +- ecrire/articles_versions.php3 | 2 +- ecrire/auteurs.php3 | 2 +- ecrire/breves_voir.php3 | 2 +- ecrire/brouteur_frame.php3 | 6 +++--- ecrire/controle_forum.php3 | 2 +- ecrire/export_all.php3 | 2 +- ecrire/forum.php3 | 2 +- ecrire/inc.php3 | 10 +++++----- ecrire/inc_export.php3 | 4 ++-- ecrire/inc_index.php3 | 10 +++++----- ecrire/inc_majbase.php3 | 2 +- ecrire/inc_mots.php3 | 2 +- ecrire/inc_presentation.php3 | 32 ++++++++++++++++---------------- ecrire/inc_rss.php3 | 10 +++++----- ecrire/inc_signatures.php3 | 3 ++- ecrire/inc_sites.php3 | 4 ++-- ecrire/inc_statistiques.php3 | 8 ++++---- ecrire/index.php3 | 6 +++--- ecrire/js_menu_rubriques.php | 2 +- ecrire/message.php3 | 2 +- ecrire/messagerie.php3 | 2 +- ecrire/naviguer.php3 | 12 ++++++------ ecrire/sites.php3 | 2 +- ecrire/sites_edit.php3 | 2 +- ecrire/sites_tous.php3 | 2 +- ecrire/statistiques_svg.php3 | 2 +- ecrire/statistiques_visites.php3 | 6 +++--- ecrire/suivi_revisions.php3 | 4 ++-- 31 files changed, 79 insertions(+), 78 deletions(-) diff --git a/ecrire/articles.php3 b/ecrire/articles.php3 index fbbdd5704d..f99bd481b5 100644 --- a/ecrire/articles.php3 +++ b/ecrire/articles.php3 @@ -238,7 +238,7 @@ if ($titre && !$ajout_forum && $flag_editable) { if ($articles_versions) { include("lab_revisions.php"); if ($new != 'oui') { - $query = "SELECT id_article FROM spip_versions WHERE id_article=$id_article LIMIT 0 OFFSET 1"; + $query = "SELECT id_article FROM spip_versions WHERE id_article=$id_article LIMIT 1 OFFSET 0"; if (!spip_num_rows(spip_query($query))) { spip_log("version initiale de l'article $id_article"); $select = join(", ", $champs); @@ -622,7 +622,7 @@ if ($options == "avancees" && $connect_statut=='0minirezo' && $flag_editable) { // $vos_articles = spip_query("SELECT articles.id_article, articles.titre, articles.statut FROM spip_articles AS articles WHERE articles.id_rubrique='$id_rubrique' AND (articles.statut = 'publie' OR articles.statut = 'prop') AND articles.id_article != '$id_article' ". - " ORDER BY articles.date DESC LIMIT 0 OFFSET 30"); + " ORDER BY articles.date DESC LIMIT 30 OFFSET 0"); if (spip_num_rows($vos_articles) > 0) { echo "<div> </div>"; echo "<div class='bandeau_rubriques' style='z-index: 1;'>"; @@ -1588,7 +1588,7 @@ if ($total > $total_afficher) { -$query_forum = "SELECT * FROM spip_forum WHERE statut='prive' AND id_article='$id_article' AND id_parent=0 ORDER BY date_heure DESC LIMIT $debut OFFSET $total_afficher"; +$query_forum = "SELECT * FROM spip_forum WHERE statut='prive' AND id_article='$id_article' AND id_parent=0 ORDER BY date_heure DESC LIMIT $total_afficher OFFSET $debut"; $result_forum = spip_query($query_forum); afficher_forum($result_forum, $forum_retour); diff --git a/ecrire/articles_forum.php3 b/ecrire/articles_forum.php3 index 97d0a2b4e6..d0e1ac2501 100644 --- a/ecrire/articles_forum.php3 +++ b/ecrire/articles_forum.php3 @@ -81,7 +81,7 @@ $enplus = 200; // intervalle affiche autour du debut $limitdeb = ($debut > $enplus) ? $debut-$enplus : 0; $limitnb = $debut + $enplus - $limitdeb; -$query_forum = "SELECT id_forum FROM spip_forum WHERE id_article='$id_article' AND id_parent=0 AND statut IN ('publie', 'off', 'prop') LIMIT $limitdeb OFFSET $limitnb"; +$query_forum = "SELECT id_forum FROM spip_forum WHERE id_article='$id_article' AND id_parent=0 AND statut IN ('publie', 'off', 'prop') LIMIT $limitnb OFFSET $limitdeb"; $result_forum = spip_query($query_forum); @@ -118,7 +118,7 @@ if ($connect_statut == "0minirezo") { AND pied.statut IN ('publie', 'off', 'prop') AND thread.id_thread=pied.id_forum GROUP BY id_thread - ORDER BY date DESC LIMIT $debut OFFSET $pack"; + ORDER BY date DESC LIMIT $pack OFFSET $debut"; $result_forum = spip_query($query_forum); afficher_forum($result_forum, $forum_retour, $id_article); } diff --git a/ecrire/articles_page.php3 b/ecrire/articles_page.php3 index f9211064bf..417c53e0b6 100644 --- a/ecrire/articles_page.php3 +++ b/ecrire/articles_page.php3 @@ -21,7 +21,7 @@ debut_gauche(); // Afficher le bouton de creation d'article // -$query = "SELECT id_rubrique FROM spip_rubriques LIMIT 0 OFFSET 1"; +$query = "SELECT id_rubrique FROM spip_rubriques LIMIT 1 OFFSET 0"; $result = spip_query($query); if (spip_num_rows($result) > 0) { diff --git a/ecrire/articles_versions.php3 b/ecrire/articles_versions.php3 index 945c54ea05..aa230aca94 100644 --- a/ecrire/articles_versions.php3 +++ b/ecrire/articles_versions.php3 @@ -49,7 +49,7 @@ $id_diff = intval($id_diff); if (!$id_diff) { $diff_auto = true; $query = "SELECT id_version FROM spip_versions WHERE id_article=$id_article ". - "AND id_version<$id_version ORDER BY id_version DESC LIMIT 0 OFFSET 1"; + "AND id_version<$id_version ORDER BY id_version DESC LIMIT 1 OFFSET 0"; if ($result = spip_query($query)) { $row = spip_fetch_array($result); $id_diff = $row['id_version']; diff --git a/ecrire/auteurs.php3 b/ecrire/auteurs.php3 index d4d143bc90..be1a11eefa 100644 --- a/ecrire/auteurs.php3 +++ b/ecrire/auteurs.php3 @@ -53,7 +53,7 @@ fin_boite_info(); if ($connect_statut == '0minirezo') { - $query = "SELECT id_auteur FROM spip_auteurs WHERE statut='6forum' LIMIT 0 OFFSET 1"; + $query = "SELECT id_auteur FROM spip_auteurs WHERE statut='6forum' LIMIT 1 OFFSET 0"; $result = spip_query($query); $flag_visiteurs = spip_num_rows($result) > 0; diff --git a/ecrire/breves_voir.php3 b/ecrire/breves_voir.php3 index 0a8328029c..80ef8bc9b4 100644 --- a/ecrire/breves_voir.php3 +++ b/ecrire/breves_voir.php3 @@ -308,7 +308,7 @@ echo "</div>"; echo "<P align='left'>"; -$query_forum = "SELECT * FROM spip_forum WHERE statut='prive' AND id_breve='$id_breve' AND id_parent=0 ORDER BY date_heure DESC LIMIT 0 OFFSET 20"; +$query_forum = "SELECT * FROM spip_forum WHERE statut='prive' AND id_breve='$id_breve' AND id_parent=0 ORDER BY date_heure DESC LIMIT 20 OFFSET 0"; $result_forum = spip_query($query_forum); afficher_forum($result_forum, $forum_retour); diff --git a/ecrire/brouteur_frame.php3 b/ecrire/brouteur_frame.php3 index 7f7088053f..f85fff5d0e 100644 --- a/ecrire/brouteur_frame.php3 +++ b/ecrire/brouteur_frame.php3 @@ -60,7 +60,7 @@ debut_html(); echo "</div>"; } - $query = "SELECT * FROM spip_breves WHERE statut = 'prop' ORDER BY date_heure DESC LIMIT 0 OFFSET 20"; + $query = "SELECT * FROM spip_breves WHERE statut = 'prop' ORDER BY date_heure DESC LIMIT 20 OFFSET 0"; $result=spip_query($query); if (spip_num_rows($result)>0) { echo "<div style='padding-top: 6px;'><b class='verdana2'>"._T("info_breves_valider")."</b></div>"; @@ -137,7 +137,7 @@ debut_html(); echo "</div>"; } - $query = "SELECT * FROM spip_breves WHERE id_rubrique=$id_rubrique ORDER BY date_heure DESC LIMIT 0 OFFSET 20"; + $query = "SELECT * FROM spip_breves WHERE id_rubrique=$id_rubrique ORDER BY date_heure DESC LIMIT 20 OFFSET 0"; $result=spip_query($query); if (spip_num_rows($result)>0) { echo "<div style='padding-top: 6px;'><b class='verdana2'>"._T('info_breves_02')."</b></div>"; @@ -217,7 +217,7 @@ debut_html(); $result = spip_query($query); $total_articles = spip_num_rows($result); - $query = "SELECT * FROM spip_breves WHERE statut = 'prop' ORDER BY date_heure DESC LIMIT 0 OFFSET 20"; + $query = "SELECT * FROM spip_breves WHERE statut = 'prop' ORDER BY date_heure DESC LIMIT 20 OFFSET 0"; $result=spip_query($query); $total_breves = spip_num_rows($result); diff --git a/ecrire/controle_forum.php3 b/ecrire/controle_forum.php3 index fd4b1e1e08..613dfafe78 100644 --- a/ecrire/controle_forum.php3 +++ b/ecrire/controle_forum.php3 @@ -257,7 +257,7 @@ $result_forum = spip_query(" SELECT * FROM spip_forum WHERE " . $query_forum . " -ORDER BY date_heure DESC LIMIT $limitdeb OFFSET $limitnb" +ORDER BY date_heure DESC LIMIT $limitnb OFFSET $limitdeb" ); while ($row = spip_fetch_array($result_forum)) { diff --git a/ecrire/export_all.php3 b/ecrire/export_all.php3 index f18c0bf9e9..e3ecce3c6c 100644 --- a/ecrire/export_all.php3 +++ b/ecrire/export_all.php3 @@ -28,7 +28,7 @@ $action = _T('info_exportation_base', array('archive' => $archive)); debut_admin($action); $debug_limit = ''; -//$debug_limit = ' LIMIT 0 OFFSET 100'; + if (!$debut_limit) $debut_limit = 0; install_debut_html(_T('info_sauvegarde')); diff --git a/ecrire/forum.php3 b/ecrire/forum.php3 index f221e29ba4..452d5eef63 100644 --- a/ecrire/forum.php3 +++ b/ecrire/forum.php3 @@ -80,7 +80,7 @@ echo "</div>"; echo "<P align='left'>"; -$query_forum="SELECT * FROM spip_forum WHERE statut='$statutforum' AND id_parent=0 ORDER BY date_heure DESC LIMIT $debut OFFSET 10"; +$query_forum="SELECT * FROM spip_forum WHERE statut='$statutforum' AND id_parent=0 ORDER BY date_heure DESC LIMIT 10 OFFSET $debut"; $result_forum=spip_query($query_forum); afficher_forum($result_forum,$urlforum); diff --git a/ecrire/inc.php3 b/ecrire/inc.php3 index b409095d20..15081d98c2 100644 --- a/ecrire/inc.php3 +++ b/ecrire/inc.php3 @@ -176,23 +176,23 @@ if (!$adresse_site) { function tester_rubrique_vide($id_rubrique) { - $query = "SELECT id_rubrique FROM spip_rubriques WHERE id_parent='$id_rubrique' LIMIT 0 OFFSET 1"; + $query = "SELECT id_rubrique FROM spip_rubriques WHERE id_parent='$id_rubrique' LIMIT 1 OFFSET 0"; list($n) = spip_fetch_array(spip_query($query)); if ($n > 0) return false; - $query = "SELECT id_article FROM spip_articles WHERE id_rubrique='$id_rubrique' AND (statut='publie' OR statut='prepa' OR statut='prop') LIMIT 0 OFFSET 1"; + $query = "SELECT id_article FROM spip_articles WHERE id_rubrique='$id_rubrique' AND (statut='publie' OR statut='prepa' OR statut='prop') LIMIT 1 OFFSET 0"; list($n) = spip_fetch_array(spip_query($query)); if ($n > 0) return false; - $query = "SELECT id_breve FROM spip_breves WHERE id_rubrique='$id_rubrique' AND (statut='publie' OR statut='prop') LIMIT 0 OFFSET 1"; + $query = "SELECT id_breve FROM spip_breves WHERE id_rubrique='$id_rubrique' AND (statut='publie' OR statut='prop') LIMIT 1 OFFSET 0"; list($n) = spip_fetch_array(spip_query($query)); if ($n > 0) return false; - $query = "SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND (statut='publie' OR statut='prop') LIMIT 0 OFFSET 1"; + $query = "SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND (statut='publie' OR statut='prop') LIMIT 1 OFFSET 0"; list($n) = spip_fetch_array(spip_query($query)); if ($n > 0) return false; - $query = "SELECT id_document FROM spip_documents_rubriques WHERE id_rubrique='$id_rubrique' LIMIT 0 OFFSET 1"; + $query = "SELECT id_document FROM spip_documents_rubriques WHERE id_rubrique='$id_rubrique' LIMIT 1 OFFSET 0"; list($n) = spip_fetch_array(spip_query($query)); if ($n > 0) return false; diff --git a/ecrire/inc_export.php3 b/ecrire/inc_export.php3 index 78ba92fffb..860d11f2b5 100644 --- a/ecrire/inc_export.php3 +++ b/ecrire/inc_export.php3 @@ -63,7 +63,7 @@ function export_objets($query, $type, $file = 0, $gz = false, $etape_en_cours="" if ($type == "forum"){ $total = spip_num_rows($result); if ($total > 5000){ - $result = spip_query($query." LIMIT $debut_limit OFFSET 5000"); + $result = spip_query($query." LIMIT 5000 OFFSET $debut_limit"); $debut_limit = $debut_limit + 5000; if ($debut_limit > $total) { $debut_limit = 0; @@ -80,7 +80,7 @@ function export_objets($query, $type, $file = 0, $gz = false, $etape_en_cours="" if ($type == "article"){ $total = spip_num_rows($result); if ($total > 500){ - $result = spip_query($query." LIMIT $debut_limit OFFSET 500"); + $result = spip_query($query." LIMIT 500 OFFSET $debut_limit"); $debut_limit = $debut_limit + 500; if ($debut_limit > $total) { $debut_limit = 0; diff --git a/ecrire/inc_index.php3 b/ecrire/inc_index.php3 index 2a69709861..23cb6ce0d6 100644 --- a/ecrire/inc_index.php3 +++ b/ecrire/inc_index.php3 @@ -78,7 +78,7 @@ function indexer_chaine($texte, $val = 1, $min_long = 3) { function deja_indexe($type, $id_objet) { $table_index = 'spip_index_'.table_objet($type); $col_id = 'id_'.$type; - $query = "SELECT $col_id FROM $table_index WHERE $col_id=$id_objet LIMIT 0 OFFSET 1"; + $query = "SELECT $col_id FROM $table_index WHERE $col_id=$id_objet LIMIT 1 OFFSET 0"; $n = @spip_num_rows(@spip_query($query)); return ($n > 0); } @@ -300,7 +300,7 @@ function indexer_objet($type, $id_objet, $forcer_reset = true) { if ($row['syndication'] = "oui") { $query_syndic = "SELECT titre FROM spip_syndic_articles WHERE id_syndic=$id_objet AND statut='publie' - ORDER BY date DESC LIMIT 0 OFFSET 100"; + ORDER BY date DESC LIMIT 100 OFFSET 0"; $result_syndic = spip_query($query_syndic); while ($row_syndic = spip_fetch_array($result_syndic)) { indexer_chaine($row_syndic['titre'], 5); @@ -461,7 +461,7 @@ function effectuer_une_indexation($nombre_indexations = 1) { else $limit = $nombre_indexations; - $s = spip_query("SELECT id_$type, idx FROM $table_objet WHERE idx IN ('','1','idx') AND $critere ORDER BY idx='idx',idx='' LIMIT 0 OFFSET $limit"); + $s = spip_query("SELECT id_$type, idx FROM $table_objet WHERE idx IN ('','1','idx') AND $critere ORDER BY idx='idx',idx='' LIMIT $limit OFFSET 0"); while ($t = spip_fetch_array($s)) { $vu[$type] .= $t[0].", "; indexer_objet($type, $t[0], $t[1]); @@ -472,7 +472,7 @@ function effectuer_une_indexation($nombre_indexations = 1) { function executer_une_indexation_syndic() { $id_syndic = 0; - if ($row = spip_fetch_array(spip_query("SELECT id_syndic FROM spip_syndic WHERE statut='publie' AND date_index < DATE_SUB(NOW(), INTERVAL 7 DAY) ORDER BY date_index LIMIT 0 OFFSET 1"))) { + if ($row = spip_fetch_array(spip_query("SELECT id_syndic FROM spip_syndic WHERE statut='publie' AND date_index < DATE_SUB(NOW(), INTERVAL 7 DAY) ORDER BY date_index LIMIT 1 OFFSET 0"))) { $id_syndic = $row['id_syndic']; spip_query("UPDATE spip_syndic SET date_index=NOW() WHERE id_syndic=$id_syndic"); marquer_indexer('syndic', $id_syndic); @@ -512,7 +512,7 @@ function requete_txt_integral($objet, $hash_recherche) { AND rec.hash IN ($hash_recherche) GROUP BY objet.$id_objet ORDER BY points DESC - LIMIT 0 OFFSET 10"; + LIMIT 10 OFFSET 0"; } // rechercher un mot dans le dico diff --git a/ecrire/inc_majbase.php3 b/ecrire/inc_majbase.php3 index 05027cbafe..019e82acdc 100644 --- a/ecrire/inc_majbase.php3 +++ b/ecrire/inc_majbase.php3 @@ -423,7 +423,7 @@ function maj_base() { } if ($version_installee < 1.418) { - $query = "SELECT * FROM spip_auteurs WHERE statut = '0minirezo' AND email != '' ORDER BY id_auteur LIMIT 0 OFFSET 1"; + $query = "SELECT * FROM spip_auteurs WHERE statut = '0minirezo' AND email != '' ORDER BY id_auteur LIMIT 1 OFFSET 0"; $result = spip_query($query); if ($webmaster = spip_fetch_array($result)) { include_ecrire("inc_meta.php3"); diff --git a/ecrire/inc_mots.php3 b/ecrire/inc_mots.php3 index 4f573de4e1..0cd72d25f4 100644 --- a/ecrire/inc_mots.php3 +++ b/ecrire/inc_mots.php3 @@ -556,7 +556,7 @@ function afficher_groupe_mots($id_groupe) { if (strlen($tranches)) { - $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 0 OFFSET 1"); + $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 1 OFFSET 0"); if ($row = spip_fetch_array($res_proch)) { $id_ajax_fonc = $row["id_ajax_fonc"]; } else { diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3 index e73ecae068..9bc757adce 100644 --- a/ecrire/inc_presentation.php3 +++ b/ecrire/inc_presentation.php3 @@ -561,7 +561,7 @@ function afficher_tranches_requete(&$query, $colspan, $tmp_var=false, $javascrip if ($deb_aff != -1) { if ($deb_aff > 0) $deb_aff --; // Correction de bug: si on affiche "de 1 a 10", alors LIMIT 0 OFFSET 10 $query = eregi_replace('LIMIT[[:space:]].*$', '', $query); - $query .= " LIMIT $deb_aff OFFSET $nb_aff"; + $query .= " LIMIT $nb_aff OFFSET $deb_aff"; } } @@ -752,7 +752,7 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a $div_trad = substr(md5($requete), 0, 4); - $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 0 OFFSET 1"); + $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 1 OFFSET 0"); if ($row = spip_fetch_array($res_proch)) { $id_ajax_trad = $row["id_ajax_fonc"]; } else { @@ -809,7 +809,7 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a if (strlen($tranches) OR $toujours_afficher) { - $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 0 OFFSET 1"); + $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 1 OFFSET 0"); if ($row = spip_fetch_array($res_proch)) { $id_ajax_fonc = $row["id_ajax_fonc"]; } else { @@ -997,7 +997,7 @@ function afficher_articles_trad($titre_table, $requete, $afficher_visites = fals $div_trad = substr(md5($requete), 0, 4); - $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 0 OFFSET 1"); + $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 1 OFFSET 0"); if ($row = spip_fetch_array($res_proch)) { $id_ajax_trad = $row["id_ajax_fonc"]; } else { @@ -1037,7 +1037,7 @@ function afficher_articles_trad($titre_table, $requete, $afficher_visites = fals if (strlen($tranches) OR $toujours_afficher) { - $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 0 OFFSET 1"); + $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 1 OFFSET 0"); if ($row = spip_fetch_array($res_proch)) { $id_ajax_fonc = $row["id_ajax_fonc"]; } else { @@ -2047,12 +2047,12 @@ function barre_onglets($rubrique, $onglet){ onglet(_T('onglet_messages_publics'), "controle_forum.php3?page=public", "public", $onglet, "forum-public-24.gif"); onglet(_T('onglet_messages_internes'), "controle_forum.php3?page=interne", "interne", $onglet, "forum-interne-24.gif"); - $query_forum = "SELECT * FROM spip_forum WHERE statut='publie' AND texte='' LIMIT 0 OFFSET 1"; + $query_forum = "SELECT * FROM spip_forum WHERE statut='publie' AND texte='' LIMIT 1 OFFSET 0"; $result_forum = spip_query($query_forum); if ($row = spip_fetch_array($result_forum)) onglet(_T('onglet_messages_vide'), "controle_forum.php3?page=vide", "vide", $onglet); - $query_forum = "SELECT * FROM spip_forum WHERE statut='prop' LIMIT 0 OFFSET 1"; + $query_forum = "SELECT * FROM spip_forum WHERE statut='prop' LIMIT 1 OFFSET 0"; $result_forum = spip_query($query_forum); if ($row = spip_fetch_array($result_forum)) onglet(_T('texte_statut_attente_validation'), "controle_forum.php3?page=prop", "prop", $onglet); @@ -2423,7 +2423,7 @@ else { echo "<div class='$class' id='bandeaudocuments' style='position: absolute; $spip_lang_left: ".$decal."px;'><div class='bandeau_sec'><table class='gauche'><tr>\n"; //icone_bandeau_secondaire (_T('icone_rubriques'), "naviguer.php3", "rubrique-24.gif", "rubriques", $sous_rubrique); - $nombre_articles = spip_num_rows(spip_query("SELECT art.id_article FROM spip_articles AS art, spip_auteurs_articles AS lien WHERE lien.id_auteur = '$connect_id_auteur' AND art.id_article = lien.id_article LIMIT 0 OFFSET 1")); + $nombre_articles = spip_num_rows(spip_query("SELECT art.id_article FROM spip_articles AS art, spip_auteurs_articles AS lien WHERE lien.id_auteur = '$connect_id_auteur' AND art.id_article = lien.id_article LIMIT 1 OFFSET 0")); if ($nombre_articles > 0) { icone_bandeau_secondaire (_T('icone_tous_articles'), "articles_page.php3", "article-24.gif", "articles", $sous_rubrique); } @@ -2434,7 +2434,7 @@ else { $nombre_versions = spip_num_rows(spip_query(" SELECT versions.*, articles.statut, articles.titre FROM spip_versions AS versions, spip_articles AS articles - WHERE versions.id_article = articles.id_article AND versions.id_version > 1$req_where LIMIT 0 OFFSET 1")); + WHERE versions.id_article = articles.id_article AND versions.id_version > 1$req_where LIMIT 1 OFFSET 0")); if ($nombre_versions > 0 OR 1==1) { icone_bandeau_secondaire (_T('icone_suivi_revisions'), "suivi_revisions.php3", "historique-24.gif", "revisions", $sous_rubrique); } @@ -2455,7 +2455,7 @@ else { if ($activer_sites<>'non') icone_bandeau_secondaire (_T('icone_sites_references'), "sites_tous.php3", "site-24.gif", "sites", $sous_rubrique); - if (@spip_num_rows(spip_query("SELECT * FROM spip_documents_rubriques LIMIT 0 OFFSET 1")) > 0) { + if (@spip_num_rows(spip_query("SELECT * FROM spip_documents_rubriques LIMIT 1 OFFSET 0")) > 0) { icone_bandeau_secondaire (_T('icone_doc_rubrique'), "documents_liste.php3", "doc-24.gif", "documents", $sous_rubrique); } } @@ -2724,7 +2724,7 @@ else { $gadget = ''; $vos_articles = spip_query("SELECT articles.id_article, articles.titre, articles.statut FROM spip_articles AS articles, spip_auteurs_articles AS lien WHERE articles.id_article=lien.id_article ". - "AND lien.id_auteur=$connect_id_auteur AND articles.statut='prepa' ORDER BY articles.date DESC LIMIT 0 OFFSET 5"); + "AND lien.id_auteur=$connect_id_auteur AND articles.statut='prepa' ORDER BY articles.date DESC LIMIT 5 OFFSET 0"); if (spip_num_rows($vos_articles) > 0) { $gadget .= "<div> </div>"; $gadget .= "<div class='bandeau_rubriques' style='z-index: 1;'>"; @@ -2741,7 +2741,7 @@ else { } $vos_articles = spip_query("SELECT articles.id_article, articles.titre, articles.statut FROM spip_articles AS articles WHERE articles.statut='prop' ". - " ORDER BY articles.date DESC LIMIT 0 OFFSET 5"); + " ORDER BY articles.date DESC LIMIT 5 OFFSET 0"); if (spip_num_rows($vos_articles) > 0) { $gadget .= "<div> </div>"; $gadget .= "<div class='bandeau_rubriques' style='z-index: 1;'>"; @@ -2759,7 +2759,7 @@ else { } $vos_articles = spip_query("SELECT * FROM spip_breves WHERE statut='prop' ". - " ORDER BY date_heure DESC LIMIT 0 OFFSET 5"); + " ORDER BY date_heure DESC LIMIT 5 OFFSET 0"); if (spip_num_rows($vos_articles) > 0) { $gadget .= "<div> </div>"; $gadget .= "<div class='bandeau_rubriques' style='z-index: 1;'>"; @@ -2777,7 +2777,7 @@ else { } - $query = "SELECT id_rubrique FROM spip_rubriques LIMIT 0 OFFSET 1"; + $query = "SELECT id_rubrique FROM spip_rubriques LIMIT 1 OFFSET 0"; $result = spip_query($query); if (spip_num_rows($result) > 0) { @@ -2849,8 +2849,8 @@ else { $jour = jour($date); // Taches (ne calculer que la valeur booleenne...) - if (spip_num_rows(spip_query("SELECT type FROM spip_messages AS messages WHERE id_auteur=$connect_id_auteur AND statut='publie' AND type='pb' AND rv!='oui' LIMIT 0 OFFSET 1")) OR - spip_num_rows(spip_query("SELECT type FROM spip_messages AS messages, spip_auteurs_messages AS lien WHERE ((lien.id_auteur='$connect_id_auteur' AND lien.id_message=messages.id_message) OR messages.type='affich') AND messages.rv='oui' AND messages.date_heure > DATE_SUB(NOW(), INTERVAL 1 DAY) AND messages.date_heure < DATE_ADD(NOW(), INTERVAL 1 MONTH) AND messages.statut='publie' GROUP BY messages.id_message ORDER BY messages.date_heure LIMIT 0 OFFSET 1"))) { + if (spip_num_rows(spip_query("SELECT type FROM spip_messages AS messages WHERE id_auteur=$connect_id_auteur AND statut='publie' AND type='pb' AND rv!='oui' LIMIT 1 OFFSET 0")) OR + spip_num_rows(spip_query("SELECT type FROM spip_messages AS messages, spip_auteurs_messages AS lien WHERE ((lien.id_auteur='$connect_id_auteur' AND lien.id_message=messages.id_message) OR messages.type='affich') AND messages.rv='oui' AND messages.date_heure > DATE_SUB(NOW(), INTERVAL 1 DAY) AND messages.date_heure < DATE_ADD(NOW(), INTERVAL 1 MONTH) AND messages.statut='publie' GROUP BY messages.id_message ORDER BY messages.date_heure LIMIT 1 OFFSET 0"))) { $largeur = "410px"; $afficher_cal = true; } diff --git a/ecrire/inc_rss.php3 b/ecrire/inc_rss.php3 index aa2f8ffb26..097045004c 100644 --- a/ecrire/inc_rss.php3 +++ b/ecrire/inc_rss.php3 @@ -199,7 +199,7 @@ function rss_suivi_forums($a, $query_forum='', $lien_moderation=false) { SELECT * FROM spip_forum WHERE " . $query_forum . " - ORDER BY date_heure DESC LIMIT 0 OFFSET 20" + ORDER BY date_heure DESC LIMIT 20 OFFSET 0" ); while ($t = spip_fetch_array($result_forum)) { @@ -272,7 +272,7 @@ function rss_suivi_messagerie($a) { if ($messages_vus) { $s = spip_query("SELECT * FROM spip_forum WHERE id_message IN (".join(',', $messages_vus).") - ORDER BY date_heure DESC LIMIT 0 OFFSET 10"); + ORDER BY date_heure DESC LIMIT 10 OFFSET 0"); while ($t = spip_fetch_array($s)) { $item = array( @@ -303,7 +303,7 @@ function rss_a_suivre($a) { function rss_articles($critere) { $s = spip_query("SELECT * FROM spip_articles WHERE $critere - ORDER BY date DESC LIMIT 0 OFFSET 10"); + ORDER BY date DESC LIMIT 10 OFFSET 0"); while ($t = spip_fetch_array($s)) { $auteur = spip_fetch_array(spip_query("SELECT auteurs.nom AS nom, auteurs.email AS email @@ -331,7 +331,7 @@ function rss_articles($critere) { function rss_breves($critere) { $s = spip_query("SELECT * FROM spip_breves WHERE $critere - ORDER BY date_heure DESC LIMIT 0 OFFSET 10"); + ORDER BY date_heure DESC LIMIT 10 OFFSET 0"); while ($t = spip_fetch_array($s)) { $item = array( 'title' => typo($t['titre']), @@ -351,7 +351,7 @@ function rss_breves($critere) { function rss_sites($critere) { $s = spip_query("SELECT * FROM spip_syndic WHERE $critere - ORDER BY date DESC LIMIT 0 OFFSET 10"); + ORDER BY date DESC LIMIT 10 OFFSET 0"); while ($t = spip_fetch_array($s)) { $item = array( 'title' => typo($t['titre']." ".$t['url_site']), diff --git a/ecrire/inc_signatures.php3 b/ecrire/inc_signatures.php3 index 4e1ac3feca..31dffa5e4a 100644 --- a/ecrire/inc_signatures.php3 +++ b/ecrire/inc_signatures.php3 @@ -25,7 +25,8 @@ function controle_signatures($script, $id, $debut, $where, $order, $limit=10) { $request = spip_query("SELECT * FROM spip_signatures " . ($where ? " WHERE $where" : "") . ($order ? " ORDER BY $order" : "") . - " LIMIT " . ($debut ? "$debut OFFSET " : "") . $limit); + " LIMIT $limit" . + ($debut ? " OFFSET $debut" : ""); while($row=spip_fetch_array($request)){ $id_signature = $row['id_signature']; diff --git a/ecrire/inc_sites.php3 b/ecrire/inc_sites.php3 index 919da36194..48c70aa5cb 100644 --- a/ecrire/inc_sites.php3 +++ b/ecrire/inc_sites.php3 @@ -1030,13 +1030,13 @@ function executer_une_syndication() { // On va tenter un site 'sus' ou 'off' de plus de 24h, et le passer en 'off' // s'il echoue - if ($row = spip_fetch_array(spip_query("SELECT * FROM spip_syndic WHERE syndication IN ('sus','off') AND statut='publie' AND date_syndic < DATE_SUB(NOW(), INTERVAL 24 HOUR) ORDER BY date_syndic LIMIT 0 OFFSET 1"))) { + if ($row = spip_fetch_array(spip_query("SELECT * FROM spip_syndic WHERE syndication IN ('sus','off') AND statut='publie' AND date_syndic < DATE_SUB(NOW(), INTERVAL 24 HOUR) ORDER BY date_syndic LIMIT 1 OFFSET 0"))) { $id_syndic = $row["id_syndic"]; syndic_a_jour($id_syndic, 'off'); } // Et un site 'oui' de plus de 2 heures, qui passe en 'sus' s'il echoue - if ($row = spip_fetch_array(spip_query("SELECT * FROM spip_syndic WHERE syndication='oui' AND statut='publie' AND date_syndic < DATE_SUB(NOW(), INTERVAL 2 HOUR) ORDER BY date_syndic LIMIT 0 OFFSET 1"))) { + if ($row = spip_fetch_array(spip_query("SELECT * FROM spip_syndic WHERE syndication='oui' AND statut='publie' AND date_syndic < DATE_SUB(NOW(), INTERVAL 2 HOUR) ORDER BY date_syndic LIMIT 1 OFFSET 0"))) { $id_syndic = $row["id_syndic"]; syndic_a_jour($id_syndic, 'sus'); } diff --git a/ecrire/inc_statistiques.php3 b/ecrire/inc_statistiques.php3 index fe8612198b..765787de40 100644 --- a/ecrire/inc_statistiques.php3 +++ b/ecrire/inc_statistiques.php3 @@ -163,9 +163,9 @@ function supprimer_referers($type = "") { } } if (!$count) $count = 1; - + $count = intval($count * 100); $query = "SELECT visites FROM $table ". - "ORDER BY visites LIMIT ".intval($count * 100)." OFFSET 1"; + "ORDER BY visites LIMIT 1 OFFSET $count"; $result = spip_query($query); $visites_min = 1; if ($row = @spip_fetch_array($result)) { @@ -186,7 +186,7 @@ function calculer_n_referers($nb_referers) { $date = date("Y-m-d"); $result = spip_query("SELECT COUNT(DISTINCT ip) AS visites, referer, HEX(referer_md5) AS md5 ". - "FROM spip_referers_temp GROUP BY referer_md5 LIMIT 0 OFFSET $nb_referers"); + "FROM spip_referers_temp GROUP BY referer_md5 LIMIT $nb_referers OFFSET 0"); $tous = spip_num_rows($result); @@ -267,7 +267,7 @@ function aff_referers ($query, $limit=10, $plus = true) { // Charger les moteurs de recherche $arr_engines = stats_load_engines(); - $query .= " LIMIT 0 OFFSET $limit"; + $query .= " LIMIT $limit OFFSET 0"; $result = spip_query($query); while ($row = spip_fetch_array($result)) { diff --git a/ecrire/index.php3 b/ecrire/index.php3 index b4d23a70a9..e41b494a61 100644 --- a/ecrire/index.php3 +++ b/ecrire/index.php3 @@ -218,7 +218,7 @@ if ($vos_articles) $vos_articles = ' AND articles.id_article NOT IN ('.join($vos // if ($spip_display == 4) { debut_raccourcis(); - if (spip_num_rows(spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 0 OFFSET 1"))) { + if (spip_num_rows(spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 1 OFFSET 0"))) { icone_horizontale(_T('icone_ecrire_article'), "articles_edit.php3?new=oui", "article-24.gif","creer.gif"); $activer_breves = lire_meta("activer_breves"); @@ -250,7 +250,7 @@ if ($spip_display == 4) { $gadget .= icone_horizontale(_T('icone_creer_rubrique'), "rubriques_edit.php3?new=oui", "rubrique-24.gif", "creer.gif", false); $gadget .= "</td>"; } - if (spip_num_rows(spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 0 OFFSET 1"))) { + if (spip_num_rows(spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 1 OFFSET 0"))) { $gadget .= "<td>"; $gadget .= icone_horizontale(_T('icone_ecrire_article'), "articles_edit.php3?new=oui$dans_rub", "article-24.gif","creer.gif", false); $gadget .= "</td>"; @@ -278,7 +278,7 @@ if ($spip_display == 4) { $gadget .= "<center><table><tr>"; - $nombre_articles = spip_num_rows(spip_query("SELECT art.id_article FROM spip_articles AS art, spip_auteurs_articles AS lien WHERE lien.id_auteur = '$connect_id_auteur' AND art.id_article = lien.id_article LIMIT 0 OFFSET 1")); + $nombre_articles = spip_num_rows(spip_query("SELECT art.id_article FROM spip_articles AS art, spip_auteurs_articles AS lien WHERE lien.id_auteur = '$connect_id_auteur' AND art.id_article = lien.id_article LIMIT 1 OFFSET 0")); if ($nombre_articles > 0) { $gadget .= "<td>"; $gadget .= icone_horizontale (_T('icone_tous_articles'), "articles_page.php3", "article-24.gif", "", false); diff --git a/ecrire/js_menu_rubriques.php b/ecrire/js_menu_rubriques.php index 210c9b306c..b74367b11f 100644 --- a/ecrire/js_menu_rubriques.php +++ b/ecrire/js_menu_rubriques.php @@ -30,7 +30,7 @@ function gen_liste_rubriques() { // se restreindre aux rubriques utilisees recemment +secteurs $liste="0"; $s = spip_query("SELECT id_rubrique FROM spip_rubriques - ORDER BY id_parent=0 DESC, date DESC LIMIT 0,500"); + ORDER BY id_parent=0 DESC, date DESC LIMIT 500 OFFSET 0"); while ($t = spip_fetch_array($s)) $liste .=",".$t['id_rubrique']; diff --git a/ecrire/message.php3 b/ecrire/message.php3 index 6b2be81bed..d4aa8856c5 100644 --- a/ecrire/message.php3 +++ b/ecrire/message.php3 @@ -167,7 +167,7 @@ function http_afficher_forum_perso($id_message, $titre) icone(_T('icone_poster_message'), "forum_envoi.php3?statut=perso&adresse_retour=".$forum_retour."&id_message=$id_message&titre_message=".urlencode($titre), "forum-interne-24.gif", "creer.gif"); echo "</div>\n<p align='left'>"; - $query_forum = "SELECT * FROM spip_forum WHERE statut='perso' AND id_message='$id_message' AND id_parent=0 ORDER BY date_heure DESC LIMIT 0 OFFSET 20"; + $query_forum = "SELECT * FROM spip_forum WHERE statut='perso' AND id_message='$id_message' AND id_parent=0 ORDER BY date_heure DESC LIMIT 20 OFFSET 0"; afficher_forum(spip_query($query_forum), $forum_retour); echo "\n</p>"; } diff --git a/ecrire/messagerie.php3 b/ecrire/messagerie.php3 index 521e2888b3..bc13037a6f 100644 --- a/ecrire/messagerie.php3 +++ b/ecrire/messagerie.php3 @@ -124,7 +124,7 @@ afficher_messages(_T('info_message_en_redaction'), $query_message, true, false, $query = "SELECT auteurs.id_auteur, auteurs.nom, COUNT(*) AS total FROM spip_auteurs AS auteurs, spip_auteurs_messages AS lien2, spip_messages AS messages, spip_auteurs_messages AS lien ". "WHERE (lien.id_auteur = $connect_id_auteur AND lien.id_message = messages.id_message AND messages.statut = 'publie' AND (messages.rv != 'oui' OR messages.date_fin > NOW() )) ". "AND (lien2.id_auteur = lien2.id_auteur AND lien2.id_message = messages.id_message AND lien2.id_auteur != $connect_id_auteur AND auteurs.id_auteur = lien2.id_auteur) ". - "GROUP BY auteurs.id_auteur ORDER BY total DESC LIMIT 0 OFFSET 10"; + "GROUP BY auteurs.id_auteur ORDER BY total DESC LIMIT 10 OFFSET 0"; $result = spip_query($query); if (spip_num_rows($result) > 0) { diff --git a/ecrire/naviguer.php3 b/ecrire/naviguer.php3 index fc1ec6aed5..bc4e3a2cd2 100644 --- a/ecrire/naviguer.php3 +++ b/ecrire/naviguer.php3 @@ -47,7 +47,7 @@ else { // si c'est une rubrique-secteur contenant des breves, ne deplacer // que si $confirme_deplace == 'oui' - if ((spip_num_rows(spip_query("SELECT id_rubrique FROM spip_breves WHERE id_rubrique='$id_rubrique' LIMIT 0 OFFSET 1")) > 0) + if ((spip_num_rows(spip_query("SELECT id_rubrique FROM spip_breves WHERE id_rubrique='$id_rubrique' LIMIT 1 OFFSET 0")) > 0) AND ($confirme_deplace != 'oui')) { $id_parent = 0; } @@ -176,7 +176,7 @@ if ($spip_display != 4) { icone_horizontale(_T('icone_tous_articles'), "articles_page.php3", "article-24.gif"); - if (spip_num_rows(spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 0 OFFSET 1")) > 0) { + if (spip_num_rows(spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 1 OFFSET 0")) > 0) { if ($id_rubrique > 0) icone_horizontale(_T('icone_ecrire_article'), "articles_edit.php3?id_rubrique=$id_rubrique&new=oui", "article-24.gif","creer.gif"); @@ -314,25 +314,25 @@ echo "<P>"; $relief = false; if (!$relief) { - $query = "SELECT id_article FROM spip_articles AS articles WHERE id_rubrique='$id_rubrique' AND statut='prop'$vos_articles LIMIT 0 OFFSET 1"; + $query = "SELECT id_article FROM spip_articles AS articles WHERE id_rubrique='$id_rubrique' AND statut='prop'$vos_articles LIMIT 1 OFFSET 0"; $result = spip_query($query); $relief = (spip_num_rows($result) > 0); } if (!$relief) { - $query = "SELECT id_breve FROM spip_breves WHERE id_rubrique='$id_rubrique' AND (statut='prepa' OR statut='prop') LIMIT 0 OFFSET 1"; + $query = "SELECT id_breve FROM spip_breves WHERE id_rubrique='$id_rubrique' AND (statut='prepa' OR statut='prop') LIMIT 1 OFFSET 0"; $result = spip_query($query); $relief = (spip_num_rows($result) > 0); } if (!$relief AND lire_meta('activer_syndic') != 'non') { - $query = "SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND statut='prop' LIMIT 0 OFFSET 1"; + $query = "SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND statut='prop' LIMIT 1 OFFSET 0"; $result = spip_query($query); $relief = (spip_num_rows($result) > 0); } if (!$relief AND lire_meta('activer_syndic') != 'non' AND $connect_statut == '0minirezo' AND $connect_toutes_rubriques) { - $query = "SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND (syndication='off' OR syndication='sus') LIMIT 0 OFFSET 1"; + $query = "SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND (syndication='off' OR syndication='sus') LIMIT 1 OFFSET 0"; $result = spip_query($query); $relief = (spip_num_rows($result) > 0); } diff --git a/ecrire/sites.php3 b/ecrire/sites.php3 index 592dd5241a..3376782182 100644 --- a/ecrire/sites.php3 +++ b/ecrire/sites.php3 @@ -519,7 +519,7 @@ echo "</div>"; echo "<p align='left'>\n"; $result_forum = spip_query("SELECT * FROM spip_forum WHERE statut='prive' -AND id_syndic=$id_syndic AND id_parent=0 ORDER BY date_heure DESC LIMIT 0 OFFSET 20"); +AND id_syndic=$id_syndic AND id_parent=0 ORDER BY date_heure DESC LIMIT 20 OFFSET 0"); afficher_forum($result_forum, $forum_retour); diff --git a/ecrire/sites_edit.php3 b/ecrire/sites_edit.php3 index 1572c46784..8aab37e181 100644 --- a/ecrire/sites_edit.php3 +++ b/ecrire/sites_edit.php3 @@ -18,7 +18,7 @@ include_ecrire ("inc_sites.php3"); $proposer_sites = lire_meta("proposer_sites"); function premiere_rubrique(){ - $query="SELECT * FROM spip_rubriques WHERE id_parent='0' ORDER BY titre LIMIT 0 OFFSET 1"; + $query="SELECT * FROM spip_rubriques WHERE id_parent='0' ORDER BY titre LIMIT 1 OFFSET 0"; $result=spip_query($query); while($row=spip_fetch_array($result)){ diff --git a/ecrire/sites_tous.php3 b/ecrire/sites_tous.php3 index 23f7ed72eb..2bb6d017f8 100644 --- a/ecrire/sites_tous.php3 +++ b/ecrire/sites_tous.php3 @@ -61,7 +61,7 @@ if ($options == 'avancees' AND $connect_statut == '0minirezo') { } afficher_syndic_articles(_T('titre_dernier_article_syndique'), - "SELECT * FROM spip_syndic_articles ORDER BY date DESC LIMIT 0 OFFSET 50", 'afficher site'); + "SELECT * FROM spip_syndic_articles ORDER BY date DESC LIMIT 50 OFFSET 0", 'afficher site'); fin_page(); diff --git a/ecrire/statistiques_svg.php3 b/ecrire/statistiques_svg.php3 index fd010da9a4..b66cbca93f 100644 --- a/ecrire/statistiques_svg.php3 +++ b/ecrire/statistiques_svg.php3 @@ -79,7 +79,7 @@ echo "<?xml version=\"1.0\" standalone=\"no\"?>"; // Recuperer premier jour $query="SELECT UNIX_TIMESTAMP(date) AS date_unix FROM $table ". - "$where ORDER BY date LIMIT 0 OFFSET 1"; + "$where ORDER BY date LIMIT 1 OFFSET 0"; $result = spip_query($query); while ($row = spip_fetch_array($result)) { $date_premier = $row['date_unix']; diff --git a/ecrire/statistiques_visites.php3 b/ecrire/statistiques_visites.php3 index 869f6227c3..8727f829aa 100644 --- a/ecrire/statistiques_visites.php3 +++ b/ecrire/statistiques_visites.php3 @@ -100,7 +100,7 @@ else { // Par popularite $articles_recents[] = "0"; - $query = "SELECT id_article FROM spip_articles WHERE statut='publie' AND popularite > 0 ORDER BY date DESC LIMIT 0 OFFSET 10"; + $query = "SELECT id_article FROM spip_articles WHERE statut='publie' AND popularite > 0 ORDER BY date DESC LIMIT 10 OFFSET 0"; $result = spip_query($query); while ($row = spip_fetch_array($result)) { $articles_recents[] = $row['id_article']; @@ -171,7 +171,7 @@ else { // Par visites depuis le debut - $query = "SELECT id_article, titre, popularite, visites FROM spip_articles WHERE statut='publie' AND popularite > 0 ORDER BY visites DESC LIMIT 0 OFFSET 30"; + $query = "SELECT id_article, titre, popularite, visites FROM spip_articles WHERE statut='publie' AND popularite > 0 ORDER BY visites DESC LIMIT 30 OFFSET 0"; $result = spip_query($query); if (spip_num_rows($result) > 0) { @@ -251,7 +251,7 @@ if (!$origine) { } $query="SELECT UNIX_TIMESTAMP(date) AS date_unix FROM $table ". - "WHERE $where ORDER BY date LIMIT 0 OFFSET 1"; + "WHERE $where ORDER BY date LIMIT 1 OFFSET 0"; $result = spip_query($query); while ($row = spip_fetch_array($result)) { $date_premier = $row['date_unix']; diff --git a/ecrire/suivi_revisions.php3 b/ecrire/suivi_revisions.php3 index ecffc78a18..9bb040f665 100644 --- a/ecrire/suivi_revisions.php3 +++ b/ecrire/suivi_revisions.php3 @@ -63,7 +63,7 @@ while ($row = mysql_fetch_array($result)) { $query_rub = " SELECT versions.*, articles.statut, articles.titre FROM spip_versions AS versions, spip_articles AS articles -WHERE versions.id_article = articles.id_article AND versions.id_version > 1 AND articles.id_secteur=$id_rubrique$req_where LIMIT 0 OFFSET 1"; +WHERE versions.id_article = articles.id_article AND versions.id_version > 1 AND articles.id_secteur=$id_rubrique$req_where LIMIT 1 OFFSET 0"; $result_rub = spip_query($query_rub); if ($id_rubrique == $id_secteur) echo "<li><b>$titre</b>"; @@ -80,7 +80,7 @@ if ((lire_meta('multi_rubriques') == 'oui') OR (lire_meta('multi_articles') == ' $query_lang = " SELECT versions.* FROM spip_versions AS versions, spip_articles AS articles -WHERE versions.id_article = articles.id_article AND versions.id_version > 1 AND articles.lang='$lang' $req_where LIMIT 0 OFFSET 1"; +WHERE versions.id_article = articles.id_article AND versions.id_version > 1 AND articles.lang='$lang' $req_where LIMIT 1 OFFSET 0"; $result_lang = spip_query($query_lang); if ($lang == $lang_choisie) echo "<li><b>$titre</b>"; -- GitLab