本文整理汇总了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);
}
示例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;
}