| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,79 @@ |
| 1 |
+<?php |
|
| 2 |
+// ---------------------------------------------------------------------- |
|
| 3 |
+// eFiction 3.0 |
|
| 4 |
+// Copyright (c) 2007 by Tammy Keefer |
|
| 5 |
+// Valid HTML 4.01 Transitional |
|
| 6 |
+// Based on eFiction 1.1 |
|
| 7 |
+// Copyright (C) 2003 by Rebecca Smallwood. |
|
| 8 |
+// http://efiction.sourceforge.net/ |
|
| 9 |
+// ---------------------------------------------------------------------- |
|
| 10 |
+// LICENSE |
|
| 11 |
+// |
|
| 12 |
+// This program is free software; you can redistribute it and/or |
|
| 13 |
+// modify it under the terms of the GNU General Public License (GPL) |
|
| 14 |
+// as published by the Free Software Foundation; either version 2 |
|
| 15 |
+// of the License, or (at your option) any later version. |
|
| 16 |
+// |
|
| 17 |
+// This program is distributed in the hope that it will be useful, |
|
| 18 |
+// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 19 |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 20 |
+// GNU General Public License for more details. |
|
| 21 |
+// |
|
| 22 |
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|
| 23 |
+// ---------------------------------------------------------------------- |
|
| 24 |
+ |
|
| 25 |
+if(!defined("_CHARSET")) exit( );
|
|
| 26 |
+$dir = opendir("modules");
|
|
| 27 |
+$admin = isset($_GET['admin']) && $_GET['admin'] == true ? true : false; |
|
| 28 |
+$module = isset($_GET['module']) ? $_GET['module'] : false; |
|
| 29 |
+if(!$module) {
|
|
| 30 |
+ $output .= "<table class=\"tblborder\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin: 0 auto;\"> |
|
| 31 |
+ <tr><th class=\"tblborder\">"._NAME."</th><th class=\"tblborder\">"._VERSION."</th><th class=\"tblborder\">"._OPTIONS."</th></tr>"; |
|
| 32 |
+ $modquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_modules ORDER BY name");
|
|
| 33 |
+ while($m = dbassoc($modquery)) {
|
|
| 34 |
+ $modules[$m['name']] = $m; |
|
| 35 |
+ } |
|
| 36 |
+} |
|
| 37 |
+while($folder = readdir($dir)) {
|
|
| 38 |
+ if($folder == "." || $folder == ".." || !is_dir("modules/$folder")) continue;
|
|
| 39 |
+ $moduleVersion = ""; $moduleName = ""; $moduleDescription = ""; $moduleAuthor = ""; $moduleOpts = array( ); |
|
| 40 |
+ $moduleAuthorEmail = ""; $moduleWebsite = ""; |
|
| 41 |
+ if($module && $module == $folder) {
|
|
| 42 |
+ if($admin) {
|
|
| 43 |
+ if(file_exists("modules/$folder/admin.php")) include("modules/$folder/admin.php");
|
|
| 44 |
+ else accessDenied( ); |
|
| 45 |
+ } |
|
| 46 |
+ else if(file_exists("modules/$folder/version.php")) {
|
|
| 47 |
+ include("modules/$folder/version.php");
|
|
| 48 |
+ $output .= "<div class='sectionheader'>$moduleName - $moduleVersion</div>"; |
|
| 49 |
+ if($moduleDescription) $output .= "<p><span class='label'>"._DESC.":</span> $moduleDescription</p>"; |
|
| 50 |
+ if($moduleAuthor || $moduleAuthorEmail) $output .= "<p><span class='label'>"._AUTHOR.":</span> ".($moduleAuthorEmail ? "<a href='mailto:$moduleAuthorEmail'>".($moduleAuthor ? $moduleAuthor : $moduleAuthorEmail)."</a>" : $moduleAuthor)."</p>"; |
|
| 51 |
+ if($moduleWebsite) $output .= "<p><span class='label'>"._WEBSITE.":</span> <a href='$moduleWebsite'>$moduleWebsite</a></p>"; |
|
| 52 |
+ if(file_exists("modules/$folder/changelog.txt")) {
|
|
| 53 |
+ $output .= "<p><span class='label'>"._CHANGELOG."</span>:<br /><br />"; |
|
| 54 |
+ $file = "modules/$folder/changelog.txt"; |
|
| 55 |
+ $log_file = @fopen($file, "r"); |
|
| 56 |
+ $file_contents = @fread($log_file, filesize($file)); |
|
| 57 |
+ $output .= format_story($file_contents); |
|
| 58 |
+ @fclose($log_file); |
|
| 59 |
+ } |
|
| 60 |
+ } |
|
| 61 |
+ else $output .= write_message(_NORESULTS); |
|
| 62 |
+ } |
|
| 63 |
+ else if(!$module) {
|
|
| 64 |
+ if(!file_exists("modules/".$folder."/version.php")) continue;
|
|
| 65 |
+ else include("modules/".$folder."/version.php");
|
|
| 66 |
+ if(empty($moduleName)) continue; |
|
| 67 |
+ $output .= "<tr><td class=\"tblborder\"><a href='admin.php?action=modules&module=$folder'>$moduleName</a></td><td class=\"tblborder\" style=\"text-align: center;\">".(isset($modules[$moduleName]['version']) ? $modules[$moduleName]['version'] : $moduleVersion)."</td><td class=\"tblborder\">"; |
|
| 68 |
+ if(file_exists("modules/$folder/install.php") && !isset($modules[$moduleName])) $moduleOpts[] = "<a href='modules/$folder/install.php'>"._INSTALLMODULE."</a>";
|
|
| 69 |
+ if(isset($modules[$moduleName]['version']) && $modules[$moduleName]['version'] < $moduleVersion && file_exists("modules/$folder/update.php")) $moduleOpts[] = "<a href='modules/$folder/update.php'>"._UPDATE."</a> ";
|
|
| 70 |
+ if(file_exists("modules/$folder/admin.php") && isset($modules[$moduleName])) $moduleOpts[] = "<a href='admin.php?action=modules&module=$folder&admin=true'>"._OPTIONS."</a>";
|
|
| 71 |
+ if(file_exists("modules/$folder/uninstall.php") && isset($modules[$moduleName])) $moduleOpts[] = "<a href='modules/$folder/uninstall.php'>"._UNINSTALLMODULE."</a>";
|
|
| 72 |
+ $output .= implode(" | ", $moduleOpts);
|
|
| 73 |
+ $output .= "</td></tr>"; |
|
| 74 |
+ } |
|
| 75 |
+} |
|
| 76 |
+ |
|
| 77 |
+closedir($dir); |
|
| 78 |
+if(!$module) $output .= "</table>"; |
|
| 79 |
+?> |
|
| 0 | 80 |
\ No newline at end of file |