-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapi_install.php
More file actions
101 lines (91 loc) · 4.07 KB
/
Copy pathapi_install.php
File metadata and controls
101 lines (91 loc) · 4.07 KB
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
<?php
define('AT_INCLUDE_PATH', '../../include/');
require (AT_INCLUDE_PATH.'vitals.inc.php');
admin_authenticate(AT_ADMIN_PRIV_PHPDOC);
$_custom_css = $_base_path . 'mods/phpdoc2/module.css'; // use a custom stylesheet
if (!function_exists('version_compare'))
{
print "phpDocumentor requires PHP version 4.1.0 or greater to function";
exit;
}
// Find out if we are submitting and if we are, send it
// This code originally by Joshua Eichorn on phpdoc.php
//
if (isset($_GET['dataform']) && empty($_REQUEST['altuserdir'])) {
foreach ($_GET as $k=>$v) {
if (strpos( $k, 'setting_' ) === 0) {
$_GET['setting'][substr( $k, 8 )] = $v;
}
}
//ATutor presets
$_GET['setting']['output'] = 'HTML:frames:DOM/earthli'; //Theme
$_GET['setting']['directory'] = AT_INCLUDE_PATH; //Source codes location, use "include/"
$_GET['setting']['defaultpackagename'] = 'ATutor '.VERSION; //ATutor package
//Check if the directory is writable, if not, halt.
if (!(is_dir($_GET['setting']['target']) && is_writable($_GET['setting']['target']))) {
$msg->addError(array('API_NOT_WRITABLE', $_GET['setting']['target'], "directory", "apidoc"));
header("Location: api_install.php");
exit;
} elseif(!(is_file($_GET['setting']['target'].'/index.html') && is_writable($_GET['setting']['target'].'/index.html'))) {
//Check if the index.html file is writable
$msg->addError(array('API_NOT_WRITABLE', $_GET['setting']['target'].'/index.html', "file", "index.html"));
header("Location: api_install.php");
exit;
} else {
//Output api convertion steps
require (AT_INCLUDE_PATH.'header.inc.php');
echo "<strong>Parsing Files ...</strong><br/>";
flush();
echo "<div id='api_process_box'><pre>\n";
/** phpdoc.inc */
include("PhpDocumentor/phpDocumentor/phpdoc.inc");
echo "</pre></div>\n";
echo "<strong>Operation Completed!!</strong> <a href=\"mods/phpdoc2/".$_GET['setting']['target']."\" target=\"atutor_api\">View API Here</a>.";
require (AT_INCLUDE_PATH.'footer.inc.php');
exit;
}
}
// set up include path so we can find all files, no matter what
$GLOBALS['_phpDocumentor_install_dir'] = dirname(dirname(realpath(__FILE__)));
$root_dir = '';
/**
* common file information
*/
include_once("PhpDocumentor/phpDocumentor/common.inc.php");
// add my directory to the include path, and make it first, should fix any errors
if (substr(PHP_OS, 0, 3) == 'WIN')
{
ini_set('include_path',$GLOBALS['_phpDocumentor_install_dir'].';'.ini_get('include_path'));
} else {
ini_set('include_path',$GLOBALS['_phpDocumentor_install_dir'].':'.ini_get('include_path'));
}
// find the .ini directory by parsing phpDocumentor.ini and extracting _phpDocumentor_options[userdir]
$ini = phpDocumentor_parse_ini_file($_phpDocumentor_install_dir . PATH_DELIMITER . 'phpDocumentor.ini', true);
if (isset($ini['_phpDocumentor_options']['userdir']))
{
$configdir = $ini['_phpDocumentor_options']['userdir'];
} else {
$configdir = $_phpDocumentor_install_dir . '/user';
}
/* Template starts here */
require (AT_INCLUDE_PATH.'header.inc.php'); ?>
<div id="phpdoc2_installer">
<form name="dataForm" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
<table>
<tr><td class="title"><label for="setting_title">API Title: </label></td>
<td><input type="text" name="setting_title" id="setting_title" value="<?php echo 'ATutor '.VERSION; ?>" size="40" /></td></tr>
<tr><td class="title"><label for="setting_target">Save to... (relative path is allowed): </label></td>
<td><input type="text" name="setting_target" id="setting_target" value="apidoc" size="40" /></td></tr>
<tr><td class="title"><label for="setting_ignore">These files will be ignored: </label></td>
<td><input type="text" name="setting_ignore" id="setting_ignore" value="*.svn" size="40" /></td></tr>
<tr>
<td><input class="buttons" type="SUBMIT" value="Go" name="submitButton" /></td>
</tr>
</table>
<input type="hidden" name="dataform" value="true">
</form>
<div class="license">
<p>This feature is provided by <a href="http://www.phpdoc.org/" target="phpdoc">phpDocumentor 1.4.1</a>.</p>
</div>
</div>
<?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>