国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.7KB

  1. <?php
  2. /**
  3. *
  4. * 信息推荐
  5. *
  6. * @version $Id: recommend.php$
  7. * @package DedeCMS.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. {
  26. if($type=='sys'){
  27. //读取文档信息
  28. $arcRow = GetOneArchive($aid);
  29. if($arcRow['aid']=='')
  30. {
  31. ShowMsg("无法把未知文档推荐给好友!","-1");
  32. exit();
  33. }
  34. extract($arcRow, EXTR_OVERWRITE);
  35. } else {
  36. $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'");
  37. if(!is_array($arcRow)){
  38. ShowMsg("无法把未知文档推荐给好友!","-1");
  39. exit();
  40. }
  41. $arcRow['arcurl']=$arcRow['indexurl']."=".$arcRow['aid'];
  42. extract($arcRow, EXTR_OVERWRITE);
  43. }
  44. }
  45. //发送推荐信息
  46. else if($action=='send')
  47. {
  48. if(!CheckEmail($email))
  49. {
  50. echo "<script>alert('Email格式不正确!');history.go(-1);</script>";
  51. exit();
  52. }
  53. $mailbody = '';
  54. $msg = dede_htmlspecialchars($msg);
  55. $mailtitle = "你的好友给你推荐了一篇文章";
  56. $mailbody .= "$msg \r\n\r\n";
  57. $mailbody .= "Power by http://www.dedecms.com 织梦内容管理系统!";
  58. $headers = "From: ".$cfg_adminemail."\r\nReply-To: ".$cfg_adminemail;
  59. if($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server))
  60. {
  61. $mailtype = 'TXT';
  62. require_once(DEDEINC.'/mail.class.php');
  63. $smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password);
  64. $smtp->debug = false;
  65. $smtp->sendmail($email,$cfg_webname,$cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
  66. }
  67. else
  68. {
  69. @mail($email, $mailtitle, $mailbody, $headers);
  70. }
  71. ShowMsg("成功推荐一篇文章!",$arcurl);
  72. exit();
  73. }
  74. $arcRow = GetOneArchive($aid);
  75. if($arcRow['aid']=='')
  76. {
  77. ShowMsg("无法把未知文档推荐给好友!","-1");
  78. exit();
  79. }
  80. extract($arcRow, EXTR_OVERWRITE);
  81. //显示模板(简单PHP文件)
  82. include(DEDETEMPLATE.'/plus/recommend.htm');