public function getSections()
 {
     $sections = array();
     $users = \FreePBX::Core()->listUsers(true);
     $ret = array();
     $ret['title'] = _("Users");
     $featurecodes = \featurecodes_getAllFeaturesDetailed();
     $ret['textdesc'] = _('User');
     $ret['numdesc'] = _('Extension');
     $ret['items'] = array();
     foreach ($users as $user) {
         $ret['items'][] = array($user[1], $user[0]);
     }
     $sections[] = $ret;
     $hookdata = \FreePBX::Hooks()->processHooks();
     foreach ($hookdata as $key => $value) {
         $sections[] = $value;
     }
     $html .= '<div class="row holder">';
     $html .= '<div class="col-sm-12">';
     foreach ($sections as $k => $v) {
         $html .= '<div class="row">';
         $html .= '<h3>' . $v['title'] . '</h3>';
         $html .= '<ul class="list-group">';
         foreach ($v['items'] as $item) {
             $html .= '	<li class="list-group-item col-sm-6"><b>' . $item[1] . '</b> - ' . $item[0] . '</li>';
         }
         $html .= '</ul>';
         $html .= '<br/>';
         $html .= '	</div>';
     }
     $html .= '</div>';
     $html .= '</div>';
     return $html;
 }
 /**
  * [asteriskInfoHooks Hooking in to Asterisk Info Module]
  * @return [array]
  * 		'mode' => "Mode",
  * 		'title' => "title",
  * 		'commands' => array('subtitle' => 'command1', 'subtitle' => 'command2')
  */
 public function asteriskInfoHooks()
 {
     $data = \FreePBX::Hooks()->processHooks();
     return $data;
 }
예제 #3
0
 public function extIgnoreList()
 {
     $numbers = array();
     $hooks = \FreePBX::Hooks()->processHooks();
     foreach ($hooks as $key => $value) {
         if (is_array($value)) {
             $numbers = array_merge($numbers, $value);
         }
     }
     return $numbers;
 }
예제 #4
0
                 }
             default:
                 // just so we don't send an <hr> and flush()
                 $didsomething = false;
         }
         if ($didsomething) {
             if (!empty($change_tracks)) {
                 $modulef->set_tracks($change_tracks);
             }
             @ob_flush();
             flush();
         }
     }
     echo _("Updating Hooks...");
     try {
         \FreePBX::Hooks()->updateBMOHooks();
     } catch (\Exception $e) {
     }
     echo _("Done") . "<br />";
     echo "</div>";
     echo "<hr /><br />";
     if ($quietmode) {
         echo '<a class="btn" href="#" onclick="parent.close_module_actions(true);" >' . _("Return") . '</a>';
     }
     break;
 case 'confirm':
     if (is_array($trackaction)) {
         ksort($trackaction);
     }
     if (is_array($moduleaction)) {
         ksort($moduleaction);
예제 #5
0
 public function getSummary()
 {
     $svcs = array("asterisk" => _("Asterisk"), "mysql" => _("MySQL"), "apache" => _("Web Server"));
     $sysinfo = \FreePBX::create()->Dashboard->getSysInfo();
     $final = array();
     $i = 0;
     foreach (array_keys($svcs) as $svc) {
         if (!method_exists($this, "check{$svc}")) {
             $final[$i]['type'] = 'unknown';
             $final[$i]['tooltip'] = "Function check{$svc} doesn't exist!";
         } else {
             $func = "check{$svc}";
             $final[$i] = $this->{$func}($sysinfo);
         }
         $final[$i]['title'] = $svcs[$svc];
         $i++;
     }
     $t = \FreePBX::Hooks()->processHooks($sysinfo);
     $f = $final;
     foreach ($t as $d) {
         foreach ($d as $d1) {
             $order = isset($d1['order']) ? $d1['order'] : count($f);
             if ($order == 0) {
                 array_unshift($f, $d1);
                 continue;
             }
             $t1 = array_slice($f, 0, $order, true);
             $t2 = array_slice($f, $order, count($f) - 1, true);
             $f = array_merge($t1, array($d1), $t2);
         }
     }
     return $f;
 }
예제 #6
0
 private function updateHooks()
 {
     $this->write(_("Updating Hooks..."));
     try {
         \FreePBX::Hooks()->updateBMOHooks();
     } catch (\Exception $e) {
     }
     $this->writeln(_("Done"));
 }
예제 #7
0
 private function postAsteriskHooks($output, $execute = true)
 {
     if (!$execute) {
         return \FreePBX::Hooks()->returnHooks();
     }
     \FreePBX::Hooks()->processHooks($output);
     return;
 }
예제 #8
0
 public function pageHook($request)
 {
     return \FreePBX::Hooks()->processHooks($request);
 }
 public function delTimeGroup($id)
 {
     $sql = "delete from timegroups_details where timegroupid = :id";
     $stmt = $this->db->prepare($sql);
     $ret1 = $stmt->execute(array(':id' => $id));
     $sql = "delete from timegroups_groups where id = :id";
     $stmt = $this->db->prepare($sql);
     $ret2 = $stmt->execute(array(':id' => $id));
     needreload();
     \FreePBX::Hooks()->processHooks($id);
     return $ret1 && $ret2;
 }
예제 #10
0
 private function fwcChownFiles()
 {
     $modules = \FreePBX::Hooks()->processHooks();
     return $modules;
 }
예제 #11
0
 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);
 }
예제 #12
0
 public function externalMessages()
 {
     $ret = array('pre' => array(), 'post' => array(), 'cancel' => false);
     $hooks = \FreePBX::Hooks()->processHooks();
     foreach ($hooks as $hook) {
         if (is_array($hook)) {
             if (isset($hook['pre'])) {
                 if (is_array($hook['pre'])) {
                     foreach ($hook['pre'] as $o) {
                         $ret['pre'][] = $o;
                     }
                 } else {
                     $ret['pre'][] = $hook['pre'];
                 }
             }
             if (isset($hook['post'])) {
                 if (is_array($hook['post'])) {
                     foreach ($hook['post'] as $o) {
                         $ret['post'][] = $o;
                     }
                 } else {
                     $ret['post'][] = $hook['post'];
                 }
             }
             if (isset($hook['cancel'])) {
                 $ret['cancel'] = true;
             }
         }
     }
     return $ret;
 }