recommend.php 2.6 KB

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