$error['writable_video'] = 1; } else { $table[] = '<span class="correct">' . IP_OK . '</span>'; } $table[] = '<b>/ip_config.php</b> ' . IP_WRITABLE; if (!is_writable(dirname(__FILE__) . '/../ip_config.php')) { $table[] = '<span class="error">' . IP_ERROR . "</span>"; $error['writable_config'] = 1; } else { $table[] = '<span class="correct">' . IP_OK . '</span>'; } $table[] = '<b>/robots.txt</b> ' . IP_WRITABLE; if (!is_writable(dirname(__FILE__) . '/../robots.txt')) { $table[] = '<span class="error">' . IP_ERROR . "</span>"; $error['writable_robots'] = 1; } else { $table[] = '<span class="correct">' . IP_OK . '</span>'; } $answer .= gen_table($table); $answer .= '<br><br>'; if (sizeof($error) > 0) { $_SESSION['step'] = 1; $answer .= '<a class="button_act" href="?step=1">' . IP_CHECK_AGAIN . '</a>'; } else { complete_step(1); $answer .= '<a class="button_act" href="?step=2">' . IP_NEXT . '</a><a class="button" href="?step=1">' . IP_CHECK_AGAIN . '</a>'; } $answer .= "<br>"; output($answer); ?>
$tab = array(); while ($l = fgets(STDIN)) { $tab[] = trim($l); } if (count($tab) != 106 * 3) { die("Code tables must contain 106 codes x 3\n"); } function gen_table($a) { $res = array(); foreach ($a as $n => $symbol) { if ($symbol == '"') { $symbol = "\\\""; } if ($symbol == "\\") { $symbol = "\\\\"; } if ($symbol[0] == "-" && strlen($symbol) > 1) { $symbol = " " . $symbol . " "; } $res[] = " \"{$symbol}\" /* {$n} */"; } $res = "{" . implode(",\n", $res) . "\n}"; return $res; } echo '#include <string.h>' . "\n"; echo '#include "read128.h"' . "\n"; echo "char * code_tableA[] = " . gen_table(array_slice($tab, 106 * 0, 106)) . ";\n"; echo "char * code_tableB[] = " . gen_table(array_slice($tab, 106 * 1, 106)) . ";\n"; echo "char * code_tableC[] = " . gen_table(array_slice($tab, 106 * 2, 106)) . ";\n"; echo "char ** code_tables[] = {code_tableA, code_tableB, code_tableC};\n";