share.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * CMS分享
  4. *
  5. *
  6. ***/
  7. defined('InShopNC') or exit('Access Invalid!');
  8. class shareControl extends CMSControl{
  9. public function __construct() {
  10. parent::__construct();
  11. }
  12. /**
  13. * 分享保存
  14. **/
  15. public function share_saveOp() {
  16. $data = array();
  17. $data['result'] = 'true';
  18. $share_id = intval($_POST['share_id']);
  19. $share_type = $_GET['type'];
  20. if($share_id <= 0 || empty($share_type) || mb_strlen($_POST['commend_message']) > 140) {
  21. showDialog(Language::get('wrong_argument'),'reload','fail','');
  22. }
  23. if(!empty($_SESSION['member_id'])) {
  24. $model = Model('cms_'.$share_type);
  25. $model->modify(array($share_type.'_share_count'=>array('exp',$share_type.'_share_count+1')),array($share_type.'_id'=>$share_id));
  26. //分享内容
  27. if(isset($_POST['share_app_items'])) {
  28. $info['commend_message'] = $_POST['commend_message'];
  29. $info['share_title'] = $_POST['share_title'];
  30. $info['share_image'] = $_POST['share_image'];
  31. if(empty($info['commend_message'])) {
  32. $info['commend_message'] = Language::get('share_text');
  33. }
  34. $info['url'] = CMS_SITE_URL.DS."index.php?act={$_GET['type']}&op={$_GET['type']}_detail&{$_GET['type']}_id=".$_POST['share_id'];
  35. self::share_app_publish($info);
  36. }
  37. showDialog(Language::get('nc_common_save_succ'),'','succ','');
  38. } else {
  39. showDialog(Language::get('no_login'),'reload','fail','');
  40. }
  41. }
  42. }