w0bm.com v1.5z FULL.RETARD.BUILD.BUT.STILL.WORKS

This commit is contained in:
noxy
2019-08-26 16:58:26 +00:00
commit da71b95aa2
517 changed files with 143236 additions and 0 deletions

11
.babelrc Normal file
View File

@@ -0,0 +1,11 @@
{
"presets": [
"minify",
["env", {
"targets": {
"browsers": ["IE 11"]
}
}]
],
"sourceMaps": "inline"
}

3
.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
* text=auto
*.css linguist-vendored
*.less linguist-vendored

481
.phpstorm.meta.php Normal file
View File

@@ -0,0 +1,481 @@
<?php
namespace PHPSTORM_META {
/**
* PhpStorm Meta file, to provide autocomplete information for PhpStorm
* Generated on 2016-06-11.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
$STATIC_METHOD_TYPES = [
new \Illuminate\Contracts\Container\Container => [
'' == '@',
'events' instanceof \Illuminate\Events\Dispatcher,
'router' instanceof \Illuminate\Routing\Router,
'url' instanceof \Illuminate\Routing\UrlGenerator,
'redirect' instanceof \Illuminate\Routing\Redirector,
'Illuminate\Contracts\Routing\ResponseFactory' instanceof \Illuminate\Routing\ResponseFactory,
'Illuminate\Contracts\Http\Kernel' instanceof \App\Http\Kernel,
'Illuminate\Contracts\Console\Kernel' instanceof \App\Console\Kernel,
'Illuminate\Contracts\Debug\ExceptionHandler' instanceof \App\Exceptions\Handler,
'Psr\Log\LoggerInterface' instanceof \Monolog\Logger,
'auth' instanceof \Illuminate\Auth\AuthManager,
'auth.driver' instanceof \Toddish\Verify\Auth\VerifyGuard,
'Illuminate\Contracts\Auth\Access\Gate' instanceof \Illuminate\Auth\Access\Gate,
'illuminate.route.dispatcher' instanceof \Illuminate\Routing\ControllerDispatcher,
'cookie' instanceof \Illuminate\Cookie\CookieJar,
'Illuminate\Contracts\Queue\EntityResolver' instanceof \Illuminate\Database\Eloquent\QueueEntityResolver,
'db.factory' instanceof \Illuminate\Database\Connectors\ConnectionFactory,
'db' instanceof \Illuminate\Database\DatabaseManager,
'encrypter' instanceof \Illuminate\Encryption\Encrypter,
'files' instanceof \Illuminate\Filesystem\Filesystem,
'filesystem' instanceof \Illuminate\Filesystem\FilesystemManager,
'filesystem.disk' instanceof \Illuminate\Filesystem\FilesystemAdapter,
'session' instanceof \Illuminate\Session\SessionManager,
'session.store' instanceof \Illuminate\Session\Store,
'Illuminate\Session\Middleware\StartSession' instanceof \Illuminate\Session\Middleware\StartSession,
'validation.presence' instanceof \Illuminate\Validation\DatabasePresenceVerifier,
'view.engine.resolver' instanceof \Illuminate\View\Engines\EngineResolver,
'view.finder' instanceof \Illuminate\View\FileViewFinder,
'view' instanceof \Illuminate\View\Factory,
'recaptcha.service' instanceof \Greggilbert\Recaptcha\Service\CheckRecaptchaV2,
'recaptcha' instanceof \Greggilbert\Recaptcha\Recaptcha,
'Cviebrock\EloquentTaggable\Services\TagService' instanceof \Cviebrock\EloquentTaggable\Services\TagService,
'blade.compiler' instanceof \Illuminate\View\Compilers\BladeCompiler,
'translation.loader' instanceof \Illuminate\Translation\FileLoader,
'translator' instanceof \Illuminate\Translation\Translator,
'command.app.name' instanceof \Illuminate\Foundation\Console\AppNameCommand,
'command.clear-compiled' instanceof \Illuminate\Foundation\Console\ClearCompiledCommand,
'command.command.make' instanceof \Illuminate\Foundation\Console\CommandMakeCommand,
'command.config.cache' instanceof \Illuminate\Foundation\Console\ConfigCacheCommand,
'command.config.clear' instanceof \Illuminate\Foundation\Console\ConfigClearCommand,
'command.console.make' instanceof \Illuminate\Foundation\Console\ConsoleMakeCommand,
'command.event.generate' instanceof \Illuminate\Foundation\Console\EventGenerateCommand,
'command.event.make' instanceof \Illuminate\Foundation\Console\EventMakeCommand,
'command.down' instanceof \Illuminate\Foundation\Console\DownCommand,
'command.environment' instanceof \Illuminate\Foundation\Console\EnvironmentCommand,
'command.handler.command' instanceof \Illuminate\Foundation\Console\HandlerCommandCommand,
'command.handler.event' instanceof \Illuminate\Foundation\Console\HandlerEventCommand,
'command.job.make' instanceof \Illuminate\Foundation\Console\JobMakeCommand,
'command.key.generate' instanceof \Illuminate\Foundation\Console\KeyGenerateCommand,
'command.listener.make' instanceof \Illuminate\Foundation\Console\ListenerMakeCommand,
'command.model.make' instanceof \Illuminate\Foundation\Console\ModelMakeCommand,
'command.optimize' instanceof \Illuminate\Foundation\Console\OptimizeCommand,
'command.policy.make' instanceof \Illuminate\Foundation\Console\PolicyMakeCommand,
'command.provider.make' instanceof \Illuminate\Foundation\Console\ProviderMakeCommand,
'command.request.make' instanceof \Illuminate\Foundation\Console\RequestMakeCommand,
'command.route.cache' instanceof \Illuminate\Foundation\Console\RouteCacheCommand,
'command.route.clear' instanceof \Illuminate\Foundation\Console\RouteClearCommand,
'command.route.list' instanceof \Illuminate\Foundation\Console\RouteListCommand,
'command.serve' instanceof \Illuminate\Foundation\Console\ServeCommand,
'command.test.make' instanceof \Illuminate\Foundation\Console\TestMakeCommand,
'command.tinker' instanceof \Illuminate\Foundation\Console\TinkerCommand,
'command.up' instanceof \Illuminate\Foundation\Console\UpCommand,
'command.vendor.publish' instanceof \Illuminate\Foundation\Console\VendorPublishCommand,
'command.view.clear' instanceof \Illuminate\Foundation\Console\ViewClearCommand,
'Illuminate\Broadcasting\BroadcastManager' instanceof \Illuminate\Broadcasting\BroadcastManager,
'Illuminate\Bus\Dispatcher' instanceof \Illuminate\Bus\Dispatcher,
'cache' instanceof \Illuminate\Cache\CacheManager,
'cache.store' instanceof \Illuminate\Cache\Repository,
'memcached.connector' instanceof \Illuminate\Cache\MemcachedConnector,
'command.cache.clear' instanceof \Illuminate\Cache\Console\ClearCommand,
'command.cache.table' instanceof \Illuminate\Cache\Console\CacheTableCommand,
'command.auth.resets.clear' instanceof \Illuminate\Auth\Console\ClearResetsCommand,
'migration.repository' instanceof \Illuminate\Database\Migrations\DatabaseMigrationRepository,
'migrator' instanceof \Illuminate\Database\Migrations\Migrator,
'command.migrate' instanceof \Illuminate\Database\Console\Migrations\MigrateCommand,
'command.migrate.rollback' instanceof \Illuminate\Database\Console\Migrations\RollbackCommand,
'command.migrate.reset' instanceof \Illuminate\Database\Console\Migrations\ResetCommand,
'command.migrate.refresh' instanceof \Illuminate\Database\Console\Migrations\RefreshCommand,
'command.migrate.install' instanceof \Illuminate\Database\Console\Migrations\InstallCommand,
'migration.creator' instanceof \Illuminate\Database\Migrations\MigrationCreator,
'command.migrate.make' instanceof \Illuminate\Database\Console\Migrations\MigrateMakeCommand,
'command.migrate.status' instanceof \Illuminate\Database\Console\Migrations\StatusCommand,
'command.seed' instanceof \Illuminate\Database\Console\Seeds\SeedCommand,
'command.seeder.make' instanceof \Illuminate\Database\Console\Seeds\SeederMakeCommand,
'seeder' instanceof \Illuminate\Database\Seeder,
'composer' instanceof \Illuminate\Foundation\Composer,
'command.queue.table' instanceof \Illuminate\Queue\Console\TableCommand,
'command.queue.failed' instanceof \Illuminate\Queue\Console\ListFailedCommand,
'command.queue.retry' instanceof \Illuminate\Queue\Console\RetryCommand,
'command.queue.forget' instanceof \Illuminate\Queue\Console\ForgetFailedCommand,
'command.queue.flush' instanceof \Illuminate\Queue\Console\FlushFailedCommand,
'command.queue.failed-table' instanceof \Illuminate\Queue\Console\FailedTableCommand,
'command.controller.make' instanceof \Illuminate\Routing\Console\ControllerMakeCommand,
'command.middleware.make' instanceof \Illuminate\Routing\Console\MiddlewareMakeCommand,
'command.session.database' instanceof \Illuminate\Session\Console\SessionTableCommand,
'hash' instanceof \Illuminate\Hashing\BcryptHasher,
'mailer' instanceof \Illuminate\Mail\Mailer,
'Illuminate\Contracts\Pipeline\Hub' instanceof \Illuminate\Pipeline\Hub,
'queue' instanceof \Illuminate\Queue\QueueManager,
'queue.connection' instanceof \Illuminate\Queue\SyncQueue,
'command.queue.work' instanceof \Illuminate\Queue\Console\WorkCommand,
'command.queue.restart' instanceof \Illuminate\Queue\Console\RestartCommand,
'queue.worker' instanceof \Illuminate\Queue\Worker,
'command.queue.listen' instanceof \Illuminate\Queue\Console\ListenCommand,
'queue.listener' instanceof \Illuminate\Queue\Listener,
'command.queue.subscribe' instanceof \Illuminate\Queue\Console\SubscribeCommand,
'queue.failer' instanceof \Illuminate\Queue\Failed\DatabaseFailedJobProvider,
'IlluminateQueueClosure' instanceof \IlluminateQueueClosure,
'auth.password' instanceof \Illuminate\Auth\Passwords\PasswordBroker,
'auth.password.tokens' instanceof \Illuminate\Auth\Passwords\DatabaseTokenRepository,
'command.ide-helper.generate' instanceof \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand,
'command.ide-helper.models' instanceof \Barryvdh\LaravelIdeHelper\Console\ModelsCommand,
'command.ide-helper.meta' instanceof \Barryvdh\LaravelIdeHelper\Console\MetaCommand,
'html' instanceof \Illuminate\Html\HtmlBuilder,
'form' instanceof \Illuminate\Html\FormBuilder,
],
\Illuminate\Contracts\Container\Container::make('') => [
'' == '@',
'events' instanceof \Illuminate\Events\Dispatcher,
'router' instanceof \Illuminate\Routing\Router,
'url' instanceof \Illuminate\Routing\UrlGenerator,
'redirect' instanceof \Illuminate\Routing\Redirector,
'Illuminate\Contracts\Routing\ResponseFactory' instanceof \Illuminate\Routing\ResponseFactory,
'Illuminate\Contracts\Http\Kernel' instanceof \App\Http\Kernel,
'Illuminate\Contracts\Console\Kernel' instanceof \App\Console\Kernel,
'Illuminate\Contracts\Debug\ExceptionHandler' instanceof \App\Exceptions\Handler,
'Psr\Log\LoggerInterface' instanceof \Monolog\Logger,
'auth' instanceof \Illuminate\Auth\AuthManager,
'auth.driver' instanceof \Toddish\Verify\Auth\VerifyGuard,
'Illuminate\Contracts\Auth\Access\Gate' instanceof \Illuminate\Auth\Access\Gate,
'illuminate.route.dispatcher' instanceof \Illuminate\Routing\ControllerDispatcher,
'cookie' instanceof \Illuminate\Cookie\CookieJar,
'Illuminate\Contracts\Queue\EntityResolver' instanceof \Illuminate\Database\Eloquent\QueueEntityResolver,
'db.factory' instanceof \Illuminate\Database\Connectors\ConnectionFactory,
'db' instanceof \Illuminate\Database\DatabaseManager,
'encrypter' instanceof \Illuminate\Encryption\Encrypter,
'files' instanceof \Illuminate\Filesystem\Filesystem,
'filesystem' instanceof \Illuminate\Filesystem\FilesystemManager,
'filesystem.disk' instanceof \Illuminate\Filesystem\FilesystemAdapter,
'session' instanceof \Illuminate\Session\SessionManager,
'session.store' instanceof \Illuminate\Session\Store,
'Illuminate\Session\Middleware\StartSession' instanceof \Illuminate\Session\Middleware\StartSession,
'validation.presence' instanceof \Illuminate\Validation\DatabasePresenceVerifier,
'view.engine.resolver' instanceof \Illuminate\View\Engines\EngineResolver,
'view.finder' instanceof \Illuminate\View\FileViewFinder,
'view' instanceof \Illuminate\View\Factory,
'recaptcha.service' instanceof \Greggilbert\Recaptcha\Service\CheckRecaptchaV2,
'recaptcha' instanceof \Greggilbert\Recaptcha\Recaptcha,
'Cviebrock\EloquentTaggable\Services\TagService' instanceof \Cviebrock\EloquentTaggable\Services\TagService,
'blade.compiler' instanceof \Illuminate\View\Compilers\BladeCompiler,
'translation.loader' instanceof \Illuminate\Translation\FileLoader,
'translator' instanceof \Illuminate\Translation\Translator,
'command.app.name' instanceof \Illuminate\Foundation\Console\AppNameCommand,
'command.clear-compiled' instanceof \Illuminate\Foundation\Console\ClearCompiledCommand,
'command.command.make' instanceof \Illuminate\Foundation\Console\CommandMakeCommand,
'command.config.cache' instanceof \Illuminate\Foundation\Console\ConfigCacheCommand,
'command.config.clear' instanceof \Illuminate\Foundation\Console\ConfigClearCommand,
'command.console.make' instanceof \Illuminate\Foundation\Console\ConsoleMakeCommand,
'command.event.generate' instanceof \Illuminate\Foundation\Console\EventGenerateCommand,
'command.event.make' instanceof \Illuminate\Foundation\Console\EventMakeCommand,
'command.down' instanceof \Illuminate\Foundation\Console\DownCommand,
'command.environment' instanceof \Illuminate\Foundation\Console\EnvironmentCommand,
'command.handler.command' instanceof \Illuminate\Foundation\Console\HandlerCommandCommand,
'command.handler.event' instanceof \Illuminate\Foundation\Console\HandlerEventCommand,
'command.job.make' instanceof \Illuminate\Foundation\Console\JobMakeCommand,
'command.key.generate' instanceof \Illuminate\Foundation\Console\KeyGenerateCommand,
'command.listener.make' instanceof \Illuminate\Foundation\Console\ListenerMakeCommand,
'command.model.make' instanceof \Illuminate\Foundation\Console\ModelMakeCommand,
'command.optimize' instanceof \Illuminate\Foundation\Console\OptimizeCommand,
'command.policy.make' instanceof \Illuminate\Foundation\Console\PolicyMakeCommand,
'command.provider.make' instanceof \Illuminate\Foundation\Console\ProviderMakeCommand,
'command.request.make' instanceof \Illuminate\Foundation\Console\RequestMakeCommand,
'command.route.cache' instanceof \Illuminate\Foundation\Console\RouteCacheCommand,
'command.route.clear' instanceof \Illuminate\Foundation\Console\RouteClearCommand,
'command.route.list' instanceof \Illuminate\Foundation\Console\RouteListCommand,
'command.serve' instanceof \Illuminate\Foundation\Console\ServeCommand,
'command.test.make' instanceof \Illuminate\Foundation\Console\TestMakeCommand,
'command.tinker' instanceof \Illuminate\Foundation\Console\TinkerCommand,
'command.up' instanceof \Illuminate\Foundation\Console\UpCommand,
'command.vendor.publish' instanceof \Illuminate\Foundation\Console\VendorPublishCommand,
'command.view.clear' instanceof \Illuminate\Foundation\Console\ViewClearCommand,
'Illuminate\Broadcasting\BroadcastManager' instanceof \Illuminate\Broadcasting\BroadcastManager,
'Illuminate\Bus\Dispatcher' instanceof \Illuminate\Bus\Dispatcher,
'cache' instanceof \Illuminate\Cache\CacheManager,
'cache.store' instanceof \Illuminate\Cache\Repository,
'memcached.connector' instanceof \Illuminate\Cache\MemcachedConnector,
'command.cache.clear' instanceof \Illuminate\Cache\Console\ClearCommand,
'command.cache.table' instanceof \Illuminate\Cache\Console\CacheTableCommand,
'command.auth.resets.clear' instanceof \Illuminate\Auth\Console\ClearResetsCommand,
'migration.repository' instanceof \Illuminate\Database\Migrations\DatabaseMigrationRepository,
'migrator' instanceof \Illuminate\Database\Migrations\Migrator,
'command.migrate' instanceof \Illuminate\Database\Console\Migrations\MigrateCommand,
'command.migrate.rollback' instanceof \Illuminate\Database\Console\Migrations\RollbackCommand,
'command.migrate.reset' instanceof \Illuminate\Database\Console\Migrations\ResetCommand,
'command.migrate.refresh' instanceof \Illuminate\Database\Console\Migrations\RefreshCommand,
'command.migrate.install' instanceof \Illuminate\Database\Console\Migrations\InstallCommand,
'migration.creator' instanceof \Illuminate\Database\Migrations\MigrationCreator,
'command.migrate.make' instanceof \Illuminate\Database\Console\Migrations\MigrateMakeCommand,
'command.migrate.status' instanceof \Illuminate\Database\Console\Migrations\StatusCommand,
'command.seed' instanceof \Illuminate\Database\Console\Seeds\SeedCommand,
'command.seeder.make' instanceof \Illuminate\Database\Console\Seeds\SeederMakeCommand,
'seeder' instanceof \Illuminate\Database\Seeder,
'composer' instanceof \Illuminate\Foundation\Composer,
'command.queue.table' instanceof \Illuminate\Queue\Console\TableCommand,
'command.queue.failed' instanceof \Illuminate\Queue\Console\ListFailedCommand,
'command.queue.retry' instanceof \Illuminate\Queue\Console\RetryCommand,
'command.queue.forget' instanceof \Illuminate\Queue\Console\ForgetFailedCommand,
'command.queue.flush' instanceof \Illuminate\Queue\Console\FlushFailedCommand,
'command.queue.failed-table' instanceof \Illuminate\Queue\Console\FailedTableCommand,
'command.controller.make' instanceof \Illuminate\Routing\Console\ControllerMakeCommand,
'command.middleware.make' instanceof \Illuminate\Routing\Console\MiddlewareMakeCommand,
'command.session.database' instanceof \Illuminate\Session\Console\SessionTableCommand,
'hash' instanceof \Illuminate\Hashing\BcryptHasher,
'mailer' instanceof \Illuminate\Mail\Mailer,
'Illuminate\Contracts\Pipeline\Hub' instanceof \Illuminate\Pipeline\Hub,
'queue' instanceof \Illuminate\Queue\QueueManager,
'queue.connection' instanceof \Illuminate\Queue\SyncQueue,
'command.queue.work' instanceof \Illuminate\Queue\Console\WorkCommand,
'command.queue.restart' instanceof \Illuminate\Queue\Console\RestartCommand,
'queue.worker' instanceof \Illuminate\Queue\Worker,
'command.queue.listen' instanceof \Illuminate\Queue\Console\ListenCommand,
'queue.listener' instanceof \Illuminate\Queue\Listener,
'command.queue.subscribe' instanceof \Illuminate\Queue\Console\SubscribeCommand,
'queue.failer' instanceof \Illuminate\Queue\Failed\DatabaseFailedJobProvider,
'IlluminateQueueClosure' instanceof \IlluminateQueueClosure,
'auth.password' instanceof \Illuminate\Auth\Passwords\PasswordBroker,
'auth.password.tokens' instanceof \Illuminate\Auth\Passwords\DatabaseTokenRepository,
'command.ide-helper.generate' instanceof \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand,
'command.ide-helper.models' instanceof \Barryvdh\LaravelIdeHelper\Console\ModelsCommand,
'command.ide-helper.meta' instanceof \Barryvdh\LaravelIdeHelper\Console\MetaCommand,
'html' instanceof \Illuminate\Html\HtmlBuilder,
'form' instanceof \Illuminate\Html\FormBuilder,
],
\App::make('') => [
'' == '@',
'events' instanceof \Illuminate\Events\Dispatcher,
'router' instanceof \Illuminate\Routing\Router,
'url' instanceof \Illuminate\Routing\UrlGenerator,
'redirect' instanceof \Illuminate\Routing\Redirector,
'Illuminate\Contracts\Routing\ResponseFactory' instanceof \Illuminate\Routing\ResponseFactory,
'Illuminate\Contracts\Http\Kernel' instanceof \App\Http\Kernel,
'Illuminate\Contracts\Console\Kernel' instanceof \App\Console\Kernel,
'Illuminate\Contracts\Debug\ExceptionHandler' instanceof \App\Exceptions\Handler,
'Psr\Log\LoggerInterface' instanceof \Monolog\Logger,
'auth' instanceof \Illuminate\Auth\AuthManager,
'auth.driver' instanceof \Toddish\Verify\Auth\VerifyGuard,
'Illuminate\Contracts\Auth\Access\Gate' instanceof \Illuminate\Auth\Access\Gate,
'illuminate.route.dispatcher' instanceof \Illuminate\Routing\ControllerDispatcher,
'cookie' instanceof \Illuminate\Cookie\CookieJar,
'Illuminate\Contracts\Queue\EntityResolver' instanceof \Illuminate\Database\Eloquent\QueueEntityResolver,
'db.factory' instanceof \Illuminate\Database\Connectors\ConnectionFactory,
'db' instanceof \Illuminate\Database\DatabaseManager,
'encrypter' instanceof \Illuminate\Encryption\Encrypter,
'files' instanceof \Illuminate\Filesystem\Filesystem,
'filesystem' instanceof \Illuminate\Filesystem\FilesystemManager,
'filesystem.disk' instanceof \Illuminate\Filesystem\FilesystemAdapter,
'session' instanceof \Illuminate\Session\SessionManager,
'session.store' instanceof \Illuminate\Session\Store,
'Illuminate\Session\Middleware\StartSession' instanceof \Illuminate\Session\Middleware\StartSession,
'validation.presence' instanceof \Illuminate\Validation\DatabasePresenceVerifier,
'view.engine.resolver' instanceof \Illuminate\View\Engines\EngineResolver,
'view.finder' instanceof \Illuminate\View\FileViewFinder,
'view' instanceof \Illuminate\View\Factory,
'recaptcha.service' instanceof \Greggilbert\Recaptcha\Service\CheckRecaptchaV2,
'recaptcha' instanceof \Greggilbert\Recaptcha\Recaptcha,
'Cviebrock\EloquentTaggable\Services\TagService' instanceof \Cviebrock\EloquentTaggable\Services\TagService,
'blade.compiler' instanceof \Illuminate\View\Compilers\BladeCompiler,
'translation.loader' instanceof \Illuminate\Translation\FileLoader,
'translator' instanceof \Illuminate\Translation\Translator,
'command.app.name' instanceof \Illuminate\Foundation\Console\AppNameCommand,
'command.clear-compiled' instanceof \Illuminate\Foundation\Console\ClearCompiledCommand,
'command.command.make' instanceof \Illuminate\Foundation\Console\CommandMakeCommand,
'command.config.cache' instanceof \Illuminate\Foundation\Console\ConfigCacheCommand,
'command.config.clear' instanceof \Illuminate\Foundation\Console\ConfigClearCommand,
'command.console.make' instanceof \Illuminate\Foundation\Console\ConsoleMakeCommand,
'command.event.generate' instanceof \Illuminate\Foundation\Console\EventGenerateCommand,
'command.event.make' instanceof \Illuminate\Foundation\Console\EventMakeCommand,
'command.down' instanceof \Illuminate\Foundation\Console\DownCommand,
'command.environment' instanceof \Illuminate\Foundation\Console\EnvironmentCommand,
'command.handler.command' instanceof \Illuminate\Foundation\Console\HandlerCommandCommand,
'command.handler.event' instanceof \Illuminate\Foundation\Console\HandlerEventCommand,
'command.job.make' instanceof \Illuminate\Foundation\Console\JobMakeCommand,
'command.key.generate' instanceof \Illuminate\Foundation\Console\KeyGenerateCommand,
'command.listener.make' instanceof \Illuminate\Foundation\Console\ListenerMakeCommand,
'command.model.make' instanceof \Illuminate\Foundation\Console\ModelMakeCommand,
'command.optimize' instanceof \Illuminate\Foundation\Console\OptimizeCommand,
'command.policy.make' instanceof \Illuminate\Foundation\Console\PolicyMakeCommand,
'command.provider.make' instanceof \Illuminate\Foundation\Console\ProviderMakeCommand,
'command.request.make' instanceof \Illuminate\Foundation\Console\RequestMakeCommand,
'command.route.cache' instanceof \Illuminate\Foundation\Console\RouteCacheCommand,
'command.route.clear' instanceof \Illuminate\Foundation\Console\RouteClearCommand,
'command.route.list' instanceof \Illuminate\Foundation\Console\RouteListCommand,
'command.serve' instanceof \Illuminate\Foundation\Console\ServeCommand,
'command.test.make' instanceof \Illuminate\Foundation\Console\TestMakeCommand,
'command.tinker' instanceof \Illuminate\Foundation\Console\TinkerCommand,
'command.up' instanceof \Illuminate\Foundation\Console\UpCommand,
'command.vendor.publish' instanceof \Illuminate\Foundation\Console\VendorPublishCommand,
'command.view.clear' instanceof \Illuminate\Foundation\Console\ViewClearCommand,
'Illuminate\Broadcasting\BroadcastManager' instanceof \Illuminate\Broadcasting\BroadcastManager,
'Illuminate\Bus\Dispatcher' instanceof \Illuminate\Bus\Dispatcher,
'cache' instanceof \Illuminate\Cache\CacheManager,
'cache.store' instanceof \Illuminate\Cache\Repository,
'memcached.connector' instanceof \Illuminate\Cache\MemcachedConnector,
'command.cache.clear' instanceof \Illuminate\Cache\Console\ClearCommand,
'command.cache.table' instanceof \Illuminate\Cache\Console\CacheTableCommand,
'command.auth.resets.clear' instanceof \Illuminate\Auth\Console\ClearResetsCommand,
'migration.repository' instanceof \Illuminate\Database\Migrations\DatabaseMigrationRepository,
'migrator' instanceof \Illuminate\Database\Migrations\Migrator,
'command.migrate' instanceof \Illuminate\Database\Console\Migrations\MigrateCommand,
'command.migrate.rollback' instanceof \Illuminate\Database\Console\Migrations\RollbackCommand,
'command.migrate.reset' instanceof \Illuminate\Database\Console\Migrations\ResetCommand,
'command.migrate.refresh' instanceof \Illuminate\Database\Console\Migrations\RefreshCommand,
'command.migrate.install' instanceof \Illuminate\Database\Console\Migrations\InstallCommand,
'migration.creator' instanceof \Illuminate\Database\Migrations\MigrationCreator,
'command.migrate.make' instanceof \Illuminate\Database\Console\Migrations\MigrateMakeCommand,
'command.migrate.status' instanceof \Illuminate\Database\Console\Migrations\StatusCommand,
'command.seed' instanceof \Illuminate\Database\Console\Seeds\SeedCommand,
'command.seeder.make' instanceof \Illuminate\Database\Console\Seeds\SeederMakeCommand,
'seeder' instanceof \Illuminate\Database\Seeder,
'composer' instanceof \Illuminate\Foundation\Composer,
'command.queue.table' instanceof \Illuminate\Queue\Console\TableCommand,
'command.queue.failed' instanceof \Illuminate\Queue\Console\ListFailedCommand,
'command.queue.retry' instanceof \Illuminate\Queue\Console\RetryCommand,
'command.queue.forget' instanceof \Illuminate\Queue\Console\ForgetFailedCommand,
'command.queue.flush' instanceof \Illuminate\Queue\Console\FlushFailedCommand,
'command.queue.failed-table' instanceof \Illuminate\Queue\Console\FailedTableCommand,
'command.controller.make' instanceof \Illuminate\Routing\Console\ControllerMakeCommand,
'command.middleware.make' instanceof \Illuminate\Routing\Console\MiddlewareMakeCommand,
'command.session.database' instanceof \Illuminate\Session\Console\SessionTableCommand,
'hash' instanceof \Illuminate\Hashing\BcryptHasher,
'mailer' instanceof \Illuminate\Mail\Mailer,
'Illuminate\Contracts\Pipeline\Hub' instanceof \Illuminate\Pipeline\Hub,
'queue' instanceof \Illuminate\Queue\QueueManager,
'queue.connection' instanceof \Illuminate\Queue\SyncQueue,
'command.queue.work' instanceof \Illuminate\Queue\Console\WorkCommand,
'command.queue.restart' instanceof \Illuminate\Queue\Console\RestartCommand,
'queue.worker' instanceof \Illuminate\Queue\Worker,
'command.queue.listen' instanceof \Illuminate\Queue\Console\ListenCommand,
'queue.listener' instanceof \Illuminate\Queue\Listener,
'command.queue.subscribe' instanceof \Illuminate\Queue\Console\SubscribeCommand,
'queue.failer' instanceof \Illuminate\Queue\Failed\DatabaseFailedJobProvider,
'IlluminateQueueClosure' instanceof \IlluminateQueueClosure,
'auth.password' instanceof \Illuminate\Auth\Passwords\PasswordBroker,
'auth.password.tokens' instanceof \Illuminate\Auth\Passwords\DatabaseTokenRepository,
'command.ide-helper.generate' instanceof \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand,
'command.ide-helper.models' instanceof \Barryvdh\LaravelIdeHelper\Console\ModelsCommand,
'command.ide-helper.meta' instanceof \Barryvdh\LaravelIdeHelper\Console\MetaCommand,
'html' instanceof \Illuminate\Html\HtmlBuilder,
'form' instanceof \Illuminate\Html\FormBuilder,
],
app('') => [
'' == '@',
'events' instanceof \Illuminate\Events\Dispatcher,
'router' instanceof \Illuminate\Routing\Router,
'url' instanceof \Illuminate\Routing\UrlGenerator,
'redirect' instanceof \Illuminate\Routing\Redirector,
'Illuminate\Contracts\Routing\ResponseFactory' instanceof \Illuminate\Routing\ResponseFactory,
'Illuminate\Contracts\Http\Kernel' instanceof \App\Http\Kernel,
'Illuminate\Contracts\Console\Kernel' instanceof \App\Console\Kernel,
'Illuminate\Contracts\Debug\ExceptionHandler' instanceof \App\Exceptions\Handler,
'Psr\Log\LoggerInterface' instanceof \Monolog\Logger,
'auth' instanceof \Illuminate\Auth\AuthManager,
'auth.driver' instanceof \Toddish\Verify\Auth\VerifyGuard,
'Illuminate\Contracts\Auth\Access\Gate' instanceof \Illuminate\Auth\Access\Gate,
'illuminate.route.dispatcher' instanceof \Illuminate\Routing\ControllerDispatcher,
'cookie' instanceof \Illuminate\Cookie\CookieJar,
'Illuminate\Contracts\Queue\EntityResolver' instanceof \Illuminate\Database\Eloquent\QueueEntityResolver,
'db.factory' instanceof \Illuminate\Database\Connectors\ConnectionFactory,
'db' instanceof \Illuminate\Database\DatabaseManager,
'encrypter' instanceof \Illuminate\Encryption\Encrypter,
'files' instanceof \Illuminate\Filesystem\Filesystem,
'filesystem' instanceof \Illuminate\Filesystem\FilesystemManager,
'filesystem.disk' instanceof \Illuminate\Filesystem\FilesystemAdapter,
'session' instanceof \Illuminate\Session\SessionManager,
'session.store' instanceof \Illuminate\Session\Store,
'Illuminate\Session\Middleware\StartSession' instanceof \Illuminate\Session\Middleware\StartSession,
'validation.presence' instanceof \Illuminate\Validation\DatabasePresenceVerifier,
'view.engine.resolver' instanceof \Illuminate\View\Engines\EngineResolver,
'view.finder' instanceof \Illuminate\View\FileViewFinder,
'view' instanceof \Illuminate\View\Factory,
'recaptcha.service' instanceof \Greggilbert\Recaptcha\Service\CheckRecaptchaV2,
'recaptcha' instanceof \Greggilbert\Recaptcha\Recaptcha,
'Cviebrock\EloquentTaggable\Services\TagService' instanceof \Cviebrock\EloquentTaggable\Services\TagService,
'blade.compiler' instanceof \Illuminate\View\Compilers\BladeCompiler,
'translation.loader' instanceof \Illuminate\Translation\FileLoader,
'translator' instanceof \Illuminate\Translation\Translator,
'command.app.name' instanceof \Illuminate\Foundation\Console\AppNameCommand,
'command.clear-compiled' instanceof \Illuminate\Foundation\Console\ClearCompiledCommand,
'command.command.make' instanceof \Illuminate\Foundation\Console\CommandMakeCommand,
'command.config.cache' instanceof \Illuminate\Foundation\Console\ConfigCacheCommand,
'command.config.clear' instanceof \Illuminate\Foundation\Console\ConfigClearCommand,
'command.console.make' instanceof \Illuminate\Foundation\Console\ConsoleMakeCommand,
'command.event.generate' instanceof \Illuminate\Foundation\Console\EventGenerateCommand,
'command.event.make' instanceof \Illuminate\Foundation\Console\EventMakeCommand,
'command.down' instanceof \Illuminate\Foundation\Console\DownCommand,
'command.environment' instanceof \Illuminate\Foundation\Console\EnvironmentCommand,
'command.handler.command' instanceof \Illuminate\Foundation\Console\HandlerCommandCommand,
'command.handler.event' instanceof \Illuminate\Foundation\Console\HandlerEventCommand,
'command.job.make' instanceof \Illuminate\Foundation\Console\JobMakeCommand,
'command.key.generate' instanceof \Illuminate\Foundation\Console\KeyGenerateCommand,
'command.listener.make' instanceof \Illuminate\Foundation\Console\ListenerMakeCommand,
'command.model.make' instanceof \Illuminate\Foundation\Console\ModelMakeCommand,
'command.optimize' instanceof \Illuminate\Foundation\Console\OptimizeCommand,
'command.policy.make' instanceof \Illuminate\Foundation\Console\PolicyMakeCommand,
'command.provider.make' instanceof \Illuminate\Foundation\Console\ProviderMakeCommand,
'command.request.make' instanceof \Illuminate\Foundation\Console\RequestMakeCommand,
'command.route.cache' instanceof \Illuminate\Foundation\Console\RouteCacheCommand,
'command.route.clear' instanceof \Illuminate\Foundation\Console\RouteClearCommand,
'command.route.list' instanceof \Illuminate\Foundation\Console\RouteListCommand,
'command.serve' instanceof \Illuminate\Foundation\Console\ServeCommand,
'command.test.make' instanceof \Illuminate\Foundation\Console\TestMakeCommand,
'command.tinker' instanceof \Illuminate\Foundation\Console\TinkerCommand,
'command.up' instanceof \Illuminate\Foundation\Console\UpCommand,
'command.vendor.publish' instanceof \Illuminate\Foundation\Console\VendorPublishCommand,
'command.view.clear' instanceof \Illuminate\Foundation\Console\ViewClearCommand,
'Illuminate\Broadcasting\BroadcastManager' instanceof \Illuminate\Broadcasting\BroadcastManager,
'Illuminate\Bus\Dispatcher' instanceof \Illuminate\Bus\Dispatcher,
'cache' instanceof \Illuminate\Cache\CacheManager,
'cache.store' instanceof \Illuminate\Cache\Repository,
'memcached.connector' instanceof \Illuminate\Cache\MemcachedConnector,
'command.cache.clear' instanceof \Illuminate\Cache\Console\ClearCommand,
'command.cache.table' instanceof \Illuminate\Cache\Console\CacheTableCommand,
'command.auth.resets.clear' instanceof \Illuminate\Auth\Console\ClearResetsCommand,
'migration.repository' instanceof \Illuminate\Database\Migrations\DatabaseMigrationRepository,
'migrator' instanceof \Illuminate\Database\Migrations\Migrator,
'command.migrate' instanceof \Illuminate\Database\Console\Migrations\MigrateCommand,
'command.migrate.rollback' instanceof \Illuminate\Database\Console\Migrations\RollbackCommand,
'command.migrate.reset' instanceof \Illuminate\Database\Console\Migrations\ResetCommand,
'command.migrate.refresh' instanceof \Illuminate\Database\Console\Migrations\RefreshCommand,
'command.migrate.install' instanceof \Illuminate\Database\Console\Migrations\InstallCommand,
'migration.creator' instanceof \Illuminate\Database\Migrations\MigrationCreator,
'command.migrate.make' instanceof \Illuminate\Database\Console\Migrations\MigrateMakeCommand,
'command.migrate.status' instanceof \Illuminate\Database\Console\Migrations\StatusCommand,
'command.seed' instanceof \Illuminate\Database\Console\Seeds\SeedCommand,
'command.seeder.make' instanceof \Illuminate\Database\Console\Seeds\SeederMakeCommand,
'seeder' instanceof \Illuminate\Database\Seeder,
'composer' instanceof \Illuminate\Foundation\Composer,
'command.queue.table' instanceof \Illuminate\Queue\Console\TableCommand,
'command.queue.failed' instanceof \Illuminate\Queue\Console\ListFailedCommand,
'command.queue.retry' instanceof \Illuminate\Queue\Console\RetryCommand,
'command.queue.forget' instanceof \Illuminate\Queue\Console\ForgetFailedCommand,
'command.queue.flush' instanceof \Illuminate\Queue\Console\FlushFailedCommand,
'command.queue.failed-table' instanceof \Illuminate\Queue\Console\FailedTableCommand,
'command.controller.make' instanceof \Illuminate\Routing\Console\ControllerMakeCommand,
'command.middleware.make' instanceof \Illuminate\Routing\Console\MiddlewareMakeCommand,
'command.session.database' instanceof \Illuminate\Session\Console\SessionTableCommand,
'hash' instanceof \Illuminate\Hashing\BcryptHasher,
'mailer' instanceof \Illuminate\Mail\Mailer,
'Illuminate\Contracts\Pipeline\Hub' instanceof \Illuminate\Pipeline\Hub,
'queue' instanceof \Illuminate\Queue\QueueManager,
'queue.connection' instanceof \Illuminate\Queue\SyncQueue,
'command.queue.work' instanceof \Illuminate\Queue\Console\WorkCommand,
'command.queue.restart' instanceof \Illuminate\Queue\Console\RestartCommand,
'queue.worker' instanceof \Illuminate\Queue\Worker,
'command.queue.listen' instanceof \Illuminate\Queue\Console\ListenCommand,
'queue.listener' instanceof \Illuminate\Queue\Listener,
'command.queue.subscribe' instanceof \Illuminate\Queue\Console\SubscribeCommand,
'queue.failer' instanceof \Illuminate\Queue\Failed\DatabaseFailedJobProvider,
'IlluminateQueueClosure' instanceof \IlluminateQueueClosure,
'auth.password' instanceof \Illuminate\Auth\Passwords\PasswordBroker,
'auth.password.tokens' instanceof \Illuminate\Auth\Passwords\DatabaseTokenRepository,
'command.ide-helper.generate' instanceof \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand,
'command.ide-helper.models' instanceof \Barryvdh\LaravelIdeHelper\Console\ModelsCommand,
'command.ide-helper.meta' instanceof \Barryvdh\LaravelIdeHelper\Console\MetaCommand,
'html' instanceof \Illuminate\Html\HtmlBuilder,
'form' instanceof \Illuminate\Html\FormBuilder,
],
];
}

12737
_ide_helper.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,92 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Video;
use App\Models\User;
use App\Models\Category;
class AddTags extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'tags';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Adds category names as tags and changes filters from users.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
// Videos
echo 'UPDATING VIDEOS', PHP_EOL, '===============', PHP_EOL;
$count = 0;
Video::withTrashed()->with('category')->chunk(200, function($videos) use ($count) {
foreach($videos as $v) {
echo 'Updating Video with ID: ', $v->id, PHP_EOL;
$v->detag();
// quick and dirty. not 100% correct though.
if($v->category->shortname === 'pr0n')
$v->tag('nsfw');
else
$v->tag('sfw');
$v->tag(array_filter([$v->category->shortname
, $v->category->name
, $v->interpret
, $v->songtitle
, $v->imgsource
], function($elem) {
return !empty(trim($elem));
}));
$count++;
}
});
echo PHP_EOL, PHP_EOL, 'Updated ', $count, ' Videos.', PHP_EOL, PHP_EOL, PHP_EOL;
// User filters
echo 'UPDATING USERS', PHP_EOL, '==============', PHP_EOL;
$count = 0;
$categories = Category::withTrashed()->get()->keyBy('id');
User::withTrashed()->chunk(200, function($users) use (&$count, $categories) {
foreach($users as $u) {
echo 'Updating User: ', $u->username, PHP_EOL;
$u->categories = array_values($categories->filter(function($cat) use($u) {
return !in_array($cat->id, $u->categories);
})->map(function($cat) {
return $cat->shortname;
})->all());
$u->save();
$count++;
}
});
echo PHP_EOL, PHP_EOL, 'Updated ', $count, ' Users.', PHP_EOL, PHP_EOL, PHP_EOL;
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
class Inspire extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'inspire';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Display an inspiring quote';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class ReadException extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'exception {file=php://stdin}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Decrypts encrypted exception messages';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$input = $this->argument('file');
$c = file_get_contents($input);
if (false === $c) {
$this->error('File not found');
return;
}
//dd(explode(PHP_EOL, $c));
list($iv, $c) = explode(PHP_EOL, $c);
$iv = hex2bin($iv);
$m = openssl_decrypt($c, 'aes128', env('APP_KEY'), 0, $iv);
$this->line($m);
}
}

32
app/Console/Kernel.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\AddTags::class,
Commands\Inspire::class,
Commands\ReadException::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')
->hourly();
}
}

8
app/Events/Event.php Normal file
View File

@@ -0,0 +1,8 @@
<?php
namespace App\Events;
abstract class Event
{
//
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
HttpException::class,
ModelNotFoundException::class,
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if (app()->bound('sentry') && $this->shouldReport($e)) {
app('sentry')->captureException($e);
}
return parent::report($e);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
* @todo Perhaps replace odd encrypted error with Sentry notification
*/
public function render($request, Exception $e)
{
if ($e instanceof ModelNotFoundException) {
$e = new NotFoundHttpException($e->getMessage(), $e);
}
if ($this->isUnauthorizedException($e)) {
$e = new HttpException(403, $e->getMessage());
}
if ($this->isHttpException($e)) {
return $this->toIlluminateResponse($this->renderHttpException($e), $e);
} else {
$res = \Response::make(
view('errors.500', ['exception' => $e]),
500);
$res->exception = $e;
return $res;
}
//return parent::render($request, $e);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Helpers;
class HumanReadable
{
public static function bytesToHuman($bytes)
{
$units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'];
for ($i = 0; $bytes > 1024; $i++) {
$bytes /= 1024;
}
return round($bytes, 2) . ' ' . $units[$i];
}
}

View File

@@ -0,0 +1,116 @@
<?php
namespace App\Http\Controllers;
use App\Models\Category;
use App\Models\Video;
use App\Models\Banner;
use Illuminate\Http\Request;
use Illuminate\Database\Eloquent\Relations\HasMany;
use App\Http\Requests;
class CategoryController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Response
*/
public function index()
{
return view('categories', ['categories' => Category::all()]);
}
/**
* Show the form for creating a new resource.
*
* @return \Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return \Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param string $shortname
* @param int $id
* @return \Response
*/
public function showVideo($shortname, $id = null)
{
$category = Category::whereShortname($shortname)->first();
if (is_null($category)) {
return redirect()->back()->with('error', 'Category not found');
}
if (is_null($id)) {
$video = Video::getRandom($category);
if ($video instanceof HasMany) {
$video = $video->first();
}
else {
return redirect()->back()->with('error', 'Category is empty.');
}
return redirect($shortname . '/' . $video->id);
} else {
// Don't filter on specific video.
// TODO: Add warning page
$video = $category->videos()->find($id);
}
if (is_null($video)) {
return redirect()->back()->with('error', 'Category is empty.');
}
return view('video', [
'video' => $video,
'related' => $category,
'banner' => Banner::getRandom($video->isSfw())]);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return \Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Response
*/
public function destroy($id)
{
//
}
}

View File

@@ -0,0 +1,237 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Category;
use App\Models\Comment;
use App\Models\Message;
use App\Models\ModeratorLog;
use App\Models\Video;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class CommentController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
if(!$request->has('username')) return JsonResponse::create('Not found', '304');
$user = User::whereUsername(urldecode($request->get('username')))->first();
if(!$user) return JsonResponse::create('Not found', '304');
return $user->comments()->orderBy('id', 'desc')->paginate(10);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request, $id)
{
$user = auth()->check() ? auth()->user() : null;
$xhr = $request->ajax();
if(is_null($user)) return $xhr ? "Not logged in" : redirect()->back()->with('error', 'Not logged in');
if(!$request->has('comment')) return $xhr ? "You need to enter a comment" : redirect()->back()->with('error', 'You need to enter a comment');
if(mb_strlen(trim($request->get('comment'))) > 2000 ) return $xhr ? "Comment to long" : redirect()->back()->with('error', 'Comment to long');
$video = Video::findOrFail($id);
$com = new Comment();
$com->content = trim($request->get('comment'));
$com->user()->associate($user);
$com->video()->associate($video);
$com->save();
$sent = [];
foreach($com->getMentioned() as $mentioned) {
Message::send($user->id, $mentioned->id, $user->username . ' mentioned you in a comment', view('messages.commentmention', ['video' => $video, 'user' => $user, 'comment' => $com]));
$sent[] = $mentioned;
}
foreach($com->answered() as $answered) {
if(array_search($answered, $sent) !== false)
continue;
Message::send($user->id, $answered->id, $user->username . ' answered on your comment', view('messages.commentanswer', ['video' => $video, 'user' => $user, 'comment' => $com]));
$sent[] = $answered;
}
if($user->id != $video->user->id)
if(array_search($video->user, $sent) === false)
Message::send($user->id, $video->user->id, $user->username . ' commented on your video', view('messages.videocomment', ['video' => $video, 'user' => $user, 'comment' => $com]));
return $xhr ? view('partials.comment', ['comment' => $com, 'mod' => $user->can('delete_comment')]) : redirect()->back()->with('success', 'Comment successfully saved');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$comment = Comment::whereId($id)->first();
if(!is_null($comment)) {
return JsonResponse::create(array(
'error' => 'null',
'comment' => Comment::whereId($id)->first()->content)
);
}
return JsonResponse::create(array(
'error' => 'comment_not_found'
));
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
if(!($request->has('comment')))
return JsonResponse::create(array('error' => 'invalid_request'));
$user = auth()->check() ? auth()->user() : null;
if(is_null($user))
return JsonResponse::create(array('error' => 'not_logged_in'));
if(!$user->can('edit_comment'))
return JsonResponse::create(array('error' => 'insufficient_permissions'));
if(is_null($comment = Comment::whereId($id)->first()))
return JsonResponse::create(array('error' => 'comment_not_found'));
$comment->content = trim($request->get('comment'));
$comment->save();
$log = new ModeratorLog();
$log->user()->associate($user);
$log->type = 'edit';
$log->target_type = 'comment';
$log->target_id = $id;
$log->save();
return JsonResponse::create(array(
'error' => 'null',
'rendered_comment' => Comment::simplemd($comment->content)
));
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(Request $request, $id)
{
if(!$request->has('reason'))
return 'invalid_request';
$reason = trim($request->get('reason'));
if($reason == '')
return 'invalid_request';
$user = auth()->check() ? auth()->user() : null;
if(is_null($user))
return 'not_logged_in';
if(!$user->can('delete_comment'))
return 'insufficient_permissions';
$comment = Comment::whereId($id)->first();
if(is_null($comment))
return 'comment_not_found';
$receiver = $comment->user;
$video = $comment->video;
Comment::destroy($id);
if($user->id != $receiver->id)
Message::send(1, $receiver->id, 'A moderator deleted your comment', view('messages.moderation.commentdelete', ['video' => $video, 'comment' => $comment, 'reason' => $reason]));
$log = new ModeratorLog();
$log->user()->associate($user);
$log->type = 'delete';
$log->target_type = 'comment';
$log->target_id = $id;
$log->reason = $reason;
$log->save();
return 'success';
}
public function restore(Request $request, $id)
{
if(!$request->has('reason'))
return 'invalid_request';
$reason = trim($request->get('reason'));
if($reason == '')
return 'invalid_request';
$user = auth()->check() ? auth()->user() : null;
if(is_null($user))
return 'not_logged_in';
if(!$user->can('delete_comment'))
return 'insufficient_permissions';
$comment = Comment::withTrashed()->whereId($id)->first();
if(is_null($comment))
return 'comment_not_found';
if(!$comment->trashed())
return 'comment_not_deleted';
$receiver = $comment->user;
$video = $comment->video;
$comment->restore();
if($user->id != $receiver->id)
Message::send(1, $receiver->id, 'A moderator restored your comment', view('messages.moderation.commentrestore', ['video' => $video, 'comment' => $comment, 'reason' => $reason]));
$log = new ModeratorLog();
$log->user()->associate($user);
$log->type = 'restore';
$log->target_type = 'comment';
$log->target_id = $id;
$log->reason = $reason;
$log->save();
return 'success';
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
abstract class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

View File

@@ -0,0 +1,112 @@
<?php
namespace App\Http\Controllers;
use App\Models\Message;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Http\Requests;
use Illuminate\Http\Response;
class MessageController extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
if(!auth()->check()) return JsonResponse::create('Not found', '304');
return auth()->user()->messagesRecv()->orderBy('id', 'desc')->paginate(15);
}
public function page()
{
if(!auth()->check()) return redirect()->back()->with('warning', 'You are not logged in');
return view('messages');
}
public function read(Request $request)
{
if(!auth()->check()) return Response::create('Unauthorized', '401');
if($request->has('m_ids')) {
$ids = $request->get('m_ids');
Message::whereTo(auth()->user()->id)->whereIn('id', $ids)->update(['read' => \Carbon\Carbon::now()]);
return 1;
}
}
public function readall()
{
if(!auth()->check()) return Response::create('Unauthorized', '401');
Message::whereTo(auth()->user()->id)->unread()->update(['read' => \Carbon\Carbon::now()]);
return 1;
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}
}

View File

@@ -0,0 +1,306 @@
<?php
namespace App\Http\Controllers;
use App\Models\Report;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class ReportController extends Controller
{
private $fromMail = "otter@w0bm.com";
private $fromName = "w0bm";
private $toMail = "admin@w0bm.com";
private $toName = "w0bm";
private $subject = "webm reported";
private $baseURL = "http://w0bm.com/";
/**
* Made by klee
* Testing to make report crap
*
*/
public function report(Request $request)
{
if(is_array($request->input('reportReasons'))) {
$reportReasons = "<li>".implode("</li><li>", $request->input('reportReasons'));
} else {
$reportReasons = "<li>".$request->input('reportReasons')."</li>";
}
if($request->user()->username == "" || $request->user()->username == null) {
$username = "User is <b>anonymous</b> because he is not registered";
} else {
$username = $request->user()->username;
}
$data = array(
"videoURL" => $this->baseURL.$request->route('id'),
"reportReasons" => $reportReasons,
"reportText" => htmlspecialchars($request->input('reportText')),
"username" => $username,
"videoID" => $request->route('id'),
"message" => array(
"html" => 'html message',
"text" => 'text message',
"to" => array(
array("name" => 'admin@w0bm.com', "email" => 'admin@w0bm.com')
),
"from_email" => 'otter@w0bm.com',
"from_name" => 'from w0bm',
"subject" => 'the subject',
"track_opens" => true,
"track_clicks" => true
),
"async" => false,
"debugOutput" => print_r(get_class_methods($request), true).print_r($request->route()->parameters(), true)
);
//$postString = json_encode($data);
\Mail::send('emails.report', $data, function ($msg) {
$msg->from($this->fromMail, $this->fromName);
$msg->to($this->toMail, $this->toName);
$msg->subject($this->subject);
});
return redirect()->back()->with('success', 'Report successfully sent');;
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
/*
if(!$request->has('username')) return JsonResponse::create('Not found', '304');
$user = User::whereUsername(urldecode($request->get('username')))->first();
if(!$user) return JsonResponse::create('Not found', '304');
return $user->comments()->orderBy('id', 'desc')->paginate(10);
*/
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request, $id)
{
/*
$user = auth()->check() ? auth()->user() : null;
$xhr = $request->ajax();
if(is_null($user)) return $xhr ? "Not logged in" : redirect()->back()->with('error', 'Not logged in');
if(!$request->has('comment')) return $xhr ? "You need to enter a comment" : redirect()->back()->with('error', 'You need to enter a comment');
if(mb_strlen(trim($request->get('comment'))) > 2000 ) return $xhr ? "Comment to long" : redirect()->back()->with('error', 'Comment to long');
$video = Video::findOrFail($id);
$com = new Comment();
$com->content = trim($request->get('comment'));
$com->user()->associate($user);
$com->video()->associate($video);
$com->save();
$sent = [];
foreach($com->getMentioned() as $mentioned) {
Message::send($user->id, $mentioned->id, $user->username . ' mentioned you in a comment', view('messages.commentmention', ['video' => $video, 'user' => $user, 'comment' => $com]));
$sent[] = $mentioned;
}
foreach($com->answered() as $answered) {
if(array_search($answered, $sent) !== false)
continue;
Message::send($user->id, $answered->id, $user->username . ' answered on your comment', view('messages.commentanswer', ['video' => $video, 'user' => $user, 'comment' => $com]));
$sent[] = $answered;
}
if($user->id != $video->user->id)
if(array_search($video->user, $sent) === false)
Message::send($user->id, $video->user->id, $user->username . ' commented on your video', view('messages.videocomment', ['video' => $video, 'user' => $user, 'comment' => $com]));
return $xhr ? view('partials.comment', ['comment' => $com, 'mod' => $user->can('delete_comment')]) : redirect()->back()->with('success', 'Comment successfully saved');
*/
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
/*
$comment = Comment::whereId($id)->first();
if(!is_null($comment)) {
return JsonResponse::create(array(
'error' => 'null',
'comment' => Comment::whereId($id)->first()->content)
);
}
return JsonResponse::create(array(
'error' => 'comment_not_found'
));
*/
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
/*
if(!($request->has('comment')))
return JsonResponse::create(array('error' => 'invalid_request'));
$user = auth()->check() ? auth()->user() : null;
if(is_null($user))
return JsonResponse::create(array('error' => 'not_logged_in'));
if(!$user->can('edit_comment'))
return JsonResponse::create(array('error' => 'insufficient_permissions'));
if(is_null($comment = Comment::whereId($id)->first()))
return JsonResponse::create(array('error' => 'comment_not_found'));
$comment->content = trim($request->get('comment'));
$comment->save();
$log = new ModeratorLog();
$log->user()->associate($user);
$log->type = 'edit';
$log->target_type = 'comment';
$log->target_id = $id;
$log->save();
*/
return JsonResponse::create(array(
'error' => 'null',
'rendered_comment' => "test rendered comment"//Comment::simplemd($comment->content)
));
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(Request $request, $id)
{
/*
if(!$request->has('reason'))
return 'invalid_request';
$reason = trim($request->get('reason'));
if($reason == '')
return 'invalid_request';
$user = auth()->check() ? auth()->user() : null;
if(is_null($user))
return 'not_logged_in';
if(!$user->can('delete_comment'))
return 'insufficient_permissions';
$comment = Comment::whereId($id)->first();
if(is_null($comment))
return 'comment_not_found';
$receiver = $comment->user;
$video = $comment->video;
Comment::destroy($id);
if($user->id != $receiver->id)
Message::send(1, $receiver->id, 'A moderator deleted your comment', view('messages.moderation.commentdelete', ['video' => $video, 'comment' => $comment, 'reason' => $reason]));
$log = new ModeratorLog();
$log->user()->associate($user);
$log->type = 'delete';
$log->target_type = 'comment';
$log->target_id = $id;
$log->reason = $reason;
$log->save();
*/
return 'success';
}
public function restore(Request $request, $id)
{
/*
if(!$request->has('reason'))
return 'invalid_request';
$reason = trim($request->get('reason'));
if($reason == '')
return 'invalid_request';
$user = auth()->check() ? auth()->user() : null;
if(is_null($user))
return 'not_logged_in';
if(!$user->can('delete_comment'))
return 'insufficient_permissions';
$comment = Comment::withTrashed()->whereId($id)->first();
if(is_null($comment))
return 'comment_not_found';
if(!$comment->trashed())
return 'comment_not_deleted';
$receiver = $comment->user;
$video = $comment->video;
$comment->restore();
if($user->id != $receiver->id)
Message::send(1, $receiver->id, 'A moderator restored your comment', view('messages.moderation.commentrestore', ['video' => $video, 'comment' => $comment, 'reason' => $reason]));
$log = new ModeratorLog();
$log->user()->associate($user);
$log->type = 'restore';
$log->target_type = 'comment';
$log->target_id = $id;
$log->reason = $reason;
$log->save();
*/
return 'success';
}
}

View File

@@ -0,0 +1,401 @@
<?php
namespace App\Http\Controllers;
use App\Models\Category;
use App\Models\User;
use App\Models\UserFavorite;
use Illuminate\Http\Request;
use Carbon\Carbon;
use App\Models\ModeratorLog;
use App\Models\Banner;
use Symfony\Component\HttpFoundation\Response;
use Toddish\Verify\Helpers\Verify;
class UserController extends Controller
{
/**
* @param Request $request
* @return \Response
*/
public function login(Request $request)
{
if($request->has('identifier') && $request->has('password')) {
switch(\Auth::verify([
'identifier' => $request->get('identifier'),
'password' => $request->get('password')
], $request->has('remember')))
{
case Verify::SUCCESS:
#\Session::put('background', auth()->user()->background);
return redirect("/")->with('success', 'Login successful');
case Verify::INVALID_CREDENTIALS:
return redirect()->back()->with('error', 'Invalid credentials');
case Verify::DISABLED:
$user = User::whereUsername($request->get('identifier'))
->orWhere('email', $request->get('identifier'))
->first();
if($user->banend->eq(Carbon::createFromTimestampUTC(1))) {
return view('banned', ['user' => $user, 'perm' => true]);
}
// if ban expired unban and relogin.
if($user->banend->lt(Carbon::now())) {
$user->banend = null;
$user->disabled = 0;
$user->banreason = null;
$user->save();
return $this->login($request);
}
return view('banned', ['user' => $user, 'perm' => false]);
case Verify::UNVERIFIED:
return redirect()->back()->with('error', 'Please verify your account');
}
}
return redirect()->back()->with('error', 'Missing credentials');
}
public function logout()
{
if(!auth()->check()) return redirect()->back()->with('warning', 'You are not logged in');
auth()->logout();
return redirect('/')->with('success', 'Logout successful');
}
/**
* Display a listing of the resource.
*
* @return \Response
*/
public function index()
{
//
}
/**
* Add tags to filter
*
* @param Request $request
* @return Response
*/
public function filter(Request $request) {
//dd($request->get('categories'));
if(!auth()->check())
return Response::create("Not logged in", 401);
if(!$request->has('filter'))
$filter = [];
else
$filter = explode(',', $request->get('filter'));
auth()->user()->categories = $filter;
auth()->user()->save();
if(!$request->ajax())
return redirect()->back()->with('success', 'Filter settings saved');
return Response::create(json_encode($filter));
}
/**
* Show the form for creating a new resource.
*
* @return \Response
*/
public function create()
{
if(auth()->check()) {
\Session::reflash();
\Session::flash('info', 'Cannot register when logged in');
return redirect('/');
}
return view('register');
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return \Response
*/
public function store(Request $request)
{
if(auth()->check()) return redirect()->back()->with('info', 'Cannot register when logged in');
$validator = \Validator::make($request->all(), [
'username' => 'required|unique:users|min:3|max:25|alpha_num',
//'email' => 'required|email|unique:users|confirmed',
'password' => 'required|min:6|confirmed',
'g-recaptcha-response' => 'required|recaptcha'
]);
if($validator->fails()) {
return redirect()->back()->withErrors($validator->errors())
->withInput($request->except(['password', 'password_confirmation']));
}
//$activation_token = str_random(8) . md5($request->get('email')) . str_random(10);
$user = new User();
$user->username = $request->get('username');
$user->email = ""; //$request->get('email');
$user->password = $request->get('password');
$user->activation_token = ""; //$activation_token;
$user->disabled = 0;
$user->verified = 1;
$user->categories = [];
if($user->save()) {
/*$data = [
'username' => $user->username,
'activation_token' => $activation_token
];*/
// Send Mail
/*\Mail::queue('emails.activation', $data, function($message) use ($user) {
$message->to($user->email, $user->username)->subject('Welcome to w0bm. Activate your account');
});*/
return redirect('/')->with('info', 'Congratulations! You can now login!');
} else {
return redirect()->back()->with('error', 'Account could not be created')->withInput($request->except(['password', 'password_confirmation']));
}
}
public function activate($token)
{
$user = User::where('activation_token', '=', $token)->first();
if(!$user) {
return redirect('/')->with('error', 'Account already activate or no account found');
}
$user->verified = 1;
$user->activation_token = null;
$user->save();
auth()->login($user);
return redirect('/')->with('success', 'Successfully activate and logged in.');
}
/**
* Display the specified resource.
*
* @param string $username
* @return \Response
*/
public function show($username)
{
$user = User::where('username', '=', $username)->first();
if(!$user) {
return redirect()->back()->with('error', 'Unknown username');
}
$vids = $user->videos()->filtered()->paginate(50);
return view('profile', ['title' => 'Uploads', 'user' => $user, 'videos' => $vids]);
}
public function show_favs($username)
{
$user = UserFavorite::where('username', '=', $username)->first();
if (!$user) {
return redirect()->back()->with('error', 'Unknown username');
}
$vids = $user->favs()->filtered()->orderBy('favorites.created_at')->paginate(50);
return view('profile', ['title' => 'Favorites', 'user' => $user, 'videos' => $vids]);
}
public function show_comments($username)
{
$user = User::where('username', '=', $username)->first();
if(!$user) {
return redirect()->back()->with('error', 'Unknown username');
}
return view('comments', ['user' => $user]);
}
public function ban(Request $request, $username)
{
if(!($request->has('reason') && $request->has('duration')))
return redirect()->back()->with('error', 'Invalid Request');
if(trim($reason = $request->get('reason')) == '')
return redirect()->back()->with('error', 'You need to specify a ban reason');
$user = auth()->check() ? auth()->user() : null;
if(is_null($user))
return redirect()->back()->with('error', 'Not logged in');
if(!$user->can('edit_user'))
return redirect()->back()->with('error', 'Insufficient permissions');
$perm = false;
if(($duration = $request->get('duration')) == '-1') {
$duration = Carbon::createFromTimestampUTC(1);
$perm = true;
} else {
preg_match('/^(\d+[yYaA])?\s*(\d+M)?\s*(\d+[wW])?\s*(\d+[dD])?\s*(\d+[Hh])?\s*(\d+[m])?\s*(\d+[sS])?$/m', $duration, $duration);
array_shift($duration);
$duration = array_map(function($elem) {
return intval(mb_substr($elem, 0, -1));
}, $duration);
$duration = Carbon::now()
->addYears($duration[0] ?? 0)
->addMonths($duration[1] ?? 0)
->addWeeks($duration[2] ?? 0)
->addDays($duration[3] ?? 0)
->addHours($duration[4] ?? 0)
->addMinutes($duration[5] ?? 0)
->addSeconds($duration[6] ?? 0);
}
$userToBan = User::whereUsername($username)->first();
if(is_null($user))
return redirect()->back()->with('error', 'User not found');
$userToBan->disabled = 1;
$userToBan->banreason = $reason;
$userToBan->banend = $duration;
$userToBan->save();
$log = new ModeratorLog();
$log->user()->associate($user);
$log->type = 'ban';
$log->target_type = 'user';
$log->target_id = $userToBan->id;
$log->reason = $reason;
$log->save();
if($perm)
return redirect()->back()->with('success', 'User ' . $userToBan->username . ' has been permanently banned');
else
return redirect()->back()->with('success', 'User ' . $userToBan->username . ' has been banned until ' . $userToBan->banend->format('d.m.Y H:i:s') . ' UTC');
}
/**
* Show the form for editing the specified resource.
*
* @param string $username
* @return \Response
*/
public function edit($username)
{
//
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return \Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Response
*/
public function destroy($id)
{
//
}
public function random($username) {
$user = User::where('username', '=', $username)->first();
if (!$user) {
return redirect()->back()->with('error', 'Unknown username');
}
$id = $user->videos()->filtered()->countScoped()->count() - 1;
if ($id < 0) {
return redirect()->back()->with('error', 'User has no uploads (Check your filter settings)');
}
$id = mt_rand(0, $id);
$vid = $user->videos()->filtered()->skip($id)->first()->id;
return redirect('/user/' . $username . '/uploads/' . $vid);
}
public function play($username, $id) {
$user = User::where('username', '=', $username)->first();
if (!$user) {
return redirect()->back()->with('error', 'Unknown username');
}
$vid = $user->videos()->filtered()->find($id);
if (!$vid) {
return redirect()->back()->with('error', 'Video not found on user');
}
return view('video', [
'video' => $vid,
'related' => $user,
'banner' => Banner::getRandom($vid->isSfw())
]);
}
// TODO: Cleanup. less Repetion between random and random_vav/play and play_fav
// Only difference are the redirect urls and the Base Model
public function random_fav($username) {
$user = UserFavorite::where('username', '=', $username)->first();
if (!$user) {
return redirect()->back()->with('error', 'Unknown username');
}
$id = $user->videos()->filtered()->countScoped()->count() - 1;
if ($id < 0) {
return redirect()->back()->with('error', 'No favorites (Check your filter settings)');
}
$id = mt_rand(0, $id);
$vid = $user->videos()->filtered()->skip($id)->first()->id;
return redirect('/user/' . $username . '/favs/' . $vid);
}
public function play_fav($username, $id) {
$user = UserFavorite::where('username', '=', $username)->first();
if (!$user) {
return redirect()->back()->with('error', 'Unknown username');
}
$vid = $user->videos()->filtered()->find($id);
if (!$vid) {
return redirect()->back()->with('error', 'Video not found on user');
}
return view('video', [
'video' => $vid,
'related' => $user,
'banner' => Banner::getRandom($vid->isSfw())
]);
}
public function setLayout(Request $request) {
if(!auth()->check())
return Response::create("unauthorized", 401);
if(!$request->has('layout'))
return Response::create("bad request", 400);
$layout = $request->get('layout');
if($layout !== strval(intval($layout)))
return Response::create("bad request", 400);
if(!in_array("layout" . $layout, array_map(function ($v) { return basename($v); }, glob("../resources/views/layout*"))))
return Response::create("bad request", 400);
auth()->user()->layout = $request->get('layout');
auth()->user()->save();
return Response::create("success", 200);
}
}

View File

@@ -0,0 +1,331 @@
<?php
namespace App\Http\Controllers;
use App\Models\Category;
use App\Models\Comment;
use App\Models\Message;
use App\Models\ModeratorLog;
use App\Models\Video;
use App\Models\Banner;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class VideoController extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request) {
if($request->has('q')){
$needle = trim($request->input('q'));
return view('index', [
'videos' => Video::filtered()->withAnyTagsFuzzy($needle)
->orderBy('id', 'asc')
->paginate(20)->appends(['q' => $needle]),
'categories' => Category::all(),
'q' => $needle
]);
}
return view('index', [
'videos' => Video::filtered()->orderBy('id', 'ASC')->paginate(20),
'categories' => Category::all()
]);
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
$user = auth()->check() ? auth()->user() : null;
return view('upload', ['user' => $user]);
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
/*var_dump($request->hasFile('file'));*/ if(!$request->hasFile('file') || !$request->has('category') || !$request->has('tags'))
return new JsonResponse(['error' => 'invalid_request']);
$tags = $request->get('tags');
if(mb_strpos($tags, 'sfw') === false && mb_strpos($tags, 'nsfw') === false)
return new JsonResponse(['error' => 'invalid_request']);
$user = auth()->check() ? auth()->user() : null;
if(is_null($user))
return new JsonResponse(['error' => 'not_logged_in']);
if(!$user->can('break_upload_limit') && $user->videos()->newlyups()->count() >= 10)
return new JsonResponse(['error' => 'uploadlimit_reached']);
$file = $request->file('file');
if(!$file->isValid()
|| mb_strtolower($file->getClientOriginalExtension()) !== 'webm'
|| mb_strtolower($file->getMimeType()) !== 'video/webm')
return new JsonResponse(['error' => 'invalid_file']);
if(!$user->can('break_max_filesize') && $file->getSize() > 41943040)
return new JsonResponse(['error' => 'file_too_big']);
if(($v = Video::withTrashed()->where('hash', '=', sha1_file($file->getRealPath()))->first()) !== null) {
if($v->trashed())
return new JsonResponse(['error' => 'already_exists']);
return new JsonResponse([
'error' => 'already_exists',
'video_id' => $v->id
]);
}
// meh time()
$file = $file->move(public_path() . '/b/', 'w0bm_' . time() . '.webm');
$hash = sha1_file($file->getRealPath());
$video = new Video();
$video->file = basename($file->getRealPath());
if(!$video->checkFileEncoding()) {
unlink($file->getRealPath());
// return before $video->save() so no need to clean up db
return new JsonResponse(['error' => 'erroneous_file_encoding']);
}
$video->videotitle = $request->get('videotitle', null);
$video->interpret = $request->get('interpret', null);
$video->songtitle = $request->get('songtitle', null);
$video->imgsource = $request->get('imgsource', null);
$video->user()->associate($user);
$video->category()->associate(Category::findOrFail($request->get('category')));
$video->hash = $hash;
$video->save();
$video->tag($tags);
$video->tag($video->videotitle);
$video->tag($video->interpret);
$video->tag($video->songtitle);
$video->tag($video->imgsource);
$video->tag($video->category->shortname);
$video->tag($video->category->name);
// TODO: outsource to different process (async)
$video->createThumbnail();
// Discord
if (config('discord.enabled') && config('discord.webhookurl')) {
$nsfw = in_array('nsfw', $video->getTagArrayNormalizedAttribute());
$nsfw = $nsfw ? ' :exclamation: **NSFW** :exclamation:' : '';
$message = config('discord.message');
$message = str_replace(
['<USER>', '<ID>', '<NSFW>'],
[$user->username, $video->id, $nsfw],
$message
);
$url = config('discord.webhookurl');
$payload = json_encode([
'content' => $message,
]);
// exec with & so it is async
exec("curl -H \"Content-Type: application/json; charset=UTF-8\" -X POST -d '$payload' '$url' > /dev/null &");
}
return new JsonResponse([
'error' => 'null',
'video_id' => $video->id
]);
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
// TODO: filter on direct id link??
$video = Video::with('tags')->find($id);
if(is_null($video))
return view('deleted');
#->back();
#->with('error', 'No video with that ID found');
$sfw = $video->tags->contains(function($key, $tag) {
return $tag->normalized === 'sfw';
});
return view('video', [
'video' => $video,
'banner' => Banner::getRandom($sfw)
]);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function update(Request $request, $id) {
if(!auth()->check())
return response('Not logged in', 403);
$user = auth()->user();
if(!$request->ajax())
return response('Invalid request', 400);
$v = Video::findOrFail($id);
if(!$user->can('edit_video') && $user->id != $v->user_id)
return response('Not enough permissions', 403);
if($request->has('interpret')) {
$v->interpret = $request->input('interpret');
$v->tag($request->input('interpret'));
}
if($request->has('songtitle')) {
$v->songtitle = $request->input('songtitle');
$v->tag($request->input('songtitle'));
}
if($request->has('imgsource')) {
$v->imgsource = $request->input('imgsource');
$v->tag($request->input('imgsource'));
}
if($request->has('videotitle')) {
$v->videotitle = $request->input('videotitle');
$v->tag($request->input('videotitle'));
}
if($request->has('category')) {
$cat = Category::findOrFail($request->input('category'));
$v->category()->associate($cat);
$v->tag($cat->name);
$v->tag($cat->shortname);
}
$v->save();
$log = new ModeratorLog();
$log->user()->associate($user);
$log->type = 'edit';
$log->target_type = 'video';
$log->target_id = $v->id;
$log->save();
return $v;
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Response
*/
public function destroy(Request $request, $id)
{
$user = auth()->check() ? auth()->user() : null;
if(is_null($user)) return new JsonResponse(['error' => 'not_logged_in']);
if(!$request->has('reason') || trim($request->get('reason')) == '') return new JsonResponse(['error' => 'invalid_request']);
$reason = trim($request->get('reason'));
if($user->can('delete_video')) {
$warnings = [];
$vid = Video::find($id);
if(!$vid)
return new JsonResponse(['error' => 'video_not_found']);
foreach($vid->comments as $comment) {
$comment->delete(); // delete associated comments
}
$vid->faved()->detach();
if(!\File::move(public_path() . '/b/' . $vid->file, storage_path() . '/deleted/' . $vid->file))
$warnings[] = 'Could not move file';
$vid->delete();
$receiver = $vid->user;
if($user->id != $receiver->id)
Message::send(1, $receiver->id, 'A moderator deleted your video', view('messages.moderation.videodelete', ['video' => $vid, 'reason' => $reason, 'videoinfo' => ['artist' => $vid->interpret, 'songtitle' => $vid->songtitle, 'video_source' => $vid->imgsource, 'category' => $vid->category->name]]));
$log = new ModeratorLog();
$log->user()->associate($user);
$log->type = 'delete';
$log->target_type = 'video';
$log->target_id = $id;
$log->reason = $reason;
$log->save();
return new JsonResponse(['error' => 'null', 'warnings' => $warnings]);
}
return new JsonResponse(['error' => 'insufficient_permissions']);
}
public function favorite($id) {
$user = auth()->check() ? auth()->user() : null;
$xhr = \Request::ajax();
if(is_null($user)) return $xhr ? "Not logged in" : redirect()->back()->with('error', 'Not logged in');
if($user->hasFaved($id)) {
$user->favs()->detach($id);
return $xhr ? "Video removed from favorites" : redirect()->back()->with('success', 'Video removed from favorites');
} else {
$user->favs()->attach($id);
return $xhr ? "Video added to favorites" : redirect()->back()->with('success', 'Video added to favorites');
}
}
/**
* @param Request $request
* @return Video | Bool
*/
public function tag(Request $request, $id) {
if(!$request->has('tags')) return new JsonResponse(["error" => "invalid_request"]);
$tags = $request->get('tags');
if(!count($tags)) return new JsonResponse(["error" => "no_tags_specified"]);
$v = Video::findOrFail($id);
if(is_null($v)) return new JsonResponse(["error" => "video_not_found"]);
$v->tag($tags);
$v['error'] = 'null';
$v['can_edit_video'] = auth()->check() ? auth()->user()->can('edit_video') : false;
return $v;
}
public function untag(Request $request, $id) {
if(!$request->has('tag') || trim($request->get('tag')) == "") return new JsonResponse(["error" => "invalid_request"]);
$user = auth()->check() ? auth()->user() : null;
if(is_null($user)) return new JsonResponse(["error" => "not_logged_in"]);
if(!$user->can('edit_video')) return new JsonResponse(["error" => "insufficient_permissions"]);
$tag = trim($request->get('tag'));
$v = Video::findOrFail($id);
if(is_null($v)) return new JsonResponse(["error" => "video_not_found"]);
$v = $v->untag($tag);
$v['error'] = 'null';
return $v;
}
}

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

37
app/Http/Kernel.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* @var array
*/
protected $middleware = [
\Clockwork\Support\Laravel\ClockworkMiddleware::class,
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
Middleware\VerifyCsrfToken::class,
Middleware\LogoutBanned::class,
Middleware\Jsonp::class
];
/**
* The application's route middleware.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'guest' => Middleware\RedirectIfAuthenticated::class,
'theme' => Middleware\Theme::class,
];
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
class Authenticate
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('/login');
}
}
return $next($request);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;
class EncryptCookies extends BaseEncrypter
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\JsonResponse;
class Jsonp {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
if ($response->headers->get('content-type') == 'application/json'
&& $request->has('callback'))
{
if (get_class($response) == JsonResponse::class) {
return $response->setCallback($request->input('callback'));
}
// TODO fix stripping headers
return response()->json($response->original)->setCallback($request->input('callback'));
}
return $response;
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Http\Middleware;
use Closure;
class LogoutBanned
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$user = auth()->user();
if($user && $user->isBanned()) {
auth()->logout();
return redirect()->back()->with('error', 'You are banned');
}
return $next($request);
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
class RedirectIfAuthenticated
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect('/');
}
return $next($request);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\View\Factory;
class Theme
{
protected $auth;
protected $view;
public function __construct(Guard $auth, Factory $view)
{
$this->auth = $auth;
$this->view = $view;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$paths = $this->view->getFinder()->getPaths();
foreach ($paths as &$p) {
$p .= "/layout" . (auth()->check() ? auth()->user()->layout : 1);
}
$this->view->setFinder(new \Illuminate\View\FileViewFinder($this->view->getFinder()->getFilesystem(), $paths));
return $next($request);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'api/video/upload'
];
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
abstract class Request extends FormRequest
{
//
}

149
app/Http/routes.php Normal file
View File

@@ -0,0 +1,149 @@
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', ['as' => 'home', function () {
Session::reflash();
// Dummy query to calculate rows
$video = \App\Models\Video::getRandom()->first();
return redirect($video->id);
}])->middleware('auth');
Route::post('filter', 'UserController@filter');
// /api
Route::group(['prefix' => 'api'], function() {
// /api/messages
Route::group(['prefix' => 'messages'], function() {
Route::get('', 'MessageController@index');
Route::post('read', 'MessageController@read');
Route::get('readall', 'MessageController@readall');
});
// /api/comments
Route::group(['prefix' => 'comments'], function() {
Route::get('/', 'CommentController@index');
Route::get('/{id}', 'CommentController@show')->where('id', '[0-9]+');
Route::post('{id}/edit', 'CommentController@update')->where('id', '[0-9]+');
Route::post('{id}/delete', 'CommentController@destroy')->where('id', '[0-9]+');
Route::post('{id}/restore', 'CommentController@restore')->where('id', '[0-9]+');
});
// /api/user
Route::group(['prefix' => 'user'], function() {
Route::post('{username}/ban', 'UserController@ban');
Route::get('/layout', 'UserController@setLayout');
});
// /api/video
Route::group(['prefix' => 'video'], function() {
Route::get('random', function() {
return \App\Models\Video::getRandom()->with(['category', 'user' => function($query) {
$query->addSelect('username', 'id');
}])->first();
});
Route::get('latest', function(\Illuminate\Http\Request $req) {
if ($req->has('filtered') && $req->get('filtered')) {
return \App\Models\Video::filtered()->orderBy('id', 'DESC')->first();
}
return \App\Models\Video::orderBy('id', 'DESC')->first();
});
Route::get('{id}', function($id) {
$res = \App\Models\Video::with(['category', 'user' => function($query) {
$query->addSelect('username', 'id');
}])->find($id);
if(!$res) {
return response(['message' => 'Video not found'], 404);
}
return $res;
})->where('id', '[0-9]+');
Route::post('{id}/delete', 'VideoController@destroy')->where('id', '[0-9]+');
Route::post('{id}/tag', 'VideoController@tag')->where('id', '[0-9]+');
Route::post('{id}/untag', 'VideoController@untag')->where('id', '[0-9]+');
Route::post('upload', 'VideoController@store')->middleware('auth.basic');
});
Route::post('upload', 'VideoController@store');
});
Route::group(["middleware" => "theme"], function() {
Route::post('report/{id}', 'ReportController@report'); // added by klee
Route::get('messages', 'MessageController@page');
Route::get('user/{username}', 'UserController@show')->middleware('auth');
Route::get('user/{username}/uploads', 'UserController@random')->middleware('auth');
Route::get('user/{username}/uploads/{id}', 'UserController@play')->where('id', '[0-9]+')->middleware('auth');
Route::get('user/{username}/favs', 'UserController@random_fav')->middleware('auth');
Route::get('user/{username}/favs/{id}', 'UserController@play_fav')->where('id', '[0-9]+')->middleware('auth');
Route::get('user/{username}/favs/index', 'UserController@show_favs')->middleware('auth');
Route::get('user/{username}/comments', 'UserController@show_comments')->middleware('auth');
Route::get('logout', 'UserController@logout');
Route::post('login', 'UserController@login');
Route::get('register', 'UserController@create');
Route::post('register', 'UserController@store');
Route::get('activate/{token}', 'UserController@activate');
Route::get('index', 'VideoController@index')->middleware('auth');
Route::post('index/{id}', 'VideoController@update')->middleware('auth');
Route::get('upload', 'VideoController@create')->middleware('auth');
Route::get('categories', 'CategoryController@index')->middleware('auth');
Route::get('webm', function() { return view('webm'); });
Route::get('about', function() { return view('about'); });
Route::get('irc', function() { return view('irc'); });
Route::get('rules', function() { return view('rules'); });
Route::get('contact', function() { return view('contact'); });
Route::get('privacy', function() { return view('privacy'); });
Route::get('teamspeak', function() { return view('teamspeak'); });
Route::get('news', function() { return view('news'); });
Route::get('0x40', function() { return view('0x40'); });
Route::get('stats', function() {
return view('stats', [
'user_count' => \App\Models\User::count(),
'upload_count' => \App\Models\Video::count(),
'comment_count' => \App\Models\Comment::count(),
//'fav_count' => \App\Models\UserFavorite::count(),
'latest_video' => \App\Models\Video::getLastId(),
'newest_user' => \App\Models\User::orderBy('id', 'DESC')->first()->username,
'dirsize' => shell_exec("(du -sh " . public_path() . "/b | cut -f1)")
]);
});
Route::get('/latest', function () {
Session::reflash();
$video = \App\Models\Video::orderBy('id', 'DESC')->first();
return redirect($video->id);
});
#Route::get('help', function() { return view('help'); });
#Route::get('announcement', function() { return view('announcement'); });
#Route::get('map', function() { return view('map'); });
#Route::get('donate', function() {
# return view('donate', [
# 'donations' => \App\Models\Donation::orderBy('timestamp', 'DESC')->get()
# ]);
#});
Route::get('transparency', function() { return view('transparency'); });
Route::get('login', function() { return view('login'); });
#Route::get('counter-strike', function() { return view('counter-strike'); });
Route::get('{id}', 'VideoController@show')->where('id', '[0-9]+');
Route::get('{id}/fav', 'VideoController@favorite')->where('id', '[0-9]+');
Route::post('{id}', 'CommentController@store')->where('id', '[0-9]+');
Route::get('{shortname}', 'CategoryController@showVideo')->where('shortname', '[a-z][a-z0-9]+')->middleware('auth');
Route::get('{shortname}/{id}', 'CategoryController@showVideo')->where(['shortname' => '[a-z][a-z0-9]+', 'id' => '[0-9]+'])->middleware('auth');
});

21
app/Jobs/Job.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
abstract class Job
{
/*
|--------------------------------------------------------------------------
| Queueable Jobs
|--------------------------------------------------------------------------
|
| This job base class provides a central location to place any logic that
| is shared across all of your jobs. The trait included with the class
| provides access to the "onQueue" and "delay" queue helper methods.
|
*/
use Queueable;
}

0
app/Listeners/.gitkeep Normal file
View File

40
app/Models/Banner.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
// Maybe this will in a n to m relation with video someday
class Banner extends Model
{
protected $casts = [
'sfw' => 'boolean'
];
protected $dates = [
'created_at',
'updated_at',
'until'
];
// If this would be in relation with video the $sfw could be
// figured out dynamically
public static function getRandom($sfw = true) {
$q = static::active();
if($sfw) $q->sfw();
$id = $q->count() - 1;
if ($id < 0) return null;
$id = mt_rand(0, $id);
$q = static::active();
if($sfw) $q->sfw();
return $q->skip($id)->first();
}
public function scopeSfw($query) {
return $query->where('sfw', true);
}
public function scopeActive($query) {
return $query->where('until', '>=', Carbon::now());
}
}

49
app/Models/Category.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* App\Models\Category
*
* @property integer $id
* @property string $name
* @property string $shortname
* @property string $description
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $deleted_at
* @property-read \Illuminate\Database\Eloquent\Collection|Video[] $videos
* @method static \Illuminate\Database\Query\Builder|\App\Models\Category whereId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Category whereName($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Category whereShortname($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Category whereDescription($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Category whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Category whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Category whereDeletedAt($value)
* @property-read \Illuminate\Database\Eloquent\Collection|User[] $users
*/
class Category extends Model
{
use SoftDeletes;
protected $table = 'categories';
public function videos() {
return $this->hasMany(Video::class);
}
public function users() {
return $this->belongsToMany(User::class);
}
public function baseurl() {
return $this->shortname;
}
public function displayName() {
return e($this->name);
}
}

90
app/Models/Comment.php Normal file
View File

@@ -0,0 +1,90 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Services\Markdown;
/**
* App\Models\Comment
*
* @property integer $id
* @property string $content
* @property integer $user_id
* @property integer $video_id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $deleted_at
* @property-read User $user
* @property-read Video $video
* @method static \Illuminate\Database\Query\Builder|\App\Models\Comment whereId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Comment whereContent($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Comment whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Comment whereVideoId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Comment whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Comment whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Comment whereDeletedAt($value)
*/
class Comment extends Model
{
use SoftDeletes;
protected $appends = ['rendered_view'];
public function user() {
return $this->belongsTo(User::class);
}
public function video() {
return $this->belongsTo(Video::class);
}
public static function simplemd($text) {
$m = app()->make(Markdown::class);
$text = $m->text($text);
return $text;
}
public function getRenderedViewAttribute() {
return static::simplemd($this->content);
}
public function getMentioned() {
$text = $this->content;
$nameMatcher = '/\B@([\wÄÖÜäöü]+)/i';
$ret = [];
if(preg_match_all($nameMatcher, $text, $users) > 0) {
foreach ($users[1] as $user) {
if(User::whereUsername($user)->count() > 0) {
$ret[] = User::whereUsername($user)->first();
}
}
}
return array_unique($ret);
}
public function answered() {
$text = $this->content;
$regex = '/^[!%*]*(\^+)/m';
$answers = [];
if(preg_match_all($regex, $text, $answered) > 0) {
foreach($answered[1] as $a) {
$answers[] = mb_strlen($a);
}
}
$answers = array_unique($answers);
$comments = $this->video->comments;
$total = $comments->count();
$ret = [];
foreach($answers as $c) {
$up = $total - $c - 1;
if($up >= 0) {
$ret[] = $comments->get($up)->user;
}
}
return $ret;
}
}

20
app/Models/Donation.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Donation extends Model
{
public $timestamps = false;
public static $needed = 150;
public static function getPercentage() {
return (static::getFunds() / static::$needed) * 100;
}
public static function getFunds() {
return static::sum('amount') ?? 0;
}
}

35
app/Models/Icon.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Icon extends Model
{
public $timestamps = false;
public function roles() {
return $this->hasMany(Role::class);
}
public function users() {
return $this->hasMany(User::class);
}
public function toJson($options = 0) {
return parent::toJson($options);
}
public function __toString() {
switch ($this->icon_type) {
case 'fa':
return '<i class="fa fa-' . $this->icon . '"></i>';
case 'img':
case 'image':
return '<img class="icon" src="https://s.w0bm.com/' . ltrim($this->icon, '/') . '" alt="' . $this->icon . '">';
default:
return '';
}
}
}

72
app/Models/Message.php Normal file
View File

@@ -0,0 +1,72 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* App\Models\Message
*
* @property integer $id
* @property integer $from
* @property integer $to
* @property string $content
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $deleted_at
* @property string $read
* @property string $subject
* @property-read User $fromUser
* @property-read User $toUser
* @method static \Illuminate\Database\Query\Builder|\App\Models\Message whereId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Message whereFrom($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Message whereTo($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Message whereContent($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Message whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Message whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Message whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Message whereRead($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Message whereSubject($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Message unread()
*/
class Message extends Model {
use SoftDeletes;
public function fromUser() {
return $this->belongsTo(User::class, 'from');
}
public function toUser() {
return $this->belongsTo(User::class, 'to');
}
public static function send($from, $to, $subject, $content) {
if(empty($subject)) return 'Subject must not be empty';
if(empty($content)) return 'Content must not be empty';
try {
if(!is_object($from))
$from = User::findOrFail($from);
if(!is_object($to))
$to = User::findOrFail($to);
} catch (ModelNotFoundException $e) {
return false;
}
$message = new static();
$message->from = $from->id;
$message->to = $to->id;
$message->subject = $subject;
$message->content = $content;
$message->save();
return $message;
}
public function scopeUnread($query) {
return $query->whereNull('read');
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\ModeratorLog
*
* @property integer $id
* @property integer $user_id
* @property string $type
* @property string $target_type
* @property integer $target_id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property-read User $user
* @method static \Illuminate\Database\Query\Builder|\App\Models\ModeratorLog whereId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\ModeratorLog whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\ModeratorLog whereType($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\ModeratorLog whereTargetType($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\ModeratorLog whereTargetId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\ModeratorLog whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\ModeratorLog whereUpdatedAt($value)
*/
class ModeratorLog extends Model
{
public function user() {
return $this->belongsTo(User::class);
}
public function getTarget() {
$target_type = $this->target_type;
switch ($target_type) {
case 'user': return User::find($this->target_id);
case 'comment': return Comment::find($this->target_id);
case 'video': return Video::find($this->target_id);
default: return null;
}
}
}

12
app/Models/Role.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Toddish\Verify\Models\Role as VerifyRole;
class Role extends VerifyRole
{
public function icon() {
return $this->belongsTo(Icon::class, 'icon_id');
}
}

135
app/Models/User.php Normal file
View File

@@ -0,0 +1,135 @@
<?php
namespace App\Models;
use Toddish\Verify\Models\User as VerifyUser;
use Carbon\Carbon;
/**
* App\Models\User
*
* @property integer $id
* @property string $username
* @property string $password
* @property string $salt
* @property string $email
* @property string $remember_token
* @property boolean $verified
* @property boolean $disabled
* @property array $categories
* @property \Carbon\Carbon $deleted_at
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $activation_token
* @property-read \Illuminate\Database\Eloquent\Collection|Video[] $videos
* @property-read \Illuminate\Database\Eloquent\Collection|Comment[] $comments
* @property-read \Illuminate\Database\Eloquent\Collection|\config('verify.models.role')[] $roles
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereUsername($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User wherePassword($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereSalt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereEmail($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereRememberToken($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereVerified($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereDisabled($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereActivationToken($value)
* @method static \Illuminate\Database\Query\Builder|\Toddish\Verify\Models\User verified()
* @method static \Illuminate\Database\Query\Builder|\Toddish\Verify\Models\User unverified()
* @method static \Illuminate\Database\Query\Builder|\Toddish\Verify\Models\User disabled()
* @method static \Illuminate\Database\Query\Builder|\Toddish\Verify\Models\User enabled()
* @property-read \Illuminate\Database\Eloquent\Collection|ModeratorLog[] $moderator_log
* @property-read \Illuminate\Database\Eloquent\Collection|Message[] $messagesSent
* @property-read \Illuminate\Database\Eloquent\Collection|Message[] $messagesRecv
* @property-read \Illuminate\Database\Eloquent\Collection|Video[] $favs
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereBackground($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereCategories($value)
*/
class User extends VerifyUser
{
protected $casts = [
// TODO: rename db column to tag filters
'categories' => 'array'
];
protected $dates = [
'created_at',
'updated_at',
'deleted_at',
'banend'
];
public function uploads() {
return $this->hasMany(Video::class);
}
public function videos() {
return $this->uploads();
}
public function comments() {
return $this->hasMany(Comment::class);
}
public function moderator_log() {
return $this->hasMany(ModeratorLog::class);
}
public function messagesSent() {
return $this->hasMany(Message::class, 'from');
}
public function messagesRecv() {
return $this->hasMany(Message::class, 'to');
}
public function favs() {
return $this->belongsToMany(Video::class, 'favorites');
}
public function hasFaved($id) {
return ! $this->favs->filter(function($vid) use ($id) {
return $vid->id == $id;
})->isEmpty();
}
public function icon() {
return $this->belongsTo(Icon::class, 'icon_id');
}
public function activeIcon() {
$icon = $this->icon;
if($icon === null) {
$roles = $this->roles;
$roles = $roles->sortByDesc('level');
foreach($roles as $role) {
if($role !== null) $icon = $role->icon;
}
}
return $icon;
}
public function isBanned() {
if($this->disabled == 1) {
return $this->banend->eq(Carbon::createFromTimeStampUTC(1)) || $this->banend->gt(Carbon::now());
}
return false;
}
public function getForeignKey() {
return 'user_id';
}
public function baseurl() {
return 'user/' . $this->username . '/uploads';
}
public function displayName() {
return e($this->username) . ($this->activeIcon() ? " " . $this->activeIcon() : "");
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
class UserFavorite extends User {
protected $table = 'users';
// Instead of uploaded Videos get favs
public function videos() {
return $this->favs();
}
public function baseurl() {
return 'user/' . $this->username . '/favs';
}
public function displayName() {
return 'Favorites (' . parent::displayName() . ')';
}
}

189
app/Models/Video.php Normal file
View File

@@ -0,0 +1,189 @@
<?php
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* App\Models\Video
*
* @property integer $id
* @property string $file
* @property string $interpret
* @property string $songtitle
* @property string $imgsource
* @property integer $category_id
* @property integer $user_id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $deleted_at
* @property string $hash
* @property-read User $user
* @property-read Category $category
* @property-read \Illuminate\Database\Eloquent\Collection|Comment[] $comments
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video whereId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video whereFile($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video whereInterpret($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video whereSongtitle($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video whereImgsource($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video whereCategoryId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video whereHash($value)
* @property-read \Illuminate\Database\Eloquent\Collection|User[] $faved
* @property-read \Illuminate\Database\Eloquent\Collection|Tag[] $tags
* @property-read mixed $tag_list
* @property-read mixed $tag_list_normalized
* @property-read mixed $tag_array
* @property-read mixed $tag_array_normalized
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video newlyups()
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video withAllTags($tags)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video withAnyTags($tags = array())
* @method static \Illuminate\Database\Query\Builder|\App\Models\Video withoutTags()
*/
class Video extends Model
{
use SoftDeletes;
use \Cviebrock\EloquentTaggable\Taggable;
public function user() {
return $this->belongsTo(User::class);
}
public function category() {
return $this->belongsTo(Category::class);
}
public function comments() {
return $this->hasMany(Comment::class);
}
public function faved() {
return $this->belongsToMany(User::class, 'favorites', 'video_id', 'user_id');
}
public static function getFirstId($related = null) {
if ($related) {
return $related->videos()->filtered()->orderBy('id', 'ASC')->first()->id;
}
return static::filtered()->orderBy('id', 'ASC')->first()->id;
}
public static function getLastId($related = null) {
if ($related) {
return $related->videos()->filtered()->orderBy('id', 'DESC')->first()->id;
}
return static::select('id')->filtered()->orderBy('id', 'DESC')->first()->id;
}
public function getNext($related = null) {
if ($related) {
return $related->videos()->filtered()->where('id', '>', $this->id)->orderBy('id', 'ASC')->first();
} else {
return static::filtered()->where('id', '>', $this->id)->orderBy('id', 'ASC')->first();
}
}
public function getPrev($related = null) {
if ($related) {
return $related->videos()->filtered()->where('id', '<', $this->id)->orderBy('id', 'DESC')->first();
} else {
return static::filtered()->where('id', '<', $this->id)->orderBy('id', 'DESC')->first();
}
}
public function scopeNewlyups($query) {
return $query->where('created_at', '>=', Carbon::now()->subHours(12));
}
public function scopeFiltered($query) {
if(auth()->check()) {
// TODO rename to filtered
$filter = auth()->user()->categories;
if(empty($filter))
return $query;
return $query->withoutAnyTags($filter);
} else {
// TODO: filter if post has sfw & nsfw tags
//return $query->withAllTags('sfw');
return $query->withoutAnyTags('nsfw');
}
}
public function checkFileEncoding() {
$dat = $this->file;
$in = public_path() . "/b";
$tmpdir = str_replace("public", "app/Http/Controllers/tmp", public_path());
for($i = 0; $i < 2; $i++) {
$ret = shell_exec("ffmpeg -y -ss 0 -i {$in}/{$dat} -vframes 1 {$tmpdir}/test.png 2>&1");
if(strpos($ret, "nothing was encoded") !== false) {
shell_exec("ffmpeg -i {$in}/{$dat} -map 0:0 -map 0:1 -c:v copy {$tmpdir}/{$dat}");
unlink($in . "/" . $dat);
rename($tmpdir . "/" . $dat, $in . "/" . $dat);
}
else return true;
}
return false;
}
/**
* Creates a .gif thumbnail to a given video file
*
* @param string $dat File of the video
*/
public function createThumbnail() {
$dat = $this->file;
$in = public_path() . "/b"; // webm-input
$out = public_path() . "/thumbs"; //thumb-output
$tmpdir = str_replace("public", "app/Http/Controllers/tmp", public_path());
$name = explode(".", $dat);
array_pop($name);
$name = join(".", $name);
if(!file_exists("{$out}/{$name}.gif")) {
$length = round(shell_exec("ffprobe -i {$in}/{$dat} -show_format -v quiet | sed -n 's/duration=//p'"));
for ($i = 1; $i < 10; $i++) {
$act = ($i * 10) * ($length / 100);
$ffmpeg = shell_exec("ffmpeg -ss {$act} -i {$in}/{$dat} -vf \"scale='if(gt(a,4/3),206,-1)':'if(gt(a,4/3),-1,116)'\" -vframes 1 {$tmpdir}/{$name}_{$i}.png 2>&1");
}
$tmp = shell_exec("convert -delay 27 -loop 0 {$tmpdir}/{$name}_*.png {$out}/{$name}.gif 2>&1");
if(@filesize("{$out}/{$name}.gif") < 2000)
@unlink("{$out}/{$name}.gif");
array_map('unlink', glob("{$tmpdir}/{$name}*.png"));
}
}
public static function getRandom($related = null) {
if ($related) {
$id = $related->videos()->filtered()->countScoped()->count() - 1;
if ($id < 0) {
return redirect()->back()->with('error', 'no videos found');
}
$id = mt_rand(0, $id);
return $related->videos()->filtered()->skip($id);
}
$id = static::filtered()->countScoped()->count() - 1;
if ($id < 0) {
return redirect()->back()->with('error', 'no videos found');
}
$id = mt_rand(0, $id);
return static::filtered()->skip($id);
}
public function isSfw() {
return $this->tags->contains(function ($key, $tag) {
$tag->normalized === 'sfw';
});
}
public function filesize() {
return filesize(getcwd() . "/b/" . $this->file);
}
}

0
app/Policies/.gitkeep Normal file
View File

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Providers;
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
//
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Blade;
class BladeServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
/* @simplemd($var) */
/** @var \Illuminate\View\Compilers\BladeCompiler $compiler */
Blade::directive('simplemd', function($text) {
return "<?php echo App\\Models\\Comment::simplemd({$text}); ?>";
});
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
//
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Providers;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
'App\Events\SomeEvent' => [
'App\Listeners\EventListener',
],
];
/**
* Register any other events for your application.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
*/
public function boot(DispatcherContract $events)
{
parent::boot($events);
//
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Services\Markdown;
class MarkdownServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->singleton(Markdown::class, function ($app) {
return Markdown::instance();
});
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to the controller routes in your routes file.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
//
parent::boot($router);
}
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace], function ($router) {
require app_path('Http/routes.php');
});
}
}

340
app/Services/Markdown.php Normal file
View File

@@ -0,0 +1,340 @@
<?php
namespace App\Services;
use App\Models\User;
class Markdown extends \Parsedown {
function __construct() {
$this->setMarkupEscaped(true);
$this->setBreaksEnabled(true);
$this->setUrlsLinked(true);
$this->InlineTypes['@'][] = 'UserMention';
#$this->InlineTypes['%'][] = 'ColoredText';
$this->InlineTypes['['][] = 'KrebsText';
$this->InlineTypes['['][] = 'ReichText';
$this->InlineTypes['['][] = 'RainbowText';
$this->InlineTypes['['][] = 'SpoilerText';
$this->InlineTypes[':'][] = 'emojimatcherpng';
//$this->InlineTypes[':'][] = 'emojimatchermp4';
$this->InlineTypes[':'][] = 'ClickableTimestamp';
$this->inlineMarkerList .= '@';
}
protected function paragraph($Line) {
$Block = array(
'element' => array(
'name' => 'p',
'text' => $Line['text'],
'handler' => 'line',
'attributes' => [
'class' => 'comment'
]
),
);
return $Block;
}
// Matches the emojis in png format
protected function inlineemojimatcherpng($Excerpt) {
if (preg_match('/\:(\w+)\:/mUs', $Excerpt['text'], $matches)) {
$path = "images/comments/" . $matches[1];
$file_ext = "";
if(file_exists($path . ".png"))
$file_ext = ".png";
else if(file_exists($path . ".gif"))
$file_ext = ".gif";
if($file_ext === "")
return;
return [
'extent' => strlen($matches[0]),
'element' => [
'name' => 'img',
'handler' => 'line',
'attributes' => [
'class' => 'comment_emoji',
'src' => '//s.w0bm.com/images/comments/' . $matches[1] . $file_ext,
'alt' => ':' . $matches[1] . ':',
'title' => ':' . $matches[1] . ':'
],
]
];
}
}
// Matches MP4 Emojis (Currently not possible due to Chromes shitty and malfunctioning autplay policy. Thanks idiots :*)
//protected function inlineemojimatchermp4($Excerpt) {
// if (preg_match('/\:(uwe)\:/mUs', $Excerpt['text'], $matches)) {
// return [
// 'extent' => strlen($matches[0]),
// 'element' => [
// 'name' => 'video',
// 'handler' => 'line',
// 'attributes' => [
// 'loop' => 'true',
// 'autoplay' => 'true',
// 'muted' => '',
// 'class' => 'comment_video',
// 'src' => '/images/comments/' . $matches[1] . '.mp4'
// ],
// ]
// ];
// }
//}
protected function inlineUserMention($Excerpt) {
if (preg_match('/\B@([\wÄÖÜäöü]+)/i', $Excerpt['context'], $matches)) {
if(User::whereUsername($matches[1])->count() > 0) {
return [
'extent' => strlen($matches[0]),
'element' => [
'name' => 'a',
'text' => $matches[0],
'attributes' => [
'href' => '/user/' . $matches[1], //link to username profile
'class' => 'user-mention', //style class of url
],
],
];
} else {
return [
'markup' => $matches[0],
'extent' => strlen($matches[0]),
];
}
}
}
// Matches [rb][/rb]
protected function inlineRainbowText($Excerpt) {
if (preg_match('/\[rb\](.+)\[\/rb]/mUs', $Excerpt['text'], $matches)) {
return [
'extent' => strlen($matches[0]),
'element' => [
'name' => 'span',
'handler' => 'line',
'text' => $matches[1],
'attributes' => [
'class' => 'rainbow'
],
]
];
}
}
// Matches [spoiler][/spoiler]
protected function inlineSpoilerText($Excerpt) {
if (preg_match('/\[spoiler\](.+)\[\/spoiler]/mUs', $Excerpt['text'], $matches)) {
return [
'extent' => strlen($matches[0]),
'element' => [
'name' => 'span',
'handler' => 'line',
'text' => $matches[1],
'attributes' => [
'class' => 'spoiler'
],
]
];
}
}
// Matches [krebs][/krebs]
protected function inlineKrebsText($Excerpt) {
if (preg_match('/\[krebs\](.+)\[\/krebs]/mUs', $Excerpt['text'], $matches)) {
return [
'extent' => strlen($matches[0]),
'element' => [
'name' => 'span',
'handler' => 'line',
'text' => $matches[1],
'attributes' => [
'class' => 'anim'
],
]
];
}
}
// Matches Reichtext
protected function inlineReichText($Excerpt) {
if (preg_match('/\[reich\](.+)\[\/reich]/mUs', $Excerpt['text'], $matches)) {
return [
'extent' => strlen($matches[0]),
'element' => [
'name' => 'span',
'handler' => 'line',
'text' => $matches[1],
'attributes' => [
'class' => 'reich'
],
]
];
}
}
// Matches %text% <- literally wtf error
/*protected function inlineColoredText($Excerpt) {
if (preg_match('/%(.+)%/', $Excerpt['text'], $matches)) {
return [
'extent' => strlen($matches[0]),
'element' => [
'name' => 'span',
'text' => $matches[1],
'attributes' => [
'class' => ''
],
]
];
}
}*/
//Greentext
protected function blockQuote($Excerpt) {
if (preg_match('/^>[ ]?(.*)/', $Excerpt['text'], $matches)) {
$Block = [
'element' => [
'name' => 'blockquote',
'handler' => 'lines',
'text' => (array) ('&gt;' . $matches[1]),
],
];
return $Block;
}
}
protected function blockQuoteContinue($Excerpt, array $Block) {
if ($Excerpt['text'][0] === '>' && preg_match('/^>[ ]?(.*)/', $Excerpt['text'], $matches)) {
if (isset($Block['interrupted'])) {
$Block['element']['text'][] = '';
unset($Block['interrupted']);
}
$Block['element']['text'][] = '&gt;' . $matches[1];
return $Block;
}
if (!isset($Block['interrupted'])) {
$Block['element']['text'][] = '&gt;' . $Excerpt['text'];
return $Block;
}
}
// Disable Lists
protected function blockList($Excerpt) {
return;
}
protected function blockListContinue($Excerpt, array $block) {
return;
}
// Disable headers
protected function blockHeader($Excerpt) {
return;
}
protected function blockSetextHeader($Excerpt, array $block = null) {
return;
}
protected function blockTable($Excerpt, array $block = null) {
return;
}
// Disable markdown links
protected function inlineLink($Excerpt) {
return;
}
// Disable markdown images
protected function inlineImage($Excerpt) {
return;
}
// Differentiate between internal and external urls and images
protected function inlineUrl($Excerpt) {
$e = parent::inlineUrl($Excerpt);
if (is_null($e)) return;
if (static::isImage($e['element']['attributes']['href'])) {
$e['element']['name'] = 'img';
$e['element']['attributes']['src'] = $e['element']['attributes']['href'];
$e['element']['attributes']['alt'] = 'Image';
$e['element']['attributes']['class'] = 'comment_image';
unset($e['element']['attributes']['href']);
unset($e['element']['text']);
return $e;
}
if (!static::isInternal($e['element']['attributes']['href'])) {
$e['element']['attributes']['target'] = '_blank';
$e['element']['attributes']['rel'] = 'extern';
} else {
$url = parse_url($e['element']['text']);
$text = $url['path'];
if (isset($url['query'])) {
$text .= '?' . $url['query'];
}
if (isset($url['fragment'])) {
$text .= '#' . $url['fragment'];
}
$e['element']['text'] = $text;
}
return $e;
}
protected function inlineClickableTimestamp($Excerpt) {
if (preg_match('/(?<=\s|^)([0-5]?\d:[0-5]\d)(?=\s|$)/', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)) {
return [
'extent' => strlen($matches[0][0]),
'position' => $matches[0][1],
'element' => [
'name' => 'a',
'text' => $matches[0][0],
'attributes' => [
'href' => '#',
'class' => 'comment_clickable_timestamp'
]
]
];
}
}
private static function isInternal($url) {
$host = parse_url($url, PHP_URL_HOST);
$currhost = $_SERVER['SERVER_NAME'];
if (0 === strpos($host, 'www')) {
$host = substr($host, 4);
}
if (0 === strpos($currhost, 'www')) {
$currhost = substr($currhost, 4);
}
return $host === $currhost;
}
private static function isImage($url) {
$cfg = config('comments');
$allowedHosters = $cfg['allowedHosters'];
$allowedExtensions = $cfg['allowedImageFileExtensions'];
$url = parse_url($url);
if (isset($url['path'])) {
$ext = pathinfo($url['path'], PATHINFO_EXTENSION);
if (in_array($ext, $allowedExtensions)) {
if (isset($url['scheme']) && $url['scheme'] === 'https') {
foreach($allowedHosters as $hoster) {
foreach($hoster as $regex) {
if(preg_match($regex, $url['host'])) {
return true;
}
}
}
return false;
}
}
}
return false;
}
}

51
artisan Normal file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env php
<?php
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running. We will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);

55
bootstrap/app.php Normal file
View File

@@ -0,0 +1,55 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

34
bootstrap/autoload.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Include The Compiled Class File
|--------------------------------------------------------------------------
|
| To dramatically increase your application's performance, you may use a
| compiled class file which contains all of the classes commonly used
| by a request. The Artisan "optimize" is used to create this file.
|
*/
$compiledPath = __DIR__.'/cache/compiled.php';
if (file_exists($compiledPath)) {
require $compiledPath;
}

2
bootstrap/cache/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

67
composer.json Normal file
View File

@@ -0,0 +1,67 @@
{
"name": "w0bm/w0bm.com",
"description": "Webm image board.",
"keywords": ["webm", "laravel", "image board"],
"license": "MIT",
"type": "project",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/w0bm/eloquent-taggable"
}
],
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"barryvdh/laravel-ide-helper": "^2.1",
"doctrine/dbal": "^2.5",
"toddish/verify": "^5.0",
"guzzlehttp/guzzle": "^6.1",
"laravelcollective/html": "^5.0",
"greggilbert/recaptcha": "^2.0",
"cviebrock/eloquent-taggable": "dev-master",
"itsgoingd/clockwork": "^1.14",
"erusev/parsedown": "^1.6",
"sentry/sentry-laravel": "^0.8.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}

4624
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

BIN
composer.phar Executable file

Binary file not shown.

215
config/app.php Normal file
View File

@@ -0,0 +1,215 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => 'http://localhost',
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
//'timezone' => 'UTC',
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY', 'SomeRandomStringWith32Characters'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Logging Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Settings: "single", "daily", "syslog", "errorlog"
|
*/
'log' => 'single',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Routing\ControllerServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\MarkdownServiceProvider::class,
//App\Providers\ViewServiceProvider::class,
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
Toddish\Verify\Providers\VerifyServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
App\Providers\BladeServiceProvider::class,
Greggilbert\Recaptcha\RecaptchaServiceProvider::class,
Cviebrock\EloquentTaggable\ServiceProvider::class,
Clockwork\Support\Laravel\ClockworkServiceProvider::class,
Sentry\SentryLaravel\SentryLaravelServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'HumanReadable' => App\Helpers\HumanReadable::class,
'Input' => Illuminate\Support\Facades\Input::class,
'Inspiring' => Illuminate\Foundation\Inspiring::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
'Recaptcha' => Greggilbert\Recaptcha\Facades\Recaptcha::class,
'Sentry' => Sentry\SentryLaravel\SentryFacade::class,
],
];

67
config/auth.php Normal file
View File

@@ -0,0 +1,67 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Authentication Driver
|--------------------------------------------------------------------------
|
| This option controls the authentication driver that will be utilized.
| This driver manages the retrieval and authentication of the users
| attempting to get access to protected areas of your application.
|
| Supported: "database", "eloquent", "verify"
|
*/
'driver' => 'verify',
/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/
'model' => App\Models\User::class,
/*
|--------------------------------------------------------------------------
| Authentication Table
|--------------------------------------------------------------------------
|
| When using the "Database" authentication driver, we need to know which
| table should be used to retrieve your users. We have chosen a basic
| default value but you may easily change it to any table you like.
|
*/
'table' => 'users',
/*
|--------------------------------------------------------------------------
| Password Reset Settings
|--------------------------------------------------------------------------
|
| Here you may set the options for resetting passwords including the view
| that is your password reset e-mail. You can also set the name of the
| table that maintains all of the reset tokens for your application.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'password' => [
'email' => 'emails.password',
'table' => 'password_resets',
'expire' => 60,
],
];

49
config/broadcasting.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
*/
'default' => env('BROADCAST_DRIVER', 'pusher'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_KEY'),
'secret' => env('PUSHER_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
],
];

79
config/cache.php Normal file
View File

@@ -0,0 +1,79 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache'),
],
'memcached' => [
'driver' => 'memcached',
'servers' => [
[
'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => 'laravel',
];

39
config/comments.php Normal file
View File

@@ -0,0 +1,39 @@
<?php
return [
'allowedHosters' => [
'img.w0bm.com' => [
'/^img\.w0bm\.com$/'
],
'imgur.com' => [
'/^i\.imgur\.com$/'
],
'giphy.com' => [
'/^media[0-6]?\.giphy\.com$/'
],
'f0ck.me' => [
'/^f0ck\.me$/'
],
'tumblr.com' => [
'/^(?:68|66|78)\.media\.tumblr\.com$/'
],
'catbox.moe' => [
'/^files\.catbox\.moe$/'
],
'pr0gramm.com' => [
'/^img\.pr0gramm\.com$/'
],
'' => [
'/^files\.nogf\.club$/',
'/^f0ck\.space$/',
'/^nogf\.club$/',
'/^f0ck\.it$/'
]
],
'allowedImageFileExtensions' => [
'jpg',
'png',
'gif',
]
];

35
config/compile.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Additional Compiled Classes
|--------------------------------------------------------------------------
|
| Here you may specify additional classes to include in the compiled file
| generated by the `artisan optimize` command. These should be classes
| that are included on basically every request into the application.
|
*/
'files' => [
//
],
/*
|--------------------------------------------------------------------------
| Compiled File Providers
|--------------------------------------------------------------------------
|
| Here you may list service providers which define a "compiles" function
| that returns additional files that should be compiled, providing an
| easy way to get common files from any packages you are utilizing.
|
*/
'providers' => [
//
],
];

126
config/database.php Normal file
View File

@@ -0,0 +1,126 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| PDO Fetch Style
|--------------------------------------------------------------------------
|
| By default, database results will be returned as instances of the PHP
| stdClass object; however, you may desire to retrieve records in an
| array format for simplicity. Here you can tweak the fetch style.
|
*/
'fetch' => PDO::FETCH_CLASS,
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => storage_path('database.sqlite'),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => true,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'cluster' => false,
'default' => [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
],
];

6
config/discord.php Normal file
View File

@@ -0,0 +1,6 @@
<?php
return [
'enabled' => true,
'webhookurl' => env('DISCORD_WEBHOOK', false),
'message' => ':new: <USER> uploaded a new webm: https://w0bm.com/<ID><NSFW>',
];

85
config/filesystems.php Normal file
View File

@@ -0,0 +1,85 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. A "local" driver, as well as a variety of cloud
| based drivers are available for your choosing. Just store away!
|
| Supported: "local", "ftp", "s3", "rackspace"
|
*/
'default' => 'local',
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => 's3',
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'ftp' => [
'driver' => 'ftp',
'host' => 'ftp.example.com',
'username' => 'your-username',
'password' => 'your-password',
// Optional FTP Settings...
// 'port' => 21,
// 'root' => '',
// 'passive' => true,
// 'ssl' => true,
// 'timeout' => 30,
],
's3' => [
'driver' => 's3',
'key' => 'your-key',
'secret' => 'your-secret',
'region' => 'your-region',
'bucket' => 'your-bucket',
],
'rackspace' => [
'driver' => 'rackspace',
'username' => 'your-username',
'key' => 'your-key',
'container' => 'your-container',
'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
'region' => 'IAD',
'url_type' => 'publicURL',
],
],
];

119
config/ide-helper.php Normal file
View File

@@ -0,0 +1,119 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Filename & Format
|--------------------------------------------------------------------------
|
| The default filename (without extension) and the format (php or json)
|
*/
'filename' => '_ide_helper',
'format' => 'php',
/*
|--------------------------------------------------------------------------
| Helper files to include
|--------------------------------------------------------------------------
|
| Include helper files. By default not included, but can be toggled with the
| -- helpers (-H) option. Extra helper files can be included.
|
*/
'include_helpers' => false,
'helper_files' => array(
base_path().'/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
),
/*
|--------------------------------------------------------------------------
| Model locations to include
|--------------------------------------------------------------------------
|
| Define in which directories the ide-helper:models command should look
| for models.
|
*/
'model_locations' => array(
'app/Models',
),
/*
|--------------------------------------------------------------------------
| Extra classes
|--------------------------------------------------------------------------
|
| These implementations are not really extended, but called with magic functions
|
*/
'extra' => array(
'Eloquent' => array('Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'),
'Session' => array('Illuminate\Session\Store'),
),
'magic' => array(
'Log' => array(
'debug' => 'Monolog\Logger::addDebug',
'info' => 'Monolog\Logger::addInfo',
'notice' => 'Monolog\Logger::addNotice',
'warning' => 'Monolog\Logger::addWarning',
'error' => 'Monolog\Logger::addError',
'critical' => 'Monolog\Logger::addCritical',
'alert' => 'Monolog\Logger::addAlert',
'emergency' => 'Monolog\Logger::addEmergency',
)
),
/*
|--------------------------------------------------------------------------
| Interface implementations
|--------------------------------------------------------------------------
|
| These interfaces will be replaced with the implementing class. Some interfaces
| are detected by the helpers, others can be listed below.
|
*/
'interfaces' => array(
'\Illuminate\Contracts\Auth\Authenticatable' => config('auth.model', 'App\User'),
),
/*
|--------------------------------------------------------------------------
| Support for custom DB types
|--------------------------------------------------------------------------
|
| This setting allow you to map any custom database type (that you may have
| created using CREATE TYPE statement or imported using database plugin
| / extension to a Doctrine type.
|
| Each key in this array is a name of the Doctrine2 DBAL Platform. Currently valid names are:
| 'postgresql', 'db2', 'drizzle', 'mysql', 'oracle', 'sqlanywhere', 'sqlite', 'mssql'
|
| This name is returned by getName() method of the specific Doctrine/DBAL/Platforms/AbstractPlatform descendant
|
| The value of the array is an array of type mappings. Key is the name of the custom type,
| (for example, "jsonb" from Postgres 9.4) and the value is the name of the corresponding Doctrine2 type (in
| our case it is 'json_array'. Doctrine types are listed here:
| http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html
|
| So to support jsonb in your models when working with Postgres, just add the following entry to the array below:
|
| "postgresql" => array(
| "jsonb" => "json_array",
| ),
|
*/
'custom_db_types' => array(
),
);

124
config/mail.php Normal file
View File

@@ -0,0 +1,124 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "ses", "log"
|
*/
'driver' => env('MAIL_DRIVER', 'mandrill'),
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'host' => env('MAIL_HOST', 'smtp.mandrillapp.com'),
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => ['address' => 'info@w0bm.com', 'name' => 'w0bm.com Staff'],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
/*
|--------------------------------------------------------------------------
| SMTP Server Password
|--------------------------------------------------------------------------
|
| Here you may set the password required by your SMTP server to send out
| messages from your application. This will be given to the server on
| connection so that the application will be able to send messages.
|
*/
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Mail "Pretend"
|--------------------------------------------------------------------------
|
| When this option is enabled, e-mail will not actually be sent over the
| web and will instead be written to your application's logs files so
| you may inspect the message. This is great for local development.
|
*/
'pretend' => false,
];

93
config/queue.php Normal file
View File

@@ -0,0 +1,93 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Driver
|--------------------------------------------------------------------------
|
| The Laravel queue API supports a variety of back-ends via an unified
| API, giving you convenient access to each back-end using the same
| syntax for each one. Here you may set the default queue driver.
|
| Supported: "null", "sync", "database", "beanstalkd",
| "sqs", "iron", "redis"
|
*/
'default' => env('QUEUE_DRIVER', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'expire' => 60,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'ttr' => 60,
],
'sqs' => [
'driver' => 'sqs',
'key' => 'your-public-key',
'secret' => 'your-secret-key',
'queue' => 'your-queue-url',
'region' => 'us-east-1',
],
'iron' => [
'driver' => 'iron',
'host' => 'mq-aws-us-east-1.iron.io',
'token' => 'your-token',
'project' => 'your-project-id',
'queue' => 'your-queue-name',
'encrypt' => true,
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'expire' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'database' => 'mysql', 'table' => 'failed_jobs',
],
];

65
config/recaptcha.php Normal file
View File

@@ -0,0 +1,65 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| API Keys
|--------------------------------------------------------------------------
|
| Set the public and private API keys as provided by reCAPTCHA.
|
| In version 2 of reCAPTCHA, public_key is the Site key,
| and private_key is the Secret key.
|
*/
'public_key' => env('RECAPTCHA_PUBLIC', ''),
'private_key' => env('RECAPTCHA_PRIVATE', ''),
/*
|--------------------------------------------------------------------------
| Template
|--------------------------------------------------------------------------
|
| Set a template to use if you don't want to use the standard one.
|
*/
'template' => '',
/*
|--------------------------------------------------------------------------
| Driver
|--------------------------------------------------------------------------
|
| Determine how to call out to get response; values are 'curl' or 'native'.
| Only applies to v2.
|
*/
'driver' => 'curl',
/*
|--------------------------------------------------------------------------
| Options
|--------------------------------------------------------------------------
|
| Various options for the driver
|
*/
'options' => array(
'curl_timeout' => 1,
'theme' => 'dark'
),
/*
|--------------------------------------------------------------------------
| Version
|--------------------------------------------------------------------------
|
| Set which version of ReCaptcha to use.
|
*/
'version' => 2,
);

14
config/sentry.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
return array(
'dsn' => env('SENTRY_DSN'),
// capture release as git sha
'release' => trim(exec('git log --pretty="%h" -n1 HEAD')),
// Capture bindings on SQL queries
'breadcrumbs.sql_bindings' => true,
// Capture default user context
'user_context' => true,
);

38
config/services.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, Mandrill, and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
],
'mandrill' => [
'secret' => env('MANDRILL_SECRET'),
],
'ses' => [
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => 'us-east-1',
],
'stripe' => [
'model' => App\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
];

153
config/session.php Normal file
View File

@@ -0,0 +1,153 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => 60,
'expire_on_close' => true,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => true,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => null,
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => 'w0bm_session',
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => null,
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => true,
];

11
config/taggable.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
return [
'delimiters' => ',;',
'glue' => ',',
'normalizer' => function($str) {
return str_slug($str, '');
}
];

24
config/verify.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
return [
'identified_by' => ['username', 'email'],
// The Super Admin role
// (returns true for all permissions)
'super_admin' => 'Super Admin',
// DB prefix for tables
'prefix' => '',
// Define Models if you extend them
'models' => [
'user' => 'App\Models\User',
'role' => 'App\Models\Role',
'permission' => 'Toddish\Verify\Models\Permission',
],
'crud_permissions' => [
'create_', 'read_', 'update_', 'delete_'
]
];

33
config/view.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
realpath(base_path('resources/views')),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => realpath(storage_path('framework/views')),
];

1
database/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.sqlite

View File

@@ -0,0 +1,21 @@
<?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\User::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,
'email' => $faker->email,
'password' => bcrypt(str_random(10)),
'remember_token' => str_random(10),
];
});

View File

View File

@@ -0,0 +1,100 @@
<?php
use Illuminate\Database\Migrations\Migration;
class VerifyInit extends Migration
{
public function __construct()
{
$this->prefix = Config::get('verify.prefix', '');
}
public function up()
{
$prefix = $this->prefix;
Schema::create($prefix . 'permissions', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('name', 100)->index();
$table->string('description', 255)->nullable();
$table->timestamps();
});
Schema::create($prefix . 'roles', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('name', 100)->index();
$table->string('description', 255)->nullable();
$table->integer('level');
$table->timestamps();
});
Schema::create($prefix . 'users', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('username', 30)->index();
$table->string('password', 60)->index();
$table->string('salt', 32);
$table->string('email', 255)->index();
$table->string('remember_token', 100)->nullable()->index();
$table->boolean('verified')->default(0);
$table->boolean('disabled')->default(0);
$table->softDeletes();
$table->timestamps();
});
Schema::create($prefix . 'role_user', function($table) use ($prefix)
{
$table->engine = 'InnoDB';
$table->integer('user_id')->unsigned()->index();
$table->integer('role_id')->unsigned()->index();
$table->timestamps();
$table->foreign('user_id')
->references('id')
->on($prefix . 'users')
->onDelete('cascade');
$table->foreign('role_id')
->references('id')
->on($prefix . 'roles')
->onDelete('cascade');
});
Schema::create($prefix . 'permission_role', function($table) use ($prefix)
{
$table->engine = 'InnoDB';
$table->integer('permission_id')->unsigned()->index();
$table->integer('role_id')->unsigned()->index();
$table->timestamps();
$table->foreign('permission_id')
->references('id')
->on($prefix . 'permissions')
->onDelete('cascade');
$table->foreign('role_id')
->references('id')
->on($prefix . 'roles')
->onDelete('cascade');
});
}
public function down()
{
Schema::drop($this->prefix . 'role_user');
Schema::drop($this->prefix . 'permission_role');
Schema::drop($this->prefix . 'users');
Schema::drop($this->prefix . 'roles');
Schema::drop($this->prefix . 'permissions');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateVideosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('videos', function(Blueprint $table) {
$table->increments('id');
$table->string('file')->unique();
$table->string('interpret')->nullable();
$table->string('songtitle')->nullable();
$table->string('imgsource')->nullable();
$table->unsignedInteger('category_id');
$table->unsignedInteger('user_id');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('videos');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categories', function(Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('shortname')->unique();
$table->text('description')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('categories');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCommentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('comments', function(Blueprint $table) {
$table->increments('id');
$table->text('content');
$table->unsignedInteger('user_id');
$table->unsignedInteger('video_id');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('comments');
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddHashToVideosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('videos', function(Blueprint $table) {
$table->char('hash', 40)->default('');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('videos', function(Blueprint $table) {
$table->dropColumn('hash');
});
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddActivationTokenToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function(Blueprint $table) {
$table->string('activation_token', 50)->nullable()->index()->after('remember_token');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function(Blueprint $table) {
$table->dropColumn('activation_token');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateModeratorLogTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('moderator_logs', function(Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->string('type');
$table->string('target_type');
$table->unsignedInteger('target_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('moderator_logs');
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddBackgroundToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function(Blueprint $table) {
$table->boolean('background')->default(true)->after('email');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function(Blueprint $table) {
$table->dropColumn('background');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserVideoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('favorites', function(Blueprint $table) {
$table->unsignedInteger('user_id')->index();
$table->unsignedInteger('video_id')->index();
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('video_id')->references('id')->on('videos')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('favorites');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMessagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
\Illuminate\Support\Facades\Schema::create('messages', function(Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('from')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
$table->unsignedInteger('to')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
$table->text('content');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
\Illuminate\Support\Facades\Schema::drop('messages');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddReadFieldToMessagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('messages', function(Blueprint $table) {
$table->timestamp('read')->nullable();
$table->string('subject')->default('');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('messages', function(Blueprint $table) {
$table->dropColumn(['read', 'subject']);
});
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddsCategoriesFieldToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->json('categories')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('categories');
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddBanningToUserTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('banreason')->nullable();
$table->timestamp('banend')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['banreason', 'banend']);
});
}
}

View File

@@ -0,0 +1,55 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddIcons extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('icons', function(Blueprint $table) {
$table->increments('id');
$table->string('icon', 255);
$table->string('icon_type', 255);
});
Schema::table('users', function(Blueprint $table) {
$table->unsignedInteger('icon_id')->index()->nullable();
$table->foreign('icon_id')
->references('id')
->on('icons')
->onDelete('cascade');
});
Schema::table('roles', function(Blueprint $table) {
$table->unsignedInteger('icon_id')->index()->nullable();
$table->foreign('icon_id')
->references('id')
->on('icons')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('icons');
Schema::table('users', function(Blueprint $table) {
$table->dropColumn('icon_id');
});
Schema::table('roles', function(Blueprint $table) {
$table->dropColumn('icon_id');
});
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddReasonToModeratorLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('moderator_logs', function (Blueprint $table) {
$table->string('reason')->nullable()->after('target_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('moderator_logs', function (Blueprint $table) {
$table->dropColumn('reason');
});
}
}

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateTaggableTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('taggable_tags', function (Blueprint $table) {
$table->increments('tag_id');
$table->string('name');
$table->string('normalized')->index();
$table->timestamps();
});
Schema::create('taggable_taggables', function (Blueprint $table) {
$table->unsignedInteger('tag_id');
$table->unsignedInteger('taggable_id');
$table->string('taggable_type');
$table->timestamps();
$table->primary(['tag_id', 'taggable_id', 'taggable_type']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('taggable_tags');
Schema::drop('taggable_taggables');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class Banners extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('banners', function(Blueprint $t) {
$t->increments('id');
$t->string('customer')->nullable();
$t->string('url');
$t->string('image');
$t->boolean('sfw');
$t->timestamp('until');
$t->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('banners');
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveBackgroundFromUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function(Blueprint $table) {
$table->dropColumn('background');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function(Blueprint $table) {
$table->boolean('background')->default(true)->after('email');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddDonationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('donations', function(Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('url')->nullable();
$table->float('amount', 5, 2);
$table->string('payment_method')->nullable();
$table->timestamp('timestamp');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('donations');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeAmountTypeToDecimalInDonationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('donations', function(Blueprint $table) {
$table->decimal('amount', 13, 4)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('donations', function(Blueprint $table) {
$table->float('amount', 5, 2)->change();
});
}
}

Some files were not shown because too many files have changed in this diff Show More