$p = 0; while (($p = strpos($data, '{', $p)) !== false) { $e = strpos($data, ':', ++$p); $tag = substr($data, $p, $e - $p); switch ($tag) { case 'SECTION': case 'PAGE': case 'MAIN_SECTION': $e = strpos($data, '}', $p); $e2 = strpos($data, '{' . $tag . ': END}', $e); if ($e === false || $e2 === false) { exit('broken template file "' . $file . '"'); } $d = explode(' ', substr($data, $p, $e - $p), 3); if (!isset($file_info_array[$file])) { $file_info_array[$file] = '<a class="file_name" href="tmpllist.php?tname=' . $tname . '&tlang=' . $tlang . '&' . _rsidl . '&max_list=' . minimize($file, $max_list) . '" title="minimize">[ - ]</a> <b>' . $file . '</b> <a name="' . $file . '"> </a><br>'; } if ($tag != 'SECTION') { $file_info_array[$file] .= ' <font size="-1">»</font> <a class="msec" href="tmpllist.php?tname=' . $tname . '&tlang=' . $tlang . '&' . _rsidl . '&edit=1&fl=' . $file . '&msec=' . urlencode($d[1]) . '&max_list=' . $max_list . '">' . $d[1] . '</a>'; } else { $file_info_array[$file] .= ' <font size="-1">»</font> <a class="sec" href="tmpllist.php?tname=' . $tname . '&tlang=' . $tlang . '&' . _rsidl . '&edit=1&fl=' . $file . '&sec=' . urlencode($d[1]) . '&max_list=' . $max_list . '">' . $d[1] . '</a>'; } if (isset($d[2]) && ($d[2] = trim($d[2]))) { if (!$edit) { $file_info_array[$file] .= '<font size="-1" color="#008800"> -> ' . htmlspecialchars($d[2]) . '</font>'; } $file_info_help[$d[1]] = $d[2]; } $file_info_array[$file] .= '<br>'; $p = $e2 + 6; break;
$input = json_decode($json, true); if ($input) { foreach ($input as $piece) { if ($piece['color'] == 'black') { $color = 1; } else { $color = 3; } array_push($mimi, array($piece['coordinate'][0], $piece['coordinate'][1], $color)); } $result = json_encode($mimi); } return $result; } $contents = array(); if ($handle = opendir('.')) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { $pathParts = pathinfo($entry); if ($pathParts['extension'] == 'log') { if ($mimi = minimize(file_get_contents($entry))) { array_push($contents, $mimi); } } } } closedir($handle); } file_put_contents('logs.js', 'var logs = ['); file_put_contents('logs.js', implode(',', $contents), FILE_APPEND); file_put_contents('logs.js', '];', FILE_APPEND);