public static function setupFS($user = "", $root = "files") { // configure the initial filesystem based on the configuration if (self::$fsSetup) { //setting up the filesystem twice can only lead to trouble return false; } $CONFIG_DATADIRECTORY_ROOT = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data"); $CONFIG_BACKUPDIRECTORY = OC_Config::getValue("backupdirectory", OC::$SERVERROOT . "/backup"); // Check if config folder is writable. if (!is_writable(OC::$SERVERROOT . "/config/")) { $tmpl = new OC_Template('', 'error', 'guest'); $tmpl->assign('errors', array(1 => array('error' => "Can't write into config directory 'config'", 'hint' => "You can usually fix this by giving the webserver user write access to the config directory in owncloud"))); $tmpl->printPage(); exit; } // Check if apps folder is writable. if (!is_writable(OC::$SERVERROOT . "/apps/")) { $tmpl = new OC_Template('', 'error', 'guest'); $tmpl->assign('errors', array(1 => array('error' => "Can't write into apps directory 'apps'", 'hint' => "You can usually fix this by giving the webserver user write access to the config directory in owncloud"))); $tmpl->printPage(); exit; } // Create root dir. if (!is_dir($CONFIG_DATADIRECTORY_ROOT)) { $success = @mkdir($CONFIG_DATADIRECTORY_ROOT); if (!$success) { $tmpl = new OC_Template('', 'error', 'guest'); $tmpl->assign('errors', array(1 => array('error' => "Can't create data directory (" . $CONFIG_DATADIRECTORY_ROOT . ")", 'hint' => "You can usually fix this by giving the webserver write access to the ownCloud directory '" . OC::$SERVERROOT . "' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' "))); $tmpl->printPage(); exit; } } // If we are not forced to load a specific user we load the one that is logged in if ($user == "" && OC_User::isLoggedIn()) { $user = OC_User::getUser(); } //first set up the local "root" storage if (!self::$rootMounted) { OC_Filesystem::mount('OC_Filestorage_Local', array('datadir' => $CONFIG_DATADIRECTORY_ROOT), '/'); self::$rootMounted = true; } if ($user != "") { //if we aren't logged in, there is no use to set up the filesystem OC::$CONFIG_DATADIRECTORY = $CONFIG_DATADIRECTORY_ROOT . "/{$user}/{$root}"; if (!is_dir(OC::$CONFIG_DATADIRECTORY)) { mkdir(OC::$CONFIG_DATADIRECTORY, 0755, true); } //jail the user into his "home" directory OC_Filesystem::init('/' . $user . '/' . $root); $quotaProxy = new OC_FileProxy_Quota(); OC_FileProxy::register($quotaProxy); self::$fsSetup = true; } }
public function dopre() { $user = OC_User::getUser(); if (!$user) { return false; } if (!OC_User::isEnabled($user) && OC_User::userExists($user)) { header('HTTP/1.1 401 Unauthorized'); header('Status: 401 Unauthorized'); $template = new \OC_Template('user_permission', 'userdisable', 'guest'); $template->printPage(); die; } }
} $subadmins = false; } // load preset quotas $quotaPreset = $config->getAppValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB'); $quotaPreset = explode(',', $quotaPreset); foreach ($quotaPreset as &$preset) { $preset = trim($preset); } $quotaPreset = array_diff($quotaPreset, array('default', 'none')); $defaultQuota = $config->getAppValue('files', 'default_quota', 'none'); $defaultQuotaIsUserDefined = array_search($defaultQuota, $quotaPreset) === false && array_search($defaultQuota, array('none', 'default')) === false; $tmpl = new OC_Template("settings", "users/main", "user"); $tmpl->assign('groups', $groups); $tmpl->assign('sortGroups', $sortGroupsBy); $tmpl->assign('adminGroup', $adminGroup); $tmpl->assign('isAdmin', (int) $isAdmin); $tmpl->assign('subadmins', $subadmins); $tmpl->assign('numofgroups', count($groups) + count($adminGroup)); $tmpl->assign('quota_preset', $quotaPreset); $tmpl->assign('default_quota', $defaultQuota); $tmpl->assign('defaultQuotaIsUserDefined', $defaultQuotaIsUserDefined); $tmpl->assign('recoveryAdminEnabled', $recoveryAdminEnabled); $tmpl->assign('enableAvatars', \OC::$server->getConfig()->getSystemValue('enable_avatars', true)); $tmpl->assign('show_storage_location', $config->getAppValue('core', 'umgmt_show_storage_location', 'false')); $tmpl->assign('show_last_login', $config->getAppValue('core', 'umgmt_show_last_login', 'false')); $tmpl->assign('show_email', $config->getAppValue('core', 'umgmt_show_email', 'false')); $tmpl->assign('show_backend', $config->getAppValue('core', 'umgmt_show_backend', 'false')); $tmpl->assign('send_email', $config->getAppValue('core', 'umgmt_send_email', 'false')); $tmpl->printPage();
/** * return the content of a file or return a zip file containing multiple files * * @param string $dir * @param string $files ; separated list of files to download * @param boolean $only_header ; boolean to only send header of the request */ public static function get($dir, $files, $only_header = false) { $xsendfile = false; if (isset($_SERVER['MOD_X_SENDFILE_ENABLED']) || isset($_SERVER['MOD_X_SENDFILE2_ENABLED']) || isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])) { $xsendfile = true; } if (is_array($files) && count($files) === 1) { $files = $files[0]; } if (is_array($files)) { $get_type = GET_TYPE::ZIP_FILES; $basename = basename($dir); if ($basename) { $name = $basename . '.zip'; } else { $name = 'download.zip'; } $filename = $dir . '/' . $name; } else { $filename = $dir . '/' . $files; if (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) { $get_type = GET_TYPE::ZIP_DIR; // downloading root ? if ($files === '') { $name = 'download.zip'; } else { $name = $files . '.zip'; } } else { $get_type = GET_TYPE::FILE; $name = $files; } } if ($get_type === GET_TYPE::FILE) { $zip = false; if ($xsendfile && OC_App::isEnabled('files_encryption')) { $xsendfile = false; } } else { $zip = new ZipStreamer(false); } OC_Util::obEnd(); if ($zip or \OC\Files\Filesystem::isReadable($filename)) { self::sendHeaders($filename, $name, $zip); } elseif (!\OC\Files\Filesystem::file_exists($filename)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OC_Template('', '404', 'guest'); $tmpl->assign('file', $name); $tmpl->printPage(); } else { header("HTTP/1.0 403 Forbidden"); die('403 Forbidden'); } if ($only_header) { return; } if ($zip) { $executionTime = intval(ini_get('max_execution_time')); set_time_limit(0); if ($get_type === GET_TYPE::ZIP_FILES) { foreach ($files as $file) { $file = $dir . '/' . $file; if (\OC\Files\Filesystem::is_file($file)) { $fh = \OC\Files\Filesystem::fopen($file, 'r'); $zip->addFileFromStream($fh, basename($file)); fclose($fh); } elseif (\OC\Files\Filesystem::is_dir($file)) { self::zipAddDir($file, $zip); } } } elseif ($get_type === GET_TYPE::ZIP_DIR) { $file = $dir . '/' . $files; self::zipAddDir($file, $zip); } $zip->finalize(); set_time_limit($executionTime); } else { if ($xsendfile) { $view = \OC\Files\Filesystem::getView(); /** @var $storage \OC\Files\Storage\Storage */ list($storage) = $view->resolvePath($filename); if ($storage->isLocal()) { self::addSendfileHeader($filename); } else { \OC\Files\Filesystem::readfile($filename); } } else { \OC\Files\Filesystem::readfile($filename); } } }
/** * print error page using Exception details * @param Exception $exception */ public static function printExceptionErrorPage($exception) { try { $request = \OC::$server->getRequest(); $content = new \OC_Template('', 'exception', 'error', false); $content->assign('errorClass', get_class($exception)); $content->assign('errorMsg', $exception->getMessage()); $content->assign('errorCode', $exception->getCode()); $content->assign('file', $exception->getFile()); $content->assign('line', $exception->getLine()); $content->assign('trace', $exception->getTraceAsString()); $content->assign('debugMode', \OC::$server->getSystemConfig()->getValue('debug', false)); $content->assign('remoteAddr', $request->getRemoteAddress()); $content->assign('requestID', $request->getId()); $content->printPage(); } catch (\Exception $e) { $logger = \OC::$server->getLogger(); $logger->logException($exception, ['app' => 'core']); $logger->logException($e, ['app' => 'core']); header(self::getHttpProtocol() . ' 500 Internal Server Error'); header('Content-Type: text/plain; charset=utf-8'); print "Internal Server Error\n\n"; print "The server encountered an internal error and was unable to complete your request.\n"; print "Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"; print "More details can be found in the server log.\n"; } die; }
/** * Prints the upgrade page */ private static function printUpgradePage() { $systemConfig = \OC::$server->getSystemConfig(); $oldTheme = $systemConfig->getValue('theme'); $systemConfig->setValue('theme', ''); \OCP\Util::addScript('config'); // needed for web root \OCP\Util::addScript('update'); // check whether this is a core update or apps update $installedVersion = $systemConfig->getValue('version', '0.0.0'); $currentVersion = implode('.', OC_Util::getVersion()); $appManager = \OC::$server->getAppManager(); $tmpl = new OC_Template('', 'update.admin', 'guest'); $tmpl->assign('version', OC_Util::getVersionString()); // if not a core upgrade, then it's apps upgrade if (version_compare($currentVersion, $installedVersion, '=')) { $tmpl->assign('isAppsOnlyUpgrade', true); } else { $tmpl->assign('isAppsOnlyUpgrade', false); } // get third party apps $ocVersion = OC_Util::getVersion(); $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion)); $tmpl->assign('incompatibleAppsList', $appManager->getIncompatibleApps($ocVersion)); $tmpl->assign('productName', 'ownCloud'); // for now $tmpl->assign('oldTheme', $oldTheme); $tmpl->printPage(); }
/** * print error page using Exception details * @param Exception $exception */ public static function printExceptionErrorPage(Exception $exception) { $request = \OC::$server->getRequest(); $content = new \OC_Template('', 'exception', 'error', false); $content->assign('errorClass', get_class($exception)); $content->assign('errorMsg', $exception->getMessage()); $content->assign('errorCode', $exception->getCode()); $content->assign('file', $exception->getFile()); $content->assign('line', $exception->getLine()); $content->assign('trace', $exception->getTraceAsString()); $content->assign('debugMode', defined('DEBUG') && DEBUG === true); $content->assign('remoteAddr', $request->getRemoteAddress()); $content->assign('requestID', $request->getId()); $content->printPage(); die; }
public static function initSession() { // prevents javascript from accessing php session cookies ini_set('session.cookie_httponly', '1;'); // set the session name to the instance id - which is unique session_name(OC_Util::getInstanceId()); // if session cant be started break with http 500 error if (session_start() === false) { OC_Log::write('core', 'Session could not be initialized', OC_Log::ERROR); header('HTTP/1.1 500 Internal Server Error'); OC_Util::addStyle("styles"); $error = 'Session could not be initialized. Please contact your '; $error .= 'system administrator'; $tmpl = new OC_Template('', 'error', 'guest'); $tmpl->assign('errors', array(1 => array('error' => $error))); $tmpl->printPage(); exit; } $sessionLifeTime = self::getSessionLifeTime(); // regenerate session id periodically to avoid session fixation if (!isset($_SESSION['SID_CREATED'])) { $_SESSION['SID_CREATED'] = time(); } else { if (time() - $_SESSION['SID_CREATED'] > $sessionLifeTime / 2) { session_regenerate_id(true); $_SESSION['SID_CREATED'] = time(); } } // session timeout if (isset($_SESSION['LAST_ACTIVITY']) && time() - $_SESSION['LAST_ACTIVITY'] > $sessionLifeTime) { if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time() - 42000, '/'); } session_unset(); session_destroy(); session_start(); } $_SESSION['LAST_ACTIVITY'] = time(); }
public static function checkUpgrade($showTemplate = true) { if (self::needUpgrade()) { if ($showTemplate && !OC_Config::getValue('maintenance', false)) { OC_Config::setValue('theme', ''); $minimizerCSS = new OC_Minimizer_CSS(); $minimizerCSS->clearCache(); $minimizerJS = new OC_Minimizer_JS(); $minimizerJS->clearCache(); OC_Util::addScript('config'); // needed for web root OC_Util::addScript('update'); $tmpl = new OC_Template('', 'update.admin', 'guest'); $tmpl->assign('version', OC_Util::getVersionString()); $tmpl->printPage(); exit; } else { return true; } } return false; }
/** * return the content of a file or return a zip file containing multiple files * * @param string $dir * @param string $files ; separated list of files to download * @param boolean $onlyHeader ; boolean to only send header of the request */ public static function get($dir, $files, $onlyHeader = false) { $view = \OC\Files\Filesystem::getView(); if (is_array($files) && count($files) === 1) { $files = $files[0]; } if (is_array($files)) { $getType = self::ZIP_FILES; $basename = basename($dir); if ($basename) { $name = $basename; } else { $name = 'download'; } $filename = $dir . '/' . $name; } else { $filename = $dir . '/' . $files; if (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) { $getType = self::ZIP_DIR; // downloading root ? if ($files === '') { $name = 'download'; } else { $name = $files; } } else { $getType = self::FILE; $name = $files; } } if ($getType === self::FILE) { $streamer = false; } else { $streamer = new Streamer(); } OC_Util::obEnd(); try { if ($getType === self::FILE) { $view->lockFile($filename, ILockingProvider::LOCK_SHARED); } if ($streamer) { $streamer->sendHeaders($name); } elseif (\OC\Files\Filesystem::isReadable($filename)) { self::sendHeaders($filename, $name); } elseif (!\OC\Files\Filesystem::file_exists($filename)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OC_Template('', '404', 'guest'); $tmpl->printPage(); exit; } else { header("HTTP/1.0 403 Forbidden"); die('403 Forbidden'); } if ($onlyHeader) { return; } if ($streamer) { $executionTime = intval(ini_get('max_execution_time')); set_time_limit(0); if ($getType === self::ZIP_FILES) { foreach ($files as $file) { $file = $dir . '/' . $file; if (\OC\Files\Filesystem::is_file($file)) { $fileSize = \OC\Files\Filesystem::filesize($file); $fh = \OC\Files\Filesystem::fopen($file, 'r'); $streamer->addFileFromStream($fh, basename($file), $fileSize); fclose($fh); } elseif (\OC\Files\Filesystem::is_dir($file)) { $streamer->addDirRecursive($file); } } } elseif ($getType === self::ZIP_DIR) { $file = $dir . '/' . $files; $streamer->addDirRecursive($file); } $streamer->finalize(); set_time_limit($executionTime); } else { \OC\Files\Filesystem::readfile($filename); } if ($getType === self::FILE) { $view->unlockFile($filename, ILockingProvider::LOCK_SHARED); } } catch (\OCP\Lock\LockedException $ex) { $l = \OC::$server->getL10N('core'); $hint = method_exists($ex, 'getHint') ? $ex->getHint() : ''; \OC_Template::printErrorPage($l->t('File is currently busy, please try again later'), $hint); } catch (\Exception $ex) { $l = \OC::$server->getL10N('core'); $hint = method_exists($ex, 'getHint') ? $ex->getHint() : ''; \OC_Template::printErrorPage($l->t('Can\'t read file'), $hint); } }
/** * return the content of a file or return a zip file containning multiply files * * @param dir $dir * @param file $file ; seperated list of files to download */ public static function get($dir, $files) { if (strpos($files, ';')) { $files = explode(';', $files); } if (is_array($files)) { $zip = new ZipArchive(); $filename = sys_get_temp_dir() . "/ownCloud.zip"; if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) { exit("cannot open <{$filename}>\n"); } foreach ($files as $file) { $file = $dir . '/' . $file; if (OC_Filesystem::is_file($file)) { $tmpFile = OC_Filesystem::toTmpFile($file); self::$tmpFiles[] = $tmpFile; $zip->addFile($tmpFile, basename($file)); } elseif (OC_Filesystem::is_dir($file)) { self::zipAddDir($file, $zip); } } $zip->close(); } elseif (OC_Filesystem::is_dir($dir . '/' . $files)) { $zip = new ZipArchive(); $filename = sys_get_temp_dir() . "/ownCloud.zip"; if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) { exit("cannot open <{$filename}>\n"); } $file = $dir . '/' . $files; self::zipAddDir($file, $zip); $zip->close(); } else { $zip = false; $filename = $dir . '/' . $files; } if ($zip or OC_Filesystem::is_readable($filename)) { header('Content-Disposition: attachment; filename="' . basename($filename) . '"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); if ($zip) { header('Content-Type: application/zip'); header('Content-Length: ' . filesize($filename)); } else { header('Content-Type: ' . OC_Filesystem::getMimeType($filename)); header('Content-Length: ' . OC_Filesystem::filesize($filename)); } } elseif ($zip or !OC_Filesystem::file_exists($filename)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OC_Template('', '404', 'guest'); $tmpl->assign('file', $filename); $tmpl->printPage(); // die('404 Not Found'); } else { header("HTTP/1.0 403 Forbidden"); die('403 Forbidden'); } @ob_end_clean(); if ($zip) { readfile($filename); unlink($filename); } else { OC_Filesystem::readfile($filename); } foreach (self::$tmpFiles as $tmpFile) { if (file_exists($tmpFile) and is_file($tmpFile)) { unlink($tmpFile); } } }
/** * The default information screen * @global array $profile */ function no_mode() { global $USERNAME, $profile; $tmpl = new OC_Template('user_openid', 'nomode', 'guest'); if (substr($profile['req_url'], -1, 1) !== '/') { //the identity should always end with a / $profile['req_url'] .= '/'; } $tmpl->addHeader('link', array('rel' => 'openid.server', 'href' => $profile['req_url'])); $tmpl->addHeader('link', array('rel' => 'openid.delegate', 'href' => $profile['idp_url'])); $tmpl->assign('user', $USERNAME); $tmpl->printPage(); }
/** * @param View $view * @param string $name * @param string $dir * @param array $params ; 'head' boolean to only send header of the request ; 'range' http range header */ private static function getSingleFile($view, $dir, $name, $params) { $filename = $dir . '/' . $name; OC_Util::obEnd(); $view->lockFile($filename, ILockingProvider::LOCK_SHARED); $rangeArray = array(); if (isset($params['range']) && substr($params['range'], 0, 6) === 'bytes=') { $rangeArray = self::parseHttpRangeHeader(substr($params['range'], 6), \OC\Files\Filesystem::filesize($filename)); } if (\OC\Files\Filesystem::isReadable($filename)) { self::sendHeaders($filename, $name, $rangeArray); } elseif (!\OC\Files\Filesystem::file_exists($filename)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OC_Template('', '404', 'guest'); $tmpl->printPage(); exit; } else { header("HTTP/1.0 403 Forbidden"); die('403 Forbidden'); } if (isset($params['head']) && $params['head']) { return; } if (!empty($rangeArray)) { try { if (count($rangeArray) == 1) { $view->readfilePart($filename, $rangeArray[0]['from'], $rangeArray[0]['to']); } else { // check if file is seekable (if not throw UnseekableException) // we have to check it before body contents $view->readfilePart($filename, $rangeArray[0]['size'], $rangeArray[0]['size']); $type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename)); foreach ($rangeArray as $range) { echo "\r\n--" . self::getBoundary() . "\r\n" . "Content-type: " . $type . "\r\n" . "Content-range: bytes " . $range['from'] . "-" . $range['to'] . "/" . $range['size'] . "\r\n\r\n"; $view->readfilePart($filename, $range['from'], $range['to']); } echo "\r\n--" . self::getBoundary() . "--\r\n"; } } catch (\OCP\Files\UnseekableException $ex) { // file is unseekable header_remove('Accept-Ranges'); header_remove('Content-Range'); header("HTTP/1.1 200 OK"); self::sendHeaders($filename, $name, array()); $view->readfile($filename); } } else { $view->readfile($filename); } }
/** * @brief Writes the config file * @return bool * * Saves the config to the config file. * */ public static function writeData() { // Create a php file ... $defaults = new OC_Defaults(); $content = "<?php\n\$CONFIG = "; $content .= var_export(self::$cache, true); $content .= ";\n"; $filename = OC::$SERVERROOT . "/config/config.php"; // Write the file $result = @file_put_contents($filename, $content); if (!$result) { $tmpl = new OC_Template('', 'error', 'guest'); $tmpl->assign('errors', array(1 => array('error' => "Can't write into config directory 'config'", 'hint' => 'This can usually be fixed by ' . '<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-permissions" target="_blank">giving the webserver write access to the config directory</a>.'))); $tmpl->printPage(); exit; } // Prevent others not to read the config @chmod($filename, 0640); OC_Util::clearOpcodeCache(); return true; }
/** * @param View $view * @param string $name */ private static function getSingleFile($view, $dir, $name, $onlyHeader) { $filename = $dir . '/' . $name; OC_Util::obEnd(); $view->lockFile($filename, ILockingProvider::LOCK_SHARED); if (\OC\Files\Filesystem::isReadable($filename)) { self::sendHeaders($filename, $name); } elseif (!\OC\Files\Filesystem::file_exists($filename)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OC_Template('', '404', 'guest'); $tmpl->printPage(); exit; } else { header("HTTP/1.0 403 Forbidden"); die('403 Forbidden'); } if ($onlyHeader) { return; } $type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename)); $pos = strpos(strtolower($type), "video"); if ($pos != -1) { $view->streamVideoFile($filename); } else { $view->readfile($filename); } }
private function printSongs($songs, $artistName = false, $albumName = false) { header('Content-Type: text/xml'); $tmpl = new \OC_Template('media', 'ampache/songs'); foreach ($songs as $song) { $songData = array(); if ($artistName) { $songData['artist_name'] = xmlentities($artistName); } else { $songData['artist_name'] = xmlentities($this->collection->getArtistName($song['song_artist'])); } if ($albumName) { $songData['album_name'] = xmlentities($albumName); } else { $songData['album_name'] = xmlentities($this->collection->getAlbumName($song['song_album'])); } $songData['id'] = $song['song_id']; $songData['name'] = xmlentities($song['song_name']); $songData['artist'] = $song['song_artist']; $songData['album'] = $song['song_album']; $songData['length'] = $song['song_length']; $songData['track'] = $song['song_track']; $songData['size'] = $song['song_size']; $url = \OCP\Util::linkToRemote('ampache') . 'server/xml.server.php/?action=play&song=' . $songData['id'] . '&auth=' . $_GET['auth']; $songData['url'] = xmlentities($url); $tmpl->append('songs', $songData); } $tmpl->printPage(); }
/** * Prints the upgrade page */ private static function printUpgradePage() { $systemConfig = \OC::$server->getSystemConfig(); $disableWebUpdater = $systemConfig->getValue('upgrade.disable-web', false); $tooBig = false; if (!$disableWebUpdater) { $apps = \OC::$server->getAppManager(); $tooBig = $apps->isInstalled('user_ldap') || $apps->isInstalled('user_shibboleth'); if (!$tooBig) { // count users $stats = \OC::$server->getUserManager()->countUsers(); $totalUsers = array_sum($stats); $tooBig = $totalUsers > 50; } } if ($disableWebUpdater || $tooBig) { // send http status 503 header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); header('Retry-After: 120'); // render error page $template = new OC_Template('', 'update.use-cli', 'guest'); $template->assign('productName', 'ownCloud'); // for now $template->assign('version', OC_Util::getVersionString()); $template->assign('tooBig', $tooBig); $template->printPage(); die; } // check whether this is a core update or apps update $installedVersion = $systemConfig->getValue('version', '0.0.0'); $currentVersion = implode('.', \OCP\Util::getVersion()); // if not a core upgrade, then it's apps upgrade $isAppsOnlyUpgrade = version_compare($currentVersion, $installedVersion, '='); $oldTheme = $systemConfig->getValue('theme'); $systemConfig->setValue('theme', ''); \OCP\Util::addScript('config'); // needed for web root \OCP\Util::addScript('update'); \OCP\Util::addStyle('update'); $appManager = \OC::$server->getAppManager(); $tmpl = new OC_Template('', 'update.admin', 'guest'); $tmpl->assign('version', OC_Util::getVersionString()); $tmpl->assign('isAppsOnlyUpgrade', $isAppsOnlyUpgrade); // get third party apps $ocVersion = \OCP\Util::getVersion(); $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion)); $tmpl->assign('incompatibleAppsList', $appManager->getIncompatibleApps($ocVersion)); $tmpl->assign('productName', 'ownCloud'); // for now $tmpl->assign('oldTheme', $oldTheme); $tmpl->printPage(); }
public function process() { $ssoUrl = $this->config->getValue("sso_login_url"); $userInfo = RequestManager::getRequest(ISingleSignOnRequest::INFO); $authInfo = AuthInfo::get(); $userInfo->setup(array("action" => "webLogin")); if ($this->unnecessaryAuth($this->request->getRequestUri())) { $uri = substr($this->request->getRequestUri(), -1 * strlen($this->config->getValue("sso_admin_login_uri"))); if ($uri === $this->config->getValue("sso_admin_login_uri") && $this->visitPort != $this->config->getValue("sso_admin_login_port")) { Util::redirect($this->defaultPageUrl); } return; } if (isset($_GET["logout"]) && $_GET["logout"] == "true") { if ($this->config->getValue("sso_global_logout")) { RequestManager::send(ISingleSignOnRequest::INVALIDTOKEN, $authInfo); } \OC_User::logout(); $template = new \OC_Template("singlesignon", "logout", "guest"); $template->printPage(); die; } if (\OC_User::isLoggedIn() && $this->config->getValue("sso_one_time_password")) { return; } if (\OC_User::isLoggedIn() && !$authInfo) { header("HTTP/1.1 " . \OCP\AppFramework\Http::STATUS_UNAUTHORIZED); header("Status: " . \OCP\AppFramework\Http::STATUS_UNAUTHORIZED); header("WWW-Authenticate: "); header("Retry-After: 120"); $template = new \OC_Template("singlesignon", "unauthorizedActions", "guest"); $template->printPage(); die; } if (\OC_User::isLoggedIn() && (!RequestManager::send(ISingleSignOnRequest::VALIDTOKEN, $authInfo) && !$this->config->getValue("sso_one_time_password"))) { header("HTTP/1.1 " . \OCP\AppFramework\Http::STATUS_UNAUTHORIZED); header("Status: " . \OCP\AppFramework\Http::STATUS_UNAUTHORIZED); header("WWW-Authenticate: "); header("Retry-After: 120"); $template = new \OC_Template("singlesignon", "tokenExpired", "guest"); $template->printPage(); die; } if (!$authInfo || !RequestManager::send(ISingleSignOnRequest::VALIDTOKEN, $authInfo) && !$this->config->getValue("sso_one_time_password")) { $url = $this->redirectUrl ? $ssoUrl . $this->config->getValue("sso_return_url_key") . $this->redirectUrl : $ssoUrl; Util::redirect($url); } if (\OC_User::isLoggedIn()) { return; } if (empty($ssoUrl) || !$userInfo->send($authInfo) || !$userInfo->hasPermission()) { header("HTTP/1.1 " . \OCP\AppFramework\Http::STATUS_UNAUTHORIZED); header("Status: " . \OCP\AppFramework\Http::STATUS_UNAUTHORIZED); header("WWW-Authenticate: "); header("Retry-After: 120"); $template = new \OC_Template("singlesignon", "verificationFailure", "guest"); $template->printPage(); if ($userInfo->hasErrorMsg()) { \OCP\Util::writeLog("Single Sign-On", $userInfo->getErrorMsg(), \OCP\Util::ERROR); } die; } if ($this->config->getValue("sso_multiple_region")) { Util::redirectRegion($userInfo, $this->config->getValue("sso_regions"), $this->config->getValue("sso_owncloud_url")); } if (!\OC_User::userExists($userInfo->getUserId())) { Util::firstLogin($userInfo, $authInfo); if ($this->request->getHeader("ORIGIN")) { return; } Util::redirect($this->defaultPageUrl); } else { Util::login($userInfo, $authInfo); if ($this->request->getHeader("ORIGIN")) { return; } Util::redirect($this->defaultPageUrl); } }
/** * Checks if the version requires an update and shows * @param bool $showTemplate Whether an update screen should get shown * @return bool|void */ public static function checkUpgrade($showTemplate = true) { if (\OCP\Util::needUpgrade()) { $systemConfig = \OC::$server->getSystemConfig(); if ($showTemplate && !$systemConfig->getValue('maintenance', false)) { $version = OC_Util::getVersion(); $oldTheme = $systemConfig->getValue('theme'); $systemConfig->setValue('theme', ''); OC_Util::addScript('config'); // needed for web root OC_Util::addScript('update'); $tmpl = new OC_Template('', 'update.admin', 'guest'); $tmpl->assign('version', OC_Util::getVersionString()); // get third party apps $apps = OC_App::getEnabledApps(); $incompatibleApps = array(); foreach ($apps as $appId) { $info = OC_App::getAppInfo($appId); if (!OC_App::isAppCompatible($version, $info)) { $incompatibleApps[] = $info; } } $tmpl->assign('appList', $incompatibleApps); $tmpl->assign('productName', 'ownCloud'); // for now $tmpl->assign('oldTheme', $oldTheme); $tmpl->printPage(); exit; } else { return true; } } return false; }
public static function checkUpgrade() { if (OC_Config::getValue('installed', false)) { $installedVersion = OC_Config::getValue('version', '0.0.0'); $currentVersion = implode('.', OC_Util::getVersion()); if (version_compare($currentVersion, $installedVersion, '>')) { OC_Log::write('core', 'starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, OC_Log::DEBUG); $result = OC_DB::updateDbFromStructure(OC::$SERVERROOT . '/db_structure.xml'); if (!$result) { echo 'Error while upgrading the database'; die; } if (file_exists(OC::$SERVERROOT . "/config/config.php") and !is_writable(OC::$SERVERROOT . "/config/config.php")) { $tmpl = new OC_Template('', 'error', 'guest'); $tmpl->assign('errors', array(1 => array('error' => "Can't write into config directory 'config'", 'hint' => "You can usually fix this by giving the webserver user write access to the config directory in owncloud"))); $tmpl->printPage(); exit; } $minimizerCSS = new OC_Minimizer_CSS(); $minimizerCSS->clearCache(); $minimizerJS = new OC_Minimizer_JS(); $minimizerJS->clearCache(); OC_Config::setValue('version', implode('.', OC_Util::getVersion())); OC_App::checkAppsRequirements(); // load all apps to also upgrade enabled apps OC_App::loadApps(); } } }
/** * Print a fatal error page and terminates the script * @param string $error_msg The error message to show * @param string $hint An optional hint message * Warning: All data passed to $hint needs to get sanitized using OC_Util::sanitizeHTML */ public static function printErrorPage($error_msg, $hint = '') { $content = new OC_Template('', 'error', 'error'); $errors = array(array('error' => $error_msg, 'hint' => $hint)); $content->assign('errors', $errors); $content->printPage(); die; }
/** * return the content of a file or return a zip file containing multiple files * * @param string $dir * @param string $file ; separated list of files to download * @param boolean $only_header ; boolean to only send header of the request */ public static function get($dir, $files, $only_header = false) { $xsendfile = false; if (isset($_SERVER['MOD_X_SENDFILE_ENABLED']) || isset($_SERVER['MOD_X_SENDFILE2_ENABLED']) || isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])) { $xsendfile = true; } if (is_array($files) && count($files) == 1) { $files = $files[0]; } if (is_array($files)) { self::validateZipDownload($dir, $files); $executionTime = intval(ini_get('max_execution_time')); set_time_limit(0); $zip = new ZipArchive(); $filename = OC_Helper::tmpFile('.zip'); if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true) { $l = OC_L10N::get('lib'); throw new Exception($l->t('cannot open "%s"', array($filename))); } foreach ($files as $file) { $file = $dir . '/' . $file; if (\OC\Files\Filesystem::is_file($file)) { $tmpFile = \OC\Files\Filesystem::toTmpFile($file); self::$tmpFiles[] = $tmpFile; $zip->addFile($tmpFile, basename($file)); } elseif (\OC\Files\Filesystem::is_dir($file)) { self::zipAddDir($file, $zip); } } $zip->close(); if ($xsendfile) { $filename = OC_Helper::moveToNoClean($filename); } $basename = basename($dir); if ($basename) { $name = $basename . '.zip'; } else { $name = 'download.zip'; } set_time_limit($executionTime); } elseif (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) { self::validateZipDownload($dir, $files); $executionTime = intval(ini_get('max_execution_time')); set_time_limit(0); $zip = new ZipArchive(); $filename = OC_Helper::tmpFile('.zip'); if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true) { $l = OC_L10N::get('lib'); throw new Exception($l->t('cannot open "%s"', array($filename))); } $file = $dir . '/' . $files; self::zipAddDir($file, $zip); $zip->close(); if ($xsendfile) { $filename = OC_Helper::moveToNoClean($filename); } $name = $files . '.zip'; set_time_limit($executionTime); } else { $zip = false; $filename = $dir . '/' . $files; $name = $files; if ($xsendfile && OC_App::isEnabled('files_encryption')) { $xsendfile = false; } } OC_Util::obEnd(); if ($zip or \OC\Files\Filesystem::isReadable($filename)) { OC_Response::setContentDispositionHeader($name, 'attachment'); header('Content-Transfer-Encoding: binary'); OC_Response::disableCaching(); if ($zip) { ini_set('zlib.output_compression', 'off'); header('Content-Type: application/zip'); header('Content-Length: ' . filesize($filename)); self::addSendfileHeader($filename); } else { $filesize = \OC\Files\Filesystem::filesize($filename); header('Content-Type: ' . \OC\Files\Filesystem::getMimeType($filename)); if ($filesize > -1) { header("Content-Length: " . $filesize); } if ($xsendfile) { list($storage) = \OC\Files\Filesystem::resolvePath(\OC\Files\Filesystem::getView()->getAbsolutePath($filename)); /** * @var \OC\Files\Storage\Storage $storage */ if ($storage->instanceOfStorage('\\OC\\Files\\Storage\\Local')) { self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename)); } } } } elseif ($zip or !\OC\Files\Filesystem::file_exists($filename)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OC_Template('', '404', 'guest'); $tmpl->assign('file', $name); $tmpl->printPage(); } else { header("HTTP/1.0 403 Forbidden"); die('403 Forbidden'); } if ($only_header) { return; } if ($zip) { $handle = fopen($filename, 'r'); if ($handle) { $chunkSize = 8 * 1024; // 1 MB chunks while (!feof($handle)) { echo fread($handle, $chunkSize); flush(); } } if (!$xsendfile) { unlink($filename); } } else { \OC\Files\Filesystem::readfile($filename); } foreach (self::$tmpFiles as $tmpFile) { if (file_exists($tmpFile) and is_file($tmpFile)) { unlink($tmpFile); } } }
/** * @param View $view * @param string $name * @param string $dir * @param boolean $onlyHeader */ private static function getSingleFile($view, $dir, $name, $onlyHeader) { $filename = $dir . '/' . $name; OC_Util::obEnd(); $view->lockFile($filename, ILockingProvider::LOCK_SHARED); if (\OC\Files\Filesystem::isReadable($filename)) { self::sendHeaders($filename, $name); } elseif (!\OC\Files\Filesystem::file_exists($filename)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OC_Template('', '404', 'guest'); $tmpl->printPage(); exit; } else { header("HTTP/1.0 403 Forbidden"); die('403 Forbidden'); } if ($onlyHeader) { return; } $view->readfile($filename); }
/** * @brief Writes the config file * @returns true/false * * Saves the config to the config file. * * Known flaws: Strings are not escaped properly */ public static function writeData() { // Create a php file ... $content = "<?php\n\$CONFIG = array(\n"; foreach (self::$cache as $key => $value) { if (is_bool($value)) { $value = $value ? 'true' : 'false'; $content .= "\"{$key}\" => {$value},\n"; } else { $value = str_replace("'", "\\'", $value); $content .= "\"{$key}\" => '{$value}',\n"; } } $content .= ");\n?>\n"; // Write the file $result = @file_put_contents(OC::$SERVERROOT . "/config/config.php", $content); if (!$result) { $tmpl = new OC_Template('', 'error', 'guest'); $tmpl->assign('errors', array(1 => array('error' => "Can't write into config directory 'config'", 'hint' => "You can usually fix this by giving the webserver user write access to the config directory in owncloud"))); $tmpl->printPage(); exit; } return true; }
$template->assign('filesExternal', $filesExternal); $template->assign('updaterAppPanel', $updaterAppPanel); $template->assign('ocDefaultEncryptionModulePanel', $ocDefaultEncryptionModulePanel); if (\OC::$server->getLockingProvider() instanceof NoopLockingProvider) { $template->assign('fileLockingEnabled', false); } else { $template->assign('fileLockingEnabled', true); } $formsMap = array_map(function ($form) { if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) { $sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]); $sectionName = str_replace('</h2>', '', $sectionName); $anchor = strtolower($sectionName); $anchor = str_replace(' ', '-', $anchor); return array('anchor' => 'goto-' . $anchor, 'section-name' => $sectionName, 'form' => $form); } return array('form' => $form); }, $forms); $formsAndMore = array_merge($formsAndMore, $formsMap); // add bottom hardcoded forms from the template $formsAndMore[] = ['anchor' => 'backgroundjobs', 'section-name' => $l->t('Cron')]; $formsAndMore[] = ['anchor' => 'mail_general_settings', 'section-name' => $l->t('Email server')]; $formsAndMore[] = ['anchor' => 'log-section', 'section-name' => $l->t('Log')]; $formsAndMore[] = ['anchor' => 'server-status', 'section-name' => $l->t('Server Status')]; $formsAndMore[] = ['anchor' => 'admin-tips', 'section-name' => $l->t('Tips & tricks')]; if ($updaterAppPanel) { $formsAndMore[] = ['anchor' => 'updater', 'section-name' => $l->t('Updates')]; } $template->assign('forms', $formsAndMore); $template->printPage();
public static function setupFS($user = "", $root = "files") { // configure the initial filesystem based on the configuration if (self::$fsSetup) { //setting up the filesystem twice can only lead to trouble return false; } $CONFIG_DATADIRECTORY_ROOT = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data"); $CONFIG_BACKUPDIRECTORY = OC_Config::getValue("backupdirectory", OC::$SERVERROOT . "/backup"); // Create root dir if (!is_dir($CONFIG_DATADIRECTORY_ROOT)) { $success = @mkdir($CONFIG_DATADIRECTORY_ROOT); if (!$success) { $tmpl = new OC_Template('', 'error', 'guest'); $tmpl->assign('errors', array(1 => array('error' => "Can't create data directory (" . $CONFIG_DATADIRECTORY_ROOT . ")", 'hint' => "You can usually fix this by setting the owner of '" . OC::$SERVERROOT . "' to the user that the web server uses (" . OC_Util::checkWebserverUser() . ")"))); $tmpl->printPage(); exit; } } // If we are not forced to load a specific user we load the one that is logged in if ($user == "" && OC_User::isLoggedIn()) { $user = OC_User::getUser(); } if ($user != "") { //if we aren't logged in, there is no use to set up the filesystem //first set up the local "root" storage and the backupstorage if needed $rootStorage = OC_Filesystem::createStorage('local', array('datadir' => $CONFIG_DATADIRECTORY_ROOT)); // if( OC_Config::getValue( "enablebackup", false )){ // // This creates the Directorys recursively // if(!is_dir( "$CONFIG_BACKUPDIRECTORY/$user/$root" )){ // mkdir( "$CONFIG_BACKUPDIRECTORY/$user/$root", 0755, true ); // } // $backupStorage=OC_Filesystem::createStorage('local',array('datadir'=>$CONFIG_BACKUPDIRECTORY)); // $backup=new OC_FILEOBSERVER_BACKUP(array('storage'=>$backupStorage)); // $rootStorage->addObserver($backup); // } OC_Filesystem::mount($rootStorage, '/'); // TODO add this storage provider in a proper way $sharedStorage = OC_Filesystem::createStorage('shared', array('datadir' => '/' . OC_User::getUser() . '/files/Shared')); OC_Filesystem::mount($sharedStorage, '/' . OC_User::getUser() . '/files/Shared/'); OC::$CONFIG_DATADIRECTORY = $CONFIG_DATADIRECTORY_ROOT . "/{$user}/{$root}"; if (!is_dir(OC::$CONFIG_DATADIRECTORY)) { mkdir(OC::$CONFIG_DATADIRECTORY, 0755, true); } // TODO: find a cool way for doing this // //set up the other storages according to the system settings // foreach($CONFIG_FILESYSTEM as $storageConfig){ // if(OC_Filesystem::hasStorageType($storageConfig['type'])){ // $arguments=$storageConfig; // unset($arguments['type']); // unset($arguments['mountpoint']); // $storage=OC_Filesystem::createStorage($storageConfig['type'],$arguments); // if($storage){ // OC_Filesystem::mount($storage,$storageConfig['mountpoint']); // } // } // } //jail the user into his "home" directory OC_Filesystem::chroot("/{$user}/{$root}"); $quotaProxy = new OC_FileProxy_Quota(); OC_FileProxy::register($quotaProxy); self::$fsSetup = true; } }
/** * checks if the selected files are within the size constraint. If not, outputs an error page. * * @param dir $dir * @param files $files */ static function validateZipDownload($dir, $files) { if (!OC_Config::getValue('allowZipDownload', true)) { $l = OC_L10N::get('files'); header("HTTP/1.0 409 Conflict"); $tmpl = new OC_Template('', 'error', 'user'); $errors = array(array('error' => $l->t('ZIP download is turned off.'), 'hint' => $l->t('Files need to be downloaded one by one.') . '<br/><a href="javascript:history.back()">' . $l->t('Back to Files') . '</a>')); $tmpl->assign('errors', $errors); $tmpl->printPage(); exit; } $zipLimit = OC_Config::getValue('maxZipInputSize', OC_Helper::computerFileSize('800 MB')); if ($zipLimit > 0) { $totalsize = 0; if (is_array($files)) { foreach ($files as $file) { $totalsize += OC_Filesystem::filesize($dir . '/' . $file); } } else { $totalsize += OC_Filesystem::filesize($dir . '/' . $files); } if ($totalsize > $zipLimit) { $l = OC_L10N::get('files'); header("HTTP/1.0 409 Conflict"); $tmpl = new OC_Template('', 'error', 'user'); $errors = array(array('error' => $l->t('Selected files too large to generate zip file.'), 'hint' => 'Download the files in smaller chunks, seperately or kindly ask your administrator.<br/><a href="javascript:history.back()">' . $l->t('Back to Files') . '</a>')); $tmpl->assign('errors', $errors); $tmpl->printPage(); exit; } } }
/** * @brief Shortcut to print a simple page for guests * @param string $application The application we render the template for * @param string $name Name of the template * @param string $parameters Parameters for the template * @return bool */ public static function printGuestPage($application, $name, $parameters = array()) { $content = new OC_Template($application, $name, "guest"); foreach ($parameters as $key => $value) { $content->assign($key, $value, false); } return $content->printPage(); }
/** * return the content of a file or return a zip file containing multiple files * * @param string $dir * @param string $files ; separated list of files to download * @param boolean $only_header ; boolean to only send header of the request */ public static function get($dir, $files, $only_header = false) { $view = \OC\Files\Filesystem::getView(); $xsendfile = false; if (\OC::$server->getLockingProvider() instanceof NoopLockingProvider) { if (isset($_SERVER['MOD_X_SENDFILE_ENABLED']) || isset($_SERVER['MOD_X_SENDFILE2_ENABLED']) || isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])) { $xsendfile = true; } } if (is_array($files) && count($files) === 1) { $files = $files[0]; } if (is_array($files)) { $get_type = self::ZIP_FILES; $basename = basename($dir); if ($basename) { $name = $basename . '.zip'; } else { $name = 'download.zip'; } $filename = $dir . '/' . $name; } else { $filename = $dir . '/' . $files; if (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) { $get_type = self::ZIP_DIR; // downloading root ? if ($files === '') { $name = 'download.zip'; } else { $name = $files . '.zip'; } } else { $get_type = self::FILE; $name = $files; } } if ($get_type === self::FILE) { $zip = false; if ($xsendfile && \OC::$server->getEncryptionManager()->isEnabled()) { $xsendfile = false; } } else { $zip = new ZipStreamer(false); } OC_Util::obEnd(); try { if ($get_type === self::FILE) { $view->lockFile($filename, ILockingProvider::LOCK_SHARED); } if ($zip or \OC\Files\Filesystem::isReadable($filename)) { self::sendHeaders($filename, $name, $zip); } elseif (!\OC\Files\Filesystem::file_exists($filename)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OC_Template('', '404', 'guest'); $tmpl->printPage(); exit; } else { header("HTTP/1.0 403 Forbidden"); die('403 Forbidden'); } if ($only_header) { return; } if ($zip) { $executionTime = intval(ini_get('max_execution_time')); set_time_limit(0); if ($get_type === self::ZIP_FILES) { foreach ($files as $file) { $file = $dir . '/' . $file; if (\OC\Files\Filesystem::is_file($file)) { $fh = \OC\Files\Filesystem::fopen($file, 'r'); $zip->addFileFromStream($fh, basename($file)); fclose($fh); } elseif (\OC\Files\Filesystem::is_dir($file)) { self::zipAddDir($file, $zip); } } } elseif ($get_type === self::ZIP_DIR) { $file = $dir . '/' . $files; self::zipAddDir($file, $zip); } $zip->finalize(); set_time_limit($executionTime); } else { if ($xsendfile) { /** @var $storage \OC\Files\Storage\Storage */ list($storage) = $view->resolvePath($filename); if ($storage->isLocal()) { self::addSendfileHeader($filename); } else { \OC\Files\Filesystem::readfile($filename); } } else { \OC\Files\Filesystem::readfile($filename); } } if ($get_type === self::FILE) { $view->unlockFile($filename, ILockingProvider::LOCK_SHARED); } } catch (\OCP\Lock\LockedException $ex) { $l = \OC::$server->getL10N('core'); $hint = method_exists($ex, 'getHint') ? $ex->getHint() : ''; \OC_Template::printErrorPage($l->t('File is currently busy, please try again later'), $hint); } catch (\Exception $ex) { $l = \OC::$server->getL10N('core'); $hint = method_exists($ex, 'getHint') ? $ex->getHint() : ''; \OC_Template::printErrorPage($l->t('Can\'t read file'), $hint); } }
/** * @brief Post installation checks */ public static function postSetupCheck($params) { // setup was successful -> webdav testing now $l = self::getTrans(); if (OC_Util::isWebDAVWorking()) { header("Location: " . OC::$WEBROOT . '/'); } else { $error = $l->t('Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken.'); $hint = $l->t('Please double check the <a href=\'%s\'>installation guides</a>.', 'http://doc.owncloud.org/server/5.0/admin_manual/installation.html'); $tmpl = new OC_Template('', 'error', 'guest'); $tmpl->assign('errors', array(1 => array('error' => $error, 'hint' => $hint))); $tmpl->printPage(); exit; } }