Esempio n. 1
0
function upload_avatar()
{
    global $avatars_path;
    global $system;
    global $avatar_h;
    global $avatar_w;
    if (isset($_POST['upload_avatar']) and $_POST['upload_avatar'] == "true" and is_images($_FILES['avatar']['name'])) {
        $avarez = getimagesize($_FILES['avatar']['tmp_name']);
        $uploadfile = $avatars_path . $system->user['username'] . '.img';
        if ($avarez[0] <= "{$avatar_w}" and $avarez[1] <= "{$avatar_h}") {
            if (move_uploaded_file($_FILES['avatar']['tmp_name'], $uploadfile)) {
                show_window(__('Result'), __('Avatar filesucefully uploaded'), 'center');
                $config_ext = parse_ini_file(CONFIG_PATH . 'adminpanel.ini');
                if ($config_ext['chmod_on']) {
                    chmod($uploadfile, octdec($config_ext['chmod']));
                }
                return $_FILES['avatar']['name'];
            }
        } else {
            show_window(__('Result'), __('Your avatar don\'t meet our requirements'), 'center');
        }
    }
}
Esempio n. 2
0
foreach ($elements as $file) {
    $filename = $user_path . $file;
    $filedata = @stat($filename);
    if (@is_dir($filename)) {
        if ($file == '.') {
            continue;
        }
        //$filename = $start_path . $file;;
        $filedata[7] = '';
        $link = '<a href="' . $url_inc . '&path=' . $filename . '" title="' . __('Show') . '"><img src="' . IMAGES_PATH . 'skins/folder.png"/> ' . $file . '</a>';
        $loadlink = '';
        $style = 'row2';
        $alert = $file != '.' ? 'onClick="if(confirm(\'' . __('Are you sure you want to delete this directory (recursively)?') . '\\n /' . $file . '\')) document.location.href = \'' . $url_inc . '&delete=' . $file . '&path=' . $user_path . '\'"' : ($alert = '');
    } else {
        $link_img = str_replace(realpath(RCMS_ROOT_PATH) . '/', RCMS_ROOT_PATH, $user_path);
        if (is_images($filename)) {
            $link = '<a href="' . $link_img . $file . '" class="gallery" title="' . $file . '"><img src="' . IMAGES_PATH . 'skins/view.gif" > ' . $file . '</a>';
        } else {
            continue;
        }
        $style = 'row1';
        $alert = 'onClick="if(confirm(\'' . __('File selected') . ': \\n' . $file . '. \\n' . __('Are you sure you want to delete this file?') . '\')) document.location.href = \'' . $url_inc . '&delete=' . $file . '&path=' . $user_path . '\';else return false;"';
        $opener = 'onClick="window.opener.document.getElementById(\'' . get('ins') . '\').value += \'[img]\'+\'' . $link_img . $file . '\'+\'[/img]\';' . (!empty($lightbox_config['close_by_clicking']) ? 'window.close();' : '') . ' return false; "';
        $insertlink = get('ins') ? '<a href="' . $link_img . $file . '"  class="btnmain" ' . $opener . '>' . __('Insert') . '</a>' : '';
    }
    $deletelink = user_can_delete($file) ? '<a href="' . $url_inc . '&delete=' . $file . '&path=' . $user_path . '" class="btnmain" ' . $alert . '>' . __('Delete') . '</a>' : '';
    ?>
<tr> 
    <td class="<?php 
    echo $style;
    ?>
Esempio n. 3
0
function upload_avatar()
{
    global $avatars_path;
    global $system;
    global $avatar_h;
    global $avatar_w;
    if (isset($_POST['upload_avatar']) and $_POST['upload_avatar'] == "true" and is_images($_FILES['avatar']['name'])) {
        $avarez = getimagesize($_FILES['avatar']['tmp_name']);
        $img = $avarez[2];
        switch ($img) {
            case "1":
                $img = 'gif';
                break;
            case "2":
                $img = 'jpg';
                break;
            case "3":
                $img = 'png';
                break;
            default:
                $img = 'Too big - deleted!';
                break;
        }
        //show_window(__('Uploaded images'),'width = '.$avarez[0].' px, '.'height = '.$avarez[1].' px, '.' image: '.$img,'center');
        if ($avarez[0] <= "{$avatar_w}" and $avarez[1] <= "{$avatar_h}") {
            $uploadfile = $avatars_path . $system->user['username'];
            $exttmp = strtolower(substr(strrev($_FILES['avatar']['name']), 0, 4));
            $ext = $exttmp;
            $ext[0] = $exttmp[2];
            $ext[2] = $exttmp[0];
            $ext = substr($ext, 0, 3);
            $tmpupl = $uploadfile;
            $uploadfile = $uploadfile . '.' . $ext;
            if ($ext == 'gif' and $img != 'Too big - deleted!') {
                if (file_exists($tmpupl . '.jpg')) {
                    rcms_delete_files($tmpupl . '.jpg');
                }
                if (file_exists($tmpupl . '.png')) {
                    rcms_delete_files($tmpupl . '.png');
                }
            }
            if ($ext == 'jpg' and $img != 'Too big - deleted!') {
                if (file_exists($tmpupl . '.gif')) {
                    rcms_delete_files($tmpupl . '.gif');
                }
                if (file_exists($tmpupl . '.png')) {
                    rcms_delete_files($tmpupl . '.png');
                }
            }
            if ($ext == 'png' and $img != 'Too big - deleted!') {
                if (file_exists($tmpupl . '.gif')) {
                    rcms_delete_files($tmpupl . '.gif');
                }
                if (file_exists($tmpupl . '.jpg')) {
                    rcms_delete_files($tmpupl . '.jpg');
                }
            }
            if (@move_uploaded_file($_FILES['avatar']['tmp_name'], $uploadfile)) {
                show_window(__('Result'), __('Avatar filesuccessfully uploaded'), 'center');
                $config_ext = parse_ini_file(CONFIG_PATH . 'adminpanel.ini');
                if ($config_ext['chmod_on']) {
                    chmod($uploadfile, octdec($config_ext['chmod']));
                    return $_FILES['avatar']['name'];
                }
            } else {
                show_window(__('Result'), __('Your avatar don\'t meet our requirements'), 'center');
            }
        }
    } else {
        show_window(__('Result'), __('Your avatar don\'t meet our requirements'), 'center');
    }
}