예제 #1
0
 function plgSystemCCK(&$subject, $config)
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         JFactory::getLanguage()->load('lib_cck', JPATH_SITE);
         if (file_exists(JPATH_SITE . '/plugins/cck_storage_location/joomla_user_note/joomla_user_note.php')) {
             $this->content_objects['joomla_user_note'] = 1;
         }
     }
     jimport('joomla.filesystem.file');
     jimport('cck.base.cck');
     // deprecated
     // Content
     jimport('cck.content.article');
     //jimport( 'cck.content.category' );
     jimport('cck.content.content');
     jimport('cck.content.user');
     // Development
     jimport('cck.development.database');
     // deprecated
     $this->multisite = JCck::_setMultisite();
     if ($this->multisite === true) {
         $this->site = null;
         $this->site_cfg = new JRegistry();
         if (JCck::isSite()) {
             $this->site = JCck::getSite();
             $this->site_cfg->loadString($this->site->configuration);
             if ($app->isSite() && $this->site) {
                 // --- Redirect to Homepage
                 $homepage = $this->site_cfg->get('homepage', 0);
                 if ($homepage > 0) {
                     $current = JUri::current(true);
                     $len = strlen($current);
                     if ($current[$len - 1] == '/') {
                         $current = substr($current, 0, -1);
                     }
                     $current = str_replace(array('http://', 'https://'), '', $current);
                     if ($current == $this->site->host) {
                         $redirect_url = JRoute::_('index.php?Itemid=' . $homepage);
                         if ($redirect_url != JUri::root(true) . '/') {
                             JFactory::getApplication()->redirect($redirect_url);
                         }
                     }
                 }
                 // ---
                 $tag = $this->site_cfg->get('language');
                 if ($tag) {
                     JFactory::getConfig()->set('language', $tag);
                     JFactory::getLanguage()->setLanguage($tag);
                 }
             }
         }
     }
     parent::__construct($subject, $config);
 }