芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/cloud.pulsehost.co.uk/vendor/afterlogic/dav/lib/DAV/Contacts/Plugin.php
oServer = $oServer; $this->oServer->on('beforeUnbind', array($this, 'beforeUnbind'), 30); $this->oServer->on('beforeCreateFile', array($this, 'beforeCreateFile'), 30); } /** * Returns a plugin name. * * Using this name other plugins will be able to access other plugins * using \Sabre\DAV\Server::getPlugin * * @return string */ public function getPluginName() { return 'contacts'; } public static function isContact($uri) { $sUriExt = \pathinfo($uri, PATHINFO_EXTENSION); return ($sUriExt != null && strtoupper($sUriExt) == 'VCF'); } /** * @param string $sPath * @throws \Sabre\DAV\Exception\NotAuthenticated * @return bool */ public function beforeUnbind($sPath) { return true; } public function beforeCreateFile($path, &$data, \Sabre\DAV\ICollection $parent, &$modified) { if (self::isContact($path)) { if ($parent->childExists(\basename($path))) { throw new \Sabre\DAV\Exception\Conflict(); } } } }