Location: PHPKode > scripts > GalleryShuffle > v1.0/php/Models/settings.php
<?php

/**
* SETTINGS
**/

class model_settings
{
	
	private $buffer;
	
	public function __construct()
	{
		
		$this->buffer = "<?php

/**
* CONFIG PHP
**/

abstract class CONFIG
{
";
		
	}
	
	
	public function saveBasicsSettings($title, $subtitle, $isShuffled, $isLocked, $password, $mail, $upSizeMax)
	{
	
		$isShuffled = FUNCTIONS::getTinyIntFromCheckbox($isShuffled);
		$isLocked = FUNCTIONS::getTinyIntFromCheckbox($isLocked);
		
		$this->buffer .= $this->getBaseSettings() . "
	
	const userLogin = '" . $mail . "';
	const userPassword = '" .  CONFIG::userPassword . "';
	
	const galleryTitle = '" . $title . "';
	const gallerySubtitle = '" . $subtitle . "';
	const galleryIsShuffled = " . $isShuffled . ";
	const galleryIsLocked = " . $isLocked . ";
	const galleryPassword = '" . $password . "';
	
	const uploadPictureLargeMaxSize = " . $upSizeMax . ";";
		
		$this->writeInConfigFile();
		
	}
	
	public function savePasswordSettings($password)
	{
		
		$this->buffer .= $this->getBaseSettings() . "
	const userLogin = '" . CONFIG::userLogin . "';
	const userPassword = '" .  $password . "';
	
	const galleryTitle = '" . CONFIG::galleryTitle . "';
	const gallerySubtitle = '" . CONFIG::gallerySubtitle . "';
	const galleryIsShuffled = " .  CONFIG::galleryIsShuffled . ";
	const galleryIsLocked = " . CONFIG::galleryIsLocked . ";
	const galleryPassword = '" . CONFIG::galleryPassword . "';
	
	const uploadPictureLargeMaxSize = " . CONFIG::uploadPictureLargeMaxSize . ";";
		
		$this->writeInConfigFile();
		
	}
	
	private function getBaseSettings()
	{
	
		return "
	const lang = '" . CONFIG::lang . "';
	
	const title = '" . CONFIG::title . "';
	const version = '" . CONFIG::version . "';
	
	const picturesFolder = '" . CONFIG::picturesFolder . "';
	const picturesSmallFolder = '" . CONFIG::picturesSmallFolder . "';
	const picturesLargeFolder = '" . CONFIG::picturesLargeFolder . "';	
	const uploadPictureSmallMaxSize = " . CONFIG::uploadPictureSmallMaxSize . ";
	const picturesExtension = '" . CONFIG::picturesExtension . "';
	
	const imageAccessUID = '" . CONFIG::imageAccessUID . "';
	
	const DBname = '" . CONFIG::DBname . "';
	const DBhostAddress = '" . CONFIG::DBhostAddress . "';
	const DBhostPort = '" . CONFIG::DBhostPort . "';
	const DBuserName = '" . CONFIG::DBuserName . "';
	const DBpassword = '" . CONFIG::DBpassword . "';
	";
	
	}
	
	private function writeInConfigFile()
	{
	
		$this->buffer .= "
	
}

?>";
	
		$fp = fopen('php/CONFIG.php', "wb");
		fwrite($fp, $this->buffer);
		fclose($fp); 
		
	}

}

?>
Return current item: GalleryShuffle