$pathI = JPATH_ADMINISTRATOR . '/templates/' . $tpl['home'] . '/html/tpl_' . $templateStyleItem->name; $path_rootI = JPATH_ADMINISTRATOR . '/templates/' . $tpl['home'] . '/html'; $tmplI = 'tpl_' . $templateStyleItem->name; } else { $pathI = JPATH_SITE . '/templates/' . $templateStyleItem->name; $path_rootI = JPATH_SITE . '/templates'; $tmplI = $templateStyleItem->name; } $docI = CCK_Document::getInstance('html'); $rparamsI = array('template' => $tmplI, 'file' => 'index.php', 'directory' => $path_rootI); include JPATH_LIBRARIES_CCK . '/base/list/list_inc_list_items.php'; $infos = array('context' => '', 'params' => $templateStyleItem->params, 'path' => $pathI, 'root' => JURI::root(true), 'template' => $templateStyleItem->name, 'theme' => $tpl['home']); $doc->i_infos = $infos; $doc->i_params = $rparamsI; $doc->i_positions = $positions; $doc->i_positions_more = $positions_p; if (isset($positions2)) { $positions = $positions2; $positions_p = $positions2_p; } } else { $fields = CCK_List::getFields_Items($search->name, $client, $access); $target_f = 'fields_list'; $positions = array(); $positions_p = CCK_List::getPositions($search->id, $client); include JPATH_LIBRARIES_CCK . '/base/list/list_inc_list_items.php'; } // Finalize $infos = array('context' => '', 'params' => $templateStyle->params, 'path' => $path, 'root' => JURI::root(true), 'template' => $templateStyle->name, 'theme' => $tpl['home']); $doc->finalize('content', $search->name, 'list', $positions, $positions_p, $infos); $data = $doc->render(false, $rparams);
$file1 = JPATH_SITE . '/templates/' . $templateStyle2->name . '/includes/' . ${$target}->name . '/no_result.php'; $file2 = JPATH_SITE . '/templates/' . $templateStyle2->name . '/includes/no_result.php'; if (file_exists($file1)) { $file = $file1; } elseif (file_exists($file2)) { $file = $file2; } else { $file = ''; } if ($file && is_file($file)) { 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)); }
$file1 = JPATH_SITE . '/templates/' . $templateStyle->name . '/includes/' . $search->name . '/no_result.php'; $file2 = JPATH_SITE . '/templates/' . $templateStyle->name . '/includes/no_result.php'; if (file_exists($file1)) { $file = $file1; } elseif (file_exists($file2)) { $file = $file2; } else { $file = ''; } if ($file && is_file($file)) { ob_start(); include $file; $data = ob_get_clean(); } } else { $data = CCK_List::render($items, $search, $path, $preconfig['client'], $preconfig['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)); }
JPluginHelper::importPlugin('cck_field_typo'); } JPluginHelper::importPlugin('cck_storage'); JPluginHelper::importPlugin('cck_storage_location'); require_once JPATH_SITE . '/libraries/cck/rendering/rendering_item.php'; $count = count($items); $count2 = count($fields); $count3 = $client == 'item' && $go_for_both ? count($fields2) : 0; if (!isset($doc->list)) { $doc->list = array(); } $doc->list[$idx] = array(); $debug = JCck::getConfig_Param('debug', 0); $ids = ''; $optimize = (int) JCck::getConfig_Param('optimize_memory', 0); $properties = CCK_List::getPropertyColumns_asString($optimize); $pks = ''; if ($list['isCore']) { for ($i = 0; $i < $count; $i++) { $ids .= (int) $items[$i]->pid . ','; $pks .= (int) $items[$i]->pk . ','; } $ids = substr($ids, 0, -1); $pks = substr($pks, 0, -1); } $storages = array('_' => ''); $suffix = ''; if ($debug == -1) { $suffix = 'Debug'; foreach ($fields as $field) { $field->storage = 'lipsum';
public static function onCCK_StoragePrepareSearch(&$field, $match, $value, $name, $name2, $target) { $sql = ''; $TA = '(::' . $name . $name2 . '::)'; $TZ = '(::/' . $name . $name2 . '::)'; //if ( !empty( $field->match_target ) && $field->match_target != '~' ) { // $target = self::_getTarget( $name, $field->match_target ); // $TA = ''; // $TZ = ''; //} switch ($match) { case 'exact': $sql = !$TA ? $target . ' = "' . $TA . $value . $TZ . '"' : $target . ' REGEXP "' . $TA . $value . $TZ . '"'; break; case 'empty': $sql = $target . ' REGEXP "' . $TA . $TZ . '"'; break; case 'alpha': $sql = $target . ' REGEXP "' . $TA . $value . '.*' . $TZ . '"'; break; case 'zeta': /* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */ $sql = $target . ' REGEXP "' . $TA . '.*' . $value . $TZ . '"'; break; case 'any': $separator = $field->match_value ? $field->match_value : ' '; $values = explode($separator, $value); if (count($values)) { $fragments = array(); foreach ($values as $v) { if (strlen($v) > 0) { $fragments[] = $target . ' REGEXP "' . $TA . '.*' . $v . '.*' . $TZ . '"'; } } if (count($fragments)) { $sql = '((' . implode(') OR (', $fragments) . '))'; } } break; case 'any_exact': $separator = $field->match_value ? $field->match_value : ' '; $values = explode($separator, $value); if (count($values)) { $fragments = array(); foreach ($values as $v) { if (strlen($v) > 0) { $fragments[] = !$TA ? $target . ' = "' . $TA . $v . $TZ . '"' : $target . ' REGEXP "' . $TA . $v . $TZ . '"'; } } if (count($fragments)) { $sql = '((' . implode(') OR (', $fragments) . '))'; } } break; case 'each': case 'each_exact': $separator = $field->match_value ? $field->match_value : ' '; $values = explode($separator, $value); if (count($values)) { $fragments = array(); if ($match == 'each_exact') { foreach ($values as $v) { if (strlen($v) > 0) { $fragments[] = (!$TA ? $target . ' = "' . $TA . $v . $TZ . '"' : $target . ' REGEXP "' . $TA . $v . $TZ . '"') . $target . ' REGEXP "' . $TA . $v . $separator . '.*' . $TZ . '"' . $target . ' REGEXP "' . $TA . '.*' . $separator . $v . $separator . '.*' . $TZ . '"' . $target . ' REGEXP "' . $TA . '.*' . $separator . $v . $TZ . '"'; } } } else { foreach ($values as $v) { if (strlen($v) > 0) { $fragments[] = $target . ' REGEXP "' . $TA . '.*' . $v . '.*' . $TZ . '"'; } } } if (count($fragments)) { $sql = '((' . implode(') AND (', $fragments) . '))'; } } break; case 'date_past_only': case 'date_past': case 'date_future': case 'date_future_only': JFactory::getApplication()->enqueueMessage(JText::_('COM_CCK_DATE_AND_TIME_MATCH_ONLY_WITH_STANDARD'), 'notice'); break; case 'nested_exact': $table = $field->match_options ? $field->match_options->get('table', $field->storage_table) : $field->storage_table; $values = JCckDevHelper::getBranch($table, $value); if (count($values)) { $fragments = array(); foreach ($values as $v) { if ($v != '') { $fragments[] = !$TA ? $target . ' = "' . $TA . $v . $TZ . '"' : $target . ' REGEXP "' . $TA . $v . $TZ . '"'; } } if (count($fragments)) { $sql = '((' . implode(') OR (', $fragments) . '))'; } } break; case 'num_higher': $range = ''; $max = $field->match_value ? $field->match_value : 99999; if ($value <= $max) { $range = CCK_List::generateRange($value, $max); } $range = '[[:<:]](' . $range . ')[[:>:]]'; $sql = $target . ' REGEXP "' . $TA . $range . $TZ . '"'; break; case 'num_higher_only': $range = ''; $max = $field->match_value ? $field->match_value : 99999; if ($value <= $max) { $range = CCK_List::generateRange($value, $max); } $range = '[[:<:]](' . $range . ')[[:>:]]'; $sql = $target . ' REGEXP "' . $TA . $range . $TZ . '"'; break; case 'num_lower': $range = ''; $min = $field->match_value ? $field->match_value : 0; if ($value >= $min) { $range = CCK_List::generateRange($min, $value); } $range = '[[:<:]](' . $range . ')[[:>:]]'; $sql = $target . ' REGEXP "' . $TA . $range . $TZ . '"'; break; case 'num_lower_only': $range = ''; $min = $field->match_value ? $field->match_value : 0; if ($value >= $min) { $range = CCK_List::generateRange($min, $value); } $range = '[[:<:]](' . $range . ')[[:>:]]'; $sql = $target . ' REGEXP "' . $TA . $range . $TZ . '"'; break; case 'not_alpha': $sql = $target . ' NOT REGEXP "' . $TA . $value . '.*' . $TZ . '"'; break; case 'not_any_exact': // todo break; case 'not_zeta': /* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */ $sql = $target . ' NOT REGEXP "' . $TA . '.*' . $value . $TZ . '"'; break; case 'not_empty': $sql = $target . ' NOT REGEXP "' . $TA . $TZ . '"'; break; case 'not_equal': $sql = $target . ' NOT REGEXP "' . $TA . $value . $TZ . '"'; break; case 'not_like': $sql = $target . ' NOT REGEXP "' . $TA . '.*' . $value . '.*' . $TZ . '"'; break; case 'not_null': $sql = $target . ' NOT REGEXP "' . $TA . '0' . $TZ . '"'; break; case 'is_null': // todo break; case 'is_not_null': // todo break; case 'radius_higher': case 'radius_lower': JFactory::getApplication()->enqueueMessage(JText::_('COM_CCK_RADIUS_MATCH_ONLY_WITH_STANDARD'), 'notice'); break; case 'none': return; break; default: $sql = $target . ' REGEXP "' . $TA . '.*' . $value . '.*' . $TZ . '"'; break; } return $sql; }