public function save($key = null, $urlVar = null) { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $model = $this->getModel('form'); $preconfig = $app->input->post->get('config', array(), 'array'); $task = $this->getTask(); $config = $model->store($preconfig); $id = $config['pk']; if ($config['validate'] == 'retry') { parent::display(); return true; } if ($id) { if ($config['stage'] > -1) { $link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery(); if ($config['stage'] > 0) { $link .= '&stage=' . $config['stage']; } $this->setRedirect(htmlspecialchars_decode($link)); return; } if ($config['message_style']) { if (isset($config['message'])) { $msg = $config['doTranslation'] ? JText::_('COM_CCK_' . str_replace(' ', '_', trim($config['message']))) : $config['message']; } else { $msg = JText::_('COM_CCK_SUCCESSFULLY_SAVED'); } $msgType = $config['message_style']; } else { $msg = ''; $msgType = ''; } } else { $msg = JText::_('JERROR_AN_ERROR_HAS_OCCURRED'); $msgType = 'error'; } switch ($task) { case 'apply': $link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery(); break; case 'save2new': $link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . $this->_getRedirectQuery(); break; case 'save2view': $location = JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core WHERE id = ' . (int) $id); $sef = 0; $itemId2 = 0; if ($location) { require_once JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/' . $location . '.php'; $link = JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'getRoute', array($config['pk'], $sef, $itemId2, array('type' => $config['type']))); $link = str_replace('/administrator/', '/', $link); break; } default: $link = $this->_getRedirectQuery(true); break; } $this->setRedirect(htmlspecialchars_decode($link), $msg, $msgType); }
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false) { if (self::$type != $field->type) { return; } self::$path = parent::g_getPath(self::$type . '/'); parent::g_onCCK_FieldPrepareForm($field, $config); // Init if (count($inherit)) { $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name; $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name; } else { $id = $field->name; $name = $field->name; } $value = $value != '' ? $value : $field->defaultvalue; $value = $value != ' ' ? $value : ''; // Validate $validate = ''; if ($config['doValidation'] > 1) { plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config); $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : ''; } // Prepare $assoc = JCckDevHelper::hasLanguageAssociations(); $form = ''; if ($assoc && $config['pk']) { if (isset($config['base']->location) && $config['base']->location) { $location = $config['base']->location; } else { $location = JCckdatabase::loadResult('SELECT storage_location FROM #__cck_core_types WHERE name = "' . $config['type'] . '"'); } if (is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/classes/helper.php')) { require_once JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/classes/helper.php'; $form = JCck::callFunc_Array('plgCCK_Storage_Location' . $location . '_Helper', 'getAssociationsForm', array($id, $name, $config)); } } // Set if (!$field->variation) { $field->form = $form; if ($field->script) { parent::g_addScriptDeclaration($field->script); } } else { // } $field->value = $value; // Return if ($return === true) { return $field; } }
function CckParseRoute($segments) { $app = JFactory::getApplication(); $count = count($segments); $menu = $app->getMenu(); $menuItem = $menu->getActive(); $vars = array(); if ($segments[0] == 'form') { $menu->setActive($app->input->getInt('Itemid', 0)); $vars['option'] = 'com_cck'; $vars['view'] = 'form'; $vars['layout'] = 'edit'; $vars['type'] = $segments[1]; } else { $legacy = 0; // check later if (!($menuItem->query['option'] == 'com_cck' && $menuItem->query['view'] == 'list')) { $legacy = 0; } if (!$legacy) { if (isset($menuItem->query['search'])) { $params = JCckDevHelper::getRouteParams($menuItem->query['search']); } if (isset($params['location']) && $params['location'] && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php')) { require_once JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php'; JCck::callFunc_Array('plgCCK_Storage_Location' . $params['location'], 'parseRoute', array(&$vars, $segments, $count, $params)); } else { $legacy = 1; } } if ($legacy) { if ($count == 2) { $vars['option'] = 'com_content'; $vars['view'] = 'article'; $vars['catid'] = $segments[0]; $vars['id'] = $segments[1]; } elseif ($count == 1) { $vars['option'] = 'com_content'; @(list($id, $alias) = explode(':', $segments[0], 2)); $category = JCategories::getInstance('Content')->get($id); if ($category && $category->id == $id && $category->alias == $alias) { $vars['view'] = 'categories'; } else { $vars['view'] = 'article'; } $vars['id'] = $segments[0]; } } } return $vars; }
public function renderField($fieldname = '', $options = NULL) { $html = ''; $field = $this->get($fieldname); if (!$field) { return $html; } if ($field->display) { $html = JCck::callFunc_Array('plgCCK_Field' . $field->type, $this->methodRender, array($field, &$this->config)); if ($field->display > 1 && $html) { if (!$options) { $options = new JRegistry(); } if ($this->markup) { $call = $this->markup; $html = $call($this, $html, $field, $options); } else { $style = ''; if ($this->methodRender == 'onCCK_FieldRenderForm' && @$field->conditional) { $conditions = explode(',', $field->conditional); $field->conditional_options = str_replace('#form#', '#' . $field->name, $field->conditional_options); if (count($conditions) > 1) { $this->addJS('$j("#' . $this->id . '_' . $fieldname . '").conditionalStates(' . $field->conditional_options . ');'); } else { $this->addJS('$j("#' . $this->id . '_' . $fieldname . '").conditionalState(' . $field->conditional_options . ');'); } } $desc = ''; if ($this->getStyleParam('field_description', 0)) { $desc = $field->description != '' ? '<div id="' . $this->id . '_desc_' . $fieldname . '" class="cck_desc cck_desc_' . $field->type . '">' . $field->description . '</div>' : ''; } $label = ''; if ($options->get('field_label', $this->getStyleParam('field_label', 1))) { $label = $this->getLabel($fieldname, true, $field->required ? '*' : ''); $label = $label != '' ? '<div id="' . $this->id . '_label_' . $fieldname . '" class="cck_label cck_label_' . $field->type . '">' . $label . '</div>' : ''; } } } } return $html; }
function delete($pks = array()) { JPluginHelper::importPlugin('content'); JPluginHelper::importPlugin('cck_storage_location'); $nb = 0; $pks_in = implode(',', $pks); $items = JCckDatabase::loadObjectList('SELECT a.id, a.cck, a.pk, a.pkb, a.storage_location, a.storage_table, a.author_id, b.id as type_id FROM #__cck_core as a' . ' LEFT JOIN #__cck_core_types AS b ON b.name = a.cck' . ' WHERE a.id IN (' . $pks_in . ')', 'id'); $config = array('author' => 0, 'type' => '', 'type_id' => 0); foreach ($pks as $pk) { $location = $items[$pk]->storage_location; if ($location) { $config['author'] = $items[$pk]->author_id; $config['type'] = $items[$pk]->cck; $config['type_id'] = $items[$pk]->type_id; if (JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'onCCK_Storage_LocationDelete', array($items[$pk]->pk, &$config))) { $nb++; } } } return $nb; }
public function saveOrder($pks = array(), $lft = array()) { JPluginHelper::importPlugin('cck_storage_location'); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id, pk, storage_location')->from('#__cck_core')->where('id IN (' . implode(',', $pks) . ')'); $db->setQuery($query); $results = $db->loadAssocList('id'); if (!empty($results)) { $ids = array(); $location = null; foreach ($pks as $pk) { $ids[] = $results[$pk]['pk']; if (null === $location) { $location = $results[$pk]['storage_location']; } } return JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'onCCK_Storage_LocationSaveOrder', array($ids, $lft)); } return false; }
public function save() { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $model = $this->getModel('form'); $preconfig = $app->input->post->get('config', array(), 'array'); $task = $this->getTask(); $config = $model->store($preconfig, $task); $id = $config['pk']; $itemId = $preconfig['itemId']; if ($config['validate'] == 'retry') { if ($app->input->get('option', '') == 'com_cck') { $view = $app->input->get('view', ''); if ($view == 'list') { $app->input->set('task', 'search'); $app->input->set('retry', $config['type']); parent::display(); return false; } elseif ($view == 'form') { $app->input->set('retry', $config['type']); parent::display(); return false; } } } if ($id) { if ($config['message_style']) { if (isset($config['message'])) { $msg = $config['doTranslation'] ? JText::_('COM_CCK_' . str_replace(' ', '_', trim($config['message']))) : $config['message']; } else { $msg = JText::_('COM_CCK_SUCCESSFULLY_SAVED'); } $msgType = $config['message_style']; } else { $msg = ''; $msgType = ''; } if ($config['stage'] > -1 && $task != 'save2skip') { if ($config['url']) { $link = $config['url']; } elseif (!(isset($preconfig['skip']) && $preconfig['skip'] == '1')) { $link = 'index.php?option=com_cck&view=form&layout=edit&type=' . $config['type'] . '&id=' . $id; if ($itemId > 0) { $link .= '&Itemid=' . $itemId; } if ($config['stage'] > 0) { $link .= '&stage=' . $config['stage']; } $link = JRoute::_($link); } if ($link != '') { if ($msg != '') { $this->setRedirect(htmlspecialchars_decode($link), $msg, $msgType); } else { $this->setRedirect(htmlspecialchars_decode($link)); } return; } } } else { $msg = JText::_('JERROR_AN_ERROR_HAS_OCCURRED'); $msgType = 'error'; } $link = $this->_getReturnPage(false); $redirect = $config['options']['redirection']; $return = ''; if ($task == 'apply' || $task == 'save2copy') { $link = ''; $redirect = 'form_edition'; $return = $app->input->getBase64('return'); } elseif ($task == 'save2new') { $link = ''; $redirect = 'form'; $return = $app->input->getBase64('return'); } elseif ($task == 'save2view') { $link = ''; $redirect = 'content'; } elseif ($task == 'save2redirect') { $link = ''; $redirect = ''; } if (!$link) { switch ($redirect) { case 'content': $loc = JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core WHERE id = ' . (int) $config['id']); $sef = 0; $itemId2 = isset($config['options']['redirection_itemid']) && $config['options']['redirection_itemid'] ? (int) $config['options']['redirection_itemid'] : $itemId; if ($itemId2 > 0) { $target = JCckDatabase::loadResult('SELECT link FROM #__menu WHERE id = ' . (int) $itemId2); if ($target) { $vars = explode('&', $target); foreach ($vars as $var) { $v = explode('=', $var); if ($v[0] == 'search') { $target = $v[1]; break; } } $vars = JCckDatabase::loadResult('SELECT options FROM #__cck_core_searchs WHERE name = "' . (string) $target . '"'); if ($vars) { $vars = new JRegistry($vars); $sef = $vars->get('sef', JCck::getConfig_Param('sef', '2')); } } } if ($loc) { require_once JPATH_SITE . '/plugins/cck_storage_location/' . $loc . '/' . $loc . '.php'; $link = JCck::callFunc_Array('plgCCK_Storage_Location' . $loc, 'getRoute', array($config['pk'], $sef, $itemId2, array('type' => $config['type']))); } else { $link = JUri::root(); } break; case 'form': $link = 'index.php?option=com_cck&view=form&layout=edit&type=' . $config['type']; if ($itemId > 0) { $link .= '&Itemid=' . $itemId; } if ($return != '') { $link .= '&return=' . $return; } $link = JRoute::_($link); break; case 'form_edition': $link = 'index.php?option=com_cck&view=form&layout=edit&type=' . $config['type'] . '&id=' . $id; if ($itemId > 0) { $link .= '&Itemid=' . $itemId; } if ($return != '') { $link .= '&return=' . $return; } $link = JRoute::_($link); break; case 'url': $link = JRoute::_($config['options']['redirection_url']); break; default: $link = $config['url'] ? $config['url'] : JUri::root(); break; } } if ($id) { $char = strpos($link, '?') > 0 ? '&' : '?'; if (isset($config['thanks'])) { if (!empty($config['thanks'])) { $thanks = @$config['thanks']->name ? $config['thanks']->name : 'thanks'; $thanks_value = @$config['thanks']->value ? $config['thanks']->value : $preconfig['type']; $link .= $char . $thanks . '=' . $thanks_value; } } else { $link .= $char . 'thanks=' . $preconfig['type']; } } if ($msg != '') { $this->setRedirect(htmlspecialchars_decode($link), $msg, $msgType); } else { $this->setRedirect(htmlspecialchars_decode($link)); } }
protected function _render($context, &$article, $tpl, $contentType, $fields, $property, $client, $cck, $parent_type) { $app = JFactory::getApplication(); $dispatcher = JDispatcher::getInstance(); $user = JFactory::getUser(); $params = array('template' => $tpl['folder'], 'file' => 'index.php', 'directory' => $tpl['root']); $lang = JFactory::getLanguage(); $lang->load('com_cck_default', JPATH_SITE); JPluginHelper::importPlugin('cck_field'); JPluginHelper::importPlugin('cck_field_link'); JPluginHelper::importPlugin('cck_field_restriction'); $p_sef = isset($this->loaded[$contentType . '_' . $client . '_options']['sef']) ? $this->loaded[$contentType . '_' . $client . '_options']['sef'] : JCck::getConfig_Param('sef', '2'); $p_title = isset($this->loaded[$contentType . '_' . $client . '_options']['title']) ? $this->loaded[$contentType . '_' . $client . '_options']['title'] : ''; $p_typo = isset($this->loaded[$contentType . '_' . $client . '_options']['typo']) ? $this->loaded[$contentType . '_' . $client . '_options']['typo'] : 1; if ($p_typo) { JPluginHelper::importPlugin('cck_field_typo'); } jimport('cck.rendering.document.document'); $doc = CCK_Document::getInstance('html'); $positions = array(); if ($parent_type != '') { $w_type = '(b.name = "' . $contentType . '" OR b.name = "' . $parent_type . '")'; } else { $w_type = 'b.name = "' . $contentType . '"'; } if ($client == 'intro') { $positions_more = JCckDatabaseCache::loadObjectList('SELECT * FROM #__cck_core_type_position AS a LEFT JOIN #__cck_core_types AS b ON b.id = a.typeid' . ' WHERE ' . $w_type . ' AND a.client ="' . $client . '"', 'position'); // todo::improve } else { $positions_more = JCckDatabase::loadObjectList('SELECT * FROM #__cck_core_type_position AS a LEFT JOIN #__cck_core_types AS b ON b.id = a.typeid' . ' WHERE ' . $w_type . ' AND a.client ="' . $client . '"', 'position'); // todo::improve } // Fields if (count($fields)) { JPluginHelper::importPlugin('cck_storage'); $config = array('author' => 0, 'client' => $client, 'doSEF' => $p_sef, 'doTranslation' => JCck::getConfig_Param('language_jtext', 0), 'doTypo' => $p_typo, 'error' => 0, 'fields' => array(), 'id' => $cck->id, 'isNew' => 0, 'Itemid' => $app->input->getInt('Itemid', 0), 'location' => $cck->storage_location, 'pk' => $article->id, 'pkb' => $cck->pkb, 'storages' => array(), 'store_id' => (int) $cck->store_id, 'type' => $cck->cck, 'type_id' => (int) $cck->type_id, 'type_alias' => $cck->type_alias ? $cck->type_alias : $cck->cck); foreach ($fields as $field) { $field->typo_target = 'value'; $fieldName = $field->name; $value = ''; $name = !empty($field->storage_field2) ? $field->storage_field2 : $fieldName; //- if ($fieldName) { $Pt = $field->storage_table; if ($Pt && !isset($config['storages'][$Pt])) { $config['storages'][$Pt] = ''; $dispatcher->trigger('onCCK_Storage_LocationPrepareContent', array(&$field, &$config['storages'][$Pt], $config['pk'], &$config, &$article)); } $dispatcher->trigger('onCCK_StoragePrepareContent', array(&$field, &$value, &$config['storages'][$Pt])); if (is_string($value)) { $value = trim($value); } if ($p_title != '' && $p_title == $field->name) { $this->title = $value; } $hasLink = $field->link != '' ? 1 : 0; $dispatcher->trigger('onCCK_FieldPrepareContent', array(&$field, $value, &$config)); $target = $field->typo_target; if ($hasLink) { $dispatcher->trigger('onCCK_Field_LinkPrepareContent', array(&$field, &$config)); if ($field->link) { JCckPluginLink::g_setHtml($field, $target); } } if (@$field->typo && ($field->{$target} !== '' || $field->typo_label == -2) && $p_typo) { $dispatcher->trigger('onCCK_Field_TypoPrepareContent', array(&$field, $field->typo_target, &$config)); } else { $field->typo = ''; } $position = $field->position; $positions[$position][] = $fieldName; // Was it the last one? if ($config['error']) { break; } } } // Merge if (count($config['fields'])) { $fields = array_merge($fields, $config['fields']); // Test: a loop may be faster. $config['fields'] = NULL; unset($config['fields']); } } // BeforeRender if (isset($config['process']['beforeRenderContent']) && count($config['process']['beforeRenderContent'])) { foreach ($config['process']['beforeRenderContent'] as $process) { if ($process->type) { JCck::callFunc_Array('plg' . $process->group . $process->type, 'on' . $process->group . 'BeforeRenderContent', array($process->params, &$fields, &$config['storages'], &$config)); } } } // Finalize $doc->fields =& $fields; $infos = array('context' => $context, 'params' => $tpl['params'], 'path' => $tpl['path'], 'root' => JURI::root(true), 'template' => $tpl['folder'], 'theme' => $tpl['home']); $doc->finalize('content', $contentType, $client, $positions, $positions_more, $infos, $cck->id); $data = $doc->render(false, $params); $article->{$property} = str_replace($article->{$property}, $data, $article->{$property}); }
public static function renderContent($field, $value = '', &$config = array('doTranslation' => 1, 'doValidation' => 2)) { if (!is_object($field)) { $field = JCckDatabase::loadObject('SELECT a.* FROM #__cck_core_fields AS a WHERE a.name = "' . $field . '"'); //# if (!$field) { return; } } $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onCCK_FieldPrepareContent', array(&$field, $value, &$config)); return JCck::callFunc_Array('plgCCK_Field' . $field->type, 'onCCK_FieldRenderContent', array($field, &$config)); }
public function delete() { if ($this->_object == '') { return false; } if (!($this->_id && $this->_pk)) { return false; } $config = array('author' => $this->_instance_core->author_id, 'type' => $this->_instance_core->cck, 'type_id' => 0); $nb = 0; if ($config['type']) { $config['type_id'] = JCckDatabaseCache::loadResult('SELECT id FROM #__cck_core_types WHERE name = "' . $config['type'] . '"'); } if (!$config['type_id']) { return false; } JPluginHelper::importPlugin('content'); if (JCck::callFunc_Array('plgCCK_Storage_Location' . $this->_object, 'onCCK_Storage_LocationDelete', array($this->_pk, &$config))) { $nb++; } return $nb ? true : false; }
public function download() { $app = JFactory::getApplication(); $id = $app->input->getInt('id', 0); $fieldname = $app->input->getString('file', ''); $collection = $app->input->getString('collection', ''); $xi = $app->input->getString('xi', 0); $client = $app->input->getString('client', 'content'); $restricted = ''; $user = JFactory::getUser(); if (!$id) { $file = $fieldname; $path = JPATH_ROOT . '/' . $file; $paths = JCck::getConfig_Param('media_paths', ''); if ($paths != '') { $allowed = false; $paths = strtr($paths, array("\r\n" => '<br />', "\r" => '<br />', "\n" => '<br />')); $paths = explode('<br />', $paths); if (count($paths)) { $paths[] = 'tmp/'; foreach ($paths as $p) { if (strpos($path, JPATH_ROOT . '/' . $p) !== false) { $allowed = true; break; } } } if (!$allowed) { $this->setRedirect(JUri::root(), JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error"); return; } } elseif (strpos($path, JPATH_ROOT . '/tmp/') === false) { $this->setRedirect(JUri::base(), JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error"); return; } } else { $field = JCckDatabase::loadObject('SELECT a.* FROM #__cck_core_fields AS a WHERE a.name="' . ($collection != '' ? $collection : $fieldname) . '"'); //# $query = 'SELECT a.pk, a.author_id, a.cck as type, b.' . $field->storage_field . ' as value FROM #__cck_core AS a LEFT JOIN ' . $field->storage_table . ' AS b on b.id = a.pk WHERE a.id =' . (int) $id; $core = JCckDatabase::loadObject($query); switch ($field->storage) { //todo: call plugins! case 'custom': if ($collection != '') { $regex = CCK_Content::getRegex_Group($fieldname, $collection, $xi); preg_match($regex, $core->value, $matches); $value = $matches[1]; } else { $regex = CCK_Content::getRegex_Field($fieldname); preg_match($regex, $core->value, $matches); $value = $matches[1]; } break; case 'standard': default: $value = $core->value; break; } // Access // $current = JSite::getMenu()->getActive()->id; $clients = JCckDatabase::loadObjectList('SELECT a.fieldid, a.client, a.access, a.restriction, a.restriction_options FROM #__cck_core_type_field AS a LEFT JOIN #__cck_core_types AS b ON b.id = a.typeid' . ' WHERE a.fieldid = ' . (int) $field->id . ' AND b.name="' . (string) $core->type . '"', 'client'); $access = isset($clients[$client]->access) ? (int) $clients[$client]->access : 0; $autorised = $user->getAuthorisedViewLevels(); $restricted = isset($clients[$client]->restriction) ? $clients[$client]->restriction : ''; if (!($access > 0 && array_search($access, $autorised) !== false)) { $this->setRedirect('index.php', JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error"); return; } JPluginHelper::importPlugin('cck_field'); $dispatcher = JDispatcher::getInstance(); $config = array('client' => $client, 'id' => id, 'pk' => $core->pk, 'pkb' => 0); $field = JCckDatabase::loadObject('SELECT a.* FROM #__cck_core_fields AS a WHERE a.name="' . $fieldname . '"'); //# if ($restricted) { JPluginHelper::importPlugin('cck_field_restriction'); $field->restriction = $restricted; $field->restriction_options = $clients[$client]->restriction_options; $allowed = JCck::callFunc_Array('plgCCK_Field_Restriction' . $restricted, 'onCCK_Field_RestrictionPrepareContent', array(&$field, &$config)); if ($allowed !== true) { $this->setRedirect('index.php', JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error"); return; } } $dispatcher->trigger('onCCK_FieldPrepareContent', array(&$field, $value, &$config)); // Path Folder if ($collection != '') { $group_x = JCckDatabase::loadObject('SELECT a.options2 FROM #__cck_core_fields AS a WHERE a.name="' . $fieldname . '"'); $f_opt2 = JCckDev::fromJSON($group_x->options2); } else { $f_opt2 = JCckDev::fromJSON($field->options2); } $file = ''; if (isset($f_opt2['storage_format']) && $f_opt2['storage_format']) { $file .= $f_opt2['path']; $file .= isset($f_opt2['path_user']) && $f_opt2['path_user'] ? $core->author_id . '/' : ''; $file .= isset($f_opt2['path_content']) && $f_opt2['path_content'] ? $core->pk . '/' : ''; } $file .= $field->value; } $path = JPATH_ROOT . '/' . $file; if (is_file($path) && $file) { $size = filesize($path); $ext = strtolower(substr(strrchr($path, '.'), 1)); if ($ext == 'php' || $file == '.htaccess') { return; } $name = substr($path, strrpos($path, '/') + 1, strrpos($path, '.')); if ($path) { set_time_limit(0); @ob_end_clean(); include JPATH_ROOT . '/components/com_cck/download.php'; } } else { $this->setRedirect('index.php', JText::_('COM_CCK_ALERT_FILE_DOESNT_EXIST'), 'error'); } }
public function g_onCCK_FieldPrepareStore_Validation(&$field, $name, &$value, &$config = array()) { if ($config['doValidation'] == 1 || $config['doValidation'] == 3) { if ($field->required) { plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareStore($field, $name, $value, $config); } $validation = $field->validation; if (!$validation) { return; } require_once JPATH_PLUGINS . '/cck_field_validation/' . $validation . '/' . $validation . '.php'; JCck::callFunc_Array('plgCCK_Field_Validation' . $validation, 'onCCK_Field_ValidationPrepareStore', array(&$field, $name, &$value, &$config)); } }
public function saveOrder($pks = array(), $lft = array()) { JPluginHelper::importPlugin('cck_storage_location'); if (!count($pks)) { return false; } $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('a.id, a.pk, a.storage_location, b.id AS type_id')->from('#__cck_core AS a')->join('LEFT', '#__cck_core_types AS b ON b.name = a.cck')->where('a.id IN (' . implode(',', $pks) . ')'); $db->setQuery($query); $results = $db->loadAssocList('id'); if (!empty($results)) { $ids = array(); $location = null; $user = JCck::getUser(); $user_id = $user->get('id'); foreach ($pks as $i => $pk) { $canEdit = $user->authorise('core.edit', 'com_cck.form.' . $results[$pk]['type_id']); $canEditOwn = $user->authorise('core.edit.own', 'com_cck.form.' . $results[$pk]['type_id']); // Check Permissions if (!($canEdit && $canEditOwn || $canEdit && !$canEditOwn && $results[$pk]['author_id'] != $user_id || $canEditOwn && $results[$pk]['author_id'] == $user_id)) { unset($lft[$i]); continue; } $ids[] = $results[$pk]['pk']; if (null === $location) { $location = $results[$pk]['storage_location']; } } if ($location && count($ids)) { return JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'onCCK_Storage_LocationSaveOrder', array($ids, $lft)); } } return false; }
public function renderField($fieldname, $options = NULL) { $field = $this->get($fieldname); $html = ''; if (!$field) { return $html; } if ($field->display) { $html = JCck::callFunc_Array('plgCCK_Field' . $field->type, $this->methodRender, array(&$field, &$this->config)); if ($field->display > 1 && $html != '') { if (!$options) { $options = new JRegistry(); } if ($field->markup == 'none') { if ($this->methodRender == 'onCCK_FieldRenderForm') { // Conditional if ($field->conditional) { $this->setConditionalStates($field); } } // Label $label = ''; if ($options->get('field_label', $this->getStyleParam('field_label', 1))) { $label = $this->getLabel($fieldname, true, $field->required ? '*' : ''); $html = $label . $html; } } elseif ($this->markup) { $call = $this->markup; $html = $call($this, $html, $field, $options); } else { if ($this->methodRender == 'onCCK_FieldRenderForm') { // Computation if (@$field->computation) { $this->setComputationRules($field); } // Conditional if (@$field->conditional) { $this->setConditionalStates($field); } } // Description $desc = ''; if ($this->getStyleParam('field_description', 0)) { if ($field->description != '') { if ($this->getStyleParam('field_description', 0) == 5) { JHtml::_('bootstrap.popover', '.hasPopover', array('container' => 'body', 'html' => true, 'trigger' => 'hover')); $desc = '<div class="hasPopover" data-placement="top" data-animation="false" data-content="' . htmlspecialchars($field->description) . '" title="' . htmlspecialchars($field->label) . '"><span class="icon-help"></span></div>'; } else { $desc = $field->description; } $desc = '<div id="' . $this->id . '_desc_' . $fieldname . '" class="cck_desc cck_desc_' . $field->type . '">' . $desc . '</div>'; } } // Label $label = ''; if ($options->get('field_label', $this->getStyleParam('field_label', 1))) { $label = $this->getLabel($fieldname, true, $field->required ? '*' : ''); $label = $label != '' ? '<div id="' . $this->id . '_label_' . $fieldname . '" class="cck_label cck_label_' . $field->type . '">' . $label . '</div>' : ''; } // Markup $html = '<div id="' . $this->id . '_' . $this->mode_property . '_' . $fieldname . '" class="cck_' . $this->mode_property . ' cck_' . $this->mode_property . '_' . $field->type . @$field->markup_class . '">' . $html . '</div>'; $html = '<div id="' . $this->id . '_' . $fieldname . '" class="cck_' . $this->mode . 's cck_' . $this->client . ' cck_' . $field->type . ' cck_' . $fieldname . '">' . $label . $html . $desc . '</div>'; } } } return $html; }
public function render() { if (isset($this->_params->type)) { return JCck::callFunc_Array('plgCCK_Field' . $this->_params->type, 'onCCK_FieldRender' . $this->_config['mode'], array($this->_params, &$this->_config)); } }
public function parse(&$segments) { $app = JFactory::getApplication(); $count = count($segments); $menu = $app->getMenu(); $menuItem = $menu->getActive(); $vars = array(); if ($segments[0] == 'form') { $menu->setActive($app->input->getInt('Itemid', 0)); $vars['option'] = 'com_cck'; $vars['view'] = 'form'; $vars['layout'] = 'edit'; $vars['type'] = @$segments[1]; } else { $legacy = 0; // check later if (!($menuItem->query['option'] == 'com_cck' && $menuItem->query['view'] == 'list')) { $legacy = 0; } if (!$legacy) { if (isset($menuItem->query['search'])) { $params = JCckDevHelper::getRouteParams($menuItem->query['search']); if ($params['doSEF'][0] == '4' || $params['doSEF'][0] == '5') { if ($count == 1) { if (isset($params['location']) && $params['location'] && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php')) { require_once JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php'; $target = $params['doSEF'][0] == '5' ? 'author_object' : 'parent_object'; $properties = array($target); $properties = JCck::callFunc('plgCCK_Storage_Location' . $params['location'], 'getStaticProperties', $properties); if ($properties[$target] != '') { $params['doSEF'][0] = '2'; $params['location'] = $properties[$target]; } } } } } if (isset($params['location']) && $params['location'] && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php')) { require_once JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php'; JCck::callFunc_Array('plgCCK_Storage_Location' . $params['location'], 'parseRoute', array(&$vars, $segments, $count, $params)); } else { $legacy = 1; } } if ($legacy) { if ($count == 2) { $vars['option'] = 'com_content'; $vars['view'] = 'article'; $vars['catid'] = $segments[0]; $vars['id'] = $segments[1]; } elseif ($count == 1) { $vars['option'] = 'com_content'; $idArray = explode(':', $segments[0], 2); $id = (int) $idArray[0]; $alias = (string) @$idArray[1]; $category = JCategories::getInstance('Content')->get($id); if ($category && $category->id == $id && $category->alias == $alias) { $vars['view'] = 'categories'; } else { $vars['view'] = 'article'; } $vars['id'] = $segments[0]; } } } return $vars; }
$dispatcher->trigger('onCCK_Storage_LocationStore', array($data['_']->location, $data, &$config, $id)); $k++; } } if (!$k) { $config['pk'] = 69; } // AfterStore if (isset($processing['onCckPreAfterStore'])) { foreach ($processing['onCckPreAfterStore'] as $p) { if (is_file(JPATH_SITE . $p->scriptfile)) { include_once JPATH_SITE . $p->scriptfile; /* Variables: $fields, $config, $user */ } } } if (isset($config['process']['afterStore']) && count($config['process']['afterStore'])) { foreach ($config['process']['afterStore'] as $process) { if ($process->type) { JCck::callFunc_Array('plg' . $process->group . $process->type, 'on' . $process->group . 'AfterStore', array($process->params, &$fields, &$config['storages'], &$config)); } } } if (isset($processing['onCckPostAfterStore'])) { foreach ($processing['onCckPostAfterStore'] as $p) { if (is_file(JPATH_SITE . $p->scriptfile)) { include_once JPATH_SITE . $p->scriptfile; /* Variables: $fields, $config, $user */ } } }
public function onAfterRender() { $app = JFactory::getApplication(); $option = $app->input->get('option', ''); $view = $app->input->get('view', ''); $layout = $app->input->get('layout', ''); // site if ($app->isSite()) { if ($this->multisite === true && $this->site_cfg->get('offline') && isset($this->offline_buffer)) { $uri = JFactory::getURI(); $app->setUserState('users.login.form.data', array('return' => (string) $uri)); JResponse::setHeader('Status', '503 Service Temporarily Unavailable', 'true'); JResponse::setBody($this->offline_buffer); } return; } // admin if ($app->isAdmin() && JFactory::getDocument()->getType() == 'html') { $buffer = JResponse::getBody(); $buffer = str_replace('icon-cck-', 'myicon-cck-', $buffer); switch ($option) { case 'com_cck': case 'com_cck_developer': case 'com_cck_ecommerce': case 'com_cck_exporter': case 'com_cck_importer': case 'com_cck_manager': case 'com_cck_multilingual': case 'com_cck_packager': case 'com_cck_toolbox': case 'com_cck_updater': case 'com_cck_webservices': $buffer = $this->_setBasics($buffer, $option, $view); break; case 'com_postinstall': $eid = $app->input->get('eid', 0); $eid2 = JCckDatabase::loadResult('SELECT extension_id FROM #__extensions WHERE type = "component" AND element = "com_cck"'); if ($eid && $eid == $eid2) { $buffer = str_replace('com_cck', 'SEBLOD', $buffer); $buffer = str_replace('option=SEBLOD', 'option=com_cck', $buffer); } break; case 'com_templates': if ($view == 'templates' || $layout == 'edit') { break; } $search = '#administrator/index.php\\?option=com_templates&task=style.edit&id=(.*)">(.*)</a>#sU'; $list = JCckDatabase::loadObjectList('SELECT a.id, b.name FROM #__template_styles AS a LEFT JOIN #__cck_core_templates AS b ON b.name = a.template WHERE b.name != ""', 'id'); preg_match_all($search, $buffer, $matches); if (count($matches[1])) { $i = 0; $style = 'height:14px; color:#ffffff; background-color:#0088CC; margin:0px 12px 0px 12px; padding:2px 8px 2px 8px; font-size:10px; font-weight:bold;'; foreach ($matches[1] as $match) { if (isset($list[$match])) { $replace = $matches[0][$i] . '<span style="' . $style . '">SEBLOD</span>Do NOT set as Default Template !'; $buffer = str_replace($matches[0][$i], $replace, $buffer); } $i++; } } break; default: $and = $view ? ' AND ( a.view = "' . $view . '" OR a.view = "" )' : ''; $locations = JCckDatabase::loadObjectList('SELECT a.name, a.options FROM #__cck_core_objects AS a WHERE a.component = "' . $option . '"' . $and); $uri = array('option' => $option, 'view' => $view, 'layout' => $layout); 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('doIntegration' => false, 'multilanguage' => 0, 'options' => new JRegistry($location->options), 'replace_end' => '"', 'return_option' => substr($option, 4), 'return_view' => $view, 'return' => '', 'search' => '', 'search_alt' => ''); require_once $path; JCck::callFunc_Array('plgCCK_Storage_Location' . $location->name . '_Integration', 'onCCK_Storage_LocationAfterRender', array(&$buffer, &$data, $uri)); if ($data['doIntegration']) { $list = JCckDatabase::loadObjectList('SELECT pk, cck FROM #__cck_core WHERE storage_location="' . $location->name . '"', 'pk'); $buffer = JCckDevIntegration::rewriteBuffer($buffer, $data, $list); } } } } break; } JResponse::setBody($buffer); return; } }
public function onContentSearch($text = '', $phrase = '', $ordering = '', $areas = NULL, $fields = array(), $fields_order = array(), &$config = array(), $current = array(), $options = NULL, $user = NULL) { if (is_array($areas)) { if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) { return array(); } } else { return array(); } if (!count($fields)) { return array(); } if (!$user) { $user = JCck::getUser(); } if (!is_object($options)) { $options = new JRegistry(); } $db = JFactory::getDbo(); $dispatcher = JDispatcher::getInstance(); $doClean = false; $doLimit = false; $limit = $options->get('limit'); $glues = 1; $order = ''; $order_string = ''; $where = ''; $w = -1; $where2 = array(); $t = 1; $t2 = 1; $tables = array('#__cck_core' => array('_' => 't0', 'fields' => array(), 'join' => 1)); $colums = array(); if (isset($config['joins'][$current['stage']]) && is_array($config['joins'][$current['stage']])) { foreach ($config['joins'][$current['stage']] as $j) { if ($j->table) { if (!isset($tables[$j->table])) { $tables[$j->table] = array('_' => 't' . $t++, 'fields' => array(), 'key' => $j->column, 'join' => 2, 'join_key' => $j->column2, 'join_table' => $j->table2); } } } $t2 = count($tables); } foreach ($fields as $field) { if (!$field->state) { continue; } if ($current['stage'] != (int) $field->stage) { continue; } $name2 = $field->match_collection != '' ? '\\\\|[0-9]+\\\\|' . $field->match_collection : ''; // - if ($field->live == 'stage') { $live_options = new JRegistry(); $live_options->loadString($field->live_options); $live_value = $live_options->get('value', $field->live_value); $live_value = $live_value ? $live_value : 1; $value = $current['stages'][$live_value]; if ($value == '' && $live_options->get('default_value') != '') { $value = (string) $live_options->get('default_value'); } } else { $value = $field->value; } // - $Pf = $field->storage_field; $Pt = $field->storage_table; if (($value !== '' && $field->match_mode != 'none' || ($field->match_mode == 'empty' || $field->match_mode == 'not_empty' || $field->match_mode == 'not_null')) && $field->storage != 'none' || $field->type == 'search_operator' && $field->match_mode != 'none') { $glue = ''; $sql = ''; if ($field->match_options != '') { $field->match_options = new JRegistry($field->match_options); } // Glue if ($glues == 1) { $glue = $where != '' ? 'AND' : ''; $where .= $glue; if ($glue != '') { $where2[++$w] = $glue; } $glue = ''; } // Sql if ($field->type == 'search_generic') { if (count($field->children)) { $sql = '('; $k = 0; foreach ($field->children as $child) { if ($k > 0) { $sql .= ' OR '; } $child->match_mode = $field->match_mode; $child->match_options = $field->match_options; $child->match_value = $field->match_value; if ($child->storage && $child->storage != 'none') { $Pf = $child->storage_field; $Pt = $child->storage_table; // - if ($Pt && !isset($tables[$Pt])) { $tables[$Pt] = array('_' => 't' . $t, 'fields' => array(), 'join' => 1); $t++; } $tables[$Pt]['location'] = $child->storage_location; // - $name = $child->storage_field2 ? $child->storage_field2 : $child->name; if ($Pt != '') { $target = $tables[$Pt]['_'] . '.' . $Pf; $tables[$Pt]['fields'][$Pf] = $Pt == '#__cck_core' ? $value : $name; } if (JCck::callFunc('plgCCK_Field' . $child->type, 'isFriendly')) { if (isset($fields[$child->name])) { $value2 = JCck::callFunc_Array('plgCCK_Field' . $child->type, 'getValueFromOptions', array($fields[$child->name], $value, $config)); } else { $value2 = JCck::callFunc_Array('plgCCK_Field' . $child->type, 'getValueFromOptions', array($child, $value, $config)); } } else { $value2 = $value; } require_once JPATH_PLUGINS . '/cck_storage/' . $child->storage . '/' . $child->storage . '.php'; $sql .= JCck::callFunc_Array('plgCCK_Storage' . $child->storage, 'onCCK_StoragePrepareSearch', array(&$child, $child->match_mode, $value2, $name, $name2, $target, $fields, &$config)); } $k++; } $sql .= ')'; } } elseif ($field->type == 'search_ordering') { $sql = ''; array_pop($where2); if (isset($field->children[$value])) { if (!isset($fields_order[$field->children[$value]->name])) { $fields_order[$field->children[$value]->name] = $field->children[$value]; } } } elseif ($field->type == 'search_operator') { // Glue if ($field->value == '((') { $glues = 0; $sql = '('; } elseif ($field->value == '))') { $glues = 1; $sql = ')'; } else { if ($where2[$w] != '(') { $glue = $field->value; $sql = $glue; } } $doClean = true; } else { // - if ($Pt && !isset($tables[$Pt])) { $tables[$Pt] = array('_' => 't' . $t, 'fields' => array(), 'join' => 1); $t++; } $tables[$Pt]['location'] = $field->storage_location; // - $name = $field->storage_field2 ? $field->storage_field2 : $field->name; if ($Pt != '') { $target = $tables[$Pt]['_'] . '.' . $Pf; $tables[$Pt]['fields'][$Pf] = $Pt == '#__cck_core' ? $value : $name; } require_once JPATH_PLUGINS . '/cck_storage/' . $field->storage . '/' . $field->storage . '.php'; $sql = JCck::callFunc_Array('plgCCK_Storage' . $field->storage, 'onCCK_StoragePrepareSearch', array(&$field, $field->match_mode, $value, $name, $name2, $target, $fields, &$config)); } $where .= $sql; $where2[++$w] = $sql; } else { if (@$glue) { $where2[$w] = ''; } // unset( $fields[$field->name] ); } } // Finalize $where = implode(' ', $where2); if ($doClean !== false) { $where = preg_replace('/\\s+/', ' ', $where); $where = str_replace('AND ( )', '', $where); $where = str_replace('AND ( )', '', $where); $where = str_replace('OR OR', 'OR', $where); $where = str_replace('( OR', '(', $where); $where = str_replace('OR )', ')', $where); } $where = str_replace('AND ()', '', $where); // -------- -------- Order if (!$order) { $order = ' t1.title ASC'; } $inherit = array('bridge' => '', 'query' => ''); $query = NULL; $results = array(); self::_setStorage($tables, $config, $inherit); JPluginHelper::importPlugin('cck_storage_location'); if (isset($config['location']) && $config['location']) { $dispatcher->trigger('onCCK_Storage_LocationSearch', array($config['location'], $tables, $fields, $fields_order, &$config, &$inherit, &$results)); $query = $inherit['query']; } if ($config['doQuery'] !== false) { if ($current['stage'] == 0) { $query = $db->getQuery(true); $query->select('t0.id AS pid,t0.pk AS pk,t0.pkb AS pkb'); $query->from('`#__cck_core` AS t0'); self::_buildQuery($dispatcher, $query, $tables, $t, $config, $inherit, $user, $config['doSelect']); $query->select('t0.cck AS cck,t0.storage_location AS loc'); $query->select('tt.id AS type_id,tt.alias AS type_alias'); $query->join('LEFT', '`#__cck_core_types` AS tt ON tt.name = t0.cck'); if (isset($config['query_parts']['select']) && $config['query_parts']['select'] != '') { $query->select($config['query_parts']['select']); } if ($where != '') { $query->where($where); } if (isset($config['query_parts']['having']) && $config['query_parts']['having'] != '') { $query->having($config['query_parts']['having']); } $query->group('t0.pk'); self::_buildQueryOrdering($order, $ordering, $fields_order, $dispatcher, $query, $tables, $t, $config, $current, $inherit, $user); if ($doLimit) { $db->setQuery($query, $config['limitstart'], $config['limitend']); } else { $db->setQuery($query, 0, $limit > 0 ? $limit : ''); } $results = $db->loadObjectList(); } else { $query = $db->getQuery(true); $query->select('t0.pk as pk'); $query->from('`#__cck_core` AS t0'); self::_buildQuery($dispatcher, $query, $tables, $t, $config, $inherit, $user, false); if ($where != '') { $query->where($where); } $query->group('t0.pk'); $db->setQuery($query); $results = $db->loadColumn(); } } // Debug if ($options->get('debug')) { echo str_replace(array('SELECT', 'FROM', 'LEFT JOIN', 'WHERE', 'ORDER BY', 'UNION'), array('<br />SELECT', '<br />FROM', '<br />LEFT JOIN', '<br />WHERE', '<br />ORDER BY', '<br />UNION'), (string) $query) . '<br /><br />'; } unset($fields); unset($fields_order); unset($tables); return $results; }
public function onContentSearch($text = '', $phrase = '', $ordering = '', $areas = NULL, $fields = array(), $fields_order = array(), &$config = array(), $current = array(), $options = NULL, $user = NULL) { if (is_array($areas)) { if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) { return array(); } } else { return array(); } if (!count($fields)) { return array(); } if (!$user) { $user = JCck::getUser(); } if (!is_object($options)) { $options = new JRegistry(); } $app = JFactory::getApplication(); $db = JFactory::getDbo(); $dispatcher = JDispatcher::getInstance(); $doClean = false; $doCount = (int) $options->get('count'); $doLimit = false; $limit = (int) $options->get('limit'); $doLimit = $limit > 0 ? false : true; $isLoadingMore = $app->input->get('format') == 'raw' && $app->input->get('infinite') > 0 ? 1 : 0; $glues = 1; $order = ''; $order_string = ''; $where = ''; $w = -1; $where2 = array(); $t = 1; $t2 = 1; $tables = array('#__cck_core' => array('_' => 't0', 'fields' => array(), 'join' => 1)); $colums = array(); if (isset($config['joins'][$current['stage']]) && is_array($config['joins'][$current['stage']])) { foreach ($config['joins'][$current['stage']] as $j) { if ($j->table) { if (!isset($tables[$j->table])) { $tables[$j->table] = array('_' => 't' . $t++, 'fields' => array(), 'key' => $j->column, 'join' => 2, 'join_key' => $j->column2, 'join_table' => $j->table2, 'join_and' => @$j->and, 'join_type' => @$j->type, 'join_mode' => @$j->mode, 'join_query' => @$j->query); } elseif (@$j->and != '') { $tables[$j->table . '@' . md5($j->and)] = array('_' => 't' . $t++, 'fields' => array(), 'key' => $j->column, 'join' => 2, 'join_key' => $j->column2, 'join_table' => $j->table2, 'join_and' => $j->and, 'join_type' => @$j->type, 'join_mode' => @$j->mode, 'join_query' => @$j->query); } } } $t2 = count($tables); } foreach ($fields as $field) { if (!$field->state) { continue; } if ($current['stage'] != (int) $field->stage) { continue; } $hasSQL = true; $name2 = $field->match_collection != '' ? '\\\\|[0-9]+\\\\|' . $field->match_collection : ''; // - if ($field->live == 'stage') { $live_options = new JRegistry(); $live_options->loadString($field->live_options); $live_value = $live_options->get('value', $field->live_value); $live_value = $live_value ? $live_value : 1; $value = $current['stages'][$live_value]; if ($value == '' && $live_options->get('default_value') != '') { $value = (string) $live_options->get('default_value'); } } else { $value = $field->value; } // - $Pf = $field->storage_field; $Pt = $field->storage_table; if (($value !== '' && $field->match_mode != 'none' || ($field->match_mode == 'empty' || $field->match_mode == 'not_empty' || $field->match_mode == 'not_null')) && $field->storage != 'none' || $field->type == 'search_operator' && $field->match_mode != 'none') { $glue = ''; $sql = ''; if ($field->match_options != '') { $field->match_options = new JRegistry($field->match_options); } // Glue if ($glues == 1) { $glue = $where != '' ? 'AND' : ''; $where .= $glue; if ($glue != '') { $where2[++$w] = $glue; } $glue = ''; } // Sql if ($field->type == 'search_generic') { if (count($field->children)) { $sql = '('; $k = 0; foreach ($field->children as $child) { if ($k > 0) { $sql .= ' OR '; } $child->match_mode = $field->match_mode; $child->match_options = $field->match_options; $child->match_value = $field->match_value; if ($child->storage && $child->storage != 'none') { $Pf = $child->storage_field; $Pt = $child->storage_table; // - if ($Pt && !isset($tables[$Pt])) { $tables[$Pt] = array('_' => 't' . $t, 'fields' => array(), 'join' => 1); $t++; } $tables[$Pt]['location'] = $child->storage_location; // - $name = $child->storage_field2 ? $child->storage_field2 : $child->name; if ($Pt != '') { $target = $tables[$Pt]['_'] . '.' . $Pf; $tables[$Pt]['fields'][$Pf] = $Pt == '#__cck_core' ? $value : $name; } if (JCck::callFunc('plgCCK_Field' . $child->type, 'isFriendly')) { if (isset($fields[$child->name])) { $value2 = JCck::callFunc_Array('plgCCK_Field' . $child->type, 'getValueFromOptions', array($fields[$child->name], $value, $config)); } else { $value2 = JCck::callFunc_Array('plgCCK_Field' . $child->type, 'getValueFromOptions', array($child, $value, $config)); } } else { $value2 = $value; } require_once JPATH_PLUGINS . '/cck_storage/' . $child->storage . '/' . $child->storage . '.php'; $sql .= JCck::callFunc_Array('plgCCK_Storage' . $child->storage, 'onCCK_StoragePrepareSearch', array(&$child, $child->match_mode, $value2, $name, $name2, $target, $fields, &$config)); } $k++; } $sql .= ')'; } } elseif ($field->type == 'search_ordering') { $sql = ''; array_pop($where2); if (isset($field->children[$value])) { if (!isset($fields_order[$field->children[$value]->name])) { $fields_order[$field->children[$value]->name] = $field->children[$value]; } } } elseif ($field->type == 'search_operator') { // Glue if ($field->value == '((') { $glues = 0; $sql = '('; } elseif ($field->value == '))') { $glues = 1; $sql = ')'; } else { if ($where2[$w] != '(') { $glue = $field->value; $sql = $glue; } } $doClean = true; } else { // - if ($Pt && !isset($tables[$Pt])) { $tables[$Pt] = array('_' => 't' . $t, 'fields' => array(), 'join' => 1); $t++; } $tables[$Pt]['location'] = $field->storage_location; // - $name = $field->storage_field2 ? $field->storage_field2 : $field->name; if ($Pt != '') { $target = $tables[$Pt]['_'] . '.' . $Pf; $tables[$Pt]['fields'][$Pf] = $Pt == '#__cck_core' ? $value : $name; } else { $target = $Pf; $hasSQL = false; } require_once JPATH_PLUGINS . '/cck_storage/' . $field->storage . '/' . $field->storage . '.php'; $sql = JCck::callFunc_Array('plgCCK_Storage' . $field->storage, 'onCCK_StoragePrepareSearch', array(&$field, $field->match_mode, $value, $name, $name2, $target, $fields, &$config)); } if ($hasSQL === false) { if ($glues == 1) { if ($where != '') { $where = substr($where, 0, -3); $where2[$w] = ''; } } $config['query_parts']['having'][] = $sql; $sql = ''; } else { $where .= $sql; $where2[++$w] = $sql; } } else { if (@$glue) { $where2[$w] = ''; } // unset( $fields[$field->name] ); } } // Finalize $where = implode(' ', $where2); if ($doClean !== false) { $where = preg_replace('/\\s+/', ' ', $where); $where = str_replace('AND ( )', '', $where); $where = str_replace('AND ( )', '', $where); $where = str_replace('OR OR', 'OR', $where); $where = str_replace('( OR', '(', $where); $where = str_replace('OR ) )', ')', $where); $where = str_replace('OR )', ')', $where); } $where = str_replace('AND ()', '', $where); // -------- -------- Order if (!$order) { $order = ' t1.title ASC'; } $inherit = array('bridge' => '', 'query' => ''); $query = NULL; $query2 = ''; $results = array(); self::_setStorage($tables, $config, $inherit); JPluginHelper::importPlugin('cck_storage_location'); if (isset($config['location']) && $config['location']) { $dispatcher->trigger('onCCK_Storage_LocationSearch', array($config['location'], $tables, $fields, $fields_order, &$config, &$inherit, &$results)); $query = $inherit['query']; } if ($config['doQuery'] !== false) { if ($current['stage'] == 0) { if (isset($config['query_variables']) && count($config['query_variables'])) { foreach ($config['query_variables'] as $var) { if ($var != '') { $db->setQuery($var); $db->execute(); } } } $query = $db->getQuery(true); $query->select('t0.id AS pid,t0.pk AS pk,t0.pkb AS pkb,t0.parent_id AS parent,t0.author_id AS author'); $query->from('`#__cck_core` AS t0'); self::_buildQuery($dispatcher, $query, $tables, $t, $config, $inherit, $user, $config['doSelect']); $query->select('t0.cck AS cck,t0.storage_location AS loc'); if ($config['location'] == 'cck_type') { $query->select($tables['#__cck_core_types']['_'] . '.id AS type_id,' . $tables['#__cck_core_types']['_'] . '.alias AS type_alias'); } else { $query->select('tt.id AS type_id,tt.alias AS type_alias'); $query->join('LEFT', '`#__cck_core_types` AS tt ON tt.name = t0.cck'); } if (isset($config['query_parts']['select'])) { if (is_string($config['query_parts']['select']) && $config['query_parts']['select'] != '' || count($config['query_parts']['select'])) { $query->select($config['query_parts']['select']); } } if ($where != '') { $query->where($where); } if (isset($config['query_parts']['having'])) { if (is_string($config['query_parts']['having']) && $config['query_parts']['having'] != '' || count($config['query_parts']['having'])) { $query->having($config['query_parts']['having']); } } if (isset($config['query_parts']['group']) && count($config['query_parts']['group'])) { $query->group($config['query_parts']['group']); } self::_buildQueryOrdering($order, $ordering, $fields_order, $dispatcher, $query, $tables, $t, $config, $current, $inherit, $user); if ($doLimit && $config['limitstart'] >= 0) { $db->setQuery($query, $config['limitstart'], $config['limitend']); } else { $db->setQuery($query, 0, $limit); } $results = $db->loadObjectList(); if ($doLimit) { $count = count($results); if ($count < $config['limitend'] && !$config['limitstart'] || $isLoadingMore) { $config['total'] = $count; } else { if ($doCount == 1 && strpos(JUri::getInstance()->toString(), 'task=') === false) { $query2 = 'SELECT COUNT(id) FROM #__cck_core WHERE cck = "' . $tables['#__cck_core']['fields']['cck'] . '"'; $config['total'] = JCckDatabaseCache::loadResult($query2); } else { if (JCck::on()) { $query1 = (string) $query; if (strpos($query1, 'HAVING') !== false) { $query->clear('order')->clear('limit'); $query2 = $db->getQuery(true); $query2->select('COUNT(*)'); $query2->from('(' . (string) $query . ') AS Count'); $db->setQuery($query2); $config['total'] = $db->loadResult(); $query2 = (string) $query2; } else { $query->clear('order')->clear('limit'); $query->clear('select')->select('COUNT(t0.id)'); $db->setQuery($query); $config['total'] = $db->loadResult(); $query2 = (string) $query; } } else { $query2 = $db->getQuery(true); $query2->select('COUNT(t0.id)'); $query2->from('`#__cck_core` AS t0'); self::_buildQuery($dispatcher, $query2, $tables, $t, $config, $inherit, $user, $config['doSelect']); if ($where != '') { $query2->where($where); } $db->setQuery($query2, 0, 0); $config['total'] = $db->loadResult(); $query2 = (string) $query2; } } } } } else { $query = $db->getQuery(true); $query->select('t0.pk as pk'); $query->from('`#__cck_core` AS t0'); self::_buildQuery($dispatcher, $query, $tables, $t, $config, $inherit, $user, false); if ($where != '') { $query->where($where); } $db->setQuery($query); $results = $db->loadColumn(); } } // Debug if ($options->get('debug')) { if (!isset($query1)) { $query1 = (string) $query; } if ($query2) { $query2 .= '<br />'; } echo str_replace(array('SELECT', 'FROM', 'LEFT JOIN', 'RIGHT JOIN', 'INNER JOIN', 'WHERE', 'AND', 'ORDER BY', 'LIMIT', 'UNION', ') AS Count'), array('<br />SELECT', '<br />FROM', '<br />LEFT JOIN', '<br />RIGHT JOIN', '<br />INNER JOIN', '<br />WHERE', '<br /> AND', '<br />ORDER BY', '<br />LIMIT', '<br />UNION', '<br />) AS Count'), $query1 . '<br />' . $query2) . '<br />'; } unset($fields); unset($fields_order); unset($tables); return $results; }
public static function onCCK_Field_LinkBeforeRenderContent($process, &$fields, &$storages, &$config = array()) { $itemId = @$process['itemId']; $name = $process['name']; $fieldname = $process['fieldname']; $location = $process['location']; if (isset($process['pk']) && $process['pk']) { $pk = $process['pk']; } else { $pk = isset($fields[$fieldname]) ? (int) $fields[$fieldname]->value : 0; } if (!$pk) { if (isset($process['matches']) && count($process['matches'][1])) { parent::g_setCustomVars($process, $fields, $name); } return; } if ($itemId == '-2') { $itemId = JFactory::getApplication()->input->get('Itemid'); $fieldname2 = $process['fieldname2']; if (isset($fields[$fieldname2])) { $itemId = (int) $fields[$fieldname2]->value; } } elseif ($itemId == '-3') { $itemId = JFactory::getApplication()->input->get('Itemid'); $itemIds = $process['fieldnames']; $items = explode('||', $itemIds); if (count($items)) { foreach ($items as $item) { if ($item != '') { $parts = explode('=', $item); if ($parts[1]) { $checks = json_decode($parts[0], true); $count = count($checks); $found = 0; if ($count) { foreach ($checks as $k => $v) { if (isset($fields[$k]) && $fields[$k]->value == $v) { $found++; } } } if ($found == $count) { $itemId = $parts[1]; break; } } } } } } $fields[$name]->link = JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'getRoute', array($pk, $process['sef'], $itemId, $config)); $target = $fields[$name]->typo_target; if ($fields[$name]->link) { if ($process['vars']) { $fields[$name]->link .= strpos($fields[$name]->link, '?') !== false ? '&' . $process['vars'] : '?' . $process['vars']; } if ($process['custom']) { $fields[$name]->link .= $process['custom'][0] == '#' ? $process['custom'] : (strpos($fields[$name]->link, '?') !== false ? '&' . $process['custom'] : '?' . $process['custom']); } JCckPluginLink::g_setHtml($fields[$name], $target); } if ($fields[$name]->typo) { $html = isset($fields[$name]->html) ? $fields[$name]->html : ''; if (strpos($fields[$name]->typo, $fields[$name]->{$target}) === false) { $fields[$name]->typo = $html; } else { $fields[$name]->typo = str_replace($fields[$name]->{$target}, $html, $fields[$name]->typo); } } if (isset($process['matches']) && count($process['matches'][1])) { parent::g_setCustomVars($process, $fields, $name); } }
* @license GNU General Public License version 2 or later; see _LICENSE.php **/ defined('_JEXEC') or die; $loaded = 0; $location = $config['location']; $params = new JRegistry(); if (count($items) && $location) { $pks = ''; $pkbs = ''; $plg = JPluginHelper::getPlugin('cck_storage_location', $location); $plg_params = new JRegistry($plg->params); for ($i = 0; $i < $total; $i++) { if (isset($items[$i]->pk)) { $pks .= (int) $items[$i]->pk . ','; $pkbs .= (int) $items[$i]->pkb . ','; } } if ($pks) { $pks = substr($pks, 0, -1); } if ($pkbs) { $pkbs = substr($pkbs, 0, -1); } JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'onCCK_Storage_LocationPrepareList', array(&$params)); $path = JPATH_PLUGINS . '/cck_storage_location/' . $location . '/tmpl/item.php'; foreach ($items as $item) { include $path; } } else { echo $data; }
ob_start(); include $file; $data = ob_get_clean(); } } else { $data = CCK_List::render($items, ${$target}, $path, $preconfig['client'], $config['Itemid'], $options, $config); } } } } if ($doDebug) { echo $profiler->mark('afterRender' . $isCached) . '<br /><br />'; } } if ($preconfig['show_form'] > 0) { // BeforeRender if (isset($config['process']['beforeRenderForm']) && count($config['process']['beforeRenderForm'])) { foreach ($config['process']['beforeRenderForm'] as $process) { if ($process->type) { JCck::callFunc_Array('plg' . $process->group . $process->type, 'on' . $process->group . 'beforeRenderForm', array($process->params, &$fields, &$config['storages'], &$config)); } } } $doc->fields =& $fields; $infos = array('context' => '', 'params' => $templateStyle->params, 'path' => $path, 'root' => JURI::root(true), 'template' => $templateStyle->name, 'theme' => $tpl['home']); $doc->finalize('form', $search->name, $config['client'], $positions, $positions_more, $infos); $form = $doc->render(false, $rparams); } // Validation $config['validation'] = count($config['validation']) ? implode(',', $config['validation']) : ''; $config['validation_options'] =& $options;
$fields[$name]->value = $value; } else { $value = ''; if ($x2k > -1) { if ($array_x) { //GroupX $search = '::' . $name . '|' . $x2k . '|' . $parent_name . '::' . '{"file_location":"' . $old_path . $file_name . '","file_title":"' . $file_title . '"}' . '::/' . $name . '|' . $x2k . '|' . $parent_name . '::'; $replace = '::' . $name . '|' . $x2k . '|' . $parent_name . '::' . '{"file_location":"' . $file_location . '","file_title":"' . $file_title . '"}' . '::/' . $name . '|' . $x2k . '|' . $parent_name . '::'; } else { //FieldX $search = '::' . $true_name . '|' . $x2k . '|' . $parent_name . '::' . '{"file_location":"' . $old_path . $file_name . '","file_title":"' . $file_title . '"}' . '::/' . $true_name . '|' . $x2k . '|' . $parent_name . '::'; $replace = '::' . $true_name . '|' . $x2k . '|' . $parent_name . '::' . '{"file_location":"' . $file_location . '","file_title":"' . $file_title . '"}' . '::/' . $true_name . '|' . $x2k . '|' . $parent_name . '::'; } } else { $search = '||' . $name . '||' . '{"file_location":"' . $old_path . $file_name . '","file_title":"' . $file_title . '"}' . '||/' . $name . '||'; $replace = '||' . $name . '||||/' . $name . '::'; } $doSave = 1; } if ($doSave) { // Update $storage = $process['storage']; $table = $process['storage_table']; $field = $process['storage_field']; if (!(isset($search) && isset($replace))) { $field2 = $process['storage_field2']; $search = JCck::callFunc_Array('plgCCK_Storage' . $storage, '_format', array($field2, $search_v)); $replace = JCck::callFunc_Array('plgCCK_Storage' . $storage, '_format', array($field2, $replace_v)); } JCckPluginLocation::g_onCCK_Storage_LocationUpdate($config['pk'], $table, $field, $search, $replace); }
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array()) { if (self::$type != $field->type) { return; } parent::g_onCCK_FieldPrepareContent($field, $config); $app = JFactory::getApplication(); $user = JFactory::getUser(); $access = implode(',', $user->getAuthorisedViewLevels()); $text = ''; if ($field->extended && $field->extended != @$config['type']) { $options2 = JCckDev::fromJSON($field->options2); $name = $field->storage_field2 ? $field->storage_field2 : $field->storage_field; $value = array(); if (@$options2['child_language']) { $language = $options2['child_language'] == '-1' ? JFactory::getLanguage()->getTag() : $options2['child_language']; $language = ' AND a.language = "' . $language . '"'; } else { $language = ''; } $location = @$options2['child_location'] ? $options2['child_location'] : 'joomla_article'; $order = @$options2['child_orderby'] ? ' ORDER BY a.' . $options2['child_orderby'] . ' ' . $options2['child_orderby_direction'] : ' ORDER BY a.title ASC'; $limit = @$options2['child_limit'] ? ' LIMIT ' . $options2['child_limit'] : ''; switch ($field->bool2) { case 2: $properties = array('table', 'access', 'custom', 'status'); $properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties); $and = $properties['status'] ? ' AND a.' . $properties['status'] . ' = 1' : ''; $and .= $properties['access'] ? ' AND a.' . $properties['access'] . ' IN (' . $access . ')' : ''; $items = JCckDatabase::loadObjectList('SELECT a.id as pk, a.' . $properties['custom'] . ' FROM ' . $properties['table'] . ' AS a LEFT JOIN #__cck_store_join_' . $name . ' AS b on b.id = a.id' . ' WHERE b.id2 = ' . (int) $config['pk'] . $and . $language . $order . $limit); if (count($items)) { foreach ($items as $item) { $text .= JHtml::_('content.prepare', $item->{$properties}['custom']); $value[] = $item->pk; } } break; case 1: $properties = array('table', 'access', 'status'); $properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties); $and = $properties['status'] ? ' AND a.' . $properties['status'] . ' = 1' : ''; $and .= $properties['access'] ? ' AND a.' . $properties['access'] . ' IN (' . $access . ')' : ''; $items = JCckDatabase::loadObjectList('SELECT a.id as pk, a.title FROM ' . $properties['table'] . ' AS a LEFT JOIN #__cck_store_join_' . $name . ' AS b ON b.id = a.id' . ' WHERE b.id2 = ' . (int) $config['pk'] . $and . $language . $order . $limit); if (count($items)) { foreach ($items as $item) { $text .= ', ' . $item->title; $value[] = $item->pk; } } if ($text) { $text = substr($text, 2); } break; default: $options2 = new JRegistry(); $options2->loadString($field->options2); $options3_json = $options2->get('child_link_options'); $options3 = new JRegistry(); $options3->loadString($options3_json); // todo >> href $properties = array('table', 'access', 'status', 'to_route'); $properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties); $and = $properties['status'] ? ' AND a.' . $properties['status'] . ' = 1' : ''; $and .= $properties['access'] ? ' AND a.' . $properties['access'] . ' IN (' . $access . ')' : ''; $items = JCckDatabase::loadObjectList('SELECT ' . $properties['to_route'] . ' FROM ' . $properties['table'] . ' AS a LEFT JOIN #__cck_store_join_' . $name . ' AS b ON b.id = a.id' . ' WHERE b.id2 = ' . (int) $config['pk'] . $and . $language . $order . $limit); if (count($items)) { $sef = JFactory::getConfig()->get('sef') ? $options3->get('sef', 2) : 0; JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'setRoutes', array(&$items, $sef, $options3->get('itemid', $app->input->getInt('Itemid', 0)))); foreach ($items as $item) { $text .= ', ' . '<a href="' . $item->link . '">' . $item->title . '</a>'; $value[] = $item->pk; } if ($text) { $text = substr($text, 2); } } break; } $field->divider = ','; $value = implode($field->divider, $value); } else { if ($value) { switch ($field->bool) { case 2: $text = JCckDatabase::loadResult('SELECT a.introtext FROM ' . self::$table . ' AS a WHERE a.id = ' . (int) $value . ' AND a.state = 1 AND a.access IN (' . $access . ')'); $text = JHtml::_('content.prepare', $text); break; case 1: $text = JCckDatabase::loadResult('SELECT a.title FROM ' . self::$table . ' AS a WHERE a.id = ' . (int) $value . ' AND a.state = 1 AND a.access IN (' . $access . ')'); break; default: require_once JPATH_SITE . '/plugins/cck_storage_location/' . self::$type . '/' . self::$type . '.php'; $item = JCckDatabase::loadObject('SELECT a.id, a.title, a.alias, a.catid, a.language FROM ' . self::$table . ' AS a WHERE a.id = ' . (int) $value . ' AND a.state = 1 AND a.access IN (' . $access . ')'); if (is_object($item)) { $options2 = new JRegistry(); $options2->loadString($field->options2); $options3_json = $options2->get('parent_link_options'); $options3 = new JRegistry(); $options3->loadString($options3_json); $field2 = (object) array('link' => 'content', 'link_options' => $options3_json, 'id' => $field->name, 'name' => $field->name, 'text' => htmlspecialchars($item->title), 'value' => ''); JCckPluginLink::g_setLink($field2, $config); $field2->link = plgCCK_Storage_LocationJoomla_Article::getRoute($item, $options3->get('sef', 2), $options3->get('itemid', $app->input->getInt('Itemid', 0))); JCckPluginLink::g_setHtml($field2, 'text'); $text = $field2->html; $field->link = $field2->link; $field->html = $field2->html; } break; } } } $field->value = $value; $field->text = $text; $field->typo_target = 'text'; }
public static function g_setLink(&$field, &$config = array()) { if (!$field->link) { return; } require_once JPATH_PLUGINS . '/cck_field_link/' . $field->link . '/' . $field->link . '.php'; JCck::callFunc_Array('plgCCK_Field_Link' . $field->link, 'onCCK_Field_LinkPrepareContent', array(&$field, &$config)); }
protected static function _importJoined($type, $joined, $elemtype, $item, &$data) { $db = JFactory::getDbo(); $str = ''; $table = '#__cck_core_' . $elemtype . '_' . $type; foreach ($joined as $j) { $name = (string) $j; if ($type == 'field') { if (isset($data['fields'][$name])) { if (file_exists(JPATH_SITE . '/plugins/cck_field/' . $data['fields'][$name]->type . '/classes/app.php')) { require_once JPATH_SITE . '/plugins/cck_field/' . $data['fields'][$name]->type . '/classes/app.php'; JCck::callFunc_Array('plgCCK_Field' . $data['fields'][$name]->type . '_App', 'onCCK_FieldImport' . $elemtype . '_Field', array($data['fields'][$name], &$j, $data)); } $name = $data['fields'][$name]->id; } else { $name = ''; } } if ($name) { $str2 = $item->id . ', "' . $name . '", '; $attributes = $j->attributes(); foreach ($data['tables_columns'][$table] as $key => $val) { if (isset($attributes[$key])) { $str2 .= '"' . $db->escape((string) $attributes[$key]) . '", '; } else { $str2 .= '"", '; } } if ($str2 != '') { $str2 = substr(trim($str2), 0, -1); $str .= '(' . $str2 . '), '; } } } if (strlen($str) > 1) { $str = substr(trim($str), 0, -1); JCckDatabase::execute('INSERT INTO ' . $table . ' VALUES ' . $str); } }
public static function onCCK_FieldBeforeRenderContent($process, &$fields, &$storages, &$config = array()) { if (!$fields[$process['name']]->state) { return; } $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $uri = JUri::getInstance(); $domain = $uri->toString(array('scheme', 'host', 'port')); $pk = $config['pk']; if ($process['fieldname'] && isset($fields[$process['fieldname']]) && $fields[$process['fieldname']]->value) { $pk = $fields[$process['fieldname']]->value; } $itemId = 0; if ($process['fieldname2'] && isset($fields[$process['fieldname2']]) && $fields[$process['fieldname2']]->value) { $itemId = $fields[$process['fieldname2']]->value; } if (!$itemId) { $itemId = $process['itemId']; } $link = JCck::callFunc_Array('plgCCK_Storage_Location' . $process['location'], 'getRoute', array($pk, $process['sef'], $itemId, $config)); $doc->addHeadLink($domain . $link, 'canonical'); $app->cck_canonical_url = $link; }
</div> <div class="width-30 <?php echo $bar; ?> active" id="seblod-sidebar"> <div class="seblod" id="seblod-sideblock"> <div class="fltlft seblod-toolbar"><?php Helper_Workshop::displayToolbar('search', $this->item->master, $this->item->client, $this->uix, ''); ?> </div> <?php if (count($this->fieldsAv)) { echo '<div class="legend top center">' . $this->lists['af_t'] . $this->lists['af_a'] . '<br />' . $this->lists['af_c'] . $this->lists['af_f'] . '</div>'; echo '<div id="scroll"><ul class="sortable connected" id="sortable2" myid="2">'; $style = array('1' => ' hide', '2' => ' hide', '3' => ' hide', '4' => ' hide', '5' => ' hide', '6' => ' hide'); foreach ($this->fieldsAv as $field) { $type_field = ''; if (isset($this->type_fields[$field->id])) { $type_field = ' c-' . $this->type_fields[$field->id]->cc; } JCck::callFunc_Array('plgCCK_Field' . $field->type, 'onCCK_FieldConstruct_Search' . $this->item->master, array(&$field, $style, $data)); Helper_Workshop::displayField($field, $type_field); } echo '</ul></div><div id="sortable_original" style="display: none;"></div>'; } ?> </div> </div> </div> <div class="clr" id="seblod-cleaner"></div>
public function renderField($fieldname, $options = NULL) { $field = $this->get($fieldname); $html = ''; if (!$field) { return $html; } if ($field->display) { $html = JCck::callFunc_Array('plgCCK_Field' . $field->type, $this->methodRender, array(&$field, &$this->config)); if ($field->display > 1 && $html != '') { if (!$options) { return $html; } if ($field->markup == 'none') { // Label $label = ''; if ($options->get('field_label', $this->getStyleParam('field_label', 1))) { $label = $this->getLabel($fieldname, true, $field->required ? '*' : ''); $html = $label . $html; } } elseif ($this->markup) { // todo } else { // Description $desc = ''; if ($this->getStyleParam('field_description', 0)) { $desc = $field->description != '' ? '<div id="' . $this->id . '_desc_' . $fieldname . '" class="cck_desc cck_desc_' . $field->type . '">' . $field->description . '</div>' : ''; } // Label $label = ''; if ($options->get('field_label', $this->getStyleParam('field_label', 1))) { $label = $this->getLabel($fieldname, true, $field->required ? '*' : ''); $label = $label != '' ? '<div id="' . $this->id . '_label_' . $fieldname . '" class="cck_label cck_label_' . $field->type . '">' . $label . '</div>' : ''; } // Markup $html = '<div id="' . $this->id . '_value_' . $fieldname . '" class="cck_value cck_value_' . $field->type . @$field->markup_class . '">' . $html . '</div>'; $html = '<div id="' . $this->id . '_' . $fieldname . '" class="cck_' . $this->mode . 's cck_list cck_' . $field->type . ' cck_' . $fieldname . '">' . $label . $html . $desc . '</div>'; } } } return $html; }