Beispiel #1
0
        foreach ($exts as $ex) {
            if ($ext == $ex) {
                $language = $lan;
                break 2;
            }
        }
    }
    return $language;
}
$file = array();
$file['file_utf'] = trim($_REQUEST['file']);
$file['file'] = u2g($file['file_utf']);
$file['content'] = file($file['file']);
$file['encode'] = get_encode($file['file']);
$file['line'] = count($file['content']);
$file['size'] = dealsize(filesize($file['file']));
$file['chmod'] = substr(sprintf('%o', @fileperms($file['file'])), -4);
$file['language'] = get_language(get_ext($file['file']));
if ('GB2312' == $file['encode']) {
    $file['encode_selected']['UTF-8'] = '';
    $file['encode_selected']['GB2312'] = 'selected="selected"';
} else {
    $file['encode_selected']['UTF-8'] = 'selected="selected"';
    $file['encode_selected']['GB2312'] = '';
}
//
$textarea = array();
$textarea['main']['width'] = C('EDIT_CONF.EDITOR_CONF.WIDTH') - 35;
$textarea['main']['height'] = C('EDIT_CONF.EDITOR_CONF.HEIGHT') - 250;
$textarea['edit']['width'] = $textarea['main']['width'] - 10;
$textarea['edit']['height'] = $textarea['main']['height'] - 10;
Beispiel #2
0
 }
 //---------------------------------------------------------------------------------------------
 $type = get_ext($_FILES["Filedata"]["name"]);
 $uploadfile = @iconv('UTF-8', 'GB2312//IGNORE', trim(urldecode($_REQUEST['path']), '/') . '/' . $_FILES["Filedata"]["name"]);
 if ((in_array('*', C('UPLOAD_CONF.UPLOAD_ALLOW_TYPE')) || in_array($type, C('UPLOAD_CONF.UPLOAD_ALLOW_TYPE'))) && $_FILES["Filedata"]["size"] < C('UPLOAD_CONF.UPLOAD_MAX_SIZE')) {
     if ($_FILES["Filedata"]["error"] > 0) {
         echo '<div class="notification attention png_bg"><div><span style="float:left;">上传失败: </span>' . $_FILES["Filedata"]["name"] . '!</div></div>';
         echo '<div class="notification error png_bg"><div><span style="float:left;">错误信息: </span>' . $_FILES["Filedata"]["error"] . '!</div></div>';
         exit;
     } else {
         $file = array();
         $file['msg_attention'] = '<div class="notification attention png_bg"><div><span style="float:left;">上传失败: </span>' . $_FILES["Filedata"]["name"] . '</div></div>';
         $file['msg_success_normal'] = '<div class="notification success png_bg"><div><span style="float:left;">上传成功: </span>' . $_FILES["Filedata"]["name"] . '</div></div>';
         $file['msg_success_cover'] = '<div class="notification attention png_bg"><div><span style="float:left;">上传成功: </span>' . $_FILES["Filedata"]["name"] . ' 已覆盖</div></div>';
         $file['file_type'] = '<span style="float:left;">文件类型: </span>' . $type . '<br />';
         $file['file_size'] = '<span style="float:left;">文件大小: </span>' . dealsize($_FILES["Filedata"]["size"]) . '<br />';
         $file['file_md5'] = '<span style="float:left;">MD5 校验 : </span>' . getGet("access2008_File_md5") . '<br />';
         $file['info'] = '<div class="notification information png_bg"><div>' . $file['file_type'] . $file['file_size'] . $file['file_md5'] . '</div></div>';
         $file['msg_error_exist'] = '<div class="notification error png_bg"><div><span style="float:left;">错误信息: </span>' . $_FILES["Filedata"]["name"] . '文件已存在</div></div>';
         $file['msg_error_cover'] = '<div class="notification error png_bg"><div><span style="float:left;">错误信息: </span>覆盖上传失败</div></div>';
         $file['msg_error_md5'] = '<div class="notification error png_bg"><div><span style="float:left;">错误信息: </span>文件MD5校验失败</div></div>';
         $file['msg_error_unknow'] = '<div class="notification error png_bg"><div><span style="float:left;">错误信息: </span>未知错误</div></div>';
         $file['msg_error_notallow'] = '<div class="notification error png_bg"><div><span style="float:left;">错误信息: </span>请检查文件类型和文件大小是否符合标准</div></div>';
         if (getGet("access2008_File_md5") !== md5_file($_FILES["Filedata"]["tmp_name"])) {
             echo $file['msg_attention'], $file['info'];
             exit($file['msg_error_md5']);
         }
         if (file_exists($uploadfile) && !(bool) $_REQUEST['cover']) {
             echo $file['msg_attention'], $file['info'];
             exit($file['msg_error_exist']);
         } elseif (file_exists($uploadfile) && (bool) $_REQUEST['cover']) {
Beispiel #3
0
        }
    }
    $Base = new Base();
    $Base->copy($temp['from'], $temp['to'], $cover, $cut, $coverfiles, $info);
    $data['message'] = '<font color="green">目录变更:</font><font color="red">' . g2u($path_from) . '</font><font color="blue">  =>  </font><font color="red">' . g2u($path_to) . '</font><br />';
    if (!$cover && is_array($coverfiles) && !empty($coverfiles)) {
        foreach ($coverfiles as $i) {
            $data['statusCode'] = 201;
            $data['data'] = array('type' => $type, 'path_from' => $path_from, 'path_to' => $path_to, 'files' => trim($_REQUEST['files']), 'cover' => $cover);
            $coverfile = str_replace($path_from, '', $i);
            $data['message'] .= '<font color="blue">覆盖文件:</font><font color="red">' . g2u($coverfile) . '</font><br />';
        }
    } else {
        $data['statusCode'] = 200;
        $data['message'] .= '<font color="green">变更详情:</font><font color="red">共' . ($cut ? '移动' : '复制') . '目录' . $info['dir'] . '个,文件' . $info['file'] . '个</font><br />';
        $data['message'] .= '<font color="green">总计大小:</font><font color="red">' . dealsize($info['size']) . '</font><br />';
    }
    $data['message'] .= '<font color="green">执行耗时:</font><font color="red">' . G('_run_start', '_run_end', 6) . ' 秒</font><br />';
    exit(json_encode($data));
} elseif ('chmod' == $action) {
    $type = trim($_REQUEST['type']);
    $data = array();
    switch ($type) {
        case 3:
            //批量权限修改
            if ('show' == trim($_REQUEST['mode'])) {
                require ROOT . 'static/template/chmodfile.tpl.php';
                exit;
            }
            $files = explode('|', u2g(trim($_REQUEST['files'])));
            $chmods = $chmod = (int) trim($_REQUEST['chmod']);
Beispiel #4
0
                                                 if ($filename) {
                                                     $type = 1;
                                                 } else {
                                                     if ($content) {
                                                         $type = 2;
                                                     }
                                                 }
                                             }
                                             $case = $case;
                                             $items = $lb->search_file($path, $s, $type, $case);
                                             if (count($items) == 0) {
                                                 exitme("notice(lang.search_no_result);", "eval");
                                             }
                                             $s = "";
                                             foreach ($items as $f) {
                                                 $s .= "||{$f}|" . dealsize(filesize($f));
                                             }
                                             exitme("search_parse('{$s}')", "eval");
                                         } else {
                                             exitme("notice(lang.deny)", "eval");
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #5
0
                            if (@move_uploaded_file($myfile, $path . $myfile_name)) {
                                $tt++;
                                $tsize += filesize($path . $myfile_name);
                                inlog("上传文件," . $path . $myfile_name . "成功");
                            } else {
                                $error .= $myfile_name . "上传失败:原因不明!\\n";
                                continue;
                            }
                        }
                    }
                }
            }
        }
    }
    $str = "成功上传{$tt}个文件!!";
    $str .= "\\n总大小:" . dealsize($tsize) . "\\n";
    $str .= $error ? "\\n以下是错误信息:\\n" . $error : "";
    exit3($str);
} else {
    exit3("没有权限!", 0);
}
function exit3($s, $r = 1)
{
    $ss = "<script language=javascript>alert('{$s}');";
    $ss .= $r ? "parent.reloaddata();" : "";
    $ss .= "</script>";
    exit($ss);
}
function checkfilename($file)
{
    if (!$file) {
Beispiel #6
0
            }
            $out_str .= "<body style='backgroud-color:#ffffff;'>\n";
            $out_str .= "<script language=javascript src=\"js/edit.js\"></script>\n";
            $out_str .= "<script language=javascript src=\"js/hash.js\"></script>\n";
            $line = @file($path);
            $content = "";
            $lines = "";
            $n = count($line);
            for ($i = 0; $i < $n; $i++) {
                $content .= htmlspecialchars($line[$i]);
            }
            $n += 1000;
            for ($i = 0; $i < $n; $i++) {
                $lines .= $i + 1 . "\n";
            }
            $main = deal_temp("js/editor.htm", array("path" => $path, "titleback" => $icon["titleback"], "width" => $sitewidth - 60, "filename" => basename1($path), "size" => dealsize(filesize($path)), "selected_gb2312" => $selected_gb2312, "selected_utf8" => $selected_utf8, "encode" => $encode));
            $main = deal_temp("temp/{$tempname}/main.htm", array("sitewidth" => $sitewidth, "title" => "编辑文件 " . basename1($path), "logout" => "<a href='login.php?action=logout' target=_top>退出</a>", "main" => $main, "currentpath" => " ", "username" => $user["name"], "footer" => ""));
            $encode2 = get_encode("temp/{$tempname}/main.htm");
            if ($encode != $encode2) {
                $s1 = @iconv($encode2, $encode, $out_str);
                $out_str = $s1 ? $s1 : $out_str;
                $s1 = @iconv($encode2, $encode, $main);
                $main = $s1 ? $s1 : $main;
            }
            echo $out_str;
            echo str_replace(array("{lines}", "{content}"), array($lines, $content), $main);
            echo "<script>RoundCorner('titlediv');RoundCorner('maindiv');</script>";
            exit;
        }
    }
}