Example #1
0
function copy_directory($source, $destination, $holo, $name, $check_holo = true)
{
    $log = Logger::getLogger("copy");
    $log->debug("copy directory : " . $source . " in " . $destination);
    if (is_dir($source)) {
        $directory = dir($source);
        while (FALSE !== ($readdirectory = $directory->read())) {
            if ($readdirectory == '.' || $readdirectory == '..' || $readdirectory == '.DS_Store') {
                continue;
            }
            $PathDir = $source . '/' . $readdirectory;
            $log->debug("File : " . $readdirectory . " Path : " . $PathDir . " holo=" . $check_holo);
            if (is_dir($PathDir)) {
                copy_directory($PathDir, $destination . '/' . $readdirectory, $holo, $name, $check_holo);
                continue;
            }
            if ($check_holo == false) {
                $log->debug("holo false => copy " . $PathDir . " in " . $destination . '/' . $readdirectory);
                copy($PathDir, $destination . '/' . $readdirectory);
                if (strstr($readdirectory, ".xml")) {
                    filter_file($destination . '/' . $readdirectory, $name);
                }
            } else {
                if (strpos($readdirectory, $holo)) {
                    $log->debug("holo true => copy " . $PathDir . " in " . $destination . '/' . $readdirectory);
                    copy($PathDir, $destination . '/' . $readdirectory);
                    if (strstr($readdirectory, ".xml")) {
                        filter_file($destination . '/' . $readdirectory, $name);
                    }
                }
            }
        }
        $directory->close();
    } else {
        copy($source, $destination);
    }
}
Example #2
0
        if ($_GPC['__code'] != $hash) {
            message('你输入的验证码不正确');
        }
        if ($_GPC['__code'] != $hash) {
            message('你输入的验证码不正确');
        }
        check_code($code);
        if (!is_file($file['tmp_name']) && empty($data)) {
            message('提交内容为空');
        }
        $originArray = array();
        if (is_file($file['tmp_name'])) {
            $content = file_get_contents($file['tmp_name']);
            $content = filter_file($content, $originArray);
        } elseif ($data) {
            $content = filter_file($data, $originArray);
        }
        $status = pdo_fetchall("SELECT * FROM " . tablename('account_status'), array(), 'id');
        $account = pdo_fetchall("SELECT * FROM " . tablename('account') . " WHERE account_type={$type} AND account in({$content}) ", array(), 'account');
        $result = template('index/multi_table', TEMPLATE_FETCH);
    }
    if ($_GPC['do'] == 'search_save') {
        header("Content-type:application/vnd.ms-excel");
        header("Content-Disposition:filename=result.xls");
        exit($result);
    }
}
$page = template('index/multi_search', 1);
//file_put_contents(IA_ROOT . '/web/multi_search.html', $page);
echo $page;
function filter_file($content, &$originArray)