<?php /* FILES::lista(PASTA->STRING,FILEFILTER->STRING,PREFIXO->BOOLEAN); */ $path = realpath(dirname(__FILE__)) . "/"; FILES::$path = $path; class FILES { public static $path = ""; // Files("fotos","*.jpg,*.png,",false); // Desta forma vai retornar todos os arquivos do tipo jpg que estiverem dentro da pasta public static function lista($pasta, $fileFilter, $prefixoPasta = false, $type = "arquivos") { return self::list_path($pasta, $fileFilter, $prefixoPasta, $type); } public static function arquivos($pasta, $fileFilter, $prefixoPasta = false) { return self::list_path($pasta, $fileFilter, $prefixoPasta, 'arquivos'); } public static function pastas($pasta, $fileFilter, $prefixoPasta = false) { return self::list_path($pasta, $fileFilter, $prefixoPasta, 'pastas'); } private static function list_path($pasta, $fileFilter, $prefixoPasta = false, $type = "arquivos") { $arquivos = array(); $pesquisa = glob($pasta . '/{' . $fileFilter . '}', GLOB_BRACE); $total = count($pesquisa); for ($i = 0; $i < $total; $i++) { $item = $pesquisa[$i]; if (!empty($item)) {
//插入管理员 $sql = "insert into {$install_tablepre}" . "users(username,password,classid,email,power) values('{$adminuser}','" . md5($adminpas) . "','1','','')"; //echo $sql; if ($pdo->exec($sql)) { //echo '成功'; } //更改配置 $db_config = ""; $db_config .= "<?php\n"; $db_config .= "//数据库配置\n"; $db_config .= "\$db_type='1';\n"; $db_config .= "\$db_host='{$sqlite_table}';\n"; $db_config .= "\$db_name='{$sqlite_name}';\n"; $db_config .= "\$db_pass='******';\n"; $db_config .= "\$db_table='{$sqlite_tab}';\n"; $db_config .= "\$db_tablepre='{$install_tablepre}';\n"; $db_config .= "\$db_ut='utf8';\n"; $db_config .= "?>"; require "../include/file.class.php"; $f = new FILES(); $f->setText($db_config); $f->saveToFile('../include/dataconfig.inc.php'); //加安装锁 @touch("../data/install.lock"); if ($rs == '1') { errorinfo("程序安装成功,请点击<a href='../'>此处</a>进入网站!", ''); } } else { errorinfo("数据库信息有误!", ''); } }