html_information.inc.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. //decode by http://dezend.qiling.org QQ 2859470
  3. if ($if_save == 'yes' && !empty($html_style)) {
  4. mymps_delete('config', 'WHERE description = \'glb_html_information\'');
  5. $db->query('INSERT INTO `' . $db_mymps . 'config` (description,value) VALUES (\'glb_html_information\',\'' . $html_style . '\')');
  6. update_config_cache();
  7. }
  8. $part == 'information' && $timer->start();
  9. $cat_limit = '';
  10. $end_limit = !empty($endid) ? 'AND id <= \'' . $endid . '\'' : '';
  11. $start_limit = !empty($startid) ? 'AND id >= \'' . $startid . '\'' : '';
  12. if (is_array($information_catid)) {
  13. foreach ($information_catid as $htmlkey => $htmlval) {
  14. $htmlinfo_catid .= $htmlval . ',';
  15. }
  16. $htmlinfo_catid = substr($htmlinfo_catid, 0, -1);
  17. $cat_limit = 'AND catid IN(' . $htmlinfo_catid . ')';
  18. }
  19. $htmlinfo_ids = $db->getAll('SELECT id,html_path FROM ' . $db_mymps . 'information WHERE info_level > \'0\' ' . $cat_limit . ' ' . $start_limit . ' ' . $end_limit);
  20. foreach ($htmlinfo_ids as ${$htmlinfo_idkey} => $htmlinfo_idval) {
  21. $id = $htmlinfo_idval['id'];
  22. $infohtmlpath = $htmlinfo_idval['html_path'];
  23. $template_info = $db->getOne('SELECT a.template_info FROM `' . $db_mymps . 'category` AS a LEFT JOIN `' . $db_mymps . 'information` AS b ON b.catid = a.catid WHERE b.id = \'' . $id . '\'');
  24. $submit = in_array($submit, array('一键更新HTML', '开始生成html', '更新主页html', 'makehtml', '开始生成')) ? 'makehtml' : 'delhtml';
  25. $submit == 'makehtml' && (include MYMPS_ASS . '/info.php');
  26. $filepath = empty($infohtmlpath) ? $seo['seo_htmldir'] . replace_html_style($mymps_global['glb_html_information'], $id) : $infohtmlpath;
  27. if ($submit == 'makehtml') {
  28. $html_c = $smarty->fetch(mymps_tpl($template_info ? $template_info : 'info_2', 'smarty'), $id);
  29. $html_m = $smarty->MakeHtmlFile(MYMPS_ROOT . $filepath, $html_c);
  30. $db->query('UPDATE `' . $db_mymps . 'information` 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 == 'information') {
  42. $timer->stop();
  43. echo '<br /><br />共耗时:' . $timer->spent();
  44. }