From 7b6f30e6e4e819e7aacafc45ef9c8e2d1c189740 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 15 Aug 2016 10:06:44 -0700 Subject: [PATCH] Fill news fields with new submitted data. --- e107_admin/newspost.php | 42 +++++++++++++++++++++++++++++++++++++++-- submitnews.php | 2 ++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 2efa907d5..7ca9d0bed 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -228,7 +228,7 @@ class news_sub_ui extends e_admin_ui 'submitnews_title' => array('title'=> LAN_TITLE, 'type' => 'method', 'width' => '35%', 'thclass' => 'left', 'readonly'=>TRUE), 'submitnews_category' => array('title'=> LAN_CATEGORY, 'type' => 'dropdown', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE), - // 'submitnews_item' => array('title'=> LAN_DESCRIPTION, 'type' => 'method', 'width' => 'auto', 'thclass' => 'left','readParms' => 'expand=...&truncate=150&bb=1', 'readonly'=>TRUE), + 'submitnews_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'width' => 'auto', 'thclass' => 'left','readParms' => 'expand=...&truncate=150&bb=1', 'readonly'=>TRUE), 'submitnews_name' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>TRUE), 'submitnews_ip' => array('title'=> LAN_IP, 'type' => 'ip', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>TRUE), 'submitnews_auth' => array('title'=> " ", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'class'=> 'left', 'readParms'=>"link=1" ), @@ -1292,7 +1292,29 @@ class news_admin_ui extends e_admin_ui exit; } - + + private function processSubmittedMedia($data) + { + if(empty($data)) + { + return false; + } + + $row = json_decode($data,true); + $text = ''; + foreach($row as $k) + { + if(!empty($k)) + { + $text .= $k."\n\n"; + } + } + + return $text; + + } + + function loadSubmitted($id) { $sql = e107::getDb(); @@ -1306,8 +1328,24 @@ class news_admin_ui extends e_admin_ui $data['news_category'] = intval( $row['submitnews_category']); $data['news_body'] .= "\n[[b]".NWSLAN_49." {$row['submitnews_name']}[/b]]"; + if($mediaData = $this->processSubmittedMedia($row['submitnews_media'])) + { + $data['news_body'] .= "\n\n".$mediaData; + } + + if(e107::getPref('wysiwyg',false)!==false) + { + $data['news_body'] = nl2br($data['news_body']); + } + + $data['news_thumbnail'] = $row['submitnews_file']; // implode(",",$thumbs); $data['news_sef'] = eHelper::dasherize($data['news_title']); + + $data['news_meta_keywords'] = $row['submitnews_keywords']; + $data['news_summary'] = $row['submitnews_summary']; + $data['news_meta_description'] = $row['submitnews_description']; + $data['submitted_id'] = $id; foreach($data as $k=>$v) diff --git a/submitnews.php b/submitnews.php index 4b6805642..4b409678c 100644 --- a/submitnews.php +++ b/submitnews.php @@ -385,7 +385,9 @@ class submitNewsForm extends e_form for($i = 0; $i <8; $i++) { $help = (isset($placeholders[$i])) ? $placeholders[$i] : ''; + $text .= "
"; $text .= $this->text('submitnews_media['.$i.']', $_POST['submitnews_media'][$i], 255, array('placeholder'=>$help) ); + $text .= "
"; } return $text;