示例#1
0
            //--------------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------------
        case "custom":
            show_view(dirname(__FILE__) . '/views/trunks/custom.php', $displayvars);
            break;
        case "dundi":
            show_view(dirname(__FILE__) . '/views/trunks/dundi.php', $displayvars);
            break;
        case "pjsip":
            // displayvars is passed by reference, and may or may not be updated.
            FreePBX::create()->PJSip->getDisplayVars($extdisplay, $displayvars);
            show_view(dirname(__FILE__) . '/views/trunks/pjsip.php', $displayvars);
            break;
        case "iax":
        case "iax2":
        case "sip":
            $displayvars['peerdetails'] = $peerdetails;
            $displayvars['usercontext'] = $usercontext;
            $displayvars['userconfig'] = $userconfig;
            $displayvars['register'] = $register;
            $displayvars['peerdetails'] = $peerdetails;
            show_view(dirname(__FILE__) . '/views/trunks/sip.php', $displayvars);
            break;
        default:
            break;
    }
    // implementation of module hook
    $module_hook == moduleHook::create();
    echo $module_hook->hookHtml;
    show_view(dirname(__FILE__) . '/views/trunks/trunk_footer.php', $displayvars);
}
示例#2
0
 public function myShowPage()
 {
     if (!function_exists('core_users_list')) {
         return _("Module Core is disabled. Please enable it");
     }
     $module_hook = \moduleHook::create();
     $mods = $this->FreePBX->Hooks->processHooks();
     $moduleHtml = '';
     foreach ($mods as $mod) {
         $moduleHtml .= $mod;
     }
     $action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : '';
     $html = '';
     $users = $this->getAllUsers();
     $html .= load_view(dirname(__FILE__) . '/views/rnav.php', array("users" => $users));
     switch ($action) {
         case 'showuser':
         case 'adduser':
             if ($action == 'showuser' && !empty($_REQUEST['user'])) {
                 $user = $this->getUserByID($_REQUEST['user']);
                 $assigned = $this->getGlobalSettingByID($_REQUEST['user'], 'assigned');
                 $assigned = !empty($assigned) ? $assigned : array();
                 $default = $user['default_extension'];
             } else {
                 $user = array();
                 $assigned = array();
                 $default = null;
             }
             $fpbxusers = array();
             $dfpbxusers = array();
             $cul = array();
             foreach (core_users_list() as $list) {
                 $cul[$list[0]] = array("name" => $list[1], "vmcontext" => $list[2]);
             }
             foreach ($cul as $e => $u) {
                 $fpbxusers[] = array("ext" => $e, "name" => $u['name'], "selected" => in_array($e, $assigned));
             }
             $iuext = $this->getAllInUseExtensions();
             $dfpbxusers[] = array("ext" => 'none', "name" => 'none', "selected" => false);
             foreach ($cul as $e => $u) {
                 if ($e != $default && in_array($e, $iuext)) {
                     continue;
                 }
                 $dfpbxusers[] = array("ext" => $e, "name" => $u['name'], "selected" => $e == $default);
             }
             $html .= load_view(dirname(__FILE__) . '/views/users.php', array("dfpbxusers" => $dfpbxusers, "fpbxusers" => $fpbxusers, "moduleHtml" => $moduleHtml, "hookHtml" => $module_hook->hookHtml, "user" => $user, "message" => $this->message));
             break;
         case 'general':
             $html .= load_view(dirname(__FILE__) . '/views/general.php', array("subject" => $this->getGlobalsetting('emailsubject'), "email" => $this->getGlobalsetting('emailbody'), "message" => $this->message, "brand" => $this->brand));
             break;
         default:
             $html .= load_view(dirname(__FILE__) . '/views/welcome.php', array());
             break;
     }
     return $html;
 }
示例#3
0
 /**
  * Page Display
  */
 public function myShowPage()
 {
     if (!function_exists('core_users_list')) {
         return _("Module Core is disabled. Please enable it");
     }
     $module_hook = \moduleHook::create();
     $mods = $this->FreePBX->Hooks->processHooks();
     $sections = array();
     foreach ($mods as $mod => $contents) {
         if (empty($contents)) {
             continue;
         }
         if (is_array($contents)) {
             foreach ($contents as $content) {
                 if (!isset($sections[$content['rawname']])) {
                     $sections[$content['rawname']] = array("title" => $content['title'], "rawname" => $content['rawname'], "content" => $content['content']);
                 } else {
                     $sections[$content['rawname']]['content'] .= $content['content'];
                 }
             }
         } else {
             if (!isset($sections[$mod])) {
                 $sections[$mod] = array("title" => ucfirst(strtolower($mod)), "rawname" => $mod, "content" => $contents);
             } else {
                 $sections[$mod]['content'] .= $contents;
             }
         }
     }
     $request = $_REQUEST;
     $action = !empty($request['action']) ? $request['action'] : '';
     $html = '';
     $users = $this->getAllUsers();
     $groups = $this->getAllGroups();
     $permissions = $this->auth->getPermissions();
     switch ($action) {
         case 'addgroup':
         case 'showgroup':
             $module_list = $this->getModuleList();
             if ($action == "showgroup") {
                 $group = $this->getGroupByGID($request['group']);
             } else {
                 $group = array();
             }
             $mods = $this->getGlobalSettingByGID($request['group'], 'pbx_modules');
             $html .= load_view(dirname(__FILE__) . '/views/groups.php', array("group" => $group, "pbx_modules" => empty($group) ? array() : (!empty($mods) ? $mods : array()), "pbx_low" => empty($group) ? '' : $this->getGlobalSettingByGID($request['group'], 'pbx_low'), "pbx_high" => empty($group) ? '' : $this->getGlobalSettingByGID($request['group'], 'pbx_high'), "pbx_login" => empty($group) ? false : $this->getGlobalSettingByGID($request['group'], 'pbx_login'), "pbx_admin" => empty($group) ? false : $this->getGlobalSettingByGID($request['group'], 'pbx_admin'), "brand" => $this->brand, "users" => $users, "modules" => $module_list, "sections" => $sections, "message" => $this->message, "permissions" => $permissions));
             break;
         case 'showuser':
         case 'adduser':
             if ($action == 'showuser' && !empty($request['user'])) {
                 $user = $this->getUserByID($request['user']);
                 $assigned = $this->getGlobalSettingByID($request['user'], 'assigned');
                 $assigned = !empty($assigned) ? $assigned : array();
                 $default = $user['default_extension'];
             } else {
                 $user = array();
                 $assigned = array();
                 $default = null;
             }
             $fpbxusers = array();
             $dfpbxusers = array();
             $cul = array();
             foreach ($this->FreePBX->Core->listUsers() as $list) {
                 $cul[$list[0]] = array("name" => $list[1], "vmcontext" => $list[2]);
             }
             foreach ($cul as $e => $u) {
                 $fpbxusers[] = array("ext" => $e, "name" => $u['name'], "selected" => in_array($e, $assigned));
             }
             $module_list = $this->getModuleList();
             $iuext = $this->getAllInUseExtensions();
             $dfpbxusers[] = array("ext" => 'none', "name" => 'none', "selected" => false);
             foreach ($cul as $e => $u) {
                 if ($e != $default && in_array($e, $iuext)) {
                     continue;
                 }
                 $dfpbxusers[] = array("ext" => $e, "name" => $u['name'], "selected" => $e == $default);
             }
             $ao = $this->auth;
             $html .= load_view(dirname(__FILE__) . '/views/users.php', array("users" => $users, "groups" => $groups, "dgroups" => $ao->getDefaultGroups(), "sections" => $sections, "pbx_modules" => empty($request['user']) ? array() : $this->getGlobalSettingByID($request['user'], 'pbx_modules'), "pbx_low" => empty($request['user']) ? '' : $this->getGlobalSettingByID($request['user'], 'pbx_low'), "pbx_high" => empty($request['user']) ? '' : $this->getGlobalSettingByID($request['user'], 'pbx_high'), "pbx_login" => empty($request['user']) ? false : $this->getGlobalSettingByID($request['user'], 'pbx_login', true), "pbx_admin" => empty($request['user']) ? false : $this->getGlobalSettingByID($request['user'], 'pbx_admin', true), "modules" => $module_list, "brand" => $this->brand, "dfpbxusers" => $dfpbxusers, "fpbxusers" => $fpbxusers, "user" => $user, "message" => $this->message, "permissions" => $permissions));
             break;
         default:
             $auths = array();
             foreach ($this->getAuths() as $auth) {
                 $class = 'FreePBX\\modules\\Userman\\Auth\\' . $auth;
                 $a = $class::getInfo($this, $this->FreePBX);
                 if (!empty($a)) {
                     $auths[$auth] = $a;
                     $auths[$auth]['html'] = $class::getConfig($this, $this->FreePBX);
                 }
             }
             $emailbody = $this->getGlobalsetting('emailbody');
             $emailsubject = $this->getGlobalsetting('emailsubject');
             $autoEmail = $this->getGlobalsetting('autoEmail');
             $autoEmail = is_null($autoEmail) ? true : $autoEmail;
             $html .= load_view(dirname(__FILE__) . '/views/welcome.php', array("autoEmail" => $autoEmail, "authtype" => $this->getConfig("auth"), "auths" => $auths, "brand" => $this->brand, "permissions" => $permissions, "groups" => $groups, "users" => $users, "sections" => $sections, "message" => $this->message, "emailbody" => $emailbody, "emailsubject" => $emailsubject));
             break;
     }
     return $html;
 }
示例#4
0
 public function hookTabs($page)
 {
     $module_hook = \moduleHook::create();
     $mods = $this->freepbx->Hooks->processHooks($page);
     $sections = array();
     foreach ($mods as $mod => $contents) {
         if (empty($contents)) {
             continue;
         }
         if (is_array($contents)) {
             foreach ($contents as $content) {
                 if (!isset($sections[$content['rawname']])) {
                     $sections[$content['rawname']] = array("title" => $content['title'], "rawname" => $content['rawname'], "content" => $content['content']);
                 } else {
                     $sections[$content['rawname']]['content'] .= $content['content'];
                 }
             }
         } else {
             if (!isset($sections[$mod])) {
                 $sections[$mod] = array("title" => ucfirst(strtolower($mod)), "rawname" => $mod, "content" => $contents);
             } else {
                 $sections[$mod]['content'] .= $contents;
             }
         }
     }
     $hookTabs = $hookcontent = '';
     foreach ($sections as $data) {
         $hookTabs .= '<li role="presentation"><a href="#corehook' . $data['rawname'] . '" aria-controls="corehook' . $data['rawname'] . '" role="tab" data-toggle="tab">' . $data['title'] . '</a></li>';
         $hookcontent .= '<div role="tabpanel" class="tab-pane" id="corehook' . $data['rawname'] . '">';
         $hookcontent .= $data['content'];
         $hookcontent .= '</div>';
     }
     return array("hookTabs" => $hookTabs, "hookContent" => $hookcontent, "oldHooks" => $module_hook->hookHtml);
 }
 public function hookForm()
 {
     $module_hook = \moduleHook::create();
     $mods = \FreePBX::Hooks()->processHooks();
     $sections = array();
     foreach ($mods as $mod => $contents) {
         if (empty($contents)) {
             continue;
         }
         if (is_array($contents)) {
             foreach ($contents as $content) {
                 if (!isset($sections[$content['rawname']])) {
                     $sections[$content['rawname']] = array("title" => $content['title'], "rawname" => $content['rawname'], "content" => $content['content']);
                 } else {
                     $sections[$content['rawname']]['content'] .= $content['content'];
                 }
             }
         } else {
             if (!isset($sections[$mod])) {
                 $sections[$mod] = array("title" => ucfirst(strtolower($mod)), "rawname" => $mod, "content" => $contents);
             } else {
                 $sections[$mod]['content'] .= $contents;
             }
         }
     }
     $hookcontent = '';
     foreach ($sections as $data) {
         $hookcontent .= '<div class="section-title" data-for="paginghook' . $data['rawname'] . '"><h3><i class="fa fa-minus"></i> ' . $data['title'] . '</h3></div>';
         $hookcontent .= '<div class="section" data-id="paginghook' . $data['rawname'] . '">';
         $hookcontent .= $data['content'];
         $hookcontent .= '</div>';
     }
     return array("hookContent" => $hookcontent, "oldHooks" => $module_hook->hookHtml);
 }