Ejemplo n.º 1
0
 static function loginCheck()
 {
     $uname = wf_gpc('wf_uname', 'p', 'trim');
     $upawd = wf_gpc('wf_upawd', 'p', 'trim');
     $uhash = wf_gpc('wf_uhash', 'p', 'trim');
     if (empty($uhash) || $uhash != $_SESSION['wf_uhash']) {
         $_SESSION = array();
         $_SESSION['wf_error'] = '校验码码非法,请刷新页面后重试';
         wf_redirect('login.php?act=in');
     }
     define('WF_REAL_ROOT_PATH', str_replace('\\', '/', realpath(wf_config('ROOT_PATH'))));
     //		define('WF_REAL_USER_PATH', WF_REAL_ROOT_PATH . $user_info['upath']);
     $user_info = self::getUserData($uname);
     if ($user_info['uname'] == $uname && $user_info['upawd'] == md5($upawd)) {
         $_SESSION = array();
         $_SESSION['wf_uauth'] = $user_info['uauth'];
         $_SESSION['wf_uname'] = $user_info['uname'];
         $_SESSION['wf_uroot'] = WF_REAL_ROOT_PATH;
         $_SESSION['wf_upath'] = $user_info['upath'];
         $_SESSION['wf_uhost'] = 'http://' . $_SERVER['HTTP_HOST'] . WEB_PATH . 'data/nfs';
         $_SESSION['wf_tokey'] = self::getTokey();
         $_SESSION['wf_error'] = '';
         wf_redirect('./');
     } else {
         $_SESSION = array();
         $_SESSION['wf_error'] = '账户不存在或密码有误!';
         wf_redirect('login.php?act=in');
     }
     exit;
 }
Ejemplo n.º 2
0
    app.api  = {
        key: 'asljasasfgjsag',
        url: './webftp.php?mod=nfs&act=upload',
        path: '/?/', cover: 0,
        wf_ssid: '<?php 
echo session_id();
?>
',
    };

    app.settings = {
        max_file_size: '<?php 
echo wf_config('UPLOAD.MAX_FILE_SIZE');
?>
', 
        chunk_size: '<?php 
echo wf_config('UPLOAD.CHUNK_SIZE');
?>
',
        filters: []
    };
    
    
    // 执行初始化
    app.upload.init();
    window.dialog = parent.$.dialog({id : 'upload'});
    window.dialog.title('文件上传 - 准备就绪');
});
</script>
</body>
</html>
Ejemplo n.º 3
0
// API通信 常量
define('WF_API_ON', false);
define('WF_API_KEY', 'eaa043d7d932729623439f2216fb86f6');
define('WF_API_URL', '');
// 加载系统函数库
require WF_CORE_ROOT . 'Functions.php';
require WF_CORE_ROOT . 'FileFS.class.php';
// 加载授权认证库
if (WF_API_ON) {
    require WF_CORE_ROOT . 'AuthRemote.class.php';
} else {
    require WF_CORE_ROOT . 'AuthLocal.class.php';
}
// 注册Error处理处理器
set_error_handler('error_handler_fun');
if (function_exists('date_default_timezone_set')) {
    date_default_timezone_set('PRC');
}
//  开启SESSION
if (isset($_GET['wf_ssid']) && !empty($_GET['wf_ssid'])) {
    session_id($_GET['wf_ssid']);
}
session_name('webftp_ssid');
session_save_path(WF_DATA_PATH . 'session');
session_set_cookie_params(1800, WEB_PATH);
session_start();
// 全局配置数组
$_CONFIG = array('SYSTEM_NAME' => '附件下载管理系统', 'SYSTEM_VERSION' => 'v1.0', 'LOG_ON' => true, 'LOG_TYPE' => 'EMERG,ALERT,CRIT,ERR,WARNING,NOTICE,INFO,DEBUG', 'LOG_FILE_SIZE' => 2097152, 'LOG_SAVE_TYPE' => 2, 'ROOT_PATH' => './data/nfs', 'USER_PATH' => '/_xx_', 'UPLOAD' => array('chunk_size' => min(8, intval(ini_get('upload_max_filesize'))), 'max_file_size' => 1024, 'filters' => array(array('All Files (*.rar;*.htm;*.jpg;*.pdf;*.doc;*.*)', '*,rar,zip,tar,gz,7z,php,js,css,htm,html,xml,jpg,png,gif,bmp,ico,pdf,doc,ppt,xls,docx,pptx,xlsx,wps,et,dps'), array('Archive Files (*.rar;*.zip;*.tar;*.gz;*.7z)', 'rar,zip,tar,gz,7z'), array('Script Files (*.php;*.js;*.css;*.htm;*.xml)', 'php,js,css,htm,html,xml'), array('Images Files (*.jpg;*.png;*.gif;*.bmp;*.ico)', 'jpg,png,gif,bmp,ico'), array('Document Files (*.doc;*.ppt;*.xls;*.pdf;wps;*.et;*.dps)', 'pdf,doc,ppt,xls,docx,pptx,xlsx,wps,et,dps'))));
// 初始化配置参数
wf_config($_CONFIG);
Ejemplo n.º 4
0
 private function on_nlist()
 {
     $path = $this->path;
     $otype = wf_gpc('fs-otype');
     $osort = wf_gpc('fs-osort');
     $this->code = $this->FileFS->nlist($path, $list, $path2) ? 200 : 300;
     $this->mess = $this->FileFS->error();
     if ($otype && $osort && !empty($list)) {
         //目录排序
         if (!empty($list['dirs'])) {
             $arr = array();
             foreach ($list['dirs'] as $k => &$v) {
                 $arr['ext'][$k] = $v['name'];
                 $arr['name'][$k] = $v['name'];
                 $arr['size'][$k] = $v['name'];
                 $arr['mtime'][$k] = $v['mtime'];
             }
             if ('desc' == $osort) {
                 array_multisort($arr[$otype], SORT_DESC, $list['dirs']);
             } else {
                 array_multisort($arr[$otype], SORT_ASC, $list['dirs']);
             }
         }
         //文件排序
         if (!empty($list['files'])) {
             $video = wf_config('VIDEO');
             $arr = array();
             foreach ($list['files'] as $k => &$v) {
                 $arr['name'][$k] = $v['name'];
                 $arr['size'][$k] = $v['size'];
                 $arr['mtime'][$k] = $v['mtime'];
                 $arr['ext'][$k] = $v['ext'];
             }
             if ('desc' == $osort) {
                 array_multisort($arr[$otype], SORT_DESC, $list['files']);
             } else {
                 array_multisort($arr[$otype], SORT_ASC, $list['files']);
             }
         }
     }
     unset($tmp, $arr);
     $data = array('list' => $list, 'path' => array('root' => '/', 'current' => $path, 'parent' => str_replace('\\', '/', dirname($path))));
     $this->data = $data;
     $this->show();
 }
Ejemplo n.º 5
0
function error_handler_fun($errno, $errmsg, $errfile, $errline, $errvars)
{
    if (!wf_config('LOG_ON')) {
        return;
    }
    $user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
    $errortype = array(E_ERROR => 'EMERG', E_WARNING => 'WARNING', E_PARSE => 'EMERG', E_NOTICE => 'NOTICE', E_CORE_ERROR => 'EMERG', E_CORE_WARNING => 'WARNING', E_COMPILE_ERROR => 'EMERG', E_COMPILE_WARNING => 'WARNING', E_USER_ERROR => 'EMERG', E_USER_WARNING => 'WARNING', E_USER_NOTICE => 'NOTICE', E_STRICT => 'NOTICE', E_RECOVERABLE_ERROR => 'EMERG', 'INFO' => 'INFO', 'DEBUG' => 'DEBUG', 'SQL' => 'SQL');
    if (isset($errortype[$errno])) {
        $error['type'] = $errortype[$errno];
    } else {
        $error['type'] = $errno;
    }
    if (!in_array($error['type'], explode(',', wf_config('LOG_TYPE')))) {
        return;
    }
    $err = date('[ Y-m-d H:i:s (T) ]') . '  ';
    $err .= $error['type'] . ':  ';
    $err .= $errmsg . '  ';
    $err .= $errfile . '  ';
    $err .= '第' . $errline . '行  ';
    $err .= "\n";
    $destination = WF_DATA_PATH . 'logs/' . date('y_m_d') . '.log';
    if (is_file($destination) && floor(wf_config('LOG_FILE_SIZE')) <= filesize($destination)) {
        if (1 == C('LOG_SAVE_TYPE')) {
            unlink($destination);
        } else {
            rename($destination, dirname($destination) . '/' . time() . '-' . basename($destination));
        }
    }
    error_log($err, 3, $destination);
}
Ejemplo n.º 6
0
 /**
  * 下载文件,支持XSend
  *
  * @param string $type 文件类型
  * @param string $path 文件路径
  * @param string $name 显示名称
  */
 public function download($path, $name, $type = 'file')
 {
     $path = $this->get_gpath($path);
     if ('file' == $type && is_readable($path)) {
         $size = filesize($path);
     } else {
         if ('dir' == $type && is_readable($path)) {
             require WF_CORE_ROOT . 'PclZip.class.php';
             $name .= '.zip';
             $temp = './data/tmp/' . md5($path) . '.tmp';
             $Zip = new PclZip($temp);
             if (!$Zip->create($path, PCLZIP_OPT_REMOVE_PATH, $path)) {
                 $this->error = '文件系统错误,目录归档错误';
                 return false;
             }
             $path = $temp;
             $size = filesize($temp);
         } else {
             $this->error = '文件系统错误,可能没有访问权限';
             return false;
         }
     }
     // 输出文件头、处理中文文件名
     $encoded_nname = rawurlencode($name);
     $ua = $_SERVER['HTTP_USER_AGENT'];
     if (preg_match('/MSIE/', $ua)) {
         header("Content-Disposition: attachment; filename={$encoded_nname}");
     } else {
         if (preg_match('/Firefox/', $ua)) {
             header("Content-Disposition: attachment; filename*=utf8'' {$name}");
         } else {
             header("Content-Disposition: attachment; filename={$name}");
         }
     }
     header('Content-type: application/octet-stream');
     header('Content-Encoding: none');
     header('Cache-Control: private');
     header('Accept-Ranges: bytes');
     header('Pragma: no-cache');
     header('Expires: 0');
     header("Content-length: {$size}");
     header("Accept-Length: {$size}");
     // 开始下载文件
     if (!is_readable($path)) {
         exit('没有读写权限:' . $path);
     } else {
         if (wf_config('X_SENDFILE_ON')) {
             // 使用X-Sendfile发送文件
             header("X-Sendfile: {$path}");
         } else {
             readfile($path);
         }
     }
     if ('dir' == $type) {
         unlink($path);
     }
     exit;
 }