<?php require_once 'config.php'; require_once '../functions/cron_news_functions.php'; //lay ra tin $db = new db_query('SELECT lin_url,lin_id, lin_cat_id, law.* FROM links LEFT JOIN law ON law_id = lin_law_id WHERE lin_status = ' . LINK_STATUS_PENDING . ' LIMIT 1'); $link_data = mysqli_fetch_assoc($db->result); if (!$link_data) { echo 'Hết link để lấy tin'; die; } //xử lý dữ liệu $array_data_news = pre_cron_news_detail($link_data); if (!$array_data_news['success']) { echo $array_data_news['error']; reload(5); die; } $title = $array_data_news['title']; $title_md5 = $array_data_news['title_md5']; $category = $array_data_news['category']; $content = $array_data_news['content']; $teaser = $array_data_news['teaser']; $tag_string = $array_data_news['tag_string']; $image = $array_data_news['image']; $link_id = $array_data_news['link_id']; $link_url = $array_data_news['link_url']; $time = time();
case 'load_news_url': $return_json = array(); $url = getValue('url', 'str', 'POST', ''); if (!filter_var($url, FILTER_VALIDATE_URL)) { break; } $domain = get_domain($url); //tìm kiếm domain trong bảng law $db_query = new db_query('SELECT * FROM law WHERE law_link_cat LIKE "' . $domain . '%" LIMIT 1'); $law_detail = mysqli_fetch_assoc($db_query->result); unset($db_query); if (!$law_detail) { break; } //lấy tin theo luật này $news_data = pre_cron_news_detail(array('lin_id' => 0, 'lin_url' => $url, 'lin_cat_id' => 0, 'law_detail_title' => $law_detail['law_detail_title'], 'law_detail_content' => $law_detail['law_detail_content'], 'law_detail_teaser' => $law_detail['law_detail_teaser'], 'law_detail_tag' => $law_detail['law_detail_tag'], 'law_detail_remove' => $law_detail['law_detail_remove']), 1); if (!$news_data['success']) { $return_json['success'] = 0; $return_json['error'] = $news_data['error']; } else { $return_json['success'] = 1; $return_json['title'] = $news_data['title']; $return_json['content'] = $news_data['content']; $return_json['teaser'] = $news_data['teaser']; $return_json['picture'] = $news_data['image']; $return_json['link_picture'] = get_picture_path($news_data['image']); } $return_json = json_encode($return_json); echo $return_json; break; case 'loadCatChild':