rray = explode(',',$settings['index_s_productid']);
$index_s_productids = get_strings($index_s_product_array);
if($index_s_productids){
$product_data = $db->get_one("select count(*) as count from $table_products p where p.products_id in ($index_new_productids) and p.status = '1' and p.s_p = '1' $query_and");
if($product_data['count'] == '0'){
$define_total = "0";
$leave_num = $total;
}elseif($product_data['count'] < $total){
$define_total = $product_data['count'];
$leave_num = $total - $product_data['count'];
}elseif($product_data['count'] >= $total){
$define_total = $product_data['count'];
$leave_num = "0";
}
}
$sproducts = array();
if($define_total){
$query = $db->query("select p.products_id, p.price, p.name, p.s_p, p.image, sp.s_price from $table_products p left join $table_specials sp on p.products_id = sp.pid where p.products_id in ($index_new_productids) and p.status = '1' and p.s_p = '1' $query_and order by p.date_added desc limit $define_total");
while ($s_products = $db->fetch_array($query)) {
$image_data = $db->get_one("select path,name,extension from $table_source where id='".$s_products['image']."' order by id limit 1");
$s_products['imagesrc'] = get_image_src($image_data);
$sproducts[$s_products['products_id']] = $s_products;
}
$index_s_products = array();
if(is_array($index_s_product_array)){
foreach($index_s_product_array as $v){
if(is_array($sproducts[$v])){
$index_s_products[] = $sproducts[$v];
}
}
}
$query_and_s .= " and products_id not in ($index_new_productids) ";
}
if($leave_num){
$query = $db->query("select p.products_id, p.price, p.name, p.s_p, p.image, sp.s_price from $table_products p left join $table_specials sp on p.products_id = sp.pid where p.status = '1' and p.s_p = '1' $query_and_s order by p.date_added desc limit $leave_num");
while ($s_products = $db->fetch_array($query)) {
$image_data = $db->get_one("select path,name,extension from $table_source where id='".$s_products['image']."' order by id limit 1");
$s_products['imagesrc'] = get_image_src($image_data);
$index_s_products[] = $s_products;
}
}
$date_value .= "\$INDEX_S_CACHE = ".arraydate_more($index_s_products).";\n\n";
create_cache('index', $date_value, 'cache_','VAR');
}
function cache_styles() {
global $db, $table_styles, $table_templates;
$query = $db->query("SELECT s.*, t.directory AS tpldirname FROM $table_styles s LEFT JOIN $table_templates t ON s.tid=t.tid");
while($query_data = $db->fetch_array($query)) {
create_cache($query_data['styleid'], arraydate_one('styles', $query_data), 'cache_style_');
}
}
function cache_usergroup() {
global $db,$GLOBALS, $table_usergroups;
$query = $db->query("SELECT * FROM $table_usergroups");
$groups = array();
while($query_data = $db->fetch_array($query)) {
$groups[] = $query_data;
create_cache($query_data['groupid'],arraydate_var($query_data,'VAR'), 'cache_usergroup_','VAR');
}
$date_value="\$USERGROUPFAQ_CACHE = ".arraydate_more($groups).";\n\n";
create_cache('faq', $date_value, 'cache_usergroup_');
}
function cache_admingroup() {
global $db,$GLOBALS, $table_admingroups;
$query = $db->query("SELECT * FROM $table_admingroups");
while($data = $db->fetch_array($query)) {
create_cache($data['admingroupsid'],arraydate_var($data,'VAR'), 'cache_admingroup_');
}
}
function cache_settings() {
global $db, $table_settings;
$query = $db->query("SELECT settings_key, value FROM $table_settings");
$data_array=array();
while($data = $db->fetch_array($query)) {
$data_array[$data[settings_key]] = $data[value];
}
create_cache('settings', arraydate_one('settings',$data_array), 'cache_');
}
function cache_classes() {
global $db, $table_classes;
$query = $db->query("SELECT classes_id, classes, title, parent_id, sort_order, showinheader FROM $table_classes ORDER BY sort_order");
$data_array