aboutsummaryrefslogtreecommitdiff
path: root/modules.php
diff options
context:
space:
mode:
authorjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-20 13:38:08 -0500
committerjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-20 13:38:08 -0500
commitbe4f83cd2a17a0ec05f5bce50c91befaafaa6e0c (patch)
tree6f20672cf5df66044b3fa9dd71fc3bcdc484abe6 /modules.php
parent1a619f2638a4f77fb8ea9557edeefb883d8c06f8 (diff)
downloadbayonetcms-be4f83cd2a17a0ec05f5bce50c91befaafaa6e0c.tar.gz
Test.
git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@376 c5b2fb0a-d05d-0410-98c8-828840a80ff6
Diffstat (limited to 'modules.php')
-rw-r--r--modules.php94
1 files changed, 94 insertions, 0 deletions
diff --git a/modules.php b/modules.php
new file mode 100644
index 0000000..96bb241
--- /dev/null
+++ b/modules.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Bayonet Content Management System
+ * Copyright (C) 2008 Joseph Hunkeler
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+define("MODULE_FILE",true);
+
+global $load,$index_module;
+
+if(isset($_GET['load']))
+ $load = $_GET['load'];
+
+if(isset($_GET['file']))
+ $file = $_GET['file'];
+
+if(is_null($load))
+{
+ $load = $config['modules']['default'];
+}
+
+$deny_chars = $config['modules']['deny_chars'];
+
+$load_temp = $load;
+
+/*
+ * broken i guess.
+for($chars = 0; $chars <= strlen($load_temp); ++$chars)
+{
+ foreach($deny_chars as $deny)
+ {
+ if($load_temp[$chars] == $deny)
+ {
+ OpenTable();
+ ReportHack("Invalid characters detected.\n");
+ CloseTable();
+ }
+ }
+}
+*/
+if(isset($load) && !empty($load) && !isset($file))
+{
+ if(file_exists("modules/" . $load))
+ {
+ include 'modules/' . $load . '/index.php';
+ }
+ else
+ {
+ ReportError("Cannot load module directory.<br>\n");
+ }
+}
+elseif(isset($load) && isset($file))
+{
+ if(file_exists("modules/" . $load))
+ {
+ //$file_temp = explode('.',$file);
+ //$file = $file_temp[0];
+
+ $run = "modules/" . $load . "/" . $file;
+
+ if(file_exists($run))
+ {
+ include $run;
+ }
+ else
+ {
+ ReportError("Cannot load module directory.<br>\n");
+ }
+ }
+ else
+ {
+ ReportError("Cannot load module file.<br>\n");
+ }
+}
+else
+{
+ ReportError("Failure to load module.<br>\n");
+}
+
+
+?> \ No newline at end of file