<?php
$xfield = empty($xfield) ? $db->safesql( htmlspecialchars(strip_tags( trim( $xfield ) ), ENT_QUOTES, $config['charset'] ) ) : false;
if (!$xfield) {
return;
}
$field = empty($field) ? $db->safesql( htmlspecialchars(strip_tags( trim( $field ) ), ENT_QUOTES, $config['charset'] ) ) : false;
if (!$field) {
return;
}
$cache = $xfield . $field;
$allow_cache = ($config['version_id'] >= '10.2') ? $config['allow_cache'] == '1' : $config['allow_cache'] == "yes";
if (!$allow_cache) {
if ($config['version_id'] >= '10.2')
$config['allow_cache'] = '1';
else
$config['allow_cache'] = "yes";
$is_change = true;
}
$xflist = dle_cache("news", $config["skin"] . $cache, false);
if ($xflist) {
echo $xflist;
return;
}
if (trim($xfield) != "") {
$where_str_xfield = "CHARACTER_LENGTH(SUBSTRING_INDEX( SUBSTRING_INDEX( xfields, '{$xfield}|', -1 ) , '||', 1 )) > 0 AND SUBSTRING_INDEX( SUBSTRING_INDEX( xfields, '{$xfield}|', -1 ) , '||', 1 ) NOT LIKE '%|%' AND CHARACTER_LENGTH(SUBSTRING_INDEX( SUBSTRING_INDEX( xfields, '{$field}|', -1 ) , '||', 1 )) > 0 AND SUBSTRING_INDEX( SUBSTRING_INDEX( xfields, '{$field}|', -1 ) , '||', 1 ) NOT LIKE '%|%'";
$select_str_xfield = "SUBSTRING_INDEX( SUBSTRING_INDEX( xfields, '{$field}|', -1 ) , '||', 1 ) as xf_{$field}";
}
else {
return;
}
if (!$field) {
return;
}
$thisdate = date ( "Y-m-d H:i:s", time () );
if($config['no_date'] && !$config['news_future'])
$where_date = " AND date < '" . $thisdate . "' ";
else
$where_date = "";
$db->query("SELECT {$select_str_xfield} FROM " . PREFIX . "_post WHERE approve=1 {$where_date} AND {$where_str_xfield}");
$xflist = array();
while ($row = $db->get_row()) {
if (!isset($xflist[$row["xf_{$field}"]])) {
$xflist[$row["xf_{$field}"]] = $row["xf_{$field}"];
}
}
$xf_list = implode($xflist);
create_cache("news", $xf_list, $config["skin"] . $cache, false);
if ($is_change) {
$config['allow_cache'] = false;
}
echo $xflist;
$db->free();
?>