Exemplo n.º 1
0
 /**
  * Set output
  * Loads the "container" view file and sets the content
  * @param string $view  The name of the view to load
  * @param array  $template_variables Associative array to pass to view
  * @return void
  */
 private function set_output($view, $template_variables = array())
 {
     ee()->load->library('view');
     if (IS_CORE) {
         $this->title = str_replace('ExpressionEngine', 'ExpressionEngine Core', $this->title);
     }
     // If we're dealing with an error, change the title to indicate that
     if ($view == "error") {
         $this->title = $this->is_installed ? sprintf(lang('error_updating'), $this->installed_version, $this->version) : sprintf(lang('error_installing'), $this->version);
         $this->subtitle = lang('stopped');
     }
     // Only show steps during upgrades
     if ($this->is_installed) {
         $suffix = sprintf(lang('subtitle_step'), $this->current_step, $this->steps);
         $this->subtitle .= empty($this->subtitle) ? $suffix : ' <span class="faded">|</span> ' . $suffix;
     }
     $javascript_basepath = $this->set_path('themes/ee/asset/javascript/');
     $javascript_dir = is_dir($javascript_basepath . 'src/') ? 'src/' : 'compressed/';
     $version = explode('.', $this->version, 2);
     $data = array('title' => $this->title, 'header' => $this->header, 'subtitle' => $this->subtitle, 'refresh' => $this->refresh, 'refresh_url' => $this->refresh_url, 'ajax_progress' => ee()->input->get('ajax_progress') == 'yes', 'image_path' => $this->image_path, 'javascript_path' => $javascript_basepath . $javascript_dir, 'version' => $this->version, 'version_major' => $version[0], 'version_minor' => $version[1], 'installed_version' => $this->installed_version, 'next_version' => substr($this->next_update, 0, 1) . '.' . substr($this->next_update, 1, 1) . '.' . substr($this->next_update, 2, 1), 'languages' => $this->languages, 'theme_url' => $this->set_path('themes'), 'is_core' => IS_CORE ? 'Core' : '', 'action' => '', 'method' => 'post');
     if ($this->is_installed) {
         // for some reason 'charset' is not set in this context and will throw a PHP warning
         $msm_config = new MSM_Config();
         $msm_config->default_ini['charset'] = 'UTF-8';
         $msm_config->site_prefs('');
         $data['theme_url'] = $msm_config->item('theme_folder_url');
         $data['javascript_path'] = $data['theme_url'] . 'ee/asset/javascript/' . $javascript_dir;
     }
     $data = array_merge($data, $template_variables);
     ee()->load->helper('language');
     ee()->load->view('container', array_merge(array('content' => ee()->load->view($view, $data, TRUE)), $data));
 }
Exemplo n.º 2
0
 /**
  * CP themeing is no longer supported, so remove the cp_theme config items
  */
 private function _remove_cp_theme_config()
 {
     $msm_config = new MSM_Config();
     $msm_config->remove_config_item(array('cp_theme'));
     ee()->smartforge->drop_column('members', 'cp_theme');
 }
Exemplo n.º 3
0
 /**
  * Change all date formatting columns to show full years
  * @return void
  */
 private function _date_format_years()
 {
     // Update members' date formats
     ee()->db->update('members', array('date_format' => '%n/%j/%Y'), array('date_format' => '%n/%j/%y'));
     ee()->db->update('members', array('date_format' => '%j/%n/%Y'), array('date_format' => '%j-%n-%y'));
     // Update the site preferences
     $sites = ee()->db->select('site_id')->get('sites');
     $msm_config = new MSM_Config();
     if ($sites->num_rows() > 0) {
         foreach ($sites->result_array() as $row) {
             $msm_config->site_prefs('', $row['site_id']);
             $localization_preferences = array();
             if ($msm_config->item('date_format') == '%n/%j/%y') {
                 $localization_preferences['date_format'] = '%n/%j/%y';
             } elseif ($msm_config->item('date_format') == '%j-%n-%y') {
                 $localization_preferences['date_format'] = '%j/%n/%Y';
             }
             if (!empty($localization_preferences)) {
                 $msm_config->update_site_prefs($localization_preferences, $row['site_id']);
             }
         }
     }
 }
Exemplo n.º 4
0
 /**
  * Update security hashes table and set new config item.
  *
  */
 private function _convert_xid_to_csrf()
 {
     // Store old setting
     $secure_forms = ee()->config->item('secure_forms');
     // Remove config item from config file
     ee()->config->_update_config(array(), array('secure_forms' => ''));
     // Remove config item from db
     $msm_config = new MSM_Config();
     $msm_config->remove_config_item('secure_forms');
     // If it was no, we need to set it as disabled
     if ($secure_forms == 'n') {
         ee()->config->_update_config(array('disable_csrf_protection' => 'y'));
     }
     // We changed how we access the table, so we'll re-key it to efficiently
     // select on the session id, which is the only column we use now.
     ee()->db->truncate('security_hashes');
     ee()->smartforge->drop_column('security_hashes', 'used');
     ee()->smartforge->drop_key('security_hashes', 'hash');
     ee()->smartforge->add_key('security_hashes', 'session_id');
 }
Exemplo n.º 5
0
 /**
  * Populates the new prv_msg_enabled and prv_msg_allow_attachments settings,
  * defaulted to yes
  */
 public function _add_new_private_messages_options()
 {
     $msm_config = new MSM_Config();
     $msm_config->update_site_prefs(array('prv_msg_enabled' => 'y', 'prv_msg_allow_attachments' => 'y'), 'all');
 }