static function getWebsiteLogo($delcache = false) { if (CGlobal::$websiteLogo === false || is_array(CGlobal::$websiteLogo) && !count(CGlobal::$websiteLogo) || $delcache) { if (AZArrCache::is_not_cached('websiteLogo', 0, '', $delcache)) { if (!$delcache) { CGlobal::$websiteLogo['current'] = array('id' => 0, 'img_src' => 'style/img/header_new/logo.png', 'title' => 'Trang chủ', 'expired' => ''); // For logo management $re = DB::query("SELECT * FROM website_logo ORDER BY start_date DESC, end_date DESC"); if ($re) { $logos = array(); $active = false; while ($row = mysql_fetch_assoc($re)) { if (isset(CGlobal::$img_server[$row['img_server']])) { $row['img_src'] = CGlobal::$img_server[$row['img_server']] . UP_FOLDER . '/' . $row['image']; if ($row['status']) { $row['active'] = "Active"; } if ($row['start_date']) { $row['startDate'] = date('d-m-Y', $row['start_date']); } if ($row['end_date']) { $row['endDate'] = date('d-m-Y', $row['end_date']); } $logos[$row['id']] = $row; // Chọn logo theo sự kiện, hoạt động nào đó của AnhNghĩa if ($row['status'] && !$active) { // Nếu trạng thái của logo là đang active và chưa có logo nào được chọn if (!$row['start_date'] || $row['start_date'] < TIME_NOW) { if (!$row['end_date'] || $row['end_date'] >= TIME_NOW) { $active = true; } } if ($active) { CGlobal::$websiteLogo['current'] = array('id' => $row['id'], 'img_src' => CGlobal::$img_server[$row['img_server']] . UP_FOLDER . '/' . $row['image'], 'title' => AZLib::remove_4_js(AZLib::trimSpace(AZLib::plainText(addslashes($row['title'])))), 'expired' => $row['end_date']); DB::query("UPDATE website_logo SET status = 0 WHERE id <> " . $row['id']); } } } } CGlobal::$websiteLogo['logos'] = $logos; AZArrCache::set(array('websiteLogo' => CGlobal::$websiteLogo)); } } } else { CGlobal::$websiteLogo = AZArrCache::$arr_cache['websiteLogo']; AZArrCache::$arr_cache = array(); } } }