[xoops-cvslog 4875] CVS update: xoops2jp/html/core

Back to archive index

Ryuji AMANO ryuji_amano****@users*****
2006年 10月 7日 (土) 16:44:15 JST


Index: xoops2jp/html/core/XCube_Utils.class.php
diff -u xoops2jp/html/core/XCube_Utils.class.php:1.1.2.1 xoops2jp/html/core/XCube_Utils.class.php:1.1.2.2
--- xoops2jp/html/core/XCube_Utils.class.php:1.1.2.1	Fri Sep 29 17:13:22 2006
+++ xoops2jp/html/core/XCube_Utils.class.php	Sat Oct  7 16:44:15 2006
@@ -1,7 +1,7 @@
 <?php
 /**
  * @package XCube
- * @version $Id: XCube_Utils.class.php,v 1.1.2.1 2006/09/29 08:13:22 minahito Exp $
+ * @version $Id: XCube_Utils.class.php,v 1.1.2.2 2006/10/07 07:44:15 ryuji_amano Exp $
  */
 
 /**
@@ -10,15 +10,28 @@
 class XCube_Utils
 {
 	/**
-	 * Formats string.
+	Display redirect message and execute redirect.
+	You can not continue your routine, because this method call exit().
+	
+	@todo I must solve direct HTML code.
+	@param $url string
+	@param $time intval
+	@param $message If you want to multiline message, you must set message as array.
+	
+	@deprecated Don't use static function of XCube layer for redirect.
 	 */
+	function redirectHeader($url, $time, $messages = null)
+	{
+		$root =& XCube_Root::getSingleton();
+		$root->mController->executeRedirect($url, $time, $messages);
+	}
+	
 	function formatMessage()
 	{
 		$arr = func_get_args();
 		
-		if (count($arr) == 0) {
+		if(count($arr)==0)
 			return null;
-		}
 		
 		$message = $arr[0];
 		for($i = 1; $i < count($arr); $i++) {
@@ -27,6 +40,41 @@
 		
 		return $message;
 	}
+	
+	function formatMessageByMap($subject,$arr)
+	{
+		$searches=array();
+		$replaces=array();
+		foreach($arr as $key=>$value) {
+			$searches[]="{".$key."}";
+			$replaces[]=$value;
+		}
+
+		return str_replace($searches,$replaces,$subject);
+	}
+
+    function checkSystemModules() {
+        $root=&XCube_Root::getSingleton();
+        $systemModules = array_map('trim', explode(',',$root->getSiteConfig('Cube','SystemModules')));
+        $recommendedModules = array_map('trim', explode(',',$root->getSiteConfig('Cube','RecommendedModules')));
+        $moduleHandler =& xoops_gethandler('module');
+        $uninstalledModules = array();
+        $disabledModules = array();
+        foreach($systemModules as $systemModule) {
+            if(!empty($systemModule)) {
+                if(!($moduleObject =& $moduleHandler->getByDirname($systemModule))) {
+                    $uninstalledModules[] = $systemModule;
+                } else if(!$moduleObject->getVar('isactive')) {
+                    $disabledModules[] = $systemModule;
+                }
+            }
+        }
+        if ((count($uninstalledModules)==0)&&(count($disabledModules)==0)) {
+            return true;
+        } else {
+            return array('uninstalled' =>$uninstalledModules, 'disabled'=>$disabledModules, 'recommended'=>$recommendedModules);
+        }
+	}
 }
 
 ?>
\ No newline at end of file


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