magic_call.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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: magic_call.php 25246 2011-11-02 03:34:53Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class magic_call {
  12. var $version = '1.0';
  13. var $name = 'call_name';
  14. var $description = 'call_desc';
  15. var $price = '20';
  16. var $weight = '20';
  17. var $useevent = 0;
  18. var $targetgroupperm = false;
  19. var $copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>';
  20. var $magic = array();
  21. var $parameters = array();
  22. function getsetting(&$magic) {}
  23. function setsetting(&$magicnew, &$parameters) {}
  24. function usesubmit() {
  25. global $_G;
  26. $id = intval($_GET['id']);
  27. $idtype = $_GET['idtype'];
  28. $blog = magic_check_idtype($id, $idtype);
  29. $num = 10;
  30. $list = $ids = $note_inserts = array();
  31. $fusername = dimplode($_POST['fusername']);
  32. if($fusername) {
  33. $query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $_POST['fusername'], 0, $num);
  34. $note = lang('spacecp', 'magic_call', array('url'=>"home.php?mod=space&uid=$_G[uid]&do=blog&id=$id"));
  35. foreach($query as $value) {
  36. $ids[] = $value['fuid'];
  37. $value['avatar'] = str_replace("'", "\'", avatar($value[fuid],'small'));
  38. $list[] = $value;
  39. $note_inserts[] = array(
  40. 'uid' => $value['fuid'],
  41. 'type' => $name,
  42. 'new' => 1,
  43. 'authorid' => $_G['uid'],
  44. 'author' => $_G['username'],
  45. 'note' => $note,
  46. 'dateline' => $_G['timestamp']
  47. );
  48. }
  49. }
  50. if(empty($ids)) {
  51. showmessage('magicuse_has_no_valid_friend');
  52. }
  53. foreach($note_inserts as $note_insert) {
  54. C::t('home_notification')->insert($note_insert);
  55. }
  56. C::t('common_member')->increase($ids, array('newprompt' => 1));
  57. usemagic($this->magic['magicid'], $this->magic['num']);
  58. updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
  59. $op = 'show';
  60. include template('home/magic_call');
  61. }
  62. function show() {
  63. $id = intval($_GET['id']);
  64. $idtype = $_GET['idtype'];
  65. magic_check_idtype($id, $idtype);
  66. magicshowtips(lang('magic/call', 'call_info'));
  67. $op = 'use';
  68. include template('home/magic_call');
  69. }
  70. }
  71. ?>