Install 0.11

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
kishman155
Translator
Translator
Posts: 169
Joined: Sat Mar 12, 2005 12:30 pm
Location: Vienna

Install 0.11

Post by kishman155 »

I have modified the Installation for 2 New Options.

Set Default Languge at Step four
Set default encoding at Step four

Code: Select all

function showPageFour($sqlloaded = 0) {
    ## don't load statements if they've already been loaded
    if ($sqlloaded == 0 && isset($_POST["createtables"])) {

        global $config, $CMS_SCHEMA_VERSION;

		$db = &ADONewConnection($_POST['dbms']);
		#$db->debug = true;
		$result = @$db->Connect($_POST['host'],$_POST['username'],$_POST['password'],$_POST['database']);

		$db_prefix = $_POST['prefix'];

		if (!$result)
		{
			showPageThree('Could not connect to database.  Verify that username and password are correct, and that the user has access to the given database.');
			return;
		}

		//Try to create and drop a dummy table (with appropriate prefix)
		@$db->Execute('DROP TABLE ' . $db_prefix . 'dummyinstall');
		$result = $db->Execute('CREATE TABLE ' . $db_prefix . 'dummyinstall (i int)');
		if ($result)
		{
			$result = $db->Execute('DROP TABLE ' . $db_prefix . 'dummyinstall');
			if (!$result)
			{
				//could not drop table
				showPageThree('Could not drop a table.  Verify that the user has privileges to drop tables in the given database.');
				return;
			}
		}
		else
		{
			//could not create table
			showPageThree('Could not create a table.  Verify that the user has privileges to create tables in the given database.');
			return;
		}

		$db->SetFetchMode(ADODB_FETCH_ASSOC);

		$CMS_INSTALL_DROP_TABLES=1;
		$CMS_INSTALL_CREATE_TABLES=1;

		include_once(dirname(__FILE__)."/schemas/schema.php");

		echo "Importing initial data...";

		$handle = fopen(dirname(__FILE__)."/schemas/initial.sql", 'r');
		if ($handle) {
			while (!feof($handle)) {
				set_magic_quotes_runtime(false);
				$s = fgets($handle, 32768);
				if ($s != "") {
					$s = trim(str_replace("{DB_PREFIX}", $db_prefix, $s));
					$result = $db->Execute($s);
					if (!$result) {
						die("Invalid query: $s");
					} ## if
				}
			}
		}

		fclose($handle);

		echo "[done]";

		echo "Setting admin account information...";

		$sql = 'UPDATE ' . $db_prefix . 'users SET username = ?, password = ?, email = ? WHERE user_id = 1';
		$db->Execute($sql, array($_POST['adminusername'], $_POST['adminpassword'], $_POST['adminemail']));

		echo "[done]";

		include_once(dirname(__FILE__)."/schemas/createseq.php");

		$db->Close();
        echo "Success!";

    } ## if

    $docroot = 'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['SCRIPT_NAME'],0,strlen($_SERVER['SCRIPT_NAME'])-20);
    $docpath = dirname(dirname(__FILE__)); 

	?>

    Now let's continue to setup your configuration file, we already have most of the stuff we need.
    Chances are you can leave all these values alone, so when you are ready, click Continue.
    
	
		
			CMS Document root (as seen from the webserver)
			" LENGTH="50" MAXLENGTH="100">
		
		
			Path to the Document root
			" LENGTH="50" MAXLENGTH="100">
		
		
			Query string (leave this alone unless you have trouble, then edit config.php by hand)
			
				
				">
			    ">
			    ">
				">
			    ">
				">
			    ">
				
			
		
		
			Default Encoding
			
			
			--
			utf-8
			ISO-8859-1
			ISO-8859-7
			
			
		
		
			Language
			
			
			Keine Voreinstellung gewählt
			简体中文 (Simplified Chinese)
			繁體中文 (Traditional Chinese)
			Brazilian Portuguese
			Dansk (Danish)
			Deutsch (German)
			English
			Español (Spanish)
			Français (French)
			Italiano (Italian)
			Lietuvių (Lithuanian)
			Nederlands (Dutch)
			Norsk (Norwegian)
			SlovenÄ
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: Install 0.11

Post by Ted »

Finally getting around to looking at this.  I like the approach, though, it should probalby work a little more dynamically in picking which languages it has access to.

I'll see about updating it to do that when I get some time.

Thanks!
Post Reply

Return to “Developers Discussion”