function generate_footer($request) { $output = array(); array_push($output, '</div>'); array_push($output, '</div>'); array_push($output, '<div class="main_nav">'); array_push($output, '<div style="padding:12px;">'); array_push($output, "Join us on IRC: <a href=\"http://webchat.esper.net/?nick=" . ($request['user_id'] == 0 ? 'Guest_' . generate_gibberish(7) : $request['login_id']) . "&channels=nerdparadise&prompt=1\">#nerdparadise on EsperNet</a>"); array_push($output, '</div>'); array_push($output, '<div style="padding:12px;">'); array_push($output, "View the Nerd Paradise source code on <a href=\"http://github.com/blakeohare/nerdparadise\">GitHub</a>"); array_push($output, '</div>'); array_push($output, '<div style="padding:12px;">'); array_push($output, 'Visit my other sites: <a href="http://blakeohare.com">blakeohare.com</a> | <a href="http://noisyprotozoa.com">Noisy Protozoa</a> | <a href="http://asdfjklsemicolon.com">asdfjkl;</a> | <a href="http://twocansandstring.com">Two Cans & String</a> | <a href="http://crayonlang.org">CrayonLang.org</a>'); array_push($output, '</div>'); array_push($output, '</div>'); array_push($output, '<div style="color:#666; font-size:11px; text-align:center;">'); array_push($output, '<div style="padding:18px;">'); array_push($output, 'Site mostly written at Zoka Coffee in Kirkland, WA.'); array_push($output, '</div>'); array_push($output, '<div style="padding:18px;">'); array_push($output, '© ' . date("Y") . ' Nerd Paradise'); array_push($output, '</div>'); array_push($output, '</div>'); if ($request['is_admin']) { array_push($output, '<div style="font-family: "Consola", monospace; font-size:10px; color:#444; padding:8px;">'); array_push($output, nl2br(str_replace(' ', ' ', htmlspecialchars(universal_to_string($request))))); array_push($output, '<br /><br />'); array_push($output, 'Queries:<table border="1">'); foreach (sql_get_logged_queries() as $query) { $sql = $query[0]; $time = $query[1]; $bg_color = '#000'; $fg_color = '#888'; if ($time > 0.01) { $bg_color = '#f00'; $fg_color = '#000'; } array_push($output, '<tr style="color:' . $fg_color . '; background-color:' . $bg_color . '"><td>' . htmlspecialchars($sql) . '</td><td>' . $time . '</td></tr>'); } array_push($output, '</table>'); array_push($output, '</div>'); } array_push($output, '</body>'); array_push($output, '</html>'); return implode("\n", $output); }
function dictionary_to_string($dict, $indent = 0) { $length = count($dict); if ($length == 0) { return '{}'; } $keys = array(); foreach ($dict as $key => $value) { array_push($keys, $key); } sort($keys); $tabs = ''; while (strlen($tabs) < $indent) { $tabs .= ' '; } $output = array('{'); for ($i = 0; $i < $length; ++$i) { array_push($output, $tabs . ' ' . $keys[$i] . ': ' . universal_to_string($dict[$keys[$i]], $indent + 1) . ($i < $length - 1 ? ',' : '')); } array_push($output, $tabs . '}'); return implode("\n", $output); }