mirror of
https://github.com/e107inc/e107.git
synced 2025-07-27 18:00:30 +02:00
EONE-1 (Bug): More improvements to upgrade process. I think it's all working, but need to clean up the interface. Also added ability to add attachments while editing a post.
This commit is contained in:
@@ -641,7 +641,7 @@ class forumAdmin
|
|||||||
|
|
||||||
if(!$poll_installed)
|
if(!$poll_installed)
|
||||||
{
|
{
|
||||||
if($fPref['poll'] == 1)
|
if($fPref->get('poll') == 1)
|
||||||
{
|
{
|
||||||
$fPref['forum_poll'] = e_UC_NOBODY;
|
$fPref['forum_poll'] = e_UC_NOBODY;
|
||||||
$fPref->save(false, true);
|
$fPref->save(false, true);
|
||||||
|
@@ -51,7 +51,7 @@ switch($action)
|
|||||||
$postInfo = $forum->postGet($id, 'post');
|
$postInfo = $forum->postGet($id, 'post');
|
||||||
$threadInfo = $postInfo;
|
$threadInfo = $postInfo;
|
||||||
$forumId = $postInfo['post_forum'];
|
$forumId = $postInfo['post_forum'];
|
||||||
$forumInfo = $forum->forum_get($forumId);
|
$forumInfo = $forum->forumGet($forumId);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -246,6 +246,7 @@ if (isset($_POST['newthread']) || isset($_POST['reply']))
|
|||||||
//$postInfo['post_entry'] .= $ur['txt'];
|
//$postInfo['post_entry'] .= $ur['txt'];
|
||||||
$_tmp = $ur['type'].'*'.$ur['file'];
|
$_tmp = $ur['type'].'*'.$ur['file'];
|
||||||
if($ur['thumb']) { $_tmp .= '*'.$ur['thumb']; }
|
if($ur['thumb']) { $_tmp .= '*'.$ur['thumb']; }
|
||||||
|
if($ur['fname']) { $_tmp .= '*'.$ur['fname']; }
|
||||||
$attachments[] = $_tmp;
|
$attachments[] = $_tmp;
|
||||||
}
|
}
|
||||||
$postInfo['post_attachments'] = implode(',', $attachments);
|
$postInfo['post_attachments'] = implode(',', $attachments);
|
||||||
@@ -367,6 +368,19 @@ if (isset($_POST['update_thread']))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($uploadResult = process_upload($postInfo['post_id']))
|
||||||
|
{
|
||||||
|
$attachments = explode(',', $postInfo['post_attachments']);
|
||||||
|
foreach($uploadResult as $ur)
|
||||||
|
{
|
||||||
|
$_tmp = $ur['type'].'*'.$ur['file'];
|
||||||
|
if($ur['thumb']) { $_tmp .= '*'.$ur['thumb']; }
|
||||||
|
if($ur['fname']) { $_tmp .= '*'.$ur['fname']; }
|
||||||
|
$attachments[] = $_tmp;
|
||||||
|
}
|
||||||
|
$postVals['post_attachments'] = implode(',', $attachments);
|
||||||
|
}
|
||||||
|
|
||||||
$postVals['post_edit_datestamp'] = time();
|
$postVals['post_edit_datestamp'] = time();
|
||||||
$postVals['post_edit_user'] = USERID;
|
$postVals['post_edit_user'] = USERID;
|
||||||
$postVals['post_entry'] = $_POST['post'];
|
$postVals['post_entry'] = $_POST['post'];
|
||||||
@@ -552,7 +566,7 @@ function process_upload()
|
|||||||
|
|
||||||
$postId = (int)$postId;
|
$postId = (int)$postId;
|
||||||
$ret = array();
|
$ret = array();
|
||||||
// var_dump($_FILES);
|
var_dump($_FILES);
|
||||||
|
|
||||||
if (isset($_FILES['file_userfile']['error']))
|
if (isset($_FILES['file_userfile']['error']))
|
||||||
{
|
{
|
||||||
@@ -570,6 +584,7 @@ function process_upload()
|
|||||||
$_att = '';
|
$_att = '';
|
||||||
$_file = '';
|
$_file = '';
|
||||||
$_thumb = '';
|
$_thumb = '';
|
||||||
|
$_fname = '';
|
||||||
$fpath = '{e_PLUGIN}forum/attachments/';
|
$fpath = '{e_PLUGIN}forum/attachments/';
|
||||||
if(strstr($upload['type'], 'image'))
|
if(strstr($upload['type'], 'image'))
|
||||||
{
|
{
|
||||||
@@ -627,7 +642,7 @@ function process_upload()
|
|||||||
}
|
}
|
||||||
if($_txt && $_file)
|
if($_txt && $_file)
|
||||||
{
|
{
|
||||||
$ret[] = array('type' => $_type, 'txt' => $_txt, 'file' => $_file, 'thumb' => $_thumb);
|
$ret[] = array('type' => $_type, 'txt' => $_txt, 'file' => $_file, 'thumb' => $_thumb, 'fname' => $_fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -105,7 +105,7 @@ class forum_post_shortcodes
|
|||||||
{
|
{
|
||||||
global $forum, $pref, $fileattach, $fileattach_alert;
|
global $forum, $pref, $fileattach, $fileattach_alert;
|
||||||
|
|
||||||
if ($forum->prefs->get('attach') && strpos(e_QUERY, 'edit') === FALSE && (check_class($pref['upload_class']) || getperms('0')))
|
if ($forum->prefs->get('attach') && (check_class($pref['upload_class']) || getperms('0')))
|
||||||
{
|
{
|
||||||
if (is_writable(e_PLUGIN.'forum/attachments'))
|
if (is_writable(e_PLUGIN.'forum/attachments'))
|
||||||
{
|
{
|
||||||
|
@@ -789,19 +789,30 @@ function step10()
|
|||||||
$info['post_entry'] = $post['post_entry'];
|
$info['post_entry'] = $post['post_entry'];
|
||||||
foreach($attachments as $attachment)
|
foreach($attachments as $attachment)
|
||||||
{
|
{
|
||||||
// var_dump($attachment);
|
|
||||||
$error = '';
|
$error = '';
|
||||||
if($f->moveAttachment($attachment, $error))
|
if($f->moveAttachment($attachment, $error))
|
||||||
{
|
{
|
||||||
$_file = split('/', $attachment['name']);
|
$_file = split('/', $attachment['name']);
|
||||||
$tmp = split('_', $_file[1], 4);
|
$newval = $attachment['type'].'*'.$_file[1];
|
||||||
$newval = $attachment['type'].'*'.$_file[1].'*'.$tmp[3];
|
switch($attachment['type'])
|
||||||
if($attachment['thumb'])
|
|
||||||
{
|
{
|
||||||
$_file = split('/', $attachment['thumb']);
|
//If file, add real name to entry
|
||||||
$newval .= '*'.$_file[1];
|
case 'file':
|
||||||
|
$tmp = split('_', $_file[1], 4);
|
||||||
|
$newval .= '*'.$tmp[3];
|
||||||
|
break;
|
||||||
|
|
||||||
|
//If image and it has a thumb, add thumb filename to entry
|
||||||
|
case 'img':
|
||||||
|
if($attachment['thumb'])
|
||||||
|
{
|
||||||
|
$_file = split('/', $attachment['thumb']);
|
||||||
|
$newval .= '*'.$_file[1];
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
$newValues[] = $newval;
|
$newValues[] = $newval;
|
||||||
|
echo "Newval = $newval <br />";
|
||||||
// echo "Removing from post:".htmlentities($attachment['html'])."<br />";
|
// echo "Removing from post:".htmlentities($attachment['html'])."<br />";
|
||||||
$info['post_entry'] = str_replace($attachment['html'], '', $info['post_entry']);
|
$info['post_entry'] = str_replace($attachment['html'], '', $info['post_entry']);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user