Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
2e19bc33
Unverified
Commit
2e19bc33
authored
Oct 08, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CS: PSR1/2
parent
a061e847
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
19 deletions
+38
-19
SetAppKey.php
Modules/Core/Console/Installers/Scripts/SetAppKey.php
+4
-4
MoveFileOnDisk.php
Modules/Media/Events/Handlers/MoveFileOnDisk.php
+1
-1
MediaController.php
Modules/Media/Http/Controllers/Frontend/MediaController.php
+1
-2
UploadDropzoneMediaRequest.php
Modules/Media/Http/Requests/UploadDropzoneMediaRequest.php
+1
-1
UploadMediaRequest.php
Modules/Media/Http/Requests/UploadMediaRequest.php
+1
-1
MediaServiceProvider.php
Modules/Media/Providers/MediaServiceProvider.php
+1
-1
NestedFoldersCollection.php
Modules/Media/Support/Collection/NestedFoldersCollection.php
+28
-8
media.php
Modules/Translation/Resources/lang/media/en/media.php
+1
-1
No files found.
Modules/Core/Console/Installers/Scripts/SetAppKey.php
View file @
2e19bc33
...
...
@@ -3,8 +3,8 @@
namespace
Modules\Core\Console\Installers\Scripts
;
use
Illuminate\Console\Command
;
use
Illuminate\Encryption\Encrypter
;
use
Illuminate\Console\ConfirmableTrait
;
use
Illuminate\Encryption\Encrypter
;
use
Modules\Core\Console\Installers\SetupScript
;
class
SetAppKey
implements
SetupScript
...
...
@@ -40,7 +40,7 @@ class SetAppKey implements SetupScript
*/
protected
function
generateRandomKey
()
{
return
'base64:'
.
base64_encode
(
return
'base64:'
.
base64_encode
(
Encrypter
::
generateKey
(
config
(
'app.cipher'
))
);
}
...
...
@@ -74,7 +74,7 @@ class SetAppKey implements SetupScript
{
file_put_contents
(
app
()
->
environmentFilePath
(),
preg_replace
(
$this
->
keyReplacementPattern
(),
'APP_KEY='
.
$key
,
'APP_KEY='
.
$key
,
file_get_contents
(
app
()
->
environmentFilePath
())
));
}
...
...
@@ -86,7 +86,7 @@ class SetAppKey implements SetupScript
*/
protected
function
keyReplacementPattern
()
{
$escaped
=
preg_quote
(
'='
.
config
(
'app.key'
),
'/'
);
$escaped
=
preg_quote
(
'='
.
config
(
'app.key'
),
'/'
);
return
"/^APP_KEY
{
$escaped
}
/m"
;
}
...
...
Modules/Media/Events/Handlers/MoveFileOnDisk.php
View file @
2e19bc33
...
...
@@ -50,7 +50,7 @@ class MoveFileOnDisk
$fromPath
=
$this
->
getFilenameFor
(
$event
->
previousData
[
'path'
],
$thumbnail
);
$toPath
=
$this
->
getFilenameFor
(
$event
->
file
->
path
,
$thumbnail
);
$this
->
move
(
$fromPath
,
$toPath
);
$this
->
move
(
$fromPath
,
$toPath
);
}
}
...
...
Modules/Media/Http/Controllers/Frontend/MediaController.php
View file @
2e19bc33
...
...
@@ -3,7 +3,6 @@
namespace
Modules\Media\Http\Controllers\Frontend
;
use
Illuminate\Routing\Controller
;
use
Illuminate\Support\Facades\Storage
;
use
Intervention\Image\Facades\Image
;
use
Modules\Media\Repositories\FileRepository
;
...
...
@@ -29,7 +28,7 @@ class MediaController extends Controller
return
Image
::
make
(
$path
)
->
response
();
return
response
()
->
file
(
$path
,
[
"Content-Type:
$type
"
"Content-Type:
$type
"
,
]);
}
}
Modules/Media/Http/Requests/UploadDropzoneMediaRequest.php
View file @
2e19bc33
...
...
@@ -27,7 +27,7 @@ class UploadDropzoneMediaRequest extends FormRequest
$size
=
$this
->
getMaxFileSize
();
return
[
'file.max'
=>
trans
(
'media::media.file too large'
,
[
'size'
=>
$size
])
'file.max'
=>
trans
(
'media::media.file too large'
,
[
'size'
=>
$size
])
,
];
}
...
...
Modules/Media/Http/Requests/UploadMediaRequest.php
View file @
2e19bc33
...
...
@@ -27,7 +27,7 @@ class UploadMediaRequest extends FormRequest
$size
=
$this
->
getMaxFileSize
();
return
[
'file.max'
=>
trans
(
'media::media.file too large'
,
[
'size'
=>
$size
])
'file.max'
=>
trans
(
'media::media.file too large'
,
[
'size'
=>
$size
])
,
];
}
...
...
Modules/Media/Providers/MediaServiceProvider.php
View file @
2e19bc33
...
...
@@ -14,13 +14,13 @@ use Modules\Media\Console\RefreshThumbnailCommand;
use
Modules\Media\Contracts\DeletingMedia
;
use
Modules\Media\Contracts\StoringMedia
;
use
Modules\Media\Entities\File
;
use
Modules\Media\Events\FileStartedMoving
;
use
Modules\Media\Events\FolderIsDeleting
;
use
Modules\Media\Events\FolderWasCreated
;
use
Modules\Media\Events\FolderWasUpdated
;
use
Modules\Media\Events\Handlers\CreateFolderOnDisk
;
use
Modules\Media\Events\Handlers\DeleteAllChildrenOfFolder
;
use
Modules\Media\Events\Handlers\DeleteFolderOnDisk
;
use
Modules\Media\Events\FileStartedMoving
;
use
Modules\Media\Events\Handlers\HandleMediaStorage
;
use
Modules\Media\Events\Handlers\MoveFileOnDisk
;
use
Modules\Media\Events\Handlers\RegisterMediaSidebar
;
...
...
Modules/Media/Support/Collection/NestedFoldersCollection.php
View file @
2e19bc33
...
...
@@ -26,7 +26,7 @@ class NestedFoldersCollection extends Collection
public
function
nest
()
{
$parentColumn
=
$this
->
parentColumn
;
if
(
!
$parentColumn
)
{
if
(
!
$parentColumn
)
{
return
$this
;
}
// Set id as keys.
...
...
@@ -34,7 +34,7 @@ class NestedFoldersCollection extends Collection
$keysToDelete
=
[];
// Add empty collection to each items.
$collection
=
$this
->
each
(
function
(
$item
)
{
if
(
!
$item
->
items
)
{
if
(
!
$item
->
items
)
{
$item
->
items
=
app
(
BaseCollection
::
class
);
}
});
...
...
@@ -43,6 +43,7 @@ class NestedFoldersCollection extends Collection
$collection
=
$this
->
reject
(
function
(
$item
)
use
(
$parentColumn
)
{
if
(
$item
->
$parentColumn
)
{
$missingAncestor
=
$this
->
anAncestorIsMissing
(
$item
);
return
$missingAncestor
;
}
});
...
...
@@ -56,6 +57,7 @@ class NestedFoldersCollection extends Collection
}
// Delete moved items.
$this
->
items
=
array_values
(
array_except
(
$collection
->
items
,
$keysToDelete
));
return
$this
;
}
...
...
@@ -71,7 +73,11 @@ class NestedFoldersCollection extends Collection
* @return array
*/
public
function
listsFlattened
(
$column
=
'title'
,
BaseCollection
$collection
=
null
,
$level
=
0
,
array
&
$flattened
=
[],
$indentChars
=
null
,
$column
=
'title'
,
BaseCollection
$collection
=
null
,
$level
=
0
,
array
&
$flattened
=
[],
$indentChars
=
null
,
$parent_string
=
null
)
{
$collection
=
$collection
?:
$this
;
...
...
@@ -84,10 +90,17 @@ class NestedFoldersCollection extends Collection
}
$flattened
[
$item
->
id
]
=
$item_string
;
if
(
$item
->
items
)
{
$this
->
listsFlattened
(
$column
,
$item
->
items
,
$level
+
1
,
$flattened
,
$indentChars
,
(
$parent_string
)
?
$item_string
:
null
);
$this
->
listsFlattened
(
$column
,
$item
->
items
,
$level
+
1
,
$flattened
,
$indentChars
,
(
$parent_string
)
?
$item_string
:
null
);
}
}
return
$flattened
;
}
...
...
@@ -101,7 +114,11 @@ class NestedFoldersCollection extends Collection
* @return array
*/
public
function
listsFlattenedQualified
(
$column
=
'title'
,
BaseCollection
$collection
=
null
,
$level
=
0
,
array
&
$flattened
=
[],
$indentChars
=
null
$column
=
'title'
,
BaseCollection
$collection
=
null
,
$level
=
0
,
array
&
$flattened
=
[],
$indentChars
=
null
)
{
return
$this
->
listsFlattened
(
$column
,
$collection
,
$level
,
$flattened
,
$indentChars
,
true
);
}
...
...
@@ -114,6 +131,7 @@ class NestedFoldersCollection extends Collection
public
function
setIndent
(
string
$indentChars
)
{
$this
->
indentChars
=
$indentChars
;
return
$this
;
}
...
...
@@ -124,6 +142,7 @@ class NestedFoldersCollection extends Collection
public
function
noCleaning
()
{
$this
->
removeItemsWithMissingAncestor
=
false
;
return
$this
;
}
...
...
@@ -135,13 +154,14 @@ class NestedFoldersCollection extends Collection
public
function
anAncestorIsMissing
(
$item
)
{
$parentColumn
=
$this
->
parentColumn
;
if
(
!
$item
->
$parentColumn
)
{
if
(
!
$item
->
$parentColumn
)
{
return
false
;
}
if
(
!
$this
->
has
(
$item
->
$parentColumn
))
{
if
(
!
$this
->
has
(
$item
->
$parentColumn
))
{
return
true
;
}
$parent
=
$this
[
$item
->
$parentColumn
];
return
$this
->
anAncestorIsMissing
(
$parent
);
}
...
...
Modules/Translation/Resources/lang/media/en/media.php
View file @
2e19bc33
...
...
@@ -38,5 +38,5 @@ return [
'create resource'
=>
'Create media'
,
'edit resource'
=>
'Edit media'
,
'destroy resource'
=>
'Delete media'
,
'file too large'
=>
'File is too large. Must be below :size MB.'
'file too large'
=>
'File is too large. Must be below :size MB.'
,
];
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment