国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.7KB

  1. <?php
  2. /**
  3. *
  4. * 信息推荐
  5. *
  6. * @version $Id: recommend.php$
  7. * @package DedeBIZ.Site
  8. * @copyright Copyright (c) 2020, DedeBIZ.COM
  9. * @license https://www.dedebiz.com/license
  10. * @link https://www.dedebiz.com
  11. */
  12. require_once(dirname(__FILE__) . "/../include/common.inc.php");
  13. require_once(DEDEINC . "/channelunit.class.php");
  14. if (!isset($action)) $action = '';
  15. unset($_FILES);
  16. if (isset($arcID)) $aid = $arcID;
  17. $arcID = $aid = (isset($aid) && is_numeric($aid) ? $aid : 0);
  18. $type = (!isset($type) ? "" : $type);
  19. if (empty($aid)) {
  20. ShowMsg("文档ID不能为空!", "-1");
  21. exit();
  22. }
  23. //读取文档信息
  24. if ($action == '') {
  25. if ($type == 'sys') {
  26. //读取文档信息
  27. $arcRow = GetOneArchive($aid);
  28. if ($arcRow['aid'] == '') {
  29. ShowMsg("无法把未知文档推荐给好友!", "-1");
  30. exit();
  31. }
  32. extract($arcRow, EXTR_OVERWRITE);
  33. } else {
  34. $arcRow = $dsql->GetOne("SELECT s.*,t.* FROM `#@__member_stow` AS s LEFT JOIN `#@__member_stowtype` AS t ON s.type=t.stowname WHERE s.aid='$aid' AND s.type='$type'");
  35. if (!is_array($arcRow)) {
  36. ShowMsg("无法把未知文档推荐给好友!", "-1");
  37. exit();
  38. }
  39. $arcRow['arcurl'] = $arcRow['indexurl'] . "=" . $arcRow['aid'];
  40. extract($arcRow, EXTR_OVERWRITE);
  41. }
  42. }
  43. //发送推荐信息
  44. else if ($action == 'send') {
  45. if (!CheckEmail($email)) {
  46. echo "<script>alert('Email格式不正确!');history.go(-1);</script>";
  47. exit();
  48. }
  49. $mailbody = '';
  50. $msg = dede_htmlspecialchars($msg);
  51. $mailtitle = "你的好友给你推荐了一篇文章";
  52. $mailbody .= "$msg \r\n\r\n";
  53. $mailbody .= "Power by https://www.dedebiz.com DedeCMSV6内容管理系统!";
  54. $headers = "From: " . $cfg_adminemail . "\r\nReply-To: " . $cfg_adminemail;
  55. if ($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server)) {
  56. $mailtype = 'TXT';
  57. require_once(DEDEINC . '/mail.class.php');
  58. $smtp = new smtp($cfg_smtp_server, $cfg_smtp_port, true, $cfg_smtp_usermail, $cfg_smtp_password);
  59. $smtp->debug = false;
  60. $smtp->sendmail($email, $cfg_webname, $cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
  61. } else {
  62. @mail($email, $mailtitle, $mailbody, $headers);
  63. }
  64. ShowMsg("成功推荐一篇文章!", $arcurl);
  65. exit();
  66. }
  67. $arcRow = GetOneArchive($aid);
  68. if ($arcRow['aid'] == '') {
  69. ShowMsg("无法把未知文档推荐给好友!", "-1");
  70. exit();
  71. }
  72. extract($arcRow, EXTR_OVERWRITE);
  73. //显示模板(简单PHP文件)
  74. include(DEDETEMPLATE . '/plus/recommend.htm');