mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 12:58:40 +00:00
fix(web): 8703281ab3
This commit is contained in:
parent
e3fc955b75
commit
71214c0631
@ -7,6 +7,8 @@ class UOJBlogEditor {
|
|||||||
public $save;
|
public $save;
|
||||||
public $cur_data = array();
|
public $cur_data = array();
|
||||||
public $post_data = array();
|
public $post_data = array();
|
||||||
|
public $show_editor = true;
|
||||||
|
public $show_tags = true;
|
||||||
|
|
||||||
public $label_text = array(
|
public $label_text = array(
|
||||||
'title' => '标题',
|
'title' => '标题',
|
||||||
@ -78,7 +80,15 @@ class UOJBlogEditor {
|
|||||||
}
|
}
|
||||||
private function receivePostData() {
|
private function receivePostData() {
|
||||||
$errors = array();
|
$errors = array();
|
||||||
foreach (array('title', 'content_md', 'tags') as $name) {
|
|
||||||
|
$keys = array('title');
|
||||||
|
if ($this->show_tags) {
|
||||||
|
$keys[] = 'tags';
|
||||||
|
}
|
||||||
|
if ($this->show_editor) {
|
||||||
|
$keys[] = 'content_md';
|
||||||
|
}
|
||||||
|
foreach ($keys as $name) {
|
||||||
$cur_err = $this->validate($name);
|
$cur_err = $this->validate($name);
|
||||||
if ($cur_err) {
|
if ($cur_err) {
|
||||||
$errors[$name] = $cur_err;
|
$errors[$name] = $cur_err;
|
||||||
@ -95,6 +105,7 @@ class UOJBlogEditor {
|
|||||||
|
|
||||||
$this->post_data['title'] = HTML::escape($this->post_data['title']);
|
$this->post_data['title'] = HTML::escape($this->post_data['title']);
|
||||||
|
|
||||||
|
if ($this->show_editor) {
|
||||||
if ($this->type == 'blog') {
|
if ($this->type == 'blog') {
|
||||||
$content_md = $_POST[$this->name . '_content_md'];
|
$content_md = $_POST[$this->name . '_content_md'];
|
||||||
try {
|
try {
|
||||||
@ -189,6 +200,7 @@ EOD
|
|||||||
$this->post_data['content'] = json_encode($config) . "\n" . $this->post_data['content'];
|
$this->post_data['content'] = json_encode($config) . "\n" . $this->post_data['content'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function handleSave() {
|
public function handleSave() {
|
||||||
$save = $this->save;
|
$save = $this->save;
|
||||||
|
Loading…
Reference in New Issue
Block a user