forked from CommonAccord/Site-Org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathccmac_helpers2.php
97 lines (67 loc) · 1.88 KB
/
ccmac_helpers2.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
<?php
error_reporting(E_ALL);
$path = './Doc/';
if(!isset($_REQUEST['action'])) {
$_REQUEST['action'] = "landing";
}
if(isset($_REQUEST['file'])) {
$dir = $_REQUEST['file'];
$dir = str_replace('..', '', $dir);
$fff = fopen("newlogs", "a");
$rrr = print_r($_SERVER, TRUE);
fwrite($fff, "$rrr\n");
$www = print_r($_POST, TRUE);
fwrite($fff, "::: $www\n");
fwrite($fff, "$dir\n\n");
fclose($fff);
} else {
$dir = './';
}
if($_REQUEST['action'] == 'list') {
include('list.php');
} // end 'list'
// "Show the Document"
else if($_REQUEST['action'] == 'source') {
if(isset($_REQUEST['submit'])) {
$fp = fopen($path.$dir, "w");
$data = $_REQUEST['newcontent'];
$data = preg_replace('/\r\n/', "\n", $data);
$data = trim($data);
fwrite($fp, $data);
fclose($fp);
}
$content = file_get_contents($path.$dir, FILE_USE_INCLUDE_PATH);
$contents = explode("\n", $content);
$rootdir = pathinfo($dir);
$filenameX = basename($dir);
//source.php includes the formatting for the table that displays the components of a document
include("source.php");
} // end 'source'
else if($_REQUEST['action'] == 'render') {
if(isset($_REQUEST['submit'])) {
echo "RENDERING...........<br>";
} else { echo "not rending ... <br>"; }
if(isset($_REQUEST['file'])){
# include('file.php');
}
echo "LALALLALALAL<br>";
# echo `perl parser2.pl $path/$dir`;
#system("perl parser2.pl $path/$dir > $path/Output999.html");
#echo file_get_contents("Output999.html", FILE_USE_INCLUDE_PATH);
if(isset($_REQUEST['file'])){
echo "</div></div>";
}
} // end 'render'
else if($_REQUEST['action'] == 'edit') {
include('edit.php');
} // end 'edit'
else if($_REQUEST['action'] == 'pull') {
echo `cd /var/www/www.commonaccord.org/Alpha; git reset --hard HEAD; git pull -f 2>&1`;
}
/*
else if($_REQUEST['action'] == 'graph') {
echo `perl tree-parse.pl $dir 2&>1`;
}
*/
else { include($_REQUEST['action'].'.php'); }
?>