Net_NNTP
[ class tree: Net_NNTP ] [ index: Net_NNTP ] [ all elements ]

Source for file Client.php

Documentation is available at Client.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
  3.  
  4. /**
  5.  * 
  6.  * 
  7.  * PHP versions 4 and 5
  8.  *
  9.  * <pre>
  10.  * +-----------------------------------------------------------------------+
  11.  * |                                                                       |
  12.  * | http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231   |
  13.  * |                                                                       |
  14.  * | This work (and included software, documentation such as READMEs,      |
  15.  * | or other related items) is being provided by the copyright holders    |
  16.  * | under the following license. By obtaining, using and/or copying       |
  17.  * | this work, you (the licensee) agree that you have read, understood,   |
  18.  * | and will comply with the following terms and conditions.              |
  19.  * |                                                                       |
  20.  * | Permission to copy, modify, and distribute this software and its      |
  21.  * | documentation, with or without modification, for any purpose and      |
  22.  * | without fee or royalty is hereby granted, provided that you include   |
  23.  * | the following on ALL copies of the software and documentation or      |
  24.  * | portions thereof, including modifications:                            |
  25.  * |                                                                       |
  26.  * | 1. The full text of this NOTICE in a location viewable to users       |
  27.  * |    of the redistributed or derivative work.                           |
  28.  * |                                                                       |
  29.  * | 2. Any pre-existing intellectual property disclaimers, notices,       |
  30.  * |    or terms and conditions. If none exist, the W3C Software Short     |
  31.  * |    Notice should be included (hypertext is preferred, text is         |
  32.  * |    permitted) within the body of any redistributed or derivative      |
  33.  * |    code.                                                              |
  34.  * |                                                                       |
  35.  * | 3. Notice of any changes or modifications to the files, including     |
  36.  * |    the date changes were made. (We recommend you provide URIs to      |
  37.  * |    the location from which the code is derived.)                      |
  38.  * |                                                                       |
  39.  * | THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT    |
  40.  * | HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,    |
  41.  * | INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR        |
  42.  * | FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE    |
  43.  * | OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,           |
  44.  * | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.                               |
  45.  * |                                                                       |
  46.  * | COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT,        |
  47.  * | SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE        |
  48.  * | SOFTWARE OR DOCUMENTATION.                                            |
  49.  * |                                                                       |
  50.  * | The name and trademarks of copyright holders may NOT be used in       |
  51.  * | advertising or publicity pertaining to the software without           |
  52.  * | specific, written prior permission. Title to copyright in this        |
  53.  * | software and any associated documentation will at all times           |
  54.  * | remain with copyright holders.                                        |
  55.  * |                                                                       |
  56.  * +-----------------------------------------------------------------------+
  57.  * </pre>
  58.  *
  59.  * @category   Net
  60.  * @package    Net_NNTP
  61.  * @author     Heino H. Gehlsen <heino@gehlsen.dk>
  62.  * @copyright  2002-2005 Heino H. Gehlsen <heino@gehlsen.dk>. All Rights Reserved.
  63.  * @license
  64.  * @version    CVS: $Id: Client.php,v 1.14 2005/12/24 11:36:29 heino Exp $
  65.  * @link       http://pear.php.net/package/Net_NNTP
  66.  * @see
  67.  *
  68.  * @filesource
  69.  */
  70.  
  71. /**
  72.  *
  73.  */
  74. require_once 'Net/NNTP/Protocol/Client.php';
  75.  
  76.  
  77. // {{{ Net_NNTP_Client
  78.  
  79. /**
  80.  * Implementation of the client side of NNTP (Network News Transfer Protocol)
  81.  *
  82.  * The Net_NNTP_Client class is a frontend class to the Net_NNTP_Protocol_Client class.
  83.  *
  84.  * @category   Net
  85.  * @package    Net_NNTP
  86.  * @version    package: 1.3.2 (beta)
  87.  * @version    api: 0.8.1 (alpha)
  88.  * @access     public
  89.  * @see        Net_NNTP_Protocol_Client
  90.  */
  91. class Net_NNTP_Client extends Net_NNTP_Protocol_Client
  92. {
  93.     // {{{ properties
  94.  
  95.     /**
  96.      * Information summary about the currently selected group.
  97.      *
  98.      * @var array 
  99.      * @access private
  100.      */
  101.     var $_selectedGroupSummary = null;
  102.  
  103.     /**
  104.      * 
  105.      *
  106.      * @var array 
  107.      * @access private
  108.      * @since 1.3.0
  109.      */
  110.     var $_overviewFormatCache = null;
  111.  
  112.     // }}}
  113.     // {{{ constructor
  114.  
  115.     /**
  116.      * Constructor
  117.      *
  118.      * <b>Usage example:</b>
  119.      * {@example docs/examples/phpdoc/constructor.php}
  120.      *
  121.      * @access public
  122.      */
  123.     function Net_NNTP_Client()
  124.     {
  125.         parent::Net_NNTP_Protocol_Client();
  126.     }
  127.  
  128.     // }}}
  129.     // {{{ connect()
  130.  
  131.     /**
  132.      * Connect to a server.
  133.      *
  134.      * xxx
  135.      * 
  136.      * <b>Usage example:</b>
  137.      * {@example docs/examples/phpdoc/connect.php}
  138.      *
  139.      * @param string    $host    (optional) The hostname og IP-address of the NNTP-server to connect to, defaults to localhost.
  140.      * @param mixed    $encryption    (optional) false|'tls'|'ssl', defaults to false.
  141.      * @param int    $port    (optional) The port number to connect to, defaults to 119 or 563 dependng on $encryption.
  142.      * @param int    $timeout    (optional)
  143.      *
  144.      * @return mixed <br>
  145.      *   - (bool)    True when posting allowed, otherwise false
  146.      *   - (object)    Pear_Error on failure
  147.      * @access public
  148.      * @see Net_NNTP_Client::disconnect()
  149.      * @see Net_NNTP_Client::authenticate()
  150.      */
  151.     function connect($host = null$encryption = null$port = null$timeout = null)
  152.     {
  153.         // v1.0.x API
  154.         if (is_int($encryption)) {
  155.         trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: connect() !'E_USER_NOTICE);
  156.             $port $encryption;
  157.         $encryption = null;
  158.         }
  159.  
  160.         return parent::connect($host$encryption$port$timeout);
  161.     }
  162.  
  163.     // }}}
  164.     // {{{ disconnect()
  165.  
  166.     /**
  167.      * Disconnect from server.
  168.      *
  169.      * @return mixed <br>
  170.      *   - (bool)
  171.      *   - (object)    Pear_Error on failure
  172.      * @access public
  173.      * @see Net_NNTP_Client::connect()
  174.      */
  175.     function disconnect()
  176.     {
  177.         return parent::disconnect();
  178.     }
  179.  
  180.     // }}}
  181.     // {{{ quit()
  182.  
  183.     /**
  184.      * Deprecated alias for disconnect().
  185.      *
  186.      * @access public
  187.      * @deprecated
  188.      * @ignore
  189.      */
  190.     function quit()
  191.     {
  192.         return $this->disconnect();
  193.     }
  194.  
  195.     // }}}
  196.     // {{{ authenticate()
  197.  
  198.     /**
  199.      * Authenticate.
  200.      *
  201.      * xxx
  202.      *
  203.      * <b>Non-standard!</b><br>
  204.      * This method uses non-standard commands, which is not part
  205.      * of the original RFC977, but has been formalized in RFC2890.
  206.      *
  207.      * <b>Usage example:</b>
  208.      * {@example docs/examples/phpdoc/authenticate.php}
  209.      *
  210.      * @param string    $user    The username
  211.      * @param string    $pass    The password
  212.      *
  213.      * @return mixed <br>
  214.      *   - (bool)    True on successful authentification, otherwise false
  215.      *   - (object)    Pear_Error on failure
  216.      * @access public
  217.      * @see Net_NNTP_Client::connect()
  218.      */
  219.     function authenticate($user$pass)
  220.     {
  221.         // Username is a must...
  222.         if ($user == null{
  223.             return $this->throwError('No username supplied'null);
  224.         }
  225.  
  226.         return $this->cmdAuthinfo($user$pass);
  227.     }
  228.  
  229.     // }}}
  230.     // {{{ selectGroup()
  231.  
  232.     /**
  233.      * Selects a group.
  234.      * 
  235.      * Moves the servers 'currently selected group' pointer to the group
  236.      * a new group, and returns summary information about it.
  237.      *
  238.      * <b>Non-standard!</b><br>
  239.      * When using the second parameter,
  240.      * This method uses non-standard commands, which is not part
  241.      * of the original RFC977, but has been formalized in RFC2890.
  242.      *
  243.      * <b>Usage example:</b>
  244.      * {@example docs/examples/phpdoc/selectGroup.php}
  245.      *
  246.      * @param string    $group    Name of the group to select
  247.      * @param mixed    $articles    (optional) experimental! When true the article numbers is returned in 'articles'
  248.      *
  249.      * @return mixed <br>
  250.      *   - (array)    Summary about the selected group
  251.      *   - (object)    Pear_Error on failure
  252.      * @access public
  253.      * @see Net_NNTP_Client::getGroups()
  254.      * @see Net_NNTP_Client::group()
  255.      * @see Net_NNTP_Client::first()
  256.      * @see Net_NNTP_Client::last()
  257.      * @see Net_NNTP_Client::count()
  258.      */
  259.     function selectGroup($group$articles = false)
  260.     {
  261.     // Select group (even if $articles is set, since many servers does not select groups when the listgroup command is run)
  262.         $summary $this->cmdGroup($group);
  263.         if (PEAR::isError($summary)) {
  264.             return $summary;
  265.         }
  266.  
  267.         // Store group info in the object
  268.         $this->_selectedGroupSummary $summary;
  269.  
  270.     // 
  271.         if ($articles !== false{
  272.             $summary2 $this->cmdListgroup($group($articles === true ? null : $articles));
  273.             if (PEAR::isError($summary2)) {
  274.                 return $summary2;
  275.             }
  276.  
  277.         // Make sure the summary array is correct...
  278.             if ($summary2['group'== $group{
  279.                 $summary $summary2;
  280.  
  281.         // ... even if server does not include summary in status reponce.
  282.             else {
  283.                 $summary['articles'$summary2['articles'];
  284.             }
  285.         }
  286.     
  287.         return $summary;
  288.     }
  289.  
  290.     // }}}
  291.     // {{{ selectPreviousArticle()
  292.  
  293.     /**
  294.      * Select the previous article.
  295.      *
  296.      * Select the previous article in current group.
  297.      *
  298.      * <b>Usage example:</b>
  299.      * {@example docs/examples/phpdoc/selectPreviousArticle.php}
  300.      *
  301.      * @param int    $_ret    (optional) Experimental
  302.      *
  303.      * @return mixed <br>
  304.      *   - (integer)    Article number, if $ret=0 (default)
  305.      *   - (string)    Message-id, if $ret=1
  306.      *   - (array)    Both article number and message-id, if $ret=-1
  307.      *   - (bool)    False if no prevoius article exists
  308.      *   - (object)    Pear_Error on failure
  309.      * @access public
  310.      * @see Net_NNTP_Client::selectArticle()
  311.      * @see Net_NNTP_Client::selectNextArticle()
  312.      */
  313.     function selectPreviousArticle($_ret = 0)
  314.     {
  315.         $response $this->cmdLast();
  316.  
  317.         if (PEAR::isError($response)) {
  318.             return false;
  319.         }
  320.  
  321.         switch ($_ret{
  322.             case -1:
  323.                 return array('Number' => (int) $response[0]'Message-ID' =>  (string) $response[1]);
  324.                 break;
  325.             case 0:
  326.                 return (int) $response[0];
  327.                 break;
  328.             case 1:
  329.                 return (string) $response[1];
  330.                 break;
  331.             default:
  332.         error()// ...
  333.     }
  334.     }
  335.  
  336.     // }}}
  337.     // {{{ selectNextArticle()
  338.  
  339.     /**
  340.      * Select the next article.
  341.      *
  342.      * Select the next article in current group.
  343.      *
  344.      * <b>Usage example:</b>
  345.      * {@example docs/examples/phpdoc/selectNextArticle.php}
  346.      *
  347.      * @param int    $_ret    (optional) Experimental
  348.      *
  349.      * @return mixed <br>
  350.      *   - (integer)    Article number, if $ret=0 (default)
  351.      *   - (string)    Message-id, if $ret=1
  352.      *   - (array)    Both article number and message-id, if $ret=-1
  353.      *   - (bool)    False if no further articles exist
  354.      *   - (object)    Pear_Error on unexpected failure
  355.      * @access public
  356.      * @see Net_NNTP_Client::selectArticle()
  357.      * @see Net_NNTP_Client::selectPreviousArticle()
  358.      */
  359.     function selectNextArticle($_ret = 0)
  360.     {
  361.         $response $this->cmdNext();
  362.  
  363.         if (PEAR::isError($response)) {
  364.             return $response;
  365.     }
  366.  
  367.         switch ($_ret{
  368.             case -1:
  369.                 return array('Number' => (int) $response[0]'Message-ID' =>  (string) $response[1]);
  370.                 break;
  371.             case 0:
  372.                 return (int) $response[0];
  373.                 break;
  374.             case 1:
  375.                 return (string) $response[1];
  376.                 break;
  377.             default:
  378.         error()// ...
  379.     }
  380.     }
  381.  
  382.     // }}}
  383.     // {{{ selectArticle()
  384.  
  385.     /**
  386.      * Selects an article by article message-number.
  387.      *
  388.      * xxx
  389.      *
  390.      * <b>Usage example:</b>
  391.      * {@example docs/examples/phpdoc/selectArticle.php}
  392.      *
  393.      * @param mixed    $article    The message-number (on the server) of
  394.      *                                   the article to select as current article.
  395.      * @param int    $_ret    (optional) Experimental
  396.      *
  397.      * @return mixed <br>
  398.      *   - (integer)    Article number
  399.      *   - (bool)    False if article doesn't exists
  400.      *   - (object)    Pear_Error on failure
  401.      * @access public
  402.      * @see Net_NNTP_Client::selectNextArticle()
  403.      * @see Net_NNTP_Client::selectPreviousArticle()
  404.      */
  405.     function selectArticle($article = null$_ret = 0)
  406.     {
  407.         $response $this->cmdStat($article);
  408.  
  409.         if (PEAR::isError($response)) {
  410.             return $response;
  411.     }
  412.  
  413.         switch ($ret{
  414.             case -1:
  415.                 return array('Number' => (int) $response[0]'Message-ID' =>  (string) $response[1]);
  416.                 break;
  417.             case 0:
  418.                 return (int) $response[0];
  419.                 break;
  420.             case 1:
  421.                 return (string) $response[1];
  422.                 break;
  423.             default:
  424.         error()// ...
  425.     }
  426.     }
  427.  
  428.     // }}}
  429.     // {{{ getArticle()
  430.  
  431.     /**
  432.      * Fetch article into transfer object.
  433.      *
  434.      * Select an article based on the arguments, and return the entire
  435.      * article (raw data).
  436.      *
  437.      * <b>Usage example:</b>
  438.      * {@example docs/examples/phpdoc/getArticle.php}
  439.      *
  440.      * @param mixed    $article    (optional) Either the message-id or the
  441.      *                                   message-number on the server of the
  442.      *                                   article to fetch.
  443.      * @param bool    $implode    (optional) When true the result array
  444.      *                                   is imploded to a string, defaults to
  445.      *                                   false.
  446.      *
  447.      * @return mixed <br>
  448.      *   - (array)    Complete article (when $implode is false)
  449.      *   - (string)    Complete article (when $implode is true)
  450.      *   - (object)    Pear_Error on failure
  451.      * @access public
  452.      * @see Net_NNTP_Client::getHeader()
  453.      * @see Net_NNTP_Client::getBody()
  454.      */
  455.     function getArticle($article = null$implode = false)
  456.     {
  457.         // v1.1.x API
  458.         if (is_string($implode)) {
  459.             trigger_error('You are using deprecated API v1.1 in Net_NNTP_Client: getHeader() !'E_USER_NOTICE);
  460.              
  461.             $class $implode;
  462.             $implode = false;
  463.  
  464.             if (!class_exists($class)) {
  465.                 return $this->throwError("Class '$class' does not exist!");
  466.         }
  467.         }
  468.  
  469.         $data $this->cmdArticle($article);
  470.         if (PEAR::isError($data)) {
  471.             return $data;
  472.         }
  473.  
  474.         if ($implode == true{
  475.             $data implode("\r\n"$data);
  476.         }
  477.  
  478.         // v1.1.x API
  479.         if (isset($class)) {
  480.             return $obj = new $class($data);
  481.         }
  482.  
  483.         //
  484.         return $data;
  485.     }
  486.  
  487.     // }}}
  488.     // {{{ getHeader()
  489.  
  490.     /**
  491.      * Fetch article header.
  492.      *
  493.      * Select an article based on the arguments, and return the article
  494.      * header (raw data).
  495.      *
  496.      * <b>Usage example:</b>
  497.      * {@example docs/examples/phpdoc/getHeader.php}
  498.      *
  499.      * @param mixed    $article    (optional) Either message-id or message
  500.      *                                   number of the article to fetch.
  501.      * @param bool    $implode    (optional) When true the result array
  502.      *                                   is imploded to a string, defaults to
  503.      *                                   false.
  504.      *
  505.      * @return mixed <br>
  506.      *   - (bool)    False if article does not exist
  507.      *   - (array)    Header fields (when $implode is false)
  508.      *   - (string)    Header fields (when $implode is true)
  509.      *   - (object)    Pear_Error on failure
  510.      * @access public
  511.      * @see Net_NNTP_Client::getArticle()
  512.      * @see Net_NNTP_Client::getBody()
  513.      */
  514.     function getHeader($article = null$implode = false)
  515.     {
  516.         // v1.1.x API
  517.         if (is_string($implode)) {
  518.             trigger_error('You are using deprecated API v1.1 in Net_NNTP_Client: getHeader() !'E_USER_NOTICE);
  519.              
  520.             $class $implode;
  521.             $implode = false;
  522.  
  523.             if (!class_exists($class)) {
  524.                 return $this->throwError("Class '$class' does not exist!");
  525.         }
  526.         }
  527.  
  528.         $data $this->cmdHead($article);
  529.         if (PEAR::isError($data)) {
  530.             return $data;
  531.         }
  532.  
  533.         if ($implode == true{
  534.             $data implode("\r\n"$data);
  535.         }
  536.  
  537.         // v1.1.x API
  538.         if (isset($class)) {
  539.             return $obj = new $class($data);
  540.         }
  541.  
  542.         //
  543.         return $data;
  544.     }
  545.  
  546.     // }}}
  547.     // {{{ getBody()
  548.  
  549.     /**
  550.      * Fetch article body.
  551.      *
  552.      * Select an article based on the arguments, and return the article
  553.      * body (raw data).
  554.      *
  555.      * <b>Usage example:</b>
  556.      * {@example docs/examples/phpdoc/getBody.php}
  557.      *
  558.      * @param mixed    $article    (optional) Either the message-id or the
  559.      *                                   message-number on the server of the
  560.      *                                   article to fetch.
  561.      * @param bool    $implode    (optional) When true the result array
  562.      *                                   is imploded to a string, defaults to
  563.      *                                   false.
  564.      *
  565.      * @return mixed <br>
  566.      *   - (array)    Message body (when $implode is false)
  567.      *   - (string)    Message body (when $implode is true)
  568.      *   - (object)    Pear_Error on failure
  569.      * @access public
  570.      * @see Net_NNTP_Client::getHeader()
  571.      * @see Net_NNTP_Client::getArticle()
  572.      */
  573.     function getBody($article = null$implode = false)
  574.     {
  575.         // v1.1.x API
  576.         if (is_string($implode)) {
  577.             trigger_error('You are using deprecated API v1.1 in Net_NNTP_Client: getHeader() !'E_USER_NOTICE);
  578.              
  579.             $class $implode;
  580.             $implode = false;
  581.  
  582.             if (!class_exists($class)) {
  583.                 return $this->throwError("Class '$class' does not exist!");
  584.         }
  585.         }
  586.  
  587.         $data $this->cmdBody($article);
  588.         if (PEAR::isError($data)) {
  589.             return $data;
  590.         }
  591.  
  592.         if ($implode == true{
  593.             $data implode("\r\n"$data);
  594.         }
  595.  
  596.         // v1.1.x API
  597.         if (isset($class)) {
  598.             return $obj = new $class($data);
  599.         }
  600.  
  601.         //
  602.         return $data;
  603.     }
  604.  
  605.     // }}}
  606.     // {{{ post()
  607.  
  608.     /**
  609.      * Post a raw article to a number of groups.
  610.      *
  611.      * <b>Usage example:</b>
  612.      * {@example docs/examples/phpdoc/post.php}
  613.      *
  614.      * @param mixed    $article    <br>
  615.      *   - (string) Complete article in a ready to send format (lines terminated by LFCR etc.)
  616.      *   - (array) First key is the article header, second key is article body - any further keys are ignored !!!
  617.      *   - (mixed) Something 'callable' (which must return otherwise acceptable data as replacement)
  618.      *
  619.      * @return mixed <br>
  620.      *   - (string)    Server response
  621.      *   - (object)    Pear_Error on failure
  622.      * @access public
  623.      * @ignore
  624.      */
  625.     function post($article)
  626.     {
  627.         // API v1.0
  628.         if (func_num_args(>= 4{
  629.  
  630.             // 
  631.             trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: post() !'E_USER_NOTICE);
  632.  
  633.             //
  634.             $groups func_get_arg(0);
  635.             $subject func_get_arg(1);
  636.             $body func_get_arg(2);
  637.             $from func_get_arg(3);
  638.             $additional func_get_arg(4);
  639.  
  640.             return $this->mail($groups$subject$body"From: $from\r\n" . $additional);
  641.         }
  642.  
  643.         // Only accept $article if array or string
  644.         if (!is_array($article&& !is_string($article)) {
  645.             return $this->throwError('Ups'null0);
  646.         }
  647.  
  648.         // 
  649.         $post $this->cmdPost();
  650.         if (PEAR::isError($post)) {
  651.             return $post;
  652.         }
  653.  
  654.         // 
  655.         if (is_callable($article)) {
  656.             $article call_user_func($article);
  657.         }
  658.  
  659.         // 
  660.         return $this->cmdPost2($article);
  661.     }
  662.  
  663.     // }}}
  664.     // {{{ mail()
  665.  
  666.     /**
  667.      * Post an article to a number of groups - using same parameters as PHP's mail() function.
  668.      *
  669.      * Among the aditional headers you might think of adding could be:
  670.      * "From: <author-email-address>", which should contain the e-mail address
  671.      * of the author of the article.
  672.      * Or "Organization: <org>" which contain the name of the organization
  673.      * the post originates from.
  674.      * Or "NNTP-Posting-Host: <ip-of-author>", which should contain the IP-address
  675.      * of the author of the post, so the message can be traced back to him.
  676.      *
  677.      * <b>Usage example:</b>
  678.      * {@example docs/examples/phpdoc/mail.php}
  679.      *
  680.      * @param string    $groups    The groups to post to.
  681.      * @param string    $subject    The subject of the article.
  682.      * @param string    $body    The body of the article.
  683.      * @param string    $additional    (optional) Additional header fields to send.
  684.      *
  685.      * @return mixed <br>
  686.      *   - (string)    Server response
  687.      *   - (object)    Pear_Error on failure
  688.      * @access public
  689.      */
  690.     function mail($groups$subject$body$additional = null)
  691.     {
  692.         //
  693.         $header  = "Newsgroups: $groups\r\n";
  694.         $header .= "Subject: $subject\r\n";
  695.         $header .= "X-poster: PEAR::Net_NNTP v1.3.2 (beta)\r\n";
  696.         if ($additional !== null{
  697.             $header .= $additional;
  698.         }
  699.  
  700.         return $this->cmdPost(array($header$body));
  701.     }
  702.  
  703.     // }}}
  704.     // {{{ getDate()
  705.  
  706.     /**
  707.      * Get the server's internal date
  708.      *
  709.      * <b>Non-standard!</b><br>
  710.      * This method uses non-standard commands, which is not part
  711.      * of the original RFC977, but has been formalized in RFC2890.
  712.      *
  713.      * <b>Usage example:</b>
  714.      * {@example docs/examples/phpdoc/getDate.php}
  715.      *
  716.      * @param int    $format    (optional) Determines the format of returned date:
  717.      *                            - 0: return string
  718.      *                            - 1: return integer/timestamp
  719.      *                            - 2: return an array('y'=>year, 'm'=>month,'d'=>day)
  720.      *
  721.      * @return mixed <br>
  722.      *   - (mixed)
  723.      *   - (object)    Pear_Error on failure
  724.      * @access public
  725.      */
  726.     function getDate($format = 1)
  727.     {
  728.         $date $this->cmdDate();
  729.         if (PEAR::isError($date)) {
  730.             return $date;
  731.         }
  732.  
  733.         switch ($format{
  734.             case 0:
  735.                 return $date;
  736.                 break;
  737.             case 1:
  738.             return strtotime(substr($date08).' '.substr($date82).':'.substr($date102).':'.substr($date122));
  739.                 break;
  740.             case 2:
  741.                 return array('y' => substr($date04),
  742.                              'm' => substr($date42),
  743.                              'd' => substr($date62));
  744.                 break;
  745.             default:
  746.         error();
  747.         }
  748.     }
  749.  
  750.     // }}}
  751.     // {{{ getNewGroups()
  752.  
  753.     /**
  754.      * Get new groups since a date.
  755.      *
  756.      * Returns a list of groups created on the server since the specified date
  757.      * and time.
  758.      *
  759.      * <b>Usage example:</b>
  760.      * {@example docs/examples/phpdoc/getNewGroups.php}
  761.      *
  762.      * @param mixed    $time    <br>
  763.      *   - (integer)    A timestamp
  764.      *   - (string)    Somthing parseable by strtotime() like '-1 week'
  765.      * @param string    $distributions    (optional)
  766.      *
  767.      * @return mixed <br>
  768.      *   - (array)
  769.      *   - (object)    Pear_Error on failure
  770.      * @access public
  771.      */
  772.     function getNewGroups($time$distributions = null)
  773.     {
  774.         switch (true{
  775.             case is_integer($time):
  776.                 break;
  777.             case is_string($time):
  778.                 $time strtotime($time);
  779.                 if ($time === false || ($time === -1 && version_compare(php_version()'5.1.0''<'))) {
  780.                     return $this->throwError('$time could not be converted into a timestamp!'null0);
  781.                 }
  782.                 break;
  783.             default:
  784.                 trigger_error('$time must be either a string or an integer/timestamp!'E_USER_ERROR);
  785.         }
  786.  
  787.         return $this->cmdNewgroups($time$distributions);
  788.     }
  789.  
  790.     // }}}
  791.     // {{{ getNewArticles()
  792.  
  793.     /**
  794.      * Get new articles since a date.
  795.      *
  796.      * Returns a list of message-ids of new articles (since the specified date
  797.      * and time) in the groups whose names match the wildmat
  798.      *
  799.      * <b>Usage example:</b>
  800.      * {@example docs/examples/phpdoc/getNewArticles.php}
  801.      *
  802.      * @param mixed    $time    <br>
  803.      *   - (integer)    A timestamp
  804.      *   - (string)    Somthing parseable by strtotime() like '-1 week'
  805.      * @param string    $groups    (optional)
  806.      * @param string    $distributions    (optional)
  807.      *
  808.      * @return mixed <br>
  809.      *   - (array)
  810.      *   - (object)    Pear_Error on failure
  811.      * @access public
  812.      * @since 1.3.0
  813.      */
  814.     function getNewArticles($time$groups '*'$distribution = null)
  815.     {
  816.         switch (true{
  817.             case is_integer($time):
  818.                 break;
  819.             case is_string($time):
  820.                 $time strtotime($time);
  821.                 if ($time === false || ($time === -1 && version_compare(php_version()'5.1.0''<'))) {
  822.                     return $this->throwError('$time could not be converted into a timestamp!'null0);
  823.         }
  824.                 break;
  825.             default:
  826.                 trigger_error('$time must be either a string or an integer/timestamp!'E_USER_ERROR);
  827.         }
  828.  
  829.         return $this->cmdNewnews($time$groups$distribution);
  830.     }
  831.  
  832.     // }}}
  833.     // {{{ getGroups()
  834.  
  835.     /**
  836.      * Fetch valid groups.
  837.      *
  838.      * Returns a list of valid groups (that the client is permitted to select)
  839.      * and associated information.
  840.      *
  841.      * <b>Usage example:</b>
  842.      * {@example docs/examples/phpdoc/getGroups.php}
  843.      *
  844.      * @return mixed <br>
  845.      *   - (array)    Nested array with information about every valid group
  846.      *   - (object)    Pear_Error on failure
  847.      * @access public
  848.      * @see Net_NNTP_Client::getDescriptions()
  849.      * @see Net_NNTP_Client::selectGroup()
  850.      */
  851.     function getGroups($wildmat = null)
  852.     {
  853.         $backup = false;
  854.  
  855.         // Get groups
  856.         $groups $this->cmdListActive($wildmat);
  857.         if (PEAR::isError($groups)) {
  858.             switch ($groups->getCode()) {
  859.                 case 500:
  860.                 case 501:
  861.                     $backup = true;
  862.             break;
  863.             default:
  864.                     return $groups;
  865.             }
  866.         }
  867.  
  868.         // 
  869.         if ($backup == true{
  870.  
  871.             // 
  872.             if (!is_null($wildmat)) {
  873.                 return $this->throwError("The server does not support the 'LIST ACTIVE' command, and the 'LIST' command does not support the wildmat parameter!"nullnull);
  874.             }
  875.         
  876.             // 
  877.             $groups2 $this->cmdList();
  878.             if (PEAR::isError($groups2)) {
  879.             // Ignore...
  880.             else {
  881.                 $groups $groups2;
  882.             }
  883.     }
  884.  
  885.         if (PEAR::isError($groups)) {
  886.             return $groups;
  887.         }
  888.  
  889.         return $groups;
  890.     }
  891.  
  892.     // }}}
  893.     // {{{ getDescriptions()
  894.  
  895.     /**
  896.      * Fetch all known group descriptions.
  897.      *
  898.      * Fetches a list of known group descriptions - including groups which
  899.      * the client is not permitted to select.
  900.      *
  901.      * <b>Non-standard!</b><br>
  902.      * This method uses non-standard commands, which is not part
  903.      * of the original RFC977, but has been formalized in RFC2890.
  904.      *
  905.      * <b>Usage example:</b>
  906.      * {@example docs/examples/phpdoc/getDescriptions.php}
  907.      *
  908.      * @param mixed    $wildmat    (optional)
  909.      *
  910.      * @return mixed <br>
  911.      *   - (array)    Associated array with descriptions of known groups
  912.      *   - (object)    Pear_Error on failure
  913.      * @access public
  914.      * @see Net_NNTP_Client::getGroups()
  915.      */
  916.     function getDescriptions($wildmat = null)
  917.     {
  918.         if (is_array($wildmat)) {
  919.         $wildmat implode(','$wildmat);
  920.         }
  921.  
  922.         // Get group descriptions
  923.         $descriptions $this->cmdListNewsgroups($wildmat);
  924.         if (PEAR::isError($descriptions)) {
  925.             return $descriptions;
  926.         }
  927.  
  928.         // TODO: add xgtitle as backup
  929.     
  930.         return $descriptions;
  931.     }
  932.  
  933.     // }}}
  934.     // {{{ getOverview()
  935.  
  936.     /**
  937.      * Fetch an overview of article(s) in the currently selected group.
  938.      *
  939.      * Returns the contents of all the fields in the database for a number
  940.      * of articles specified by either article-numnber range, a message-id,
  941.      * or nothing (indicating currently selected article).
  942.      *
  943.      * The first 8 fields per article is always as follows:
  944.      *   - 'Number' - '0' or the article number of the currently selected group.
  945.      *   - 'Subject' - header content.
  946.      *   - 'From' - header content.
  947.      *   - 'Date' - header content.
  948.      *   - 'Message-ID' - header content.
  949.      *   - 'References' - header content.
  950.      *   - ':bytes' - metadata item.
  951.      *   - ':lines' - metadata item.
  952.      *
  953.      * The server may send more fields form it's database...
  954.      *
  955.      * <b>Non-standard!</b><br>
  956.      * This method uses non-standard commands, which is not part
  957.      * of the original RFC977, but has been formalized in RFC2890.
  958.      *
  959.      * <b>Usage example:</b>
  960.      * {@example docs/examples/phpdoc/getOverview.php}
  961.      *
  962.      * @param mixed    $range    (optional)
  963.      *                           - '<message number>'
  964.      *                           - '<message number>-<message number>'
  965.      *                           - '<message number>-'
  966.      *                           - '<message-id>'
  967.      * @param boolean    $_names    (optional) experimental parameter! Use field names as array kays
  968.      * @param boolean    $_forceNames    (optional) experimental parameter!
  969.      *
  970.      * @return mixed <br>
  971.      *   - (array)    Nested array of article overview data
  972.      *   - (object)    Pear_Error on failure
  973.      * @access public
  974.      * @see Net_NNTP_Client::getHeaderField()
  975.      * @see Net_NNTP_Client::getOverviewFormat()
  976.      */
  977.     function getOverview($range = null$_names = true$_forceNames = true)
  978.     {
  979.         // API v1.0
  980.         switch (true{
  981.         // API v1.3
  982.         case func_num_args(!= 2:
  983.         case is_bool(func_get_arg(1)):
  984.         case !is_int(func_get_arg(1)) || (is_string(func_get_arg(1)) && ctype_digit(func_get_arg(1))):
  985.         case !is_int(func_get_arg(0)) || (is_string(func_get_arg(0)) && ctype_digit(func_get_arg(0))):
  986.         break;
  987.  
  988.         default:
  989.                 // 
  990.                 trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: getOverview() !'E_USER_NOTICE);
  991.  
  992.                 // Fetch overview via API v1.3
  993.                 $overview $this->getOverview(func_get_arg(0'-' func_get_arg(1)truefalse);
  994.                 if (PEAR::isError($overview)) {
  995.                     return $overview;
  996.                 }
  997.  
  998.                 // Create and return API v1.0 compliant array
  999.                 $articles = array();
  1000.                 foreach ($overview as $article{
  1001.  
  1002.                     // Rename 'Number' field into 'number'
  1003.                     $article array_merge(array('number' => array_shift($article))$article);
  1004.         
  1005.                     // Use 'Message-ID' field as key
  1006.                     $articles[$article['Message-ID']] $article;
  1007.                 }
  1008.                 return $articles;
  1009.         }
  1010.  
  1011.         // Fetch overview from server
  1012.         $overview $this->cmdXOver($range);
  1013.         if (PEAR::isError($overview)) {
  1014.             return $overview;
  1015.         }
  1016.  
  1017.         // Use field names from overview format as keys?
  1018.         if ($_names{
  1019.  
  1020.             // Already cached?
  1021.             if (is_null($this->_overviewFormatCache)) {
  1022.                 // Fetch overview format
  1023.                 $format $this->getOverviewFormat($forceNamestrue);
  1024.                 if (PEAR::isError($format)){
  1025.                     return $format;
  1026.                 }
  1027.  
  1028.                 // Prepend 'Number' field
  1029.                 $format array_merge(array('Number' => false)$format);
  1030.  
  1031.                 // Cache format
  1032.                 $this->_overviewFormatCache $format;
  1033.  
  1034.             // 
  1035.             else {
  1036.                 $format $this->_overviewFormatCache;
  1037.             }
  1038.  
  1039.             // Loop through all articles
  1040.             foreach ($overview as $key => $article{
  1041.  
  1042.                 // Copy $format
  1043.                 $f $format;
  1044.  
  1045.                 // Field counter
  1046.                 $i = 0;
  1047.         
  1048.         // Loop through forld names in format
  1049.                 foreach ($f as $tag => $full{
  1050.  
  1051.                     //
  1052.                     $f[$tag$article[$i++];
  1053.  
  1054.                     // If prefixed by field name, remove it
  1055.                     if ($full === true{
  1056.                     $f[$tagltrimsubstr($f[$tag]strpos($f[$tag]':'+ 1)" \t");
  1057.                     }
  1058.                 }
  1059.  
  1060.                 // Replace article 
  1061.             $overview[$key$f;
  1062.             }
  1063.         }
  1064.  
  1065.         //
  1066.         switch (true{
  1067.  
  1068.             // Expect one article
  1069.             case is_null($range);
  1070.             case is_int($range);
  1071.             case is_string($range&& ctype_digit($range):
  1072.             case is_string($range&& substr($range01== '<' && substr($range-11== '>':
  1073.                 if (count($overview== 0{
  1074.                     return false;
  1075.                 else {
  1076.                     return reset($overview);
  1077.                 }
  1078.                 break;
  1079.  
  1080.             // Expect multiple articles
  1081.             default:
  1082.                 return $overview;
  1083.         }
  1084.     }
  1085.  
  1086.     // }}}
  1087.     // {{{ getOverviewFormat()
  1088.  
  1089.     /**
  1090.      * Fetch names of fields in overview database
  1091.      *
  1092.      * Returns a description of the fields in the database for which it is consistent.
  1093.      *
  1094.      * <b>Non-standard!</b><br>
  1095.      * This method uses non-standard commands, which is not part
  1096.      * of the original RFC977, but has been formalized in RFC2890.
  1097.      *
  1098.      * <b>Usage example:</b>
  1099.      * {@example docs/examples/phpdoc/getOveriewFormat.php}
  1100.      *
  1101.      * @return mixed <br>
  1102.      *   - (array)    Overview field names
  1103.      *   - (object)    Pear_Error on failure
  1104.      * @access public
  1105.      * @see Net_NNTP_Client::getOverview()
  1106.      */
  1107.     function getOverviewFormat($_forceNames = true$_full = false)
  1108.     {
  1109.         $format $this->cmdListOverviewFmt();
  1110.         if (PEAR::isError($format)) {
  1111.             return $format;
  1112.         }
  1113.  
  1114.         // Force name of first seven fields
  1115.         if ($_forceNames{
  1116.             array_splice($format07);
  1117.             $format array_merge(array('Subject'    => false,
  1118.                                         'From'       => false,
  1119.                                         'Date'       => false,
  1120.                                         'Message-ID' => false,
  1121.                                         'References' => false,
  1122.                                         ':bytes'     => false,
  1123.                                         ':lines'     => false)$format);
  1124.         }
  1125.  
  1126.         if ($_full{
  1127.             return $format;
  1128.         else {
  1129.             return array_keys($format);
  1130.         }
  1131.     }
  1132.  
  1133.     // }}}
  1134.     // {{{ getHeaderField()
  1135.  
  1136.     /**
  1137.      * Fetch content of a header field from message(s).
  1138.      *
  1139.      * Retreives the content of specific header field from a number of messages.
  1140.      *
  1141.      * <b>Non-standard!</b><br>
  1142.      * This method uses non-standard commands, which is not part
  1143.      * of the original RFC977, but has been formalized in RFC2890.
  1144.      *
  1145.      * <b>Usage example:</b>
  1146.      * {@example docs/examples/phpdoc/getHeaderField.php}
  1147.      *
  1148.      * @param string    $field    The name of the header field to retreive
  1149.      * @param mixed    $range    (optional)
  1150.      *                             '<message number>'
  1151.      *                             '<message number>-<message number>'
  1152.      *                             '<message number>-'
  1153.      *                             '<message-id>'
  1154.      *
  1155.      * @return mixed <br>
  1156.      *   - (array)    Nested array of
  1157.      *   - (object)    Pear_Error on failure
  1158.      * @access public
  1159.      * @see Net_NNTP_Client::getOverview()
  1160.      * @see Net_NNTP_Client::getReferences()
  1161.      */
  1162.     function getHeaderField($field$range = null)
  1163.     {
  1164.         $fields $this->cmdXHdr($field$range);
  1165.         if (PEAR::isError($fields)) {
  1166.             return $fields;
  1167.         }
  1168.  
  1169.         //
  1170.         switch (true{
  1171.  
  1172.             // Expect one article
  1173.             case is_null($range);
  1174.             case is_int($range);
  1175.             case is_string($range&& ctype_digit($range):
  1176.             case is_string($range&& substr($range01== '<' && substr($range-11== '>':
  1177.  
  1178.                 if (count($fields== 0{
  1179.                     return false;
  1180.                 else {
  1181.                     return reset($fields);
  1182.                 }
  1183.                 break;
  1184.  
  1185.             // Expect multiple articles
  1186.             default:
  1187.                 return $fields;
  1188.         }
  1189.     }
  1190.  
  1191.     // }}}
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.     // {{{ getGroupArticles()
  1200.  
  1201.     /**
  1202.      *
  1203.      *
  1204.      * <b>Non-standard!</b><br>
  1205.      * This method uses non-standard commands, which is not part
  1206.      * of the original RFC977, but has been formalized in RFC2890.
  1207.      *
  1208.      * <b>Usage example:</b>
  1209.      * {@example docs/examples/phpdoc/getGroupArticles.php}
  1210.      *
  1211.      * @param mixed    $range    (optional) Experimental!
  1212.      *
  1213.      * @return mixed <br>
  1214.      *   - (array)
  1215.      *   - (object)    Pear_Error on failure
  1216.      * @access public
  1217.      * @since 1.3.0
  1218.      */
  1219.     function getGroupArticles($range = null)
  1220.     {
  1221.         $summary $this->cmdListgroup();
  1222.         if (PEAR::isError($summary)) {
  1223.             return $summary;
  1224.         }
  1225.  
  1226.         // Update summary cache if group was also 'selected'
  1227.         if ($summary['group'!== null{
  1228.             $this->_selectedGroupSummary($summary);
  1229.         }
  1230.     
  1231.         //
  1232.         return $summary['articles'];
  1233.     }
  1234.  
  1235.     // }}}
  1236.     // {{{ getReferences()
  1237.  
  1238.     /**
  1239.      * Fetch reference header field of message(s).
  1240.      *
  1241.      * Retrieves the content of the references header field of messages via
  1242.      * either the XHDR ord the XROVER command.
  1243.      *
  1244.      * Identical to getHeaderField('References').
  1245.      *
  1246.      * <b>Non-standard!</b><br>
  1247.      * This method uses non-standard commands, which is not part
  1248.      * of the original RFC977, but has been formalized in RFC2890.
  1249.      *
  1250.      * <b>Usage example:</b>
  1251.      * {@example docs/examples/phpdoc/getReferences.php}
  1252.      *
  1253.      * @param mixed    $range    (optional)
  1254.      *                             '<message number>'
  1255.      *                             '<message number>-<message number>'
  1256.      *                             '<message number>-'
  1257.      *                             '<message-id>'
  1258.      *
  1259.      * @return mixed <br>
  1260.      *   - (array)    Nested array of references
  1261.      *   - (object)    Pear_Error on failure
  1262.      * @access public
  1263.      * @see Net_NNTP_Client::getHeaderField()
  1264.      */
  1265.     function getReferences($range = null)
  1266.     {
  1267.         $backup = false;
  1268.  
  1269.         $references $this->cmdXHdr('References'$range);
  1270.         if (PEAR::isError($references)) {
  1271.             switch ($references->getCode()) {
  1272.                 case 500:
  1273.                 case 501:
  1274.                     $backup = true;
  1275.             break;
  1276.             default:
  1277.                     return $references;
  1278.             }
  1279.         }
  1280.  
  1281.         if (true && (is_array($references&& count($references== 0)) {
  1282.             $backup = true;
  1283.         }
  1284.  
  1285.         if ($backup == true{
  1286.             $references2 $this->cmdXROver($range);
  1287.             if (PEAR::isError($references2)) {
  1288.             // Ignore...
  1289.             else {
  1290.                 $references $references2;
  1291.             }
  1292.     }
  1293.  
  1294.         if (PEAR::isError($references)) {
  1295.             return $references;
  1296.         }
  1297.  
  1298.         if (is_array($references)) {
  1299.             foreach ($references as $key => $val{
  1300.                 $references[$keypreg_split("/ +/"trim($val)-1PREG_SPLIT_NO_EMPTY);
  1301.             }
  1302.     }
  1303.  
  1304.         //
  1305.         switch (true{
  1306.  
  1307.             // Expect one article
  1308.             case is_null($range);
  1309.             case is_int($range);
  1310.             case is_string($range&& ctype_digit($range):
  1311.             case is_string($range&& substr($range01== '<' && substr($range-11== '>':
  1312.                 if (count($references== 0{
  1313.                     return false;
  1314.                 else {
  1315.                     return reset($references);
  1316.                 }
  1317.                 break;
  1318.  
  1319.             // Expect multiple articles
  1320.             default:
  1321.                 return $references;
  1322.         }
  1323.     }
  1324.  
  1325.     // }}}
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.     // {{{ count()
  1332.  
  1333.     /**
  1334.      * Number of articles in currently selected group
  1335.      *
  1336.      * <b>Usage example:</b>
  1337.      * {@example docs/examples/phpdoc/count.php}
  1338.      *
  1339.      * @return mixed <br>
  1340.      *   - (integer)    the number of article in group
  1341.      *   - (object)    Pear_Error on failure
  1342.      * @access public
  1343.      * @see Net_NNTP_Client::group()
  1344.      * @see Net_NNTP_Client::first()
  1345.      * @see Net_NNTP_Client::last()
  1346.      * @see Net_NNTP_Client::selectGroup()
  1347.      * @ignore
  1348.      */
  1349.     function count()
  1350.     {
  1351.         return $this->_selectedGroupSummary['count'];
  1352.     }
  1353.  
  1354.     // }}}
  1355.     // {{{ last()
  1356.  
  1357.     /**
  1358.      * Maximum article number in currently selected group
  1359.      *
  1360.      * <b>Usage example:</b>
  1361.      * {@example docs/examples/phpdoc/last.php}
  1362.      *
  1363.      * @return mixed <br>
  1364.      *   - (integer)    the last article's number
  1365.      *   - (object)    Pear_Error on failure
  1366.      * @access public
  1367.      * @see Net_NNTP_Client::first()
  1368.      * @see Net_NNTP_Client::group()
  1369.      * @see Net_NNTP_Client::count()
  1370.      * @see Net_NNTP_Client::selectGroup()
  1371.      * @ignore
  1372.      */
  1373.     function last()
  1374.     {
  1375.         return $this->_selectedGroupSummary['last'];
  1376.     }
  1377.  
  1378.     // }}}
  1379.     // {{{ first()
  1380.  
  1381.     /**
  1382.      * Minimum article number in currently selected group
  1383.      *
  1384.      * <b>Usage example:</b>
  1385.      * {@example docs/examples/phpdoc/first.php}
  1386.      *
  1387.      * @return mixed <br>
  1388.      *   - (integer)    the first article's number
  1389.      *   - (object)    Pear_Error on failure
  1390.      * @access public
  1391.      * @see Net_NNTP_Client::last()
  1392.      * @see Net_NNTP_Client::group()
  1393.      * @see Net_NNTP_Client::count()
  1394.      * @see Net_NNTP_Client::selectGroup()
  1395.      * @ignore
  1396.      */
  1397.     function first()
  1398.     {
  1399.         return $this->_selectedGroupSummary['first'];
  1400.     }
  1401.  
  1402.     // }}}
  1403.     // {{{ group()
  1404.  
  1405.     /**
  1406.      * Currently selected group
  1407.      *
  1408.      * <b>Usage example:</b>
  1409.      * {@example docs/examples/phpdoc/group.php}
  1410.      *
  1411.      * @return mixed <br>
  1412.      *   - (string)    group name
  1413.      *   - (object)    Pear_Error on failure
  1414.      * @access public
  1415.      * @see Net_NNTP_Client::first()
  1416.      * @see Net_NNTP_Client::last()
  1417.      * @see Net_NNTP_Client::count()
  1418.      * @see Net_NNTP_Client::selectGroup()
  1419.      * @ignore
  1420.      */
  1421.     function group()
  1422.     {
  1423.         return $this->_selectedGroupSummary['group'];
  1424.     }
  1425.  
  1426.     // }}}
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.     // {{{ isConnected()
  1435.  
  1436.     /**
  1437.      * Test whether a connection is currently open or closed.
  1438.      *
  1439.      * @return bool    True if connected, otherwise false
  1440.      * @access public
  1441.      * @see Net_NNTP_Client::connect()
  1442.      * @see Net_NNTP_Client::quit()
  1443.      * @deprecated    since v1.3.0 due to use of protected method: Net_NNTP_Protocol_Client::isConnected()
  1444.      * @ignore
  1445.      */
  1446.     function isConnected()
  1447.     {
  1448.     trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: isConnected() !'E_USER_NOTICE);
  1449.         return parent::_isConnected();
  1450.     }
  1451.  
  1452.     // }}}
  1453.     // {{{ getArticleRaw()
  1454.  
  1455.     /**
  1456.      * Deprecated alias for getArticle()
  1457.      *
  1458.      * @deprecated
  1459.      * @ignore
  1460.      */
  1461.     function getArticleRaw($article$implode = false)
  1462.     {
  1463.         trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: getArticleRaw() !'E_USER_NOTICE);
  1464.         return $this->getArticle($article$implode);
  1465.     }
  1466.  
  1467.     // }}}
  1468.     // {{{ getHeaderRaw()
  1469.  
  1470.     /**
  1471.      * Deprecated alias for getHeader()
  1472.      *
  1473.      * @deprecated
  1474.      * @ignore
  1475.      */
  1476.     function getHeaderRaw($article = null$implode = false)
  1477.     {
  1478.         trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: getHeaderRaw() !'E_USER_NOTICE);
  1479.         return $this->getHeader($article$implode);
  1480.     }
  1481.  
  1482.     // }}}
  1483.     // {{{ getBodyRaw()
  1484.  
  1485.     /**
  1486.      * Deprecated alias for getBody()
  1487.      *
  1488.      * @deprecated
  1489.      * @ignore
  1490.      */
  1491.     function getBodyRaw($article = null$implode = false)
  1492.     {
  1493.         trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: getBodyRaw() !'E_USER_NOTICE);
  1494.         return $this->getBody($article$implode);
  1495.     }
  1496.  
  1497.     // }}}
  1498.     // {{{ getNewNews()
  1499.  
  1500.     /**
  1501.      * Deprecated alias for getNewArticles()
  1502.      *
  1503.      * @deprecated
  1504.      * @ignore
  1505.      */
  1506.     function getNewNews($time$groups '*'$distribution = null)
  1507.     {
  1508.         trigger_error('You are using deprecated API v1.1 in Net_NNTP_Client: getNewNews() !'E_USER_NOTICE);
  1509.         return $this->getNewArticles($time$groups$distribution);
  1510.     }
  1511.  
  1512.     // }}}
  1513.     // {{{ getReferencesOverview()
  1514.  
  1515.     /**
  1516.      * Deprecated alias for getReferences()
  1517.      *
  1518.      * @deprecated
  1519.      * @ignore
  1520.      */
  1521.     function getReferencesOverview($first$last)
  1522.     {
  1523.     trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: getReferencesOverview() !'E_USER_NOTICE);
  1524.         return $this->getReferences($first '-' $last);
  1525.     }
  1526.  
  1527.     // }}}
  1528.  
  1529. }
  1530.  
  1531. // }}}
  1532.  
  1533. /*
  1534.  * Local variables:
  1535.  * tab-width: 4
  1536.  * c-basic-offset: 4
  1537.  * c-hanging-comment-ender-p: nil
  1538.  * End:
  1539.  */
  1540.  
  1541. ?>

Documentation generated on Mon, 11 Mar 2019 14:32:03 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.