summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTom Needham <tom@owncloud.com>2013-02-09 12:05:48 +0000
committerTom Needham <tom@owncloud.com>2013-02-09 12:05:48 +0000
commit5d14a2cc463f09d010537a5537e3339a87d57558 (patch)
treee53b4fece6b204e7ffdaaa6ce3601ddaf25b5ba6 /lib
parenteefaefe87d4ef2271c7a079632744948ca8d2496 (diff)
parent0c73cae77b402355809c8f5f5be69d8a730fe3e2 (diff)
downloadnextcloud-server-5d14a2cc463f09d010537a5537e3339a87d57558.tar.gz
nextcloud-server-5d14a2cc463f09d010537a5537e3339a87d57558.zip
Merge in master
Diffstat (limited to 'lib')
-rw-r--r--lib/app.php9
-rw-r--r--lib/archive/tar.php2
-rw-r--r--lib/base.php26
-rw-r--r--lib/files/filesystem.php13
-rw-r--r--lib/files/storage/local.php4
-rw-r--r--lib/files/storage/temporary.php4
-rw-r--r--lib/helper.php7
-rw-r--r--lib/hook.php22
-rw-r--r--lib/l10n/af_ZA.php8
-rw-r--r--lib/l10n/lv.php31
-rw-r--r--lib/l10n/ru.php1
-rw-r--r--lib/public/share.php30
-rw-r--r--lib/public/util.php18
-rw-r--r--lib/router.php6
-rw-r--r--lib/template.php2
-rw-r--r--lib/templatelayout.php6
-rw-r--r--lib/user.php38
-rwxr-xr-xlib/util.php36
18 files changed, 217 insertions, 46 deletions
diff --git a/lib/app.php b/lib/app.php
index fa3e14ce4d2..3a4e21e8cd1 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -36,6 +36,7 @@ class OC_App{
static private $appTypes = array();
static private $loadedApps = array();
static private $checkedApps = array();
+ static private $altLogin = array();
/**
* @brief loads all apps
@@ -568,6 +569,14 @@ class OC_App{
self::$personalForms[]= $app.'/'.$page.'.php';
}
+ public static function registerLogIn($entry) {
+ self::$altLogin[] = $entry;
+ }
+
+ public static function getAlternativeLogIns() {
+ return self::$altLogin;
+ }
+
/**
* @brief: get a list of all apps in the apps folder
* @return array or app names (string IDs)
diff --git a/lib/archive/tar.php b/lib/archive/tar.php
index 117d88e5f42..e7c81389619 100644
--- a/lib/archive/tar.php
+++ b/lib/archive/tar.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once 'Archive/Tar.php';
+require_once OC::$THIRDPARTYROOT . '/3rdparty/Archive/Tar.php';
class OC_Archive_TAR extends OC_Archive{
const PLAIN=0;
diff --git a/lib/base.php b/lib/base.php
index 90e64f13af6..5bfdb0b7c0a 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -402,9 +402,11 @@ class OC {
self::initPaths();
- register_shutdown_function(array('OC_Log', 'onShutdown'));
- set_error_handler(array('OC_Log', 'onError'));
- set_exception_handler(array('OC_Log', 'onException'));
+ if (!defined('PHPUNIT_RUN')) {
+ register_shutdown_function(array('OC_Log', 'onShutdown'));
+ set_error_handler(array('OC_Log', 'onError'));
+ set_exception_handler(array('OC_Log', 'onException'));
+ }
// set debug mode if an xdebug session is active
if (!defined('DEBUG') || !DEBUG) {
@@ -552,14 +554,16 @@ class OC {
self::checkUpgrade();
}
- try {
- OC::getRouter()->match(OC_Request::getPathInfo());
- return;
- } catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
- //header('HTTP/1.0 404 Not Found');
- } catch (Symfony\Component\Routing\Exception\MethodNotAllowedException $e) {
- OC_Response::setStatus(405);
- return;
+ if (!self::$CLI) {
+ try {
+ OC::getRouter()->match(OC_Request::getPathInfo());
+ return;
+ } catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
+ //header('HTTP/1.0 404 Not Found');
+ } catch (Symfony\Component\Routing\Exception\MethodNotAllowedException $e) {
+ OC_Response::setStatus(405);
+ return;
+ }
}
$app = OC::$REQUESTEDAPP;
diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php
index 65d9ffab485..71bf3d8708d 100644
--- a/lib/files/filesystem.php
+++ b/lib/files/filesystem.php
@@ -527,8 +527,7 @@ class Filesystem {
}
/**
- * normalize a path
- *
+ * @brief Fix common problems with a file path
* @param string $path
* @param bool $stripTrailingSlash
* @return string
@@ -537,21 +536,21 @@ class Filesystem {
if ($path == '') {
return '/';
}
-//no windows style slashes
+ //no windows style slashes
$path = str_replace('\\', '/', $path);
-//add leading slash
+ //add leading slash
if ($path[0] !== '/') {
$path = '/' . $path;
}
-//remove duplicate slashes
+ //remove duplicate slashes
while (strpos($path, '//') !== false) {
$path = str_replace('//', '/', $path);
}
-//remove trailing slash
+ //remove trailing slash
if ($stripTrailingSlash and strlen($path) > 1 and substr($path, -1, 1) === '/') {
$path = substr($path, 0, -1);
}
-//normalize unicode if possible
+ //normalize unicode if possible
if (class_exists('Normalizer')) {
$path = \Normalizer::normalize($path);
}
diff --git a/lib/files/storage/local.php b/lib/files/storage/local.php
index 9fc9d375bb3..a5db4ba9194 100644
--- a/lib/files/storage/local.php
+++ b/lib/files/storage/local.php
@@ -184,7 +184,7 @@ class Local extends \OC\Files\Storage\Common{
// Windows OS: we use COM to access the filesystem
if (strpos($name, 'win') !== false) {
if (class_exists('COM')) {
- $fsobj = new COM("Scripting.FileSystemObject");
+ $fsobj = new \COM("Scripting.FileSystemObject");
$f = $fsobj->GetFile($fullPath);
return $f->Size;
}
@@ -197,7 +197,7 @@ class Local extends \OC\Files\Storage\Common{
return (float)exec('stat -c %s ' . escapeshellarg($fullPath));
}
} else {
- OC_Log::write('core', 'Unable to determine file size of "'.$fullPath.'". Unknown OS: '.$name, OC_Log::ERROR);
+ \OC_Log::write('core', 'Unable to determine file size of "'.$fullPath.'". Unknown OS: '.$name, \OC_Log::ERROR);
}
return 0;
diff --git a/lib/files/storage/temporary.php b/lib/files/storage/temporary.php
index ffc55e27507..542d2cd9f48 100644
--- a/lib/files/storage/temporary.php
+++ b/lib/files/storage/temporary.php
@@ -9,11 +9,11 @@
namespace OC\Files\Storage;
/**
- * local storage backnd in temporary folder for testing purpores
+ * local storage backend in temporary folder for testing purpose
*/
class Temporary extends Local{
public function __construct($arguments) {
- $this->datadir=\OC_Helper::tmpFolder();
+ parent::__construct(array('datadir' => \OC_Helper::tmpFolder()));
}
public function cleanUp() {
diff --git a/lib/helper.php b/lib/helper.php
index 0e549d006a1..a0fbdd10394 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -394,13 +394,12 @@ class OC_Helper {
// it looks like we have a 'file' command,
// lets see if it does have mime support
$path=escapeshellarg($path);
- $fp = popen("file -i -b $path 2>/dev/null", "r");
+ $fp = popen("file -b --mime-type $path 2>/dev/null", "r");
$reply = fgets($fp);
pclose($fp);
- // we have smth like 'text/x-c++; charset=us-ascii\n'
- // and need to eliminate everything starting with semicolon including trailing LF
- $mimeType = preg_replace('/;.*/ms', '', trim($reply));
+ //trim the newline
+ $mimeType = trim($reply);
}
return $mimeType;
diff --git a/lib/hook.php b/lib/hook.php
index 4da331bb5d8..e30aefb5e18 100644
--- a/lib/hook.php
+++ b/lib/hook.php
@@ -20,19 +20,22 @@ class OC_Hook{
* TODO: write example
*/
static public function connect( $signalclass, $signalname, $slotclass, $slotname ) {
- // Create the data structure
+ // If we're trying to connect to an emitting class that isn't
+ // yet registered, register it
if( !array_key_exists( $signalclass, self::$registered )) {
self::$registered[$signalclass] = array();
}
- if( !array_key_exists( $signalname, self::$registered[$signalclass] )) {
+ // If we're trying to connect to an emitting method that isn't
+ // yet registered, register it with the emitting class
+ if( !array_key_exists( $signalname, self::$registered[$signalclass] )) {
self::$registered[$signalclass][$signalname] = array();
}
-
- // register hook
+
+ // Connect the hook handler to the requested emitter
self::$registered[$signalclass][$signalname][] = array(
"class" => $slotclass,
"name" => $slotname );
-
+
// No chance for failure ;-)
return true;
}
@@ -49,14 +52,19 @@ class OC_Hook{
* TODO: write example
*/
static public function emit( $signalclass, $signalname, $params = array()) {
- // Return false if there are no slots
+
+ // Return false if no hook handlers are listening to this
+ // emitting class
if( !array_key_exists( $signalclass, self::$registered )) {
return false;
}
+
+ // Return false if no hook handlers are listening to this
+ // emitting method
if( !array_key_exists( $signalname, self::$registered[$signalclass] )) {
return false;
}
-
+
// Call all slots
foreach( self::$registered[$signalclass][$signalname] as $i ) {
try {
diff --git a/lib/l10n/af_ZA.php b/lib/l10n/af_ZA.php
new file mode 100644
index 00000000000..38e91288fbe
--- /dev/null
+++ b/lib/l10n/af_ZA.php
@@ -0,0 +1,8 @@
+<?php $TRANSLATIONS = array(
+"Help" => "Hulp",
+"Personal" => "Persoonlik",
+"Settings" => "Instellings",
+"Users" => "Gebruikers",
+"Apps" => "Toepassings",
+"Admin" => "Admin"
+);
diff --git a/lib/l10n/lv.php b/lib/l10n/lv.php
index 3330d0e6b70..9f2a0dea749 100644
--- a/lib/l10n/lv.php
+++ b/lib/l10n/lv.php
@@ -3,6 +3,33 @@
"Personal" => "Personīgi",
"Settings" => "Iestatījumi",
"Users" => "Lietotāji",
-"Authentication error" => "Ielogošanās kļūme",
-"Files" => "Faili"
+"Apps" => "Lietotnes",
+"Admin" => "Administratori",
+"ZIP download is turned off." => "ZIP lejupielādēšana ir izslēgta.",
+"Files need to be downloaded one by one." => "Datnes var lejupielādēt tikai katru atsevišķi.",
+"Back to Files" => "Atpakaļ pie datnēm",
+"Selected files too large to generate zip file." => "Izvēlētās datnes ir pārāk lielas, lai izveidotu zip datni.",
+"couldn't be determined" => "nevarēja noteikt",
+"Application is not enabled" => "Lietotne nav aktivēta",
+"Authentication error" => "Autentifikācijas kļūda",
+"Token expired. Please reload page." => "Pilnvarai ir beidzies termiņš. Lūdzu, pārlādējiet lapu.",
+"Files" => "Datnes",
+"Text" => "Teksts",
+"Images" => "Attēli",
+"seconds ago" => "sekundes atpakaļ",
+"1 minute ago" => "pirms 1 minūtes",
+"%d minutes ago" => "pirms %d minūtēm",
+"1 hour ago" => "pirms 1 stundas",
+"%d hours ago" => "pirms %d stundām",
+"today" => "šodien",
+"yesterday" => "vakar",
+"%d days ago" => "pirms %d dienām",
+"last month" => "pagājušajā mēnesī",
+"%d months ago" => "pirms %d mēnešiem",
+"last year" => "gājušajā gadā",
+"years ago" => "gadus atpakaļ",
+"%s is available. Get <a href=\"%s\">more information</a>" => "%s ir pieejams. Iegūt <a href=\"%s\">vairāk informācijas</a>",
+"up to date" => "ir aktuāls",
+"updates check is disabled" => "atjauninājumu pārbaude ir deaktivēta",
+"Could not find category \"%s\"" => "Nevarēja atrast kategoriju “%s”"
);
diff --git a/lib/l10n/ru.php b/lib/l10n/ru.php
index 3ed55f8e9dc..5ef2cca3be3 100644
--- a/lib/l10n/ru.php
+++ b/lib/l10n/ru.php
@@ -9,6 +9,7 @@
"Files need to be downloaded one by one." => "Файлы должны быть загружены по одному.",
"Back to Files" => "Назад к файлам",
"Selected files too large to generate zip file." => "Выбранные файлы слишком велики, чтобы создать zip файл.",
+"couldn't be determined" => "Невозможно установить",
"Application is not enabled" => "Приложение не разрешено",
"Authentication error" => "Ошибка аутентификации",
"Token expired. Please reload page." => "Токен просрочен. Перезагрузите страницу.",
diff --git a/lib/public/share.php b/lib/public/share.php
index 3c5c2d53782..af2a538e252 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -342,6 +342,13 @@ class Share {
*/
public static function unshare($itemType, $itemSource, $shareType, $shareWith) {
if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, null, 1)) {
+ // Pass all the vars we have for now, they may be useful
+ \OC_Hook::emit('OCP\Share', 'pre_unshare', array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'shareType' => $shareType,
+ 'shareWith' => $shareWith,
+ ));
self::delete($item['id']);
return true;
}
@@ -356,6 +363,12 @@ class Share {
*/
public static function unshareAll($itemType, $itemSource) {
if ($shares = self::getItemShared($itemType, $itemSource)) {
+ // Pass all the vars we have for now, they may be useful
+ \OC_Hook::emit('OCP\Share', 'pre_unshareAll', array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'shares' => $shares
+ ));
foreach ($shares as $share) {
self::delete($share['id']);
}
@@ -516,7 +529,8 @@ class Share {
$collectionTypes[] = $type;
}
}
- if (!self::getBackend($itemType) instanceof Share_Backend_Collection) {
+ // TODO Add option for collections to be collection of themselves, only 'folder' does it now...
+ if (!self::getBackend($itemType) instanceof Share_Backend_Collection || $itemType != 'folder') {
unset($collectionTypes[0]);
}
// Return array if collections were found or the item type is a collection itself - collections can be inside collections
@@ -690,7 +704,7 @@ class Share {
$select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`, `uid_owner`, '
.'`share_type`, `share_with`, `file_source`, `path`, `file_target`, '
.'`permissions`, `expiration`, `storage`, `*PREFIX*filecache`.`parent` as `file_parent`, '
- .'`name` `mtime`, `mimetype`, `mimepart`, `size`, `encrypted`, `etag`';
+ .'`name`, `mtime`, `mimetype`, `mimepart`, `size`, `encrypted`, `etag`';
} else {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`, `*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`, `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`, `token`';
}
@@ -707,6 +721,7 @@ class Share {
}
$items = array();
$targets = array();
+ $switchedItems = array();
while ($row = $result->fetchRow()) {
// Filter out duplicate group shares for users with unique targets
if ($row['share_type'] == self::$shareTypeGroupUserUnique && isset($items[$row['parent']])) {
@@ -731,6 +746,7 @@ class Share {
// Switch ids if sharing permission is granted on only one share to ensure correct parent is used if resharing
if (~(int)$items[$id]['permissions'] & PERMISSION_SHARE && (int)$row['permissions'] & PERMISSION_SHARE) {
$items[$row['id']] = $items[$id];
+ $switchedItems[$id] = $row['id'];
unset($items[$id]);
$id = $row['id'];
}
@@ -763,8 +779,8 @@ class Share {
if ( isset($row['share_with']) && $row['share_with'] != '') {
$row['share_with_displayname'] = \OCP\User::getDisplayName($row['share_with']);
}
- if ( isset($row['uid_owner']) && $row['uid_owner'] != '') {
- $row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']);
+ if ( isset($row['uid_owner']) && $row['uid_owner'] != '') {
+ $row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']);
}
$items[$row['id']] = $row;
@@ -834,7 +850,11 @@ class Share {
}
}
// Remove collection item
- unset($items[$row['id']]);
+ $toRemove = $row['id'];
+ if (array_key_exists($toRemove, $switchedItems)) {
+ $toRemove = $switchedItems[$toRemove];
+ }
+ unset($items[$toRemove]);
}
}
if (!empty($collectionItems)) {
diff --git a/lib/public/util.php b/lib/public/util.php
index a78a52f326e..5f6ede4460e 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -59,9 +59,9 @@ class Util {
* @param string $fromname
* @param bool $html
*/
- public static function sendMail( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html=0, $altbody='', $ccaddress='', $ccname='', $bcc='') {
+ public static function sendMail( $toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '') {
// call the internal mail class
- \OC_MAIL::send($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '');
+ \OC_MAIL::send($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html, $altbody, $ccaddress, $ccname, $bcc);
}
/**
@@ -148,6 +148,20 @@ class Util {
}
/**
+ * @brief Creates an url using a defined route
+ * @param $route
+ * @param array $parameters
+ * @return
+ * @internal param array $args with param=>value, will be appended to the returned url
+ * @returns the url
+ *
+ * Returns a url to the given app and file.
+ */
+ public static function linkToRoute( $route, $parameters = array() ) {
+ return \OC_Helper::linkToRoute($route, $parameters);
+ }
+
+ /**
* @brief Creates an url
* @param string $app app
* @param string $file file
diff --git a/lib/router.php b/lib/router.php
index 746b68c2c0c..dbaca9e0d5d 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -23,7 +23,11 @@ class OC_Router {
public function __construct() {
$baseUrl = OC_Helper::linkTo('', 'index.php');
- $method = $_SERVER['REQUEST_METHOD'];
+ if ( !OC::$CLI) {
+ $method = $_SERVER['REQUEST_METHOD'];
+ }else{
+ $method = 'GET';
+ }
$host = OC_Request::serverHost();
$schema = OC_Request::serverProtocol();
$this->context = new RequestContext($baseUrl, $method, $host, $schema);
diff --git a/lib/template.php b/lib/template.php
index 238d8a8ad0f..fb9f7ad62d9 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -192,7 +192,7 @@ class OC_Template{
// Content Security Policy
// If you change the standard policy, please also change it in config.sample.php
- $policy = OC_Config::getValue('custom_csp_policy', 'default-src \'self\'; script-src \'self\' \'unsafe-eval\'; style-src \'self\' \'unsafe-inline\'; frame-src *; img-src *');
+ $policy = OC_Config::getValue('custom_csp_policy', 'default-src \'self\'; script-src \'self\' \'unsafe-eval\'; style-src \'self\' \'unsafe-inline\'; frame-src *; img-src *; font-src \'self\' data:');
header('Content-Security-Policy:'.$policy); // Standard
header('X-WebKit-CSP:'.$policy); // Older webkit browsers
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index 37ece91047f..345f540af04 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -19,6 +19,7 @@ class OC_TemplateLayout extends OC_Template {
}
// Add navigation entry
+ $this->assign( 'application', '', false );
$navigation = OC_App::getNavigation();
$this->assign( 'navigation', $navigation, false);
$this->assign( 'settingsnavigation', OC_App::getSettingsNavigation(), false);
@@ -28,6 +29,8 @@ class OC_TemplateLayout extends OC_Template {
break;
}
}
+ $user_displayname = OC_User::getDisplayName();
+ $this->assign( 'user_displayname', $user_displayname );
} else if ($renderas == 'guest') {
parent::__construct('core', 'layout.guest');
} else {
@@ -36,6 +39,9 @@ class OC_TemplateLayout extends OC_Template {
// Add the js files
$jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array(), false);
+ if (OC_Config::getValue('installed', false)) {
+ $this->append( 'jsfiles', OC_Helper::linkToRoute('js_config'));
+ }
if (!empty(OC_Util::$core_scripts)) {
$this->append( 'jsfiles', OC_Helper::linkToRemoteBase('core.js', false));
}
diff --git a/lib/user.php b/lib/user.php
index 38259bceea5..9dc8cca97a6 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -275,7 +275,7 @@ class OC_User {
foreach(self::$_usedBackends as $backend) {
if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) {
if($backend->userExists($uid)) {
- $success |= $backend->setDisplayName($uid, $displayName);
+ $result |= $backend->setDisplayName($uid, $displayName);
}
}
}
@@ -420,6 +420,42 @@ class OC_User {
}
/**
+ * @brief Check whether user can change his password
+ * @param $uid The username
+ * @returns true/false
+ *
+ * Check whether a specified user can change his password
+ */
+ public static function canUserChangePassword($uid) {
+ foreach(self::$_usedBackends as $backend) {
+ if($backend->implementsActions(OC_USER_BACKEND_SET_PASSWORD)) {
+ if($backend->userExists($uid)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @brief Check whether user can change his display name
+ * @param $uid The username
+ * @returns true/false
+ *
+ * Check whether a specified user can change his display name
+ */
+ public static function canUserChangeDisplayName($uid) {
+ foreach(self::$_usedBackends as $backend) {
+ if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) {
+ if($backend->userExists($uid)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
* @brief Check if the password is correct
* @param $uid The username
* @param $password The password
diff --git a/lib/util.php b/lib/util.php
index 91970ab2b96..9ce974619bc 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -243,6 +243,17 @@ class OC_Util {
$web_server_restart= false;
}
+ $handler = ini_get("session.save_handler");
+ if($handler == "files") {
+ $tmpDir = session_save_path();
+ if($tmpDir != ""){
+ if(!@is_writable($tmpDir)){
+ $errors[]=array('error' => 'The temporary folder used by PHP to save the session data is either incorrect or not writable! Please check : '.session_save_path().'<br/>',
+ 'hint'=>'Please ask your server administrator to grant write access or define another temporary folder.');
+ }
+ }
+ }
+
if($web_server_restart) {
$errors[]=array('error'=>'PHP modules have been installed, but they are still listed as missing?<br/>', 'hint'=>'Please ask your server administrator to restart the web server.');
}
@@ -289,6 +300,8 @@ class OC_Util {
$redirect_url = OC_Util::sanitizeHTML($_REQUEST['redirect_url']);
$parameters['redirect_url'] = urlencode($redirect_url);
}
+
+ $parameters['alt_login'] = OC_App::getAlternativeLogIns();
OC_Template::printGuestPage("", "login", $parameters);
}
@@ -508,6 +521,11 @@ class OC_Util {
* Check if the setlocal call doesn't work. This can happen if the right local packages are not available on the server.
*/
public static function issetlocaleworking() {
+ // setlocale test is pointless on Windows
+ if (OC_Util::runningOnWindows() ) {
+ return true;
+ }
+
$result=setlocale(LC_ALL, 'en_US.UTF-8');
if($result==false) {
return(false);
@@ -517,6 +535,14 @@ class OC_Util {
}
/**
+ * Check if the PHP module fileinfo is loaded.
+ * @return bool
+ */
+ public static function fileInfoLoaded() {
+ return function_exists('finfo_open');
+ }
+
+ /**
* Check if the ownCloud server can connect to the internet
*/
public static function isinternetconnectionworking() {
@@ -628,6 +654,9 @@ class OC_Util {
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($curl, CURLOPT_MAXREDIRS, 10);
+
curl_setopt($curl, CURLOPT_USERAGENT, "ownCloud Server Crawler");
if(OC_Config::getValue('proxy','')<>'') {
curl_setopt($curl, CURLOPT_PROXY, OC_Config::getValue('proxy'));
@@ -666,4 +695,11 @@ class OC_Util {
return $data;
}
+ /**
+ * @return bool - well are we running on windows or not
+ */
+ public static function runningOnWindows() {
+ return (substr(PHP_OS, 0, 3) === "WIN");
+ }
+
}