function getfilelist2($directory) { if (!is_dir($directory)) { return; } $files = array(); $index = 0; if ($dirh = @opendir($directory)) { while (false !== ($filename = readdir($dirh))) { if ($filename == '.' || $filename == '..') { continue; } if (is_dir($directory . $filename)) { $files[$filename] = getfilelist($directory . $filename); } } return $files; } }
$loglist[] = $logpref . $ym . $_GET["d"] . $logext; } } else { // LOG TYPE 0 if ($flg_exception_act) { $dataflgs = array(); $fn = array(); $fn = getfilelist($logfile); if ($fn) { foreach ($fn as $v) { $loglist[] = $v; } } } elseif ($_GET["d"] == '00') { $fn = array(); $fn = getfilelist($logfile); if (count($fn)) { $_GET["d"] = eregi_replace("({$logpref}|{$logext})", "", max($fn)); $loglist[] = max($fn); } else { $_GET["d"] = '01'; } } else { $loglist[] = $logpref . $_GET["d"] . $logext; } } if ($loglist) { //データナンバー初期化 $data_no = 0; //一時データ初期化 unset($tmp_data);
$settting["plugin"] = getfilelist($plugindir); if (is_array($settting["plugin"])) { foreach ($settting["plugin"] as $k => $v) { if (!eregi("(\\.php)\$", $v)) { unset($settting["plugin"][$k]); continue; } $settting["plugin"][$k] = basename($v, ".php"); } sort($settting["plugin"]); } /*=========================================*/ /* スキン読み込み */ /*=========================================*/ $settting["skin"] = array(); $settting["skin"] = getfilelist($skindir); sort($settting["skin"]); /*=========================================*/ /* 設定初期化 */ /*=========================================*/ $settting["exclude_hosts"] = array(); $settting["exclude_urls"] = array(); $settting["exclude_uas"] = array(); $settting["act"] = array(); $settting["ch_url"] = array(); /*=========================================*/ /* 各設定読み込み */ /*=========================================*/ //HOST・IP $list_fn = $datadir . "exclude_hosts.txt"; if (file_exists($list_fn)) {
if (!is_readable($conf)) { return $larray; } $file = fopen($conf, "r"); while (!feof($file)) { $line = trim(fgets($file)); if (!ereg("#", $line) && $line) { $larray[] = $line; } } fclose($file); return $larray; } //要导入的服务器内网IP列表,一行一个,应尽量确保一次导入的机器都是一种角色 $listfile = "/root/ssd.txt"; $lines = getfilelist($listfile); $i = 0; //一次导入的IP数量 $j = 10000; foreach ($lines as $l) { $postdata = array(); $postdata[act] = 'add'; $postdata[ip_in] = $l; $e = explode('.', $l); $postdata[ip_ex] = $e[0] . '.' . ($e[1] - 1) . '.' . $e[2] . '.' . $e[3]; $postdata[env] = 'online'; //根据B段IP数字判断所属IDC编号的,这个idcid编号应根据你们数据库里idc表里的id来决定。如果你们要导入的内网IP无法在B段上区分,这里要自行改下实现方式。 switch ($e[1]) { case 75: if ($e[2] == 48) { $idcid = 15;
function blogger_getRecentPosts($m) { $appkey = $m->getParam(0); // discarded $blogid = $m->getParam(1); $username = $m->getParam(2); $password = $m->getParam(3); $numberOfPosts = $m->getParam(4); unset($appkey); // this is just to drive the point home that we aren't using appkey. // i suppose we could log the appkeys just for the heck of it. $blogid = $blogid->scalarval(); $username = $username->scalarval(); $password = $password->scalarval(); $numberOfPosts = $m->scalarval(); if (isvaliduser($username, $password)) { parse_str(readuser($username), $userinfo); } $postlist = getfilelist("{$_SERVER['PWUSERS_DIR']}/{$username}/plan/", "plan*.txt*"); rsort($postlist); for ($i = 0; $i < $numberOfPosts; $i++) { $returnlist['content'] = new xmlrpcval(getplan($username, "." . $postid), 'string'); $returnlist['userid'] = new xmlrpcval($username, 'string'); $returnlist['postid'] = new xmlrpcval($postid, 'string'); $returnlist['datecreated'] = new xmlrpcval($postid, 'string'); $xmlarray[] = new xmlrpcval(xmlrpc_encode($returnlist)); } $returnarray = new xmlrpcval($xmlarray, 'array'); $returnval = new xmlrpcresp($returnarray); // if we generated an error, create an error return response if ($err) { return new xmlrpcresp(0, $xmlrpcerruser, $err); } else { // otherwise, we create the right response return $returnval; } }
function getdirectorysize($root) { $root = getRealpath($root); $size = 0; $fileList = getfilelist($root); foreach ($fileList as $file) { $size += filesize($root . "/" . $file); } $dirList = getdirlist($root); foreach ($dirList as $dir) { $size += getdirectorysize($root . "/" . $dir); } return $size; }