1 #include <stdio.h>
2
3 #include "lsg2.h"
4
5 struct LPMAPI *LMAPI;
6
lsg2_switch_context(void)7 void lsg2_switch_context(void)
8 {
9 LMAPI->log_printf(15, "Switching context in module LSG/2\n");
10 }
11
lsg2_upgradelist(int prev,int cur)12 int lsg2_upgradelist(int prev, int cur)
13 {
14 LMAPI->log_printf(10, "Upgrading lists in module LSG/2\n");
15 return 1;
16 }
17
lsg2_upgrade(int prev,int cur)18 int lsg2_upgrade(int prev, int cur)
19 {
20 LMAPI->log_printf(10, "Upgrading module LSG/2\n");
21 return 1;
22 }
23
lsg2_unload(void)24 void lsg2_unload(void)
25 {
26 LMAPI->log_printf(10, "Unloading module LSG/2\n");
27 }
28
lsg2_init(void)29 void lsg2_init(void)
30 {
31 LMAPI->log_printf(10, "Initializing module LSG/2\n");
32 }
33
lsg2_load(struct LPMAPI * api)34 void lsg2_load(struct LPMAPI* api)
35 {
36 LMAPI = api;
37
38 /* Log the module initialization */
39 LMAPI->log_printf(10, "Loading module LSG/2\n");
40
41 /* Register us as a modules */
42 LMAPI->add_module("LSG/2", "Listargate/2 WWW Interface");
43
44 /* Cmd line args */
45 LMAPI->add_cmdarg("-lsg2", 0, NULL, cmdarg_lsg2);
46
47 /* Mode of operation */
48 LMAPI->add_mode("lsg2", mode_lsg2);
49
50 /* Cookie type stuff */
51 LMAPI->register_cookie('W', "$$COOKIE$$", NULL, NULL);
52
53 /* CGI Modes */
54 LMAPI->add_cgi_mode("default", cgimode_default);
55 LMAPI->add_cgi_mode("login", cgimode_login);
56 LMAPI->add_cgi_mode("logout", cgimode_logout);
57 LMAPI->add_cgi_mode("listmenu", cgimode_listmenu);
58 LMAPI->add_cgi_mode("displayfile", cgimode_displayfile);
59 LMAPI->add_cgi_mode("userlist", cgimode_userlist);
60 LMAPI->add_cgi_mode("passwd", cgimode_passwd);
61 LMAPI->add_cgi_mode("subscribe", cgimode_subscribe);
62 LMAPI->add_cgi_mode("unsubscribe", cgimode_unsubscribe);
63 LMAPI->add_cgi_mode("flagedit", cgimode_flagedit);
64 LMAPI->add_cgi_mode("setflags", cgimode_setflags);
65 LMAPI->add_cgi_mode("setname", cgimode_setname);
66 LMAPI->add_cgi_mode("userinfo", cgimode_userinfo);
67 LMAPI->add_cgi_mode("admin", cgimode_admin);
68 LMAPI->add_cgi_mode("setconfig", cgimode_setconfig);
69 LMAPI->add_cgi_mode("config", cgimode_config);
70 LMAPI->add_cgi_mode("getfile", cgimode_getfile);
71 LMAPI->add_cgi_mode("putfile", cgimode_putfile);
72 LMAPI->add_cgi_mode("admin_subscribe", cgimode_admin_subscribe);
73 LMAPI->add_cgi_mode("admin_unsubscribe", cgimode_admin_unsubscribe);
74 LMAPI->add_cgi_mode("admin_setflags", cgimode_admin_setflags);
75 LMAPI->add_cgi_mode("admin_setname", cgimode_admin_setname);
76 LMAPI->add_cgi_mode("admin_userinfo", cgimode_admin_userinfo);
77 LMAPI->add_cgi_mode("admin_usersetinfo", cgimode_admin_usersetinfo);
78 LMAPI->add_cgi_mode("admin_userfor_generic", cgimode_admin_userfor_generic);
79
80 /* CGI Hooks */
81 LMAPI->add_cgi_hook("modehead", cgihook_modehead);
82 LMAPI->add_cgi_hook("modeheadex", cgihook_modeheadex);
83 LMAPI->add_cgi_hook("modeend", cgihook_modeend);
84 LMAPI->add_cgi_hook("username", cgihook_username);
85 LMAPI->add_cgi_hook("editusername", cgihook_editusername);
86 LMAPI->add_cgi_hook("authcookie", cgihook_authcookie);
87 LMAPI->add_cgi_hook("password", cgihook_password);
88 LMAPI->add_cgi_hook("submit", cgihook_submit);
89 LMAPI->add_cgi_hook("lists", cgihook_lists);
90 LMAPI->add_cgi_hook("listsex", cgihook_listsex);
91 LMAPI->add_cgi_hook("displayfile", cgihook_display_textfile);
92 LMAPI->add_cgi_hook("welcome-button", cgihook_welcome_button);
93 LMAPI->add_cgi_hook("faq-button", cgihook_faq_button);
94 LMAPI->add_cgi_hook("info-button", cgihook_infofile_button);
95 LMAPI->add_cgi_hook("curlist", cgihook_curlist);
96 LMAPI->add_cgi_hook("userlist", cgihook_userlist);
97 LMAPI->add_cgi_hook("liscript", cgihook_liscript);
98 LMAPI->add_cgi_hook("subscribe", cgihook_subscribe);
99 LMAPI->add_cgi_hook("unsubscribe", cgihook_unsubscribe);
100 LMAPI->add_cgi_hook("flaglist", cgihook_flaglist);
101 LMAPI->add_cgi_hook("setname", cgihook_setname);
102 LMAPI->add_cgi_hook("showflags", cgihook_showflags);
103 LMAPI->add_cgi_hook("configfile", cgihook_configfile);
104 LMAPI->add_cgi_hook("fileedit", cgihook_fileedit);
105 LMAPI->add_cgi_hook("adminfilelist", cgihook_adminfilelistdrop);
106 LMAPI->add_cgi_hook("adminshowflags", cgihook_admin_showflags);
107 LMAPI->add_cgi_hook("adminflaglist", cgihook_admin_flaglist);
108 LMAPI->add_cgi_hook("adminuserlistbox", cgihook_admin_userlistbox);
109 LMAPI->add_cgi_hook("adminsetname", cgihook_admin_setname);
110
111 /* Variables */
112 LMAPI->register_var("lsg2-cookie-duration", "15 m", "CGI",
113 "The length of time that cookies for the LSG/2 web form should last.",
114 "lsg2-cookie-duration = 30 m", VAR_DURATION, VAR_GLOBAL|VAR_SITE);
115 LMAPI->register_var("lsg2-cgi-url", NULL, "CGI",
116 "URL on the associated web server pointing to the LSG/2 cgi wrapper.",
117 "lsg2-cgi-url = http://my.dom/cgi-bin/lsg2.cgi", VAR_STRING,
118 VAR_GLOBAL|VAR_SITE);
119 LMAPI->register_var("lsg2-iis-support", "no", "CGI",
120 "Does LSG/2 need to run in Microsoft IIS-compatible mode? (Likely breaks other webservers.)",
121 "lg2-iis-support = yes", VAR_BOOL, VAR_GLOBAL);
122 LMAPI->register_var("lsg2-paranoia", "no", "CGI",
123 "Is LSG/2 paranoid, e.g. does it deny all remote administration.",
124 "lsg2-paranoia = no", VAR_BOOL, VAR_GLOBAL|VAR_SITE);
125 LMAPI->register_var("lsg2-sort-userlist", "yes", "CGI",
126 "Should LSG/2 sort the userlist in admin mode. This can be expensive for large lists.",
127 "lsg2-sort-userlist = true", VAR_BOOL, VAR_ALL);
128
129 /* Internal variables */
130 LMAPI->register_var("lcgi-error", NULL, NULL, NULL, NULL,
131 VAR_STRING, VAR_ALL|VAR_INTERNAL);
132 LMAPI->register_var("lcgi-remote-host", NULL, NULL, NULL, NULL,
133 VAR_STRING, VAR_ALL|VAR_INTERNAL);
134 LMAPI->register_var("lcgi-server-soft", NULL, NULL, NULL, NULL,
135 VAR_STRING, VAR_ALL|VAR_INTERNAL);
136 LMAPI->register_var("lcgi-mode", NULL, NULL, NULL, NULL,
137 VAR_STRING, VAR_ALL|VAR_INTERNAL);
138 LMAPI->register_var("lcgi-lastmode", NULL, NULL, NULL, NULL,
139 VAR_STRING, VAR_ALL|VAR_INTERNAL);
140 LMAPI->register_var("lcgi-user", NULL, NULL, NULL, NULL,
141 VAR_STRING, VAR_ALL|VAR_INTERNAL);
142 LMAPI->register_var("lcgi-userfor", NULL, NULL, NULL, NULL,
143 VAR_STRING, VAR_ALL|VAR_INTERNAL);
144 LMAPI->register_var("lcgi-list", NULL, NULL, NULL, NULL,
145 VAR_STRING, VAR_ALL|VAR_INTERNAL);
146 LMAPI->register_var("lcgi-pass", NULL, NULL, NULL, NULL,
147 VAR_STRING, VAR_ALL|VAR_INTERNAL);
148 LMAPI->register_var("lcgi-pass-confirm", NULL, NULL, NULL, NULL,
149 VAR_STRING, VAR_ALL|VAR_INTERNAL);
150 LMAPI->register_var("lcgi-cookie", NULL, NULL, NULL, NULL,
151 VAR_STRING, VAR_ALL|VAR_INTERNAL);
152 LMAPI->register_var("lcgi-fullname", NULL, NULL, NULL, NULL,
153 VAR_STRING, VAR_ALL|VAR_INTERNAL);
154 LMAPI->register_var("lcgi-adminfile", NULL, NULL, NULL, NULL,
155 VAR_STRING, VAR_ALL|VAR_INTERNAL);
156
157 LMAPI->register_var("lsg2-img-admin", "<b>A</b>", NULL, NULL, NULL,
158 VAR_STRING, VAR_ALL|VAR_INTERNAL);
159 LMAPI->register_var("lsg2-img-moderators", "<b>M</b>", NULL, NULL, NULL,
160 VAR_STRING, VAR_ALL|VAR_INTERNAL);
161 LMAPI->register_var("lsg2-img-hidden", "<b>H</b>", NULL, NULL, NULL,
162 VAR_STRING, VAR_ALL|VAR_INTERNAL);
163 LMAPI->register_var("lsg2-img-digest", "<b>D</b>", NULL, NULL, NULL,
164 VAR_STRING, VAR_ALL|VAR_INTERNAL);
165 LMAPI->register_var("lsg2-img-vacation", "<b>V</b>", NULL, NULL, NULL,
166 VAR_STRING, VAR_ALL|VAR_INTERNAL);
167
168 LMAPI->register_var("tlcgi-textfile", NULL, NULL, NULL, NULL,
169 VAR_STRING, VAR_TEMP|VAR_INTERNAL);
170 LMAPI->register_var("tlcgi-pathinfo", NULL, NULL, NULL, NULL,
171 VAR_STRING, VAR_GLOBAL|VAR_INTERNAL);
172 LMAPI->register_var("tlcgi-generic-text", NULL, NULL, NULL, NULL,
173 VAR_STRING, VAR_TEMP|VAR_INTERNAL);
174 LMAPI->register_var("tlcgi-editfile", NULL, NULL, NULL, NULL,
175 VAR_STRING, VAR_TEMP|VAR_INTERNAL);
176 LMAPI->register_var("tlcgi-editfile-desc", NULL, NULL, NULL, NULL,
177 VAR_STRING, VAR_TEMP|VAR_INTERNAL);
178
179 LMAPI->register_var("tlcgi-users-total", NULL, NULL, NULL, NULL,
180 VAR_INT, VAR_TEMP|VAR_INTERNAL);
181 LMAPI->register_var("tlcgi-users-admins", NULL, NULL, NULL, NULL,
182 VAR_INT, VAR_TEMP|VAR_INTERNAL);
183 LMAPI->register_var("tlcgi-users-moderators", NULL, NULL, NULL, NULL,
184 VAR_INT, VAR_TEMP|VAR_INTERNAL);
185 LMAPI->register_var("tlcgi-users-digest", NULL, NULL, NULL, NULL,
186 VAR_INT, VAR_TEMP|VAR_INTERNAL);
187 LMAPI->register_var("tlcgi-users-hidden", NULL, NULL, NULL, NULL,
188 VAR_INT, VAR_TEMP|VAR_INTERNAL);
189 LMAPI->register_var("tlcgi-users-vacation", NULL, NULL, NULL, NULL,
190 VAR_INT, VAR_TEMP|VAR_INTERNAL);
191 }
192