control.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * The control file of conference module of XXB.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd., www.zentao.net)
  6. * @license ZOSL (https://zpl.pub/page/zoslv1.html)
  7. * @author Wenrui LI <liwenrui@easycorp.ltd>
  8. * @package conference
  9. * @version $Id$
  10. * @link https://xuanim.com
  11. */
  12. ?>
  13. <?php
  14. class conference extends control
  15. {
  16. /**
  17. * @var conferenceModel
  18. */
  19. public $conference;
  20. /**
  21. * View and set jitsi configuration.
  22. *
  23. * @param string $type type could be 'server', 'video', 'edit'
  24. * @access public
  25. * @return void
  26. */
  27. public function admin($type = 'server')
  28. {
  29. if(!empty($_POST))
  30. {
  31. $domain = $_POST['domain'];
  32. /**
  33. * 匹配是否是域名+端口的形式
  34. * www.example.com:8080
  35. * www.example.com
  36. * 127.0.0.1:8080
  37. * 127.0.0.1
  38. * @var bool $isMatch
  39. */
  40. $re = '/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9](?:\:\d+)?$/';
  41. preg_match($re, $domain, $matches, PREG_OFFSET_CAPTURE, 0);
  42. if(empty($matches) && !empty($domain)) {
  43. $parsedUrl = parse_url($domain);
  44. if($parsedUrl !== false)
  45. {
  46. $domain = $parsedUrl['host'] . ($parsedUrl['port'] ? ':' . $parsedUrl['port'] : '');
  47. }
  48. }
  49. $_POST['domain'] = $domain;
  50. $result = $this->conference->setConfiguration($_POST);
  51. $this->send($result);
  52. }
  53. $conferenceConfig = $this->conference->getConfiguration();
  54. $this->view->title = $this->lang->conference->common;
  55. $this->view->type = $type;
  56. $this->view->enabled = isset($conferenceConfig->enabled) && $conferenceConfig->enabled == 'true';
  57. $this->view->domain = isset($conferenceConfig->domain) ? $conferenceConfig->domain : '';
  58. $this->display();
  59. }
  60. /**
  61. * Get conference permissions.
  62. *
  63. * @access public
  64. * @return void
  65. */
  66. public function getConferencePermissions()
  67. {
  68. return $this->conference->getConferencePermissions();
  69. }
  70. }