original_string: function ls($path) {
  
          if (trim($path) == '') {
              $this->_error_log('Missing a path in method ls');
              return false;
          }
          $this->_path = $this->translate_uri($path);
  
          $this->header_unset();
          $this->create_basic_request('PROPFIND');
          $this->header_add('Depth: 1');
          $this->header_add('Content-type: application/xml');
          // create profind xml request...
          $xml  = <<<EOD
  <?xml version="1.0" encoding="utf-8"?>
  <propfind xmlns="DAV:"><prop>
  <getcontentlength xmlns="DAV:"/>
  <getlastmodified xmlns="DAV:"/>
  <executable xmlns="http://apache.org/dav/props/"/>
  <resourcetype xmlns="DAV:"/>
  <checked-in xmlns="DAV:"/>
  <checked-out xmlns="DAV:"/>
  </prop></propfind>
  EOD;
          $this->header_add('Content-length: ' . strlen($xml));
          $this->send_request();
          $this->_error_log($xml);
          fputs($this->sock, $xml);
          $this->get_respond();
          $response = $this->process_respond();
          // validate the response ... (only basic validation)
          // check http-version
          if ($response['status']['http-version'] == 'HTTP/1.1' ||
              $response['status']['http-version'] == 'HTTP/1.0') {
                  // seems to be http ... proceed
                  // We expect a 207 Multi-Status status code
                  // print 'http ok<br>';
                  if (strcmp($response['status']['status-code'],'207') == 0 ) {
                      // ok so far
                      // next there should be a Content-Type: text/xml; charset="utf-8" header line
                      if (preg_match('#(application|text)/xml;\s?charset=[\'\"]?utf-8[\'\"]?#i', $response['header']['Content-Type'])) {
                          // ok let's get the content of the xml stuff
                          $this->_parser = xml_parser_create_ns('UTF-8');
                          $this->_parserid = (int) $this->_parser;
                          // forget old data...
                          unset($this->_ls[$this->_parserid]);
                          unset($this->_xmltree[$this->_parserid]);
                          xml_parser_set_option($this->_parser,XML_OPTION_SKIP_WHITE,0);
                          xml_parser_set_option($this->_parser,XML_OPTION_CASE_FOLDING,0);
                          // xml_parser_set_option($this->_parser,XML_OPTION_TARGET_ENCODING,'UTF-8');
                          xml_set_object($this->_parser, $this);
                          xml_set_element_handler($this->_parser, "_propfind_startElement", "_endElement");
                          xml_set_character_data_handler($this->_parser, "_propfind_cdata");
  
  
                          if (!xml_parse($this->_parser, $response['body'])) {
                              die(sprintf("XML error: %s at line %d",
                                  xml_error_string(xml_get_error_code($this->_parser)),
                                  xml_get_current_line_number($this->_parser)));
                          }
  
                          // Free resources
                          xml_parser_free($this->_parser);
                          $arr = $this->_ls[$this->_parserid];
                          return $arr;
                      } else {
                          $this->_error_log('Missing Content-Type: text/xml header in response!!');
                          return false;
                      }
                  } else {
                      // return status code ...
                      return $response['status']['status-code'];
                  }
              }
  
          // response was not http
          $this->_error_log('Ups in method ls: error in response from server');
          return false;
      }
code: function ls($path) {
  
          if (trim($path) == '') {
              $this->_error_log('Missing a path in method ls');
              return false;
          }
          $this->_path = $this->translate_uri($path);
  
          $this->header_unset();
          $this->create_basic_request('PROPFIND');
          $this->header_add('Depth: 1');
          $this->header_add('Content-type: application/xml');
          // create profind xml request...
          $xml  = <<<EOD
  <?xml version="1.0" encoding="utf-8"?>
  <propfind xmlns="DAV:"><prop>
  <getcontentlength xmlns="DAV:"/>
  <getlastmodified xmlns="DAV:"/>
  <executable xmlns="http://apache.org/dav/props/"/>
  <resourcetype xmlns="DAV:"/>
  <checked-in xmlns="DAV:"/>
  <checked-out xmlns="DAV:"/>
  </prop></propfind>
  EOD;
          $this->header_add('Content-length: ' . strlen($xml));
          $this->send_request();
          $this->_error_log($xml);
          fputs($this->sock, $xml);
          $this->get_respond();
          $response = $this->process_respond();
          // validate the response ... (only basic validation)
          // check http-version
          if ($response['status']['http-version'] == 'HTTP/1.1' ||
              $response['status']['http-version'] == 'HTTP/1.0') {
                  // seems to be http ... proceed
                  // We expect a 207 Multi-Status status code
                  // print 'http ok<br>';
                  if (strcmp($response['status']['status-code'],'207') == 0 ) {
                      // ok so far
                      // next there should be a Content-Type: text/xml; charset="utf-8" header line
                      if (preg_match('#(application|text)/xml;\s?charset=[\'\"]?utf-8[\'\"]?#i', $response['header']['Content-Type'])) {
                          // ok let's get the content of the xml stuff
                          $this->_parser = xml_parser_create_ns('UTF-8');
                          $this->_parserid = (int) $this->_parser;
                          // forget old data...
                          unset($this->_ls[$this->_parserid]);
                          unset($this->_xmltree[$this->_parserid]);
                          xml_parser_set_option($this->_parser,XML_OPTION_SKIP_WHITE,0);
                          xml_parser_set_option($this->_parser,XML_OPTION_CASE_FOLDING,0);
                          // xml_parser_set_option($this->_parser,XML_OPTION_TARGET_ENCODING,'UTF-8');
                          xml_set_object($this->_parser, $this);
                          xml_set_element_handler($this->_parser, "_propfind_startElement", "_endElement");
                          xml_set_character_data_handler($this->_parser, "_propfind_cdata");
  
  
                          if (!xml_parse($this->_parser, $response['body'])) {
                              die(sprintf("XML error: %s at line %d",
                                  xml_error_string(xml_get_error_code($this->_parser)),
                                  xml_get_current_line_number($this->_parser)));
                          }
  
                          // Free resources
                          xml_parser_free($this->_parser);
                          $arr = $this->_ls[$this->_parserid];
                          return $arr;
                      } else {
                          $this->_error_log('Missing Content-Type: text/xml header in response!!');
                          return false;
                      }
                  } else {
                      // return status code ...
                      return $response['status']['status-code'];
                  }
              }
  
          // response was not http
          $this->_error_log('Ups in method ls: error in response from server');
          return false;
      }
code_tokens: function ls ( $ path ) { if ( trim ( $ path ) == '' ) { $ this -> _error_log ( 'Missing a path in method ls' ) ; return false ; } $ this -> _path = $ this -> translate_uri ( $ path ) ; $ this -> header_unset ( ) ; $ this -> create_basic_request ( 'PROPFIND' ) ; $ this -> header_add ( 'Depth: 1' ) ; $ this -> header_add ( 'Content-type: application/xml' ) ; // create profind xml request... $ xml =  <<<EOD
  <?xml version="1.0" encoding="utf-8"?>
  <propfind xmlns="DAV:"><prop>
  <getcontentlength xmlns="DAV:"/>
  <getlastmodified xmlns="DAV:"/>
  <executable xmlns="http://apache.org/dav/props/"/>
  <resourcetype xmlns="DAV:"/>
  <checked-in xmlns="DAV:"/>
  <checked-out xmlns="DAV:"/>
  </prop></propfind>
  EOD ; $ this -> header_add ( 'Content-length: ' . strlen ( $ xml ) ) ; $ this -> send_request ( ) ; $ this -> _error_log ( $ xml ) ; fputs ( $ this -> sock , $ xml ) ; $ this -> get_respond ( ) ; $ response = $ this -> process_respond ( ) ; // validate the response ... (only basic validation) // check http-version if ( $ response [ 'status' ] [ 'http-version' ] == 'HTTP/1.1' || $ response [ 'status' ] [ 'http-version' ] == 'HTTP/1.0' ) { // seems to be http ... proceed // We expect a 207 Multi-Status status code // print 'http ok<br>'; if ( strcmp ( $ response [ 'status' ] [ 'status-code' ] , '207' ) == 0 ) { // ok so far // next there should be a Content-Type: text/xml; charset="utf-8" header line if ( preg_match ( '#(application|text)/xml;\s?charset=[\'\"]?utf-8[\'\"]?#i' , $ response [ 'header' ] [ 'Content-Type' ] ) ) { // ok let's get the content of the xml stuff $ this -> _parser = xml_parser_create_ns ( 'UTF-8' ) ; $ this -> _parserid = ( int ) $ this -> _parser ; // forget old data... unset ( $ this -> _ls [ $ this -> _parserid ] ) ; unset ( $ this -> _xmltree [ $ this -> _parserid ] ) ; xml_parser_set_option ( $ this -> _parser , XML_OPTION_SKIP_WHITE , 0 ) ; xml_parser_set_option ( $ this -> _parser , XML_OPTION_CASE_FOLDING , 0 ) ; // xml_parser_set_option($this->_parser,XML_OPTION_TARGET_ENCODING,'UTF-8'); xml_set_object ( $ this -> _parser , $ this ) ; xml_set_element_handler ( $ this -> _parser , "_propfind_startElement" , "_endElement" ) ; xml_set_character_data_handler ( $ this -> _parser , "_propfind_cdata" ) ; if ( ! xml_parse ( $ this -> _parser , $ response [ 'body' ] ) ) { die ( sprintf ( "XML error: %s at line %d" , xml_error_string ( xml_get_error_code ( $ this -> _parser ) ) , xml_get_current_line_number ( $ this -> _parser ) ) ) ; } // Free resources xml_parser_free ( $ this -> _parser ) ; $ arr = $ this -> _ls [ $ this -> _parserid ] ; return $ arr ; } else { $ this -> _error_log ( 'Missing Content-Type: text/xml header in response!!' ) ; return false ; } } else { // return status code ... return $ response [ 'status' ] [ 'status-code' ] ; } } // response was not http $ this -> _error_log ( 'Ups in method ls: error in response from server' ) ; return false ; }
docstring: Public method ls
  
  Get's directory information from webdav server into flat a array using PROPFIND
  
  All filenames are UTF-8 encoded.
  Have a look at _propfind_startElement what keys are used in array returned.
  @param string path
  @return array dirinfo, false on error
docstring_tokens: Public method ls