mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +02:00
Issue #1796 - Submit news enhancements ToDo: preferences for input items.
This commit is contained in:
@@ -474,6 +474,10 @@ CREATE TABLE submitnews (
|
||||
submitnews_ip varchar(45) NOT NULL default '',
|
||||
submitnews_auth tinyint(3) unsigned NOT NULL default '0',
|
||||
submitnews_file text NOT NULL,
|
||||
submitnews_keywords varchar(255) NOT NULL default '',
|
||||
submitnews_description text,
|
||||
submitnews_summary text,
|
||||
submitnews_media text,
|
||||
PRIMARY KEY (submitnews_id)
|
||||
) ENGINE=MyISAM;
|
||||
# --------------------------------------------------------
|
||||
|
@@ -175,16 +175,20 @@ class submitNews
|
||||
{
|
||||
|
||||
$insertQry = array(
|
||||
'submitnews_id' => 0,
|
||||
'submitnews_name' => $submitnews_user,
|
||||
'submitnews_email' => $submitnews_email,
|
||||
'submitnews_title' => $submitnews_title,
|
||||
'submitnews_category' => intval($_POST['cat_id']),
|
||||
'submitnews_item' => $submitnews_item,
|
||||
'submitnews_datestamp' => time(),
|
||||
'submitnews_ip' => $ip,
|
||||
'submitnews_auth' => '0',
|
||||
'submitnews_file' => implode(',',$submitnews_filearray),
|
||||
'submitnews_id' => 0,
|
||||
'submitnews_name' => $submitnews_user,
|
||||
'submitnews_email' => $submitnews_email,
|
||||
'submitnews_title' => $submitnews_title,
|
||||
'submitnews_category' => intval($_POST['cat_id']),
|
||||
'submitnews_item' => $submitnews_item,
|
||||
'submitnews_datestamp' => time(),
|
||||
'submitnews_ip' => $ip,
|
||||
'submitnews_auth' => '0',
|
||||
'submitnews_file' => implode(',',$submitnews_filearray),
|
||||
'submitnews_keywords' => $tp->filter($_POST['submitnews_keywords'], 'str'),
|
||||
'submitnews_description' => $tp->filter($_POST['submitnews_description'], 'str'),
|
||||
'submitnews_summary' => $tp->filter($_POST['submitnews_summary'], 'str'),
|
||||
'submitnews_media' => json_encode($_POST['submitnews_media'],JSON_PRETTY_PRINT)
|
||||
);
|
||||
|
||||
if(!$sql->insert("submitnews", $insertQry))
|
||||
@@ -224,6 +228,7 @@ class submitNews
|
||||
$sql = e107::getDb();
|
||||
$ns = e107::getRender();
|
||||
$pref = e107::pref('core');
|
||||
$frm = e107::getForm();
|
||||
|
||||
$text = "";
|
||||
|
||||
@@ -293,6 +298,30 @@ class submitNews
|
||||
</tr>
|
||||
";
|
||||
|
||||
|
||||
|
||||
/* submitnews_keywords varchar(255) NOT NULL default '',
|
||||
submitnews_description text NOT NULL,
|
||||
submitnews_summary text NOT NULL,
|
||||
submitnews_media text NOT NULL,
|
||||
*/
|
||||
$fields = array();
|
||||
$fields['submitnews_keywords'] = array('title'=>"Keywords", 'type'=>'tags');
|
||||
$fields['submitnews_summary'] = array('title'=>'Summary', 'type'=>'text', 'writeParms'=>array('maxlength'=>255, 'size'=>'xxlarge'));
|
||||
$fields['submitnews_description'] = array('title'=>'Meta Description', 'type'=>'textarea','writeParms'=>array('placeholder'=>'Used by Facebook etc.'));
|
||||
$fields['submitnews_media'] = array('title'=>'Media URLs', 'type'=>'method', 'method'=>'submitNewsForm::submitnews_media');
|
||||
|
||||
|
||||
foreach($fields as $key=>$fld)
|
||||
{
|
||||
$text .= "<tr><td style='width:20%' class='forumheader3'>
|
||||
".$fld['title']
|
||||
."</td>
|
||||
<td style='width:80%' class='forumheader3'>".$frm->renderElement($key, '', $fld)."</td>
|
||||
</tr>";
|
||||
|
||||
}
|
||||
|
||||
if ($pref['subnews_attach'] && $pref['upload_enabled'] && check_class($pref['upload_class']) && FILE_UPLOADS)
|
||||
{
|
||||
$text .= "
|
||||
@@ -336,6 +365,34 @@ class submitNews
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
class submitNewsForm extends e_form
|
||||
{
|
||||
|
||||
function submitnews_media($cur, $mode, $att)
|
||||
{
|
||||
$text = '';
|
||||
|
||||
$placeholders = array(
|
||||
'eg. http://www.youtube.com/watch?v=Mxhn11_fzJQ',
|
||||
'eg. http://path-to-image/image.jpg',
|
||||
'eg. http://path-to-audio/file.mp3'
|
||||
);
|
||||
|
||||
for($i = 0; $i <8; $i++)
|
||||
{
|
||||
$help = (isset($placeholders[$i])) ? $placeholders[$i] : '';
|
||||
$text .= $this->text('submitnews_media['.$i.']', $_POST['submitnews_media'][$i], 255, array('placeholder'=>$help) );
|
||||
}
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user