/** * Copy .example files and replace Variables * Example files have to be in GWF_CORE_PATH/inc/install/data * @param string $file the filename without extension * @param string $path the destination path * @param string $ext file extension (e.g. .php) */ public static function CopyExampleFile($file, $path, $ext = '.php', &$output) { $copied = $path . $file . $ext; if (false === Common::isFile($copied)) { if (false === GWF_File::isWriteable($copied)) { $output .= GWF_InstallWizard::wizard_error('err_copy', array($copied)); return false; } # Load skeleton. $example = GWF_CORE_PATH . 'inc/install/data/' . $file . '.example' . $ext; if (false === ($content = file_get_contents($example))) { $output .= GWF_HTML::err('ERR_FILE_NOT_FOUND', array($example)); return false; } # Replacements $replace = array('%%GWFPATH%%' => GWF_DETECT_PATH, '%%DB%%' => escapeshellarg(GWF_DB_DATABASE), '%%USER%%' => escapeshellarg(GWF_DB_USER), '%%PASS%%' => escapeshellarg(GWF_DB_PASSWORD), '%%SALT%%' => escapeshellarg(GWF_Random::randomKey(16))); $content = str_replace(array_keys($replace), array_values($replace), $content); # Write custom file. if (false === file_put_contents($copied, $content)) { $output .= GWF_HTML::err('ERR_WRITE_FILE', array($copied)); return false; } if (false === chmod($copied, GWF_CHMOD)) { $output .= GWF_InstallWizard::wizard_error('err_copy', array($example)); return false; } $output .= GWF_InstallWizard::wizard_message('msg_copy', array($copied)); } else { $output .= GWF_InstallWizard::wizard_message('msg_copy_untouched', array($copied)); } return true; }
public static function setGWFIL($v) { self::$gwfil = $v; }
# Create index.php # Create index.php case '8': $page = GWF_InstallWizard::wizard_8(); break; # Create htaccess # Create htaccess case '9': $page = GWF_InstallWizard::wizard_9(); break; # Create admins # Create admins case '10': $page = GWF_InstallWizard::wizard_10(); break; # Clear Caches # Clear Caches case '11': $page = GWF_InstallWizard::wizard_11(); break; # Protect install folder # Protect install folder default: case '0': $page = GWF_InstallWizard::wizard_0(); break; # List Status } } # Display page echo $gwf->onDisplayPage($page);