Index: trunk/include/notification.inc.sub.php.delete
===================================================================
--- trunk/include/notification.inc.sub.php.delete	(revision 95)
+++ 	(revision )
@@ -1,153 +1,0 @@
-<?php
-function Notification_triggerEvent($category, $item_id, $event, $extra_tags=array(), $user_list=array(), $omit_user_id=null)
-{
-	if( ! is_object($GLOBALS["xoopsModule"]) ) return false ;
-	$module_id = $GLOBALS["xoopsModule"]->getVar('mid') ;
-	$notification_handler =& xoops_gethandler( 'notification' ) ;
-	$notification_handler->triggerEvent($category, $item_id, $event, $extra_tags, $user_list, $module_id, $omit_user_id)
-}
-function do_CommentNotifications($commentID, $comment_post_ID)
-{
-	$xpress_prefix = $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-	if ($xpress_prefix == 'wordpress') $xpress_prefix = 'wp';
-	$db =& Database::getInstance() ;
-	$myts =& MyTextsanitizer::getInstance() ;
-
-	$table_term_relationships = $db->prefix($xpress_prefix."_term_relationships");
-	$table_term_taxonomy = $db->prefix($xpress_prefix."_term_taxonomy");
-	$table_terms = $db->prefix($xpress_prefix."_terms");
-	$table_categories = $db->prefix($xpress_prefix."_categories");
-	$wp_post = $db->prefix($xpress_prefix."_posts");
-	$wp_options = $db->prefix($xpress_prefix."_options");
-	$wp_users  = $db->prefix($xpress_prefix."_users");
-	$wp_comments  = $db->prefix($xpress_prefix."_comments");
-	$post_id = $comment_post_ID;
-
-	$post_title = get_the_title($post_id);
-	$post_url = get_permalink($post_id). '#comment';
-	$blog_name = get_bloginfo('name');
-
-	/*
-	$sql = "SELECT option_value  FROM $wp_options WHERE option_name ='blogname'";
-	$blog_row = $db->fetchArray( $db->query( $sql ) ) ;
-	if( empty( $blog_row ) ) return false;
-	$blog_name = $blog_row['option_value'];
-	*/								
-	// query
-	$sql = "SELECT * FROM ".$wp_post." WHERE ID=$comment_post_ID ";
-	$post_row = $db->fetchArray( $db->query( $sql ) ) ;
-	if( empty( $post_row ) ) return false;
-	//			$post_title = $post_row['post_title'];
-	$post_author = $post_row['post_author'];
-
-	$sql = "SELECT display_name  FROM $wp_users WHERE ID ='$post_author'";
-	$blog_row = $db->fetchArray( $db->query( $sql ) ) ;
-	if( empty( $blog_row ) ) return false;
-	$user_name = $blog_row['display_name'];
-
-	require_once XOOPS_ROOT_PATH . '/include/notification_functions.php' ;
-	// non-module integration returns false quickly
-	
-	if( ! is_object($GLOBALS["xoopsModule"]) ) return false ;
-	$not_modid = $GLOBALS["xoopsModule"]->getVar('mid') ;
-
-	$comment_tags = array( 'XPRESS_AUTH_NAME' =>$user_name,'XPRESS_BLOG_NAME' =>$blog_name,'XPRESS_POST_TITLE' => $post_title , 'XPRESS_POST_URL' => $post_url ) ;
-	$notification_handler =& xoops_gethandler( 'notification' ) ;
-	$notification_handler->triggerEvent( 'global' , 0 , 'comment' , $comment_tags , false , $not_modid ) ;
-	$notification_handler->triggerEvent( 'author' , $post_author , 'comment' , $comment_tags , false , $not_modid ) ;
-	$notification_handler->triggerEvent( 'post' , $comment_post_ID , 'comment' , $comment_tags , false , $not_modid ) ;
-
-	// categorie notification
-	include(XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/wp-includes/version.php');
-	if ($wp_db_version < 6124){
-		$sql2 = "SELECT c.cat_ID, c.cat_name FROM ".$table_categories." c, ".$table_post2cat." p2c WHERE c.cat_ID = p2c.category_id AND p2c.post_id=".$comment_post_ID;
-	} else {
-		$sql2  = "SELECT $table_term_relationships.object_id, $table_terms.term_id AS cat_ID, $table_terms.name AS cat_name ";
-		$sql2 .= "FROM $table_term_relationships INNER JOIN ($table_term_taxonomy INNER JOIN $table_terms ON $table_term_taxonomy.term_id = $table_terms.term_id) ON $table_term_relationships.term_taxonomy_id = $table_term_taxonomy.term_taxonomy_id ";
-		$sql2 .= "WHERE ($table_term_relationships.object_id =" . $comment_post_ID.") AND ($table_term_taxonomy.taxonomy='category')";		
-	}
-	$res2 = $db->query($sql2);
-	while($row2 = $db->fetchArray($res2)){
-		$cat_id = $row2['cat_ID'];
-		$cat_name = $row2['cat_name'];
-		$comment_tags = array( 'XPRESS_AUTH_NAME' =>$user_name,'XPRESS_BLOG_NAME' =>$blog_name,'XPRESS_CAT_TITLE' => $cat_name,'XPRESS_POST_TITLE' => $post_title , 'XPRESS_POST_URL' => $post_url ) ;
-		$notification_handler->triggerEvent( 'category' , $cat_id , 'comment' , $comment_tags , false , $not_modid ) ;
-	}
-}
-
-function do_PostNotifications($post_id,$not_event)
-{
-	 // $not_event:		newpost,editpost ; $commentID, $comment_post_ID)
-	 
-	$xpress_prefix = $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-	if ($xpress_prefix == 'wordpress') $xpress_prefix = 'wp';
-	$db =& Database::getInstance() ;
-	$myts =& MyTextsanitizer::getInstance() ;
-
-	$table_term_relationships = $db->prefix($xpress_prefix."_term_relationships");
-	$table_term_taxonomy = $db->prefix($xpress_prefix."_term_taxonomy");
-	$table_terms = $db->prefix($xpress_prefix."_terms");
-	$table_categories = $db->prefix($xpress_prefix."_categories");
-	$wp_post = $db->prefix($xpress_prefix."_posts");
-	$wp_options = $db->prefix($xpress_prefix."_options");
-	$wp_users  = $db->prefix($xpress_prefix."_users");
-	$wp_comments  = $db->prefix($xpress_prefix."_comments");
-
-	$post_title = get_the_title($post_id);
-	$post_url = get_permalink($post_id). '#comment';
-	$blog_name = get_bloginfo('name');
-
-	// query
-	$sql = "SELECT * FROM ".$wp_post." WHERE ID=$post_id ";
-	$post_row = $db->fetchArray( $db->query( $sql ) ) ;
-	if( empty( $post_row ) ) return false;
-	//			$post_title = $post_row['post_title'];
-	$post_author = $post_row['post_author'];
-
-	$sql = "SELECT display_name  FROM $wp_users WHERE ID ='$post_author'";
-	$blog_row = $db->fetchArray( $db->query( $sql ) ) ;
-	if( empty( $blog_row ) ) return false;
-	$user_name = $blog_row['display_name'];
-
-	require_once XOOPS_ROOT_PATH . '/include/notification_functions.php' ;
-	// non-module integration returns false quickly
-	
-	if( ! is_object($GLOBALS["xoopsModule"]) ) return false ;
-	$not_modid = $GLOBALS["xoopsModule"]->getVar('mid') ;
-	
-	$posts_tags = array( 'XPRESS_AUTH_NAME' =>$user_name,'XPRESS_BLOG_NAME' =>$blog_name,'XPRESS_POST_TITLE' => $post_title , 'XPRESS_POST_URL' => $post_url ) ;
-
-	$notification_handler =& xoops_gethandler( 'notification' ) ;	
-	switch ($not_event) {
-		case 'newpost' :
-			$notification_handler->triggerEvent( 'global' , 0 , 'newpost' , $posts_tags , false , $not_modid ) ;
-			$notification_handler->triggerEvent( 'author' , $post_author , 'newpost' , $posts_tags , false , $not_modid ) ;
-
-			// categorie notification
-			include(XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/wp-includes/version.php');
-			if ($wp_db_version < 6124){
-				$sql2 = "SELECT c.cat_ID, c.cat_name FROM ".$table_categories." c, ".$table_post2cat." p2c WHERE c.cat_ID = p2c.category_id AND p2c.post_id=".$post_id;
-			} else {
-				$sql2  = "SELECT $table_term_relationships.object_id, $table_terms.term_id AS cat_ID, $table_terms.name AS cat_name ";
-				$sql2 .= "FROM $table_term_relationships INNER JOIN ($table_term_taxonomy INNER JOIN $table_terms ON $table_term_taxonomy.term_id = $table_terms.term_id) ON $table_term_relationships.term_taxonomy_id = $table_term_taxonomy.term_taxonomy_id ";
-				$sql2 .= "WHERE ($table_term_relationships.object_id =" . $post_id.") AND ($table_term_taxonomy.taxonomy='category')";		
-			}
-			$res2 = $db->query($sql2);
-			while($row2 = $db->fetchArray($res2)){
-				$cat_id = $row2['cat_ID'];
-				$cat_name = $row2['cat_name'];
-				$posts_tags = array( 'XPRESS_AUTH_NAME' =>$user_name,'XPRESS_BLOG_NAME' =>$blog_name,'XPRESS_CAT_TITLE' => $cat_name,'XPRESS_POST_TITLE' => $post_title , 'XPRESS_POST_URL' => $post_url ) ;
-				$notification_handler->triggerEvent( 'category' , $cat_id , 'newpost' , $posts_tags , false , $not_modid ) ;
-			}
-			break;
-		case 'editpost' :
-			$notification_handler->triggerEvent( 'post' , $post_id , 'editpost' , $posts_tags , false , $not_modid ) ;
-			break;
-		default :
-	}
-}		
-
-
-
-	
-?>
Index: trunk/include/oninstall.php
===================================================================
--- trunk/include/oninstall.php	(revision 95)
+++ trunk/include/oninstall.php	(revision 96)
@@ -51,4 +51,5 @@
 	wp_cache_flush();
 	make_db_current_silent();
+	$ret[] = "The data base of wordpress was made by prefix $table_prefix.";
 	
 	$option_desc = __('WordPress web address');
@@ -67,12 +68,43 @@
 	update_option("home", $site_url);
 	update_option("siteurl", $site_url);
+	update_option("what_to_show", "posts");
+	update_option('default_pingback_flag', 0);
+	$ret[] = 'The initial data was written in the data base of wordpress.';
+	
 	update_option("template", "xpress_default");
 	update_option("stylesheet", "xpress_default");
-	update_option("what_to_show", "posts");
-
+	$ret[] = 'The default theme of wordpress was set to xpress_default.';
 	/* add new option for uploads */
 //	update_option('uploads_use_yearmonth_folders', 1);
 //	update_option('upload_path', $module->getVar("dirname"));
 	
+		
+// Admin User Data write
+	// Change uid field
+	$wpdb->query("ALTER TABLE $wpdb->posts CHANGE `post_author` `post_author` mediumint(8) NOT NULL DEFAULT '0'");
+	$user_name = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("uname"):'admin';
+	$email = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("email"):'foo@exsample.com';
+	$pass_md5 = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("pass"):'';
+	
+	$user_id = username_exists($user_name);
+	if ( !$user_id ) {
+		$random_password = 'admin';
+		$user_id = wp_create_user($user_name, $random_password, $email);
+	} else {
+		$random_password = __('User already exists.  Password inherited.');
+	}
+
+	$user = new WP_User($user_id);
+	$user->set_role('administrator');
+	'User ' . $user_name . ' of the administrator was made.';
+	// over write xoops md5 password 
+	$sql = "UPDATE $wpdb->users SET user_pass ='$pass_md5' WHERE ID = $user_id";
+	$wpdb->query($sql);
+	$ret[] = 'The password of XOOPS was copied.';
+	// Set Default data
+	wp_install_defaults($user_id);
+	$ret[] = 'The first sample post & comment was written.';
+//	    generate_page_uri_index();
+
 	/* activate the XPressME plugin */
 	$plugin_current = "xpressme/xpressme.php";
@@ -80,18 +112,6 @@
 	include_once(dirname(__FILE__) . '/../wp-content/plugins/'.$plugin_current);
 	do_action('activate_'.$plugin_current);
-		
-// Admin User Data write
-	// Change uid field
-	$wpdb->query("ALTER TABLE $wpdb->posts CHANGE `post_author` `post_author` mediumint(8) NOT NULL DEFAULT '0'");
-	$ID = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("uid"):1;
-//   	require_once($mydirpath . '/include/user_sync.php');
-	$sync_messg = '';
-//	user_sync_to_wordpress($ID,$sync_messg);		//this function in XPressME plugin 
-
-	// Set Default data
-		wp_install_defaults($ID);
-//	    generate_page_uri_index();
-
-	        
+	$ret[] = 'The xpressme plug-in was activated.';
+	
 	// create views table
 	$xp_prefix = $mydirname;
@@ -115,4 +135,6 @@
 
 	dbDelta($views_queries);
+	$ret[] = "$views_table table of XPressME was made.";
+
 	
 	$d3forum_link = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_d3forum_link' ;
@@ -124,4 +146,5 @@
 		)$charset_collate;";
 	dbDelta($views_queries);
+	$ret[] = "$d3forum_link table of XPressME was made.";
 	
 	$group_role = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_group_role' ;
@@ -136,4 +159,6 @@
 		)$charset_collate;";
 	dbDelta($views_queries);
+	$ret[] = "$group_role table of XPressME was made.";
+
 	$sql = "INSERT INTO $group_role (groupid, role) VALUES (1, 'administrator')";
 	$wpdb->query($sql);
Index: trunk/include/onupdate.php
===================================================================
--- trunk/include/onupdate.php	(revision 95)
+++ trunk/include/onupdate.php	(revision 96)
@@ -46,4 +46,5 @@
 		}				
 	}
+
 	/* activate the tag plugin */
 	$plugin_current = "xpressme/xpressme.php";
Index: trunk/include/request_url.php
===================================================================
--- trunk/include/request_url.php	(revision 95)
+++ trunk/include/request_url.php	(revision 96)
@@ -13,7 +13,7 @@
  */
 function check_page_call($check_file =''){
-	global $xoops_config;
+	global $xoops_config;	// not object at install
 	if (empty($check_file)) return false;
-	$xpress_page = 	$xoops_config->module_name . '/' . $check_file;
+	$xpress_page = 	basename(dirname(dirname(__FILE__))) . '/' . $check_file;
 	$php_script_name = $_SERVER['SCRIPT_NAME'];
 	$php_query_string = $_SERVER['QUERY_STRING'];
@@ -49,3 +49,11 @@
 	return $ret;
 }
+
+function is_xpress_install_call(){
+	$action = 'action=ModuleInstall&dirname=';
+	$php_script_name = $_SERVER['SCRIPT_NAME'];
+	$php_query_string = $_SERVER['QUERY_STRING'];
+	if (strstr($php_query_string,$action) !== false) return true;
+	return false;
+}
 ?>
Index: trunk/include/xpress_block_render.php
===================================================================
--- trunk/include/xpress_block_render.php	(revision 95)
+++ trunk/include/xpress_block_render.php	(revision 96)
@@ -99,4 +99,24 @@
 	}
 	
+    function xpress_block_cache_found($mydirname,$block_name)
+    {
+    	global $xoops_config;
+    	if(defined('XOOPS_ROOT_PATH')){
+    		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+    	} else {
+    		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
+    	}
+    	$xml_name = $block_name . '.xml';
+
+        $filename = $cache_dir .$mydirname . '_' . $xml_name;
+		$cache_time = 0;
+//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) {
+        if (file_exists($filename)) {
+            return true;
+       } else {
+			return false;
+		}
+    } 
+	
 	function xpress_block_render($mydirname,$block_function_name,$options)
 	{
@@ -108,5 +128,7 @@
 		$blockID =get_block_id($mydirname,$func_file,$options);		
 
-		if (!is_null($wpdb)){
+		$this_url = '/modules/'. $mydirname;
+		$call_url = $_SERVER['REQUEST_URI'];
+		if (strstr($call_url,$this_url)){
 			xpress_block_css_set($mydirname);
 			
@@ -114,10 +136,11 @@
 			require_once $block_theme_file;
 			$block = $call_theme_function_name($options);		//The block name and the called function name should be assumed to be the same name. 
-
-// Not Cache Write Now.  Becose Cache Write On WordPress Event			
-//			xpress_block_cache_write($mydirname,$cache_title. $blockID, $block);  
 		} else {
-			$xml = xpress_block_cache_read($mydirname,$cache_title. $blockID);
-			$block = $xml['block'];
+			if (xpress_block_cache_found($mydirname,$cache_title. $blockID)){
+				$xml = xpress_block_cache_read($mydirname,$cache_title. $blockID);
+				$block = $xml['block'];
+			} else {
+				$block['err_message'] = sprintf(_MB_XPRESS_BLOCK_CACHE_ERR, '<a href="' . XOOPS_URL . '/modules/' . $mydirname . '">' . $mydirname .'</a>');
+			}
 		}
 
Index: trunk/include/xpress_cache.php
===================================================================
--- trunk/include/xpress_cache.php	(revision 95)
+++ trunk/include/xpress_cache.php	(revision 96)
@@ -1,13 +1,28 @@
 <?php
 	
+if(!function_exists("xpress_cache_found")):
+    function xpress_cache_found($filename)
+    {
+		$cache_time = 0;
+//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) {
+        if (file_exists($filename)) {
+            return true;
+       } else {
+			return false;
+		}
+    } 
+endif;
+
 if(!function_exists("xpress_cache_read")):
     function xpress_cache_read($mydirname,$collation_key)
     {
     	global $xoops_config;
-		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
-		$cache_time = 0;
+    	if(defined('XOOPS_ROOT_PATH')){
+    		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+    	} else {
+    		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
+    	}
         $filename = $cache_dir .$mydirname . '_' . $collation_key;
-//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) {
-        if (file_exists($filename)) {
+        if (xpress_cache_found($filename)) {
             return file_get_contents($filename);
        } else {
Index: trunk/include/xpress_debug_log.php
===================================================================
--- trunk/include/xpress_debug_log.php	(revision 95)
+++ trunk/include/xpress_debug_log.php	(revision 96)
@@ -57,3 +57,71 @@
     }
 }
+
+function xpress_error_handler($errno,$errstr,$errfile,$errline,$errcontext) {
+	$module_dirpath = dirname(dirname(__FILE__));
+	$root_path = dirname(dirname(dirname(dirname(__FILE__))));
+	
+	$show_backtrace = true;
+
+	// Time stamp of error entry
+	$dt = date("Y-m-d H:i:s (T)");
+
+	// define an assoc array of error string
+	// in reality the only entries we should
+	// consider are E_WARNING, E_NOTICE, E_USER_ERROR,
+	// E_USER_WARNING and E_USER_NOTICE
+	$errortype = array (
+		E_ERROR          => "Error",
+		E_WARNING        => "Warning",
+		E_PARSE          => "Parsing Error",
+		E_NOTICE          => "Notice",
+		E_CORE_ERROR      => "Core Error",
+		E_CORE_WARNING    => "Core Warning",
+		E_COMPILE_ERROR  => "Compile Error",
+		E_COMPILE_WARNING => "Compile Warning",
+		E_USER_ERROR      => "User Error",
+		E_USER_WARNING    => "User Warning",
+		E_USER_NOTICE    => "User Notice",
+		E_STRICT          => "Runtime Notice"
+	);
+	if (strstr($errstr, 'Use of undefined constant xpress_debug_message - assumed') !== false) return;
+	// set of errors for which a var trace will be saved
+	$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
+
+	$err = "<errorentry>\n";
+	$err .= "\t<datetime>" . $dt . "</datetime>\n";
+	$err .= "\t<errornum>" . $errno . "</errornum>\n";
+	$err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n";
+	$err .= "\t<errormsg>" . $errstr . "</errormsg>\n";
+	$err .= "\t<scriptname>" . $errfile . "</scriptname>\n";
+	$err .= "\t<scriptlinenum>" . $errline . "</scriptlinenum>\n";
+	$err .= "\t<errcontext>" . $errcontext . "</errcontext>\n";
+
+	if (in_array($errno, $user_errors)) {
+		$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
+	}
+	$err .= "</errorentry>\n\n";
+
+	$err_trace = '';
+	if ($show_backtrace){	
+		$backtraces = array_reverse(debug_backtrace());
+		$err_trace .= "BACK TRACE\n";
+		foreach($backtraces as $backtrace){
+			$trace = @$backtrace['file']. "\tLINE(" . @$backtrace['line'] . ")\t" . @$backtrace['function']  . "()\n";
+			$trace = str_replace($root_path,"",$trace);
+			$trace = str_replace("\\","/",$trace);
+			$trace = str_replace($root_path,"",$trace);
+			$trace = "\t" . $trace;
+			$err_trace .= $trace;
+		}
+	}
+	$head = "\n***** XPressME ERROR LOG ****************************************************************************************************\n";
+	$message = $head . $err . $err_trace;
+	$_debug_file = $module_dirpath . '/wp-content/xpress_error.log';
+	if ($errno != E_STRICT) {
+		$_fp = fopen($_debug_file, 'a');
+		fwrite($_fp, $message);	
+		fclose($_fp);
+	}
+}
 ?>
Index: trunk/include/xpress_render.php
===================================================================
--- trunk/include/xpress_render.php	(revision 95)
+++ trunk/include/xpress_render.php	(revision 96)
@@ -10,5 +10,8 @@
 	$pattern = "<style[^>]*?>(.*)<\/style>";
 	preg_match("/".$pattern."/s",  $head_str, $style_matches);
-	$style = $style_matches[0];
+	if (empty($style_matches[0]))
+		$style = '';
+	else
+		$style = $style_matches[0];
  
 	$pattern = "<link(.*)>";
@@ -95,11 +98,13 @@
 //rendering for the module header and the body
 function xpress_render($contents){
-	global $xoopsTpl;
-	include XOOPS_ROOT_PATH."/header.php";
-	$page_title = $GLOBALS["xoopsModule"]->getVar("name")." ".wp_title('&raquo;', false);	
+	global $xoops_config , $xoopsTpl;
+	include $xoops_config->xoops_root_path ."/header.php";
+	$page_title = $GLOBALS["xoopsModule"]->getVar("name")." ".wp_title('&raquo;', false);
 	$xoopsTpl->assign('xoops_module_header', get_xpress_module_header($contents));
 	$xoopsTpl->assign('xoops_pagetitle', $page_title);
 	$xoopsTpl->assign('xpress_body_contents', get_body($contents));
 	echo get_body($contents);
+	require_once( ABSPATH .'/include/xpress_breadcrumbs.php' );
+	include $xoops_config->xoops_root_path . '/footer.php';
 }
 
