Орла
Области
Компаний
Пользователи
Галерея
Фиксированные новости
Орла
Отзывы о фирмах
Тарифы
Пользователи
Области
Банкоматы
Торговые точки
Доска объявлений
Курсы валют
Скидки
организации Орла
организации области
товары
сайты
сайты Орел
Данные
Разделы
Поиск
Поиск запросы
Статистика
Показы каталога организаций
Статистика клиенты
Пользователи
Сайты
Управление сайтом
Анкета
Аптеки
Афиша
Афиша новая
Баннеры
Бизнес >
Викторина
Голосование
Гость на сайте
Истории
Календарь событий
Каталоги >
Конкурс красоты
Конкурс аудио
Консультации
Меню
Новое на сайте
Новости >
Организации >
Программа ТВ
Публикации
Разделы сайта
Рассылка
Рестораны
Секрет фирмы >
Сервисы >
Ссылки
Тесты
Файловый менеджер
Форум
Фотогалерея
Обратная связь
Недвижимость
Новый год
Тексты
Пользователи
Юридический рейтинг
Отзывы на товары
Бан пользователей
Жалобы
Новые тесты
Коронавирус
Файловый менеджер
Имя файла
news_func.php
Содержимое
<?php function xml(){ $news=fetchAll("select id, news_header, news_short, news_full, UNIX_TIMESTAMP(data) as date, razdel, id_rubrik, url, img_index from news where razdel <> '5' and razdel <> '25' and razdel <> '28' and razdel <> '29' and status ='3' and data between DATE_SUB(curdate(),INTERVAL 2 day) and now()"); if (!$news) { echo mysql_error(); exit; } $strTopFile = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\"> "; $bodyFile = ""; foreach ($news as $news => $item){ // var_dump($val); $bodyFile .= "<url> <loc>https://infoorel.ru/news/". $item['url'].".html</loc> <news:news> <news:publication> <news:name>Новости</news:name> <news:language>ru</news:language> </news:publication> <news:publication_date>".date('Y-m-d', $item['date'])."</news:publication_date> <news:title>".strip_tags($item['news_header'])."</news:title> </news:news> </url> "; } $bottomFile = "</urlset>"; // $f =fopen('/data/site/infoorel.ru/html/news-111111.txt', 'w'); echo $_SERVER['DOCUMENT_ROOT']; // fwrite($f, "3434343"); echo '2222'; // fclose($f); // if ($f=fopen("/data/site/infoorel.ru/html/news.xml","w")) { // $b=fwrite($f, "3434343"); // fclose($f); // } } function news_rss() { $r_news=sql("select id, news_header, news_short, news_full, UNIX_TIMESTAMP(data) as date, razdel, id_rubrik, url, img_index from news where razdel <> '5' and razdel <> '25' and status ='3' and data between DATE_SUB(curdate(),INTERVAL 1 day) and now()"); if (!$r_news) { echo mysql_error(); exit; } $str_top_file = "<?xml version=\"1.0\" encoding=\"windows-1251\"?> <rss xmlns:yandex=\"http://news.yandex.ru\" xmlns:media=\"http://search.yahoo.com/mrss/\" xmlns:turbo=\"http://turbo.yandex.ru\" version=\"2.0\"> <channel> <title>Новости Орла</title> <link>https://www.infoorel.ru/</link> <description>Орловский городской сайт infoOrel.ru</description> <yandex:logo>https://www.infoorel.ru/images/logo.gif</yandex:logo> <yandex:logo type=\"square\">https://www.infoorel.ru/images/logoinfo100.png</yandex:logo> <turbo:analytics type=\"Yandex\" id=\"26008341\"></turbo:analytics> "; while ($rs_n=sqlget($r_news)) { switch ($rs_n['razdel']){ case '2': $kategory="Общество"; break; case '3': $kategory="Происшествия"; break; case '7': $kategory="Культура"; break; case '27': $kategory="Медицина"; break; case '20': $kategory="Область"; break; case '26': $kategory="Спорт"; break; default: $kategory="Общество";break; } $limit = 1500; switch ($rs_n['id_rubrik']){ case '4': $genre = "<yandex:genre>interview</yandex:genre>"; break; case '6': $genre = strlen(strip_tags($rs_n['news_full'])) >= $limit ? "<yandex:genre>article</yandex:genre>" : "<yandex:genre>message</yandex:genre>"; break; case '5': $genre = strlen(strip_tags($rs_n['news_full'])) >= $limit ? "<yandex:genre>article</yandex:genre>" : "<yandex:genre>message</yandex:genre>"; break; case '1': $genre = "<yandex:genre>lenta</yandex:genre>"; break; case '2': $genre = "<yandex:genre>lenta</yandex:genre>"; break; default: $genre = "<yandex:genre>message</yandex:genre>"; break; } $hostname = "https://www.infoorel.ru/"; $images_array = fetchAll("SELECT foto_small FROM news_foto WHERE id_news={$rs_n['id']}"); if(isNotEmptyArray($images_array)){ $pictures = ''; foreach($images_array as $image){ $full_path = $hostname.$image['foto_small']; if(file_exists('/data/site/infoorel.ru/html/'.$image['foto_small'])){ $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime_type = finfo_file($finfo, '/data/site/infoorel.ru/html/'.$image['foto_small']); finfo_close($finfo); if($mime_type and $mime_type!=''){ $pictures = $pictures."<enclosure url=\"{$full_path}\" type=\"{$mime_type}\"/> "; } } } }else{ $pictures = ''; } preg_match_all('/<img\ssrc="(.*?)"/is',$rs_n['news_full'],$image_match); if(isNotEmptyArray($image_match[1])){ $pictures_from_text = ''; foreach($image_match[1] as $image){ $full_path = "https://www.infoorel.ru".$image; if(file_exists('/data/site/infoorel.ru/html'.$image)){ $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime_type = finfo_file($finfo, '/data/site/infoorel.ru/html'.$image); finfo_close($finfo); if($mime_type and $mime_type!=''){ $pictures_from_text = $pictures_from_text."<enclosure url=\"{$full_path}\" type=\"{$mime_type}\"/> "; } } } $image_match = NULL; }else{ $pictures_from_text=''; } $videos_array = fetchAll("SELECT fileName FROM news_video WHERE id_news={$rs_n['id']} AND status = 3"); if(isNotEmptyArray($videos_array)){ $videos = ''; foreach($videos_array as $video){ $full_path = $hostname.'user_foto/flv/news/'.$video['fileName'].'.flv'; if(file_exists("/data/site/infoorel.ru/html/user_foto/flv/news/".$video['fileName'].".flv")){ $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime_type = finfo_file($finfo, "/data/site/infoorel.ru/html/user_foto/flv/news/".$video['fileName'].".flv"); finfo_close($finfo); if($mime_type and $mime_type!=''){ $videos = $videos."<enclosure url=\"{$full_path}\" type=\"{$mime_type}\"/> "; } }} }else{ $videos = ''; } $str_body_file.="<item turbo=\"true\"> <title>".htmlspecialchars(strip_tags($rs_n['news_header']),0,'')."</title> <link>https://www.infoorel.ru/news/".$rs_n['url'] . ".html</link> <description>".htmlspecialchars($rs_n['news_short'])."</description> <category>".$kategory."</category> " .$pictures .$pictures_from_text .$videos. "<pubDate>".date('r', $rs_n['date'])."</pubDate> ".$genre ." <yandex:full-text>".str_replace("'","'",htmlspecialchars(strip_tags($rs_n['news_full']),0,''))." </yandex:full-text> <turbo:content> <![CDATA[ <header> <figure> <img src=\"https://www.infoorel.ru/{$rs_n['img_index']}\" /> </figure> <h1>".htmlspecialchars(strip_tags($rs_n['news_header']),0,'')."</h1> </header> {$rs_n['news_full']} {$pictures} {$pictures_from_text} {$videos} ]]> </turbo:content> </item> "; } $str_bottom_file="</channel> </rss>"; if ($f=fopen("/data/site/infoorel.ru/html/news.rss","w")) { $b=fwrite($f, $str_top_file.$str_body_file.$str_bottom_file); fclose($f); } } function postfb($data,$id) { $is_intable = sql("select * from news_vk where news_id=".$id); if (mysql_num_rows($is_intable)==0) { sql("insert into news_vk set news_id=".$id); } $is_posted = sql("select * from news_vk where news_id=".$id." and fb <> 0 and fb <> '-1'"); if (mysql_num_rows($is_posted)==0) { $app_id = "450603345011571"; $app_secret = "e7cbc901d191928c61661a0646c64868"; $my_url = "https://www.infoorel.ru/maps/newfb/req.php"; require_once 'fb/facebook.php'; $facebook = new Facebook(array( 'appId' => $app_id, 'secret' => $app_secret, 'cookie' => true )); //$token = "AAAGZA0kRQY3MBADY4hc4K0uCc547L4jjZCRQPKJqK60EFlPwymZCTJ3IrcFbCzWXDwE236tYeVoJUxEiAGBlT7MLV0KqETb1k9iFvQRdAZDZD"; $token = "CAAGZA0kRQY3MBAMlSSG3hKLPYX4fah9OmTLtxDXNWMDxyS9i7NZCl0bUuXEqMIyD665O1Pmu7zFwrBgyBOh8lCI4D4ZBZC5ZCevlQ40QJVuftI9ZBkvq0A0X45lBWZClzaMZASQ39jelnZCZAhrtl1bqh0BZAqvL6yq62iKu3BBR5xoPruYID6ULGzV"; $news = sqlval('SELECT url FROM news WHERE id = ' . $id); $link = 'https://www.infoorel.ru/news/' . $news['url'] . '.html'; $post = array( 'access_token' => $token, 'message' => $data.' '.$link); $res = $facebook->api('/241063616029549/feed', 'POST', $post); sql("update news_vk set fb=1 where news_id=".$id); } } function postok($data,$id) { $is_intable = sql("select * from news_vk where news_id=".$id); $news = sqlval('SELECT url FROM news WHERE id = ' . $id); if (mysql_num_rows($is_intable)==0) { sql("insert into news_vk set news_id=".$id); } $is_posted = sql("select * from news_vk where news_id=".$id." and ok <> 0 and ok <> '-1'"); if (mysql_num_rows($is_posted)==0) { require_once 'od.php'; $link = 'https://www.infoorel.ru/news/'.$news['url'] . '.html'; add_od($data." ".$link); sql("update news_vk set ok=1 where news_id=".$id); } } function postvk($data,$id) { $is_intable = sql("select * from news_vk where news_id=".$id); if (mysql_num_rows($is_intable)==0) { sql("insert into news_vk set news_id=".$id); } $is_posted = sql("select * from news_vk where news_id=".$id." and vk_group <> 0 and vk_group <> '-1'"); if (mysql_num_rows($is_posted)==0) { $vkontakteAccessToken = '5bf8c9aba33eab7074a87c28233598e123861a9357a8a129b1ebbecef878084a8e974069316825d724f13'; $vkontakteUserId = '-43225363'; $sRequest = "https://api.vk.com/method/wall.post?owner_id=$vkontakteUserId&access_token=$vkontakteAccessToken&message=$data&from_group=1&attachment=https://infoorel.ru/news/news.php?news_id=".$id; $oResponce = json_decode(file_get_contents($sRequest)); $vk_rez = $oResponce->{'response'}->{'post_id'}; if ($vk_rez>0) { sql("update news_vk set vk_group=".$vkontakteUserId." where news_id=".$id); } } } function posttwit($data,$id) { $is_intable = sql("select * from news_vk where news_id=".$id); if (mysql_num_rows($is_intable)==0) { sql("insert into news_vk set news_id=".$id); } $is_posted = sql("select * from news_vk where news_id=".$id." and twitter <> 0 and twitter <> '-1'"); if (mysql_num_rows($is_posted)==0) { require_once 'twitteroauth/twitteroauth.php'; $link = 'https://www.infoorel.ru/news/news.php?news_id='.$id; $connection = new TwitterOAuth( "0mUD5Ylv9VGPjgZzSGQ", "kSso2cYG70BpcgLRPZoakih2dbkKNFbJk4RZMfdDCGo", "1100363256-755JDDq3MoWpFdpATdBsROv9vaeKAzVmSW306zU", "k7vYDDprNj69uSwbWA5Yx4JaYjOQ1FQBY2NjIZGX0" ); $connection->post('statuses/update', array( 'status' => $data .' : '. $link, 'entities' => array("urls" => array("url" => $link,) ) )); sql("update news_vk set twitter=1 where news_id=".$id); } } function newPostVK($text,$id_new,$path_to_img){ try{ $vkontakteAccessToken = '5bf8c9aba33eab7074a87c28233598e123861a9357a8a129b1ebbecef878084a8e974069316825d724f13'; $vkontakteUserId = '-43225363'; $gid = '43225363'; $v = '5.73'; $is_intable = sql("select * from news_vk where news_id=".$id_new); if (mysql_num_rows($is_intable)==0) { sql("insert into news_vk set news_id=".$id_new); } $is_posted = sql("select * from news_vk where news_id=".$id_new." and vk_group <> 0 and vk_group <> '-1'"); if (mysql_num_rows($is_posted)==0) { if($path_to_img!=''){ $sRequest = "https://api.vk.com/method/photos.getWallUploadServer?v=" . $v . "&gid=$gid&access_token=$vkontakteAccessToken"; $oResponce = json_decode(file_get_contents($sRequest)); if(!$oResponce)throw new Exception('Пустой объект'); $upload_url = $oResponce->{'response'}->{'upload_url'}; if($upload_url == '')throw new Exception('Нет урла'); $post_params = array( "file1" => "@"."/data/site/infoorel.ru/html/$path_to_img" ); $ch = curl_init(); if(!$ch)throw new Exception('Lib_CURL не установлен'); curl_setopt($ch, CURLOPT_URL, $upload_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params); $result = json_decode(curl_exec($ch)); if(!$result)throw new Exception('Пустой объект CURLа'); $server = $result->{'server'}; $hash = $result->{'hash'}; $photo = $result->{'photo'}; if($server == '' or $hash == '' or $photo == '')throw new Exception('Не все параметры'); $sRequest = "https://api.vk.com/method/photos.saveWallPhoto?v=" . $v . "&gid=$gid&access_token=$vkontakteAccessToken&server=$server&hash=$hash&photo=$photo"; $oResponce = json_decode(file_get_contents($sRequest)); if(!$oResponce)throw new Exception('Пустой объект сохранения'); if(isset($oResponce->{'response'}[0]->{'id'})){ $id = (string)$oResponce->{'response'}[0]->{'id'}; if($id == '')throw new Exception('Нет ID картинки'); } $ownerId = $oResponce->{'response'}[0]->{'owner_id'}; $attachment = 'photo' . $ownerId . '_' . $id; $s1Request = "https://api.vk.com/method/wall.post?v=" . $v . "&owner_id=$vkontakteUserId&access_token=$vkontakteAccessToken&message=$text&from_group=1&attachments=".$attachment; }else{ $s1Request = "https://api.vk.com/method/wall.post?v=" . $v . "&owner_id=$vkontakteUserId&access_token=$vkontakteAccessToken&message=$text&from_group=1"; } $o1Responce = json_decode(file_get_contents($s1Request)); $vk_rez = $o1Responce->{'response'}->{'post_id'}; if ($vk_rez>0) { sql("update news_vk set vk_group=".$vkontakteUserId.", vk_post_id = {$vk_rez} where news_id=".$id_new); } } } catch(Exception $e){ echo $e->getMessage(); } } /** * Функция отправляет фотографию на сервер * Подробное описание метода на сайте: * https://core.telegram.org/bots/api#available-methods * * @param $photoUrl - ссылка на картинку вида http://www.infoorel.ru/user_foto.... * @param $title - заголовок фотографии. Если title длинее 140 символов, то обрезаем его. * @param $url - ссылка на источник, если нет указывайте null * * @return bool */ function sendTelegramPhoto($photoUrl, $title, $url = null, $message = null) { if ($photoUrl == null) { return false; } $curlUrl = 'https://api.telegram.org/bot295195669:AAG_yTOj47Cp40Rs3sKfqqhtFFwCIBVKB7E/sendPhoto?chat_id=@infoorel'; if (mb_strlen($title, 'UTF-8') > 140) { $title = mb_substr($title." ".$message, 0, 140); } if ($url != null) { $message .= ' ' . $url; } $postFields = [ 'chat_id' => '@infoorel', 'photo' => $photoUrl, 'caption' => $title ]; $curl = curl_init($curlUrl); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postFields)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_exec($curl); curl_close($curl); $Peremenaya="https://api.telegram.org/bot295195669:AAG_yTOj47Cp40Rs3sKfqqhtFFwCIBVKB7E/sendMessage?chat_id=@infoorel&text=".$message; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "$Peremenaya"); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); return true; } ?>
/admin/news///////
Имя
Дата
Размер
fb
2013-04-27
twitteroauth_old
2013-04-27
action.php
2015-05-22
2 кб.
delete_slider.php
2017-02-22
302 байт
edit_slider.php
2017-02-22
6 кб.
fix.php
2021-03-29
8 кб.
get_tags.php
2017-02-21
507 байт
news.rss
2006-01-02
24 кб.
news_func.php
2026-10-02
16 кб.
news_modif.php.back
2025-01-09
45 кб.
news_modif.php.back~
2026-07-24
45 кб.
news_modif.php.bak.charset_20261002
2026-01-12
46 кб.
news_new.php
2019-04-25
202 байт
news_sql_new.php
2021-03-29
12 кб.
od2.php
2013-08-13
522 байт
razdel.php
2017-06-21
6 кб.
sitemap.xml
2019-04-25
0 байт
swfobject.js
2008-06-02
7 кб.
test_fb.php
2016-01-15
3 кб.
testvk.php
2014-07-29
6 кб.
upload_thumb.php
2026-01-12
13 кб.
{response}-
2016-11-07
0 байт
{upload_url}~
2026-07-24
0 байт
/admin/news///////
Загрузить файлы
Файл 1
Файл 2
Файл 3