Beispiel #1
0
 function view_main()
 {
     $this->db = Model::dbConnect($GLOBALS["gDataBase"]["db"]);
     $serverinfo = PHP_OS . ' / PHP v' . PHP_VERSION;
     $serverinfo .= @ini_get('safe_mode') ? ' Safe Mode' : NULL;
     $dbversion = $this->db->getOne("SELECT VERSION()");
     $fileupload = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : '<font color="red">' . $lang['no'] . '</font>';
     $dbsize = 0;
     $query = $tables = $this->db->getAll("SHOW TABLE STATUS");
     foreach ($tables as $table) {
         $dbsize += $table['Data_length'] + $table['Index_length'];
     }
     $dbsize = $dbsize ? size_unit_convert($dbsize) : $lang['unknown'];
     $dbversion = $this->db->getOne("SELECT VERSION()");
     $magic_quote_gpc = get_magic_quotes_gpc() ? 'On' : 'Off';
     $allow_url_fopen = ini_get('allow_url_fopen') ? 'On' : 'Off';
     $this->tpl->assign('serverinfo', $serverinfo);
     $this->tpl->assign('fileupload', $fileupload);
     $this->tpl->assign('dbsize', $dbsize);
     $this->tpl->assign('dbversion', $dbversion);
     $this->tpl->assign('magic_quote_gpc', $magic_quote_gpc);
     $this->tpl->assign('allow_url_fopen', $allow_url_fopen);
 }
Beispiel #2
0
function list_dir($path, $type = 'all')
{
    $list = array();
    if (!($dir = @dir($path))) {
        return false;
    }
    $i = 0;
    while (false !== ($filename = $dir->read())) {
        if (preg_match("/^(\\.{1,2}|\\.svn)\$/ism", $filename)) {
            continue;
        }
        $fileinfo = stat($dir->path . '/' . $filename);
        $pathinfo = pathinfo($filename);
        $filetype = filetype($dir->path . '/' . $filename);
        //if($filetype == 'dir') list_dir($dir->path,$list[$i]);
        if ($type == 'file' && $filetype == 'dir' && $type != 'all') {
            continue;
        }
        if ($type == 'dir' && $filetype == 'file' && $type != 'all') {
            continue;
        }
        $list[$i]['id'] = $filename . uniqid("_");
        $list[$i]['type'] = $filetype;
        $list[$i]['name'] = mb_convert_encoding($filename, "UTF-8", "GBK");
        $list[$i]['basename'] = $pathinfo['basename'];
        $list[$i]['extension'] = isset($pathinfo['extension']) ? $pathinfo['extension'] : '';
        $list[$i]['time'] = date("Y-m-d H:i:s", $fileinfo['mtime']);
        $list[$i]['size'] = size_unit_convert($fileinfo['size']);
        if ($filetype == 'dir') {
            $list[$i]['folders'] = array(array("_reference" => ''));
        }
        $list[$i]['dir'] = path_clean($dir->path);
        $list[$i]['path'] = path_clean($dir->path . '/' . $filename);
        $i++;
    }
    $dir->close();
    //@array_multisort($list,SORT_DESC,$list);//排序 如果搜索全部类型则先列数组
    return $list;
}