Mercurial > hg > extraction-interface
view interface/save_full_text.php @ 3:f196939ccc03
error handle and alert feedback to user.
If error occurs, user'll not be halted by the loading page and sections_revisions will recovery to previous version.
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 26 Jan 2015 12:19:39 +0100 |
parents | b12c99b7c3f0 |
children |
line wrap: on
line source
<?php if ($_POST['text']){ $date = date('Y_m_d_H_i_s', time()); if ( file_exists("parsing_files/".$_POST['filename'].".txt") ) { $oldFile = file_get_contents("parsing_files/".$_POST['filename'].".txt"); file_put_contents("parsing_files/".$_POST['filename']."_".$date.".txt", $oldFile); } if (get_magic_quotes_gpc()) { $require = stripslashes($_POST['text']); } else { $require = $_POST['text']; } $require = preg_replace("/【<a(.*?)>(.*?)<\/a>】/u", "【\\2】", $require); $require = preg_replace('/&/u', "&", $require); $require = preg_replace("/○/u", " ", $require); $require = preg_replace("/<br>/u", "\n", $require); $require = preg_replace("/<br>/u", "\n", $require); file_put_contents("parsing_files/".$_POST['filename'].".txt", $require); } ?>