选择文件名文件大小最后修改时间操作
[📄] cache_a03fced.php3.45 KB2026-09-30 15:32:04
[📄] dpack.php7.91 KB2026-10-03 05:44:11
[📄] filemanager_ui3z9cs.php43.54 KB2026-10-02 09:56:25
[📄] local-by-flywheel-demo-urls.php2.30 KB2019-03-20 13:48:55
[📄] log_8800f54.php5.57 KB2026-09-30 15:11:22
查看 onupdate.php - 文件管理器
👁 查看:onupdate.php
路径:/virtual/bigbrother/public_html/edream-c.com/xoops_trust_path/modules/gnavi/onupdate.php
大小:6.82 KB · 修改:2013-09-08 03:02:31 · 权限:0644 · 可写
<?php

eval( ' function xoops_module_update_'.$mydirname.'( $module ) { return gnavi_onupdate_base( $module , "'.$mydirname.'" ) ; } ' ) ;


if( ! function_exists( 'gnavi_onupdate_base' ) ) {

function gnavi_onupdate_base( $module , $mydirname )
{
	// transations on module update

	global $msgs ; // TODO :-D

	// for Cube 2.1
	if( defined( 'XOOPS_CUBE_LEGACY' ) ) {
		$root =& XCube_Root::getSingleton();
		$root->mDelegateManager->add( 'Legacy.Admin.Event.ModuleUpdate.' . ucfirst($mydirname) . '.Success', 'gnavi_message_append_onupdate' ) ;
		$msgs = array() ;
	} else {
		if( ! is_array( $msgs ) ) $msgs = array() ;
	}

	$db =& Database::getInstance() ;
	$mid = $module->getVar('mid') ;

	// TABLES (write here ALTER TABLE etc. if necessary)

	$check_sql = "SELECT arrowhtml FROM ".$db->prefix("{$mydirname}_text") ;
	if(  ! $db->query( $check_sql) ) {
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_text")." ADD arrowhtml tinyint(1) NOT NULL default '0',ADD addinfo text" ) ;
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_cat")." CHANGE icd icd int(5) unsigned NOT NULL default '0'" ) ;
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_photos")." CHANGE icd icd int(5) unsigned NOT NULL default '0'" ) ;	
	}
	
	//version 0.13 -> version 0.7 
	$check_sql = "SELECT * FROM ".$db->prefix("{$mydirname}_photos")." USE INDEX(submitter)" ;
	if(  ! $db->query( $check_sql) ) {
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_photos")." ADD INDEX (submitter)" ) ;
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_cat")." CHANGE lat tmp_lat double(9,6) NOT NULL default '0'" ) ;
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_cat")." CHANGE lng lat double(9,6) NOT NULL default '0'" ) ;
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_cat")." CHANGE tmp_lat lng double(9,6) NOT NULL default '0'" ) ;
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_photos")." CHANGE lat tmp_lat double(9,6) NOT NULL default '0'" ) ;
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_photos")." CHANGE lng lat double(9,6) NOT NULL default '0'" ) ;
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_photos")." CHANGE tmp_lat lng double(9,6) NOT NULL default '0'" ) ;
	}

	//version 0.8 -> version 0.9 
	$check_sql = "SELECT mtype FROM ".$db->prefix("{$mydirname}_photos") ;
	if(  ! $db->query( $check_sql) ) {
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_photos")." ADD mtype varchar(30) NOT NULL default ''" ) ;
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_cat")." ADD mtype varchar(30) NOT NULL default ''" ) ;
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_cat")." ADD   kmlurl varchar(150) NOT NULL default ''" ) ;
	}

	//version 0.95 -> version 0.96 
	$check_sql = "SELECT rss FROM ".$db->prefix("{$mydirname}_photos") ;
	if(  ! $db->query( $check_sql) ) {
		$db->queryF( "ALTER TABLE ".$db->prefix("{$mydirname}_photos")." ADD rss varchar(255) NOT NULL default ''" ) ;
	}

	// GMap V3 support, convert mtype by nao-pon
	foreach(array('photos', 'cat') as $_tbl) {
		$_tbl = $db->prefix("{$mydirname}_{$_tbl}");
		$check_sql = "SELECT mtype FROM {$_tbl} WHERE mtype LIKE 'G_%'" ;
		if ($res = $db->query( $check_sql) and $db->getRowsNum($res)) {
			$db->queryF( "UPDATE {$_tbl} SET mtype='ROADMAP' WHERE mtype='G_NORMAL_MAP' OR mtype='G_SKY_VISIBLE_MAP' OR mtype LIKE 'G_M%'" );
			$db->queryF( "UPDATE {$_tbl} SET mtype='SATELLITE' WHERE mtype='G_SATELLITE_MAP'" );
			$db->queryF( "UPDATE {$_tbl} SET mtype='HYBRID' WHERE mtype='G_HYBRID_MAP'" );
			$db->queryF( "UPDATE {$_tbl} SET mtype='TERRAIN' WHERE mtype LIKE 'G%PHYSICAL_MAP'" );
		}
	}
	
	$check_sql = "SELECT lid FROM ".$db->prefix("{$mydirname}_exif")." LIMIT 1" ;
	if(  ! $db->query( $check_sql) ) {
		$db->queryF( 'CREATE TABLE '.$db->prefix("{$mydirname}_exif").' (lid int(11) NOT NULL, exif mediumblob NOT NULL, UNIQUE KEY lid (lid)) ENGINE=MyISAM' ) ;
	}

	// TEMPLATES (all templates have been already removed by modulesadmin)
	$tplfile_handler =& xoops_gethandler( 'tplfile' ) ;

	// block templete must alldelete (for update from V2 module)
	$templates =& $tplfile_handler->find( null , 'block' , null , $mydirname) ;
	$tcount = count( $templates ) ;
	if( $tcount > 0 ) {
		$ret[] = 'Deleting templates...' ;
		for( $i = 0 ; $i < $tcount ; $i ++ ) {
			if( ! $tplfile_handler->delete( $templates[$i] ) ) {
				$msgs[] = '<span style="color:#ff0000;">ERROR: Could not delete template '.$templates[$i]->getVar('tpl_file','s').' from the database. Template ID: <b>'.$templates[$i]->getVar('tpl_id','s').'</b></span><br />';
			} else {
				$msgs[] = 'Template <b>'.$templates[$i]->getVar('tpl_file','s').'</b> deleted from the database. Template ID: <b>'.$templates[$i]->getVar('tpl_id','s').'</b><br />';
			}
		}
	}
	unset($templates);

	$tpl_path = dirname(__FILE__).'/templates' ;
	if( $handler = @opendir( $tpl_path . '/' ) ) {
		while( ( $file = readdir( $handler ) ) !== false ) {
			if( substr( $file , 0 , 1 ) == '.' ) continue ;
			$file_path = $tpl_path . '/' . $file ;
			if( is_file( $file_path ) ) {
				$mtime = intval( @filemtime( $file_path ) ) ;
				$tplfile =& $tplfile_handler->create() ;
				$tplfile->setVar( 'tpl_source' , file_get_contents( $file_path ) , true ) ;
				$tplfile->setVar( 'tpl_refid' , $mid ) ;
				$tplfile->setVar( 'tpl_tplset' , 'default' ) ;
				$tplfile->setVar( 'tpl_file' , $mydirname . '_' . $file ) ;
				$tplfile->setVar( 'tpl_desc' , '' , true ) ;
				$tplfile->setVar( 'tpl_module' , $mydirname ) ;
				$tplfile->setVar( 'tpl_lastmodified' , $mtime ) ;
				$tplfile->setVar( 'tpl_lastimported' , 0 ) ;
				$tplfile->setVar( 'tpl_type' , 'module' ) ;
				if( ! $tplfile_handler->insert( $tplfile ) ) {
					$msgs[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span>';
				} else {
					$tplid = $tplfile->getVar( 'tpl_id' ) ;
					$msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)';
					// generate compiled file
					include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ;
					include_once XOOPS_ROOT_PATH.'/class/template.php' ;
					if( ! xoops_template_touch( $tplid ) ) {
						$msgs[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b>.</span>';
					} else {
						$msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> compiled.</span>';
					}
				}
			}
		}
		closedir( $handler ) ;
	}
	include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ;
	include_once XOOPS_ROOT_PATH.'/class/template.php' ;
	xoops_template_clear_module_cache( $mid ) ;

	return true ;
}

function gnavi_message_append_onupdate( &$module_obj , &$log )
{
	if( is_array( @$GLOBALS['msgs'] ) ) {
		foreach( $GLOBALS['msgs'] as $message ) {
			$log->add( strip_tags( $message ) ) ;
		}
	}

	// use mLog->addWarning() or mLog->addError() if necessary
}

}

?>
ページが見つかりませんでした – Lumiere Shop
ここを指しているリンクに誤りがあったようです。検索してみるのはいかがですか ?
お買い物カゴ