Beispiel #1
1
 public function onPost()
 {
     $question = Html::clean(post('question'));
     $reply_email = post('email');
     $validator = Validator::make(['question' => $question, 'reply_email' => $reply_email], ['question' => 'required', 'reply_email' => 'email']);
     if ($validator->fails()) {
         Flash::error('Please enter the question');
     } else {
         $ask = new Question();
         $ask->question = $question;
         /**
          * Saving question in DB
          **/
         $ask->is_approved = '0';
         $ask->category_id = '0';
         $ask->reply_email = $reply_email;
         $ask->save();
         /**
          * Sending email to admin
          **/
         $params = compact('question');
         Mail::send('redmarlin.faq::mail.asked', $params, function ($message) {
             $message->to(MailSettings::get('sender_email'));
             $email = post('email');
         });
         Flash::success('Your question was received correctly.');
     }
 }
 /**
  * Execute the console command.
  * @return void
  */
 public function fire()
 {
     $base_path = base_path('');
     $this->info('Dependencies installing begins here! (plugin:install)');
     // DEPENDENCIES
     foreach (['RainLab.Translate', 'Flynsarmy.IdeHelper', 'BnB.ScaffoldTranslation', 'October.Drivers', 'RainLab.GoogleAnalytics', 'Genius.StorageClear'] as $required) {
         $this->info('Installing: ' . $required);
         Artisan::call("plugin:install", ['name' => $required]);
     }
     $this->info('Dependencies installed!');
     // THEME
     $this->info('Installing: oc-genius-theme');
     system("cd '{$base_path}' && git clone https://github.com/estudiogenius/oc-genius-theme themes/genius");
     Theme::setActiveTheme('genius');
     // ELIXIR
     $this->info('Installing: oc-genius-elixir');
     system("cd '{$base_path}' && git clone https://github.com/estudiogenius/oc-genius-elixir plugins/genius/elixir");
     // FORMS
     $this->info('Installing: oc-genius-forms');
     system("cd '{$base_path}' && git clone https://github.com/estudiogenius/oc-genius-forms plugins/genius/forms");
     // BACKUP
     $this->info('Installing: oc-genius-backup');
     system("cd '{$base_path}' && git clone https://github.com/estudiogenius/oc-genius-backup plugins/genius/backup");
     // GOOGLE ANALYTICS
     $this->info('Initial setup: AnalytcsSettings');
     if (!AnalytcsSettings::get('project_name')) {
         AnalytcsSettings::create(['project_name' => 'API Project', 'client_id' => '979078159189-8afk8nn2las4vk1krbv8t946qfk540up.apps.googleusercontent.com', 'app_email' => '*****@*****.**', 'profile_id' => '112409305', 'tracking_id' => 'UA-29856398-24', 'domain_name' => 'retrans.srv.br'])->gapi_key()->add(File::create(['data' => plugins_path('genius/base/assets/genius-analytics.p12')]));
     }
     // EMAIL
     $this->info('Initial setup: MailSettings');
     if (!MailSettings::get('mandrill_secret')) {
         MailSettings::create(['send_mode' => 'mandrill', 'sender_name' => 'Genius Soluções Web', 'sender_email' => '*****@*****.**', 'mandrill_secret' => 't27R2C15NPnZ8tzBrIIFTA']);
     }
     // BRAND
     $this->info('Initial setup: BrandSettings');
     if (!BrandSettings::get('app_init')) {
         BrandSettings::create(['app_name' => 'Genius Soluções Web', 'app_tagline' => 'powered by Genius', "primary_color_light" => "#e67e22", "primary_color_dark" => "#d35400", "secondary_color_light" => "#34495e", "secondary_color_dark" => "#2b3e50", "custom_css" => "", 'app_init' => true])->logo()->add(File::create(['data' => plugins_path('genius/base/assets/genius-logo.png')]));
     }
     // USUARIO BASE
     $this->info('Initial setup: User');
     $user = User::find(1);
     if (!$user->last_name) {
         $user->update(['first_name' => 'Genius', 'last_name' => 'Soluções Web', 'login' => 'genius', 'email' => '*****@*****.**', 'password' => 'genius', 'password_confirmation' => 'genius']);
         $user->avatar()->add(File::create(['data' => plugins_path('genius/base/assets/genius-avatar.jpg')]));
     }
     $this->info('Genius.Base is ready to rock!');
     $this->info('');
     $this->info('For Laravel Elixir setup run: php artisan elixir:init');
 }
Beispiel #3
0
 /**
  * Register mail templating and settings override.
  */
 protected function registerMailer()
 {
     /*
      * Override system mailer with mail settings
      */
     Event::listen('mailer.beforeRegister', function () {
         if (MailSettings::isConfigured()) {
             MailSettings::applyConfigValues();
         }
     });
     /*
      * Override standard Mailer content with template
      */
     Event::listen('mailer.beforeAddContent', function ($mailer, $message, $view, $data) {
         if (MailTemplate::addContentToMailer($message, $view, $data)) {
             return false;
         }
     });
 }
Beispiel #4
0
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     /*
      * Register self
      */
     parent::register('system');
     /*
      * Register core providers
      */
     App::register('October\\Rain\\Config\\ConfigServiceProvider');
     App::register('October\\Rain\\Translation\\TranslationServiceProvider');
     /*
      * Define path constants
      */
     if (!defined('PATH_APP')) {
         define('PATH_APP', app_path());
     }
     if (!defined('PATH_BASE')) {
         define('PATH_BASE', base_path());
     }
     if (!defined('PATH_PUBLIC')) {
         define('PATH_PUBLIC', public_path());
     }
     if (!defined('PATH_STORAGE')) {
         define('PATH_STORAGE', storage_path());
     }
     if (!defined('PATH_PLUGINS')) {
         define('PATH_PLUGINS', base_path() . Config::get('cms.pluginsDir'));
     }
     /*
      * Register singletons
      */
     App::singleton('string', function () {
         return new \October\Rain\Support\Str();
     });
     App::singleton('backend.helper', function () {
         return new \Backend\Classes\BackendHelper();
     });
     App::singleton('backend.menu', function () {
         return \Backend\Classes\NavigationManager::instance();
     });
     App::singleton('backend.auth', function () {
         return \Backend\Classes\AuthManager::instance();
     });
     /*
      * Register all plugins
      */
     $pluginManager = PluginManager::instance();
     $pluginManager->registerAll();
     /*
      * Error handling for uncaught Exceptions
      */
     App::error(function (\Exception $exception, $httpCode) {
         $handler = new ErrorHandler();
         $isConsole = App::runningInConsole();
         return $handler->handleException($exception, $httpCode, $isConsole);
     });
     /*
      * Write all log events to the database
      */
     Event::listen('illuminate.log', function ($level, $message, $context) {
         if (!DbDongle::hasDatabase()) {
             return;
         }
         EventLog::add($message, $level);
     });
     /*
      * Register basic Twig
      */
     App::bindShared('twig', function ($app) {
         $twig = new Twig_Environment(new TwigLoader(), ['auto_reload' => true]);
         $twig->addExtension(new TwigExtension());
         return $twig;
     });
     /*
      * Register .htm extension for Twig views
      */
     App::make('view')->addExtension('htm', 'twig', function () {
         return new TwigEngine(App::make('twig'));
     });
     /*
      * Register Twig that will parse strings
      */
     App::bindShared('twig.string', function ($app) {
         $twig = $app['twig'];
         $twig->setLoader(new Twig_Loader_String());
         return $twig;
     });
     /*
      * Override system mailer with mail settings
      */
     Event::listen('mailer.beforeRegister', function () {
         if (MailSettings::isConfigured()) {
             MailSettings::applyConfigValues();
         }
     });
     /*
      * Override standard Mailer content with template
      */
     Event::listen('mailer.beforeAddContent', function ($mailer, $message, $view, $plain, $data) {
         if (MailTemplate::addContentToMailer($message, $view, $data)) {
             return false;
         }
     });
     /*
      * Register other module providers
      */
     foreach (Config::get('cms.loadModules', []) as $module) {
         if (strtolower(trim($module)) == 'system') {
             continue;
         }
         App::register('\\' . $module . '\\ServiceProvider');
     }
     /*
      * Register navigation
      */
     BackendMenu::registerCallback(function ($manager) {
         $manager->registerMenuItems('October.System', ['system' => ['label' => 'system::lang.system.menu_label', 'icon' => 'icon-cog', 'url' => Backend::url('system/settings'), 'permissions' => ['backend.manage_users', 'system.*'], 'order' => 1000]]);
     });
     /*
      * Register report widgets
      */
     WidgetManager::instance()->registerReportWidgets(function ($manager) {
         $manager->registerReportWidget('System\\ReportWidgets\\Status', ['label' => 'backend::lang.dashboard.status.widget_title_default', 'context' => 'dashboard']);
     });
     /*
      * Register permissions
      */
     BackendAuth::registerCallback(function ($manager) {
         $manager->registerPermissions('October.System', ['system.manage_settings' => ['label' => 'system::lang.permissions.manage_system_settings', 'tab' => 'System'], 'system.manage_updates' => ['label' => 'system::lang.permissions.manage_software_updates', 'tab' => 'System'], 'system.manage_mail_templates' => ['label' => 'system::lang.permissions.manage_mail_templates', 'tab' => 'System']]);
     });
     /*
      * Register markup tags
      */
     MarkupManager::instance()->registerCallback(function ($manager) {
         $manager->registerFunctions(['post' => 'post', 'link_to' => 'link_to', 'link_to_asset' => 'link_to_asset', 'link_to_route' => 'link_to_route', 'link_to_action' => 'link_to_action', 'asset' => 'asset', 'action' => 'action', 'url' => 'url', 'route' => 'route', 'secure_url' => 'secure_url', 'secure_asset' => 'secure_asset', 'str_*' => ['Str', '*'], 'url_*' => ['URL', '*'], 'html_*' => ['HTML', '*'], 'form_*' => ['Form', '*'], 'form_macro' => ['Form', '__call']]);
         $manager->registerFilters(['slug' => ['Str', 'slug'], 'plural' => ['Str', 'plural'], 'singular' => ['Str', 'singular'], 'finish' => ['Str', 'finish'], 'snake' => ['Str', 'snake'], 'camel' => ['Str', 'camel'], 'studly' => ['Str', 'studly'], 'md' => ['October\\Rain\\Support\\Markdown', 'parse']]);
     });
     /*
      * Register settings
      */
     SettingsManager::instance()->registerCallback(function ($manager) {
         $manager->registerSettingItems('October.System', ['administrators' => ['label' => 'backend::lang.user.menu_label', 'description' => 'backend::lang.user.menu_description', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-users', 'url' => Backend::url('backend/users'), 'permissions' => ['backend.manage_users'], 'order' => 600], 'updates' => ['label' => 'system::lang.updates.menu_label', 'description' => 'system::lang.updates.menu_description', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-cloud-download', 'url' => Backend::url('system/updates'), 'permissions' => ['system.manage_updates'], 'order' => 700], 'event_logs' => ['label' => 'system::lang.event_log.menu_label', 'description' => 'system::lang.event_log.menu_description', 'category' => SettingsManager::CATEGORY_LOGS, 'icon' => 'icon-exclamation-triangle', 'url' => Backend::url('system/eventlogs'), 'permissions' => ['system.access_event_logs'], 'order' => 800], 'request_logs' => ['label' => 'system::lang.request_log.menu_label', 'description' => 'system::lang.request_log.menu_description', 'category' => SettingsManager::CATEGORY_LOGS, 'icon' => 'icon-file-o', 'url' => Backend::url('system/requestlogs'), 'permissions' => ['system.access_request_logs'], 'order' => 800], 'mail_settings' => ['label' => 'system::lang.mail.menu_label', 'description' => 'system::lang.mail.menu_description', 'category' => SettingsManager::CATEGORY_MAIL, 'icon' => 'icon-envelope', 'class' => 'System\\Models\\MailSettings', 'order' => 400], 'mail_templates' => ['label' => 'system::lang.mail_templates.menu_label', 'description' => 'system::lang.mail_templates.menu_description', 'category' => SettingsManager::CATEGORY_MAIL, 'icon' => 'icon-envelope-square', 'url' => Backend::url('system/mailtemplates'), 'order' => 500]]);
     });
     /*
      * Register console commands
      */
     $this->registerConsoleCommand('october.up', 'System\\Console\\OctoberUp');
     $this->registerConsoleCommand('october.down', 'System\\Console\\OctoberDown');
     $this->registerConsoleCommand('october.update', 'System\\Console\\OctoberUpdate');
     $this->registerConsoleCommand('october.util', 'System\\Console\\OctoberUtil');
     $this->registerConsoleCommand('plugin.install', 'System\\Console\\PluginInstall');
     $this->registerConsoleCommand('plugin.remove', 'System\\Console\\PluginRemove');
     $this->registerConsoleCommand('plugin.refresh', 'System\\Console\\PluginRefresh');
     /*
      * Override clear cache command
      */
     App::bindShared('command.cache.clear', function ($app) {
         return new \System\Console\CacheClear($app['cache'], $app['files']);
     });
     /*
      * Register the sidebar for the System main menu
      */
     BackendMenu::registerContextSidenavPartial('October.System', 'system', '@/modules/system/partials/_system_sidebar.htm');
 }
 /**
  * Add data to DB scheme
  * @return null;
  */
 public function run()
 {
     Settings::set('name', 'Seldac');
     Settings::set('full_name', 'Seldac Servizi S.r.L.');
     Settings::set('slogan', 'The answer to the administrative needs of all companies, small and medium-sized businesses, professionals and associations.');
     Settings::set('about', implode("\n", ['provides high-level advice to companies, accompanying step by step their customers in the intricate field of taxation.', 'The service of electronic data processing accounting allows to fulfill all the formalities required by law.', 'Our customer can resolve the related tasks because the service is managed by experienced staff', 'through the use of one of the most advanced management software as ZUCCHETTI.']));
     Settings::set('address_street_name', 'via Felice Cavallotti');
     Settings::set('address_street_number', '128');
     Settings::set('address_street_int', '3');
     Settings::set('address_zip', '15067');
     Settings::set('address_city', 'Novi Ligure');
     Settings::set('address_province', 'AL');
     Settings::set('address_country', 'IT');
     Settings::set('vat', '02254830066');
     Settings::set('rui_section', 'E');
     Settings::set('rui_number', 'E000147232');
     Settings::set('rui_date', '10/04/2007');
     Settings::set('mc_address_street_name', 'via Felice Cavallotti');
     Settings::set('mc_address_street_number', '128');
     Settings::set('mc_address_street_int', '5');
     Settings::set('mc_address_zip', '15067');
     Settings::set('mc_address_city', 'Novi Ligure');
     Settings::set('mc_address_province', 'AL');
     Settings::set('mc_address_country', 'IT');
     Settings::set('mc_nin', 'CSRMRC64P02D612A');
     Settings::set('mc_vat', '05110830485');
     AddThisSettings::set('pubid', 'ra-5481b79425aef103');
     SegmentSettings::set('write_key', 'qufrprcjgq');
     $ga_settings = GoogleAnalyticsSettings::instance();
     $ga_settings->project_name = 'seldac';
     $ga_settings->client_id = '284098878834-asjihnigkqg3ikl5kiqsgked7f2j3nf4.apps.googleusercontent.com';
     $ga_settings->app_email = '*****@*****.**';
     $ga_settings->profile_id = '63908586';
     $ga_settings->tracking_id = 'UA-34732651-1';
     $ga_settings->domain_name = 'seldac';
     $ga_settings->save();
     $mail_settings = MailSettings::instance();
     $mail_settings->send_mode = 'smtp';
     $mail_settings->sender_name = 'Seldac Servizi S.r.L.';
     $mail_settings->sender_email = '*****@*****.**';
     $mail_settings->smtp_address = 'smtp.aruba.it';
     $mail_settings->smtp_port = '465';
     $mail_settings->smtp_user = '******';
     $mail_settings->smtp_password = '******';
     $mail_settings->smtp_authorization = '1';
     $mail_settings->smtp_ssl = '1';
     $mail_settings->save();
     $seo_extension_settings = SeoExtensionSettings::instance();
     $seo_extension_settings->enable_title = '1';
     $seo_extension_settings->enable_canonical_url = '1';
     $seo_extension_settings->title = '| Seldac';
     $seo_extension_settings->title_position = 'suffix';
     $seo_extension_settings->other_tags = "<meta name=\"author\" content=\"Alex Carrega (AxC - http:\\/\\/www.alexcarrega.com)\">\r\n<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" \\/>\r\n<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\" \\/>\r\n<meta name=\"description\" content=\"Contact page\" \\/>\r\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">";
     $seo_extension_settings->save();
     $brand_settings = BrandSettings::instance();
     $brand_settings->app_name = 'Seldac';
     $brand_settings->app_tagline = 'Seldac Servizi S.r.L.';
     $brand_settings->primary_color_light = '#de6b10';
     $brand_settings->primary_color_dark = '#DAA520';
     $brand_settings->secondary_color_light = '#F0E68C';
     $brand_settings->secondary_color_dark = '#B22222';
     $brand_settings->save();
     $recaptcha_settings = reCAPTCHASettings::instance();
     $recaptcha_settings->public_key = '6LfF0uwSAAAAAL4L5_sQ9aDiCn8PzMd0rStSSH5N';
     $recaptcha_settings->private_key = '6LfF0uwSAAAAAOdiygwACNXT34u5NpD0ndHXn9Jn';
     $recaptcha_settings->save();
     // @p-color: #58585a;
     // @s-color: #de6b10;
     // @bg-color: #e6e7e8;
     // @i-color: #DAA520;
     // @w-color: #F0E68C;
     // @d-color: #B22222;
 }
Beispiel #6
0
 public function onOctoMailSent()
 {
     // Set the requested template in a variable;
     $this->requestTemplate = $this->loadTemplate();
     if (!$this->requestTemplate) {
         throw new \Exception(sprintf(Lang::get('octodevel.octomail::lang.components.mailTemplate.functions.onOctoMailSent.exceptions.invalid_template')));
     }
     // Set a second variable with request data from database
     $template = $this->requestTemplate->attributes;
     if (!$template) {
         throw new \Exception(sprintf(Lang::get('octodevel.octomail::lang.components.mailTemplate.functions.onOctoMailSent.exceptions.invalid_attributes')));
     }
     // Set a global $_POST variable
     $post = post();
     // Unset problematic variables
     if (isset($post['message'])) {
         throw new \Exception(sprintf(Lang::get('octodevel.octomail::lang.components.mailTemplate.functions.onOctoMailSent.exceptions.invalid_message_field')));
     }
     // get the message body
     $this->bodyField = $this->property('bodyField');
     if (isset($this->bodyField) && !empty($this->bodyField)) {
         if (isset($post[$this->bodyField])) {
             $body = strip_tags($post[$this->bodyField]);
             $post[$this->bodyField] = nl2br($body);
         }
     }
     // get name for auto-response message
     $this->aRName = $this->property('responseFieldName');
     // get email for auto-response message
     $this->aREmail = $this->property('responseFieldEmail');
     // Set redirect URL
     $redirectUrl = $this->controller->pageUrl($this->property('redirectURL'));
     // Get response email
     $responseMailTemplate = $this->property('responseTemplate');
     // Get request info
     $request = Request::createFromGlobals();
     // Set some request variables
     $post['ip_address'] = $request->getClientIp();
     $post['user_agent'] = $request->headers->get('User-Agent');
     $post['sender_name'] = $template['sender_name'];
     $post['sender_email'] = $template['sender_email'];
     $post['recipient_name'] = $template['recipient_name'] ? $template['recipient_name'] : MailSettings::get('sender_name');
     $post['recipient_email'] = $template['recipient_email'] ? $template['recipient_email'] : MailSettings::get('sender_email');
     $post['default_subject'] = $template['subject'];
     // Set some usable data
     $data = ['replyto_email' => isset($post[$this->aREmail]) ? $post[$this->aREmail] : false, 'replyto_name' => isset($post[$this->aRName]) ? $post[$this->aRName] : false, 'sender_name' => $template['sender_name'], 'sender_email' => $template['sender_email'], 'recipient_name' => $template['recipient_name'] ? $template['recipient_name'] : MailSettings::get('sender_name'), 'recipient_email' => $template['recipient_email'] ? $template['recipient_email'] : MailSettings::get('sender_email'), 'default_subject' => $template['subject']];
     // Making custon validation
     $fields = explode(',', preg_replace('/\\s/', '', $template['fields']));
     if ($fields) {
         $validation_rules = [];
         foreach ($fields as $field) {
             $rules = explode("|", $field);
             if ($rules) {
                 $field_name = $rules[0];
                 $validation_rules[$field_name] = [];
                 unset($rules[0]);
                 foreach ($rules as $key => $rule) {
                     $validation_rules[$field_name][$key] = $rule;
                 }
             }
         }
         $this->rules = $validation_rules;
         $validation = Validator::make($post, $this->rules);
         if ($validation->fails()) {
             throw new ValidationException($validation);
         }
     }
     // Get recipients
     $recipients = DB::table($this->recipients)->where('template_id', '=', $template['id'])->leftJoin($this->recipients_table, $this->recipients_table . '.id', '=', $this->recipients . '.recipient_id')->get();
     if (!$template['multiple_recipients']) {
         Mail::send('octodevel.octomail::mail.' . $template['slug'], $post, function ($message) use($data) {
             $message->from($data['sender_email'], $data['sender_name']);
             $message->to($data['recipient_email'], $data['recipient_name'])->subject($data['default_subject']);
             if ($data['replyto_email'] and $data['replyto_name']) {
                 $message->replyTo($data['replyto_email'], $data['replyto_name']);
             }
         });
         $log = new RegisterLog();
         $log->template_id = $template['id'];
         $log->sender_agent = $post['user_agent'];
         $log->sender_ip = $post['ip_address'];
         $log->sent_at = date('Y-m-d H:i:s');
         $log->data = $post;
         $log->save();
     } else {
         // Multiple emails
         foreach ($recipients as $recipient) {
             $data['recipient_name'] = $recipient->name;
             $data['recipient_email'] = $recipient->email;
             Mail::send('octodevel.octomail::mail.' . $template['slug'], $post, function ($message) use($data) {
                 $message->from($data['sender_email'], $data['sender_name']);
                 $message->to($data['recipient_email'], $data['recipient_name'])->subject($data['default_subject']);
                 if ($data['replyto_email'] and $data['replyto_name']) {
                     $message->replyTo($data['replyto_email'], $data['replyto_name']);
                 }
             });
             $log = new RegisterLog();
             $log->template_id = $template['id'];
             $log->sender_agent = $post['user_agent'];
             $log->sender_ip = $post['ip_address'];
             $log->sent_at = date('Y-m-d H:i:s');
             $log->data = $post;
             $log->save();
         }
     }
     if (isset($post[$this->aREmail]) and $post[$this->aREmail] and (isset($post[$this->aRName]) and $post[$this->aRName]) and (isset($template['autoresponse']) and $template['autoresponse'])) {
         $response = ['name' => $post[$this->aRName], 'email' => $post[$this->aREmail]];
         if ($responseMailTemplate) {
             Mail::send($responseMailTemplate, $post, function ($autoresponse) use($response) {
                 $autoresponse->to($response['email'], $response['name']);
             });
         }
     }
     $this->page["result"] = true;
     $this->page["confirmation_text"] = $template['confirmation_text'];
     if ($redirectUrl) {
         return Redirect::intended($redirectUrl);
     }
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     /*
      * Register self
      */
     parent::register('system');
     /*
      * Register singletons
      */
     App::singleton('backend.helper', function () {
         return new \Backend\Helpers\Backend();
     });
     App::singleton('backend.menu', function () {
         return \Backend\Classes\NavigationManager::instance();
     });
     App::singleton('backend.auth', function () {
         return \Backend\Classes\AuthManager::instance();
     });
     /*
      * Check for CLI or system/updates route and disable any plugin initialization
      * @todo This should be moved to middleware
      */
     $requestPath = \October\Rain\Router\Helper::normalizeUrl(\Request::path());
     $systemPath = \October\Rain\Router\Helper::normalizeUrl(Config::get('cms.backendUri') . '/system/updates');
     if (stripos($requestPath, $systemPath) === 0) {
         PluginManager::$noInit = true;
     }
     $updateCommands = ['october:up', 'october:update'];
     if (App::runningInConsole() && count(array_intersect($updateCommands, Request::server('argv'))) > 0) {
         PluginManager::$noInit = true;
     }
     /*
      * Register all plugins
      */
     $pluginManager = PluginManager::instance();
     $pluginManager->registerAll();
     /*
      * Allow plugins to use the scheduler
      */
     Event::listen('console.schedule', function ($schedule) use($pluginManager) {
         foreach ($pluginManager->getPlugins() as $plugin) {
             if (method_exists($plugin, 'registerSchedule')) {
                 $plugin->registerSchedule($schedule);
             }
         }
     });
     /*
      * Error handling for uncaught Exceptions
      */
     Event::listen('exception.beforeRender', function ($exception, $httpCode, $request) {
         $handler = new ErrorHandler();
         return $handler->handleException($exception);
     });
     /*
      * Write all log events to the database
      */
     Event::listen('illuminate.log', function ($level, $message, $context) {
         if (DbDongle::hasDatabase() && !defined('OCTOBER_NO_EVENT_LOGGING')) {
             EventLog::add($message, $level);
         }
     });
     /*
      * Register basic Twig
      */
     App::singleton('twig', function ($app) {
         $twig = new Twig_Environment(new TwigLoader(), ['auto_reload' => true]);
         $twig->addExtension(new TwigExtension());
         return $twig;
     });
     /*
      * Register .htm extension for Twig views
      */
     App::make('view')->addExtension('htm', 'twig', function () {
         return new TwigEngine(App::make('twig'));
     });
     /*
      * Register Twig that will parse strings
      */
     App::singleton('twig.string', function ($app) {
         $twig = $app['twig'];
         $twig->setLoader(new Twig_Loader_String());
         return $twig;
     });
     /*
      * Override system mailer with mail settings
      */
     Event::listen('mailer.beforeRegister', function () {
         if (MailSettings::isConfigured()) {
             MailSettings::applyConfigValues();
         }
     });
     /*
      * Override standard Mailer content with template
      */
     Event::listen('mailer.beforeAddContent', function ($mailer, $message, $view, $data) {
         if (MailTemplate::addContentToMailer($message, $view, $data)) {
             return false;
         }
     });
     /*
      * Register other module providers
      */
     foreach (Config::get('cms.loadModules', []) as $module) {
         if (strtolower(trim($module)) == 'system') {
             continue;
         }
         App::register('\\' . $module . '\\ServiceProvider');
     }
     /*
      * Register navigation
      */
     BackendMenu::registerCallback(function ($manager) {
         $manager->registerMenuItems('October.System', ['system' => ['label' => 'system::lang.settings.menu_label', 'icon' => 'icon-cog', 'url' => Backend::url('system/settings'), 'permissions' => ['backend.manage_users', 'system.*'], 'order' => 1000]]);
     });
     /*
      * Register report widgets
      */
     WidgetManager::instance()->registerReportWidgets(function ($manager) {
         $manager->registerReportWidget('System\\ReportWidgets\\Status', ['label' => 'backend::lang.dashboard.status.widget_title_default', 'context' => 'dashboard']);
     });
     /*
      * Register permissions
      */
     BackendAuth::registerCallback(function ($manager) {
         $manager->registerPermissions('October.System', ['system.manage_updates' => ['label' => 'system::lang.permissions.manage_software_updates', 'tab' => 'system::lang.permissions.name'], 'system.manage_mail_settings' => ['label' => 'system::lang.permissions.manage_mail_settings', 'tab' => 'system::lang.permissions.name'], 'system.manage_mail_templates' => ['label' => 'system::lang.permissions.manage_mail_templates', 'tab' => 'system::lang.permissions.name']]);
     });
     /*
      * Register markup tags
      */
     MarkupManager::instance()->registerCallback(function ($manager) {
         $manager->registerFunctions(['input' => 'input', 'post' => 'post', 'get' => 'get', 'link_to' => 'link_to', 'link_to_asset' => 'link_to_asset', 'link_to_route' => 'link_to_route', 'link_to_action' => 'link_to_action', 'asset' => 'asset', 'action' => 'action', 'url' => 'url', 'route' => 'route', 'secure_url' => 'secure_url', 'secure_asset' => 'secure_asset', 'str_*' => ['Str', '*'], 'url_*' => ['URL', '*'], 'html_*' => ['HTML', '*'], 'form_*' => ['Form', '*'], 'form_macro' => ['Form', '__call']]);
         $manager->registerFilters(['slug' => ['Str', 'slug'], 'plural' => ['Str', 'plural'], 'singular' => ['Str', 'singular'], 'finish' => ['Str', 'finish'], 'snake' => ['Str', 'snake'], 'camel' => ['Str', 'camel'], 'studly' => ['Str', 'studly'], 'trans' => ['Lang', 'get'], 'transchoice' => ['Lang', 'choice'], 'md' => ['Markdown', 'parse']]);
     });
     /*
      * Register settings
      */
     SettingsManager::instance()->registerCallback(function ($manager) {
         $manager->registerSettingItems('October.System', ['administrators' => ['label' => 'backend::lang.user.menu_label', 'description' => 'backend::lang.user.menu_description', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-users', 'url' => Backend::url('backend/users'), 'permissions' => ['backend.manage_users'], 'order' => 600], 'updates' => ['label' => 'system::lang.updates.menu_label', 'description' => 'system::lang.updates.menu_description', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-cloud-download', 'url' => Backend::url('system/updates'), 'permissions' => ['system.manage_updates'], 'order' => 700], 'event_logs' => ['label' => 'system::lang.event_log.menu_label', 'description' => 'system::lang.event_log.menu_description', 'category' => SettingsManager::CATEGORY_LOGS, 'icon' => 'icon-exclamation-triangle', 'url' => Backend::url('system/eventlogs'), 'permissions' => ['system.access_event_logs'], 'order' => 800], 'request_logs' => ['label' => 'system::lang.request_log.menu_label', 'description' => 'system::lang.request_log.menu_description', 'category' => SettingsManager::CATEGORY_LOGS, 'icon' => 'icon-file-o', 'url' => Backend::url('system/requestlogs'), 'permissions' => ['system.access_request_logs'], 'order' => 800], 'mail_settings' => ['label' => 'system::lang.mail.menu_label', 'description' => 'system::lang.mail.menu_description', 'category' => SettingsManager::CATEGORY_MAIL, 'icon' => 'icon-envelope', 'class' => 'System\\Models\\MailSettings', 'permissions' => ['system.manage_mail_settings'], 'order' => 400], 'mail_templates' => ['label' => 'system::lang.mail_templates.menu_label', 'description' => 'system::lang.mail_templates.menu_description', 'category' => SettingsManager::CATEGORY_MAIL, 'icon' => 'icon-envelope-square', 'url' => Backend::url('system/mailtemplates'), 'permissions' => ['system.manage_mail_templates'], 'order' => 500]]);
     });
     /*
      * Add CMS based cache clearing to native command
      */
     Event::listen('cache:cleared', function () {
         \System\Helpers\Cache::clear();
     });
     /*
      * Register console commands
      */
     $this->registerConsoleCommand('october.up', 'System\\Console\\OctoberUp');
     $this->registerConsoleCommand('october.down', 'System\\Console\\OctoberDown');
     $this->registerConsoleCommand('october.update', 'System\\Console\\OctoberUpdate');
     $this->registerConsoleCommand('october.util', 'System\\Console\\OctoberUtil');
     $this->registerConsoleCommand('plugin.install', 'System\\Console\\PluginInstall');
     $this->registerConsoleCommand('plugin.remove', 'System\\Console\\PluginRemove');
     $this->registerConsoleCommand('plugin.refresh', 'System\\Console\\PluginRefresh');
     /*
      * Register the sidebar for the System main menu
      */
     BackendMenu::registerContextSidenavPartial('October.System', 'system', '~/modules/system/partials/_system_sidebar.htm');
 }