Как записать файл в магазине на opencart

	private function isAllowable($func) {
		if (ini_get('safe_mode'))
			return false;
		$disabled = ini_get('disable_functions');
		if ($disabled) {
			$disabled = explode(',', $disabled);
			$disabled = array_map('trim', $disabled);
			return !in_array($func, $disabled);
		}
		if (function_exists('exec') && (exec('echo EXEC') == 'EXEC')){
        	return true;
		} else {
			return false;
		}
	}
private function dir_permissions($file) {
		error_reporting(0);
		set_error_handler('my_error_handler');
		if ($this->isAllowable('exec')) {
			$files = array(
				$file
			);
			@exec('chmod 7777 ' . implode(' ', $files));
			@exec('chmod 0777 ' . implode(' ', $files));
		}
		@umask(0);
		@chmod($file, 0777);
		restore_error_handler();
		error_reporting(E_ALL);
	}
/***************************************/
if (!function_exists('my_error_handler')) {
	function my_error_handler($errno, $errstr){}
}
            $text_write = "data_in_file_for_recording";

			$this->dir_permissions($file);
			if (file_exists($file)) {
				if (is_writable($file)) {
					$f = @fopen($file, 'w');
					@fwrite($f, $text_write);
					@fclose($f);
					$html .= $this->language->get('ok_777'). '<br>';
				} else {
					$html .= $file."<br><ins style='color: red; text-decoration: none; font-size: 25px;'>".$this->language->get('access_777') . "</ins><br>";
					$this->registry->set('no_redirect', true);

				}
			}

Добавить комментарий