Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backslash #48

Merged
merged 6 commits into from
Mar 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/LaravelFilemanagerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public function boot()
$this->publishes([
__DIR__.'/../public' => public_path('vendor/laravel-filemanager'),
], 'lfm_public');

$this->publishes([
__DIR__.'/views' => resource_path('views/vendor/laravel-filemanager'),
], 'lfm_view');
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/controllers/LfmController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct()
*/
public function show()
{
$working_dir = DIRECTORY_SEPARATOR;
$working_dir = '/';
$working_dir .= (Config::get('lfm.allow_multi_user')) ? \Auth::user()->user_field : Config::get('lfm.shared_folder_name');

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

// remove first slash
if (substr($working_dir, 0, 1) === DIRECTORY_SEPARATOR) {
if (substr($working_dir, 0, 1) === '/') {
$working_dir = substr($working_dir, 1);
}


$location .= $working_dir;

if ($type === 'directory' || $type === 'thumb') {
$location .= DIRECTORY_SEPARATOR;
$location .= '/';
}

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

if ($type === 'thumb' && !$in_thumb_folder) {
$location .= Config::get('lfm.thumb_folder_name') . DIRECTORY_SEPARATOR;
$location .= Config::get('lfm.thumb_folder_name') . '/';
}

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

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

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

Expand Down Expand Up @@ -164,7 +164,7 @@ public function getFileName($file)

$arr_dir = explode('/', $lfm_file_path);
$arr_filename['short'] = end($arr_dir);
$arr_filename['long'] = DIRECTORY_SEPARATOR . $lfm_file_path;
$arr_filename['long'] = '/' . $lfm_file_path;

return $arr_filename;
}
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/UploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private function makeThumb($dest_path, $new_filename)

$thumb_img = Image::make($dest_path . $new_filename);
$thumb_img->fit(200, 200)
->save($dest_path . $thumb_folder_name . DIRECTORY_SEPARATOR . $new_filename);
->save($dest_path . $thumb_folder_name . '/' . $new_filename);
unset($thumb_img);
}

Expand Down
63 changes: 63 additions & 0 deletions src/lang/fa/lfm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

return [
'nav-back' => 'بازگشت',
'nav-new' => 'پوشه جدید',
'nav-upload' => 'آپلود',
'nav-thumbnails' => 'تصویرک ها',
'nav-list' => 'لیست',

'menu-rename' => 'تغییر نام',
'menu-delete' => 'حذف',
'menu-view' => 'مشاهده',
'menu-download' => 'دانلود',
'menu-resize' => 'تغییر اندازه',
'menu-crop' => 'برش',

'title-page' => 'مدیریت فایل',
'title-panel' => 'مدیریت فایل لاراول',
'title-upload' => 'آپلود کردن فایل',
'title-view' => 'مشاهده فایل',
'title-root' => 'فایل ها',
'title-shares' => 'فایل های اشتراکی',
'title-item' => 'آیتم',
'title-size' => 'اندازه',
'title-type' => 'نوع',
'title-modified' => 'تاریخ آخرین ویرایش',
'title-action' => 'اقدام',

'type-folder' => 'پوشه',

'message-empty' => 'پوشه خالی است.',
'message-choose' => 'انتخاب فایل',
'message-delete' => 'آیا برای حذف این آیتم مطمئن هستید؟',
'message-name' => 'نام پوشه:',
'message-rename' => 'تغییر نام به:',

'error-rename' => 'این نام قبلا استفاده شده!',
'error-file-empty' => 'شما باید یک فایل را انتخاب کنید!',
'error-file-exist' => 'یک فایل دیگر با این نام قبلا ایجاد شده است!',
'error-delete' => 'به دلیل خالی نبودن پوشه امکان حذف آن وجود ندارد!',
'error-folder-name' => 'نام پوشه نمی تواند خالی باشد!',
'error-folder-exist'=> 'یک پوشه با این نام قبلا ایجاد شده است!',
'error-mime' => 'پسوند غیرمجاز: ',
'error-instance' => 'فایل آپلود شده باید نمونه ای از UploadedFile باشد',
'error-invalid' => 'درخواست آپلود غیرمعتبر',

'btn-upload' => 'آپلود فایل',
'btn-uploading' => 'در حال آپلود',
'btn-close' => 'بستن',
'btn-crop' => 'برش',
'btn-cancel' => 'انصراف',
'btn-resize' => 'تغییر اندازه',

'resize-ratio' => 'نسبت:',
'resize-scaled' => 'تصویر مفیاس شده:',
'resize-true' => 'بله',
'resize-old-height' => 'ارتفاع اصلی:',
'resize-old-width' => 'پهنای اصلی:',
'resize-new-height' => 'ارتفاع:',
'resize-new-width' => 'پهنا:',

'locale-bootbox' => 'fa',
];
6 changes: 3 additions & 3 deletions src/middleware/MultiUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function handle($request, Closure $next)
$slug = \Config::get('lfm.user_field');

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

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

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

private function validDir($previous_dir)
{
if (starts_with($previous_dir, DIRECTORY_SEPARATOR . \Config::get('lfm.shared_folder_name'))) {
if (starts_with($previous_dir, '/' . \Config::get('lfm.shared_folder_name'))) {
return true;
}

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

Expand Down
2 changes: 1 addition & 1 deletion src/views/images-list.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@if((sizeof($file_info) > 0) || (sizeof($directories) > 0))
<table class="table table-condensed table-striped">
<thead>
<th style='width:50%;'>{{ Lang::get('laravel-filemanager::lfm.title-item') }}</th>
<th>{{ Lang::get('laravel-filemanager::lfm.title-item') }}</th>
<th>{{ Lang::get('laravel-filemanager::lfm.title-size') }}</th>
<th>{{ Lang::get('laravel-filemanager::lfm.title-type') }}</th>
<th>{{ Lang::get('laravel-filemanager::lfm.title-modified') }}</th>
Expand Down
Loading