public static function onCCK_Storage_LocationAfterDispatch(&$data, $uri = array()) { $return = '&return_o=' . substr($uri['option'], 4); if (!$uri['layout']) { $do = $data['options']->get('add', 1); $data['options']->set('add_alt_link', 'index.php?option=com_content&view=article&layout=edit&cck=1'); if ($do == 1) { JCckDevIntegration::addModalBox($data['options']->get('add_layout', 'icon'), $return, $data['options']); } elseif ($do == 2) { JCckDevIntegration::addDropdown('form', $return, $data['options']); } JCckDevIntegration::addWarning('copy'); } elseif ($uri['layout'] == 'edit' && !$uri['id']) { if ($data['options']->get('add_redirect', 1)) { JCckDevIntegration::redirect($data['options']->get('default_type'), $return); } } elseif ($uri['layout'] == 'edit' && $uri['id']) { // $isCck = JCckDatabase::loadResult( 'SELECT cck FROM #__cck_core WHERE storage_location="'.self::$type.'" AND pk='.(int)$uri['id'] ); // if ( $data['options']->get( 'edit_redirect', 0 ) || $isCck ) { // redirect // } } }
public static function onCCK_Storage_LocationAfterDispatch(&$data, $uri = array()) { $return = '&return_o=' . substr($uri['option'], 4) . '&return_v=' . $uri['view']; if (!$uri['layout']) { if ($uri['view'] != 'users') { return; } $do = $data['options']->get('add', 1); $data['options']->set('add_alt_link', 'index.php?option=com_users&view=user&layout=edit&cck=1'); if ($do == 1) { JCckDevIntegration::addModalBox($data['options']->get('add_layout', 'icon'), $return, $data['options']); } elseif ($do == 2) { JCckDevIntegration::addDropdown('form', $return, $data['options']); } } elseif ($uri['layout'] == 'edit' && !$uri['id']) { if ($uri['view'] != 'user') { return; } if ($data['options']->get('add_redirect', 1)) { JCckDevIntegration::redirect($data['options']->get('default_type'), $return . 's'); } } }
public static function onCCK_Storage_LocationAfterDispatch(&$data, $uri = array()) { $app = JFactory::getApplication(); $ext = $app->input->get('extension', ''); $exclude = $data['options']->get('exclude', ''); $extensions = explode(',', str_replace(' ', '', $exclude)); $return = '&extension=' . $ext . '&return_o=' . substr($uri['option'], 4); if (!in_array($ext, $extensions)) { if (!$uri['layout']) { $do = $data['options']->get('add', 1); $data['options']->set('add_alt_link', 'index.php?option=com_categories&view=category&layout=edit&extension=' . $ext . '&cck=1'); if ($do == 1) { JCckDevIntegration::addModalBox($data['options']->get('add_layout', 'icon'), $return, $data['options']); } elseif ($do == 2) { JCckDevIntegration::addDropdown('form', $return, $data['options']); } JCckDevIntegration::addWarning('copy'); } elseif ($uri['layout'] == 'edit' && !$uri['id']) { if ($data['options']->get('add_redirect', 1)) { JCckDevIntegration::redirect($data['options']->get('default_type'), $return); } } } }
public function onAfterDispatch() { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $id = $app->input->getInt('id', 0); $option = $app->input->get('option', ''); $view = $app->input->get('view', ''); $layout = $app->input->get('layout', ''); if ($app->isAdmin()) { switch ($option) { case 'com_cck': if (!JCck::on() && $view == 'sites') { JCckDevIntegration::addDropdown($view); } break; case 'com_config': $com = $app->input->get('component', ''); if ($com == 'com_cck' || $com == 'com_cck_developer' || $com == 'com_cck_ecommerce' || $com == 'com_cck_exporter' || $com == 'com_cck_importer' || $com == 'com_cck_manager' || $com == 'com_cck_multilingual' || $com == 'com_cck_packager' || $com == 'com_cck_toolbox' || $com == 'com_cck_updater' || $com == 'com_cck_webservices') { JHtml::_('stylesheet', 'administrator/components/com_cck/assets/css/ui-big.css', array(), false); JCck::loadjQuery(true, true, true); } break; case 'com_menus': if ($layout || $view == 'item') { JHtml::_('stylesheet', 'administrator/components/com_cck/assets/css/ui-big.css', array(), false); } break; case 'com_modules': if ($layout) { JHtml::_('stylesheet', 'administrator/components/com_cck/assets/css/ui-big.css', array(), false); } break; case 'com_postinstall': $doc->addStyleDeclaration('fieldset{padding-bottom:18px;} fieldset > legend{margin-bottom:0;}'); break; case 'com_plugins': if ($layout) { JHtml::_('stylesheet', 'administrator/components/com_cck/assets/css/ui-big.css', array(), false); } break; default: $locations = JCckDatabase::loadObjectList('SELECT a.name, a.options FROM #__cck_core_objects AS a WHERE a.component = "' . $option . '"'); $uri = array('option' => $option, 'view' => $view, 'layout' => $layout, 'id' => $id); if (count($locations)) { foreach ($locations as $location) { $path = JPATH_SITE . '/plugins/cck_storage_location/' . $location->name . '/classes/integration.php'; if (is_file($path)) { $data = array('options' => new JRegistry($location->options)); require_once $path; JCck::callFunc_Array('plgCCK_Storage_Location' . $location->name . '_Integration', 'onCCK_Storage_LocationAfterDispatch', array(&$data, $uri)); } } } break; } } elseif ($app->isSite()) { if (!JCck::getConfig_Param('sef_canonical', 0) && !isset($app->cck_canonical) && JCck::on() && isset($doc->_links) && count($doc->_links)) { foreach ($doc->_links as $k => $link) { if ($link['relation'] == 'canonical') { unset($doc->_links[$k]); break; } } } $itemId = $app->input->getInt('Itemid', 0); $user = JFactory::getUser(); if ($this->multisite === true) { $site_title = $this->site_cfg->get('sitename', ''); $site_pages = $this->site_cfg->get('sitename_pagetitles', 0); $site_desc = $this->site_cfg->get('metadesc', ''); $site_keys = $this->site_cfg->get('metakeys', ''); $meta_desc = $doc->getMetaData('description'); $meta_keys = $doc->getMetaData('keywords'); if ($site_pages) { $title = $site_pages == 2 ? $doc->getTitle() . ' - ' . $site_title : $site_title . ' - ' . $doc->getTitle(); $doc->setTitle($title); } if ($site_desc && (!$meta_desc || $meta_desc == $app->getCfg('MetaDesc'))) { $doc->setMetaData('description', $site_desc); } if ($site_keys && (!$meta_keys || $meta_keys == $app->getCfg('MetaKeys'))) { $doc->setMetaData('keywords', $site_keys); } if ($this->site_cfg->get('offline') && !$user->authorise('core.login.offline')) { $template = JCckDatabase::loadObject('SELECT template, params FROM #__template_styles WHERE template = "' . $app->getTemplate() . '"'); $params = array('directory' => JPATH_THEMES, 'file' => 'offline.php', 'params' => $template->params, 'template' => $template->template); $doc->parse($params); $this->offline_buffer = $doc->render(false, $params); } elseif ($this->site_cfg->get('set_template_style', false)) { $menu = $app->getMenu(); if (is_object($menu)) { $style = $menu->getActive()->template_style_id; if ($style) { $this->_setTemplateStyle($style); } } } } if ($option == 'com_users') { $options = JCckDatabase::loadResult('SELECT a.options FROM #__cck_core_objects AS a WHERE a.name = "joomla_user"'); $options = new JRegistry($options); $itemId = $app->input->getInt('Itemid', 0); if ($options->get('registration', 1)) { if ($view == 'profile') { $user = JFactory::getUser(); $userid = $user->get('id'); if (!$userid) { return; } if ($layout == 'edit') { $type = JCckDatabase::loadResult('SELECT cck FROM #__cck_core WHERE storage_location="joomla_user" AND pk=' . (int) $userid); if (!$type) { return; } $url = 'index.php?option=com_cck&view=form&layout=edit&type=' . $type . '&id=' . $userid . '&Itemid=' . $itemId; } else { require_once JPATH_SITE . '/plugins/cck_storage_location/joomla_user/joomla_user.php'; $sef = 0; $itemId2 = $options->get('profile_itemid', 0); if ($itemId2) { $link = JCckDatabase::loadResult('SELECT link FROM #__menu WHERE id = ' . (int) $itemId2); if (strpos($link, 'index.php?option=com_cck&view=list') !== false) { $search = str_replace('index.php?option=com_cck&view=list&search=', '', $link); $search = substr($search, 0, strpos($search, '&')); $search = JCckDatabase::loadResult('SELECT options FROM #__cck_core_searchs WHERE name = "' . $search . '"'); if ($search != '') { $search = new JRegistry($search); $sef = $search->get('sef', JCck::getConfig_Param('sef', '2')); if ($sef) { $itemId = $itemId2; } } } } $url = plgCCK_Storage_LocationJoomla_User::getRoute($userid, $sef, $itemId); } if ($url != '') { $app->redirect($url); } } elseif ($view == 'registration') { $type = $options->get('default_type', 'user'); if (!$type) { return; } $url = 'index.php?option=com_cck&view=form&layout=edit&type=' . $type . '&Itemid=' . $itemId; $app->redirect($url); } } } if ($option == 'com_content' && $view == 'form' && $layout == 'edit') { $itemId = $app->input->getInt('Itemid', 0); $aid = $app->input->getInt('a_id', 0); $return = $app->input->getBase64('return'); if (!$aid) { return; } $type = JCckDatabase::loadResult('SELECT cck FROM #__cck_core WHERE storage_location="joomla_article" AND pk=' . (int) $aid); if (!$type) { return; } $url = 'index.php?option=com_cck&view=form&layout=edit&type=' . $type . '&id=' . $aid . '&Itemid=' . $itemId . '&return=' . $return; $app->redirect($url); } $css_def = JCck::getConfig_Param('site_css_def', ''); $css = JCck::getConfig_Param('site_css', ''); $js = JCck::getConfig_Param('site_js', ''); if ($css_def == 'custom') { $custom = JCck::getConfig_Param('site_css_def_custom', ''); if (is_array($custom) && count($custom)) { $css_def = implode('-', $custom); $css_def = $css_def == 'base-spacing-writing' ? 'all' : $css_def; $doc->addStyleSheet(JURI::root(true) . '/media/cck/css/definitions/' . $css_def . '.css'); } } elseif ($css_def) { $doc->addStyleSheet(JURI::root(true) . '/media/cck/css/definitions/' . $css_def . '.css'); } if ($css != '') { $doc->addStyleDeclaration($css); } if ($js != '') { JCck::loadjQuery(true, false, false); $doc->addScriptDeclaration('jQuery(document).ready(function($){' . $js . '});'); } } }