diff --git a/application/controllers/welcome.php b/application/controllers/welcome.php
index 65c79fb0..8ae656db 100644
--- a/application/controllers/welcome.php
+++ b/application/controllers/welcome.php
@@ -66,27 +66,23 @@ class Welcome extends CI_Controller {
}
//获取所有信息URL,用来批量静态化更新
- public function create_all_urls() {
+ public function create_all_urls($view=false) {
set_time_limit(0);
$this->output->enable_profiler(false);
- $data['all_information'] = $this->Information_model->GetList('ic_status,ic_url,ic_sitecode');
- $this->load->view('bootstrap/header', $data);
- $this->load->view('bootstrap/cache_url', $data);
- $this->load->view('bootstrap/footer');
- }
-
- //获取所有信息URL,用来批量静态化更新
- public function create_all_amp_urls() {
- set_time_limit(0);
- $this->output->enable_profiler(false);
- $data['all_information'] = $this->Information_model->GetList('ic_id,ic_status,ic_url,ic_sitecode');
- $this->load->view('bootstrap3/header', $data);
- $this->load->view('bootstrap3/refresh_amp_urls');
- $this->load->view('bootstrap3/footer');
+ $data['all_information'] = $this->Information_model->GetList('ic_status,ic_id,ic_url,ic_sitecode');
+ if ($view == 'amp') {
+ $this->load->view('bootstrap3/header', $data);
+ $this->load->view('bootstrap3/refresh_amp_urls');
+ $this->load->view('bootstrap3/footer');
+ } else {
+ $this->load->view('bootstrap/header', $data);
+ $this->load->view('bootstrap/cache_url', $data);
+ $this->load->view('bootstrap/footer');
+ }
}
//获取某个信息节点和子节点url
- public function create_infomation_urls($is_parent_id) {
+ public function create_infomation_urls($is_parent_id, $view = false) {
$this->output->enable_profiler(FALSE);
$structure = $this->InfoStructures_model->Detail($is_parent_id);
if (empty($structure)) {
@@ -94,9 +90,15 @@ class Welcome extends CI_Controller {
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');
+ if ($view == 'amp') {
+ $this->load->view('bootstrap3/header', $data);
+ $this->load->view('bootstrap3/refresh_amp_urls');
+ $this->load->view('bootstrap3/footer');
+ } else {
+ $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) {
@@ -117,37 +119,37 @@ class Welcome extends CI_Controller {
$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
- ));
+ '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
- ));
+ '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';
+ $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'
- ));
+ 'status' => 'error',
+ 'infoId' => $info_id,
+ 'message' => 'info content is empty'
+ ));
return;
}
$htm_doc->loadHTML(
- mb_convert_encoding($information->ic_content, 'HTML-ENTITIES', 'UTF-8'));
+ mb_convert_encoding($information->ic_content, 'HTML-ENTITIES', 'UTF-8'));
$htm_doc->normalizeDocument();
$img_list = $htm_doc->getElementsByTagName('img');
foreach ($img_list as $img) {
@@ -159,15 +161,15 @@ class Welcome extends CI_Controller {
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
$a_href = $anchor->getAttribute('href');
- echo 'a.href: '.$a_href.'
';
+ echo 'a.href: ' . $a_href . '
';
$match_result = array();
preg_match('/^http:\/\/www.chinahighlights.com(.*)/', $a_href, $match_result);
$result_count = count($match_result);
if ($result_count == 2) {
- $result = '//www.chinahighlights.com'.$match_result[1];
+ $result = '//www.chinahighlights.com' . $match_result[1];
$anchor->setAttribute('href', $result);
- echo $result.'
';
+ echo $result . '
';
}
}
@@ -196,7 +198,6 @@ class Welcome extends CI_Controller {
// $information->ic_ht_product_id,
// $information->ic_ht_product_type,
// $information->ic_author);
-
// $this->echo_json(array(
// 'status' => 'ok',
// 'infoId' => $info_id,
@@ -206,17 +207,16 @@ class Welcome extends CI_Controller {
}
public function count_redirect_nofollow() {
- $include_redirece_info =
- $this->Information_model->search_all_text('&t=78002', 2000);
- echo 'redirect count: '.count($include_redirece_info).'
';
+ $include_redirece_info = $this->Information_model->search_all_text('&t=78002', 2000);
+ echo 'redirect count: ' . count($include_redirece_info) . '
';
$redirect_nofollow_list = array();
$htm_doc = new DOMDocument();
- $htm_doc->encoding='UTF-8';
+ $htm_doc->encoding = 'UTF-8';
libxml_use_internal_errors(true);
$htm_doc->strictErrorChecking = false;
foreach ($include_redirece_info as $info) {
$htm_doc->loadHTML(
- mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8'));
+ mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8'));
$htm_doc->normalizeDocument();
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
@@ -227,166 +227,97 @@ class Welcome extends CI_Controller {
preg_match('/.*&t=78002$/', $a_href, $match_result);
$result_count = count($match_result);
if ($result_count > 0 && $a_rel != 'nofollow') {
- echo $info->ic_url.' | '.'('.$info->ic_id.','.$info->is_id.')'.'
';
- echo 'a.href: '.$a_href.'; rel: '.$a_rel.'
';
+ echo $info->ic_url . ' | ' . '(' . $info->ic_id . ',' . $info->is_id . ')' . '
';
+ echo 'a.href: ' . $a_href . '; rel: ' . $a_rel . '
';
$redirect_nofollow_list[] = $info;
}
}
}
- echo 'nofollow_count: '.count($redirect_nofollow_list).'
';
+ echo 'nofollow_count: ' . count($redirect_nofollow_list) . '
';
return $redirect_nofollow_list;
}
public function transform_redirect_nofollow() {
$redirect_nofollow_list = $this->count_redirect_nofollow();
$htm_doc = new DOMDocument();
- $htm_doc->encoding='UTF-8';
+ $htm_doc->encoding = 'UTF-8';
libxml_use_internal_errors(true);
$htm_doc->strictErrorChecking = false;
foreach ($redirect_nofollow_list as $info) {
$htm_doc->loadHTML(
- mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8'));
+ mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8'));
$htm_doc->normalizeDocument();
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
$a_rel = $anchor->getAttribute('rel');
- $anchor->setAttribute('rel', 'nofollow');
+ $anchor->setAttribute('rel', 'nofollow');
$this->Logs_model->backup($info->is_id, $info->ic_content);
$info->ic_content = $htm_doc->saveHTML();
$this->InfoContents_model->Update(
- $info->ic_id,
- $info->ic_url,
- $info->ic_url_title,
- $info->ic_type,
- $info->ic_title,
- $info->ic_content,
- $info->ic_summary,
- $info->ic_seo_title,
- $info->ic_seo_description,
- $info->ic_seo_keywords,
- $info->ic_show_bread_crumbs,
- $info->ic_status,
- $info->ic_template,
- $info->ic_photo,
- $info->ic_photo_width,
- $info->ic_photo_height,
- $info->ic_recommend_tours,
- $info->ic_recommend_packages,
- $info->ic_ht_area_id,
- $info->ic_ht_area_type,
- $info->ic_ht_product_id,
- $info->ic_ht_product_type,
- $info->ic_author);
+ $info->ic_id, $info->ic_url, $info->ic_url_title, $info->ic_type, $info->ic_title, $info->ic_content, $info->ic_summary, $info->ic_seo_title, $info->ic_seo_description, $info->ic_seo_keywords, $info->ic_show_bread_crumbs, $info->ic_status, $info->ic_template, $info->ic_photo, $info->ic_photo_width, $info->ic_photo_height, $info->ic_recommend_tours, $info->ic_recommend_packages, $info->ic_ht_area_id, $info->ic_ht_area_type, $info->ic_ht_product_id, $info->ic_ht_product_type, $info->ic_author);
}
}
-
- echo 'update_nofollow_count: '.count($redirect_nofollow_list).'
';
+
+ echo 'update_nofollow_count: ' . count($redirect_nofollow_list) . '
';
}
public function count_http_of_href() {
- $data['all_information'] =
- $this->Information_model->search_all_text('http://www.chinahighlights.com/', 2000);
- echo 'count: '.count($data['all_information']).'
';
+ $data['all_information'] = $this->Information_model->search_all_text('http://www.chinahighlights.com/', 2000);
+ echo 'count: ' . count($data['all_information']) . '
';
var_dump($data['all_information']);
}
public function transform_href_to_https() {
$http_host = 'http://www.chinahighlights.com/';
- $https_host = 'https://www.chinahighlights.com/';
- $data['all_information'] =
- $this->Information_model->search_all_text($http_host, 200);
- echo 'count: '.count($data['all_information']).'
';
+ $https_host = 'https://www.chinahighlights.com/';
+ $data['all_information'] = $this->Information_model->search_all_text($http_host, 200);
+ echo 'count: ' . count($data['all_information']) . '
';
if (empty($data['all_information'])) {
echo 'nothing transform to https';
- } else {
- foreach ($data['all_information'] as $item) {
+ } else {
+ foreach ($data['all_information'] as $item) {
- if (empty($item->ic_url)) {
- echo '['.$item->ic_title .'] ['.$item->ic_url.']
';
+ if (empty($item->ic_url)) {
+ echo '[' . $item->ic_title . '] [' . $item->ic_url . ']
';
continue;
} else {
- echo $item->ic_url.' | '.$item->ic_title.'
';
+ echo $item->ic_url . ' | ' . $item->ic_title . '
';
}
$this->Logs_model->backup($item->is_id, $item->ic_content);
- $item->ic_content=str_replace($http_host, $https_host, $item->ic_content);
- $this->InfoContents_model->Update(
- $item->ic_id,
- $item->ic_url,
- $item->ic_url_title,
- $item->ic_type,
- $item->ic_title,
- $item->ic_content,
- $item->ic_summary,
- $item->ic_seo_title,
- $item->ic_seo_description,
- $item->ic_seo_keywords,
- $item->ic_show_bread_crumbs,
- $item->ic_status,
- $item->ic_template,
- $item->ic_photo,
- $item->ic_photo_width,
- $item->ic_photo_height,
- $item->ic_recommend_tours,
- $item->ic_recommend_packages,
- $item->ic_ht_area_id,
- $item->ic_ht_area_type,
- $item->ic_ht_product_id,
- $item->ic_ht_product_type,
- $item->ic_author
- );
- }
+ $item->ic_content = str_replace($http_host, $https_host, $item->ic_content);
+ $this->InfoContents_model->Update(
+ $item->ic_id, $item->ic_url, $item->ic_url_title, $item->ic_type, $item->ic_title, $item->ic_content, $item->ic_summary, $item->ic_seo_title, $item->ic_seo_description, $item->ic_seo_keywords, $item->ic_show_bread_crumbs, $item->ic_status, $item->ic_template, $item->ic_photo, $item->ic_photo_width, $item->ic_photo_height, $item->ic_recommend_tours, $item->ic_recommend_packages, $item->ic_ht_area_id, $item->ic_ht_area_type, $item->ic_ht_product_id, $item->ic_ht_product_type, $item->ic_author
+ );
+ }
}
}
private function echo_json($obj) {
$this->output
- ->set_content_type('application/json')
- ->set_output(json_encode($obj));
+ ->set_content_type('application/json')
+ ->set_output(json_encode($obj));
}
-
- //批量替换二级域名,如图片或者data域名
- function replace_hostname($topnum){
- $data=array();
- $find_host='http://data.chinarundreisen.com/'; //http://bilder.chinarundreisen.com/
- $new_host='//data.chinarundreisen.com/';
- $data['all_information'] = $this->Information_model->search_all_text($find_host,$topnum);
- if($data['all_information']){
- foreach($data['all_information'] as $item){
- echo $item->ic_url.'
';
- $item->ic_content=str_replace($find_host, $new_host,$item->ic_content);
- $this->InfoContents_model->Update(
- $item->ic_id,
- $item->ic_url,
- $item->ic_url_title,
- $item->ic_type,
- $item->ic_title,
- $item->ic_content,
- $item->ic_summary,
- $item->ic_seo_title,
- $item->ic_seo_description,
- $item->ic_seo_keywords,
- $item->ic_show_bread_crumbs,
- $item->ic_status,
- $item->ic_template,
- $item->ic_photo,
- $item->ic_photo_width,
- $item->ic_photo_height,
- $item->ic_recommend_tours,
- $item->ic_recommend_packages,
- $item->ic_ht_area_id,
- $item->ic_ht_area_type,
- $item->ic_ht_product_id,
- $item->ic_ht_product_type,
- $item->ic_author
- );
- }
- }else{
- echo 'all done';
- }
- }
+ //批量替换二级域名,如图片或者data域名
+ function replace_hostname($topnum) {
+ $data = array();
+ $find_host = 'http://data.chinarundreisen.com/'; //http://bilder.chinarundreisen.com/
+ $new_host = '//data.chinarundreisen.com/';
+ $data['all_information'] = $this->Information_model->search_all_text($find_host, $topnum);
+ if ($data['all_information']) {
+ foreach ($data['all_information'] as $item) {
+ echo $item->ic_url . '
';
+ $item->ic_content = str_replace($find_host, $new_host, $item->ic_content);
+ $this->InfoContents_model->Update(
+ $item->ic_id, $item->ic_url, $item->ic_url_title, $item->ic_type, $item->ic_title, $item->ic_content, $item->ic_summary, $item->ic_seo_title, $item->ic_seo_description, $item->ic_seo_keywords, $item->ic_show_bread_crumbs, $item->ic_status, $item->ic_template, $item->ic_photo, $item->ic_photo_width, $item->ic_photo_height, $item->ic_recommend_tours, $item->ic_recommend_packages, $item->ic_ht_area_id, $item->ic_ht_area_type, $item->ic_ht_product_id, $item->ic_ht_product_type, $item->ic_author
+ );
+ }
+ } else {
+ echo 'all done';
+ }
+ }
private function check_url($subject) {
$result = $subject;
@@ -410,7 +341,7 @@ class Welcome extends CI_Controller {
preg_match($pattern, $subject, $match_result);
$result_count = count($match_result);
if ($result_count == 2) {
- $result = $replace.$match_result[1];
+ $result = $replace . $match_result[1];
}
return $result;
}
@@ -431,7 +362,7 @@ class Welcome extends CI_Controller {
$parent_path = str_replace('-', ',', $parent_path);
$parent_path = trim($parent_path, ',');
if ($parent_path != '')
- $parent_path.=',';
+ $parent_path .= ',';
$this->load->model('Import_model');
$this->Import_model->set_path($is_id, $parent_path);
echo 'ok';
diff --git a/application/views/bootstrap/welcome.php b/application/views/bootstrap/welcome.php
index 13137544..d2bca395 100644
--- a/application/views/bootstrap/welcome.php
+++ b/application/views/bootstrap/welcome.php
@@ -42,7 +42,7 @@