html_category.inc.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. //decode by http://dezend.qiling.org QQ 2859470
  3. if (is_array($information_catid)) {
  4. $submit = in_array($submit, array('一键更新HTML', '开始生成html', '更新主页html', 'makehtml', '开始生成')) ? 'makehtml' : 'delhtml';
  5. $part == 'category' && $timer->start();
  6. $page_start = !$page_start ? 1 : intval($page_start);
  7. $page_end = isset($page_end) ? intval($page_end) : '';
  8. foreach ($information_catid as $k => $v) {
  9. $catid = $v;
  10. $html_make_row = $db->getRow('SELECT html_dir,catname,template FROM `' . $db_mymps . 'category` WHERE catid = \'' . $v . '\'');
  11. $total = iszero(ceil(mymps_count('information', 'WHERE catid in (' . get_cat_children($v, 'category') . ')') / 15));
  12. $pend = $total < $page_end || empty($page_end) ? $total : $page_end;
  13. $pend < $page_start && exit('当前生成 ' . $row[catname] . ',起始页码为 ' . $page_start . ' ,终页码为 ' . $page_end . ',起始页码不能小于终页码');
  14. for ($page = $page_start; $page <= $pend; $page++) {
  15. $areaid = 0;
  16. $submit == 'makehtml' && (include MYMPS_ASS . '/info_list.php');
  17. $cat = NULL;
  18. $filepath = $seo['seo_htmldir'] . $html_make_row['html_dir'] . 'list_' . $page . $seo['seo_htmlext'];
  19. $indexpath = $seo['seo_htmldir'] . $html_make_row['html_dir'] . 'index' . $seo['seo_htmlext'];
  20. if ($submit == 'makehtml') {
  21. $html_c = $smarty->fetch(mymps_tpl($html_make_row['template'] ? $html_make_row['template'] : 'list', 'smarty'), $v . $page);
  22. $html_m = $smarty->MakeHtmlFile(MYMPS_ROOT . $filepath, $html_c);
  23. echo inner('信息栏目 [' . $html_make_row[catname] . '] ' . $filepath . ' 生成成功!');
  24. if ($page == 1) {
  25. echo copy(MYMPS_ROOT . $filepath, MYMPS_ROOT . $indexpath) ? inner('成功复制' . $filepath . '为' . $indexpath . '!') : inner('复制' . $filepath . '为' . $indexpath . '失败!');
  26. }
  27. } else {
  28. if ($submit == 'delhtml' && $filepath) {
  29. @unlink(MYMPS_ROOT . $filepath);
  30. echo inner('信息栏目 [' . $html_make_row[catname] . '] ' . $filepath . ' 删除成功!');
  31. if ($page == 1) {
  32. @unlink(MYMPS_ROOT . $indexpath);
  33. echo inner('成功删除' . $indexpath . '!');
  34. }
  35. }
  36. }
  37. }
  38. ob_flush();
  39. flush();
  40. }
  41. if ($part == 'category') {
  42. $timer->stop();
  43. echo '<br /><br />共耗时:' . $timer->spent();
  44. }
  45. } else {
  46. exit(inner('您还没有指定需要生成的页面!'));
  47. }