]> jfr.im git - irc/unrealircd/unrealircd.git/commitdiff
.
authorstskeeps <redacted>
Tue, 7 Aug 2001 21:37:25 +0000 (21:37 +0000)
committerstskeeps <redacted>
Tue, 7 Aug 2001 21:37:25 +0000 (21:37 +0000)
19 files changed:
html/back/background.jpg [new file with mode: 0644]
html/html/index.phtml [new file with mode: 0644]
html/html/main.html [new file with mode: 0644]
html/icons/conffiles.jpg [new file with mode: 0644]
html/icons/modules.jpg [new file with mode: 0644]
html/icons/opers.jpg [new file with mode: 0644]
html/icons/settings.jpg [new file with mode: 0644]
html/icons/stats.jpg [new file with mode: 0644]
html/icons/users.jpg [new file with mode: 0644]
html/index.html [new file with mode: 0644]
html/sections/active.gif [new file with mode: 0644]
html/sections/inactive.gif [new file with mode: 0644]
html/unrealircd.com/active.gif [new file with mode: 0644]
html/unrealircd.com/inactive.gif [new file with mode: 0644]
include/modules/web/httpd.h [new file with mode: 0644]
src/modules/web/httpd.c [new file with mode: 0644]
src/modules/web/phtml.c [new file with mode: 0644]
src/modules/web/u_stats.c [new file with mode: 0644]
src/modules/web/vfs.c [new file with mode: 0644]

diff --git a/html/back/background.jpg b/html/back/background.jpg
new file mode 100644 (file)
index 0000000..c763fe7
Binary files /dev/null and b/html/back/background.jpg differ
diff --git a/html/html/index.phtml b/html/html/index.phtml
new file mode 100644 (file)
index 0000000..589c37e
--- /dev/null
@@ -0,0 +1,107 @@
+<html>
+
+       <head>
+               <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+               <title>
+$ TITLE
+</title>
+               <style type="text/css" media="screen"> 
+<!-- 
+BODY, TABLE { 
+    scrollbar-base-color : Black; 
+    scrollbar-3d-light-color : #D3D3D3; 
+    scrollbar-dark-shadow-color : #D3D3D3; 
+    scrollbar-shadow-color : #D3D3D3; 
+    scrollbar-highlight-color : #D3D3D3; 
+    scrollbar-arrow-color : Black; 
+    scrollbar-face-color : #D3D3D3; 
+    background-color : #FFFFFF; 
+    font-size : 8pt; 
+    font-family : "Trebuchet MS", Arial, Tahoma; 
+}
+BODY, TABLE, DIV { 
+    scrollbar-base-color : Black; 
+    scrollbar-3d-light-color : #D3D3D3; 
+    scrollbar-dark-shadow-color : #D3D3D3; 
+    scrollbar-shadow-color : #D3D3D3; 
+    scrollbar-highlight-color : #D3D3D3; 
+    scrollbar-arrow-color : Black; 
+    scrollbar-face-color : #D3D3D3; 
+    font-size : 8pt; 
+    font-family : "Trebuchet MS", Arial, Tahoma; 
+}
+SELECT, .textbox { 
+    font-family : "Trebuchet MS", Arial, Tahoma; 
+    font-size : 8pt; 
+    scrollbar-base-color : Black; 
+    scrollbar-3d-light-color : #D3D3D3; 
+    scrollbar-dark-shadow-color : #D3D3D3; 
+    scrollbar-shadow-color : #D3D3D3; 
+    scrollbar-highlight-color : #D3D3D3; 
+    scrollbar-arrow-color : Black; 
+    scrollbar-face-color : #D3D3D3; 
+    border : 1px solid #D3D3D3; 
+    background-color : #F4f4F4; 
+} 
+.button { 
+    font-family : Tahoma; 
+    border : 1px solid #C8C8C8; 
+    font-size : 11px; 
+    cursor : hand; 
+    background-color : #E5E5E5; 
+    }
+#background { position: absolute; z-index: 0; top: 0px; left: 0px; width: 800px; height: 600px; visibility: visible }
+#buttons         { position: absolute; top: 420px; left: 6px; width: 470px; height: 21px; visibility: visible }
+#content           { position: absolute; top: 77px; left: 133px; width: 399px; height: 283px; visibility: visible }
+#unrealIRCdLink      { font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; top: 364px; left: 559px; width: 89px; height: 16px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3  }
+#background { position: absolute; z-index: -10; top: 0px; left: 0px; width: 800px; height: 600px; visibility: visible }
+#icon { z-index: 1; font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; top: 13px; left: 22px; width: 72px; height: 73px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3 }
+
+#button1img {z-index: 1; font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; top: 150px; left: 11px; width: 111px; height: 23px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3 }
+#button1text   { font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; z-index: 2; top: 150px; left: 11px; width: 111px; height: 23px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3; padding: 1px; }
+#button2img {z-index: 1; font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; top: 180px; left: 11px; width: 111px; height: 23px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3 }
+#button2text   { font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; z-index: 2; top: 180px; left: 11px; width: 111px; height: 23px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3; padding: 1px; }
+</style>
+       </head>
+
+       <body bgcolor="#ffffff" text="black" link="black" vlink="black" alink="black">
+                       <div id="button1img" OnClick="location.href='/section/opers'" onMouseOver="document.body.style.cursor = 'hand'; document.button1.src='/sections/active.gif';" onMouseOut="document.body.style.cursor = 'auto'; document.button1.src='/sections/inactive.gif';"> <img src="/sections/inactive.gif" name="button1" border="0"></div>
+                       <div id="button1text" align="center" OnClick="location.href='/section/opers'" onMouseOver="document.body.style.cursor = 'hand'; document.button1.src='../sections/active.gif';" onMouseOut="document.body.style.cursor = 'auto'; document.button1.src='../sections/inactive.gif';">Operators</div>
+
+                       <div id="button2img" OnClick="location.href='/section/stats'" onMouseOver="document.body.style.cursor = 'hand'; document.button2.src='/sections/active.gif';" onMouseOut="document.body.style.cursor = 'auto'; document.button2.src='/sections/inactive.gif';"> <img src="/sections/inactive.gif" name="button2" border="0"></div>
+                       <div id="button2text" align="center" OnClick="location.href='/section/stats'" onMouseOver="document.body.style.cursor = 'hand'; document.button2.src='/sections/active.gif';" onMouseOut="document.body.style.cursor = 'auto'; document.button2.src='/sections/inactive.gif';">Stats</div>
+               <div id="icon">
+                               <img
+$ ICON
+width="72" height="73" border="0"></div>
+               <div id="background">
+                       <img src="/back/background.jpg" width="650" height="450" border="0">
+                       <div id="unrealIRCdLink">
+                               <a target="_blank"href="http://www.unrealircd.com/" onMouseOver="document.unreallink.src='/unrealircd.com/active.gif';" onMouseOut="document.unreallink.src='/unrealircd.com/inactive.gif';"> <img src="/unrealircd.com/inactive.gif" name="unreallink" border="0"> </a> </div>
+               </div>
+               <div id="buttons">
+                       <div align="left">
+                               <input type="submit" class="textbox" name="submitButtonName" value="save and close"> <input class="textbox" type="submit" name="submitButtonName" value="discard and close"> <input class="textbox" type="submit" name="submitButtonName" value="reset to original values"></div>
+               </div>
+               <div id="content">
+                       <div align="left">
+                               <i><font size="+2">
+$ SECTION
+</font></i>
+                               <p></p>
+                       </div>
+                       <div align="center">
+                               <table border="1" cellpadding="20" cellspacing="0" width="309" height="161" borderColorDark="black" borderColorLight="black">
+                                       <tr>
+                                               <td borderColorDark="#ffffff" borderColorLight="#ffffff">
+$ DATA
+                                               </td>
+                                       </tr>
+                               </table>
+                       </div>
+                       <p></p>
+               </div>
+               <p></p>
+       </body>
+
+</html>
\ No newline at end of file
diff --git a/html/html/main.html b/html/html/main.html
new file mode 100644 (file)
index 0000000..84c85e8
--- /dev/null
@@ -0,0 +1,107 @@
+<html>
+
+       <head>
+               <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+               <title>UnrealIRCdConfig</title>
+               <style type="text/css" media="screen"> 
+<!-- 
+BODY, TABLE { 
+    scrollbar-base-color : Black; 
+    scrollbar-3d-light-color : #D3D3D3; 
+    scrollbar-dark-shadow-color : #D3D3D3; 
+    scrollbar-shadow-color : #D3D3D3; 
+    scrollbar-highlight-color : #D3D3D3; 
+    scrollbar-arrow-color : Black; 
+    scrollbar-face-color : #D3D3D3; 
+    background-color : #FFFFFF; 
+    font-size : 8pt; 
+    font-family : "Trebuchet MS", Arial, Tahoma; 
+}
+BODY, TABLE, DIV { 
+    scrollbar-base-color : Black; 
+    scrollbar-3d-light-color : #D3D3D3; 
+    scrollbar-dark-shadow-color : #D3D3D3; 
+    scrollbar-shadow-color : #D3D3D3; 
+    scrollbar-highlight-color : #D3D3D3; 
+    scrollbar-arrow-color : Black; 
+    scrollbar-face-color : #D3D3D3; 
+    font-size : 8pt; 
+    font-family : "Trebuchet MS", Arial, Tahoma; 
+}
+SELECT, .textbox { 
+    font-family : "Trebuchet MS", Arial, Tahoma; 
+    font-size : 8pt; 
+    scrollbar-base-color : Black; 
+    scrollbar-3d-light-color : #D3D3D3; 
+    scrollbar-dark-shadow-color : #D3D3D3; 
+    scrollbar-shadow-color : #D3D3D3; 
+    scrollbar-highlight-color : #D3D3D3; 
+    scrollbar-arrow-color : Black; 
+    scrollbar-face-color : #D3D3D3; 
+    border : 1px solid #D3D3D3; 
+    background-color : #F4f4F4; 
+} 
+.button { 
+    font-family : Tahoma; 
+    border : 1px solid #C8C8C8; 
+    font-size : 11px; 
+    cursor : hand; 
+    background-color : #E5E5E5; 
+    }
+#background { position: absolute; z-index: 0; top: 0px; left: 0px; width: 800px; height: 600px; visibility: visible }
+#buttons         { position: absolute; top: 420px; left: 6px; width: 470px; height: 21px; visibility: visible }
+#content           { position: absolute; top: 77px; left: 133px; width: 399px; height: 283px; visibility: visible }
+#unrealIRCdLink      { font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; top: 364px; left: 559px; width: 89px; height: 16px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3  }
+#background { position: absolute; z-index: -10; top: 0px; left: 0px; width: 800px; height: 600px; visibility: visible }
+#icon { z-index: 1; font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; top: 13px; left: 22px; width: 72px; height: 73px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3 }
+
+#button1img {z-index: 1; font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; top: 150px; left: 11px; width: 111px; height: 23px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3 }
+#button1text   { font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; z-index: 2; top: 150px; left: 11px; width: 111px; height: 23px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3; padding: 1px; }
+#button2img {z-index: 1; font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; top: 180px; left: 11px; width: 111px; height: 23px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3 }
+#button2text   { font-size: 8pt; font-family: "Trebuchet MS", Arial, Tahoma; position: absolute; z-index: 2; top: 180px; left: 11px; width: 111px; height: 23px; visibility: visible; scrollbar-3d-light-color: #D3D3D3; scrollbar-arrow-color: Black; scrollbar-base-color: Black; scrollbar-dark-shadow-color: #D3D3D3; scrollbar-face-color: #D3D3D3; scrollbar-highlight-color: #D3D3D3; scrollbar-shadow-color: #D3D3D3; padding: 1px; }
+</style>
+       </head>
+
+       <body bgcolor="#ffffff" text="black" link="black" vlink="black" alink="black">
+                       <div id="button1img" OnClick="location.href='http://www.whatever.org'" onMouseOver="document.body.style.cursor = 'hand'; document.button1.src='../sections/active.gif';" onMouseOut="document.body.style.cursor = 'auto'; document.button1.src='../sections/inactive.gif';"> <img src="../sections/inactive.gif" name="button1" border="0"></div>
+                       <div id="button1text" align="center" OnClick="location.href='http://www.whatever.org'" onMouseOver="document.body.style.cursor = 'hand'; document.button1.src='../sections/active.gif';" onMouseOut="document.body.style.cursor = 'auto'; document.button1.src='../sections/inactive.gif';">Operators</div>
+
+                       <div id="button2img" OnClick="location.href='http://www.whatever.org'" onMouseOver="document.body.style.cursor = 'hand'; document.button2.src='../sections/active.gif';" onMouseOut="document.body.style.cursor = 'auto'; document.button2.src='../sections/inactive.gif';"> <img src="../sections/inactive.gif" name="button2" border="0"></div>
+                       <div id="button2text" align="center" OnClick="location.href='http://www.whatever.org'" onMouseOver="document.body.style.cursor = 'hand'; document.button2.src='../sections/active.gif';" onMouseOut="document.body.style.cursor = 'auto'; document.button2.src='../sections/inactive.gif';">Stats</div>
+               <div id="icon">
+                               <img src="../icons/opers.jpg" width="72" height="73" border="0"></div>
+               <div id="background">
+                       <img src="../back/background.jpg" width="650" height="450" border="0">
+                       <div id="unrealIRCdLink">
+                               <a target="_blank"href="http://www.unrealircd.com/" onMouseOver="document.unreallink.src='../unrealircd.com/active.gif';" onMouseOut="document.unreallink.src='../unrealircd.com/inactive.gif';"> <img src="../unrealircd.com/inactive.gif" name="unreallink" border="0"> </a> </div>
+               </div>
+               <div id="buttons">
+                       <div align="left">
+                               <input type="submit" class="textbox" name="submitButtonName" value="save and close"> <input class="textbox" type="submit" name="submitButtonName" value="discard and close"> <input class="textbox" type="submit" name="submitButtonName" value="reset to original values"></div>
+               </div>
+               <div id="content">
+                       <div align="left">
+                               <i><font size="+2">Section Title </font></i>
+                               <p></p>
+                       </div>
+                       <div align="center">
+                               <table border="1" cellpadding="20" cellspacing="0" width="309" height="161" borderColorDark="black" borderColorLight="black">
+                                       <tr>
+                                               <td borderColorDark="#ffffff" borderColorLight="#ffffff">
+                                                       <p><input type="radio" value="radioValue" name="default">Radio one <input type="radio" value="radioValue" name="default">Radio two</p>
+                                                       <p><select name="selectName" size="4" multiple>
+                                                                       <option value="one">First</option>
+                                                                       <option value="two">Second</option>
+                                                                       <option value="three">Third</option>
+                                                               </select></p>
+                                                       <p><input class="textbox" type="text" name="textfieldName" size="24" value="Textbox to enter text values"></p>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </div>
+                       <p></p>
+               </div>
+               <p></p>
+       </body>
+
+</html>
\ No newline at end of file
diff --git a/html/icons/conffiles.jpg b/html/icons/conffiles.jpg
new file mode 100644 (file)
index 0000000..f0ba962
Binary files /dev/null and b/html/icons/conffiles.jpg differ
diff --git a/html/icons/modules.jpg b/html/icons/modules.jpg
new file mode 100644 (file)
index 0000000..b908e3b
Binary files /dev/null and b/html/icons/modules.jpg differ
diff --git a/html/icons/opers.jpg b/html/icons/opers.jpg
new file mode 100644 (file)
index 0000000..4a84cc1
Binary files /dev/null and b/html/icons/opers.jpg differ
diff --git a/html/icons/settings.jpg b/html/icons/settings.jpg
new file mode 100644 (file)
index 0000000..f04d9c1
Binary files /dev/null and b/html/icons/settings.jpg differ
diff --git a/html/icons/stats.jpg b/html/icons/stats.jpg
new file mode 100644 (file)
index 0000000..bd7f4e6
Binary files /dev/null and b/html/icons/stats.jpg differ
diff --git a/html/icons/users.jpg b/html/icons/users.jpg
new file mode 100644 (file)
index 0000000..0019333
Binary files /dev/null and b/html/icons/users.jpg differ
diff --git a/html/index.html b/html/index.html
new file mode 100644 (file)
index 0000000..af2d6b2
--- /dev/null
@@ -0,0 +1,56 @@
+<html>\r\r       <head>\r         <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">\r                <title>loader</title>\r          <csactions>
+                       <csaction name="3093F4DA0" class="Open Window" type="onevent" val0="/section/opers" val1="" val2="650" val3="450" val4="false" val5="false" val6="false" val7="false" val8="false" val9="false" val10="false">
+               </csactions>\r           <csscriptdict>\r                 <script><!--\rfunction CSClickReturn () {
+       var bAgent = window.navigator.userAgent; 
+       var bAppName = window.navigator.appName;
+       if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
+               return true; // dont follow link
+       else return false; // dont follow link
+}\r\rCSStopExecution = false;
+function CSAction(array) { 
+       return CSAction2(CSAct, array);
+}
+function CSAction2(fct, array) { 
+       var result;
+       for (var i=0;i<array.length;i++) {
+               if(CSStopExecution) return false; 
+               var actArray = fct[array[i]];
+               if(actArray == null) return false; 
+               var tempArray = new Array;
+               for(var j=1;j<actArray.length;j++) {
+                       if((actArray[j] != null) && (typeof(actArray[j]) == "object") && (actArray[j].length == 2)) {
+                               if(actArray[j][0] == "VAR") {
+                                       tempArray[j] = CSStateArray[actArray[j][1]];
+                               }
+                               else {
+                                       if(actArray[j][0] == "ACT") {
+                                               tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
+                                       }
+                               else
+                                       tempArray[j] = actArray[j];
+                               }
+                       }
+                       else
+                               tempArray[j] = actArray[j];
+               }                       
+               result = actArray[0](tempArray);
+       }
+       return result;
+}
+CSAct = new Object;\r
+function CSOpenWindow(action) {
+       var wf = "";    
+       wf = wf + "width=" + action[3];
+       wf = wf + ",height=" + action[4];
+       wf = wf + ",resizable=" + (action[5] ? "yes" : "no");
+       wf = wf + ",scrollbars=" + (action[6] ? "yes" : "no");
+       wf = wf + ",menubar=" + (action[7] ? "yes" : "no");
+       wf = wf + ",toolbar=" + (action[8] ? "yes" : "no");
+       wf = wf + ",directories=" + (action[9] ? "yes" : "no");
+       wf = wf + ",location=" + (action[10] ? "yes" : "no");
+       wf = wf + ",status=" + (action[11] ? "yes" : "no");             
+       window.open(action[1],action[2],wf);
+}\r\r// --></script>\r            </csscriptdict>\r                <csactiondict>\r                 <script><!--\rCSAct[/*CMP*/ '3093F4DA0'] = new Array(CSOpenWindow,/*URL*/ '/section/opers','',650,450,false,false,false,false,false,false,false);
+\r// --></script>\r              </csactiondict>\r        </head>\r\r       <body bgcolor="#ffffff">\r               <p><br><br><br><br>
+               <center><input type="submit" value="open the shite" name="submitButtonName" onclick="CSAction(new Array(/*CMP*/'3093F4DA0'));" csclick="3093F4DA0"></center>
+       </body>\r\r</html>
\ No newline at end of file
diff --git a/html/sections/active.gif b/html/sections/active.gif
new file mode 100644 (file)
index 0000000..a8bbfc7
Binary files /dev/null and b/html/sections/active.gif differ
diff --git a/html/sections/inactive.gif b/html/sections/inactive.gif
new file mode 100644 (file)
index 0000000..2de3556
Binary files /dev/null and b/html/sections/inactive.gif differ
diff --git a/html/unrealircd.com/active.gif b/html/unrealircd.com/active.gif
new file mode 100644 (file)
index 0000000..0f16e79
Binary files /dev/null and b/html/unrealircd.com/active.gif differ
diff --git a/html/unrealircd.com/inactive.gif b/html/unrealircd.com/inactive.gif
new file mode 100644 (file)
index 0000000..8049b87
Binary files /dev/null and b/html/unrealircd.com/inactive.gif differ
diff --git a/include/modules/web/httpd.h b/include/modules/web/httpd.h
new file mode 100644 (file)
index 0000000..3a9d6c2
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+   UnrealIRCd internal webserver - httpd.h
+   Copyright (c) 2001, The UnrealIRCd Team
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without modification, are permitted
+   provided that the following conditions are met:
+   
+     * Redistributions of source code must retain the above copyright notice, this list of conditions
+       and the following disclaimer.
+     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+       and the following disclaimer in the documentation and/or other materials provided with the
+       distribution.
+     * Neither the name of the The UnrealIRCd Team nor the names of its contributors may be used
+       to endorse or promote products derived from this software without specific prior written permission.
+     * The source code may not be redistributed for a fee or in closed source
+       programs, without expressed oral consent by the UnrealIRCd Team, however
+       for operating systems where binary distribution is required, if URL
+       is passed with the package to get the full source
+     * No warranty is given unless stated so by the The UnrealIRCd Team
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+   FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR  
+   BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+typedef struct _httpd_header HTTPd_Header;
+
+struct _httpd_header
+{
+       char     *name;
+       char     *value;
+       HTTPd_Header *next;
+};
+
+typedef struct _httpd_request HTTPd_Request;
+
+struct _httpd_request
+{
+       SOCKET          fd;
+       char            inbuf[1024];
+       short           pos;
+       /* 0 = gimme head request 1 = getting head */
+       unsigned        state : 2;
+       /* 1 = GET    0 = POST */
+       unsigned        method : 1;
+       
+       char            *url;
+       HTTPd_Header    *headers;
+       long            content_length;
+       HTTPd_Header    *dataheaders;
+};
+
+char   *GetField(HTTPd_Header *header, char *name);
+char   *GetHeader(HTTPd_Request *request, char *name);
+void   httpd_standard_header(HTTPd_Request *request, char *type);
+void   httpd_badrequest(HTTPd_Request *request, char *reason);
+void   sockprintf(HTTPd_Request *r, char *format, ...);
+void   httpd_sendfile(HTTPd_Request *r, char *filename);
\ No newline at end of file
diff --git a/src/modules/web/httpd.c b/src/modules/web/httpd.c
new file mode 100644 (file)
index 0000000..47ef762
--- /dev/null
@@ -0,0 +1,621 @@
+/*
+   UnrealIRCd internal webserver
+   Copyright (c) 2001, The UnrealIRCd Team
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without modification, are permitted
+   provided that the following conditions are met:
+   
+     * Redistributions of source code must retain the above copyright notice, this list of conditions
+       and the following disclaimer.
+     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+       and the following disclaimer in the documentation and/or other materials provided with the
+       distribution.
+     * Neither the name of the The UnrealIRCd Team nor the names of its contributors may be used
+       to endorse or promote products derived from this software without specific prior written permission.
+     * The source code may not be redistributed for a fee or in closed source
+       programs, without expressed oral consent by the UnrealIRCd Team, however
+       for operating systems where binary distribution is required, if URL
+       is passed with the package to get the full source
+     * No warranty is given unless stated so by the The UnrealIRCd Team
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+   FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR  
+   BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include "config.h"
+#include "struct.h"
+#include "common.h"
+#include "sys.h"
+#include "numeric.h"
+#include "msg.h"
+#include "channel.h"
+#include <time.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef _WIN32
+#include <io.h>
+#else
+#include <sys/socket.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/resource.h>
+#endif
+#include <fcntl.h>
+#include "h.h"
+#ifdef STRIPBADWORDS
+#include "badwords.h"
+#endif
+#ifdef _WIN32
+#include "version.h"
+#endif
+#include "threads.h"
+#include "modules/web/httpd.h"
+
+SOCKET httpdfd = -1;
+
+void    httpd_socketthread(void *req);
+void   httpd_acceptthread(void *p);
+
+int    h_u_stats(HTTPd_Request *r);
+int    h_u_vfs(HTTPd_Request *r);
+int    h_u_phtml(HTTPd_Request *r);
+
+
+#ifndef DYNAMIC_LINKING
+ModuleInfo httpd_info
+#else
+#define httpd_info mod_header
+ModuleInfo mod_header
+#endif
+  = {
+       2,
+       "httpd",        /* Name of module */
+       "$Id$", /* Version */
+       "httpd", /* Short description of module */
+       NULL, /* Pointer to our dlopen() return value */
+       NULL 
+    };
+
+
+
+void   httpd_sendfile(HTTPd_Request *r, char *filename)
+{
+       int     xfd = open(filename, O_RDONLY);
+       if (xfd)
+       {
+               while (read(xfd, &r->inbuf[0], 1))
+               {
+                       FDwrite(r->fd,&r->inbuf[0], 1);
+               }
+       }
+       close(xfd);
+}
+
+/*
+ * Helper function
+*/
+
+void   sockprintf(HTTPd_Request *r, char *format, ...)
+{
+       va_list         ap;
+       char            *ptr;
+
+       va_start(ap, format);
+       vsprintf(r->inbuf, format, ap);
+       strcat(r->inbuf, "\r\n");
+       va_end(ap);
+       FDwrite(r->fd, r->inbuf, strlen(r->inbuf));
+}
+/* The purpose of these ifdefs, are that we can "static" link the ircd if we
+ * want to
+*/
+
+/* This is called on module init, before Server Ready */
+#ifdef DYNAMIC_LINKING
+DLLFUNC int    mod_init(int module_load)
+#else
+int    httpd_init(int module_load)
+#endif
+{
+       add_HookX(HOOKTYPE_HTTPD_URL, h_u_stats, NULL);
+       add_HookX(HOOKTYPE_HTTPD_URL, h_u_vfs, NULL);
+       add_HookX(HOOKTYPE_HTTPD_URL, h_u_phtml, NULL);
+               
+}
+
+/* Is first run when server is 100% ready */
+#ifdef DYNAMIC_LINKING
+DLLFUNC int    mod_load(int module_load)
+#else
+int    httpd_load(int module_load)
+#endif
+{
+       THREAD thread;
+       THREAD_ATTR attr;
+       
+       struct SOCKADDR_IN      sin;
+       if ((httpdfd = socket(AFINET, SOCK_STREAM, 0)) == -1)
+       {
+               config_error("httpd: could not create socket");
+               httpdfd = -1;
+               return -1;
+       }               
+#ifndef INET6
+       sin.SIN_ADDR.S_ADDR = inet_addr(conf_listen->ip);
+#else
+       inet_pton(AFINET, conf_listen->ip, (void *)&sin.SIN_ADDR);
+#endif
+       sin.SIN_PORT = htons(8091);
+       sin.SIN_FAMILY = AFINET;
+       if (bind(httpdfd, (struct SOCKADDR *)&sin, sizeof(sin)))
+       {
+               config_error("httpd: could not bind: %s",
+                       strerror(ERRNO));
+               CLOSE_SOCK(httpdfd);
+               httpdfd = -1;
+               return -1;
+       }
+
+       listen(httpdfd, LISTEN_SIZE);
+       IRCCreateThread(thread, attr, httpd_acceptthread, NULL);
+       return 0;
+}
+
+
+/* Called when module is unloaded */
+#ifdef DYNAMIC_LINKING
+DLLFUNC void   mod_unload(void)
+#else
+void   httpd_unload(void)
+#endif
+{
+       del_HookX(HOOKTYPE_HTTPD_URL, h_u_stats, NULL);
+       del_HookX(HOOKTYPE_HTTPD_URL, h_u_vfs, NULL);
+       del_HookX(HOOKTYPE_HTTPD_URL, h_u_phtml, NULL);
+}
+
+/*     
+ * copyright (c) 2000 Todor Prokopov
+ * from the CGI library, under the GPL
+*/
+static int urldecode(char *s)
+{
+  char *p = s;
+
+  while (*s != '\0')
+  {
+    if (*s == '%')
+    {
+      s++;
+      if (!isxdigit(*s))
+        return 0;
+      *p = (isalpha(*s) ? (*s & 0xdf) - 'A' + 10 : *s - '0') << 4;
+      s++;
+      if (!isxdigit(*s))
+        return 0;
+      *p += isalpha(*s) ? (*s & 0xdf) - 'A' + 10 : *s - '0';
+    }
+    else if (*s == '+')
+      *p = ' ';
+    else
+      *p = *s;
+    s++;
+    p++;
+  }
+  *p = '\0';
+  return 1;
+}
+
+int parse_urlenc(HTTPd_Request *request)
+{
+  unsigned int i;
+  unsigned int p;
+  int   param_count;
+  int  content_length;
+  char  **tempheaders;
+  char  **tempvalues;
+  HTTPd_Header *h;
+  char *buf;
+
+  content_length = request->content_length;
+  buf = request->inbuf;
+
+  if (content_length != 0)
+  {
+    param_count = 1;
+    for (i = 0; i < content_length; i++)
+      if (buf[i] == '&')
+        param_count++;
+    i = 0;
+    p = 0;
+    tempheaders = (char **)MyMallocEx(sizeof(char *) * param_count);
+    tempvalues = (char **)MyMallocEx(sizeof(char *) * param_count);
+    while (i < content_length)
+    {
+      tempheaders[p] = buf + i;
+      while (i < content_length && buf[i] != '=' && buf[i] != '&')
+        i++;
+      if (i >= content_length || buf[i] != '=')
+      {
+       MyFree(tempheaders);
+       MyFree(tempvalues);
+        return 0;
+      }
+      buf[i] = '\0';
+      i++;
+      tempvalues[p] = buf + i;
+      while (i < content_length && buf[i] != '=' && buf[i] != '&')
+        i++;
+      if (i < content_length)
+      {
+        if (buf[i] != '&')
+        {
+         MyFree(tempheaders);
+         MyFree(tempvalues);
+          return 0;
+        }
+        buf[i] = '\0';
+        i++;
+      }
+      if (!urldecode(tempheaders[p]) || !urldecode(tempvalues[p]))
+      {
+         MyFree(tempheaders);
+         MyFree(tempvalues);
+        return 0;
+      }
+      p++;
+    }
+  }
+  for (i = 0; i < p; i++)
+  {
+       h = (HTTPd_Header *) MyMallocEx(sizeof(HTTPd_Header));
+       h->name = strdup(tempheaders[i]);
+       h->value = strdup(tempvalues[i]);
+       h->next = request->dataheaders;
+       request->dataheaders = h;
+  }
+  MyFree(tempheaders);
+  MyFree(tempvalues);
+  return 1;
+}
+
+/* Normal copyright applies here */
+
+char   *GetField(HTTPd_Header *header, char *name)
+{
+       HTTPd_Header *p;
+       for (p = header; p; p = p->next)
+               if (!strcasecmp(p->name, name))
+                       return (p->value);
+       return NULL;
+       
+}
+
+char   *GetHeader(HTTPd_Request *request, char *name)
+{
+       HTTPd_Header *p;
+       for (p = request->headers; p; p = p->next)
+               if (!strcasecmp(p->name, name))
+                       return (p->value);
+       return NULL;
+}
+
+void   httpd_standard_headerX(HTTPd_Request *request, char *type, int extra)
+{
+       char             datebuf[100];
+       sockprintf(request, "HTTP/1.1 200 OK");
+       sockprintf(request, "Server: UnrealIRCd HTTPd");
+       sockprintf(request, "Connection: close");
+       sockprintf(request, "Date: %s", (char *) rfctime(time(NULL), datebuf));
+       sockprintf(request, "Content-Type: %s", type);
+       if (extra != 1) 
+               sockprintf(request, "");
+}
+
+void   httpd_standard_header(HTTPd_Request *request, char *type)
+{
+       httpd_standard_headerX(request, type, 0);
+}
+
+void   httpd_404_header(HTTPd_Request *request, char *path)
+{
+       char             datebuf[100];
+       sockprintf(request, "HTTP/1.1 404 Not Found");
+       sockprintf(request, "Server: UnrealIRCd HTTPd");
+       sockprintf(request, "Connection: close");
+       sockprintf(request, "Date: %s", (char *) rfctime(time(NULL), datebuf));
+       sockprintf(request, "Content-Type: text/html");
+       sockprintf(request, "");
+       sockprintf(request, "<b>Not Found</b><br>Could not find %s<br>",
+               path);
+}
+
+void   httpd_304_header(HTTPd_Request *request)
+{
+       char             datebuf[100];
+       sockprintf(request, "HTTP/1.1 304 Not Modified");
+       sockprintf(request, "Server: UnrealIRCd HTTPd");
+       sockprintf(request, "Connection: close");
+       sockprintf(request, "Date: %s", (char *) rfctime(time(NULL), datebuf));
+       sockprintf(request, "Content-Type: text/html");
+       sockprintf(request, "");
+}
+
+
+void   httpd_400_header(HTTPd_Request *request, char *why)
+{
+       char             datebuf[100];
+       sockprintf(request, "HTTP/1.1 400 Internal Server Error");
+       sockprintf(request, "Server: UnrealIRCd HTTPd");
+       sockprintf(request, "Connection: close");
+       sockprintf(request, "Date: %s", (char *) rfctime(time(NULL), datebuf));
+       sockprintf(request, "Content-Type: text/html");
+       sockprintf(request, "");
+       sockprintf(request, "%s<br>",
+               why);
+}
+
+void   httpd_parse_final(HTTPd_Request *request)
+{
+       if (request->method == 0)
+       {
+               char    *cl;
+               
+               cl = GetHeader(request, "Content-Length:");
+               if (!cl)
+               {
+                       sockprintf(request, "Missing content-length header..");
+                       return;
+               }
+               request->content_length = atoi(cl);
+               if (request->content_length <= 1023)
+               {
+                       request->state = 2;
+               }
+       }
+       else
+       {
+               RunHookReturn(HOOKTYPE_HTTPD_URL, request, >0);
+               httpd_404_header(request, request->url);
+               return;
+       }
+}
+
+void   httpd_badrequest(HTTPd_Request *request, char *reason)
+{
+       sockprintf(request, "HTTP/1.1 400 Bad Request");
+       sockprintf(request, "Server: UnrealIRCd HTTPd");
+       sockprintf(request, "Connection: close");
+       sockprintf(request, "Content-Type: text/plain");
+       sockprintf(request, "");
+       sockprintf(request, "%s", reason);
+}
+
+int    httpd_parse(HTTPd_Request *request)
+{
+       if (request->state == 0)
+       {
+               char    *cmd;
+
+               cmd = strtok(request->inbuf, " ");
+               if (!cmd)
+               {
+                       httpd_badrequest(request, "Bad protocol start");
+                       return -1;
+               }
+               else
+               {
+                       if (!strcmp(cmd, "GET") || !strcmp(cmd, "POST"))
+                       {
+                               char *url;
+                       
+                               url = strtok(NULL, " ");
+                               if (!url)
+                               {
+                                       httpd_badrequest(request, "Missing parameter");
+                                       return -1;
+                               }
+                               else
+                               {
+                                       request->url = strdup(url);
+                                       request->state = 1;
+                                       request->method = !strcmp(cmd, "GET") ? 1 : 0;
+                                       return 1;
+                               }
+                               
+                       }
+                       else
+                       {
+                               httpd_badrequest(request, cmd);
+                       }
+                       return -1;
+               }
+               return 1;
+       }       
+       else if (request->state == 1)
+       {
+               char    *headername;
+               char    *headerdata;
+               
+               headername = strtok(request->inbuf, " ");
+               if (!headername)
+               {
+                       httpd_parse_final(request);
+                       if (request->state > 1)
+                       {
+                               return 1;
+                       }
+                       else
+                               return -1;
+               }
+               else
+               {
+                       headerdata = strtok(NULL, "");
+                       if (!headerdata)
+                       {
+                               httpd_badrequest(request, "Malformed headers");
+                               return -1;
+                       }
+                       else
+                       {
+                               HTTPd_Header *header;
+                               header = (HTTPd_Header *) MyMalloc(sizeof(HTTPd_Header));
+                               header->name = strdup(headername);
+                               header->value = strdup(headerdata);
+                               header->next = request->headers;
+                               request->headers = header;
+                               return 1;
+                       }
+               }
+       } else if (request->state == 2)
+       {
+               if (parse_urlenc(request))
+               {
+                       RunHookReturn(HOOKTYPE_HTTPD_URL, request, >0) -1;
+                       httpd_404_header(request, request->url);
+                       return -1;
+               }
+               else
+               {
+                       httpd_badrequest(request, "Bad encoding");
+               }
+               return -1;
+       }
+}
+
+
+
+void   httpd_acceptthread(void *p)
+{
+       
+       SOCKET          callerfd;
+       HTTPd_Request   *req;   
+       
+       THREAD          thread;
+       THREAD_ATTR     thread_attr;
+       
+       while (1)
+       {
+               callerfd = accept(httpdfd, NULL, NULL);
+               if (callerfd >= 0)
+               {
+                       req = (HTTPd_Request *)MyMallocEx(sizeof(HTTPd_Request));
+                       req->fd = callerfd;
+                       IRCCreateThread(thread, thread_attr, httpd_socketthread, (void *)req);
+               }
+       }
+}
+
+
+
+void    httpd_socketthread(void *req)
+{
+       HTTPd_Request   *request = (HTTPd_Request *)req;
+       HTTPd_Header    *hp, *hp2;
+       fd_set          rfds;
+       struct timeval  tv;
+       int             retval, retval2;
+       tv.tv_sec = 10;
+       tv.tv_usec = 0;
+       FD_ZERO(&rfds);
+       FD_SET(request->fd, &rfds);
+               
+       while (request->pos < 1024)
+       {
+               if (retval = select(request->fd + 1, &rfds, NULL, NULL, &tv))
+               {
+                       while ((retval2 = recv(request->fd, &request->inbuf[request->pos], 1, 0)) >= 0)
+                       {
+                               if (request->state != 2)
+                               {
+                                       if (request->inbuf[request->pos] == '\n')
+                                       {
+                                               request->inbuf[request->pos + 1] = '\0';
+                                               iCstrip(request->inbuf);
+                                               if (httpd_parse(request) < 0)
+                                               {
+                                                       request->pos = 1024;
+                                                       break;
+                                               }
+                                               else
+                                                       request->pos = 0;
+                                       }
+                                       else
+                                       {
+                                               request->pos++;
+                                       }
+                                       if (request->pos >= 1024)
+                                       {
+                                               break;
+                                       }
+                               }
+                               else
+                               {
+                                       request->pos++;
+                                       if (request->pos >= 1024)
+                                               break;
+                                       if (request->pos == request->content_length)
+                                       {
+                                               request->inbuf[request->pos + 1] = '\0';
+                                               request->pos = 1024;
+                                               httpd_parse(request);
+                                               break;
+                                       }
+                               }
+                       }               
+                       if (request->pos >= 1024)
+                               break;
+
+                       if (retval2 < 0)
+                               request->pos = 1024;
+                       else
+                               request->pos += retval2;
+               }                               
+               else
+               {
+                       if (retval < 0)
+                       {       
+                               request->pos = 1024;
+                       }
+               }
+       }       
+       
+end:
+       CLOSE_SOCK(request->fd);
+       if (request->url)
+               MyFree(request->url);
+       
+       hp = request->headers;
+       while (hp)
+       {
+               if (hp->name)
+                       MyFree(hp->name);
+               if (hp->value)
+                       MyFree(hp->value);
+               hp2 = hp;
+               hp = hp->next;
+               MyFree(hp2);
+       }
+       hp = request->dataheaders;
+       while (hp)
+       {
+               if (hp->name)
+                       MyFree(hp->name);
+               if (hp->value)
+                       MyFree(hp->value);
+               hp2 = hp;
+               hp = hp->next;
+               MyFree(hp2);
+       }
+       MyFree(request);
+       IRCExitThread(NULL);
+       return;
+}
\ No newline at end of file
diff --git a/src/modules/web/phtml.c b/src/modules/web/phtml.c
new file mode 100644 (file)
index 0000000..50db855
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+   UnrealIRCd internal webserver - Prototype HTML
+   Copyright (c) 2001, The UnrealIRCd Team
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without modification, are permitted
+   provided that the following conditions are met:
+   
+     * Redistributions of source code must retain the above copyright notice, this list of conditions
+       and the following disclaimer.
+     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+       and the following disclaimer in the documentation and/or other materials provided with the
+       distribution.
+     * Neither the name of the The UnrealIRCd Team nor the names of its contributors may be used
+       to endorse or promote products derived from this software without specific prior written permission.
+     * The source code may not be redistributed for a fee or in closed source
+       programs, without expressed oral consent by the UnrealIRCd Team, however
+       for operating systems where binary distribution is required, if URL
+       is passed with the package to get the full source
+     * No warranty is given unless stated so by the The UnrealIRCd Team
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+   FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR  
+   BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include "config.h"
+#include "struct.h"
+#include "common.h"
+#include "sys.h"
+#include "numeric.h"
+#include "msg.h"
+#include "channel.h"
+#include <time.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef _WIN32
+#include <io.h>
+#else
+#include <sys/socket.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/resource.h>
+#endif
+#include <fcntl.h>
+#include "h.h"
+#ifdef STRIPBADWORDS
+#include "badwords.h"
+#endif
+#ifdef _WIN32
+#include "version.h"
+#endif
+#include "threads.h"
+#include "modules/web/httpd.h"
+
+DLLFUNC int h_u_phtml(HTTPd_Request *r);
+
+#define soprintf sockprintf
+
+#define SECTION_OPERS 1
+#define SECTION_STATS 2
+
+char *Titles[] = 
+{
+       "<NULL>",
+       "Operators",
+       "IRC Server Stats"
+};
+
+char *Icons[] =
+{
+       "<NULL>",
+       "/icons/opers.jpg",
+       "/icons/stats.jpg"
+};
+
+char *Sections[] =
+{
+       "<NULL>",
+       "IRC Operators",
+       "IRC Server Stats"
+};
+
+char *ButtonTexts[] =
+{
+       "<NULL>",
+       "Operators",
+       "Stats"
+};
+
+char *ButtonURLs[] = 
+{
+       "<NULL>",
+       "/section/opers",
+       "/section/stats"
+};
+
+DLLFUNC int h_u_phtml(HTTPd_Request *r)
+{
+       int     section = 0;
+       char    buf[1024];
+       char    bbuf[1024];
+       char    *s;
+       FILE    *f = NULL;
+
+       f = fopen("html/html/index.phtml", "r");
+       if (!f)
+               return 0;       
+       if (!match("/section/opers", r->url))
+               section = SECTION_OPERS;
+       if (!match("/section/stats", r->url))
+               section = SECTION_STATS;
+       if (section < 1)
+               return 0;
+               
+       httpd_standard_header(r, "text/html");
+       while (fgets(buf, 1023, f))
+       {
+               iCstrip(buf);
+               strcpy(bbuf, buf);
+               if (*buf == '$' && (buf[1] == ' '))
+               {
+                       s = strtok(buf, " ");
+                       if (s)
+                       {
+                               s = strtok(NULL, " ");
+                               if (s)
+                               {
+                                       if (!strcmp(s, "TITLE"))
+                                       {
+                                               sockprintf(r, "%s", Titles[section]);
+                                       }
+                                       else
+                                       if (!strcmp(s, "ICON"))
+                                       {
+                                               sockprintf(r, " src=\"%s\" ",
+                                                       Icons[section]);
+                                       }
+                                       else
+                                       if (!strcmp(s, "SECTION"))
+                                       {
+                                               sockprintf(r, "%s",
+                                                       Sections[section]);
+                                       }
+                                       else
+                                       if (!strcmp(s, "DATA"))
+                                       {
+                                               time_t  tmpnow;
+                                               
+                                               if (section == SECTION_STATS)
+                                               {
+                                                       tmpnow = TStime() - me.since;
+                                                       sockprintf(r, "My name is %s<br>", me.name);
+                                                       sockprintf(r, 
+                                                               "Been up for %lu days, %lu hours, %lu minutes, %lu seconds",
+                                                                       tmpnow / 86400, (tmpnow / 3600) % 24, (tmpnow /60) %60, 
+                                                                       tmpnow % 60);
+                                                       
+                                               }
+                                       }
+                                       
+                               }       
+                               else
+                                       sockprintf(r, "%s", bbuf);
+                       }
+                       else
+                           sockprintf(r, "%s", bbuf);
+               }
+               else
+                       sockprintf(r, "%s", bbuf);
+       }
+       return 1;
+}
diff --git a/src/modules/web/u_stats.c b/src/modules/web/u_stats.c
new file mode 100644 (file)
index 0000000..53dd84d
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+   UnrealIRCd internal webserver - /stats
+   Copyright (c) 2001, The UnrealIRCd Team
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without modification, are permitted
+   provided that the following conditions are met:
+   
+     * Redistributions of source code must retain the above copyright notice, this list of conditions
+       and the following disclaimer.
+     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+       and the following disclaimer in the documentation and/or other materials provided with the
+       distribution.
+     * Neither the name of the The UnrealIRCd Team nor the names of its contributors may be used
+       to endorse or promote products derived from this software without specific prior written permission.
+     * The source code may not be redistributed for a fee or in closed source
+       programs, without expressed oral consent by the UnrealIRCd Team, however
+       for operating systems where binary distribution is required, if URL
+       is passed with the package to get the full source
+     * No warranty is given unless stated so by the The UnrealIRCd Team
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+   FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR  
+   BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include "config.h"
+#include "struct.h"
+#include "common.h"
+#include "sys.h"
+#include "numeric.h"
+#include "msg.h"
+#include "channel.h"
+#include <time.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef _WIN32
+#include <io.h>
+#else
+#include <sys/socket.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/resource.h>
+#endif
+#include <fcntl.h>
+#include "h.h"
+#ifdef STRIPBADWORDS
+#include "badwords.h"
+#endif
+#ifdef _WIN32
+#include "version.h"
+#endif
+#include "threads.h"
+#include "modules/web/httpd.h"
+
+extern ircstats IRCstats;
+
+int h_u_stats(HTTPd_Request *r);
+
+#define soprintf sockprintf
+DLLFUNC int h_u_stats(HTTPd_Request *r)
+{
+       HTTPd_Header *p;
+       if (!match("/stats", r->url))
+       {
+               httpd_standard_header(r, "text/html");
+               soprintf(r, "<title>Current user stats on %s</title>", me.name);
+               soprintf(r, "Clients: %li  Invisible: %li  Servers: %li<br>",
+                       IRCstats.clients, IRCstats.invisible, IRCstats.servers);
+               soprintf(r, "Unknown: %li  My clients: %li  My Servers: %li<br>",
+                       IRCstats.unknown, IRCstats.me_clients, IRCstats.me_servers);
+               soprintf(r, "My Peak: %li    Global Peak: %li<br>",
+                       IRCstats.me_max, IRCstats.global_max);
+               for (p = r->headers; p; p = p->next)
+               {
+                       soprintf(r, "%s = %s<br>",
+                               p->name, p->value);     
+               }
+               return 1;
+       }
+       return 0;
+}
diff --git a/src/modules/web/vfs.c b/src/modules/web/vfs.c
new file mode 100644 (file)
index 0000000..9c155ab
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+   UnrealIRCd internal webserver - Virtual File System
+   Copyright (c) 2001, The UnrealIRCd Team
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without modification, are permitted
+   provided that the following conditions are met:
+   
+     * Redistributions of source code must retain the above copyright notice, this list of conditions
+       and the following disclaimer.
+     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+       and the following disclaimer in the documentation and/or other materials provided with the
+       distribution.
+     * Neither the name of the The UnrealIRCd Team nor the names of its contributors may be used
+       to endorse or promote products derived from this software without specific prior written permission.
+     * The source code may not be redistributed for a fee or in closed source
+       programs, without expressed oral consent by the UnrealIRCd Team, however
+       for operating systems where binary distribution is required, if URL
+       is passed with the package to get the full source
+     * No warranty is given unless stated so by the The UnrealIRCd Team
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+   FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR  
+   BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include "config.h"
+#include "struct.h"
+#include "common.h"
+#include "sys.h"
+#include "numeric.h"
+#include "msg.h"
+#include "channel.h"
+#include <time.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef _WIN32
+#include <io.h>
+#else
+#include <sys/socket.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/resource.h>
+#endif
+#include <fcntl.h>
+#include "h.h"
+#ifdef STRIPBADWORDS
+#include "badwords.h"
+#endif
+#ifdef _WIN32
+#include "version.h"
+#endif
+#include "threads.h"
+#include "modules/web/httpd.h"
+
+int h_u_vfs(HTTPd_Request *r);
+
+typedef struct _vfs_table VFStable;
+
+struct _vfs_table
+{
+       char    *filename;
+       char    *realfile;
+       char    *ct;
+};
+
+VFStable       vfsTable[] =
+{
+       {"/sections/active.gif", "html/sections/active.gif", "image/gif"},
+       {"/sections/inactive.gif", "html/sections/inactive.gif", "image/gif"},
+       {"/html/main.html", "html/html/main.html", "text/html"},
+       {"/icons/conffiles.jpg", "html/icons/conffiles.jpg", "image/jpeg"},
+       {"/icons/modules.jpg", "html/icons/modules.jpg", "image/jpeg"},
+       {"/icons/opers.jpg", "html/icons/opers.jpg", "image/jpeg"},
+       {"/icons/settings.jpg", "html/icons/settings.jpg", "image/jpeg"},
+       {"/icons/stats.jpg", "html/icons/stats.jpg", "image/jpeg"},
+       {"/icons/users.jpg", "html/icons/users.jpg", "image/jpeg"},
+       {"/back/background.jpg", "html/back/background.jpg", "image/jpeg"},
+       {"/unrealircd.com/active.gif", "html/unrealircd.com/active.gif", "image/jpeg"},
+       {"/unrealircd.com/inactive.gif", "html/unrealircd.com/inactive.gif", "image/jpeg"},
+       {"/", "html/index.html", "text/html"},
+       {NULL, NULL, NULL}      
+};
+#define soprintf sockprintf
+
+DLLFUNC int h_u_vfs(HTTPd_Request *r)
+{
+       VFStable *p = &vfsTable[0];
+       struct stat statf;
+       char    *ims;
+       time_t  tmt;
+       char    *datebuf = NULL;
+
+       ims = GetHeader(r, "if-modified-since");
+       while (p->filename)
+       {
+               if (!match(p->filename, r->url))
+               {
+                       stat(p->realfile, &statf);
+                       if (ims)
+                       {
+                               if (tmt = rfc2time(ims) < 0)
+                               {
+                                       httpd_400_header(r, "Bad date");
+                                       return 1;       
+                               }
+                               if (statf.st_mtime < tmt)
+                               {
+                                       httpd_304_header(r);
+                                       return 1;
+                               } 
+                       }                       
+                       httpd_standard_headerX(r, p->ct, 1);
+                       datebuf = MyMalloc(60);
+                       soprintf(r, "Last-Modified: %s",
+                               rfctime(statf.st_mtime, datebuf));
+                       MyFree(datebuf);
+                       soprintf(r, "");
+                       
+                       httpd_sendfile(r, p->realfile);
+                       return 1;
+               }
+               p++;
+       }
+       return 0;
+}