diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2012-06-14 13:44:42 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2012-06-14 13:44:42 +0200 |
commit | 87855f2506d6ef3a36b5b574966c8373ab9d4b92 (patch) | |
tree | 13781a051dcb44c86841c7f013eed3aace32d783 | |
parent | 211a546600de0d108d3c1b66602dec681ff18837 (diff) | |
parent | 8fd9cbcc54190f9f3afd7e74ed295216953c7383 (diff) | |
download | nextcloud-server-87855f2506d6ef3a36b5b574966c8373ab9d4b92.tar.gz nextcloud-server-87855f2506d6ef3a36b5b574966c8373ab9d4b92.zip |
Merge branch 'master' of gitorious.org:owncloud/owncloud
-rw-r--r-- | apps/contacts/templates/part.cropphoto.php | 4 | ||||
-rw-r--r-- | lib/helper.php | 74 | ||||
-rw-r--r-- | lib/public/util.php | 22 |
3 files changed, 48 insertions, 52 deletions
diff --git a/apps/contacts/templates/part.cropphoto.php b/apps/contacts/templates/part.cropphoto.php index 1e025ef4e0c..1079afc808a 100644 --- a/apps/contacts/templates/part.cropphoto.php +++ b/apps/contacts/templates/part.cropphoto.php @@ -1,7 +1,7 @@ <?php $id = $_['id']; $tmpkey = $_['tmpkey']; -$csrf_token = $_GET['csrf_token']; +$requesttoken = $_['requesttoken']; OCP\Util::writeLog('contacts','templates/part.cropphoto.php: tmpkey: '.$tmpkey, OCP\Util::DEBUG); ?> <script language="Javascript"> @@ -49,7 +49,7 @@ OCP\Util::writeLog('contacts','templates/part.cropphoto.php: tmpkey: '.$tmpkey, action="<?php echo OCP\Util::linkToAbsolute('contacts', 'ajax/savecrop.php'); ?>"> <input type="hidden" id="id" name="id" value="<?php echo $id; ?>" /> - <input type="hidden" name="requesttoken" value="<?php echo $csrf_token; ?>"> + <input type="hidden" name="requesttoken" value="<?php echo $requesttoken; ?>"> <input type="hidden" id="tmpkey" name="tmpkey" value="<?php echo $tmpkey; ?>" /> <fieldset id="coords"> <input type="hidden" id="x1" name="x1" value="" /> diff --git a/lib/helper.php b/lib/helper.php index decc1d61336..2ded7b13c38 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -90,12 +90,12 @@ class OC_Helper { } - /** - * @brief Returns the server protocol - * @returns the server protocol - * - * Returns the server protocol. It respects reverse proxy servers and load balancers - */ + /** + * @brief Returns the server protocol + * @returns the server protocol + * + * Returns the server protocol. It respects reverse proxy servers and load balancers + */ public static function serverProtocol() { if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { $proto = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']); @@ -132,7 +132,7 @@ class OC_Helper { * Returns a absolute url to the given service. */ public static function linkToRemote( $service, $add_slash = true ) { - return self::linkToAbsolute( '', 'remote.php') . '/' . $service . ($add_slash?'/':''); + return self::linkToAbsolute( '', 'remote.php') . '/' . $service . (($add_slash && $service[strlen($service)-1]!='/')?'/':''); } /** @@ -143,7 +143,7 @@ class OC_Helper { * * Returns the path to the image. */ - public static function imagePath( $app, $image ){ + public static function imagePath( $app, $image ){ // Read the selected theme from the config file $theme=OC_Config::getValue( "theme" ); @@ -551,35 +551,35 @@ class OC_Helper { } } - /** - * Adds a suffix to the name in case the file exists - * - * @param $path - * @param $filename - * @return string - */ - public static function buildNotExistingFileName($path, $filename){ - if($path==='/'){ - $path=''; - } - if ($pos = strrpos($filename, '.')) { - $name = substr($filename, 0, $pos); - $ext = substr($filename, $pos); - } else { - $name = $filename; - } - - $newpath = $path . '/' . $filename; - $newname = $filename; - $counter = 2; - while (OC_Filesystem::file_exists($newpath)) { - $newname = $name . ' (' . $counter . ')' . $ext; - $newpath = $path . '/' . $newname; - $counter++; - } - - return $newpath; - } + /** + * Adds a suffix to the name in case the file exists + * + * @param $path + * @param $filename + * @return string + */ + public static function buildNotExistingFileName($path, $filename){ + if($path==='/'){ + $path=''; + } + if ($pos = strrpos($filename, '.')) { + $name = substr($filename, 0, $pos); + $ext = substr($filename, $pos); + } else { + $name = $filename; + } + + $newpath = $path . '/' . $filename; + $newname = $filename; + $counter = 2; + while (OC_Filesystem::file_exists($newpath)) { + $newname = $name . ' (' . $counter . ')' . $ext; + $newpath = $path . '/' . $newname; + $counter++; + } + + return $newpath; + } /* * checks if $sub is a subdirectory of $parent diff --git a/lib/public/util.php b/lib/public/util.php index 995161e2abe..d79d3f26b1e 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -145,15 +145,15 @@ class Util { } - /** - * @brief Creates an url - * @param $app app - * @param $file file - * @returns the url - * - * Returns a url to the given app and file. - */ - public static function linkTo( $app, $file ){ + /** + * @brief Creates an url + * @param $app app + * @param $file file + * @returns the url + * + * Returns a url to the given app and file. + */ + public static function linkTo( $app, $file ){ return(\OC_Helper::linkTo( $app, $file )); } @@ -264,10 +264,6 @@ class Util { public static function callCheck(){ return(\OC_Util::callCheck()); } - - - - } ?> |