@ -599,7 +599,7 @@ class Share extends Constants {
if ( $backend -> isShareTypeAllowed ( $shareType ) === false ) {
$message = 'Sharing %s failed, because the backend does not allow shares from type %i' ;
$message_t = $l -> t ( 'Sharing %s failed, because the backend does not allow shares from type %i' , array ( $itemSourceName , $shareType ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareType ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareType ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
@ -617,14 +617,14 @@ class Share extends Constants {
if ( ! $path ) {
$message = 'Sharing %s failed, because the file does not exist' ;
$message_t = $l -> t ( 'Sharing %s failed, because the file does not exist' , array ( $itemSourceName ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
// verify that the user has share permission
if ( ! \OC\Files\Filesystem :: isSharable ( $path )) {
$message = 'You are not allowed to share %s' ;
$message_t = $l -> t ( 'You are not allowed to share %s' , array ( $itemSourceName ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
}
@ -637,7 +637,7 @@ class Share extends Constants {
foreach ( $mounts as $mount ) {
if ( $mount -> getStorage () -> instanceOfStorage ( '\OCA\Files_Sharing\ISharedStorage' )) {
$message = 'Sharing "' . $itemSourceName . '" failed, because it contains files shared with you!' ;
\OCP\Util :: writeLog ( 'OCP\Share' , $message , \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , $message , \OCP\Util :: DEBUG );
throw new \Exception ( $message );
}
@ -654,13 +654,13 @@ class Share extends Constants {
if ( $shareWith == $uidOwner ) {
$message = 'Sharing %s failed, because the user %s is the item owner' ;
$message_t = $l -> t ( 'Sharing %s failed, because the user %s is the item owner' , array ( $itemSourceName , $shareWith ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
if ( ! \OC_User :: userExists ( $shareWith )) {
$message = 'Sharing %s failed, because the user %s does not exist' ;
$message_t = $l -> t ( 'Sharing %s failed, because the user %s does not exist' , array ( $itemSourceName , $shareWith ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
if ( $shareWithinGroupOnly ) {
@ -669,7 +669,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the user '
. '%s is not a member of any groups that %s is a member of' ;
$message_t = $l -> t ( 'Sharing %s failed, because the user %s is not a member of any groups that %s is a member of' , array ( $itemSourceName , $shareWith , $uidOwner ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith , $uidOwner ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith , $uidOwner ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
}
@ -682,7 +682,7 @@ class Share extends Constants {
if ( $checkExists [ 'uid_owner' ] != $uidOwner || $checkExists [ 'share_type' ] == $shareType ) {
$message = 'Sharing %s failed, because this item is already shared with %s' ;
$message_t = $l -> t ( 'Sharing %s failed, because this item is already shared with %s' , array ( $itemSourceName , $shareWith ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
}
@ -690,14 +690,14 @@ class Share extends Constants {
if ( ! \OC_Group :: groupExists ( $shareWith )) {
$message = 'Sharing %s failed, because the group %s does not exist' ;
$message_t = $l -> t ( 'Sharing %s failed, because the group %s does not exist' , array ( $itemSourceName , $shareWith ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
if ( $shareWithinGroupOnly && ! \OC_Group :: inGroup ( $uidOwner , $shareWith )) {
$message = 'Sharing %s failed, because '
. '%s is not a member of the group %s' ;
$message_t = $l -> t ( 'Sharing %s failed, because %s is not a member of the group %s' , array ( $itemSourceName , $uidOwner , $shareWith ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $uidOwner , $shareWith ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $uidOwner , $shareWith ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
// Check if the item source is already shared with the group, either from the same owner or a different user
@ -710,7 +710,7 @@ class Share extends Constants {
if ( $checkExists [ 'uid_owner' ] != $uidOwner || $checkExists [ 'share_type' ] == $shareType ) {
$message = 'Sharing %s failed, because this item is already shared with %s' ;
$message_t = $l -> t ( 'Sharing %s failed, because this item is already shared with %s' , array ( $itemSourceName , $shareWith ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
}
@ -750,7 +750,7 @@ class Share extends Constants {
if ( \OCP\Util :: isPublicLinkPasswordRequired () && empty ( $shareWith )) {
$message = 'You need to provide a password to create a public link, only protected links are allowed' ;
$message_t = $l -> t ( 'You need to provide a password to create a public link, only protected links are allowed' );
\OCP\Util :: writeLog ( 'OCP\Share' , $message , \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , $message , \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
@ -779,7 +779,7 @@ class Share extends Constants {
}
$message = 'Sharing %s failed, because sharing with links is not allowed' ;
$message_t = $l -> t ( 'Sharing %s failed, because sharing with links is not allowed' , array ( $itemSourceName ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
} else if ( $shareType === self :: SHARE_TYPE_REMOTE ) {
@ -790,7 +790,7 @@ class Share extends Constants {
$shareWith , $uidOwner , self :: FORMAT_NONE , null , 1 , true , true )) {
$message = 'Sharing %s failed, because this item is already shared with %s' ;
$message_t = $l -> t ( 'Sharing %s failed, because this item is already shared with %s' , array ( $itemSourceName , $shareWith ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
@ -819,7 +819,7 @@ class Share extends Constants {
// Future share types need to include their own conditions
$message = 'Share type %s is not valid for %s' ;
$message_t = $l -> t ( 'Share type %s is not valid for %s' , array ( $shareType , $itemSource ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $shareType , $itemSource ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $shareType , $itemSource ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
@ -1047,7 +1047,7 @@ class Share extends Constants {
$message = 'Setting permissions for %s failed,'
. ' because the permissions exceed permissions granted to %s' ;
$message_t = $l -> t ( 'Setting permissions for %s failed, because the permissions exceed permissions granted to %s' , array ( $itemSource , \OC_User :: getUser ()));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSource , \OC_User :: getUser ()), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSource , \OC_User :: getUser ()), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
}
@ -1110,7 +1110,7 @@ class Share extends Constants {
$message = 'Setting permissions for %s failed, because the item was not found' ;
$message_t = $l -> t ( 'Setting permissions for %s failed, because the item was not found' , array ( $itemSource ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSource ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSource ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
@ -2158,7 +2158,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the user %s is the original sharer' ;
$message_t = $l -> t ( 'Sharing %s failed, because the user %s is the original sharer' , array ( $itemSourceName , $shareWith ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $shareWith ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
}
@ -2170,7 +2170,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the permissions exceed permissions granted to %s' ;
$message_t = $l -> t ( 'Sharing %s failed, because the permissions exceed permissions granted to %s' , array ( $itemSourceName , $uidOwner ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $uidOwner ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName , $uidOwner ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
} else {
// TODO Don't check if inside folder
@ -2196,7 +2196,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because resharing is not allowed' ;
$message_t = $l -> t ( 'Sharing %s failed, because resharing is not allowed' , array ( $itemSourceName ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSourceName ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
} else {
@ -2209,7 +2209,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the sharing backend for '
. '%s could not find its source' ;
$message_t = $l -> t ( 'Sharing %s failed, because the sharing backend for %s could not find its source' , array ( $itemSource , $itemType ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSource , $itemType ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSource , $itemType ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
if ( $backend instanceof \OCP\Share_Backend_File_Dependent ) {
@ -2224,7 +2224,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the file could not be found in the file cache' ;
$message_t = $l -> t ( 'Sharing %s failed, because the file could not be found in the file cache' , array ( $itemSource ));
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSource ), \OCP\Util :: ERROR );
\OCP\Util :: writeLog ( 'OCP\Share' , sprintf ( $message , $itemSource ), \OCP\Util :: DEBUG );
throw new \Exception ( $message_t );
}
} else {