-
Notifications
You must be signed in to change notification settings - Fork 34
/
index.php
124 lines (105 loc) · 4.55 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?PHP
$shell = array();
$base = '../';
$shell['title2'] = 'Examples';
$shell['link2'] = '../';
include 'config.php';
ob_start();
?>
<div id="donate">
<p>Your generous donation allows me to continue developing and updating my code!</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="5791421">
<input class="submit" type="image" src="../donate.gif" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<div class="clear"></div>
</div>
<?
$shell['donate'] = ob_get_contents();
ob_end_clean();
function draw_shell() {
global $shell, $base;
?><!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Ben Alman » <?= $shell['title1'] ?><? if ( $shell['title2'] ) { print ' » ' . $shell['title2']; } ?><? if ( $shell['title3'] ) { print ' » ' . $shell['title3']; } ?></title>
<script type="text/javascript" src="<?= $base ?>../shared/ba-debug.js"></script>
<?
if ( $shell['jquery'] ) {
?><script type="text/javascript" src="<?= $base ?>../shared/<?= $shell['jquery'] ?>"></script><?
}
?><script type="text/javascript" src="<?= $base ?>../shared/SyntaxHighlighter/scripts/shCore.js"></script><?
if ( $shell['shBrush'] ) {
foreach ( $shell['shBrush'] as $brush ) {
?><script type="text/javascript" src="<?= $base ?>../shared/SyntaxHighlighter/scripts/shBrush<?= $brush ?>.js"></script><?
}
}
?>
<link rel="stylesheet" type="text/css" href="<?= $base ?>../shared/SyntaxHighlighter/styles/shCore.css">
<link rel="stylesheet" type="text/css" href="<?= $base ?>../shared/SyntaxHighlighter/styles/shThemeDefault.css">
<link rel="stylesheet" type="text/css" href="<?= $base ?>index.css">
<?= $shell['html_head'] ?>
</head>
<body>
<div id="page">
<div id="header">
<h1>
<a href="http://benalman.com/" class="title"><b>Ben</b> Alman</a>
<?
$i = 1;
while ( $shell["title$i"] ) {
print ' » ';
if ( $shell["link$i"] ) {
print '<a href="' . $shell["link$i"] . '">' . $shell["title$i"] . '</a>';
} else {
print $shell["title$i"];
}
$i++;
}
?>
</h1>
<?
$i = 2;
while ( $shell["h$i"] ) {
print "<h$i>" . $shell["h$i"] . "</h$i>";
$i++;
}
?>
<?= $shell['html_header'] ?>
</div>
<div id="content">
<?= $shell['html_body'] ?>
</div>
<div id="footer">
<p>
If console output is mentioned, but your browser has no console, this example is using <a href="http://benalman.com/projects/javascript-debug-console-log/">JavaScript Debug</a>. Click this bookmarklet: <a href="javascript:if(!window.firebug){window.firebug=document.createElement("script");firebug.setAttribute("src","http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js");document.body.appendChild(firebug);(function(){if(window.firebug.version){firebug.init()}else{setTimeout(arguments.callee)}})();void (firebug);if(window.debug&&debug.setCallback){(function(){if(window.firebug&&window.firebug.version){debug.setCallback(function(b){var a=Array.prototype.slice.call(arguments,1);firebug.d.console.cmd[b].apply(window,a)},true)}else{setTimeout(arguments.callee,100)}})()}};">Debug + Firebug Lite</a> to add the Firebug lite console to the current page. Syntax highlighting is handled by <a href="http://alexgorbatchev.com/">SyntaxHighlighter</a>.
</p>
<p>
All original code is Copyright © 2010 "Cowboy" Ben Alman and dual licensed under the MIT and GPL licenses. View the <a href="http://benalman.com/about/license/">license page</a> for more details.
</p>
</div>
</div>
</body>
</html><?
}
if ( count( get_included_files() ) == 2 ) {
$shell['link2'] = '';
$shell['h2'] = 'Select an example:';
$shell['h3'] = '';
$shell['html_body'] = '';
$files = scandir( '.' );
foreach ( $files as $file ) {
if ( $file != '.' && $file != '..' && file_exists( "$file/index.php" ) ) {
$file_contents = file_get_contents( "$file/index.php" );
$title = preg_replace( '/^.*\$shell\[\'title3\'\]\s*=\s*"(.*?)";.*$/s', '$1', $file_contents );
$title = $title == $file_contents ? $file : stripcslashes( $title );
$shell['html_body'] .= "<a href=\"$file/\">$title</a><br>";
}
}
$base = '';
draw_shell();
}
?>