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


PHP FreePBX::OOBE方法代码示例

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


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

示例1: ajaxHandler


//.........这里部分代码省略.........
             if (!isset($_REQUEST['zone'])) {
                 throw new \Exception("No Zone");
             }
             return $this->changeNetworksZone(trim($_REQUEST['net']), $_REQUEST['zone']);
         case "addrfc":
             return $this->addRfcNetworks();
         case "addthishost":
             $thishost = $this->detectHost();
             $nets = $this->getConfig("networkmaps");
             if (!is_array($nets)) {
                 $nets = array();
             }
             $nets[$thishost] = "trusted";
             $this->setConfig("networkmaps", $nets);
             return $this->runHook('addnetwork', array('trusted' => array($thishost)));
         case "addthisnetwork":
             $thisnet = $this->detectNetwork();
             $nets = $this->getConfig("networkmaps");
             if (!is_array($nets)) {
                 $nets = array();
             }
             $nets[$thisnet] = "trusted";
             $this->setConfig("networkmaps", $nets);
             return $this->runHook('addnetwork', array('trusted' => array($thisnet)));
         case "updateinterface":
             // Remove any notifications about invalid interface configurations
             $this->Notifications()->delete('firewall', 'trustedint');
             $this->Notifications()->delete('firewall', 'newint');
             return $this->runHook('updateinterface', array('iface' => $_REQUEST['iface'], 'newzone' => $_REQUEST['zone']));
         case "updaterfw":
             return $this->setConfig($_REQUEST['proto'], $_REQUEST['value'] == "true", 'rfw');
         case "addtoblacklist":
             return $this->addToBlacklist(htmlentities($_REQUEST['entry'], \ENT_QUOTES, 'UTF-8', false));
         case "removefromblacklist":
             return $this->removeFromBlacklist(htmlentities($_REQUEST['entry'], \ENT_QUOTES, 'UTF-8', false));
         case "setsafemode":
             if ($_REQUEST['value'] == "disabled") {
                 return $this->disableSafemode();
             } elseif ($_REQUEST['value'] == "enabled") {
                 return $this->enableSafemode();
             } else {
                 throw new \Exception("Unknown safemode");
             }
         case "setrejectmode":
             if ($_REQUEST['value'] != "reject") {
                 return $this->setConfig("dropinvalid", true);
             } else {
                 return $this->setConfig("dropinvalid", false);
             }
             // Custom firewall rules.
             // Custom firewall rules.
         // Custom firewall rules.
         // Custom firewall rules.
         case "addcustomrule":
             return $this->addCustomService(htmlentities($_REQUEST['name'], \ENT_QUOTES, 'UTF-8', false), $_REQUEST['proto'], $_REQUEST['port']);
         case "editcustomrule":
             return $this->editCustomService($_REQUEST['id'], htmlentities($_REQUEST['name'], \ENT_QUOTES, 'UTF-8', false), $_REQUEST['proto'], $_REQUEST['port']);
         case "deletecustomrule":
             return $this->deleteCustomService($_REQUEST['id']);
         case "updatecustomzones":
             if (!isset($_REQUEST['zones'])) {
                 $_REQUEST['zones'] = array();
             }
             return $this->setCustomServiceZones($_REQUEST['id'], $_REQUEST['zones']);
             // Attackers page
         // Attackers page
         case "getattackers":
             include __DIR__ . "/Attacks.class.php";
             $a = new Firewall\Attacks($this->getJiffies());
             $smart = $this->getSmartObj();
             return $a->getAllAttacks($smart->getRegistrations());
         case "delattacker":
             return $this->runHook("removeallblocks", array("unblock" => $_REQUEST['target']));
             // OOBE
         // OOBE
         case "getoobequestion":
             include __DIR__ . "/OOBE.class.php";
             $o = new Firewall\OOBE($this);
             return $o->getQuestion();
         case "answeroobequestion":
             include __DIR__ . "/OOBE.class.php";
             $o = new Firewall\OOBE($this);
             return $o->answerQuestion();
         case "abortoobe":
             $this->setConfig("abortoobe", true);
             return true;
         case "restartoobe":
             $o = \FreePBX::OOBE()->getConfig("completed");
             if (!is_array($o)) {
                 throw new \Exception("OOBE isn't an array");
             }
             unset($o['firewall']);
             \FreePBX::OOBE()->setConfig("completed", $o);
             $this->setConfig("oobeanswered", array());
             $this->setConfig("abortoobe", false);
             return;
         default:
             throw new \Exception("Sad Panda - " . $_REQUEST['command']);
     }
 }
开发者ID:ntadmin,项目名称:firewall,代码行数:101,代码来源:Firewall.class.php


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