예제 #1
0
파일: get.php 프로젝트: akiyatkin/files
        return false;
    }
    return infra_theme($folder . $result);
}, array($fdata['path']), isset($_GET['re']));
$ans = array('src' => $isrc);
if (!$src) {
    if (!infra_isphp()) {
        header('HTTP/1.0 404 Not Found');
    }
    return;
}
$fdata = infra_srcinfo($src);
if (in_array($fdata['ext'], array('docx'))) {
    $txt = files\Docx::get($src);
    return Ans::txt($txt);
}
if (in_array($fdata['ext'], array('mht'))) {
    $txt = files\Mht::get($src);
    return Ans::txt($txt);
}
if (in_array($fdata['ext'], array('xls', 'xlsx'))) {
    $ans = files\Xlsx::get($src);
    return Ans::ans($ans);
}
if (in_array($fdata['ext'], array('tpl', 'html', 'htm', 'php'))) {
    $txt = infra_loadTEXT($src);
    return Ans::txt($txt);
}
if (!infra_isphp()) {
    header('HTTP/1.0 400 Bad Request');
}
예제 #2
0
파일: user.php 프로젝트: akiyatkin/user
<?php

/**
 * Проверяем что нет ошибок и возвращаются ожидаемые данные User::get...
 */
use itlife\infra\ext\Ans;
use itlife\user\User;
infra_test(true);
$ans = array();
$data = User::get();
if (!$data || sizeof($data) != 5 || !$data['result'] || !$data['id']) {
    return Ans::err($ans, 'User data get error');
}
return Ans::ret($ans, 'Ok');
예제 #3
0
파일: read.php 프로젝트: akiyatkin/files
if (mb_strlen($text) != 1935) {
    return Ans::err($ans, 'Cant read ' . $name . ' ' . strlen($text));
}
$name = 'test.html';
$text = Mht::get('*files/tests/resources/' . $name);
if (strlen($text) != 1073) {
    return Ans::err($ans, 'Cant read ' . $name . ' ' . strlen($text));
}
$data = Xlsx::init('*files/tests/resources/test.xlsx');
if (!$data) {
    return Ans::err($ans, 'Cant read test.xlsx');
}
$data = Xlsx::init('*files/tests/resources/test.csv');
if (!$data) {
    return Ans::err($ans, 'Cant read test.csv');
}
if (sizeof($data['childs']) != 1) {
    return Ans::err($ans, 'Cant read test.csv ' . sizeof($data['childs']));
}
$num = ini_get('mbstring.func_overload');
if ($num != 0) {
    $ans['class'] = 'bg-warning';
    return Ans::err($ans, 'mbstring.func_overload should be 0, not ' . $num);
} else {
    $data = Xlsx::get('*files/tests/resources/test.xls');
    if (sizeof($data['childs'][0]['data']) != 30) {
        return Ans::err($ans, 'Cant read test.xls ' . sizeof($data['childs'][0]['data']));
    }
}
return Ans::ret($ans, 'tpl, mht, docx, xls, xlsx read ok!');