html_channel.inc.php 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. //decode by http://dezend.qiling.org QQ 2859470
  3. @(include MYMPS_DATA . '/caches/plugin.php');
  4. $pluginsettings = $data;
  5. unset($data);
  6. $cat = NULL;
  7. $submit = in_array($submit, array('一键更新HTML', '开始生成html', '更新主页html', 'makehtml', '开始生成')) ? 'makehtml' : 'delhtml';
  8. if (is_array($news_catid)) {
  9. $part == 'channel' && $timer->start();
  10. $page_start = !$page_start ? 1 : intval($page_start);
  11. $page_end = isset($page_end) ? intval($page_end) : '';
  12. foreach ($news_catid as $k => $v) {
  13. $catid = $v;
  14. if ($v == 0) {
  15. $submit == 'makehtml' && (include MYMPS_ASS . '/news_index.php');
  16. $filepath = $seo[seo_htmldir] . $seo[seo_htmlnewsdir] . '/index' . $seo[seo_htmlext];
  17. if ($submit == 'makehtml') {
  18. $html_c = $smarty->fetch(mymps_tpl('news_index', 'smarty'));
  19. $html_m = $smarty->MakeHtmlFile(MYMPS_ROOT . $filepath, $html_c);
  20. echo inner('新闻首页 ' . $filepath . ' 生成成功! <a href="' . $filepath . '" target="_blank">点击此处浏览该文件</a>');
  21. } else {
  22. if ($submit == 'delhtml') {
  23. @unlink(MYMPS_ROOT . $filepath);
  24. echo inner('新闻首页' . $filepath . ' 删除成功!');
  25. }
  26. }
  27. ob_flush();
  28. flush();
  29. } else {
  30. $html_make_row = $db->getRow('SELECT html_dir,catname FROM `' . $db_mymps . 'channel` WHERE catid = \'' . $v . '\'');
  31. $catid = $v;
  32. $total = iszero(ceil(mymps_count('news', 'WHERE catid in (' . get_cat_children($v, 'channel') . ')') / $mymps_global['cfg_page_line']));
  33. $pend = $total < $page_end || empty($page_end) ? $total : $page_end;
  34. $pend < $page_start && exit('当前生成 ' . $row[catname] . ',起始页码为 ' . $page_start . ' ,终页码为 ' . $page_end . ',起始页码不能小于终页码');
  35. for ($page = $page_start; $page <= $pend; $page++) {
  36. $submit == 'makehtml' && (include MYMPS_ASS . '/news_list.php');
  37. $filepath = $seo['seo_htmldir'] . $seo['seo_htmlnewsdir'] . $html_make_row['html_dir'] . 'list_' . $page . $seo[seo_htmlext];
  38. $indexpath = $seo['seo_htmldir'] . $seo['seo_htmlnewsdir'] . $html_make_row['html_dir'] . 'index' . $seo[seo_htmlext];
  39. if ($submit == 'makehtml') {
  40. $html_c = $smarty->fetch(mymps_tpl('news_list', 'smarty'));
  41. $html_m = $smarty->MakeHtmlFile(MYMPS_ROOT . $filepath, $html_c);
  42. echo inner('新闻栏目 [' . $html_make_row[catname] . '] ' . $filepath . ' 生成成功!');
  43. } else {
  44. if ($submit == 'delhtml' && $filepath) {
  45. @unlink(MYMPS_ROOT . $filepath);
  46. echo inner('新闻栏目 [' . $html_make_row[catname] . '] ' . $filepath . ' 删除成功!');
  47. }
  48. }
  49. if ($page == 1) {
  50. if ($submit == 'makehtml') {
  51. echo copy(MYMPS_ROOT . $filepath, MYMPS_ROOT . $indexpath) ? inner('成功复制' . $filepath . '为' . $indexpath . '!') : inner('复制' . $filepath . '为' . $indexpath . '失败!');
  52. $db->query('UPDATE `' . $db_mymps . 'channel` SET htmlpath = \'' . $indexpath . '\' WHERE catid = \'' . $catid . '\'');
  53. } else {
  54. if ($submit == 'delhtml' && $indexpath) {
  55. @unlink(MYMPS_ROOT . $indexpath);
  56. echo inner($indexpath . '删除成功!');
  57. }
  58. }
  59. }
  60. }
  61. ob_flush();
  62. flush();
  63. }
  64. }
  65. if ($part == 'channel') {
  66. $timer->stop();
  67. echo '<br /><br />共耗时:' . $timer->spent();
  68. }
  69. } else {
  70. exit(inner('您还没有指定需要生成的页面!'));
  71. }
  72. $pluginsettings = NULL;