提示Warning: strstr(): Empty delimiter in /usr/share/nginx/www/farmer/library/Custom/Competence.php on line 161

牧野人 发布于 2016/04/06 16:18
阅读 217
收藏 0

跪求高手解决:代码

<?php


class Custom_Competence extends Zend_Controller_Action {


/**
* 系统用户对象
*
* @var System_Admin_User
*/
protected $user;


protected $application;


/**
* 系统操作
*
* @var string
*/
protected $act = "";


/**
* 控制器名称
*
* @var string
*/
private $controllerName = "";


/**
* 方法名称
*
* @var string
*/
private $actionName = "";


private $urlArray = array ();


private $urlName = "";


public function init() {
parent::init ();

$this->controllerName = $this->getRequest ()->getControllerName ();
$this->actionName = $this->getRequest ()->getActionName ();
$this->urlArray [] = $this->controllerName;
$explodeAction = explode ( ".", $this->actionName );
$this->urlArray [] = $explodeAction [0];
$this->urlName = "/" . $this->controllerName . "/" . $this->actionName;

$this->_helper->viewRenderer->setNoRender ();
$this->application = new Zend_Session_Namespace ( "application" );
$this->application->setExpirationSeconds ( 86400 );
try {
$this->user = new System_Admin_User ( $this->application->manager ["Id"] );
if (( int ) ($this->user->GetId ()) > 0) {
$this->view->assign ( "theme", $this->user->GetTheme () );

$this->act = $this->_getParam ( 'act', null );
$this->CheckUrlName ();
$this->GetMenuTitle ();
return;
} else {
$this->_helper->redirector ( "login", "signin" );
}
} catch ( Exception $e ) {
$this->_helper->redirector ( "login", "signin" );
}
}


private $orgnizeUrlArray = array ();


private $orgnizeReadOnlyArray = array ();


private function GetGroupRelation() {
$adminCongregation = new System_Admin_Congregation ( $this->user );
$congregationArray = array ();
foreach ( $adminCongregation->Items () as $congregationKey => $congregationVelue ) {
$congregationArray [] = $congregationVelue->GetOrganize ();
}
$purviewArray = array ();
foreach ( $congregationArray as $congregationArrayKey => $congregationArrayValue ) {
$purviewArray = new System_Admin_Purview ( $congregationArrayValue );
foreach ( $purviewArray->Items () as $purviewKey => $purviewValue ) {
$adminOrganize = new System_Admin_Organizepurview ( $purviewValue->GetId () );
$tmpArray = array ();
$tmpArray [] = $purviewValue->GetF2 ()->GetControllerName ();
$tmpArray [] = $purviewValue->GetF2 ()->GetActionName ();
$this->orgnizeUrlArray [] = $tmpArray;
$tmpArray [] = $adminOrganize->GetF3 ();
$this->orgnizeReadOnlyArray [] = $tmpArray;
}
}
}


private $userUrlArray = array ();


private $userReadOnlyArray = array ();


private function GetUserRelation() {
$adminRelation = new System_Admin_Relation ( $this->user );
foreach ( $adminRelation->Items () as $relationKey => $relationVelue ) {
$adminUserrelation = new System_Admin_Userrelation ( $relationVelue->GetId () );
$tmpArray = array ();
$tmpArray [] = $relationVelue->GetF2 ()->GetControllerName ();
$tmpArray [] = $relationVelue->GetF2 ()->GetActionName ();
$this->userUrlArray [] = $tmpArray;
$tmpArray [] = $adminUserrelation->GetF3 ();
$this->userReadOnlyArray [] = $tmpArray;
}
}


private function CheckEnabled() {
if (! in_array ( $this->urlArray, $this->userUrlArray ) && ! in_array ( $this->urlArray, $this->orgnizeUrlArray )) {
die ( "暂无访问权限" );
} else {
$this->CheckReadonly ();
}
}


private function CheckReadonly() {
$orgnizeReadOnly = true;
foreach ( $this->orgnizeReadOnlyArray as $value ) {
if ($value [0] == $this->urlArray [0] && $value [1] == $this->urlArray [1]) {
$orgnizeReadOnly = $value [2] == 0 ? true : false;
break;
}
}

$userReadOnly = $orgnizeReadOnly;
foreach ( $this->userReadOnlyArray as $value ) {
if ($value [0] == $this->urlArray [0] && $value [1] == $this->urlArray [1]) {
$userReadOnly = $value [2] == 0 ? true : false;
break;
}
}

if ($userReadOnly) {
$this->act = Func::Randomkeys ( 8 );
$act = $this->_getParam ( 'act', null );
if (! is_null ( $act )) {
$this->view->assign ( "alert", "<script>alert('您当前的权限不可以修改数据')</script>" );
return;
}
}
}


private function CheckUrlName() {
if ($this->user->GetId () > 1) {
if ($this->urlName != "/admin/index" && $this->urlName != "/admin/logoff" && $this->urlName != "/admin/system" && $this->urlName != "/admin/menu" && $this->urlName != "/admin/hello" && $this->urlName != "/admin/right" && $this->urlName != "/admin/password") {
$this->GetGroupRelation ();
$this->GetUserRelation ();
$this->CheckEnabled ();
}
}
}


private function GetMenuTitle() {
$menuTitleArray = array ();
$group = new System_Admin_Group ();
foreach ( $group->GetGroup () as $groupValue ) {
$menuList = $groupValue->GetChildren ();
foreach ( $menuList as $menuValue ) {
if ($menuValue->GetUrl () != "") {
if (strstr ( $_SERVER ["REQUEST_URI"], $menuValue->GetUrl () )) {
$menuTitleArray [] = $menuValue->GetParent ()->GetTitle ();
$menuTitleArray [] = $menuValue->GetTitle ();
break;
}
}
}
if (! empty ( $menuTitleArray )) {
$this->view->assign ( "menuParentTitle", $menuTitleArray [0] );
$this->view->assign ( "menuTitle", $menuTitleArray [1] );
}
}
}
}

加载中
返回顶部
顶部