[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/SyncML/Command/ -> Status.php (source)

   1  <?php
   2  
   3  require_once  'SyncML/Command.php';
   4  require_once 'SyncML/Constants.php';
   5  
   6  /**
   7   * $Horde: framework/SyncML/SyncML/Command/Status.php,v 1.15.10.6 2006/01/31 17:55:19 jan Exp $
   8   *
   9   * Copyright 2003-2006 Anthony Mills <amills@pyramid6.com>
  10   *
  11   * See the enclosed file COPYING for license information (LGPL). If you
  12   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  13   *
  14   * @author  Anthony Mills <amills@pyramid6.com>
  15   * @since   Horde 3.0
  16   * @package SyncML
  17   */
  18  class SyncML_Command_Status extends SyncML_Command {
  19  
  20      var $_response;
  21  
  22      var $_cmdRef;
  23  
  24      /**
  25       * Must be present.
  26       */
  27      var $_cmd;
  28  
  29      var $_sourceRef;
  30  
  31      var $_targetRef;
  32  
  33      var $_chalMetaFormat;
  34  
  35      var $_chalMetaType;
  36  
  37      var $_chalMetaNextNonce;
  38  
  39      var $_itemDataAnchorNext;
  40  
  41      var $_itemDataAnchorLast;
  42  
  43      function SyncML_Command_Status($response = null, $cmd = null)
  44      {
  45          if ($response != null) {
  46              $this->_response = $response;
  47          }
  48  
  49          if ($cmd != null) {
  50              $this->_cmd = $cmd;
  51          }
  52      }
  53  
  54      function output($currentCmdID, &$output)
  55      {
  56          $attrs = array();
  57  
  58          $state = &$_SESSION['SyncML.state'];
  59  
  60          if ($this->_cmd != null) {
  61              $attrs = array();
  62              $output->startElement($state->getURI(), 'Status', $attrs);
  63  
  64              $output->startElement($state->getURI(), 'CmdID', $attrs);
  65              $chars = $currentCmdID;
  66              $output->characters($chars);
  67              $output->endElement($state->getURI(), 'CmdID');
  68  
  69              $output->startElement($state->getURI(), 'MsgRef', $attrs);
  70              $chars = $state->getMsgID();
  71              $output->characters($chars);
  72              $output->endElement($state->getURI(), 'MsgRef');
  73  
  74              $output->startElement($state->getURI(), 'CmdRef', $attrs);
  75              $chars = $this->_cmdRef;
  76              $output->characters($chars);
  77              $output->endElement($state->getURI(), 'CmdRef');
  78  
  79              $output->startElement($state->getURI(), 'Cmd', $attrs);
  80              $chars = $this->_cmd;
  81              $output->characters($chars);
  82              $output->endElement($state->getURI(), 'Cmd');
  83  
  84              if (isset($this->_targetRef)) {
  85                  $output->startElement($state->getURI(), 'TargetRef', $attrs);
  86                  $chars = $this->_targetRef;
  87                  $output->characters($chars);
  88                  $output->endElement($state->getURI(), 'TargetRef');
  89              }
  90  
  91              if (isset($this->_sourceRef)) {
  92                  $output->startElement($state->getURI(), 'SourceRef', $attrs);
  93                  $chars = $this->_sourceRef;
  94                  $output->characters($chars);
  95                  $output->endElement($state->getURI(), 'SourceRef');
  96              }
  97  
  98              // If we are responding to the SyncHdr and we are not
  99              // authorized then request basic authorization.
 100              //
 101              // FIXME: Right now we always send this, ignoring the
 102              // isAuthorized() test. Is that correct?
 103              if ($this->_cmd == 'SyncHdr' && !$state->isAuthorized()) {
 104                  $this->_chalMetaFormat = 'b64';
 105                  $this->_chalMetaType = 'syncml:auth-basic';
 106                  $this->_response = RESPONSE_CREDENTIALS_MISSING;
 107              }
 108  
 109              if (isset($this->_chalMetaFormat) && isset($this->_chalMetaType)) {
 110                  $output->startElement($state->getURI(), 'Chal', $attrs);
 111                  $output->startElement($state->getURI(), 'Meta', $attrs);
 112  
 113                  $metainfuri = $state->getURIMeta();
 114  
 115                  $output->startElement($metainfuri, 'Type', $attrs);
 116                  $chars = $this->_chalMetaType;
 117                  $output->characters($chars);
 118                  $output->endElement($metainfuri, 'Type');
 119  
 120                  $output->startElement($metainfuri, 'Format', $attrs);
 121                  $chars = $this->_chalMetaFormat;
 122                  $output->characters($chars);
 123                  $output->endElement($metainfuri, 'Format');
 124  
 125                  $output->endElement($state->getURI(), 'Meta');
 126                  $output->endElement($state->getURI(), 'Chal');
 127              }
 128  
 129              $output->startElement($state->getURI(), 'Data', $attrs);
 130              $chars = $this->_response;
 131              $output->characters($chars);
 132              $output->endElement($state->getURI(), 'Data');
 133  
 134              if (isset($this->_itemDataAnchorNext) || isset($this->_itemDataAnchorLast)) {
 135                  $output->startElement($state->getURI(), 'Item', $attrs);
 136                  $output->startElement($state->getURI(), 'Data', $attrs);
 137  
 138                  $metainfuri = $state->getURIMeta();
 139                  $output->startElement($metainfuri, 'Anchor', $attrs);
 140  
 141                  if (isset($this->_itemDataAnchorLast)) {
 142  
 143                    $output->startElement($metainfuri, 'Last', $attrs);
 144                    $chars = $this->_itemDataAnchorLast;
 145                    $output->characters($chars);
 146                    $output->endElement($metainfuri, 'Last');
 147                  }
 148  
 149                  if (isset($this->_itemDataAnchorNext)) {
 150  
 151                    $output->startElement($metainfuri, 'Next', $attrs);
 152                    $chars = $this->_itemDataAnchorNext;
 153                    $output->characters($chars);
 154                    $output->endElement($metainfuri, 'Next');
 155                  }
 156  
 157                  $output->endElement($metainfuri, 'Anchor');
 158  
 159                  $output->endElement($state->getURI(), 'Data');
 160                  $output->endElement($state->getURI(), 'Item');
 161              }
 162  
 163              $output->endElement($state->getURI(), 'Status');
 164  
 165              $currentCmdID++;
 166          }
 167  
 168          return $currentCmdID;
 169      }
 170  
 171      /**
 172       * Setter for property response.
 173       *
 174       * @param string $response  New value of property response.
 175       */
 176      function setResponse($response)
 177      {
 178          $this->_response = $response;
 179      }
 180  
 181      /**
 182       * Setter for property cmd.
 183       *
 184       * @param string $cmd  New value of property cmd.
 185       */
 186      function setCmd($cmd)
 187      {
 188          $this->_cmd = $cmd;
 189      }
 190  
 191      /**
 192       * Setter for property cmdRef.
 193       *
 194       * @param string $cmdRef  New value of property cmdRef.
 195       */
 196      function setCmdRef($cmdRef)
 197      {
 198          $this->_cmdRef = $cmdRef;
 199      }
 200  
 201      /**
 202       * Setter for property sourceRef.
 203       *
 204       * @param string $sourceRef  New value of property sourceRef.
 205       */
 206      function setSourceRef($sourceRef)
 207      {
 208          $this->_sourceRef = $sourceRef;
 209      }
 210  
 211      /**
 212       * Setter for property targetRef.
 213       *
 214       * @param string $targetRef  New value of property targetRef.
 215       */
 216      function setTargetRef($targetRef)
 217      {
 218          $this->_targetRef = $targetRef;
 219      }
 220  
 221      /**
 222       * Setter for property itemDataAnchorNext.
 223       *
 224       * @param string $itemDataAnchorNext  New value of property itemDataAnchorNext.
 225       */
 226      function setItemDataAnchorNext($itemDataAnchorNext)
 227      {
 228          $this->_itemDataAnchorNext = $itemDataAnchorNext;
 229      }
 230  
 231      /**
 232       * Setter for property itemDataAnchorLast.
 233       *
 234       * @param string $itemDataAnchorLast  New value of property itemDataAnchorLast.
 235       */
 236      function setItemDataAnchorLast($itemDataAnchorLast)
 237      {
 238          $this->_itemDataAnchorLast = $itemDataAnchorLast;
 239      }
 240  
 241  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7