{* logo *}
{foreach $special_user_fields.logo as $logo}
{capture name=pb assign=pb}pb_{$logo.caption}{/capture}
{if (isset($listing.user[$logo]) && $listing.user[$logo])}
<div class="mb10"><img style="object-fit:cover;width: 100px;height: 97px;border-radius: 50%;" src="{$live_site}/uploads/{$logo}/{$listing.user[$logo]}" /></div>
{/if}
{/foreach}
здесь по другому немного код написан, как здесь сменить можно на is_array?
{* logo *}
{foreach $special_listing_fields.logo as $logo}
{if (is_array($listing[$logo.caption]) && $listing[$logo.caption])}
<div class="mb10"><img src="{$live_site}/uploads/{$logo.caption}/{$listing[$logo.caption]}" /></div>
{/if}
{/foreach}
function getNoShortListings($where, $q_join='', $noloc = 0){
global $db, $settings;
$join_pictures = "";
$count = "*";
$locations_str="";
global $admin_side;
if(!$noloc && $settings['enable_locations'] && !isset($admin_side)) {
$locations_str = locations::makeQueryStr();
if(!$where) $locations_str = " where ".substr($locations_str, 4);
}
do_action("search_listing_query", array(&$where));
// count(*) faster than count(val) **********
$sql = "select count($count)
from ".TABLE_ADS."
$join_pictures $join_users $join_ext $join_options $join_pe
$q_join
".$where.$locations_str;
//echo $sql;
$no_ads = $db->fetchRow($sql);
return $no_ads;
}
function getShortListings($where, $order_by, $order_way, $general_row, $ads_per_page, $search='', $q_vars='', $q_join='', $join_cat='') { ....
$join_ext = "";
if (strstr($where, TABLE_ADS_EXTENSION)) {
$join_ext = " left join " . TABLE_ADS_EXTENSION . " on " . TABLE_ADS . ".id = " . TABLE_ADS_EXTENSION . ".`id` ";
}
$join_options = "";
if (strstr($where, TABLE_OPTIONS)) {
$join_options = " left join " . TABLE_OPTIONS . " on " . TABLE_ADS . ".`id` = " . TABLE_OPTIONS . ".`object_id` and `option` like 'video' ";
}
$join_cat = "";
if (strstr($where, TABLE_CATEGORIES)) {
$join_users = "left join " . TABLE_CATEGORIES . "_lang on " . TABLE_ADS . ".category_id=" . TABLE_CATEGORIES . "_lang.id ";
}
$join_pe = "";
if (strstr($where, TABLE_PENDING_EDITED)) {
$join_pe = " left join " . TABLE_PENDING_EDITED . " on " . TABLE_ADS . ".id = " . TABLE_PENDING_EDITED . ".`ad_id` ";
}
$join_pictures = '';
if(strstr($where, TABLE_ADS_PICTURES))
$join_pictures = "inner join ".TABLE_ADS_PICTURES." on ".TABLE_ADS.".id=".TABLE_ADS_PICTURES.".ad_id ";
$join_users = '';
if(strstr($where, TABLE_USERS))
$join_users = "inner join ".TABLE_USERS." on ".TABLE_ADS.".user_id=".TABLE_USERS.".id ";
function getLatest($no_latest, $where = '') {
global $db, $settings;
$locations_str="";
if($settings['enable_locations'])
$locations_str = locations::makeQueryStr();
$where="where ".TABLE_ADS.".active = 1".$where.$locations_str;
$order_by_str="order by date_added desc";
$order_way='';
$start=0;
$ads_per_page=$no_latest;
$result=$this->getShortListings($where,$order_by_str,$order_way,$start,$ads_per_page);
return $result;
}
function getFeatured($no_featured, $where = '') {
global $db, $settings;
$locations_str="";
if($settings['enable_locations'])
$locations_str = locations::makeQueryStr();
$where="where ".TABLE_ADS.".featured>0 and ".TABLE_ADS.".active = 1".$where.$locations_str;
// solution to avoid order by rand()
$total_featured = $db->fetchRow("select count(*) from ".TABLE_ADS." ".$where);
if($total_featured<=$no_featured) {
$result=$this->getShortListings($where,"","",0,0);
shuffle ( $result );
return $result;
}
// more than $no_featured results
$t = $total_featured - $no_featured;
$start = rand(0,$t);
$result=$this->getShortListings($where,"","",$start,$no_featured);
return $result;
}
$LastModified_unix = strtotime(date("D, d M Y H:i:s", filectime($_SERVER['SCRIPT_FILENAME'])));
$LastModified = gmdate("D, d M Y H:i:s \G\M\T", $LastModified_unix);
$IfModifiedSince = false; if (isset($_ENV['HTTP_IF_MODIFIED_SINCE']))
$IfModifiedSince = strtotime(substr ($_ENV['HTTP_IF_MODIFIED_SINCE'], 5));
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
$IfModifiedSince = strtotime(substr ($_SERVER['HTTP_IF_MODIFIED_SINCE'], 5));
if ($IfModifiedSince && $IfModifiedSince >= $LastModified_unix) {
header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
exit; }
header('Last-Modified: '. $LastModified);
куда добавить explain ? это код который долго грузится