[xoops-cvslog 2311] CVS update: xoops2jp/html/modules/base/preload/SiteClose

Back to archive index

NobuNobu nobun****@users*****
2006年 2月 6日 (月) 14:21:08 JST


Index: xoops2jp/html/modules/base/preload/SiteClose/SiteClose.class.php
diff -u xoops2jp/html/modules/base/preload/SiteClose/SiteClose.class.php:1.1.2.3 xoops2jp/html/modules/base/preload/SiteClose/SiteClose.class.php:1.1.2.4
--- xoops2jp/html/modules/base/preload/SiteClose/SiteClose.class.php:1.1.2.3	Thu Nov 17 12:44:22 2005
+++ xoops2jp/html/modules/base/preload/SiteClose/SiteClose.class.php	Mon Feb  6 14:21:08 2006
@@ -1,76 +1,73 @@
-<?php
-
-class SiteClose_Filter extends XCube_ActionFilter
-{
-	function preBlockFilter()
-	{
-		if($this->mController->mConfig['closesite']==1)
-			$this->_processSiteClose();
-
-		$delegate=new XCube_Delegate("SiteClose_Filter","callbackCheckLoginSuccess");
-		$this->mController->mRoot->mEventManager->add("Site.CheckLogin.Success",$delegate);
-	}
-
-	function _processSiteClose()
-	{
-	    $accessAllowFlag = false;
-
-		if(is_object($this->mController->mXoopsUser)) {
-			foreach ($this->mController->mXoopsUser->getGroups() as $group) {
-				if (in_array($group, $this->mController->mConfig['closesite_okgrp']) || XOOPS_GROUP_ADMIN == $group) {
-					$allowed = true;
-					break;
-				}
-			}
-		}
-		elseif(!empty($_POST['xoops_login'])) {
-			// Check!
-	        require_once XOOPS_ROOT_PATH.'/include/checklogin.php';
-	        exit();
-	    }
-
-	    if (!$accessAllowFlag) {
-	        require_once XOOPS_ROOT_PATH.'/class/template.php';
-	        $xoopsTpl = new XoopsTpl();
-	        $xoopsTpl->assign( array('xoops_sitename' => htmlspecialchars($this->mController->mConfig['sitename']),
-	                                   'xoops_themecss' => xoops_getcss(),
-	                                   'xoops_imageurl' => XOOPS_THEME_URL.'/'.$this->mController->mConfig['theme_set'].'/',
-	                                   'lang_login' => _LOGIN,
-	                                   'lang_username' => _USERNAME,
-	                                   'lang_password' => _PASSWORD,
-	                                   'lang_siteclosemsg' => $this->mController->mConfig['closesite_text']));
-	        $xoopsTpl->xoops_setCaching(1);
-	        $xoopsTpl->display('db:system_siteclosed.html');	///< @todo depends schema
-	        exit();
-	    }
-	}
-	
-	function callbackCheckLoginSuccess(&$controller,&$eventArgs)
-	{
-		//
-		// This check is not needed. :)
-		//
-		if(!is_object($eventArgs['xoopsUser']))
-			return;
-
-		$user=&$eventArgs['xoopsUser'];
-
-		// Site close
-		if($controller->getConfig('closesite')) {
-			$accessAllowed=false;
-
-			foreach($user->getGroups() as $group) {
-				if(in_array($group,$controller->getConfig('closesite_okgrp') || $group==XOOPS_GROUP_ADMIN)) {
-					$accessAllowed=true;
-					break;
-				}
-			}
-
-			if(!$accessAllowed) {
-				XCube_Utils::redirectHeader(XOOPS_URL,1,_NOPERM);
-			}
-		}
-	}
-}
-
+<?php
+
+class SiteClose_Filter extends XCube_ActionFilter
+{
+	function preBlockFilter()
+	{
+		if($this->mController->mConfig['closesite']==1) {
+			$this->mController->mRoot->mEventManager->add("Site.Login",new XCube_InstanceDelegate($this,"callbackSiteLogin"));
+			$this->mController->mRoot->mEventManager->add("Site.CheckLogin.Success",new XCube_InstanceDelegate($this,"callbackCheckLoginSuccess"));
+		}
+	}
+
+	function callbackSiteLogin()
+	{
+	    $accessAllowFlag = false;
+		if(!empty($_POST['xoops_login'])) {
+			// Check!
+	        require_once XOOPS_ROOT_PATH.'/include/checklogin.php';
+			return;
+	    }elseif(is_object($this->mController->mXoopsUser)) {
+			foreach ($this->mController->mXoopsUser->getGroups() as $group) {
+				if (in_array($group, $this->mController->mConfig['closesite_okgrp']) || XOOPS_GROUP_ADMIN == $group) {
+					$accessAllowFlag = true;
+					break;
+				}
+			}
+		}
+
+	    if (!$accessAllowFlag) {
+	        require_once XOOPS_ROOT_PATH.'/class/template.php';
+	        $xoopsTpl = new XoopsTpl();
+	        $xoopsTpl->assign( array('xoops_sitename' => htmlspecialchars($this->mController->mConfig['sitename']),
+	                                   'xoops_themecss' => xoops_getcss(),
+	                                   'xoops_imageurl' => XOOPS_THEME_URL.'/'.$this->mController->mConfig['theme_set'].'/',
+	                                   'lang_login' => _LOGIN,
+	                                   'lang_username' => _USERNAME,
+	                                   'lang_password' => _PASSWORD,
+	                                   'lang_siteclosemsg' => $this->mController->mConfig['closesite_text']));
+	        $xoopsTpl->xoops_setCaching(1);
+	        $xoopsTpl->display('db:system_siteclosed.html');	///< @todo depends schema
+	        exit();
+	    }
+	}
+	
+	function callbackCheckLoginSuccess(&$controller,&$eventArgs)
+	{
+		//
+		// This check is not needed. :)
+		//
+		if(!is_object($eventArgs['xoopsUser']))
+			return;
+
+		$user=&$eventArgs['xoopsUser'];
+
+		// Site close
+		if($controller->getConfig('closesite')) {
+			$accessAllowed=false;
+
+			foreach($user->getGroups() as $group) {
+				if(in_array($group,$controller->getConfig('closesite_okgrp')) || ($group==XOOPS_GROUP_ADMIN)) {
+					$accessAllowed=true;
+					break;
+				}
+			}
+
+			if(!$accessAllowed) {
+				XCube_Utils::redirectHeader(XOOPS_URL,1,_NOPERM);
+			}
+		}
+	}
+}
+
 ?>
\ No newline at end of file


xoops-cvslog メーリングリストの案内
Back to archive index