Merge pull request #389 from owncloud/scrut
Fix some issues found by code inspector
This commit is contained in:
		
						commit
						36aca68e0c
					
				| @ -123,7 +123,7 @@ class SessionController extends Controller{ | ||||
| 			} | ||||
| 
 | ||||
| 			try { | ||||
| 				$file = new File($session->getFileId()); | ||||
| 				new File($session->getFileId()); | ||||
| 			} catch (\Exception $e){ | ||||
| 				$this->logger->warning('Error. Session no longer exists. ' . $e->getMessage(), array('app' => $this->appName)); | ||||
| 				$ex = new BadRequestException(); | ||||
| @ -199,7 +199,6 @@ class SessionController extends Controller{ | ||||
| 							implode(',', $this->request->getParams()) | ||||
| 					); | ||||
| 					throw $ex; | ||||
| 					break; | ||||
| 			} | ||||
| 		} catch (BadRequestException $e){ | ||||
| 			$response->setStatus(Http::STATUS_BAD_REQUEST); | ||||
|  | ||||
| @ -48,7 +48,7 @@ abstract class Db { | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Get single record by primary key | ||||
| 	 * @param type $value primary key value | ||||
| 	 * @param int $value primary key value | ||||
| 	 * @return \OCA\Documents\Db | ||||
| 	 */ | ||||
| 	public function load($value){ | ||||
|  | ||||
| @ -12,13 +12,19 @@ | ||||
| namespace OCA\Documents; | ||||
| 
 | ||||
| use \OCP\AppFramework\Http; | ||||
| use \OCP\IRequest; | ||||
| 
 | ||||
| class DownloadResponse extends \OCP\AppFramework\Http\Response { | ||||
| 	private $request; | ||||
| 	private $view; | ||||
| 	private $path; | ||||
| 	 | ||||
| 	public function __construct($request, $user, $path) { | ||||
| 	/** | ||||
| 	 * @param IRequest $request | ||||
| 	 * @param string $user | ||||
| 	 * @param string $path | ||||
| 	 */ | ||||
| 	public function __construct(IRequest $request, $user, $path) { | ||||
| 		$this->request = $request; | ||||
| 		$this->user = $user; | ||||
| 		$this->path = $path; | ||||
| @ -90,6 +96,7 @@ class DownloadResponse extends \OCP\AppFramework\Http\Response { | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Send 416 if we can't satisfy the requested ranges | ||||
| 	 * @param integer $filesize | ||||
| 	 */ | ||||
| 	protected function sendRangeNotSatisfiable($filesize){ | ||||
| 		$this->setStatus(Http::STATUS_REQUEST_RANGE_NOT_SATISFIABLE); | ||||
|  | ||||
| @ -93,6 +93,10 @@ class File { | ||||
| 		return $this->passwordProtected; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @param string $password | ||||
| 	 * @return boolean | ||||
| 	 */ | ||||
| 	public function checkPassword($password){ | ||||
| 		$shareId  = $this->sharing[0]['id']; | ||||
| 		if (!$this->isPasswordProtected() | ||||
| @ -119,6 +123,9 @@ class File { | ||||
| 		return false; | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * @param boolean $value | ||||
| 	 */ | ||||
| 	public function setPasswordProtected($value){ | ||||
| 		$this->passwordProtected = $value; | ||||
| 	} | ||||
|  | ||||
| @ -35,7 +35,7 @@ class Genesis { | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Create new genesis document | ||||
| 	 * @param OCA\Documents\File $file  | ||||
| 	 * @param File $file  | ||||
| 	 * */	 | ||||
| 	public function __construct(\OCA\Documents\File $file){ | ||||
| 		list($view, $path) = $file->getOwnerViewAndPath(); | ||||
|  | ||||
| @ -43,6 +43,10 @@ class Helper { | ||||
| 		return '#' . str_pad($str, 6, "0", STR_PAD_LEFT); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @param string $name | ||||
| 	 * @return string | ||||
| 	 */ | ||||
| 	public static function getMemberColor($name){ | ||||
| 		$hash = md5($name); | ||||
| 		$maxRange = hexdec('ffffffffffffffffffffffffffffffff'); | ||||
| @ -50,22 +54,30 @@ class Helper { | ||||
| 		return '#' . self::convertHSLToRGB($hue, 90, 60); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @param string $message | ||||
| 	 */ | ||||
| 	public static function debugLog($message){ | ||||
| 		self::log($message, \OCP\Util::DEBUG); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @param string $message | ||||
| 	 */ | ||||
| 	public static function warnLog($message){ | ||||
| 		self::log($message, \OCP\Util::WARN); | ||||
| 	} | ||||
| 
 | ||||
| 	public static function errorLog($message){ | ||||
| 		self::log($message, \OCP\Util::ERROR); | ||||
| 	} | ||||
| 
 | ||||
| 	public static function log($message, $level){ | ||||
| 		\OCP\Util::writeLog(self::APP_ID, $message, $level); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @param integer $iH | ||||
| 	 * @param integer $iS | ||||
| 	 * @param integer $iV | ||||
| 	 * @return string | ||||
| 	 */ | ||||
| 	protected static function convertHSLToRGB($iH, $iS, $iV){ | ||||
| 		if ($iH < 0){ | ||||
| 			$iH = 0;   // Hue:
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user