how to use this code on johncms 6
<?php
/*
* JohnCMS NEXT Mobile Content Management System (http://johncms.com)
*
* For copyright and license information, please see the LICENSE.md
* Installing the system or redistributions of files must retain the above copyright notice.
*
* @linkhttp://johncms.com JohnCMS Project
* @copyright Copyright (C) JohnCMS Community
* @license GPL-3
*/
defined('_IN_JOHNCMS') or die('Error: restricted access');
require('../incfiles/head.php');
if (!$id || !$user_id) {
echo functions::display_error($lng['error_wrong_data']);
require('../incfiles/end.php');
exit;
}
// Проверяем, тот ли юзер заливает файл и в нужное ли место
$req = mysql_query("SELECT * FROM `forum` WHERE `id` = '$id'");
$res = mysql_fetch_assoc($req);
if ($res['type'] != 'm' || $res['user_id'] != $user_id) {
echo functions::display_error($lng['error_wrong_data']);
require('../incfiles/end.php');
exit;
}
// Проверяем, тот ли юзер заливает файл и в нужное ли место
$req2 = mysql_query("SELECT * FROM `forum` WHERE `id` = '" . $res['refid'] . "'");
$res2 = mysql_fetch_array($req2);
$req3 = mysql_query("SELECT * FROM `forum` WHERE `id` = '" . $res2['refid'] . "'");
$res3 = mysql_fetch_array($req3);
$page = ceil($pa2 / $kmess);
// Форма выбора файла для выгрузки
echo '<div class="formjs mrt-code card shadow--2dp color--blue-grey-700"><div class="phdr"><h4>Upload thumbnail</h4></div>' .
'<div class="jserror" style="display:none;"></div>';
echo '<div class="list1"><form method="post" enctype="multipart/form-data">' .
'<div class="file_input_div">' .
'<div class="file_input">' .
'<label class="image_input_button m-button m-button--fab m-button--mini-fab m-button--colored">' .
'<i class="material-icons"></i>' .
'<input id="file_input_file" class="none" type="file" name="imagefile" required="required"/>' .
'</label>' .
'</div>' .
'<div id="file_input_text_div" class="m-textfield">' .
'<input class="file_input_text m-textfield__input" type="text" disabled readonly id="file_input_text" />' .
'<label class="m-textfield__label" for="file_input_text"></label>' .
'</div>' .
'</div>' .
'<input type="hidden" name="t" value="avatar" />' .
'<input type="hidden" name="a" value="thumb" />' .
'<input type="hidden" name="id" value="' . $id . '" />' .
'<div class="button-container"><button class="button" type="submit" name="submit"><span>upload</span></button></div></form></div>' .
'<div class="list1">' . _t('Max. Size') . ': ' . $config['flsz'] . 'kb.</div>' .
'<div class="list1"><a href="/forum/' . $res['id'] . '/' . $res['seo'] . '_p' . $page . '.html">' . _t('Back to topic') . '</a></div>' .
'</div>';