Esempio n. 1
0
 /**
  * @return MAIL_PROVIDER
  */
 public function make_mail_provider()
 {
     $class_name = $this->final_class_name('MAIL_PROVIDER', 'webcore/mail/mail_provider.php');
     /** @var $Result MAIL_PROVIDER */
     $Result = new $class_name($this);
     $opts = $this->mail_options;
     if ($opts->logging_enabled) {
         $class_name = $this->final_class_name('FILE_LOGGER', 'webcore/log/file_logger.php');
         /** @var $logger FILE_LOGGER */
         $logger = new $class_name();
         $logger->set_file_name($this->env->resolve_file($opts->log_file_name));
         if ($this->env->debugging) {
             $logger->set_enabled(Msg_type_all);
         } else {
             $logger->set_enabled(Msg_type_all - Msg_type_all_debug);
             $logger->set_channel_enabled(Msg_channel_publisher, Msg_type_all - Msg_type_all_debug);
             $logger->set_channel_enabled(Msg_channel_mail, Msg_type_all - Msg_type_all_debug);
         }
         $Result->logs->set_logger($logger);
     }
     return $Result;
 }
 /**
  * Send the error to the logger.
  * @param EXCEPTION_SIGNATURE $sig
  * @param string $msg
  * @access private
  */
 public function dispatch($sig, $msg)
 {
     if ($this->env->is_http_server() && $this->env->buffered() && $this->env->exception_handler_page) {
         $current_url = $this->env->url();
         $handler_url = $this->env->resolve_file($this->env->exception_handler_page);
         if (strpos($current_url, $handler_url) === false) {
             $parameters = $sig->as_query_string();
             $this->env->redirect_root($handler_url . '?' . $parameters);
         } else {
             parent::dispatch($sig, $msg);
         }
     } else {
         parent::dispatch($sig, $msg);
     }
 }
Esempio n. 3
0
 /**
  * Initialize the on-screen logger by passing {@link ENVIRONMENT::is_http_server()} 
  * to {@link set_is_html()}.
  * @param ENVIRONMENT $env
  */
 public function __construct($env)
 {
     parent::__construct();
     $this->set_is_html($env->is_http_server());
 }
Esempio n. 4
0
 /**
  * Called immediately after creating a page.
  * Override this function to customize initialization.
  * @see _make_page()
  * @param ENVIRONMENT $env
  * @param THEMED_PAGE $page
  * @access private
  */
 protected function _init_page($env, $page)
 {
     /* Set default properties for the <PAGE_TITLE>. */
     $page->title->group = $env->title;
     /* Force common local storage (client-side cookies) for the entire site. */
     $page->storage->prefix = 'webcore_';
     $page->storage->path = '/';
     /* Customize the page template. The example below adjusts the logo and
      * copyright rendered by the default template (See DEFAULT_TEMPLATE_RENDERER).
      * For more information on individual settings, see the documentation for
      * <PAGE_TEMPLATE_OPTIONS> and <PAGE_ICON_OPTIONS>.
      */
     $page->template_options->logo_file = '{icons}/logos/earthli_webcore_logo_full';
     $page->template_options->logo_title = 'earthli WebCore';
     $page->template_options->copyright = "Copyright (c) " . date('Y') . " Copyright holder. All Rights Reserved.";
     $page->icon_options->file_name = '{icons}/logos/webcore_icon';
     $page->icon_options->mime_type = 'image/png';
     /* Set the default theme. Look in the '{styles}/fonts' folder for font faces,
      * '{styles}/core' for font sizes and '{styles}/themes' for themes.
      */
     $page->default_theme->main_CSS_file_name = '{styles}themes/ice';
     $page->default_theme->font_name_CSS_file_name = '{styles}fonts/verdana';
     $page->default_theme->font_size_CSS_file_name = '{styles}core/small';
     /* Set up database options. */
     $page->database_options->host = 'localhost';
     // sets the default
     $page->database_options->name = 'earthli';
     $page->database_options->user_name = 'root';
     // sets the default
     $page->database_options->password = '';
     /* Set up basic mailing options. */
     $page->mail_options->enabled = false;
     $page->mail_options->SMTP_server = $env->default_domain();
     $page->mail_options->webmaster_address = 'webmaster@' . $env->default_domain();
     $page->mail_options->send_from_address = 'webmaster@' . $env->default_domain();
     $page->mail_options->send_from_name = $env->title;
     $page->mail_options->log_file_name = '{logs}earthli_mail.log';
     /* Set up icon aliases; controls which paths are updated by themes. */
     $page->add_as_icon_listener_to($env);
     $page->add_as_icon_listener_to($page);
     $page->add_icon_alias($env, Folder_name_icons);
 }