Feed.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: Feed.php 25512 2011-11-14 02:31:42Z yexinhao $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class Cloud_Service_Server_Feed extends Cloud_Service_Server_Restful {
  12. protected static $_instance;
  13. public static function getInstance() {
  14. if (!(self::$_instance instanceof self)) {
  15. self::$_instance = new self();
  16. }
  17. return self::$_instance;
  18. }
  19. public function onFeedPublishTemplatizedAction($uId, $appId, $titleTemplate, $titleData, $bodyTemplate, $bodyData, $bodyGeneral = '', $image1 = '', $image1Link = '', $image2 = '', $image2Link = '', $image3 = '', $image3Link = '', $image4 = '', $image4Link = '', $targetIds = '', $privacy = '', $hashTemplate = '', $hashData = '', $specialAppid=0) {
  20. $res = $this->getUserSpace($uId);
  21. if (!$res) {
  22. return new Cloud_Service_Server_ErrorResponse('1', "User($uId) Not Exists");
  23. }
  24. $friend = ($privacy == 'public') ? 0 : ($privacy == 'friends' ? 1 : 2);
  25. $images = array($image1, $image2, $image3, $image4);
  26. $image_links = array($image1Link, $image2Link, $image3Link, $image4Link);
  27. require_once libfile('function/feed');
  28. $result = feed_add($appId, $titleTemplate, $titleData, $bodyTemplate, $bodyData, $bodyGeneral, $images, $image_links, $targetIds, $friend, $specialAppid, 1);
  29. return $result;
  30. }
  31. }