Skip to content

Commit 2a1f061

Browse files
committed
Merge pull request #48 from amin101/Backslash
Backslash
2 parents 0e942fb + 51424f6 commit 2a1f061

File tree

8 files changed

+466
-398
lines changed

8 files changed

+466
-398
lines changed

src/LaravelFilemanagerServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ public function boot()
3131
$this->publishes([
3232
__DIR__.'/../public' => public_path('vendor/laravel-filemanager'),
3333
], 'lfm_public');
34+
35+
$this->publishes([
36+
__DIR__.'/views' => resource_path('views/vendor/laravel-filemanager'),
37+
], 'lfm_view');
3438
}
3539

3640
/**

src/controllers/LfmController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct()
4848
*/
4949
public function show()
5050
{
51-
$working_dir = DIRECTORY_SEPARATOR;
51+
$working_dir = '/';
5252
$working_dir .= (Config::get('lfm.allow_multi_user')) ? \Auth::user()->user_field : Config::get('lfm.shared_folder_name');
5353

5454
return view('laravel-filemanager::index')
@@ -87,23 +87,23 @@ private function formatLocation($location, $type = null, $get_thumb = false)
8787
$working_dir = Input::get('working_dir');
8888

8989
// remove first slash
90-
if (substr($working_dir, 0, 1) === DIRECTORY_SEPARATOR) {
90+
if (substr($working_dir, 0, 1) === '/') {
9191
$working_dir = substr($working_dir, 1);
9292
}
9393

9494

9595
$location .= $working_dir;
9696

9797
if ($type === 'directory' || $type === 'thumb') {
98-
$location .= DIRECTORY_SEPARATOR;
98+
$location .= '/';
9999
}
100100

101101
//if user is inside thumbs folder there is no need
102102
// to add thumbs substring to the end of $location
103103
$in_thumb_folder = preg_match('/'.Config::get('lfm.thumb_folder_name').'$/i',$working_dir);
104104

105105
if ($type === 'thumb' && !$in_thumb_folder) {
106-
$location .= Config::get('lfm.thumb_folder_name') . DIRECTORY_SEPARATOR;
106+
$location .= Config::get('lfm.thumb_folder_name') . '/';
107107
}
108108

109109
return $location;
@@ -117,7 +117,7 @@ private function formatLocation($location, $type = null, $get_thumb = false)
117117

118118
public function getPath($type = null, $get_thumb = false)
119119
{
120-
$path = base_path() . DIRECTORY_SEPARATOR . $this->file_location;
120+
$path = base_path() . '/' . $this->file_location;
121121

122122
$path = $this->formatLocation($path, $type);
123123

@@ -164,7 +164,7 @@ public function getFileName($file)
164164

165165
$arr_dir = explode('/', $lfm_file_path);
166166
$arr_filename['short'] = end($arr_dir);
167-
$arr_filename['long'] = DIRECTORY_SEPARATOR . $lfm_file_path;
167+
$arr_filename['long'] = '/' . $lfm_file_path;
168168

169169
return $arr_filename;
170170
}

src/controllers/UploadController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private function makeThumb($dest_path, $new_filename)
119119

120120
$thumb_img = Image::make($dest_path . $new_filename);
121121
$thumb_img->fit(200, 200)
122-
->save($dest_path . $thumb_folder_name . DIRECTORY_SEPARATOR . $new_filename);
122+
->save($dest_path . $thumb_folder_name . '/' . $new_filename);
123123
unset($thumb_img);
124124
}
125125

src/lang/fa/lfm.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
return [
4+
'nav-back' => 'بازگشت',
5+
'nav-new' => 'پوشه جدید',
6+
'nav-upload' => 'آپلود',
7+
'nav-thumbnails' => 'تصویرک ها',
8+
'nav-list' => 'لیست',
9+
10+
'menu-rename' => 'تغییر نام',
11+
'menu-delete' => 'حذف',
12+
'menu-view' => 'مشاهده',
13+
'menu-download' => 'دانلود',
14+
'menu-resize' => 'تغییر اندازه',
15+
'menu-crop' => 'برش',
16+
17+
'title-page' => 'مدیریت فایل',
18+
'title-panel' => 'مدیریت فایل لاراول',
19+
'title-upload' => 'آپلود کردن فایل',
20+
'title-view' => 'مشاهده فایل',
21+
'title-root' => 'فایل ها',
22+
'title-shares' => 'فایل های اشتراکی',
23+
'title-item' => 'آیتم',
24+
'title-size' => 'اندازه',
25+
'title-type' => 'نوع',
26+
'title-modified' => 'تاریخ آخرین ویرایش',
27+
'title-action' => 'اقدام',
28+
29+
'type-folder' => 'پوشه',
30+
31+
'message-empty' => 'پوشه خالی است.',
32+
'message-choose' => 'انتخاب فایل',
33+
'message-delete' => 'آیا برای حذف این آیتم مطمئن هستید؟',
34+
'message-name' => 'نام پوشه:',
35+
'message-rename' => 'تغییر نام به:',
36+
37+
'error-rename' => 'این نام قبلا استفاده شده!',
38+
'error-file-empty' => 'شما باید یک فایل را انتخاب کنید!',
39+
'error-file-exist' => 'یک فایل دیگر با این نام قبلا ایجاد شده است!',
40+
'error-delete' => 'به دلیل خالی نبودن پوشه امکان حذف آن وجود ندارد!',
41+
'error-folder-name' => 'نام پوشه نمی تواند خالی باشد!',
42+
'error-folder-exist'=> 'یک پوشه با این نام قبلا ایجاد شده است!',
43+
'error-mime' => 'پسوند غیرمجاز: ',
44+
'error-instance' => 'فایل آپلود شده باید نمونه ای از UploadedFile باشد',
45+
'error-invalid' => 'درخواست آپلود غیرمعتبر',
46+
47+
'btn-upload' => 'آپلود فایل',
48+
'btn-uploading' => 'در حال آپلود',
49+
'btn-close' => 'بستن',
50+
'btn-crop' => 'برش',
51+
'btn-cancel' => 'انصراف',
52+
'btn-resize' => 'تغییر اندازه',
53+
54+
'resize-ratio' => 'نسبت:',
55+
'resize-scaled' => 'تصویر مفیاس شده:',
56+
'resize-true' => 'بله',
57+
'resize-old-height' => 'ارتفاع اصلی:',
58+
'resize-old-width' => 'پهنای اصلی:',
59+
'resize-new-height' => 'ارتفاع:',
60+
'resize-new-width' => 'پهنا:',
61+
62+
'locale-bootbox' => 'fa',
63+
];

src/middleware/MultiUser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function handle($request, Closure $next)
1212
$slug = \Config::get('lfm.user_field');
1313

1414
\Auth::user()->user_field = \Auth::user()->$slug;
15-
$new_working_dir = DIRECTORY_SEPARATOR . \Auth::user()->user_field;
15+
$new_working_dir = '/' . \Auth::user()->user_field;
1616

1717
$previous_dir = $request->input('working_dir');
1818

@@ -28,11 +28,11 @@ public function handle($request, Closure $next)
2828

2929
private function validDir($previous_dir)
3030
{
31-
if (starts_with($previous_dir, DIRECTORY_SEPARATOR . \Config::get('lfm.shared_folder_name'))) {
31+
if (starts_with($previous_dir, '/' . \Config::get('lfm.shared_folder_name'))) {
3232
return true;
3333
}
3434

35-
if (starts_with($previous_dir, DIRECTORY_SEPARATOR . (string)\Auth::user()->user_field)) {
35+
if (starts_with($previous_dir, '/' . (string)\Auth::user()->user_field)) {
3636
return true;
3737
}
3838

src/views/images-list.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@if((sizeof($file_info) > 0) || (sizeof($directories) > 0))
44
<table class="table table-condensed table-striped">
55
<thead>
6-
<th style='width:50%;'>{{ Lang::get('laravel-filemanager::lfm.title-item') }}</th>
6+
<th>{{ Lang::get('laravel-filemanager::lfm.title-item') }}</th>
77
<th>{{ Lang::get('laravel-filemanager::lfm.title-size') }}</th>
88
<th>{{ Lang::get('laravel-filemanager::lfm.title-type') }}</th>
99
<th>{{ Lang::get('laravel-filemanager::lfm.title-modified') }}</th>

0 commit comments

Comments
 (0)