Esempio n. 1
0
    if ($list) {
        foreach ($list as $file) {
            $d = Load::loadJSON($takepath . $file);
            $d['path'] = Path::resolve($d['path']);
            $d['modified'] = filemtime(Path::theme($d['path']));
            preg_match("/\\.([a-zA-Z]+)\$/", $d['path'], $match);
            $d['ext'] = strtolower($match[1]);
            $files[] = $d;
        }
    }
    $ans['files'] = $files;
} elseif ($type == 'takefile') {
    if ($submit) {
        $take = (bool) $_GET['take'];
        $ans['take'] = $take;
        $file = autoedit_theme($id);
        $file = Path::toutf($file);
        if (!$file) {
            $ans['noaction'] = true;
            //Собственно всё осталось как было
        } else {
            $takepath = autoedit_takepath($file);
            if (!$take && is_file($takepath)) {
                $r = @unlink($takepath);
                if (!$r) {
                    return Ans::err($ans, 'Неудалось отпустить файл');
                }
            } elseif ($take && !is_file($takepath)) {
                //Повторно захватывать не будем
                $save = array('path' => $id, 'date' => time(), 'ip' => $_SERVER['REMOTE_ADDR'], 'browser' => $_SERVER['HTTP_USER_AGENT']);
                $r = file_put_contents($takepath, Load::json_encode($save));
Esempio n. 2
0
function autoedit_takepath($file = false)
{
    $takepath = Path::resolve('!admin_takefiles/');
    if ($file === false) {
        return $takepath;
    }
    $file = autoedit_theme($file);
    $path = $takepath . preg_replace('/[\\/\\\\\\*]/', '_', Path::tofs($file)) . '.js';
    return $path;
}