Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1139 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  erreur Notice: Undefined offset

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

erreur Notice: Undefined offset

n°1704135
tinihau
Posté le 18-03-2008 à 15:46:55  profilanswer
 

Bonjour,
 
j'ai récupérer des codes qui me permmettent de communiquer avec des serveurs de news.
 
Tout fonctionne bien mais lorsque j'exécute le fichier article.php ci dessous :
 

Citation :

<?
  header("Expires: ".gmdate("D, d M Y H:i:s",time()+(3600*24))." GMT" );
 
 
  // register parameters
  $id=$_REQUEST["id"];
  $group=$_REQUEST["group"];
 
  include "config.inc.php";
 
  /*
  $thread_show["replies"]=true;
  $thread_show["lastdate"]=false;
  $thread_show["threadsize"]=false;
  */
 
  include "auth.inc";
  include "$file_newsportal";
 
  $message=message_read($id,0,$group);
  if (!$message) {
    header ("HTTP/1.0 404 Not Found" );
    $subject=$title;
    $title.=' - Article not found';
    if($ns!=false)
    nntp_close($ns);
  } else {
    $subject=htmlspecialchars($message->header->subject);
    header("Last-Modified: ".date("r", $message->header->date));
    $title.= ' - '.$subject;
  }
  include "head.inc";
 
  // has the user read-rights on this article?
  if((function_exists("npreg_group_has_read_access" ) &&
      !npreg_group_has_read_access($group)) ||
     (function_exists("npreg_group_is_visible" ) &&
      !npreg_group_is_visible($group))) {
    die("access denied" );
  }
 
 
?>
 
<div class="centerblock">
 
<h1 class="np_article_headline"><?=htmlspecialchars($subject) ?></h1>
 
<table cellpadding="0" cellspacing="0" width="100%" class="np_buttonbar"><tr>
<?
  echo '<td class="np_button"><a class="np_button" href="'.
       $file_index.'">'.$text_thread["button_grouplist"].'</a></td>';
  echo '<td class="np_button"><a class="np_button" href="'.
       $file_thread.'?group='.urlencode($group).'">'.$text_article["back_to_group"].'</a></td>';
  if ((!$readonly) && ($message) &&
      (!function_exists("npreg_group_has_write_access" ) ||
             npreg_group_has_write_access($group)))
    echo '<td class="np_button"> <a class="np_button" href="'.
         $file_post.'?type=reply&id='.urlencode($id).
         '&group='.urlencode($group).'">'.$text_article["button_answer"].
         '</a></td>';
 
?>
<td width="100%">&nbsp;</td></tr></table>
 
<?
  if (!$message)
    // article not found
    echo $text_error["article_not_found"];
  else {
    if($article_showthread)
      $thread=thread_cache_load($group);
    //echo "<br>";
    message_show($group,$id,0,$message);
    if($article_showthread)
      message_thread($message->header->id,$group,$thread);
 
  }
  include "tail.inc";
?>
</div>


 
il m'affiche bien ce que je veut mais m'affiche aussi les erreurs suivantes qui sont assez gênantes car j'aimerai un affichage propre :
 

Citation :


Notice: Undefined offset: 54 in c:\program files\easyphp1-8\www\newsportal-0.37\lib\message.inc.php on line 396
 
Notice: Undefined offset: 54 in c:\program files\easyphp1-8\www\newsportal-0.37\lib\message.inc.php on line 419
 
Notice: Undefined offset: 54 in c:\program files\easyphp1-8\www\newsportal-0.37\lib\message.inc.php on line 472
 
Notice: Undefined offset: 54 in c:\program files\easyphp1-8\www\newsportal-0.37\lib\message.inc.php on line 474
 
Notice: Undefined offset: 54 in c:\program files\easyphp1-8\www\newsportal-0.37\lib\message.inc.php on line 476
 
Notice: Undefined offset: 54 in c:\program files\easyphp1-8\www\newsportal-0.37\lib\message.inc.php on line 480


 
quelqu'un pourrait t'il m'aider à les corriger svp
 
merci de votre aide

mood
Publicité
Posté le 18-03-2008 à 15:46:55  profilanswer
 

n°1704189
art_dupond
je suis neuneu... oui oui !!
Posté le 18-03-2008 à 17:04:55  profilanswer
 

regarde pit-etre dans c:\program files\easyphp1-8\www\newsportal-0.37\lib\message.inc.php on line 396 ?


---------------
oui oui
n°1704214
tinihau
Posté le 18-03-2008 à 17:27:21  profilanswer
 

art_dupond a écrit :

regarde pit-etre dans c:\program files\easyphp1-8\www\newsportal-0.37\lib\message.inc.php on line 396 ?


 
oups !
 
 :pt1cable:  
 
je me suis trompé de fichier, voici lecodage du  fichier c:\program files\easyphp1-8\www\newsportal-0.37\lib\message.inc.php qui contient les erreurs:
 

Citation :

/*
 * decodes a body. Splits the content of $body into an array of several
 * lines, respecting the special decoding issues of format=flowed
 * articles. Each returned line consists of two fields: text and
 * the quote depth (depth)
 */
function decode_textbody($body,$format="fixed" ) {
  $body=split("\n",$body);
  $nbody=array();
  $depth=0;
  $paragraph=""; // empty paragraph
  $lastline="";
  for($i=0; $i<count($body)+1; $i++) {
    // calculate the quote depth of the actual line
    $ndepth=0;
    $tdepth=0;
ligne396:  for($j=0; $j<=strlen($body[$i]); $j++) {
      $tdepth=$j;
      if(isset($body[$i][$j])&&$body[$i][$j]=='>') {
        $ndepth++;
      } else {
        if( isset($body[$i][$j])&& ($body[$i][$j]!=' ') || isset($body[$i][$j-1])&&($body[$i][$j-1]==' ') || ($j==0)) {
          break;
        }
      }
    }
    // generate a new paragraph?
    if(($i>0) && (($ndepth!=$depth) || $format!="flowed" ||
       (isset($paragraph[strlen($paragraph)-1]))&&($paragraph[strlen($paragraph)-1]!=' ')) || ($i==count($body))) {
      $tmp->text=$lastline=$paragraph;
      $tmp->depth=$depth;
      $paragraph="";
      if(phpversion()>=5)
        $nbody[]=clone($tmp);
      else
        $nbody[]=$tmp;
    }
    if(isset($body[$i]) && $body[$i]=="-- " && $format=="flowed" )
 $body[$i]="--";
ligne419:    $paragraph.=substr($body[$i],$tdepth);
    $depth=$ndepth;
  }
  return $nbody;
}
 
/*
 * replaces multiple spaces in texts by &nbsp;es and convert special-chars
 * to their entities
 */
function text2html($text) {
  return eregi_replace("^ ","&nbsp;",
         str_replace("  ","&nbsp; ",
         str_replace("  ","&nbsp; ",
         str_replace("\n","<br>",
         htmlspecialchars($text)))));
}
 
 
/*
 * print an article to the webpage
 *
 * $group: The name of the newsgroup
 * $id: the ID of the article inside the group or the message-id
 * $attachment: The number of the attachment of the article.
 *              0 means the normal textbody.
 */
function message_show($group,$id,$attachment=0,$article_data=false,$maxlen=false) {
  global $file_article,$file_article_full;
  global $text_header,$text_article,$article_showthread;
  global $block_xnoarchive,$article_graphicquotes;
  if ($article_data == false)
    $article_data=message_read($id,$attachment,$group);
  $head=$article_data->header;
  $body=$article_data->body[$attachment];
  if ($head) {
    if (($block_xnoarchive) && (isset($head->xnoarchive)) &&
        ($head->xnoarchive=="yes" )) {
      echo $text_article["block-xnoarchive"];
    } else
    if (($head->content_type[$attachment]=="text/plain" ) &&
        ($attachment==0)) {
      show_header($head,$group);
      $body=decode_textbody($body,
             $article_data->header->content_type_format[$attachment]);
      $depth=0;
      echo '<div class="np_article_body">';
      $currentlen=0; // needed if $maxlen is set
      for ($i=0; $i<=count($body) &&
                 (($currentlen<$maxlen) || ($maxlen==false)); $i++) {
        // HTMLized Quotings instead of boring > ?
        if($article_graphicquotes) {
          // HTMLized Quotings
ligne472: for($j=$depth; $j<$body[$i]->depth; $j++)
            echo '<blockquote class="np_article_quote">';
ligne474: for($j=$body[$i]->depth; $j<$depth; $j++)
            echo '</blockquote>';
ligne476: $t=html_parse(text2html($body[$i]->text)).'<br>';
          echo $t;
          $currentlen+=strlen($t);
          echo "\n";
ligne480: $depth=$body[$i]->depth;
        } else {
          // Boring old Quotings with >
          if($body[$i]->depth==0) {
            if(trim($body[$i]->text)=='')
              $t="<br>\n";
            else
              $t=html_parse(text2html($body[$i]->text))."<br>\n";
          } else {
            $t='<i>'.str_repeat('&gt;',$body[$i]->depth).' '.
              html_parse(text2html(
                 textwrap($body[$i]->text,72-$body[$i]->depth,
                  "\n".str_repeat('>',$body[$i]->depth).' '))).
              "</i><br>\n";
          }
          echo $t;
          $currentlen+=strlen($t);
        }
      }
      echo '</div>';
      if($maxlen!=false && $currentlen>=$maxlen) {
        echo '<br><a href="'.$file_article_full.'?id='.$id.'&group='.
             $group.'">'.$text_article["full_article"].'</a>';
      }
    } else {
      echo $body;
    }
  }
}
 

n°1704220
skeye
Posté le 18-03-2008 à 17:36:24  profilanswer
 

L'auteur s'est planté sur les bornes de ses tableaux en écrivant ses boucles. T'as plus qu'à corriger.[:dawa]


---------------
Can't buy what I want because it's free -
n°1704366
tinihau
Posté le 19-03-2008 à 08:57:35  profilanswer
 

skeye a écrit :

L'auteur s'est planté sur les bornes de ses tableaux en écrivant ses boucles. T'as plus qu'à corriger.[:dawa]


 
Comment justement ?
 
je ne suis pas un grand fana de php  :sweat:

n°1704368
skeye
Posté le 19-03-2008 à 08:59:05  profilanswer
 

Demande à l'auteur.[:dawa]
Ici on est pas vraiment là pour débugger les scripts pompés à droite et à gauche qui marchent pas...et là de toute manière on ne sait pas d'où viennent les tableaux ni ce qu'il y a dedans...


Message édité par skeye le 19-03-2008 à 08:59:51

---------------
Can't buy what I want because it's free -

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  erreur Notice: Undefined offset

 

Sujets relatifs
[php]Erreur d'inscription de formulaire dans une BDDUpload de fichier + création de répertoire: Erreur d'Array !!?
Erreur Php & jpgraphErreur VBA PowerPoint (ActiveWindow)
erreur 3664 pour une requete sql avec la fonction openrecordset[Solutionné][VBA] erreur avec Paste, je comprends pas pourquoi
IE7 attraper l'erreur "URL trop longue"Erreur de code en PHP
Erreur 127 commande make g++ introuvableErreur Type incompatible
Plus de sujets relatifs à : erreur Notice: Undefined offset


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR