Beispiel #1
0
 public function createFile($name, $data = null)
 {
     if ($this->steamContainer->check_access_insert()) {
         $name = purifyName($name);
         $mimetype = MimetypeHelper::get_instance()->getMimeType(strtolower($name));
         if (strstr("{$mimetype}", "image/") || strstr("{$mimetype}", "text/wiki")) {
             try {
                 $steam_document = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $name, $data, $mimetype);
                 $steam_document->move($this->steamContainer);
                 return $name;
             } catch (Exception $e) {
                 throw new \Sabre\DAV\Exception($e->getMessage());
             }
         }
     }
     parent::createFile($name, $data);
 }
Beispiel #2
0
 /**
  * Returns the last modification time, as a unix timestamp
  *
  * @return int
  */
 public function getLastModified()
 {
     if (!empty($this->_item['modified'])) {
         return $this->_item['modified'];
     }
     if (!empty($this->_item['created'])) {
         return $this->_item['created'];
     }
     return parent::getLastModified();
 }
 public function createFile($name, $data = null)
 {
     if ($this->steamContainer->check_access_insert()) {
         if (preg_match('/^(.*).forum$/', $name) || preg_match('/^(.*).portal$/', $name) || preg_match('/^(.*).pyramide$/', $name) || preg_match('/^(.*).fragebogen$/', $name)) {
             parent::createFile($name, $data);
         }
         $name = purifyName($name);
         $mimetype = MimetypeHelper::get_instance()->getMimeType(strtolower($name));
         try {
             $steam_document = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $name, $data, $mimetype);
             $steam_document->move($this->steamContainer);
             return $name;
         } catch (Exception $e) {
             throw new \Sabre\DAV\Exception($e->getMessage());
         }
     }
     parent::createFile($name, $data);
 }