public function __construct($conf) { require_once "include/Settings.class.php"; require_once "include/session/Session.class.php"; require_once "include/ServiceEnvironment.class.php"; require_once "include/Util.class.php"; require_once "db/DBConnectionFactory.class.php"; require_once "include/configuration/ConfigurationDao.class.php"; require_once "include/Logging.class.php"; require_once "include/Version.info.php"; require_once "include/Cookie.class.php"; require_once "include/Features.class.php"; require_once "include/Request.class.php"; Logging::initialize($conf); $this->settings = new Settings($conf); $this->session = new Session(TRUE); $f = new DBConnectionFactory(); $db = $f->createConnection($this->settings); $this->configuration = new ConfigurationDao($db); $env = new ServiceEnvironment($db, $this->session, new VoidResponseHandler(), $this->configuration, $this->settings); $env->initialize(new Request(TRUE)); $this->authentication = $env->authentication(); }
} } class Kloudspeaker_DAV_Server extends Sabre_DAV_Server { public function exec() { Logging::logDebug("WebDAV request: " . Util::array2str($this->httpRequest->getHeaders())); parent::exec(); } } try { $settings = new Settings($CONFIGURATION); $db = getDB($settings); $conf = new ConfigurationDao($db); $session = new WebDavSession(); $env = new ServiceEnvironment($db, $session, new VoidResponseHandler(), $conf, $settings); $env->plugins()->setup(); $rq = new Kloudspeaker_DAV_Request(); $env->initialize($rq); // only basic auth supported $auth = new Sabre_HTTP_BasicAuth(); $result = $auth->getUserPass(); if (!$result) { Logging::logDebug("DAV authentication missing"); $auth->requireLogin(); echo "Authentication required\n"; die; } $user = $env->configuration()->getUserByNameOrEmail($result[0]); if (!$user) { Logging::logDebug("DAV authentication failure");
} } class Mollify_DAV_Server extends Sabre_DAV_Server { public function exec() { Logging::logDebug("WebDAV request: " . Util::array2str($this->httpRequest->getHeaders())); parent::exec(); } } try { $settings = new Settings($CONFIGURATION); $db = getDB($settings); $conf = new ConfigurationDao($db); $session = new WebDavSession(); $env = new ServiceEnvironment($db, $session, new VoidResponseHandler(), $conf, $settings); $env->plugins()->setup(); $rq = new Mollify_DAV_Request(); $env->initialize($rq); if (isset($BASIC_AUTH) and $BASIC_AUTH == TRUE) { $auth = new Sabre_HTTP_BasicAuth(); $result = $auth->getUserPass(); if (!$result) { Logging::logDebug("DAV authentication missing"); $auth->requireLogin(); echo "Authentication required\n"; die; } $user = $env->configuration()->getUserByNameOrEmail($result[0]); if (!$user) { Logging::logDebug("DAV authentication failure");
public function removeSession($id) { } public function updateSessionTime($id, $time) { } public function removeAllSessionBefore($time) { } } $settings = new Settings($CONFIGURATION); $session = new CMDSession(); $f = new DBConnectionFactory(); $db = $f->createConnection($settings); $configuration = new ConfigurationDao($db); $env = new ServiceEnvironment($db, $session, new VoidResponseHandler(), $configuration, $settings); $env->initialize(Request::get(TRUE)); $env->plugins()->setup(); $options = $opts["options"]; if (isset($options["user"])) { //TODO validate & auth $user = $env->configuration()->getUser($options["user"]); if (!$user) { echo "Invalid user: "******"user"] . "\n"; return; } echo "Running as user: id=" . $user["id"] . " name=" . $user["name"] . "\n"; $env->authentication()->setAuth($user); } $command = $opts["commands"][0]; if (!$env->commands()->exists($command)) {
return $this->file->size(); } public function getLastModified() { return $this->file->lastModified(); } public function getETag() { return null; } } try { $settings = new Settings($CONFIGURATION); $db = getDB($settings); $conf = new ConfigurationDao($db); $env = new ServiceEnvironment($db, new TemporarySession(), new VoidResponseHandler(), $conf, $settings); $env->plugins()->setup(); $env->initialize(new Mollify_DAV_Request()); if (isset($BASIC_AUTH) and $BASIC_AUTH == TRUE) { $auth = new Sabre_HTTP_BasicAuth(); $result = $auth->getUserPass(); if (!$result) { Logging::logDebug("DAV authentication missing"); $auth->requireLogin(); echo "Authentication required\n"; die; } $user = $env->configuration()->getUserByNameOrEmail($result[0]); if (!$user) { Logging::logDebug("DAV authentication failure"); $auth->requireLogin();