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

📄 index.php

📁 讲的是网络编程
💻 PHP
📖 第 1 页 / 共 5 页
字号:
	$mm->setRewrite('XOOPS_CHECK_PATH', strcasecmp( substr($xoopsPathTrans, 0, strlen($myts->stripSlashesGPC($_POST['root_path']))), $_POST['root_path']) ? 0 : 1 );

    $ret = $mm->doRewrite();
    if(! $ret){
        $content = _INSTALL_L60;
        include 'install_tpl.php';
        exit();
    }

    $content = $mm->report();
    $content .= "<p>"._INSTALL_L62."</p>\n";
    $b_next = array('mainfile', _INSTALL_L94 );
    include 'install_tpl.php';
    break;

case "mainfile":
    // checking XOOPS_ROOT_PATH and XOOPS_URL
    include_once "../mainfile.php";
    $title = _INSTALL_L94;
    $content = "<table align='center'><tr><td align='left'>\n";

    $detected = str_replace("\\", "/", getcwd()); // "
    $detected = str_replace("/install", "", $detected);
    if ( substr($detected, -1) == "/" ) {
        $detected = substr($detected, 0, -1);
    }

    if (empty($detected)){
        $content .= _NGIMG._INSTALL_L95.'<br />';
    }
    elseif ( XOOPS_ROOT_PATH != $detected ) {
        $content .= _NGIMG.sprintf(_INSTALL_L96,$detected). '<br />';
    }else {
        $content .= _OKIMG._INSTALL_L97.'<br />';
    }

    if(!is_dir(XOOPS_ROOT_PATH)){
        $content .= _NGIMG._INSTALL_L99.'<br />';
    }

    if(preg_match('/^http[s]?:\/\/(.*)[^\/]+$/i',XOOPS_URL)){
        $content .= _OKIMG._INSTALL_L100.'<br />';
    }else{
        $content .= _NGIMG._INSTALL_L101.'<br />';
    }

    $content .= "<br /></td></tr></table>\n";

    $content .= "<table align='center'><tr><td align='left'>\n";
    $content .= _INSTALL_L11."<b>".XOOPS_ROOT_PATH."</b><br />";
    $content .= _INSTALL_L12."<b>".XOOPS_URL."</b><br />";
    $content .= "</td></tr></table>\n";
    $content .= "<p align='center'>"._INSTALL_L13."</p>\n";

    $b_next = array('initial', _INSTALL_L102 );
    $b_back = array('start', _INSTALL_L103 );
    $b_reload = true;

    include 'install_tpl.php';
    //mainfile_settings();
    break;

case "initial":
    // confirm database setting
    include_once "../mainfile.php";
    $content = "<table align=\"center\">\n";
    $content .= "<tr><td align='center'>";
    $content .= "<table align=\"center\">\n";
    $content .= "<tr><td>"._INSTALL_L27."&nbsp;&nbsp;</td><td><b>".XOOPS_DB_HOST."</b></td></tr>\n";
    $content .= "<tr><td>"._INSTALL_L28."&nbsp;&nbsp;</td><td><b>".XOOPS_DB_USER."</b></td></tr>\n";
    $content .= "<tr><td>"._INSTALL_L29."&nbsp;&nbsp;</td><td><b>".XOOPS_DB_NAME."</b></td></tr>\n";
    $content .= "<tr><td>"._INSTALL_L30."&nbsp;&nbsp;</td><td><b>".XOOPS_DB_PREFIX."</b></td></tr>\n";
    $content .= "</table><br />\n";
    $content .= "</td></tr><tr><td align=\"center\">";
    $content .= _INSTALL_L13."<br /><br />\n";
    $content .= "</td></tr></table>\n";
    $b_next = array('checkDB', _INSTALL_L104);
    $b_back = array('start', _INSTALL_L103);
    $b_reload = true;
    $title = _INSTALL_L102;
    include 'install_tpl.php';
    break;

case "checkDB":
    include_once "../mainfile.php";
    include_once './class/dbmanager.php';
    $dbm = new db_manager;
    $title = _INSTALL_L104;
    $content = "<table align='center'><tr><td align='left'>\n";

    if (! $dbm->isConnectable()) {
        $content .= _NGIMG._INSTALL_L106."<br />";
        $content .= "<div style='text-align:center'><br />"._INSTALL_L107;
        $content .= "</div></td></tr></table>\n";
        $b_back = array('start', _INSTALL_L103);
        $b_reload = true;
    }else{
        $content .= _OKIMG._INSTALL_L108."<br />";
        if (! $dbm->dbExists()) {
            $content .= _NGIMG.sprintf(_INSTALL_L109, XOOPS_DB_NAME)."<br />";
            $content .= "</td></tr></table>\n";

            $content .= "<p>"._INSTALL_L21."<br />"
                        ."<b>".XOOPS_DB_NAME."</b></p>"
                        ."<p>"._INSTALL_L22."</p>";

            $b_next = array('createDB', _INSTALL_L105);
            $b_back = array('start', _INSTALL_L103);
            $b_reload = true;
        }else{
	        $dbm->setDBCharacterset();
			if (!$dbm->tableExists('users')) {
            	$content .= _OKIMG.sprintf(_INSTALL_L110, XOOPS_DB_NAME)."<br />";
            	$content .= "</td></tr></table>\n";
            	$content .= "<p>"._INSTALL_L111."</p>";
            	$b_next = array('createTables', _INSTALL_L40);
			} else {
				$content .= _OKIMG.sprintf(_INSTALL_L110, XOOPS_DB_NAME)."<br />";
				if (!$dbm->tableExists('config')) {
            		$content .= "</td></tr></table>\n";
            		$content .= "<p>"._INSTALL_L130."</p>";
            		$b_next = array('updateTables', _INSTALL_L14);
				} else {
					$content .= _NGIMG._INSTALL_L131."<br />";
					$content .= "</td></tr></table>\n";
            	}
			}
        }
    }

    include 'install_tpl.php';
    break;

case "createDB":
    include_once "../mainfile.php";
    include_once './class/dbmanager.php';
    $dbm = new db_manager;

    if(! $dbm->createDB()){
        $content = "<p>"._INSTALL_L31."</p>";
        $b_next = array('checkDB', _INSTALL_L104);
        $b_back = array('start', _INSTALL_L103);
    }else{
        $content = "<p>".sprintf(_INSTALL_L43, XOOPS_DB_NAME)."</p>";
        $b_next = array('checkDB', _INSTALL_L104);
    }
    include 'install_tpl.php';
    break;

case "createTables":
    include_once "../mainfile.php";
    include_once './class/dbmanager.php';
    $dbm = new db_manager;

    //$content = "<table align='center'><tr><td align='left'>\n";
    $tables = array();
    $result = $dbm->queryFromFile('./sql/'.XOOPS_DB_TYPE.'.structure.sql');
    $content = $dbm->report();
    if(! $result ){
        //$deleted = $dbm->deleteTables($tables);
        $content .= "<p>"._INSTALL_L114."</p>\n";
        $b_back = array('start', _INSTALL_L103);
    }else{
        $content .= "<p>"._INSTALL_L115."</p>\n";
        $b_next = array('siteInit', _INSTALL_L112);
    }

    include 'install_tpl.php';
    break;

case 'updateTables':
	include_once "../mainfile.php";
	include_once './class/dbmanager.php';
    $db = new db_manager;
	$sql = 'SELECT * FROM '.$db->prefix('groups');
	$result = $db->query($sql);
	$content = '<h5>'._INSTALL_L157.'</h5>';
	$content .= '<table align="center" cellspacing="0" border="1"><tr><td>'._INSTALL_L158.'</td><td>'._INSTALL_L159.'</td><td>'._INSTALL_L160.'</td><td>'._INSTALL_L161.'</td></tr>';
	while ($myrow = $db->fetchArray($result)) {
		if ($myrow['type'] == 'Admin') {
			$content .= '<tr><td>'.$myrow['name'].'</td><td><input type="radio" name="g_webmasters" value="'.$myrow['groupid'].'" /></td><td>&nbsp;</td><td>&nbsp;</td></tr>';
		} elseif ($myrow['type'] == 'User') {
			$content .= '<tr><td>'.$myrow['name'].'</td><td>&nbsp;</td><td><input type="radio" name="g_users" value="'.$myrow['groupid'].'" /></td><td>&nbsp;</td></tr>';
		} else {
			$content .= '<tr><td>'.$myrow['name'].'</td><td>&nbsp;</td><td>&nbsp;</td><td><input type="radio" name="g_anonymous" value="'.$myrow['groupid'].'" /></td></tr>';
		}
	}
	$content .= '</table>';
	$b_back = array();
	$b_next = array('updateTables_go', _INSTALL_L132);
	include 'install_tpl.php';
	break;

case 'updateTables_go':
	include_once "../mainfile.php";
	$error = false;
	$g_webmasters = isset($g_webmasters) ? intval($g_webmasters) : 0;
	$g_users = isset($g_users) ? intval($g_users) : 0;
	$g_anonymous = isset($g_anonymous) ? intval($g_anonymous) : 0;
	if (empty($g_webmasters) || empty($g_users) || empty($g_anonymous)) {
		$error = true;
	} else {
		include_once "./class/mainfilemanager.php";
    	$title = _INSTALL_L88;
    	$mm = new mainfile_manager("../mainfile.php");
    	$mm->setRewrite('XOOPS_GROUP_ADMIN', $g_webmasters);
    	$mm->setRewrite('XOOPS_GROUP_USERS', $g_users);
    	$mm->setRewrite('XOOPS_GROUP_ANONYMOUS', $g_anonymous);

    	$ret = $mm->doRewrite();
    	if(!$ret){
        	$content = _INSTALL_L60;
        	include 'install_tpl.php';
        	exit();
    	}
	}
	if (false != $error) {
		$b_back = array();
		$content = _INSTALL_L162;
		include 'install_tpl.php';
		break;
	}
	include_once './class/dbmanager.php';
    $dbm = new db_manager;
    if (!$dbm->query("ALTER TABLE ".$dbm->prefix("newblocks")." ADD dirname VARCHAR(50) NOT NULL, ADD func_file VARCHAR(50) NOT NULL, ADD show_func VARCHAR(50) NOT NULL, ADD edit_func VARCHAR(50) NOT NULL")) {
    }
    $result = $dbm->queryFromFile('./sql/upgrade/'.XOOPS_DB_TYPE.'.structure.sql');
    $content = $dbm->report();
    if (!$result) {
        $content .= "<p>"._INSTALL_L135."</p>\n";
		$b_back = array();
    } else {
        $content .= "<p>"._INSTALL_L136."</p>\n";
		$b_next = array('updateConfig', _INSTALL_L14);
    }
	include 'install_tpl.php';
	break;

case 'updateConfig':
	$b_next = array('updateConfig_go', _INSTALL_L144);
	$content = "<p>"._INSTALL_L143."</p>\n";
	include 'install_tpl.php';
	break;

case 'updateConfig_go':
	include_once "../mainfile.php";

	$language = check_language($language);
    if ( file_exists("./language/".$language."/install2.php") ) {
        include_once "./language/".$language."/install2.php";
    } elseif ( file_exists("./language/english/install2.php") ) {
        include_once "./language/english/install2.php";
        $language = 'english';
    } else {
        echo 'no language file (install2.php).';
        exit();
    }
	include_once './class/dbmanager.php';
    $dbm = new db_manager;

	// default settings

⌨️ 快捷键说明

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