processor.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. class CoverModuleProcessor extends WeModuleProcessor {
  8. public function respond() {
  9. global $_W;
  10. $content = $this->message['content'];
  11. $reply = table('cover_reply')->where(array('rid' => $this->rule))->get();
  12. if (!empty($reply)) {
  13. load()->model('module');
  14. $module = module_fetch($reply['module']);
  15. if (empty($module) && !in_array($reply['module'], array('site', 'mc', 'card', 'page', 'clerk'))) {
  16. return '';
  17. }
  18. $url = $reply['url'];
  19. if (empty($reply['url'])) {
  20. $entry = table('modules_bindings')
  21. ->select('eid')
  22. ->where(array(
  23. 'module' => $reply['module'],
  24. 'do' => $reply['do']
  25. ))
  26. ->get();
  27. $url = url('entry', array('eid' => $entry['eid']));
  28. }
  29. $news = array();
  30. $news[] = array(
  31. 'title' => $reply['title'],
  32. 'description' => $reply['description'],
  33. 'picurl' => $reply['thumb'],
  34. 'url' => $url,
  35. );
  36. return $this->respNews($news);
  37. }
  38. return '';
  39. }
  40. }