本文整理汇总了PHP中Director::getConfigPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Director::getConfigPath方法的具体用法?PHP Director::getConfigPath怎么用?PHP Director::getConfigPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Director
的用法示例。
在下文中一共展示了Director::getConfigPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
public function initialize()
{
// check if user is logged in
$authentication = Authentication::getInstance();
$request = Request::getInstance();
if ($authentication->isLogin() && !$authentication->isRole(SystemUser::ROLE_BACKEND)) {
$this->log->info("Failed access for " . $authentication->getUserName() . " (not enough privileges for admin section) from " . $request->getValue('REMOTE_ADDR', Request::SERVER));
throw new Exception('Access denied');
}
// check if admin section is restricted by ip-addresses
$ip_allow = $this->director->getConfig()->admin_section_ip_allow;
if ($ip_allow) {
$ips = explode(",", $ip_allow);
if (!in_array($request->getValue('REMOTE_ADDR', Request::SERVER), $ips)) {
$this->log->info("Failed access for " . $authentication->getUserName() . " (ip not in list for admin access) from " . $request->getValue('REMOTE_ADDR', Request::SERVER));
throw new Exception('Access denied');
}
}
// create tree object
$treefile = Director::getConfigPath() . $this->director->getConfig()->admin_menu;
$useLogin = $this->director->getConfig()->dsn;
$this->tree = new AdminTree($treefile, $useLogin);
$this->tree->setPrefix($this->urlPrefix);
// check if path is set. is not, get the startpage path
$path = $request->getPath();
$currentId = $this->tree->isSiteRoot() ? $this->tree->getStartNodeId() : $this->tree->getIdFromPath($path);
// current id does not exist. try to search login pages
if (!$currentId && $this->tree->pathExists($path)) {
$this->tree->setCurrentIdExists($this->tree->getIdFromPath($path, Tree::TREE_ORIGINAL));
}
$this->tree->setCurrentId($currentId);
}
示例2: handlePostDelete
/**
* handle post delete functions
* this function removes the extension files
*
* @param array filtered values for insertion
* @return void
* @see DbConnector::handlePostDelete
*/
protected function handlePostDelete($id, $values)
{
$className = $values['classname'];
$configFile = Director::getConfigPath() . strtolower($className) . ".ini";
if (file_exists($configFile)) {
unlink($configFile);
}
$extensionPath = $this->getExtensionPath($className);
Utils::removeRecursive($extensionPath);
}