| 
                                
                                    @@ 631-636 (lines=6) @@
                                 | 
                            
                                                            
                                    | 628 | 
                                     | 
                                    			$itemName = $path;  | 
                                
                                                            
                                    | 629 | 
                                     | 
                                     | 
                                
                                                            
                                    | 630 | 
                                     | 
                                    			// verify that the file exists before we try to share it  | 
                                
                                                            
                                    | 631 | 
                                     | 
                                    			if (!$path) { | 
                                
                                                            
                                    | 632 | 
                                     | 
                                    				$message = 'Sharing %s failed, because the file does not exist';  | 
                                
                                                            
                                    | 633 | 
                                     | 
                                    				$message_t = $l->t('Sharing %s failed, because the file does not exist', array($itemSourceName)); | 
                                
                                                            
                                    | 634 | 
                                     | 
                                    				\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::DEBUG); | 
                                
                                                            
                                    | 635 | 
                                     | 
                                    				throw new \Exception($message_t);  | 
                                
                                                            
                                    | 636 | 
                                     | 
                                    			}  | 
                                
                                                            
                                    | 637 | 
                                     | 
                                    			// verify that the user has share permission  | 
                                
                                                            
                                    | 638 | 
                                     | 
                                    			if (!\OC\Files\Filesystem::isSharable($path) || \OCP\Util::isSharingDisabledForUser()) { | 
                                
                                                            
                                    | 639 | 
                                     | 
                                    				$message = 'You are not allowed to share %s';  | 
                                
                                                                                
                                 | 
                                
                                    @@ 683-688 (lines=6) @@
                                 | 
                            
                                                            
                                    | 680 | 
                                     | 
                                     | 
                                
                                                            
                                    | 681 | 
                                     | 
                                    		// Verify share type and sharing conditions are met  | 
                                
                                                            
                                    | 682 | 
                                     | 
                                    		if ($shareType === self::SHARE_TYPE_USER) { | 
                                
                                                            
                                    | 683 | 
                                     | 
                                    			if ($shareWith == $uidOwner) { | 
                                
                                                            
                                    | 684 | 
                                     | 
                                    				$message = 'Sharing %s failed, because you can not share with yourself';  | 
                                
                                                            
                                    | 685 | 
                                     | 
                                    				$message_t = $l->t('Sharing %s failed, because you can not share with yourself', [$itemName]); | 
                                
                                                            
                                    | 686 | 
                                     | 
                                    				\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::DEBUG); | 
                                
                                                            
                                    | 687 | 
                                     | 
                                    				throw new \Exception($message_t);  | 
                                
                                                            
                                    | 688 | 
                                     | 
                                    			}  | 
                                
                                                            
                                    | 689 | 
                                     | 
                                    			if (!\OC_User::userExists($shareWith)) { | 
                                
                                                            
                                    | 690 | 
                                     | 
                                    				$message = 'Sharing %s failed, because the user %s does not exist';  | 
                                
                                                            
                                    | 691 | 
                                     | 
                                    				$message_t = $l->t('Sharing %s failed, because the user %s does not exist', array($itemSourceName, $shareWith)); | 
                                
                                                                                
                                 | 
                                
                                    @@ 882-888 (lines=7) @@
                                 | 
                            
                                                            
                                    | 879 | 
                                     | 
                                    			}  | 
                                
                                                            
                                    | 880 | 
                                     | 
                                     | 
                                
                                                            
                                    | 881 | 
                                     | 
                                    			return $send;  | 
                                
                                                            
                                    | 882 | 
                                     | 
                                    		} else { | 
                                
                                                            
                                    | 883 | 
                                     | 
                                    			// Future share types need to include their own conditions  | 
                                
                                                            
                                    | 884 | 
                                     | 
                                    			$message = 'Share type %s is not valid for %s';  | 
                                
                                                            
                                    | 885 | 
                                     | 
                                    			$message_t = $l->t('Share type %s is not valid for %s', array($shareType, $itemSource)); | 
                                
                                                            
                                    | 886 | 
                                     | 
                                    			\OCP\Util::writeLog('OCP\Share', sprintf($message, $shareType, $itemSource), \OCP\Util::DEBUG); | 
                                
                                                            
                                    | 887 | 
                                     | 
                                    			throw new \Exception($message_t);  | 
                                
                                                            
                                    | 888 | 
                                     | 
                                    		}  | 
                                
                                                            
                                    | 889 | 
                                     | 
                                     | 
                                
                                                            
                                    | 890 | 
                                     | 
                                    		// Put the item into the database  | 
                                
                                                            
                                    | 891 | 
                                     | 
                                    		$result = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, null, null, $itemSourceName, $expirationDate);  | 
                                
                                                                                
                                 | 
                                
                                    @@ 1227-1232 (lines=6) @@
                                 | 
                            
                                                            
                                    | 1224 | 
                                     | 
                                    			}  | 
                                
                                                            
                                    | 1225 | 
                                     | 
                                    		}  | 
                                
                                                            
                                    | 1226 | 
                                     | 
                                     | 
                                
                                                            
                                    | 1227 | 
                                     | 
                                    		if ($date < $today) { | 
                                
                                                            
                                    | 1228 | 
                                     | 
                                    			$message = 'Cannot set expiration date. Expiration date is in the past';  | 
                                
                                                            
                                    | 1229 | 
                                     | 
                                    			$message_t = $l->t('Cannot set expiration date. Expiration date is in the past'); | 
                                
                                                            
                                    | 1230 | 
                                     | 
                                    			\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::WARN); | 
                                
                                                            
                                    | 1231 | 
                                     | 
                                    			throw new \Exception($message_t);  | 
                                
                                                            
                                    | 1232 | 
                                     | 
                                    		}  | 
                                
                                                            
                                    | 1233 | 
                                     | 
                                     | 
                                
                                                            
                                    | 1234 | 
                                     | 
                                    		return $date;  | 
                                
                                                            
                                    | 1235 | 
                                     | 
                                    	}  | 
                                
                                                                                
                                 | 
                                
                                    @@ 1453-1458 (lines=6) @@
                                 | 
                            
                                                            
                                    | 1450 | 
                                     | 
                                    					throw new \Exception($message_t);  | 
                                
                                                            
                                    | 1451 | 
                                     | 
                                    				}  | 
                                
                                                            
                                    | 1452 | 
                                     | 
                                    				return self::$backends[$itemType];  | 
                                
                                                            
                                    | 1453 | 
                                     | 
                                    			} else { | 
                                
                                                            
                                    | 1454 | 
                                     | 
                                    				$message = 'Sharing backend %s not found';  | 
                                
                                                            
                                    | 1455 | 
                                     | 
                                    				$message_t = $l->t('Sharing backend %s not found', array($class)); | 
                                
                                                            
                                    | 1456 | 
                                     | 
                                    				\OCP\Util::writeLog('OCP\Share', sprintf($message, $class), \OCP\Util::ERROR); | 
                                
                                                            
                                    | 1457 | 
                                     | 
                                    				throw new \Exception($message_t);  | 
                                
                                                            
                                    | 1458 | 
                                     | 
                                    			}  | 
                                
                                                            
                                    | 1459 | 
                                     | 
                                    		}  | 
                                
                                                            
                                    | 1460 | 
                                     | 
                                    		$message = 'Sharing backend for %s not found';  | 
                                
                                                            
                                    | 1461 | 
                                     | 
                                    		$message_t = $l->t('Sharing backend for %s not found', array($itemType)); | 
                                
                                                                                
                                 | 
                                
                                    @@ 2280-2286 (lines=7) @@
                                 | 
                            
                                                            
                                    | 2277 | 
                                     | 
                                    						$result['fileSource'] = ($backend instanceof \OCP\Share_Backend_File_Dependent) ? $itemSource : null;  | 
                                
                                                            
                                    | 2278 | 
                                     | 
                                    					}  | 
                                
                                                            
                                    | 2279 | 
                                     | 
                                    				}  | 
                                
                                                            
                                    | 2280 | 
                                     | 
                                    			} else { | 
                                
                                                            
                                    | 2281 | 
                                     | 
                                    				$message = 'Sharing %s failed, because resharing is not allowed';  | 
                                
                                                            
                                    | 2282 | 
                                     | 
                                    				$message_t = $l->t('Sharing %s failed, because resharing is not allowed', array($itemSourceName)); | 
                                
                                                            
                                    | 2283 | 
                                     | 
                                     | 
                                
                                                            
                                    | 2284 | 
                                     | 
                                    				\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::DEBUG); | 
                                
                                                            
                                    | 2285 | 
                                     | 
                                    				throw new \Exception($message_t);  | 
                                
                                                            
                                    | 2286 | 
                                     | 
                                    			}  | 
                                
                                                            
                                    | 2287 | 
                                     | 
                                    		} else { | 
                                
                                                            
                                    | 2288 | 
                                     | 
                                    			$result['parent'] = null;  | 
                                
                                                            
                                    | 2289 | 
                                     | 
                                    			$result['suggestedItemTarget'] = null;  | 
                                
                                                                                
                                 | 
                                
                                    @@ 2308-2314 (lines=7) @@
                                 | 
                            
                                                            
                                    | 2305 | 
                                     | 
                                    					$meta = \OC\Files\Filesystem::getFileInfo($result['filePath']);  | 
                                
                                                            
                                    | 2306 | 
                                     | 
                                    					$result['fileSource'] = $meta['fileid'];  | 
                                
                                                            
                                    | 2307 | 
                                     | 
                                    				}  | 
                                
                                                            
                                    | 2308 | 
                                     | 
                                    				if ($result['fileSource'] == -1) { | 
                                
                                                            
                                    | 2309 | 
                                     | 
                                    					$message = 'Sharing %s failed, because the file could not be found in the file cache';  | 
                                
                                                            
                                    | 2310 | 
                                     | 
                                    					$message_t = $l->t('Sharing %s failed, because the file could not be found in the file cache', array($itemSource)); | 
                                
                                                            
                                    | 2311 | 
                                     | 
                                     | 
                                
                                                            
                                    | 2312 | 
                                     | 
                                    					\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource), \OCP\Util::DEBUG); | 
                                
                                                            
                                    | 2313 | 
                                     | 
                                    					throw new \Exception($message_t);  | 
                                
                                                            
                                    | 2314 | 
                                     | 
                                    				}  | 
                                
                                                            
                                    | 2315 | 
                                     | 
                                    			} else { | 
                                
                                                            
                                    | 2316 | 
                                     | 
                                    				$result['filePath'] = null;  | 
                                
                                                            
                                    | 2317 | 
                                     | 
                                    				$result['fileSource'] = null;  |