예제 #1
0
	/**
	 * Save new content or revert to default, and set flash message.
	 *
	 * @return void
	*/
	private function saveRobotsTxtAction()
	{
		include_once(ISC_BASE_PATH.'/lib/class.file.php');
		$fc = new FileClass();
		$content = $_POST['robotstxtFileContent'];
		$success = 'RobotsSaveSuccess';

		if (isset($_POST['robotstxtRevertButton'])) {
			// Revert button is clicked instead.
			$content = $this->defaultContent;
			$success = 'RobotsRevertSuccess';
		}

		$res = $fc->writeToFile($content, $this->filePath);
		if ($res == true) {
			FlashMessage(GetLang($success), MSG_SUCCESS, $this->mainUrl);
		} else {
			FlashMessage(GetLang('RobotsSaveError'), MSG_ERROR, $this->mainUrl);
		}
	}