Location: PHPKode > projects > PHP Newsgroup Reader > tmpsave.php
<?
					for($i=1;$i<=$num_article_field;++$i)
							$arr[$i] = "";
//					$arr[3] = "";
					while ( ($s=fgets($fp))!=$t&&$s!=$u )
					{
							$s = str_replace($replace1, $replace2, $s);
//print("$s<BR>");
							@list($st1, $st2) = split(": ", $s, 2);
							//Xref: shknews01 news.software.readers:51558 news.software.nntp:7355
							if ( $st1=="Xref" )
							{
									@list($temp, $arr[2]) = split(":", $st2);
									@list($arr[2],$temp) = split(" ", $arr[2],2);
//									print("*".$arr[2]."*");
									continue;
							}

							//Message-ID: <hide@address.com>
							if ($st1=="Message-ID")
							{
									@list($temp, $temp1) = split("<", $st2);
									@list($arr[1], $temp) = split(">", $temp1);
									continue;
							}

							//References: <3d2c553d$hide@address.com>
							if ($st1=="References")
								for ($k=strlen($st2)-1;$k>=0;$k--)
									if ($st2[$k]=='<')
                	        		{
										$temp = substr($st2,1+$k);
										list($arr[3],$temp) = split('>',$temp,2);
										break;
									}

							//From: ">_< Y*2 >~<"
							if ($st1=="From")
							{
								@list($st2, $temp) = split(" <", $st2);
								@list($arr[7],$temp1) = split(">", $temp);
								if ( $st2[0]=="\""&&$st2[strlen($st2)-1]=="\"" )
									$st2 = substr($st2,1,strlen($st2)-2);
								$arr[5] = decode_mime($st2);
								continue;
							}

							//Subject: Re: 11111
							if ( is_int(strpos($st1,"=?")) )
								$arr[4] = $arr[4].decode_mime($st1);
							if ($st1=="Subject")
								$arr[4] = decode_mime($st2);

							//Date: fri, 19 Jul 2002 18:13:57 +0800//Date: Fri, 21 Mar 2003 15:41:44 -0000
							if ($st1=="Date")
							{
								if ( (ord($st2[0])-ord('9'))>0 )
									list($temp,$date) = split(" ", $st2, 2);
								else
									$date = $st2;
								list($dd,$mm,$yy,$time, $temp) = split(" ", $date);
								list($h, $m, $s1) = split(":", $time);
								$temp1 = $GMT-($temp[0]=='+'?(int)$temp[1]*10+(int)$temp[2]:-(int)$temp[1]*10-(int)$temp[2]);
								if ( $h+$temp1<0 )
								{
									$dd--;
									$h=24+($h+$temp1);
								}else if ($h+$temp1>=24){
									$dd++;
									$h=($h+$temp1)-24;
								}else
									$h += $temp1;
								if ( $h<=9 )
									$h = "0".$h;
								@$mm = $month[strtolower($mm)];
								$arr[6] = $yy[2].$yy[3]."/".$mm."/".$dd." ".$h.":".$m.":".$s1;
							}
					}//while
					$last1--;

					if ( $s==$t )
							if ( $arr[3]=="" )//No reference ID -> Not a reply post
							{
									$new_post[++$num_new_post] = $arr;

									for (@$i=count($arr1); $i; --$i)
										if ( $flag2[$i] )/*if($arr1[$i][6]>=$new_post[$j][6])*/
											sorting($new_post[$num_new_post]);
							}else{
									++$num_reply_post;
									$arr1[$num_reply_post] = $arr;
									$flag2[$num_reply_post] = 1;/* !!FLAG2 is a VERY important factor to efficiency!! */
							}
?>
Return current item: PHP Newsgroup Reader