|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
if (!defined('BASEPATH'))
|
|
|
|
|
exit('No direct script access allowed');
|
|
|
|
|
|
|
|
|
|
class Welcome extends CI_Controller {
|
|
|
|
|
|
|
|
|
|
function __construct() {
|
|
|
|
|
parent::__construct();
|
|
|
|
|
$this->permission->is_admin();
|
|
|
|
|
//$this->output->enable_profiler(TRUE);
|
|
|
|
|
$this->load->model('Area_model');
|
|
|
|
|
$this->load->model('InfoStructures_model');
|
|
|
|
|
$this->load->model('Information_model');
|
|
|
|
|
$this->load->model('InfoContents_model');
|
|
|
|
|
$this->load->model('Coupon_model');
|
|
|
|
|
$this->load->model('Logs_model');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function index() {
|
|
|
|
|
|
|
|
|
|
$data['countryList'] = $this->Area_model->get_country_list();
|
|
|
|
|
$data['provinceList'] = $this->Area_model->get_province_list();
|
|
|
|
|
$data['city_list'] = $this->Area_model->get_municipalities_list();
|
|
|
|
|
$data['lastEditList'] = $this->Information_model->get_last_edit_list();
|
|
|
|
|
$data['last_city_list'] = $this->Area_model->get_last_edit_city();
|
|
|
|
|
|
|
|
|
|
$this->load->view('bootstrap/header', $data);
|
|
|
|
|
$this->load->view('bootstrap/welcome');
|
|
|
|
|
$this->load->view('bootstrap/footer');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function search($isrecommend = false) {
|
|
|
|
|
//先搜索url,如果找到唯一就跳走,多于一条的则列出来,一条没有的就去搜索信息
|
|
|
|
|
$data['keywords'] = $this->input->post('keywords');
|
|
|
|
|
$data['all_text_search'] = $this->input->post('all_text_search'); //全文搜索
|
|
|
|
|
$search_url = str_replace($this->config->item('site_url'), "", $data['keywords']);
|
|
|
|
|
$data['search_list'] = $this->Information_model->search_url($search_url);
|
|
|
|
|
if (count($data['search_list']) === 0) {
|
|
|
|
|
if (!empty($data['all_text_search']) && $data['all_text_search'] == 'true') {
|
|
|
|
|
$data['search_list'] = $this->Information_model->search_all_text($data['keywords']);
|
|
|
|
|
} else {
|
|
|
|
|
$data['search_list'] = $this->Information_model->search($data['keywords']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($isrecommend) {
|
|
|
|
|
$data['ic_id_list'] = $this->input->post('ic_id_list') == '' ? '0' : $this->input->post('ic_id_list');
|
|
|
|
|
$this->load->view('bootstrap3/recommendlist', $data);
|
|
|
|
|
return TRUE;
|
|
|
|
|
} else if (count($data['search_list']) === 1) {
|
|
|
|
|
redirect(site_url('information/edit/' . $data['search_list'][0]->is_id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data['countryList'] = $this->Area_model->get_country_list();
|
|
|
|
|
$data['provinceList'] = $this->Area_model->get_province_list();
|
|
|
|
|
$data['city_list'] = $this->Area_model->get_municipalities_list();
|
|
|
|
|
|
|
|
|
|
$this->load->view('bootstrap/header', $data);
|
|
|
|
|
$this->load->view('bootstrap/welcome');
|
|
|
|
|
$this->load->view('bootstrap/footer');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取所有信息+产品url
|
|
|
|
|
public function create_all_urls() {
|
|
|
|
|
set_time_limit(0);
|
|
|
|
|
$this->output->enable_profiler(false);
|
|
|
|
|
$this->Information_model->topNum = false;
|
|
|
|
|
$data['all_information'] = $this->Information_model->GetList('ic_status,ic_url,ic_sitecode');
|
|
|
|
|
//系列站产品连接
|
|
|
|
|
$site_code = strtoupper($this->config->item('site_code'));
|
|
|
|
|
if (!empty($site_code)) {
|
|
|
|
|
$this->load->helper('file');
|
|
|
|
|
$path = APPPATH . '/views/product_urls/updateCache' . $site_code . '.txt';
|
|
|
|
|
if (file_exists($path)) {
|
|
|
|
|
$data['product_urls'] = read_file($path);
|
|
|
|
|
$domain = $this->config->item('site_url');
|
|
|
|
|
$data['product_urls'] = str_replace("\n", '<br/>', $data['product_urls']);
|
|
|
|
|
$data['product_urls'] = str_replace($domain, $domain . '/index.php/welcome/update_cache/?static_html_url=', $data['product_urls']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$this->load->view('none_urls', $data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取某个信息节点和子节点url
|
|
|
|
|
public function create_infomation_urls($is_parent_id) {
|
|
|
|
|
$this->output->enable_profiler(FALSE);
|
|
|
|
|
$structure = $this->InfoStructures_model->Detail($is_parent_id);
|
|
|
|
|
if (empty($structure)) {
|
|
|
|
|
show_404();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path);
|
|
|
|
|
$this->load->view('bootstrap/header', $data);
|
|
|
|
|
$this->load->view('bootstrap/cache_url', $data);
|
|
|
|
|
$this->load->view('bootstrap/footer');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function get_infomation_urls($is_parent_id) {
|
|
|
|
|
$this->output->enable_profiler(FALSE);
|
|
|
|
|
$structure = $this->InfoStructures_model->Detail($is_parent_id);
|
|
|
|
|
if (empty($structure)) {
|
|
|
|
|
show_404();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path);
|
|
|
|
|
|
|
|
|
|
$this->load->view('bootstrap/header', $data);
|
|
|
|
|
$this->load->view('bootstrap/static_url', $data);
|
|
|
|
|
$this->load->view('bootstrap/footer');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function get_info_backup_id($info_id) {
|
|
|
|
|
$last_backup = $this->Logs_model->get_last_backup($info_id);
|
|
|
|
|
if (empty($last_backup)) {
|
|
|
|
|
$this->echo_json(array(
|
|
|
|
|
'status' => 'error',
|
|
|
|
|
'logId' => 0,
|
|
|
|
|
'datetime' => 0,
|
|
|
|
|
'username' => 0
|
|
|
|
|
));
|
|
|
|
|
} else {
|
|
|
|
|
$this->echo_json(array(
|
|
|
|
|
'status' => 'success',
|
|
|
|
|
'logId' => $last_backup->log_id,
|
|
|
|
|
'datetime' => $last_backup->log_datetime,
|
|
|
|
|
'username' => $last_backup->log_ht_username
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function change_static_url($info_id) {
|
|
|
|
|
$information = $this->Information_model->Detail($info_id);
|
|
|
|
|
$htm_doc = new DOMDocument();
|
|
|
|
|
$htm_doc->encoding='UTF-8';
|
|
|
|
|
libxml_use_internal_errors(true);
|
|
|
|
|
$htm_doc->strictErrorChecking = false;
|
|
|
|
|
if (empty($information->ic_content)) {
|
|
|
|
|
$this->echo_json(array(
|
|
|
|
|
'status' => 'error',
|
|
|
|
|
'infoId' => $info_id,
|
|
|
|
|
'message' => 'info content is empty'
|
|
|
|
|
));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$htm_doc->loadHTML(
|
|
|
|
|
mb_convert_encoding($information->ic_content, 'HTML-ENTITIES', 'UTF-8'));
|
|
|
|
|
$htm_doc->normalizeDocument();
|
|
|
|
|
$img_list = $htm_doc->getElementsByTagName('img');
|
|
|
|
|
foreach ($img_list as $img) {
|
|
|
|
|
$img_src = $img->getAttribute('src');
|
|
|
|
|
$img_src = $this->check_url($img_src);
|
|
|
|
|
$img->setAttribute('src', $img_src);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$information->ic_content = $htm_doc->saveHTML();
|
|
|
|
|
$this->InfoContents_model->Update(
|
|
|
|
|
$information->ic_id,
|
|
|
|
|
$information->ic_url,
|
|
|
|
|
$information->ic_url_title,
|
|
|
|
|
$information->ic_type,
|
|
|
|
|
$information->ic_title,
|
|
|
|
|
$information->ic_content,
|
|
|
|
|
$information->ic_summary,
|
|
|
|
|
$information->ic_seo_title,
|
|
|
|
|
$information->ic_seo_description,
|
|
|
|
|
$information->ic_seo_keywords,
|
|
|
|
|
$information->ic_show_bread_crumbs,
|
|
|
|
|
$information->ic_status,
|
|
|
|
|
$information->ic_template,
|
|
|
|
|
$information->ic_photo,
|
|
|
|
|
$information->ic_photo_width,
|
|
|
|
|
$information->ic_photo_height,
|
|
|
|
|
$information->ic_recommend_tours,
|
|
|
|
|
$information->ic_recommend_packages,
|
|
|
|
|
$information->ic_ht_area_id,
|
|
|
|
|
$information->ic_ht_area_type,
|
|
|
|
|
$information->ic_ht_product_id,
|
|
|
|
|
$information->ic_ht_product_type,
|
|
|
|
|
$information->ic_author);
|
|
|
|
|
|
|
|
|
|
$this->echo_json(array(
|
|
|
|
|
'status' => 'ok',
|
|
|
|
|
'infoId' => $info_id,
|
|
|
|
|
'message' => 'success',
|
|
|
|
|
'date' => date('Y-m-d h:i:s')
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function echo_json($obj) {
|
|
|
|
|
$this->output
|
|
|
|
|
->set_content_type('application/json')
|
|
|
|
|
->set_output(json_encode($obj));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function check_url($subject) {
|
|
|
|
|
$result = $subject;
|
|
|
|
|
$check_rules = array(
|
|
|
|
|
'/^\/image\/(.*)/' => '//images.chinahighlights.com/image/',
|
|
|
|
|
'/^http:\/\/images.chinahighlights.com(.*)/' => '//images.chinahighlights.com',
|
|
|
|
|
'/^http:\/\/data.chinahighlights.com(.*)/' => '//data.chinahighlights.com',
|
|
|
|
|
'/^http:\/\/www.chinahighlights.com(.*)/' => '//www.chinahighlights.com');
|
|
|
|
|
|
|
|
|
|
foreach ($check_rules as $pattern => $replace) {
|
|
|
|
|
// echo 'key: '.$pattern.'; val: '.$replace.'</br>';
|
|
|
|
|
$result = $this->replace_url($pattern, $replace, $result);
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function replace_url($pattern, $replace, $subject) {
|
|
|
|
|
$result = $subject;
|
|
|
|
|
$match_result = array();
|
|
|
|
|
preg_match($pattern, $subject, $match_result);
|
|
|
|
|
$result_count = count($match_result);
|
|
|
|
|
if ($result_count == 2) {
|
|
|
|
|
$result = $replace.$match_result[1];
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生肖促销订单查询
|
|
|
|
|
public function coupon() {
|
|
|
|
|
$data['countryList'] = $this->Area_model->get_country_list();
|
|
|
|
|
$data['provinceList'] = $this->Area_model->get_province_list();
|
|
|
|
|
$data['city_list'] = $this->Area_model->get_municipalities_list();
|
|
|
|
|
$data['coupon'] = $this->Coupon_model->getlist();
|
|
|
|
|
|
|
|
|
|
$this->load->view('bootstrap/header', $data);
|
|
|
|
|
$this->load->view('bootstrap/welcome');
|
|
|
|
|
$this->load->view('bootstrap/footer');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function set_path($is_id, $parent_path = '') {
|
|
|
|
|
$parent_path = str_replace('-', ',', $parent_path);
|
|
|
|
|
$parent_path = trim($parent_path, ',');
|
|
|
|
|
if ($parent_path != '')
|
|
|
|
|
$parent_path.=',';
|
|
|
|
|
$this->load->model('Import_model');
|
|
|
|
|
$this->Import_model->set_path($is_id, $parent_path);
|
|
|
|
|
echo 'ok';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function search_by_icid() {
|
|
|
|
|
$ic_id_list = $this->input->post('ic_id_list');
|
|
|
|
|
$ic_id_list = rtrim(trim($ic_id_list), ',') . ',';
|
|
|
|
|
$this->load->model('InfoContents_model');
|
|
|
|
|
$data['search_list'] = $this->InfoContents_model->get_ic_contents_by_list($ic_id_list);
|
|
|
|
|
$data['search_type'] = 'recommended';
|
|
|
|
|
$this->load->view('bootstrap3/recommendlist', $data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|