当前位置: 首页>>代码示例>>PHP>>正文


PHP FreePBX::Sysadmin方法代码示例

本文整理汇总了PHP中FreePBX::Sysadmin方法的典型用法代码示例。如果您正苦于以下问题:PHP FreePBX::Sysadmin方法的具体用法?PHP FreePBX::Sysadmin怎么用?PHP FreePBX::Sysadmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FreePBX的用法示例。


在下文中一共展示了FreePBX::Sysadmin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendPassResetEmail

 /**
  * Sends a password reset email
  * @param {int} $id The userid
  */
 public function sendPassResetEmail($id)
 {
     global $amp_conf;
     $user = $this->getUserByID($id);
     if (empty($user) || empty($user['email'])) {
         return false;
     }
     $token = $this->Userman->generatePasswordResetToken($id);
     if (empty($token)) {
         return false;
     }
     $user['token'] = $token['token'];
     $user['brand'] = $this->brand;
     $user['host'] = 'http://' . $_SERVER["SERVER_NAME"];
     $user['link'] = $user['host'] . "/ucp/?forgot=" . $user['token'];
     $user['valid'] = date("h:i:s A", $token['valid']);
     $ports = array();
     if ($this->FreePBX->Modules->moduleHasMethod("sysadmin", "getPorts")) {
         $ports = \FreePBX::Sysadmin()->getPorts();
     } else {
         if (!function_exists('sysadmin_get_portmgmt') && $this->FreePBX->Modules->checkStatus('sysadmin') && file_exists($this->FreePBX->Config()->get('AMPWEBROOT') . '/admin/modules/sysadmin/functions.inc.php')) {
             include $this->FreePBX->Config()->get('AMPWEBROOT') . '/admin/modules/sysadmin/functions.inc.php';
         }
         if (function_exists('sysadmin_get_portmgmt')) {
             $ports = sysadmin_get_portmgmt();
         }
     }
     if (!empty($ports['ucp'])) {
         $user['host'] = $user['host'] . ":" . $ports['ucp'];
         $user['link'] = $user['host'] . "/?forgot=" . $user['token'];
     }
     $template = file_get_contents(__DIR__ . '/views/emails/reset_text.tpl');
     preg_match_all('/%([\\w|\\d]*)%/', $template, $matches);
     foreach ($matches[1] as $match) {
         $replacement = !empty($user[$match]) ? $user[$match] : '';
         $template = str_replace('%' . $match . '%', $replacement, $template);
     }
     $this->Userman->sendEmail($user['id'], $this->brand . " password reset", $template);
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:43,代码来源:Ucp.class.php

示例2: getSvc_restapps

 private function getSvc_restapps()
 {
     $retarr = array("name" => _("REST Apps"), "defzones" => array("internal"), "descr" => _("Text for REST Apps not done..."), "fw" => array(array("protocol" => "tcp", "port" => 85)));
     // TODO: This is not portable for machines that don't have sysadmin.
     // Ask sysadmin for the REAL port of the admin interface
     try {
         $ports = \FreePBX::Sysadmin()->getPorts();
         $retarr['fw'][0]['port'] = $ports['restapps'];
     } catch (\Exception $e) {
         // ignore
     }
     return $retarr;
 }
开发者ID:ntadmin,项目名称:firewall,代码行数:13,代码来源:Services.class.php


注:本文中的FreePBX::Sysadmin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。