cvs: pear /Net_NNTP NNTP.php

From: Date: Thu, 01 Nov 2001 16:37:41 +0000
Subject: cvs: pear /Net_NNTP NNTP.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1233@lists.php.net to get a copy of this message
cox Thu Nov 1 11:37:41 2001 EDT Modified files: /pear/Net_NNTP NNTP.php Log: fix a parse error and identation (please be carefull with commits) Index: pear/Net_NNTP/NNTP.php diff -u pear/Net_NNTP/NNTP.php:1.6 pear/Net_NNTP/NNTP.php:1.7 --- pear/Net_NNTP/NNTP.php:1.6 Tue Oct 30 17:17:31 2001 +++ pear/Net_NNTP/NNTP.php Thu Nov 1 11:37:41 2001 @@ -18,13 +18,13 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: NNTP.php,v 1.6 2001/10/30 22:17:31 mog Exp $ +// $Id: NNTP.php,v 1.7 2001/11/01 16:37:41 cox Exp $ require_once 'PEAR.php'; -define("NNTP_ALL"0,); -define("NNTP_NAMES",1); -define("NNTP_LIST",2); +define('NNTP_ALL', 0); +define('NNTP_NAMES', 1); +define('NNTP_LIST', 2); /** * The NNTP:: class fetches UseNet news articles acording to the standard * based on RFC 1036. @@ -347,7 +347,8 @@ * * @author Morgan Christiansson <mog@linux.nu> */ - function get_data() { + function get_data() + { $body = array(); while(!feof($this->fp)) { $line = trim(fgets($this->fp, 256)); @@ -375,43 +376,45 @@ $this->max = $response_arr[3]; $this->min = $response_arr[2]; - return array( - "first" => $response_arr[2], - "last" => $response_arr[3] - ); + return array( + "first" => $response_arr[2], + "last" => $response_arr[3] + ); } /** - * + * * @param int $fetch NNTP_ALL NNTP_NAMES NNTP_LIST * @author Morgan Christiansson <mog@linux.nu> */ - function get_groups($fetch=TRUE) { - $this->command("LIST"); - foreach($this->get_data() as $line) { - $arr = explode(" ",$line); - $groups[$arr[0]]["group"] = $arr[0]; - $groups[$arr[0]]["last"] = $arr[1]; - $groups[$arr[0]]["first"] = $arr[2]; - $groups[$arr[0]]["posting_allowed"] = $arr[3]; - } - - $this->command("LIST NEWSGROUPS"); - foreach($this->get_data() as $line) { - preg_match("/^(.*?)\s(.*?$)/",$line,$matches); - $groups[$matches[1]]["desc"] = $matches[2]; - } - return $groups; + function get_groups($fetch = true) + { + $this->command("LIST"); + foreach($this->get_data() as $line) { + $arr = explode(" ",$line); + $groups[$arr[0]]["group"] = $arr[0]; + $groups[$arr[0]]["last"] = $arr[1]; + $groups[$arr[0]]["first"] = $arr[2]; + $groups[$arr[0]]["posting_allowed"] = $arr[3]; + } + + $this->command("LIST NEWSGROUPS"); + foreach($this->get_data() as $line) { + preg_match("/^(.*?)\s(.*?$)/",$line,$matches); + $groups[$matches[1]]["desc"] = $matches[2]; + } + return $groups; } - function get_overview_fmt() { + function get_overview_fmt() + { $this->command("LIST OVERVIEW.FMT"); $format = array("number"); foreach($body = $this->get_data() as $line) { $line = current(explode(":",$line)); $format[] = $line; } - return $format; + return $format; } function get_overview($first,$last) { @@ -548,4 +551,4 @@ return $response; } } -?> +?> \ No newline at end of file

« previous php.pear.cvs (#1233) next »