Пример #1
0
 /**
  * Returns a list of properties for this nodes.;
  * @param array $properties
  * @return array
  * @note The properties list is a list of propertynames the client
  * requested, encoded as xmlnamespace#tagName, for example:
  * http://www.example.org/namespace#author If the array is empty, all
  * properties should be returned
  */
 public function getProperties($properties)
 {
     if (is_null($this->property_cache)) {
         $sql = 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` = ?';
         $result = OC_DB::executeAudited($sql, array(OC_User::getUser(), $this->path));
         $this->property_cache = array();
         while ($row = $result->fetchRow()) {
             $this->property_cache[$row['propertyname']] = $row['propertyvalue'];
         }
         $this->property_cache[self::GETETAG_PROPERTYNAME] = '"' . $this->info->getEtag() . '"';
     }
     // if the array was empty, we need to return everything
     if (count($properties) == 0) {
         return $this->property_cache;
     }
     $props = array();
     foreach ($properties as $property) {
         if (isset($this->property_cache[$property])) {
             $props[$property] = $this->property_cache[$property];
         }
     }
     return $props;
 }
Пример #2
0
 /**
  * Returns the ETag for a file
  *
  * An ETag is a unique identifier representing the current version of the
  * file. If the file changes, the ETag MUST change.  The ETag is an
  * arbitrary string, but MUST be surrounded by double-quotes.
  *
  * Return null if the ETag can not effectively be determined
  *
  * @return string
  */
 public function getETag()
 {
     return '"' . $this->info->getEtag() . '"';
 }