summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2012-05-07 22:56:34 +0200
committerFrank Karlitschek <frank@owncloud.org>2012-05-07 22:56:34 +0200
commit10d291d6b3bf25794a8edaea6c867788b717eb15 (patch)
tree1b83402cd97b609d5afd719fb41e7650eb81e7fa /lib
parent40b823bc8be138057c0e03c7f52cde8231386cdd (diff)
parent4dbc2093c680bebaa42f230937be88a58984c5bd (diff)
downloadnextcloud-server-10d291d6b3bf25794a8edaea6c867788b717eb15.tar.gz
nextcloud-server-10d291d6b3bf25794a8edaea6c867788b717eb15.zip
Merge branch 'master' of gitorious.org:owncloud/owncloud
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php4
-rw-r--r--lib/filecache.php2
-rw-r--r--lib/helper.php25
-rw-r--r--lib/public/util.php14
-rw-r--r--lib/user.php6
5 files changed, 36 insertions, 15 deletions
diff --git a/lib/base.php b/lib/base.php
index 40df2b0c56c..14f2439ecbd 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -443,8 +443,8 @@ class OC{
$_GET['getfile'] = $file;
}
if(!is_null(self::$REQUESTEDFILE)){
- $subdir = OC::$APPSROOT . '/' . self::$REQUESTEDAPP . '/' . self::$REQUESTEDFILE;
- $parent = OC::$APPSROOT . '/' . self::$REQUESTEDAPP;
+ $subdir = OC::$APPSROOT . '/apps/' . self::$REQUESTEDAPP . '/' . self::$REQUESTEDFILE;
+ $parent = OC::$APPSROOT . '/apps/' . self::$REQUESTEDAPP;
if(!OC_Helper::issubdirectory($subdir, $parent)){
self::$REQUESTEDFILE = null;
header('HTTP/1.0 404 Not Found');
diff --git a/lib/filecache.php b/lib/filecache.php
index 091a7939e1a..8763865c8c3 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -655,7 +655,7 @@ class OC_FileCache{
}else{
$view=new OC_FilesystemView(($root=='/')?'':$root);
}
- $dh=$view->opendir($path);
+ $dh=$view->opendir($path.'/');
if($dh){//check for changed/new files
while (($filename = readdir($dh)) !== false) {
if($filename != '.' and $filename != '..'){
diff --git a/lib/helper.php b/lib/helper.php
index 2ddd5e7b778..f5e247ca9eb 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -41,15 +41,15 @@ class OC_Helper {
$app .= '/';
// Check if the app is in the app folder
if( file_exists( OC::$APPSROOT . '/apps/'. $app.$file )){
- if(substr($file, -3) == 'php' || substr($file, -3) == 'css'){
+ //if(substr($file, -3) == 'php' || substr($file, -3) == 'css'){
if(substr($app, -1, 1) == '/'){
$app = substr($app, 0, strlen($app) - 1);
}
$urlLinkTo = OC::$WEBROOT . '/?app=' . $app;
$urlLinkTo .= ($file!='index.php')?'&getfile=' . urlencode($file):'';
- }else{
- $urlLinkTo = OC::$APPSWEBROOT . '/apps/' . $app . $file;
- }
+ //}else{
+ // $urlLinkTo = OC::$APPSWEBROOT . '/apps/' . $app . $file;
+ //}
}
else{
$urlLinkTo = OC::$WEBROOT . '/' . $app . $file;
@@ -106,6 +106,17 @@ class OC_Helper {
}
/**
+ * @brief Creates an absolute url for remote use
+ * @param $service id
+ * @returns the url
+ *
+ * Returns a absolute url to the given service.
+ */
+ public static function linkToRemote( $service ) {
+ return self::linkToAbsolute( '', 'remote.php') . '/' . $service . '/';
+ }
+
+ /**
* @brief Creates path to an image
* @param $app app
* @param $image image name
@@ -576,14 +587,12 @@ class OC_Helper {
return true;
}
}
- /*
- echo 'SUB: ' . $sub . "\n";
+ /*echo 'SUB: ' . $sub . "\n";
echo 'PAR: ' . $parent . "\n";
echo 'REALSUB: ' . $realpath_sub . "\n";
echo 'REALPAR: ' . $realpath_parent . "\n";
echo substr($realpath_sub, 0, strlen($realpath_parent));
- exit;
- */
+ exit;*/
return false;
}
}
diff --git a/lib/public/util.php b/lib/public/util.php
index 4068d73370d..f9f3759fe5b 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -130,6 +130,18 @@ class Util {
}
+ /**
+ * @brief Creates an absolute url for remote use
+ * @param $service id
+ * @returns the url
+ *
+ * Returns a absolute url to the given app and file.
+ */
+ public static function linkToRemote( $service ) {
+ return(\OC_Helper::linkToRemote( $service ));
+ }
+
+
/**
* @brief Creates an url
* @param $app app
@@ -150,7 +162,7 @@ class Util {
* reverse proxies
*/
public static function getServerHost() {
- return(\OC_Helper::severHost());
+ return(\OC_Helper::serverHost());
}
/**
diff --git a/lib/user.php b/lib/user.php
index 8b887559df3..816caff8dd8 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -117,15 +117,15 @@ class OC_User {
// Check the name for bad characters
// Allowed are: "a-z", "A-Z", "0-9" and "_.@-"
if( preg_match( '/[^a-zA-Z0-9 _\.@\-]/', $uid )){
- return false;
+ throw new Exception('Only the following characters are allowed in a username: "a-z", "A-Z", "0-9", and "_.@-"');
}
// No empty username
if(trim($uid) == ''){
- return false;
+ throw new Exception('A valid username must be provided');
}
// Check if user already exists
if( self::userExists($uid) ){
- return false;
+ throw new Exception('The username is already being used');
}