⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.php

📁 在综合英文版XOOPS 2.09, 2.091, 2.092 的基础上正式发布XOOPS 2.09中文版 XOOPS 2.09x 版主要是PHP5升级、bug修正和安全补正: 1 全面兼容PHP 5.
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php// $Id: main.php,v 1.1.1.1 2004/09/25 13:46:18 phppp Exp $//  ------------------------------------------------------------------------ ////                XOOPS - PHP Content Management System                      ////                    Copyright (c) 2000 XOOPS.org                           ////                       <http://www.xoops.org/>                             ////  ------------------------------------------------------------------------ ////  This program is free software; you can redistribute it and/or modify     ////  it under the terms of the GNU General Public License as published by     ////  the Free Software Foundation; either version 2 of the License, or        ////  (at your option) any later version.                                      ////                                                                           ////  You may not change or alter any portion of this comment or credits       ////  of supporting developers from this source code or any supporting         ////  source code which is considered copyrighted (c) material of the          ////  original comment or credit authors.                                      ////                                                                           ////  This program is distributed in the hope that it will be useful,          ////  but WITHOUT ANY WARRANTY; without even the implied warranty of           ////  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            ////  GNU General Public License for more details.                             ////                                                                           ////  You should have received a copy of the GNU General Public License        ////  along with this program; if not, write to the Free Software              ////  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA ////  ------------------------------------------------------------------------ //// Author: Kazumi Ono (AKA onokazu)                                          //// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //// Project: The XOOPS Project                                                //// ------------------------------------------------------------------------- //if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) {	exit("Access Denied");}include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';include_once XOOPS_ROOT_PATH."/modules/system/admin/modulesadmin/modulesadmin.php";$op = "list";if ( isset($_POST) ) {	foreach ( $_POST as $k => $v ) {		${$k} = $v;  	}}if (isset($_GET['op'])) {	$op = $_GET['op'];	$module = $_GET['module'];}if ( $op == "list" ) {	xoops_module_list();	exit();}if ( $op == "confirm" ) {	xoops_cp_header();	//OpenTable();	$error = array();	if ( !is_writable(XOOPS_CACHE_PATH.'/') ) {		// attempt to chmod 666		if ( !chmod(XOOPS_CACHE_PATH.'/', 0777) ) {			$error[] = sprintf(_MUSTWABLE, "<b>".XOOPS_CACHE_PATH.'/</b>');		}	}	if ( count($error) > 0 ) {		xoops_error($error);		echo "<p><a href='admin.php?fct=modulesadmin'>"._MD_AM_BTOMADMIN."</a></p>";		xoops_cp_footer();		exit();	}	echo "<h4 style='text-align:left;'>"._MD_AM_PCMFM."</h4>	<form action='admin.php' method='post'>	<input type='hidden' name='fct' value='modulesadmin' />	<input type='hidden' name='op' value='submit' />	<table width='100%' border='0' cellspacing='1' class='outer'>	<tr align='center'><th>"._MD_AM_MODULE."</th><th>"._MD_AM_ACTION."</th><th>"._MD_AM_ORDER."</th></tr>";	$mcount = 0;	$myts =& MyTextsanitizer::getInstance();	foreach ($module as $mid) {		if ($mcount % 2 != 0) {			$class = 'odd';		} else {			$class = 'even';		}		echo '<tr class="'.$class.'"><td align="center">'.$myts->stripSlashesGPC($oldname[$mid]);		$newname[$mid] = trim($myts->stripslashesGPC($newname[$mid]));		if ($newname[$mid] != $oldname[$mid]) {			echo '&nbsp;&raquo;&raquo;&nbsp;<span style="color:#ff0000;font-weight:bold;">'.$newname[$mid].'</span>';		}		echo '</td><td align="center">';		if (isset($newstatus[$mid]) && $newstatus[$mid] ==1) {			if ($oldstatus[$mid] == 0) {				echo "<span style='color:#ff0000;font-weight:bold;'>"._MD_AM_ACTIVATE."</span>";			} else {				echo _MD_AM_NOCHANGE;			}		} else {			$newstatus[$mid] = 0;			if ($oldstatus[$mid] == 1) {				echo "<span style='color:#ff0000;font-weight:bold;'>"._MD_AM_DEACTIVATE."</span>";			} else {				echo _MD_AM_NOCHANGE;			}		}		echo "</td><td align='center'>";		if ($oldweight[$mid] != $weight[$mid]) {			echo "<span style='color:#ff0000;font-weight:bold;'>".$weight[$mid]."</span>";		} else {			echo $weight[$mid];		}		echo "		<input type='hidden' name='module[]' value='".$mid."' />		<input type='hidden' name='oldname[".$mid."]' value='".htmlspecialchars($oldname[$mid], ENT_QUOTES)."' />		<input type='hidden' name='newname[".$mid."]' value='".htmlspecialchars($newname[$mid], ENT_QUOTES)."' />		<input type='hidden' name='oldstatus[".$mid."]' value='".$oldstatus[$mid]."' />		<input type='hidden' name='newstatus[".$mid."]' value='".$newstatus[$mid]."' />		<input type='hidden' name='oldweight[".$mid."]' value='".intval($oldweight[$mid])."' />		<input type='hidden' name='weight[".$mid."]' value='".intval($weight[$mid])."' />		</td></tr>";	}	echo "	<tr class='foot' align='center'><td colspan='3'><input type='submit' value='"._MD_AM_SUBMIT."' />&nbsp;<input type='button' value='"._MD_AM_CANCEL."' onclick='location=\"admin.php?fct=modulesadmin\"' /></td></tr>	</table>	</form>";	xoops_cp_footer();	exit();}if ( $op == "submit" ) {	$ret = array();	$write = false;	foreach ($module as $mid) {		if (isset($newstatus[$mid]) && $newstatus[$mid] ==1) {			if ($oldstatus[$mid] == 0) {				$ret[] = xoops_module_activate($mid);			}		} else {			if ($oldstatus[$mid] == 1) {				$ret[] = xoops_module_deactivate($mid);			}		}		$newname[$mid] = trim($newname[$mid]);		if ($oldname[$mid] != $newname[$mid] || $oldweight[$mid] != $weight[$mid]) {			$ret[] = xoops_module_change($mid, $weight[$mid], $newname[$mid]);			$write = true;		}		flush();	}	if ( $write ) {		$contents = xoops_module_get_admin_menu();		if (!xoops_module_write_admin_menu($contents)) {			$ret[] = "<p>"._MD_AM_FAILWRITE."</p>";		}	}	xoops_cp_header();	if ( count($ret) > 0 ) {		foreach ($ret as $msg) {			if ($msg != '') {				echo $msg;			}		}	}	echo "<br /><a href='admin.php?fct=modulesadmin'>"._MD_AM_BTOMADMIN."</a>";	xoops_cp_footer();	exit();}if ($op == 'install') {	$module_handler =& xoops_gethandler('module');	$mod =& $module_handler->create();	$mod->loadInfoAsVar($module);	if ($mod->getInfo('image') != false && trim($mod->getInfo('image')) != '') {		$msgs ='<img src="'.XOOPS_URL.'/modules/'.$mod->getVar('dirname').'/'.trim($mod->getInfo('image')).'" alt="" />';	}	$msgs .= '<br /><span style="font-size:smaller;";>'.$mod->getVar('name').'</span><br /><br />'._MD_AM_RUSUREINS;	xoops_cp_header();	xoops_confirm(array('module' => $module, 'op' => 'install_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _MD_AM_INSTALL);	xoops_cp_footer();	exit();}if ($op == 'install_ok') {	$ret = array();	$ret[] = xoops_module_install($module);	$contents = xoops_module_get_admin_menu();	if (!xoops_module_write_admin_menu($contents)) {		$ret[] = "<p>"._MD_AM_FAILWRITE."</p>";	}	xoops_cp_header();	if (count($ret) > 0) {		foreach ($ret as $msg) {			if ($msg != '') {				echo $msg;			}		}	}	echo "<br /><a href='admin.php?fct=modulesadmin'>"._MD_AM_BTOMADMIN."</a>";	xoops_cp_footer();	exit();}if ($op == 'uninstall') {	$module_handler =& xoops_gethandler('module');	$mod =& $module_handler->getByDirname($module);	if ($mod->getInfo('image') != false && trim($mod->getInfo('image')) != '') {		$msgs ='<img src="'.XOOPS_URL.'/modules/'.$mod->getVar('dirname').'/'.trim($mod->getInfo('image')).'" alt="" />';	}	$msgs .= '<br /><span style="font-size:smaller;";>'.$mod->getVar('name').'</span><br /><br />'._MD_AM_RUSUREUNINS;	xoops_cp_header();	xoops_confirm(array('module' => $module, 'op' => 'uninstall_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _YES);	xoops_cp_footer();	exit();}if ($op == 'uninstall_ok') {	$ret = array();	$ret[] = xoops_module_uninstall($module);	$contents = xoops_module_get_admin_menu();	if (!xoops_module_write_admin_menu($contents)) {		$ret[] = "<p>"._MD_AM_FAILWRITE."</p>";	}	xoops_cp_header();	if (count($ret) > 0) {		foreach ($ret as $msg) {			if ($msg != '') {				echo $msg;			}		}	}	echo "<a href='admin.php?fct=modulesadmin'>"._MD_AM_BTOMADMIN."</a>";	xoops_cp_footer();	exit();}if ($op == 'update') {	$module_handler =& xoops_gethandler('module');	$mod =& $module_handler->getByDirname($module);	if ($mod->getInfo('image') != false && trim($mod->getInfo('image')) != '') {		$msgs ='<img src="'.XOOPS_URL.'/modules/'.$mod->getVar('dirname').'/'.trim($mod->getInfo('image')).'" alt="" />';	}	$msgs .= '<br /><span style="font-size:smaller;";>'.$mod->getVar('name').'</span><br /><br />'._MD_AM_RUSUREUPD;	xoops_cp_header();	xoops_confirm(array('dirname' => $module, 'op' => 'update_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _MD_AM_UPDATE);	xoops_cp_footer();	exit();}if ($op == 'update_ok') {	$dirname = trim($dirname);	$module_handler =& xoops_gethandler('module');	$module =& $module_handler->getByDirname($dirname);	include_once XOOPS_ROOT_PATH.'/class/template.php';	xoops_template_clear_module_cache($module->getVar('mid'));	// we dont want to change the module name set by admin	$temp_name = $module->getVar('name');	$module->loadInfoAsVar($dirname);	$module->setVar('name', $temp_name);	xoops_cp_header();	if (!$module_handler->insert($module)) {		echo '<p>无法更新模块 '.$module->getVar('name').'</p>';		echo "<br /><a href='admin.php?fct=modulesadmin'>"._MD_AM_BTOMADMIN."</a>";	} else {		$newmid = $module->getVar('mid');		$msgs = array();		$msgs[] = '模块数据已更新.';		$tplfile_handler =& xoops_gethandler('tplfile');		$deltpl =& $tplfile_handler->find('default', 'module', $module->getVar('mid'));		$delng = array();		if (is_array($deltpl)) {			$xoopsTpl = new XoopsTpl();			// clear cache files			$xoopsTpl->clear_cache(null, 'mod_'.$dirname);			// delete template file entry in db			$dcount = count($deltpl);			for ($i = 0; $i < $dcount; $i++) {				if (!$tplfile_handler->delete($deltpl[$i])) {					$delng[] = $deltpl[$i]->getVar('tpl_file');				}			}		}		$templates = $module->getInfo('templates');		if ($templates != false) {			$msgs[] = '更新模板...';			foreach ($templates as $tpl) {				$tpl['file'] = trim($tpl['file']);				if (!in_array($tpl['file'], $delng)) {					$tpldata =& xoops_module_gettemplate($dirname, $tpl['file']);					$tplfile =& $tplfile_handler->create();					$tplfile->setVar('tpl_refid', $newmid);					$tplfile->setVar('tpl_lastimported', 0);					$tplfile->setVar('tpl_lastmodified', time());					if (preg_match("/\.css$/i", $tpl['file'])) {						$tplfile->setVar('tpl_type', 'css');					} else {						$tplfile->setVar('tpl_type', 'module');					}					$tplfile->setVar('tpl_source', $tpldata, true);					$tplfile->setVar('tpl_module', $dirname);					$tplfile->setVar('tpl_tplset', 'default');					$tplfile->setVar('tpl_file', $tpl['file'], true);					$tplfile->setVar('tpl_desc', $tpl['description'], true);					if (!$tplfile_handler->insert($tplfile)) {						$msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">ERROR: 无法将模板文件 <b>'.$tpl['file'].'</b> 添加到数据库中.</span>';					} else {						$newid = $tplfile->getVar('tpl_id');						$msgs[] = '&nbsp;&nbsp;模板 <b>'.$tpl['file'].'</b> 已添加到数据库中.';						if ($xoopsConfig['template_set'] == 'default') {							if (!xoops_template_touch($newid)) {								$msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">ERROR: 无法重编译模板文件 <b>'.$tpl['file'].'</b>.</span>';							} else {								$msgs[] = '&nbsp;&nbsp;模板 <b>'.$tpl['file'].'</b> 已重编译.</span>';							}						}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -