/** * Execute the console command. * * @return void */ public function handle() { parent::fire(); try { if (cmsinstalled()) { throw new \Exception('The CMS is already installed!'); } $success = $this->r_installer->testDBConnection($this->argument('db-host'), $this->argument('db-name'), $this->argument('db-username'), $this->argument('db-password')); if ($success) { $this->r_installer->generateConfigs($this->argument('site-name'), $this->argument('site-description'), $this->argument('site-url'), $this->argument('db-host'), $this->argument('db-name'), $this->argument('db-username'), $this->argument('db-password'), $this->argument('user-first-name'), $this->argument('user-last-name'), $this->argument('user-email')); $this->call('cache:clear'); $this->r_installer->migrate(['APP_SITE_NAME' => $this->argument('site-name'), 'APP_URL' => $this->argument('site-url')], ['--force' => true, '--database' => 'installer'], ['--force' => true, '--database' => 'installer']); $password = Str::random(Settings::get('installer.password_length')); $this->r_installer->addUserAdmin(['civility' => $this->argument('user-civility'), 'first_name' => $this->argument('user-first-name'), 'last_name' => $this->argument('user-last-name'), 'email' => $this->argument('user-email'), 'password' => $password]); $this->r_installer->set_env_as_production(); $this->line(sprintf(trans('installer::installer.command_line_show_password'), $this->argument('user-email'), $password)); $this->line(trans('installer::installer.command_line_remember_change_password')); } else { $this->error(trans('installer::installer.error:db_connection')); } } catch (InvalidArgumentException $e) { $this->error($e->getMessage()); } catch (\Exception $e) { $this->error($e->getMessage()); } }
/** * @param null $action * * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed */ public function register($action = null) { switch ($action) { case 'info': return $this->widgetInformation(); default: return $this->output('users.widgets.socialbuttons', ['social_login' => Settings::get('users.social.login')]); } }
/** * Register bindings in the container. * * @return void */ public function register() { //Bind the facade and pass api construct parameters $this->app->bind('LinkedIn', function () { $api_key = Settings::get('linkedin.api_key'); $api_secret = Settings::get('linkedin.api_secret'); $linkedIn = new LinkedInLaravel($api_key, $api_secret); $linkedIn->setHttpClient(new HttpClient()); $linkedIn->setHttpMessageFactory(new HttpGuzzleMessageFactory()); return $linkedIn; }); }
/** * Register the service providers. * * @return void */ public function register() { // Main Service $this->app->bind('SammyK\\LaravelFacebookSdk\\LaravelFacebookSdk', function ($app) { $config = Settings::get('laravel-facebook-sdk.facebook_config'); $config['app_id'] = Settings::get('services.facebook.client_id'); $config['app_secret'] = Settings::get('services.facebook.client_secret'); if (!isset($config['persistent_data_handler']) && isset($app['session.store'])) { $config['persistent_data_handler'] = new LaravelPersistentDataHandler($app['session.store']); } if (!isset($config['url_detection_handler'])) { $config['url_detection_handler'] = new LaravelUrlDetectionHandler($app['url']); } return new LaravelFacebookSdk($app['config'], $app['url'], $config); }); }
/** * Boot the application events. * * @return void */ public function boot() { $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); if (cmsinstalled()) { if (true || Settings::get('users.users_module_as_home_page')) { Route::group(['middleware' => ['web', 'user'], 'namespace' => 'cms\\Modules\\Users\\Http\\Controllers\\Frontend'], function () { Route::get('/', ['as' => 'home', 'uses' => 'UsersController@index']); }); } if (Settings::get('users.is_registration_allowed')) { Route::group(['middleware' => ['web'], 'as' => 'users.', 'namespace' => 'cms\\Modules\\Users\\Http\\Controllers\\Frontend'], function () { // Registration routes... Route::get('register', ['as' => 'register', 'uses' => 'RegisterController@showRegistrationForm']); Route::post('register', 'RegisterController@register'); // Register from social networks Route::get('register/{provider?}', ['uses' => 'RegisterController@getRegisterFromProvider']); Route::post('register/{provider?}', ['uses' => 'RegisterController@postRegisterFromProvider']); }); } } }
/** * Twitter constructor. * * @param Config $config * @param SessionStore $session */ public function __construct(Config $config, SessionStore $session) { $this->tconfig = Settings::get('ttwitter'); $client_id = Settings::get('services.twitter.client_id'); $client_secret = Settings::get('services.twitter.client_secret'); $this->tconfig['CONSUMER_KEY'] = isset($client_id) && !empty($client_id) ? $client_id : $this->tconfig['CONSUMER_KEY']; $this->tconfig['CONSUMER_SECRET'] = isset($client_secret) && !empty($client_secret) ? $client_secret : $this->tconfig['CONSUMER_SECRET']; if (empty($this->tconfig)) { throw new Exception('No config found'); } $this->debug = isset($this->tconfig['debug']) && $this->tconfig['debug'] ? true : false; $this->parent_config = ['consumer_key' => $this->tconfig['CONSUMER_KEY'], 'consumer_secret' => $this->tconfig['CONSUMER_SECRET'], 'token' => $this->tconfig['ACCESS_TOKEN'], 'secret' => $this->tconfig['ACCESS_TOKEN_SECRET']]; if ($session->has('access_token')) { $access_token = $session->get('access_token'); if (is_array($access_token) && isset($access_token['oauth_token']) && isset($access_token['oauth_token_secret']) && !empty($access_token['oauth_token']) && !empty($access_token['oauth_token_secret'])) { $this->parent_config['token'] = $access_token['oauth_token']; $this->parent_config['secret'] = $access_token['oauth_token_secret']; } } $this->parent_config['use_ssl'] = $this->tconfig['USE_SSL']; $this->parent_config['user_agent'] = 'LTTW ' . parent::VERSION; parent::__construct($this->parent_config); }
/** * Set the active theme based on the settings */ private function setActiveTheme() { if (cmsinstalled()) { $theme = ''; if ($this->inAdministration() || $this->inInstaller()) { $theme = Settings::get('themes.themes.backend'); } else { $theme = Settings::get('themes.themes.frontend'); } ThemeFacade::setCurrent($theme); } else { ThemeFacade::setCurrent(config('themes.themes.backend')); } }
/** * @return \Symfony\Component\HttpFoundation\Response */ public function showConnector() { // xAbe todo : decommente dans le controller le _before(); $debug = false; $session = null; $roots = $this->getElFinderRoots(); if (empty($roots)) { $roots = array_merge($this->getMountableElFinderDirectoriesList(), $this->getMountableElFinderDisksList()); } // if (app()->bound('session.store')) // { // $sessionStore = app('session.store'); // $session = new LaravelSession($sessionStore); // } $rootOptions = Settings::get('elfinder.root_options', []); foreach ($roots as $key => $root) { if (is_array($rootOptions)) { $roots[$key] = array_merge($rootOptions, $root); } } $opts = Settings::get('elfinder.options', []); $opts = array_merge($opts, ['roots' => $roots, 'session' => $session, 'debug' => $debug]); $elFinder = new \elFinder($opts); // run elFinder $connector = new Connector($elFinder, $debug); $connector->run(); return $connector->getResponse(); }
/** * Get provider config from settings. * * @param string $provider * * @return array */ private function getConfig($provider) { return ['client_id' => Settings::get('services.' . $provider . '.client_id'), 'client_secret' => Settings::get('services.' . $provider . '.client_secret'), 'redirect' => Settings::get('services.' . $provider . '.redirect')]; }