$dispatcher = JDispatcher::getInstance(); $integrity = array(); $processing = array(); if (JCckToolbox::getConfig()->get('processing', 0)) { $processing = JCckDatabaseCache::loadObjectListArray('SELECT type, scriptfile FROM #__cck_more_processings WHERE published = 1 ORDER BY ordering', 'type'); } $storages = array(); $config = array('author' => 0, 'client' => $client, 'doTranslation' => JCck::getConfig_Param('language_jtext', 0), 'doValidation' => JCck::getConfig_Param('validation', '2'), 'error' => false, 'fields' => array(), 'id' => $preconfig['id'], 'isNew' => $isNew, 'Itemid' => $preconfig['itemId'], 'message' => $preconfig['message'], 'message_style' => '', 'options' => '', 'pk' => $id, 'post' => $post, 'process' => array(), 'stage' => -1, 'storages' => array(), 'task' => $task, 'type' => $preconfig['type'], 'url' => $preconfig['url'], 'validate' => ''); CCK_Form::applyTypeOptions($config); $stage = -1; $stages = isset($config['options']['stages']) ? $config['options']['stages'] : 1; if ($stages > 1) { $stage = $preconfig['stage']; } $parent = JCckDatabase::loadResult('SELECT parent FROM #__cck_core_types WHERE name = "' . $preconfig['type'] . '"'); $fields = CCK_Form::getFields(array($preconfig['type'], $parent), $client, $stage, '', true); if (count($fields)) { foreach ($fields as $field) { $name = $field->name; $field->state = ''; // Restriction if (isset($field->restriction) && $field->restriction) { $field->authorised = JCck::callFunc_Array('plgCCK_Field_Restriction' . $field->restriction, 'onCCK_Field_RestrictionPrepareStore', array(&$field, &$config)); if (!$field->authorised) { continue; } } if ($task != 'save2copy' && ($field->variation == 'hidden' || $field->variation == 'hidden_auto' || $field->variation == 'disabled' || $field->variation == 'value') && !$field->live && $field->live_value != '') { $value = $field->live_value; } else { if (isset($post[$name])) {
public function onContentAfterDelete($context, $data) { $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('name AS object')->from('#__cck_core_objects')->where('context = ' . $db->quote($context)); $db->setQuery($query); $object = $db->loadResult(); if (!$object) { return true; } $tableKey = $data->getKeyName(); $pk = $data->{$tableKey}; $base = str_replace('#__', '', $data->getTableName()); require_once JPATH_SITE . '/plugins/cck_storage_location/' . $object . '/' . $object . '.php'; $properties = array('custom'); $properties = JCck::callFunc('plgCCK_Storage_Location' . $object, 'getStaticProperties', $properties); $custom = $properties['custom']; $type = ''; // Core if ($custom) { preg_match('#::cck::(.*)::/cck::#U', $data->{$custom}, $matches); $id = $matches[1]; if (!$id) { return true; } $table = JCckTable::getInstance('#__cck_core', 'id', $id); $type = $table->cck; } else { $table = JCckTable::getInstance('#__cck_core'); if ($table->load(array('pk' => $pk, 'storage_location' => $object))) { $type = $table->cck; } } if ($table->pk > 0) { // -- Leave nothing behind if ($type != '') { require_once JPATH_LIBRARIES . '/cck/base/form/form.php'; JPluginHelper::importPlugin('cck_field'); JPluginHelper::importPlugin('cck_storage'); JPluginHelper::importPlugin('cck_storage_location'); $config = array('pk' => $table->pk, 'storages' => array(), 'type' => $table->cck); $dispatcher = JDispatcher::getInstance(); $parent = JCckDatabase::loadResult('SELECT parent FROM #__cck_core_types WHERE name = "' . $type . '"'); $fields = CCK_Form::getFields(array($type, $parent), 'all', -1, '', true); if (count($fields)) { foreach ($fields as $field) { $Pt = $field->storage_table; $value = ''; /* Yes but, .. */ if ($Pt && !isset($config['storages'][$Pt])) { $config['storages'][$Pt] = ''; $dispatcher->trigger('onCCK_Storage_LocationPrepareDelete', array(&$field, &$config['storages'][$Pt], $pk, &$config)); } $dispatcher->trigger('onCCK_StoragePrepareDelete', array(&$field, &$value, &$config['storages'][$Pt], &$config)); $dispatcher->trigger('onCCK_FieldDelete', array(&$field, $value, &$config, array())); } } } // -- Leave nothing behind $table->delete(); } // Processing JLoader::register('JCckToolbox', JPATH_PLATFORM . '/cms/cck/toolbox.php'); if (JCckToolbox::getConfig()->get('processing', 0)) { $event = 'onContentAfterDelete'; $processing = JCckDatabaseCache::loadObjectListArray('SELECT type, scriptfile FROM #__cck_more_processings WHERE published = 1 ORDER BY ordering', 'type'); if (isset($processing[$event])) { foreach ($processing[$event] as $p) { if (is_file(JPATH_SITE . $p->scriptfile)) { include_once JPATH_SITE . $p->scriptfile; /* Variables: $id, $pk, $type */ } } } } $tables = JCckDatabase::loadColumn('SHOW TABLES'); $prefix = JFactory::getConfig()->get('dbprefix'); if (in_array($prefix . 'cck_store_item_' . $base, $tables)) { $table = JCckTable::getInstance('#__cck_store_item_' . $base, 'id', $pk); if ($table->id) { $table->delete(); } } if (in_array($prefix . 'cck_store_form_' . $type, $tables)) { $table = JCckTable::getInstance('#__cck_store_form_' . $type, 'id', $pk); if ($table->id) { $table->delete(); } } return true; }
$retry = $app->input->get('retry', ''); $post = $retry && $retry == $type->name ? JRequest::get('post') : array(); $config = array('action' => $preconfig['action'], 'asset' => 'com_content', 'asset_id' => 0, 'author' => 0, 'client' => $preconfig['client'], 'core' => true, 'custom' => '', 'doTranslation' => JCck::getConfig_Param('language_jtext', 0), 'doValidation' => JCck::getConfig_Param('validation', '2'), 'error' => 0, 'fields' => array(), 'formId' => $preconfig['formId'], 'isNew' => $isNew, 'javascript' => '', 'pk' => $id, 'submit' => $preconfig['submit'], 'storages' => array(), 'translate_id' => $translate_id, 'type' => $type->name, 'type_id' => $type->id, 'url' => @$preconfig['url'] ? $preconfig['url'] : $current, 'validate' => array(), 'validation' => array(), 'validation_options' => array()); // ACL if (!$canAccess) { if ($isNew) { CCK_Form::redirect($no_action, $no_redirect, $no_message, $no_style, $config); return; } if (!($canEditOwn || $canEditOwnContent)) { CCK_Form::redirect($no_action, $no_redirect, $no_message, $no_style, $config); return; } } // Fields $fields = CCK_Form::getFields(array($type->name, $type->parent), $preconfig['client'], $stage, '', true, true); if (!count($fields)) { $app->enqueueMessage('Oops! Fields not found.. ; (', 'error'); return; } // Template $P = 'template_' . $preconfig['client']; $templateStyle = CCK_Form::getTemplateStyle($type->{$P}, array('rendering_css_core' => $type->stylesheets)); if (!$templateStyle) { $app->enqueueMessage('Oops! Template not found.. ; (', 'error'); return; } // Template Override $tpl['home'] = $app->getTemplate(); if (file_exists(JPATH_ADMINISTRATOR . '/templates/' . $tpl['home'] . '/html/tpl_' . $templateStyle->name)) { $path = JPATH_ADMINISTRATOR . '/templates/' . $tpl['home'] . '/html/tpl_' . $templateStyle->name;