} else { $id = ''; } if (validate($_POST) && !check_get_params($_GET)) { //если заполнена форма и гет параметров нет add_ads($_POST); } elseif (check_get_params($_GET) && isset($_POST['main_form_submit'])) { //при сохранении объявления up_ads($_POST); } if (isset($_GET['action']) && !isset($_POST['main_form_submit']) && $_GET['action'] == 'del') { //если существует GET['action'] и при этом не нажата кнопка delAds($_GET['id']); //удаление объявления } $ads = getAds(); //показы списка //проверка существует ли ключ в массиве if (isset($_GET['id']) && isset($ads) && array_key_exists($_GET['id'], $ads)) { $ad = $ads[$_GET['id']]; } else { $ad = ''; } if (isset($ads)) { $smarty->assign('ads', $ads); } if (check_get_params($_GET)) { $smarty->assign('ad', $ad); } else { $smarty->assign('ad', NULL); }
//Store the bean $id = R::store($channel); $channel->data_source = 'http'; } else { $channel->data_source = 'database'; } if ($cacheAvailable) { $memcache->add("chthmb-{$feed}", $channel->thumbnail_url, false, 1800); } jsonForAjax(R::exportAll($channel)); break; case 'youtube_thumbnail': getYoutubeThumbnail($_GET['id'], isset($_GET['base64'])); break; case 'ads': getAds(); break; case 'sponsored_channel': getSponsoredChannel(); break; } function getChannelThumbnail($feed) { $thumbnail_url = null; if (preg_match("/\\/domain\\//u", $feed) > 0) { $uri = "http://www.reddit.com" . $feed . "/search/.json?restrict_sr=on&sort=top&syntax=cloudsearch&limit=100"; } else { $uri = "http://www.reddit.com" . $feed . "/search/.json?q=%28and+%28or+site%3A%27youtube.com%27+site%3A%27vimeo.com%27+site%3A%27youtu.be%27%29+timestamp%3A" . (time() - 30 * 24 * 60 * 60) . "..%29&restrict_sr=on&sort=top&syntax=cloudsearch&limit=100"; } $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$session->show_year = $session->start_year; $session->show_month = $session->start_month; $session->show_day = $session->start_day; $smarty->assign('start_year', $session->start_year); $smarty->assign('start_month', $session->start_month); $smarty->assign('start_day', $session->start_day); $smarty->assign('end_year', $session->end_year); $smarty->assign('end_month', $session->end_month); $smarty->assign('end_day', $session->end_day); $smarty->assign('show_year', $session->show_year); $smarty->assign('show_month', $session->show_month); $smarty->assign('show_day', $session->show_day); $session->slot = ''; $smarty->assign('errors', $errors); // load up ads $smarty->assign('ads', getAds()); $smarty->display('ads_management.tpl'); } } catch (Exception $e) { $GLOBALS['applog']->logMessage("Caught exception trying to add advertisement: " . $e->getMessage(), LOGGER_ERROR, 'ad_add'); $errors['global']['message'] = "There was a fatal error trying to add the advertisement. Please contact the system administrator."; $smarty->assign('errors', $errors); $smarty->display('home_management.tpl'); } } else { // we weren't submitted - this form should always be a POST $errors['global']['message'] = "ad_add.php was called without a context. If this error persists, please contact the system administrator."; $smarty->assign('errors', $errors); $smarty->display('home_management.tpl'); } } else {