html_news.inc.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. //decode by http://dezend.qiling.org QQ 2859470
  3. $cat = NULL;
  4. $submit = in_array($submit, array('一键更新HTML', '开始生成html', '更新主页html', 'makehtml', '开始生成')) ? 'makehtml' : 'delhtml';
  5. if ($if_save == 'yes' && !empty($html_style)) {
  6. mymps_delete('config', 'WHERE description = \'glb_html_news\'');
  7. $db->query('INSERT INTO `' . $db_mymps . 'config` (description,value) VALUES (\'glb_html_news\',\'' . $html_style . '\')');
  8. update_config_cache();
  9. }
  10. $part == 'news' && $timer->start();
  11. $cat_limit = '';
  12. $end_limit = !empty($endid) ? 'AND id <= \'' . $endid . '\'' : '';
  13. $start_limit = !empty($startid) ? 'AND id >= \'' . $startid . '\'' : '';
  14. if (is_array($news_catid)) {
  15. foreach ($news_catid as $htmlkey => $htmlval) {
  16. $htmlnews_catid .= $htmlval . ',';
  17. }
  18. $htmlnews_catid = substr($htmlnews_catid, 0, -1);
  19. $cat_limit = 'AND catid IN(' . $htmlnews_catid . ')';
  20. }
  21. $htmlnews_ids = $db->getAll('SELECT id,html_path FROM ' . $db_mymps . 'news WHERE isjump = \'0\' ' . $cat_limit . ' ' . $start_limit . ' ' . $end_limit);
  22. foreach ($htmlnews_ids as ${$htmlnews_idkey} => $htmlnews_idval) {
  23. $id = $htmlnews_idval['id'];
  24. $newshtmlpath = $htmlnews_idval['html_path'];
  25. $submit == 'makehtml' && (include MYMPS_ASS . '/news.php');
  26. $filepath = empty($newshtmlpath) ? $seo['seo_htmldir'] . $seo['seo_htmlnewsdir'] . replace_html_style($mymps_global['glb_html_news'], $id) : $newshtmlpath;
  27. if ($submit == 'makehtml') {
  28. $html_c = $smarty->fetch(mymps_tpl('news', 'smarty'));
  29. $html_m = $smarty->MakeHtmlFile(MYMPS_ROOT . $filepath, $html_c);
  30. $db->query('UPDATE `' . $db_mymps . 'news` SET html_path = \'' . $filepath . '\' WHERE id = \'' . $id . '\'');
  31. echo inner('新闻<a href="' . $filepath . '" target="_blank">' . $filepath . '</a> 生成成功!');
  32. } else {
  33. if ($submit == 'delhtml' && !empty($filepath)) {
  34. @unlink(MYMPS_ROOT . $filepath);
  35. echo inner('新闻<a href="' . $filepath . '" target="_blank">' . $filepath . '</a> 删除成功!');
  36. }
  37. }
  38. ob_flush();
  39. flush();
  40. }
  41. if ($part == 'news') {
  42. $timer->stop();
  43. echo '<br /><br />共耗时:' . $timer->spent();
  44. }