All pastes #138662 Raw Edit

Untitled

public text v1 · immutable
#138662 ·published 2006-08-19 12:19 UTC
rendered paste body
	// Section 6 - Edit Content Layout
	class modTheme_sec6 {
	
		var $row;
		
		function modTheme_sec6() {
		
			// Edit AdminCP or Main Layout?
			$type = cleanstr( $_GET['type'] );
			if ( $type == NULL ) {
				$type = 'main';
			}
			
			// Get a list of modules
			global $libmysql;
			$Query = $libmysql->Query( " SELECT `name` FROM `tcm_modules` WHERE `secid` = '1' AND `type` = '$type' " );
			
			// Store results to be used later
			while ( $result = mysql_fetch_array( $Query ) ) {
				$this->row[] = $result;
			}
			
			// Find directory to template file
			if ( $type == 'main' ) { 
				$templateFile = '../themes/'._CONFIG_THEME_MAIN.'/main_template.html';
			} else {
				$templateFile = 'themes/'._CONFIG_THEME.'/main_template.html';
			}			

			// See if template file exists
			if ( !file_exists( $templateFile ) ) {
				$_SESSION['error'] = 'The template file is missing or invalid';				
			} else {
			
				$templateFileSource = file_get_contents( $templateFile );

				// Find all of the sX ( Where X is a number ) in the template file
				preg_match_all("#\{(S\d+)\}#", $templateFileSource, $templateTags );
				$templateTags = $templateTags[1];
				
				if ( $templateTags == NULL ) {
					$_SESSION['error'] = 'There are no sectors in the template file to edit';					
				} else {
				
					echo '<pre>';
					echo print_r( $templateTags );
					echo '</pre>';
					// Loop the tag to find the
					foreach( $templateTags as $key=>$val ) {
					}
				}
				
			}	
		
		}
		
	}