示例#1
0
文件: save.php 项目: joomux/jTips
 */
global $mainframe, $database, $mosConfig_absolute_path;
//Make sure this is not a hack job
jTipsSpoofCheck();
require_once 'components/com_jtips/classes/jseason.class.php';
$jSeason = new jSeason($database);
if ($id = jTipsGetParam($_REQUEST, 'id', FALSE)) {
    $jSeason->load($id);
}
$jSeason->bind($_REQUEST);
//BUG 263 - set the date fields if we are in J1.0
if (!isJoomla15()) {
    $jSeason->start_time = TimeDate::toDisplayDate($jSeason->start_time);
    $jSeason->end_time = TimeDate::toDisplayDate($jSeason->end_time);
}
if ($_FILES['image']['name'] and imageDirCheck()) {
    $logofile = 'images/jtips/' . $_FILES['image']['name'];
    if (isJoomla15()) {
        jimport('joomla.filesystem.file');
        jTipsLogger::_log('MOVING ' . $_FILES['image']['tmp_name'] . ' TO ' . $logofile, 'ERROR');
        //JFile::move($_FILES['image']['tmp_name'], $mosConfig_absolute_path.'/'.$logofile);
        //BUG 270 - to complete upload, use the upload function, not move
        JFile::upload($_FILES['image']['tmp_name'], $mosConfig_absolute_path . '/' . $logofile);
    } else {
        if (!is_dir($mosConfig_absolute_path . '/images/jtips') or !file_exists($mosConfig_absolute_path . '/images/jtips')) {
            mkdir($mosConfig_absolute_path . '/images/jtips');
        }
        move_uploaded_file($_FILES['image']['tmp_name'], $mosConfig_absolute_path . '/' . $logofile);
    }
    $jSeason->image = $logofile;
} else {
示例#2
0
文件: save.php 项目: joomux/jTips
//Make sure this is not a hack job
jTipsSpoofCheck();
require_once 'components/com_jtips/classes/jteam.class.php';
require_once 'components/com_jtips/lib/tnimg.lib.php';
$jTeam = new jTeam($database);
if ($id = jTipsGetParam($_REQUEST, 'id', false)) {
    $jTeam->load($id);
}
$jTeam->bind($_POST);
if (jTipsGetParam($_REQUEST, 'removeImage', false)) {
    $jTeam->logo = null;
} else {
    unset($jTeam->logo);
    //so we dont overwrite the current value
}
if (isset($_FILES['logo']['name']) and !empty($_FILES['logo']['name']) and imageDirCheck()) {
    //Upload image
    $filename = str_replace(' ', '_', $_FILES['logo']['name']);
    $filename_100 = getJtipsImage($filename, 100);
    $filename_25 = getJtipsImage($filename);
    if (!isJoomla15()) {
        if (!is_dir($mosConfig_absolute_path . '/images/jtips') or !file_exists($mosConfig_absolute_path . '/images/jtips')) {
            mkdir($mosConfig_absolute_path . '/images/jtips');
        }
    } else {
        jimport('joomla.filesystem.folder');
        jimport('joomla.filesystem.file');
        jimport('joomla.filesystem.path');
        if (!JFolder::exists($mosConfig_absolute_path . '/images/jtips')) {
            JFolder::create($mosConfig_absolute_path . '/images/jtips');
        }