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

En cas d'arguments incohérents, plutot que de retourner vide sans rien dire,...

En cas d'arguments incohérents, plutot que de retourner vide sans rien dire, les signaler dans spip_log et prendre des valeurs par défaut pour aider le validateur à générer des tests significatifs.
parent 18434afb
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -21,14 +21,16 @@ function exec_dater_dist()
// http://doc.spip.org/@exec_dater_args
function exec_dater_args($id, $type)
{
$table = table_objet_sql($type);
$prim = id_table_objet($table); // pour secu
if (!$prim OR !autoriser('voir',$type,$id)) {
if (!$id OR !autoriser('voir',$type,$id)) {
include_spip('inc/minipres');
echo minipres();
} else {
$table = table_objet_sql($type);
if (!$table) {
spip_log("dater, type inconnu: $type");
$type = 'article';
$table = table_objet_sql($type);
}
$row = sql_fetsel("*", $table, "id_$type=$id");
$statut = $row['statut'];
$date = $row[($type!='breve')?"date":"date_heure"];
......
......@@ -24,11 +24,14 @@ function exec_grouper_mots_dist()
function exec_grouper_mots_args($id_groupe)
{
$cpt = sql_countsel("spip_mots", "id_groupe=$id_groupe");
if (!$cpt)
ajax_retour('') ;
else {
$grouper_mots = charger_fonction('grouper_mots', 'inc');
ajax_retour($grouper_mots($id_groupe, $cpt));
if (!$cpt) {
if ($cpt === NULL) {
include_spip('inc/minipres');
echo minipres();
} else ajax_retour('') ;
} else {
$grouper_mots = charger_fonction('grouper_mots', 'inc');
ajax_retour($grouper_mots($id_groupe, $cpt));
}
}
?>
......@@ -22,7 +22,7 @@ function exec_meme_rubrique_dist()
function exec_meme_rubrique_args($id, $type, $order)
{
if ((!autoriser('publierdans','rubrique',$id))
OR (!preg_match('/^[\w_-]+$/',$order))) {
OR (!preg_match('/^[\w_-]*$/',$order))) {
include_spip('inc/minipres');
echo minipres();
} else {
......
......@@ -158,12 +158,12 @@ function controle_une_url($transformer_xml, $script, $dir)
// tant pis, on signale le cas par un resultat negatif
if (strpos($page, "id='minipres'")) {
if (!$f = charger_fonction($script . '_args', $dir, true)) {
if (!$g = charger_fonction($script . '_args', $dir, true)) {
$res = 0 - $res;
} else {
unset($GLOBALS['xhtml_error']);
$args = array(1, 'id_article', 1);
$page2 = $transformer_xml($f, $args);
$page2 = $transformer_xml($f=$g, $args);
$appel = join(', ', $args);
if (strpos($page2, "id='minipres'")) {
$res = 0 - strlen($page2);
......@@ -171,7 +171,7 @@ function controle_une_url($transformer_xml, $script, $dir)
}
}
$n = isset($GLOBALS['xhtml_error']) ? $GLOBALS['xhtml_error'] : '';
spip_log("validation de $script en appelant $f : " . count($n) . " erreurs.");
spip_log("validation de $script en appelant $f : " . ($n ? " des " : "pas d'") . "erreurs.", 'valid');
return array($n, $res, $script, $appel);
}
?>
......@@ -37,15 +37,14 @@ function inc_editer_mot_dist($objet, $id_objet, $cherche_mot, $select_groupe, $f
$url_base = "naviguer";
}
else if ($objet == 'syndic') {
else {
if ($objet != 'syndic')
spip_log("erreur dans formulaire_mots($objet, $id_objet, $cherche_mot, $select_groupe, $flag)");
// continuer avec des valeurs par defaut pour le validateur
$table_id = 'id_syndic';
$table = 'syndic';
$url_base = "sites";
}
else {
spip_log("erreur dans formulaire_mots($objet, $id_objet, $cherche_mot, $select_groupe, $flag)");
return '';
}
$cpt = sql_countsel("spip_mots AS mots, spip_mots_$table AS lien", "lien.$table_id=$id_objet AND mots.id_mot=lien.id_mot");
......
......@@ -1355,7 +1355,11 @@ function meme_rubrique($id_rubrique, $id, $type, $order='date', $limit=NULL, $aj
global $spip_lang_right, $spip_lang_left;
include_spip('inc/afficher_objets');
if (!($table = table_objet_sql($type))) return '';
if (!($table = table_objet_sql($type))) {
spip_log("meme_rubrique: $type table inconnue");
$type = 'article';
$table = table_objet_sql($type);
}
if (!$limit) $limit = 10;
......
......@@ -28,7 +28,11 @@ function inc_tourner_dist($id_document, $document, $script, $flag, $type)
$table = 'spip_documents_' . $type . 's';
$prim = id_table_objet($table);
if (!$prim) return '';
if (!$prim) {
spip_log("tourner: $type table inconnue");
$type = 'article';
$table = 'spip_documents_' . $type . 's';
}
$prim = 'id_' . $type;
// si pas de doc le hash sera inutilisable
$id = intval(sql_getfetsel($prim, $table, "id_document = " . intval($id_document)));
......@@ -54,11 +58,10 @@ function inc_tourner_dist($id_document, $document, $script, $flag, $type)
array('fichier'=>basename($document['fichier'])));
$res = "<img src='" . _DIR_IMG_PACK . "warning-24.gif'"
."\n\tstyle='float: right;'\n\talt=\"$c\"\n\ttitle=\"$c\" />";
} else if ($flag AND !$id_vignette)
$res = boutons_rotateurs($document, $type, $id, $id_document,$script);
$boite = '';
} else {
if ($flag AND !$id_vignette)
$res = boutons_rotateurs($document, $type, $id, $id_document,$script);
}
} else {
$res = "\n<div class='verdana1' style='float: $spip_lang_right; text-align: $spip_lang_right;'>";
......@@ -69,12 +72,15 @@ function inc_tourner_dist($id_document, $document, $script, $flag, $type)
$res .= "</div>\n";
}
return tourner_greffe($id_document, $document, $url, $res);
}
$res .= "<div style='text-align: center;'>";
$res .= document_et_vignette($document, $url, true);
$res .= "</div>\n";
$res .= "<div style='text-align: center; color: 333333;' class='verdana1 spip_x-small'>&lt;doc"
function tourner_greffe($id_document, $document, $url, $res)
{
$res .= "<div style='text-align: center;'>"
.document_et_vignette($document, $url, true)
."</div>\n"
."<div style='text-align: center; color: 333333;' class='verdana1 spip_x-small'>&lt;doc"
. $id_document
. "&gt;</div>";
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter