function showLog($c) { echo '* ' . $c->shortSha() . "\n"; if (count($c->parents()) >= 1) { echo "| \n"; $p = $c->parents(); $c2 = new GitCommit($c->git()); $c2 = $c2->load($p[0]); showLog($c2); } }
function importFromCenter_handler($guid) { //从开盘服务器导入数据处理 global $_W; $progress = 5; updateProgress($progress, '获取导入验证'); $domain = $_W['config']['server']; $url = "http://{$domain}/db.php"; //?XDEBUG_SESSION_START=PHPSTORM showLog("正在连接中心{$domain}....."); $res = curl($url, array('func' => 'get_token', 'guid' => $guid, 'client' => $_W['config']['client'])); if (!empty($res) && $res['ok']) { $token = $res['token']; showLog("连接中心{$domain}成功,已获取验证<br/>"); } else { showLog('获取验证失败:' . $res['msg']); updateProgress(100, '导入项目失败'); return false; } $calls = array('project' => '主体项目', 'user' => '用户信息', 'build' => '楼盘信息', 'room' => '房间信息', 'chips' => '认筹信息'); $step = 20; $clear = false; foreach ($calls as $c => $m) { $progress += $step; updateProgress($progress, '正在获取' . $m); $data = curl($url, array('token' => $token, 'func' => 'get_data', 'type' => $c)); if (empty($data) || empty($data['ok'])) { showLog('获取' . $m . '出错' . $data['msg'] . '<br>'); continue; } if ($data['ok']) { showLog('获取' . $m . '成功<br>'); foreach ($data['data'] as $sync) { try { $res = sync_table($sync, true); showLog(" >>{$res['table']}表{$res['total']}条记录,更新{$res['update']}条,插入{$res['insert']}条<br/>"); } catch (Exception $e) { showLog(" >>{$res['table']}表更新出错:" . $e->getMessage() . '<br/>'); } } } sleep(1); } curl($url, array('token' => $token, 'func' => 'release_token')); showLog('导入完成'); updateProgress(100, '导入完成'); }
<?php include "login_check.php"; include "menu.php"; include "config/config.php"; include "functions.php"; //$bin_danger = "/usr/share/fruitywifi/bin/danger"; //DEPRECATED function showLog($filename, $path) { //$filename = "logs/dnsmasq.log"; //$filename = $path; $fh = fopen($path, "r"); // or die("Could not open file."); if (filesize($path)) { $data = fread($fh, filesize($path)); // or die("Could not read file."); fclose($fh); $data_array = explode("\n", $data); $data = implode("\n", array_reverse($data_array)); $data = htmlspecialchars($data); } echo "\n\t\t<br>\n\t\t<div class='rounded-top' align='left'> <b>{$filename}</b> </div>\n\t\t<textarea name='newdata' rows='10' cols='100' class='module-content' style='font-family: courier; overflow: auto; height:200px;'>{$data}</textarea>\n\t\t<br>\n\t"; } $logs_path = "{$log_path}/"; $logs = glob($logs_path . '*'); for ($i = 0; $i < count($logs); $i++) { $filename = str_replace($logs_path, "", $logs[$i]); //echo "$filename<br>"; if ($filename != "install.txt") { showLog($filename, $logs[$i]); } }
<html> <head> <title>Quiz Machine</title> </head> <body> <center> <h1>Quiz Machine</h1> <?php getFiles(); showTest(); showEdit(); showLog(); function getFiles() { //get list of all files for use in other routines global $dirPtr, $theFiles; chdir("."); $dirPtr = openDir("."); $currentFile = readDir($dirPtr); while ($currentFile !== false) { $theFiles[] = $currentFile; $currentFile = readDir($dirPtr); } // end while } // end getFiles function showTest() { //print a list of tests for user to take
function dispatchConference($op) { require_once _base_ . '/lib/lib.urlmanager.php'; $url =& UrlManager::getInstance(); $url->setStdQuery('modname=conference&op=list'); if (isset($_POST['undo'])) { $op = 'list'; } switch ($op) { case 'list': conference_list($url); break; case 'startnewconf': conference_startnewconf($url); break; case 'modconf': conference_modconf(); break; case 'delconf': conference_delconf(); break; case 'booking': booking(); break; case 'modbooking': modBooking(); break; case 'history': showHistory(); break; case 'log': showLog(); break; default: conference_list($url); } }
function updateToErp_handler($projGUID, $option) { //导出客户信息 //export_customer($projGUID); $progress = 5; updateProgress($progress, '正在准备...'); $cfg = MsSql()->getConfig(); showLog("正在连接数据库{$cfg['host']}[{$cfg['database']}]..."); unset($cfg); if (MsSql()->IsConnected()) { showLog("连接数据库成功<br/>"); } else { showLog(MsSql()->getErrors()[0]); updateProgress(100, '连接出错'); exit; } $importInvo = false; $step_item = intval(90 / count($option)); $step = $step_item / 10; //分十次调用,每次1? $progressFunc = function ($value) use(&$progress, &$step) { $p = $progress + intval($step * $value); updateProgress($p, ''); sleep(1); }; foreach ($option as $item) { if ($item == 'voucher') { updateProgress($progress, '开始导出诚意金数据...'); $res = export_Voucher($projGUID, $progressFunc); showLog("导出诚意金数据完成,{$res['total']}条数据,{$res['update']}条更新,{$res['failed']}条出错<br/>"); $importInvo = true; } if ($item == 'order') { updateProgress($progress, '开始导出订金、订单数据...'); $res = export_chips($projGUID, $progressFunc); showLog("导出订金数据完成,{$res['total']}条数据,{$res['update']}条更新,{$res['failed']}条出错<br/>"); $importInvo = true; } if ($item == 'discount') { updateProgress($progress, '开始导入折扣数据...'); importErp_ProjPayAndDiscount($projGUID); showLog("导入折扣数据完成<br/>"); } if ($item == 'room') { updateProgress($progress, '开始导入房间数据...'); importErp_BuildInfo($projGUID); showLog("导入房间数据完成<br/>"); } if ($item == 'user') { updateProgress($progress, '开始导入用户数据...'); importErp_UserInfo($projGUID); showLog("导入用户数据完成<br/>"); } sleep(1); $progress += $step_item; } if ($importInvo) { updateProgress($progress, '开始导入票据信息...'); $res = export_Invoice($projGUID, $progressFunc); showLog("导入票据完成,{$res['total']}条数据,{$res['update']}条更新,{$res['failed']}条出错<br/>"); } updateProgress(100, '更新完成'); showLog('更新数据完成<br/>'); //记录日志 pdo_update('project', array('changetime' => TIMESTAMP), array('projguid' => $projGUID)); }
function processImportLogs() { // This function will import all existing log files. This is useful for rebuilding an empty Gamespy database global $cfg; // Make Sure Script doesn't timeout set_time_limit(0); // Find Log Files showLog("Importing Log Files"); $regex = '([0-9]{4})([0-9]{2})([0-9]{2})_([0-9]{4})'; $dir = opendir(chkPath($cfg->get('stats_logs'))); chdir(chkPath($cfg->get('stats_logs'))); while (($file = readdir($dir)) !== false) { if (strpos($file, $cfg->get('stats_ext'))) { ereg($regex, $file, $sort); $files[] = $sort[0] . "|" . $file; } } // Sort Files sort($files, SORT_STRING); // Re-post existing log data to bf2statistics $total = 0; for ($x = 0; $x < count($files); $x++) { $file = explode("|", $files[$x]); $fh = fsockopen($_SERVER['HTTP_HOST'], 80); fwrite($fh, "POST /ASP/bf2statistics.php HTTP/1.1\r\n"); fwrite($fh, "HOST: localhost\r\n"); fwrite($fh, "User-Agent: GameSpyHTTP/1.0\r\n"); fwrite($fh, "Content-Type: application/x-www-form-urlencoded\r\n"); $filename = @fopen($file[1], 'r'); $data = fread($filename, filesize($file[1])); @fclose($filename); if (strpos($data, '\\EOF\\1') === false) { // Older SNAPSHOT. Insert EOF to ensure bf2statiscs.php processes this... $data .= '\\EOF\\1'; } if (strpos($file[1], "importdata") === false) { // Make sure we know this is an import of existing log data $data .= '\\import\\1'; } fwrite($fh, "Content-Length: " . strlen($data) . "\r\n\r\n"); fwrite($fh, $data . "\r\n"); fclose($fh); showLog(" -> Importing {$file['1']}...done!"); $total++; } showLog("Total files imported: {$total}"); }
//$filename = "logs/dnsmasq.log"; //$filename = $path; $fh = fopen($path, "r"); // or die("Could not open file."); if(filesize($path)) { $data = fread($fh, filesize($path)); // or die("Could not read file."); fclose($fh); $data_array = explode("\n", $data); $data = implode("\n",array_reverse($data_array)); $data = htmlspecialchars($data); } echo " <br> <div class='rounded-top' align='left'> <b>$filename</b> </div> <textarea name='newdata' rows='10' cols='100' class='module-content' style='font-family: courier; overflow: auto; height:200px;'>$data</textarea> <br> "; } $logs_path = "$log_path/"; $logs = glob($logs_path.'*'); for ($i = 0; $i < count($logs); $i++) { $filename = str_replace($logs_path,"",$logs[$i]); //echo "$filename<br>"; if ($filename != "install.txt") showLog($filename, $logs[$i]); } ?>
<?php $phpdir = $_SERVER['DOCUMENT_ROOT'] . "/php"; require "{$phpdir}/template/top.inc"; require "{$phpdir}/template/includes.inc"; navDefine("main", "/nav_main.inc", "current", "log"); crumbSet("Log File"); ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title><?php echo encoderTitleText(); ?> </title> <?php require "{$phpdir}/template/head.inc"; ?> </head> <body> <?php require "{$phpdir}/template/body.inc"; require "{$phpdir}/log_file.inc"; $logfile = $_POST["logfile"]; showLog($logfile); require "{$phpdir}/template/foot.inc"; ?> </body> </html>