This repository has been archived by the owner on Dec 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
213 lines (209 loc) · 8.09 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php
if (!empty($_SERVER['ORIG_PATH_INFO'])) //Are we forwarding from 'pretty' urls?
{
$path=$_SERVER['ORIG_PATH_INFO'];
}
else //we are going direct from the query string!
{
foreach ($_GET as $var=>$val) //Parse through the $_GET array and set variables for each named key
{
${$var}=$val;
}
}
if (@$action == "install")
{
define("USR","installer");
}
elseif (!file_exists(dirname(__FILE__)."/appcore/dataconnect/connect.ini"))
{
header("Location: ./app.php?action=install");
}
else
{
require_once dirname(__FILE__)."/appcore/common.inc.php";
}
?>
<!doctype html>
<html>
<head>
<title>Tower21 WebComiX: <?php echo($path) ?></title>
<!-- Load Bootstrap and dependencies -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//<?php echo $conf->base_uri ?>/appcore/scripts/summernote.min.js"></script>
<script src="//www.tower21studios.com/assets/js/bootstrap.js"></script>
<script src="//<?php echo $conf->base_uri ?>/appcore/scripts/editor.js"></script>
<!-- jQuery UI draggable and resizable required for editor -->
<script src="//<?php echo $conf->base_uri ?>/appcore/scripts/jquery-ui.min.js"></script>
<script language="javascript">
$(function(){
if ($("#Page .page").length > 0){
$("#AS-2").remove();
$("#Page").attr("class","text-justify col-sm-12");
}
<?php if (!empty($_GET['modal'])){ ?>
$("#messageModal .modal-title").html("<?php echo ucwords($_GET['modal']) ?>");
$("#messageModal .modal-body").html("<?php switch($_GET['modal']){
case 'private':
echo "<div class='alert alert-warning'>The author has marked this item as either private or as a draft. It, therefore, cannot be accessed through the index. If you are the author or an editor, please access this through the project manager.</div>";
break;
case 'login':
echo "<div class='alert alert-info'>Please provide login credentials</div><form action='./app.php?action=login' method='post'><div class='form-group'><label for='user'>Username</label><input type='text' class='form-control' name='name' id='user'></div><div class='form-group'><label for='pass'>Password</label><input type='password' class='form-control' name='password' id='pass'></div><button type='submit' class='btn btn-primary'>Login</button> <button data-dismiss='modal' class='btn btn-danger'>Cancel</button></form>";
} ?>");
$("#messageModal").modal('show');
$("#messageModal").on('hidden.bs.modal',function(){
history.back();
});
<?php } ?>
});
</script>
<link rel="stylesheet" href="//<?php echo $conf->base_uri ?>/appcore/styles/editor.css" type="text/css">
<!-- Styles from main domain -->
<link rel="stylesheet" href="//www.tower21studios.com/assets/css/bootstrap.css" type="text/css">
<link rel="stylesheet" href="//www.tower21studios.com/assets/css/v2.css" type="text/css">
</head>
<body>
<header>
<div id="messageModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Message</h3>
</div>
<div class="modal-body">
<p>We have a message for you!</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Okay</button>
</div>
</div>
</div>
</div>
<div id="AJAXModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type=button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Preparing something awesome...</h3>
</div>
<div class="modal-body">
<p>Becoming 20% more awesome...</p>
</div>
</div>
</div>
</div>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#defaultNavbar1"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
<a class="navbar-brand" href="//<?php echo $conf->base_uri ?>/">#Dare2Dream</a></div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="defaultNavbar1">
<ul class="nav navbar-nav">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php if($session->level < 5){ print "Welcome ". $session->name; }
else { print "Login"; } ?><span class="caret"></span></a>
<?php
require_once dirname(__FILE__)."/appmodules/ucp.mod.php";
echo ucp_module($session,$conf->base_uri,$conf->open_registration);
?>
</li>
<li><a href="//<?php echo $conf->base_uri ?>/random/" role="button" aria-expanded="false">Discover</a>
</li>
<li><form class="navbar-form navbar-left" role="search" action="//<?php echo $conf->base_uri ?>/search/" method="get">
<div class="input-group">
<input type="text" class="form-control" name="q" placeholder="Search"<?php
if (!empty($_GET['q']))
{
echo " value=\"{$_GET['q']}\"";
}?>>
<div class="input-group-btn">
<button type="submit" class="btn btn-primary" title="Search"><span class="glyphicon glyphicon-search"></span></button>
<button type="button" onclick="window.location='//<?php echo $conf->base_uri ?>/advanced-search/'" class="btn btn-primary" title="Advanced"><span class="glyphicon glyphicon-cog"></span></button>
</div>
</div>
</form></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Tower21 Studios Limited<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="http://www.towe21studios.com">Main Site</a></li>
<li><a href="http://blog.tower21studios.com">Our Blog</a></li>
<li><a href="https://twitter.com/Tower21Studios">Twitter</a></li>
<li><a href="https://www.facebook.com/Tower21Studios">Facebook</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<hr>
<div class="row">
<div class="text-center as col-sm-12" id="AS-1">
<?php
require_once dirname(__FILE__)."/appmodules/adspace.mod.php";
//echo inner_add('random','h');
?>
</div>
</div>
<hr>
<div class="row">
<div class="text-justify as col-lg-2 col-md-4 col-sm-5" id="AS-2">
<?php
require dirname(__FILE__)."/appmodules/adspace.mod.php";
//echo inner_add('random','v');
?>
</div>
<div class="text-justify col-lg-10 col-md-8 col-sm-7" id="Page">
<?php
$path_parts=(explode("/",trim($path,"/")));
switch($path_parts[0])
{
case "random":
case "search":
case "advanced-search":
require_once dirname(__FILE__)."/appmodules/search.mod.php";
echo start_search($path_parts[0],$_GET);
break;
case "view":
echo view_doc($path_parts[1],$path_parts[2]);
break;
default:
echo load_index($path,$session);
}
?>
</div>
</div>
</div>
</body>
</html>
<?php function load_index($path,MCSession $curusr)
{
if (empty($path) || $path == "/")
{
require_once dirname(__FILE__)."/appmodules/series.mod.php";
return list_projects($curusr,$_GET['q']);
}
else
{
require_once dirname(__FILE__)."/appmodules/children.mod.php";
return list_children($path,$curusr,$_GET['q']);
}
}
function view_doc($type,$id)
{
$table=new DataBaseTable($type."s",true,DATACONF);
$col=substr($type,0,1)."id";
$q=$table->getData($col.":`= ".$id);
$siteroot=SITEROOT;
$doc=$q->fetch(PDO::FETCH_ASSOC);
return <<<HTML
<h2>{$doc['title']}</h2>
<div class="left" style="width:1em"><a href="{$siteroot}save/{$type}/{$id}/html"><span class="glyphicon glyphicon-save" title="Download"></span></a> <a href="{$siteroot}print/{$type}/{$id}"><span class="glyphicon glyphicon-print" title="Print"></span></a></div>
<div id="DocViewer" class="page" style="width:95%">
{$doc['note']}
</div>
HTML;
}