选择文件名文件大小最后修改时间操作
[📄] 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
mDelegateManager->add( 'Legacy.Admin.Event.ModuleUpdate.' . ucfirst($mydirname) . '.Success', 'bulletin_message_append_onupdate' ) ; $msgs = array() ; } else { $isCube = false ; if( ! is_array( $msgs ) ) $msgs = array() ; } $db =& Database::getInstance() ; $mid = $module->getVar('mid') ; // transations on module update // TABLES (write here ALTER TABLE etc. if necessary) if( $prev_version < 200 ){ $msgs[] = 'Executing compatible programs... (ver '. $prev_version / 100 .' to 2.x)'; $sql = sprintf("SHOW TABLES LIKE '%s'", $xoopsDB->prefix("{$mydirname}_relation") ); list($result) = $xoopsDB->fetchRow($xoopsDB->query($sql)); if( empty($result) ){ $sql = "CREATE TABLE `".$xoopsDB->prefix("{$mydirname}_relation")."` ( `storyid` int(8) NOT NULL default '0', `linkedid` int(8) NOT NULL default '0', `dirname` varchar(25) NOT NULL default '') ENGINE=MyISAM;"; if( $xoopsDB->query($sql) ){ $msgs[] = '  Table '.htmlspecialchars($xoopsDB->prefix("{$mydirname}_relation")).' created.'; }else{ $msgs[] = '  Invalid SQL '.htmlspecialchars($sql).''; } }else{ $msgs[] = '  Table '.htmlspecialchars($result).' already exsits.'; } $sql = sprintf("SHOW COLUMNS FROM %s LIKE 'block'", $xoopsDB->prefix("{$mydirname}_stories") ); list($result) = $xoopsDB->fetchRow($xoopsDB->query($sql)); if( empty($result) ){ $sql = sprintf("ALTER TABLE %s ADD `block` TINYINT( 1 ) DEFAULT '1'", $xoopsDB->prefix("{$mydirname}_stories") ); if( $xoopsDB->query($sql) ){ $msgs[] = '  Column block added.'; }else{ $msgs[] = '  Invalid SQL '.htmlspecialchars($sql).''; } }else{ $msgs[] = '  Column block already exsits.'; } // This is Duplication V2 compatibility... if( preg_match( '/^(\D+)(\d*)$/' , $mydirname , $regs ) ){ $mydirnumber = $regs[2] === '' ? '' : intval( $regs[2] ) ; $sql = sprintf("SHOW TABLES LIKE '%s%%'", str_replace('_','\_',$xoopsDB->prefix("bulletin{$mydirnumber}_")) ); $result = $xoopsDB->query($sql); while(list($table) = $xoopsDB->fetchRow($result)){ $sql = "SELECT * FROM ".$xoopsDB->prefix('modules')." WHERE dirname = 'bulletin{$mydirnumber}'"; list($count) = $xoopsDB->fetchRow($xoopsDB->query($sql)); if($count == 0){ $renamed = preg_replace('/^' .$xoopsDB->prefix("bulletin{$mydirnumber}"). '/i', $xoopsDB->prefix($mydirname), $table); $sql = "ALTER TABLE `".addslashes($table)."` RENAME `".addslashes($renamed)."` "; if( $xoopsDB->query($sql) ){ $msgs[] = '  Table '.htmlspecialchars($table).' is renamed into '.htmlspecialchars($renamed).'.'; }else{ $msgs[] = '  Failed to rename table '.htmlspecialchars($table).''; } } } } } // update table structure from 2.04 $check_rs = $db->query( "SELECT topic_created FROM ".$db->prefix($mydirname.'_topics') ) ; if( empty( $check_rs ) ) { $db->queryF( "ALTER TABLE ".$db->prefix($mydirname.'_topics')." ADD `topic_created` int(10) unsigned NOT NULL default 0, ADD `topic_modified` int(10) unsigned NOT NULL default 0, MODIFY `topic_imgurl` varchar(255) NOT NULL default '', MODIFY `topic_title` varchar(255) NOT NULL default ''" ) ; $db->queryF( "ALTER TABLE ".$db->prefix($mydirname.'_stories')." MODIFY `uid` mediumint(8) unsigned NOT NULL default 0" ) ; $db->queryF( "ALTER TABLE ".$db->prefix($mydirname.'_relation')." ADD KEY (`storyid`), ADD PRIMARY KEY (`storyid`,`linkedid`,`dirname`)" ) ; } //ver2.22->ver3.0 $sql = sprintf("SHOW TABLES LIKE '%s'", $db->prefix("{$mydirname}_topic_access") ); list($result) = $db->fetchRow($db->query($sql)); if( empty($result) ){ $sql ="CREATE TABLE ".$db->prefix("{$mydirname}_topic_access")." ( topic_id smallint(5) unsigned NOT NULL default 0, uid mediumint(8) default NULL, groupid smallint(5) default NULL, can_post tinyint(1) NOT NULL default 0, can_edit tinyint(1) NOT NULL default 0, can_delete tinyint(1) NOT NULL default 0, post_auto_approved tinyint(1) NOT NULL default 0, UNIQUE KEY (topic_id,uid), UNIQUE KEY (topic_id,groupid), KEY (topic_id), KEY (uid), KEY (groupid), KEY (can_post) ) ENGINE=MyISAM; "; if( $db->query($sql) ){ $msgs[] = '  Table '.htmlspecialchars($db->prefix("{$mydirname}_topic_access")).' created.'; }else{ $msgs[] = '  Invalid SQL '.htmlspecialchars($sql).''; } //ver2.22->ver3.0 creat data to topic_access $can_groups = array(); $can_read_topic_id = array(); $topic_access_data = ""; $sql = "SELECT gperm_groupid FROM ".$db->prefix('group_permission'); $sql .= " WHERE gperm_itemid = ".$mid; $sql .= " AND gperm_modid = 1"; $sql .= " AND gperm_name = 'module_read'"; $result = $db->query($sql); if (empty($result)){ $msgs[] = '  Invalid SQL '.htmlspecialchars($sql).''; }else{ while ($myrow = $db->fetchArray($result)) { $can_groups[$myrow['gperm_groupid']]['can_read'] = 1; $can_groups[$myrow['gperm_groupid']]['can_post'] = 0; $can_groups[$myrow['gperm_groupid']]['can_edit'] = 0; $can_groups[$myrow['gperm_groupid']]['can_delete'] = 0; $can_groups[$myrow['gperm_groupid']]['post_auto_approved'] = 0; } if (!empty($can_groups)){ //ca_post,post_auto_approved $sql = "SELECT * FROM ".$db->prefix('group_permission'); $sql .= " WHERE gperm_modid = ".$mid; $sql .= " AND gperm_name = 'bulletin_permit'"; $result = $db->query($sql); if (empty($result)){ $msgs[] = '  Invalid SQL '.htmlspecialchars($sql).''; }else{ while ($myrow = $db->fetchArray($result)) { if(isset($can_groups[$myrow['gperm_groupid']])){ switch ($myrow['gperm_itemid']) { case 1: $can_groups[$myrow['gperm_groupid']]['can_post'] = 1; break; case 2: $can_groups[$myrow['gperm_groupid']]['post_auto_approved'] = 1; break; } } } $sql = "SELECT gperm_groupid FROM ".$db->prefix('group_permission'); $sql .= " WHERE gperm_itemid = ".$mid; $sql .= " AND gperm_modid = 1"; $sql .= " AND gperm_name = 'module_admin'"; $result = $db->query($sql); if (empty($result)){ $msgs[] = '  Invalid SQL '.htmlspecialchars($sql).''; }else{ while ($myrow = $db->fetchArray($result)) { if(isset($can_groups[$myrow['gperm_groupid']])){ $can_groups[$myrow['gperm_groupid']]['can_post'] = 1; $can_groups[$myrow['gperm_groupid']]['can_edit'] = 1; $can_groups[$myrow['gperm_groupid']]['can_delete'] = 1; $can_groups[$myrow['gperm_groupid']]['post_auto_approved'] = 1; } } $sql = "SELECT topic_id FROM ".$db->prefix("{$mydirname}_topics"); $result = $db->query($sql); if (empty($result)){ $msgs[] = '  Invalid SQL '.htmlspecialchars($sql).''; }else{ while ($myrow = $db->fetchArray($result)) { $can_read_topic_id[] = $myrow['topic_id']; } if (!empty($can_read_topic_id)){ foreach ($can_read_topic_id as $topic_id) { foreach ($can_groups as $groupid => $value) { $sql = "INSERT INTO `".$db->prefix("{$mydirname}_topic_access")."`"; $sql .= " (`topic_id`, `uid`, `groupid`, `can_post`, `can_edit`, `can_delete`, `post_auto_approved`)"; $sql .= " VALUES (".$topic_id.", NULL, ".$groupid.", ".$value['can_post'].", ".$value['can_edit'].", ".$value['can_delete'].", ".$value['post_auto_approved'].")"; if ($db->query($sql)){ $msgs[] = '  Table '.htmlspecialchars($db->prefix("{$mydirname}_topic_access")).' add '.$topic_id.' for group '.$groupid ; }else{ $msgs[] = '  Invalid SQL '.htmlspecialchars($sql).''; } } } } } } } } } } // TEMPLATES (all templates have been already removed by modulesadmin) $tplfile_handler =& xoops_gethandler( 'tplfile' ) ; $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 ) && substr( $file , -5 ) == '.html' ) { $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[] = 'ERROR: Could not insert template '.htmlspecialchars($mydirname.'_'.$file).' to the database.'; } else { $tplid = $tplfile->getVar( 'tpl_id' ) ; $msgs[] = 'Template '.htmlspecialchars($mydirname.'_'.$file).' added to the database. (ID: '.$tplid.')'; // 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[] = 'ERROR: Failed compiling template '.htmlspecialchars($mydirname.'_'.$file).'.'; } else { $msgs[] = 'Template '.htmlspecialchars($mydirname.'_'.$file).' compiled.'; } } } } closedir( $handler ) ; } include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; include_once XOOPS_ROOT_PATH.'/class/template.php' ; xoops_template_clear_module_cache( $mid ) ; // BLOCKS $tpl_path = dirname(__FILE__).'/templates/blocks' ; 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 ) && substr( $file , -5 ) == '.html' ) { $mtime = intval( @filemtime( $file_path ) ) ; $tpl_file = $mydirname . '_' . $file; $tpl_source = file_get_contents( $file_path ); $sql = "SELECT tpl_id, tpl_refid FROM ".$db->prefix('tplfile')." WHERE tpl_module='$mydirname' AND tpl_file=".$db->quoteString($tpl_file)." AND tpl_tplset='default' LIMIT 1"; list($tpl_id, $block_id) = $db->fetchRow($db->query($sql)); if( empty($tpl_id) && empty($block_id)){ $blocks_info = $module->getInfo('blocks'); $show_func = ''; foreach($blocks_info as $oneblock){ if($tpl_file == $oneblock['template']){ $show_func = $oneblock['show_func']; break; } } if( $show_func != ''){ $sql = sprintf("SELECT bid FROM %s WHERE dirname=%s AND show_func=%s", $db->prefix("newblocks"), $db->quoteString($mydirname), $db->quoteString($show_func) ) ; list($block_id) = $xoopsDB->fetchRow($xoopsDB->query($sql)); if($block_id){ $tplfile =& $tplfile_handler->create(); $tplfile->setVar('tpl_module', $mydirname); $tplfile->setVar('tpl_refid', $block_id); $tplfile->setVar('tpl_source', $tpl_source, true); $tplfile->setVar('tpl_tplset', 'default'); $tplfile->setVar('tpl_file', $tpl_file, true); $tplfile->setVar('tpl_type', 'block'); $tplfile->setVar('tpl_lastimported', 0); $tplfile->setVar('tpl_lastmodified', $mtime); $tplfile->setVar('tpl_desc', '', true); if (!$tplfile_handler->insert($tplfile)) { $msgs[] = '  ERROR: Could not insert template '.$tpl_file.' to the database.'; } else { $newid = $tplfile->getVar('tpl_id'); $msgs[] = '  Template '.$tpl_file.' added to the database.'; if ($xoopsConfig['template_set'] == 'default') { if (!xoops_template_touch($block_id)) { $msgs[] = '  ERROR: Template '.$tpl_file.' recompile failed.'; } else { $msgs[] = '  Template '.$tpl_file.' recompiled.'; } } } $sql = "UPDATE ".$db->prefix("newblocks")." SET template=".$db->quoteString($tpl_file).", last_modified=".time()." WHERE bid=".$block_id; if( !$result = $db->query($sql) ) { $msgs[] = 'ERROR: Could not insert template '.htmlspecialchars($mydirname.'_'.$file).' to the database.'; }else{ $msgs[] = 'Template '.htmlspecialchars($mydirname.'_'.$file).' added to the database. (ID: '.$newid.')'; } } } } elseif (!empty($tpl_id) && isset($tpl_source) && $tpl_source != '') { $sql = "SELECT COUNT(*) FROM ".$db->prefix('tplsource')." WHERE tpl_id='$tpl_id'"; list($count) = $xoopsDB->fetchRow($xoopsDB->query($sql)); if($count==0){ $sql = sprintf("INSERT INTO %s (tpl_id, tpl_source) VALUES (%u, %s)", $db->prefix('tplsource'), $tpl_id, $db->quoteString($tpl_source)); }else{ $sql = "UPDATE ".$db->prefix("tplsource")." SET tpl_source=".$db->quoteString($tpl_source)." WHERE tpl_id=".$tpl_id; } if( !$result = $db->query($sql) ) { $msgs[] = 'ERROR: Could not insert template '.htmlspecialchars($mydirname.'_'.$file).' to the database.'; } else { $sql = "UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified=".$mtime." WHERE tpl_id=".$tpl_id; $db->query($sql); $msgs[] = 'Template '.htmlspecialchars($mydirname.'_'.$file).' added to the database. (ID: '.$tpl_id.')'; // generate compiled file include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; include_once XOOPS_ROOT_PATH.'/class/template.php'; if( ! xoops_template_touch( $tpl_id ) ) { $msgs[] = 'ERROR: Failed compiling template '.htmlspecialchars($mydirname.'_'.$file).'.'; } else { $msgs[] = 'Template '.htmlspecialchars($mydirname.'_'.$file).' compiled.'; } } $sql = "UPDATE ".$db->prefix("newblocks")." SET template=".$db->quoteString($tpl_file).", last_modified=".time()." WHERE bid=".$block_id; if( !$result = $db->query($sql) ) { $msgs[] = 'ERROR: Could not set template '.htmlspecialchars($mydirname.'_'.$file).' to the `newblocks` table.'; }else{ $msgs[] = 'Template '.htmlspecialchars($mydirname.'_'.$file).' added to the `newblocks` table. (BID: '.$block_id.')'; } } } } closedir( $handler ) ; } return true ; } function bulletin_message_append_onupdate( &$module_obj , &$log ) { if( is_array( @$GLOBALS['msgs'] ) ) { foreach( $GLOBALS['msgs'] as $message ) { $log->add( strip_tags( $message ) ) ; } } } ?>