示例#1
0
 /**
  * Retrieves base DN of current datasource.
  *
  * @return ldap_user current instance
  * @throws \RuntimeException
  */
 public function elevateForPasswordChange()
 {
     if ($this->server instanceof LDAP\server) {
         exception::enterSensitive();
         $dn = $this->setup->read('pwchanger.dn');
         $pw = $this->setup->read('pwchanger.token');
         if ($dn && $pw) {
             if ($this->server->simpleBindAs($dn, $pw)->getBoundAs() !== $dn) {
                 throw new \RuntimeException('failed to elevate user for changing password');
             }
             exception::leaveSensitive();
             return $this;
         }
         throw new \RuntimeException('missing configuration for elevating user on link to datasource');
     }
     throw new \RuntimeException('request for elevating user on unconfigured link to datasource');
 }
示例#2
0
文件: manager.php 项目: cepharum/txf
 /**
  * Initializes use of current view manager instance.
  */
 public function onLoad()
 {
     $this->initialOBLevel = \ob_get_level();
     ob_start();
     if (txf::getContextMode() == txf::CTXMODE_NORMAL) {
         register_shutdown_function(array(&$this, 'onShutdown'));
     }
     if (!@$_GET['rawerror']) {
         set_exception_handler(array(&$this, 'onException'));
         set_error_handler(array(&$this, 'onError'));
     }
     // read default assets from configuration
     $assets = config::getList('view.asset');
     foreach ($assets as $asset) {
         if (@$asset['url'] && @$asset['type']) {
             $id = trim(@$asset['id']);
             if ($id === '') {
                 $id = md5(@$asset['url']);
             }
             $this->addAsset($id, $asset['url'], $asset['type'], $asset['insertBefore']);
         }
     }
     // initialize HTTP defaults
     header('Content-Type: text/html; charset=utf-8');
     // initialize variables from configuration
     foreach (config::get('view.variable', array()) as $name => $content) {
         $this->variable($name, $content);
     }
     // initialize content of viewports
     foreach (set::asHash(config::get('view.static', array())) as $name => $content) {
         $this->writeInViewport($name, $content);
     }
     // process global widget to include custom output in every view
     $this->processConfiguredWidgets("load");
 }