aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortenox <as@tenoware.com>2017-01-13 01:10:48 -0800
committertenox <as@tenoware.com>2017-01-13 01:10:48 -0800
commitc1a3a46007249c6de1c461b38a03ded6297df6de (patch)
tree2f235ca952425f4fcbc07c2243556c8c04c03c26
parent036ed644dd334ce5113eac503d5e14c5bee2b8ca (diff)
downloadwfm-c1a3a46007249c6de1c461b38a03ded6297df6de.tar.gz
initial git support
-rw-r--r--dialogs.c15
-rw-r--r--fileio.c22
-rw-r--r--wfm.h3
3 files changed, 31 insertions, 9 deletions
diff --git a/dialogs.c b/dialogs.c
index 6ebad0d..7926a26 100644
--- a/dialogs.c
+++ b/dialogs.c
@@ -246,8 +246,11 @@ void about(void) {
"Server Side RFC 1321 implementation by L. Peter Deutsch<BR>\n"
"Client Side RFC 1321 implementation by Paul Johnston<BR>\n"
"Icons by Yusuke Kamiyamane<BR>\n"
+#ifdef WFMGIT
+ "Uses libgit2 library<BR>\n"
+#endif
"URL Encoding routines by Fred Bulback<BR>\n"
- "Copyright &copy; 1994-2016 by Antoni Sawicki<BR>\n"
+ "Copyright &copy; 1994-2017 by Antoni Sawicki<BR>\n"
"Copyright &copy; 1996-2011 by Thomas Boutell and Boutell.Com, Inc.<BR>\n"
"Copyright &copy; 2002 by Aladdin Enterprises<BR>\n"
"Copyright &copy; 1999-2009 by Paul Johnston<BR>\n"
@@ -258,6 +261,7 @@ void about(void) {
"Server: %s<BR>\n"
"User Agent: %s<BR>\n"
"JavaScript Level: %d<BR>\n"
+ "Git Support: %s (%s)<BR>\n"
"&nbsp;<P>\n"
"&nbsp;<P>\n"
"</TD>\n"
@@ -274,7 +278,14 @@ void about(void) {
"<TR><TD COLSPAN=3 BGCOLOR=\"#EEEEEE\">&nbsp;</TD></TR>\n"
"</TABLE>\n"
"</TD></TR></TABLE>\n</BODY></HTML>\n",
- ICONSURL, TAGLINE, VERSION, __DATE__, __TIME__, __VERSION__, cgiServerSoftware, cgiUserAgent, js, cgiScriptName, virt_dirname, token);
+ ICONSURL, TAGLINE, VERSION, __DATE__, __TIME__, __VERSION__, cgiServerSoftware, cgiUserAgent, js,
+#ifdef WFMGIT
+ "Yes"
+#else
+ "No"
+#endif
+ , (repo_check()) ? "Oo Repo Present" : "Repo OK",
+ cgiScriptName, virt_dirname, token);
}
diff --git a/fileio.c b/fileio.c
index b5718d3..78044b0 100644
--- a/fileio.c
+++ b/fileio.c
@@ -81,6 +81,8 @@ void receivefile(void) {
cgiFormFileClose(input);
fclose(output);
+
+ revup_commit("Receive File");
redirect("%s?highlight=%s&directory=%s&token=%s", cgiScriptName, virt_filename_urlencoded, virt_dirname_urlencoded, token);
@@ -101,9 +103,10 @@ void mkfile(void) {
error("Unable to create file.<BR>%s", strerror(errno));
fclose(output);
-
- redirect("%s?highlight=%s&directory=%s&token=%s", cgiScriptName, virt_filename_urlencoded, virt_dirname_urlencoded
- , token);
+
+ revup_commit("New File");
+
+ redirect("%s?highlight=%s&directory=%s&token=%s", cgiScriptName, virt_filename_urlencoded, virt_dirname_urlencoded, token);
}
@@ -117,7 +120,7 @@ void newdir(void) {
if(mkdir(phys_filename, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH )!=0)
error("Unable to create directory.<BR>%s", strerror(errno));
-
+
redirect("%s?highlight=%s&directory=%s&token=%s", cgiScriptName, virt_filename_urlencoded, virt_dirname_urlencoded, token);
}
@@ -202,6 +205,8 @@ void edit_save(void) {
free(buff);
+ revup_commit("Editor Save");
+
redirect("%s?highlight=%s&directory=%s&token=%s", cgiScriptName, virt_filename_urlencoded, virt_dirname_urlencoded, token);
}
@@ -234,7 +239,8 @@ void fileio_re_rmdir(char *dirname) {
error("Unable to remove directory...<BR>%s", strerror(errno));
} else {
if(unlink(tempfullpath)!=0)
- error("Unable to remove directory....<BR>%s", strerror(errno));
+ error("Unable to remove file....<BR>%s", strerror(errno));
+ delete_commit("Recursive Delete");
}
}
@@ -261,6 +267,7 @@ void fileio_delete(void) {
else {
if(unlink(phys_filename)!=0)
error("Unable to remove file.<BR>%s", strerror(errno));
+ delete_commit("Delete File");
}
}
@@ -277,7 +284,7 @@ void delete(void) {
// Single
if(cgiFormStringMultiple("multiselect_filename", &responses) == cgiFormNotFound) {
checkfilename(NULL);
- fileio_delete();
+ fileio_delete();
}
// Multi
else {
@@ -339,7 +346,8 @@ void move(void) {
//
// Recursive Dir Size
//
-// WARNING: will not count directories starting with .
+// NOTE: will not count directories starting with . (dot)
+// so size of git repo will not show here...
off_t du(char *pdir) {
DIR *dir;
struct dirent *direntry;
diff --git a/wfm.h b/wfm.h
index 55fefaf..aa43724 100644
--- a/wfm.h
+++ b/wfm.h
@@ -149,3 +149,6 @@ void html_title(char *);
void singleprompt_ui(char *);
char *url_encode(char *);
char *url_decode(char *);
+int revup_commit(char *);
+int delete_commit(char *);
+int repo_check(void); \ No newline at end of file