WWW improvements, fixes and a bug.
This commit is contained in:
parent
3f1f8f9749
commit
6ac2e6f125
1
.gitignore
vendored
1
.gitignore
vendored
@ -75,3 +75,4 @@ menus/file.mnu
|
|||||||
menus/logoff.mnu
|
menus/logoff.mnu
|
||||||
menus/mail.mnu
|
menus/mail.mnu
|
||||||
menus/main.mnu
|
menus/main.mnu
|
||||||
|
.vscode/settings.json
|
||||||
|
1
dist/config/bbs.ini
vendored
1
dist/config/bbs.ini
vendored
@ -16,6 +16,7 @@ Automessage Write Level = 10
|
|||||||
Fork = false
|
Fork = false
|
||||||
Enable WWW = false
|
Enable WWW = false
|
||||||
WWW Port = 8080
|
WWW Port = 8080
|
||||||
|
WWW URL = http://127.0.0.1:8080/
|
||||||
Enable SSH = false
|
Enable SSH = false
|
||||||
SSH Port = 2024
|
SSH Port = 2024
|
||||||
SSH DSA Key = /home/andrew/MagickaBBS/keys/ssh_host_dsa_key
|
SSH DSA Key = /home/andrew/MagickaBBS/keys/ssh_host_dsa_key
|
||||||
|
12
dist/www/header.tpl
vendored
12
dist/www/header.tpl
vendored
@ -1,19 +1,19 @@
|
|||||||
<HTML>
|
<HTML>
|
||||||
<HEAD>
|
<HEAD>
|
||||||
<TITLE>Magicka BBS</TITLE>
|
<TITLE>Magicka BBS</TITLE>
|
||||||
<link rel="stylesheet" type="text/css" href="/static/style.css">
|
<link rel="stylesheet" type="text/css" href="@@WWW_URL@@static/style.css">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
</HEAD>
|
</HEAD>
|
||||||
<BODY>
|
<BODY>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<img src="/static/header.png" alt="Magicka BBS" />
|
<img src="@@WWW_URL@@static/header.png" alt="Magicka BBS" />
|
||||||
</div>
|
</div>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/">Home</a></li>
|
<li><a href="@@WWW_URL@@">Home</a></li>
|
||||||
<li><a href="/last10/">Last 10 Callers</a></li>
|
<li><a href="@@WWW_URL@@last10/">Last 10 Callers</a></li>
|
||||||
<li><a href="/email/">Email</a></li>
|
<li><a href="@@WWW_URL@@email/">Email</a></li>
|
||||||
<li><a href="/msgs/">Conferences</a></li>
|
<li><a href="@@WWW_URL@@msgs/">Conferences</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
. . . .__ .__ __.
|
. . . .__ .__ __.
|
||||||
|\/| _. _ * _.;_/ _. [__)[__)(__
|
|\/| _. _ * _.;_/ _. [__)[__)(__
|
||||||
| |(_](_]|(_.| \(_] [__)[__).__) v0.8a
|
| |(_](_]|(_.| \(_] [__)[__).__) v0.9a
|
||||||
-------._|----------------------------------
|
-------._|----------------------------------
|
||||||
Magicka BBS is a Free BBS System for Linux,
|
Magicka BBS is a Free BBS System for Linux,
|
||||||
macOS, FreeBSD, NetBSD, OpenIndiana,
|
macOS, FreeBSD, NetBSD, OpenIndiana,
|
||||||
|
46
src/bbs.c
46
src/bbs.c
@ -1075,3 +1075,49 @@ int copy_file(char *src, char *dest) {
|
|||||||
fclose(dest_file);
|
fclose(dest_file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *str_replace(char *orig, char *rep, char *with) {
|
||||||
|
char *result; // the return string
|
||||||
|
char *ins; // the next insert point
|
||||||
|
char *tmp; // varies
|
||||||
|
int len_rep; // length of rep (the string to remove)
|
||||||
|
int len_with; // length of with (the string to replace rep with)
|
||||||
|
int len_front; // distance between rep and end of last rep
|
||||||
|
int count; // number of replacements
|
||||||
|
|
||||||
|
// sanity checks and initialization
|
||||||
|
if (!orig || !rep)
|
||||||
|
return NULL;
|
||||||
|
len_rep = strlen(rep);
|
||||||
|
if (len_rep == 0)
|
||||||
|
return NULL; // empty rep causes infinite loop during count
|
||||||
|
if (!with)
|
||||||
|
with = "";
|
||||||
|
len_with = strlen(with);
|
||||||
|
|
||||||
|
// count the number of replacements needed
|
||||||
|
ins = orig;
|
||||||
|
for (count = 0; tmp = strstr(ins, rep); ++count) {
|
||||||
|
ins = tmp + len_rep;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = result = malloc(strlen(orig) + (len_with - len_rep) * count + 1);
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// first time through the loop, all the variable are set correctly
|
||||||
|
// from here on,
|
||||||
|
// tmp points to the end of the result string
|
||||||
|
// ins points to the next occurrence of rep in orig
|
||||||
|
// orig points to the remainder of orig after "end of rep"
|
||||||
|
while (count--) {
|
||||||
|
ins = strstr(orig, rep);
|
||||||
|
len_front = ins - orig;
|
||||||
|
tmp = strncpy(tmp, orig, len_front) + len_front;
|
||||||
|
tmp = strcpy(tmp, with) + len_with;
|
||||||
|
orig += len_front + len_rep; // move to next "end of rep"
|
||||||
|
}
|
||||||
|
strcpy(tmp, orig);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "jamlib/jam.h"
|
#include "jamlib/jam.h"
|
||||||
|
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 8
|
#define VERSION_MINOR 9
|
||||||
#define VERSION_STR "alpha"
|
#define VERSION_STR "alpha"
|
||||||
|
|
||||||
#define NETWORK_FIDO 1
|
#define NETWORK_FIDO 1
|
||||||
@ -128,6 +128,7 @@ struct bbs_config {
|
|||||||
char *netmail_sem;
|
char *netmail_sem;
|
||||||
char *default_tagline;
|
char *default_tagline;
|
||||||
int telnet_port;
|
int telnet_port;
|
||||||
|
char *www_url;
|
||||||
int www_server;
|
int www_server;
|
||||||
int www_port;
|
int www_port;
|
||||||
char *www_path;
|
char *www_path;
|
||||||
@ -227,6 +228,8 @@ struct msg_headers {
|
|||||||
struct jam_msg **msgs;
|
struct jam_msg **msgs;
|
||||||
int msg_count;
|
int msg_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern char *str_replace(char *orig, char *rep, char *with);
|
||||||
extern int copy_file(char *src, char *dest);
|
extern int copy_file(char *src, char *dest);
|
||||||
extern int recursive_delete(const char *dir);
|
extern int recursive_delete(const char *dir);
|
||||||
extern void automessage_write(struct user_record *user);
|
extern void automessage_write(struct user_record *user);
|
||||||
|
10
src/main.c
10
src/main.c
@ -425,6 +425,13 @@ static int handler(void* user, const char* section, const char* name,
|
|||||||
}
|
}
|
||||||
} else if (strcasecmp(name, "www port") == 0) {
|
} else if (strcasecmp(name, "www port") == 0) {
|
||||||
conf->www_port = atoi(value);
|
conf->www_port = atoi(value);
|
||||||
|
} else if (strcasecmp(name, "www url") == 0) {
|
||||||
|
if (value[strlen(value) - 1] == '/') {
|
||||||
|
conf->www_url = strdup(value);
|
||||||
|
} else {
|
||||||
|
conf->www_url = (char *)malloc(strlen(value) + 2);
|
||||||
|
sprintf(conf->www_url, "%s/", value);
|
||||||
|
}
|
||||||
} else if (strcasecmp(name, "ssh port") == 0) {
|
} else if (strcasecmp(name, "ssh port") == 0) {
|
||||||
conf->ssh_port = atoi(value);
|
conf->ssh_port = atoi(value);
|
||||||
} else if (strcasecmp(name, "ssh dsa key") == 0) {
|
} else if (strcasecmp(name, "ssh dsa key") == 0) {
|
||||||
@ -1065,7 +1072,7 @@ void server(int port, int ipv6) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_WWW)
|
#if defined(ENABLE_WWW)
|
||||||
if (conf.www_server && conf.www_path != NULL) {
|
if (conf.www_server && conf.www_path != NULL && conf.www_url != NULL) {
|
||||||
if (!conf.fork) {
|
if (!conf.fork) {
|
||||||
printf(" - HTTP Starting on Port %d (IPv%d)\n", conf.www_port, (ipv6 ? 6 : 4));
|
printf(" - HTTP Starting on Port %d (IPv%d)\n", conf.www_port, (ipv6 ? 6 : 4));
|
||||||
}
|
}
|
||||||
@ -1241,6 +1248,7 @@ int main(int argc, char **argv) {
|
|||||||
conf.telnet_port = 0;
|
conf.telnet_port = 0;
|
||||||
conf.string_file = NULL;
|
conf.string_file = NULL;
|
||||||
conf.www_path = NULL;
|
conf.www_path = NULL;
|
||||||
|
conf.www_url = NULL;
|
||||||
conf.archiver_count = 0;
|
conf.archiver_count = 0;
|
||||||
conf.broadcast_enable = 0;
|
conf.broadcast_enable = 0;
|
||||||
conf.broadcast_port = 0;
|
conf.broadcast_port = 0;
|
||||||
|
179
src/www.c
179
src/www.c
@ -40,8 +40,14 @@ struct connection_info_s {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void *www_logger(void * cls, const char * uri, struct MHD_Connection *con) {
|
void *www_logger(void * cls, const char * uri, struct MHD_Connection *con) {
|
||||||
struct sockaddr_in *so = (struct sockaddr_in *)MHD_get_connection_info(con, MHD_CONNECTION_INFO_CLIENT_ADDRESS)->client_addr;
|
struct sockaddr *so = (struct sockaddr *)MHD_get_connection_info(con, MHD_CONNECTION_INFO_CLIENT_ADDRESS)->client_addr;
|
||||||
ipaddress = strdup(inet_ntoa(so->sin_addr));
|
if (so->sa_family == AF_INET) {
|
||||||
|
ipaddress = (char *)malloc(INET_ADDRSTRLEN + 1);
|
||||||
|
inet_ntop(AF_INET, &((struct sockaddr_in *)so)->sin_addr, ipaddress, INET_ADDRSTRLEN);
|
||||||
|
} else if (so->sa_family == AF_INET6) {
|
||||||
|
ipaddress = (char *)malloc(INET6_ADDRSTRLEN + 1);
|
||||||
|
inet_ntop(AF_INET6, &((struct sockaddr_in6 *)so)->sin6_addr, ipaddress, INET6_ADDRSTRLEN);
|
||||||
|
}
|
||||||
dolog("%s", uri);
|
dolog("%s", uri);
|
||||||
free(ipaddress);
|
free(ipaddress);
|
||||||
ipaddress = NULL;
|
ipaddress = NULL;
|
||||||
@ -78,6 +84,7 @@ void www_request_completed(void *cls, struct MHD_Connection *connection, void **
|
|||||||
free(con_info->user->email);
|
free(con_info->user->email);
|
||||||
free(con_info->user->location);
|
free(con_info->user->location);
|
||||||
free(con_info->user->sec_info);
|
free(con_info->user->sec_info);
|
||||||
|
free(con_info->user->signature);
|
||||||
free(con_info->user);
|
free(con_info->user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +188,7 @@ char *www_get_mime_type(const char *extension) {
|
|||||||
|
|
||||||
int www_401(char *header, char *footer, struct MHD_Connection * connection) {
|
int www_401(char *header, char *footer, struct MHD_Connection * connection) {
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
char *page;
|
char *page, *page_tmp;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
char *whole_page;
|
char *whole_page;
|
||||||
struct MHD_Response *response;
|
struct MHD_Response *response;
|
||||||
@ -190,32 +197,35 @@ int www_401(char *header, char *footer, struct MHD_Connection * connection) {
|
|||||||
|
|
||||||
snprintf(buffer, 4096, "%s/401.tpl", conf.www_path);
|
snprintf(buffer, 4096, "%s/401.tpl", conf.www_path);
|
||||||
|
|
||||||
page = NULL;
|
page_tmp = NULL;
|
||||||
|
|
||||||
if (stat(buffer, &s) == 0) {
|
if (stat(buffer, &s) == 0) {
|
||||||
page = (char *)malloc(s.st_size + 1);
|
page_tmp = (char *)malloc(s.st_size + 1);
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(page, 0, s.st_size + 1);
|
memset(page_tmp, 0, s.st_size + 1);
|
||||||
fptr = fopen(buffer, "r");
|
fptr = fopen(buffer, "r");
|
||||||
if (fptr) {
|
if (fptr) {
|
||||||
fread(page, s.st_size, 1, fptr);
|
fread(page_tmp, s.st_size, 1, fptr);
|
||||||
fclose(fptr);
|
fclose(fptr);
|
||||||
} else {
|
} else {
|
||||||
free(page);
|
free(page_tmp);
|
||||||
page = NULL;
|
page_tmp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
page = (char *)malloc(16);
|
page_tmp = (char *)malloc(16);
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sprintf(page, "Missing Content");
|
sprintf(page_tmp, "Missing Content");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
page = str_replace(page_tmp, "@@WWW_URL@@", conf.www_url);
|
||||||
|
free(page_tmp);
|
||||||
|
|
||||||
whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1);
|
whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1);
|
||||||
|
|
||||||
sprintf(whole_page, "%s%s%s", header, page, footer);
|
sprintf(whole_page, "%s%s%s", header, page, footer);
|
||||||
@ -233,7 +243,7 @@ int www_401(char *header, char *footer, struct MHD_Connection * connection) {
|
|||||||
|
|
||||||
int www_404(char *header, char *footer, struct MHD_Connection * connection) {
|
int www_404(char *header, char *footer, struct MHD_Connection * connection) {
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
char *page;
|
char *page, *page_tmp;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
char *whole_page;
|
char *whole_page;
|
||||||
struct MHD_Response *response;
|
struct MHD_Response *response;
|
||||||
@ -242,32 +252,35 @@ int www_404(char *header, char *footer, struct MHD_Connection * connection) {
|
|||||||
|
|
||||||
snprintf(buffer, 4096, "%s/404.tpl", conf.www_path);
|
snprintf(buffer, 4096, "%s/404.tpl", conf.www_path);
|
||||||
|
|
||||||
page = NULL;
|
page_tmp = NULL;
|
||||||
|
|
||||||
if (stat(buffer, &s) == 0) {
|
if (stat(buffer, &s) == 0) {
|
||||||
page = (char *)malloc(s.st_size + 1);
|
page_tmp = (char *)malloc(s.st_size + 1);
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(page, 0, s.st_size + 1);
|
memset(page_tmp, 0, s.st_size + 1);
|
||||||
fptr = fopen(buffer, "r");
|
fptr = fopen(buffer, "r");
|
||||||
if (fptr) {
|
if (fptr) {
|
||||||
fread(page, s.st_size, 1, fptr);
|
fread(page_tmp, s.st_size, 1, fptr);
|
||||||
fclose(fptr);
|
fclose(fptr);
|
||||||
} else {
|
} else {
|
||||||
free(page);
|
free(page_tmp);
|
||||||
page = NULL;
|
page = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
page = (char *)malloc(16);
|
page_tmp = (char *)malloc(16);
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sprintf(page, "Missing Content");
|
sprintf(page_tmp, "Missing Content");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
page = str_replace(page_tmp, "@@WWW_URL@@", conf.www_url);
|
||||||
|
free(page_tmp);
|
||||||
|
|
||||||
whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1);
|
whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1);
|
||||||
|
|
||||||
sprintf(whole_page, "%s%s%s", header, page, footer);
|
sprintf(whole_page, "%s%s%s", header, page, footer);
|
||||||
@ -283,7 +296,7 @@ int www_404(char *header, char *footer, struct MHD_Connection * connection) {
|
|||||||
|
|
||||||
int www_403(char *header, char *footer, struct MHD_Connection * connection) {
|
int www_403(char *header, char *footer, struct MHD_Connection * connection) {
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
char *page;
|
char *page, *page_tmp;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
char *whole_page;
|
char *whole_page;
|
||||||
struct MHD_Response *response;
|
struct MHD_Response *response;
|
||||||
@ -292,32 +305,35 @@ int www_403(char *header, char *footer, struct MHD_Connection * connection) {
|
|||||||
|
|
||||||
snprintf(buffer, 4096, "%s/403.tpl", conf.www_path);
|
snprintf(buffer, 4096, "%s/403.tpl", conf.www_path);
|
||||||
|
|
||||||
page = NULL;
|
page_tmp = NULL;
|
||||||
|
|
||||||
if (stat(buffer, &s) == 0) {
|
if (stat(buffer, &s) == 0) {
|
||||||
page = (char *)malloc(s.st_size + 1);
|
page_tmp = (char *)malloc(s.st_size + 1);
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(page, 0, s.st_size + 1);
|
memset(page_tmp, 0, s.st_size + 1);
|
||||||
fptr = fopen(buffer, "r");
|
fptr = fopen(buffer, "r");
|
||||||
if (fptr) {
|
if (fptr) {
|
||||||
fread(page, s.st_size, 1, fptr);
|
fread(page_tmp, s.st_size, 1, fptr);
|
||||||
fclose(fptr);
|
fclose(fptr);
|
||||||
} else {
|
} else {
|
||||||
free(page);
|
free(page_tmp);
|
||||||
page = NULL;
|
page_tmp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
page = (char *)malloc(16);
|
page_tmp = (char *)malloc(16);
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sprintf(page, "Missing Content");
|
sprintf(page_tmp, "Missing Content");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
page = str_replace(page_tmp, "@@WWW_URL@@", conf.www_url);
|
||||||
|
free(page_tmp);
|
||||||
|
|
||||||
whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1);
|
whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1);
|
||||||
|
|
||||||
sprintf(whole_page, "%s%s%s", header, page, footer);
|
sprintf(whole_page, "%s%s%s", header, page, footer);
|
||||||
@ -376,11 +392,11 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
|||||||
struct MHD_Response *response;
|
struct MHD_Response *response;
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
char *page;
|
char *page, *page_tmp;
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
struct stat s;
|
struct stat s;
|
||||||
char *header;
|
char *header, *header_tmp;
|
||||||
char *footer;
|
char *footer, *footer_tmp;
|
||||||
char *whole_page;
|
char *whole_page;
|
||||||
FILE *fptr;
|
FILE *fptr;
|
||||||
char *mime;
|
char *mime;
|
||||||
@ -432,97 +448,106 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
|||||||
|
|
||||||
snprintf(buffer, 4096, "%s/header.tpl", conf.www_path);
|
snprintf(buffer, 4096, "%s/header.tpl", conf.www_path);
|
||||||
|
|
||||||
header = NULL;
|
header_tmp = NULL;
|
||||||
|
|
||||||
if (stat(buffer, &s) == 0) {
|
if (stat(buffer, &s) == 0) {
|
||||||
header = (char *)malloc(s.st_size + 1);
|
header_tmp = (char *)malloc(s.st_size + 1);
|
||||||
if (header == NULL) {
|
if (header_tmp == NULL) {
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
}
|
}
|
||||||
memset(header, 0, s.st_size + 1);
|
memset(header_tmp, 0, s.st_size + 1);
|
||||||
fptr = fopen(buffer, "r");
|
fptr = fopen(buffer, "r");
|
||||||
if (fptr) {
|
if (fptr) {
|
||||||
fread(header, s.st_size, 1, fptr);
|
fread(header_tmp, s.st_size, 1, fptr);
|
||||||
fclose(fptr);
|
fclose(fptr);
|
||||||
} else {
|
} else {
|
||||||
free(header);
|
free(header_tmp);
|
||||||
header = NULL;
|
header_tmp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header == NULL) {
|
if (header_tmp == NULL) {
|
||||||
header = (char *)malloc(strlen(conf.bbs_name) * 2 + 61);
|
header_tmp = (char *)malloc(strlen(conf.bbs_name) * 2 + 61);
|
||||||
if (header == NULL) {
|
if (header_tmp == NULL) {
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
}
|
}
|
||||||
sprintf(header, "<HTML>\n<HEAD>\n<TITLE>%s</TITLE>\n</HEAD>\n<BODY>\n<H1>%s</H1><HR />", conf.bbs_name, conf.bbs_name);
|
sprintf(header_tmp, "<HTML>\n<HEAD>\n<TITLE>%s</TITLE>\n</HEAD>\n<BODY>\n<H1>%s</H1><HR />", conf.bbs_name, conf.bbs_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
header = str_replace(header_tmp, "@@WWW_URL@@", conf.www_url);
|
||||||
|
free(header_tmp);
|
||||||
|
|
||||||
snprintf(buffer, 4096, "%s/footer.tpl", conf.www_path);
|
snprintf(buffer, 4096, "%s/footer.tpl", conf.www_path);
|
||||||
|
|
||||||
footer = NULL;
|
footer = NULL;
|
||||||
|
|
||||||
if (stat(buffer, &s) == 0) {
|
if (stat(buffer, &s) == 0) {
|
||||||
footer = (char *)malloc(s.st_size + 1);
|
footer_tmp = (char *)malloc(s.st_size + 1);
|
||||||
if (footer == NULL) {
|
if (footer_tmp == NULL) {
|
||||||
free(header);
|
free(header);
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
}
|
}
|
||||||
memset(footer, 0, s.st_size + 1);
|
memset(footer_tmp, 0, s.st_size + 1);
|
||||||
fptr = fopen(buffer, "r");
|
fptr = fopen(buffer, "r");
|
||||||
if (fptr) {
|
if (fptr) {
|
||||||
fread(footer, s.st_size, 1, fptr);
|
fread(footer_tmp, s.st_size, 1, fptr);
|
||||||
fclose(fptr);
|
fclose(fptr);
|
||||||
} else {
|
} else {
|
||||||
free(footer);
|
free(footer_tmp);
|
||||||
footer = NULL;
|
footer_tmp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (footer == NULL) {
|
if (footer_tmp == NULL) {
|
||||||
footer = (char *)malloc(43);
|
footer_tmp = (char *)malloc(43);
|
||||||
if (footer == NULL) {
|
if (footer_tmp == NULL) {
|
||||||
free(header);
|
free(header);
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
}
|
}
|
||||||
sprintf(footer, "<HR />Powered by Magicka BBS</BODY></HTML>");
|
sprintf(footer_tmp, "<HR />Powered by Magicka BBS</BODY></HTML>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
footer = str_replace(footer_tmp, "@@WWW_URL@@", conf.www_url);
|
||||||
|
free(footer_tmp);
|
||||||
|
|
||||||
if (strcmp(method, "GET") == 0) {
|
if (strcmp(method, "GET") == 0) {
|
||||||
if (strcasecmp(url, "/") == 0) {
|
if (strcasecmp(url, "/") == 0) {
|
||||||
|
|
||||||
snprintf(buffer, 4096, "%s/index.tpl", conf.www_path);
|
snprintf(buffer, 4096, "%s/index.tpl", conf.www_path);
|
||||||
|
|
||||||
page = NULL;
|
page_tmp = NULL;
|
||||||
|
|
||||||
if (stat(buffer, &s) == 0) {
|
if (stat(buffer, &s) == 0) {
|
||||||
page = (char *)malloc(s.st_size + 1);
|
page_tmp = (char *)malloc(s.st_size + 1);
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
free(header);
|
free(header);
|
||||||
free(footer);
|
free(footer);
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
}
|
}
|
||||||
memset(page, 0, s.st_size + 1);
|
memset(page_tmp, 0, s.st_size + 1);
|
||||||
fptr = fopen(buffer, "r");
|
fptr = fopen(buffer, "r");
|
||||||
if (fptr) {
|
if (fptr) {
|
||||||
fread(page, s.st_size, 1, fptr);
|
fread(page_tmp, s.st_size, 1, fptr);
|
||||||
fclose(fptr);
|
fclose(fptr);
|
||||||
} else {
|
} else {
|
||||||
free(page);
|
free(page_tmp);
|
||||||
page = NULL;
|
page_tmp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
page = (char *)malloc(16);
|
page_tmp = (char *)malloc(16);
|
||||||
if (page == NULL) {
|
if (page_tmp == NULL) {
|
||||||
free(header);
|
free(header);
|
||||||
free(footer);
|
free(footer);
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
}
|
}
|
||||||
sprintf(page, "Missing Content");
|
sprintf(page_tmp, "Missing Content");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
page = str_replace(page_tmp, "@@WWW_URL@@", conf.www_url);
|
||||||
|
free(page_tmp);
|
||||||
|
|
||||||
whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1);
|
whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1);
|
||||||
|
|
||||||
sprintf(whole_page, "%s%s%s", header, page, footer);
|
sprintf(whole_page, "%s%s%s", header, page, footer);
|
||||||
@ -756,7 +781,7 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
|||||||
MHD_destroy_response (response);
|
MHD_destroy_response (response);
|
||||||
free(header);
|
free(header);
|
||||||
free(footer);
|
free(footer);
|
||||||
return MHD_YES;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
if (www_403(header, footer, connection) != 0) {
|
if (www_403(header, footer, connection) != 0) {
|
||||||
free(header);
|
free(header);
|
||||||
@ -864,7 +889,8 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
|||||||
to = NULL;
|
to = NULL;
|
||||||
body = NULL;
|
body = NULL;
|
||||||
replyid = NULL;
|
replyid = NULL;
|
||||||
|
conference = -1;
|
||||||
|
area = -1;
|
||||||
|
|
||||||
for (i=0;i<con_inf->count;i++) {
|
for (i=0;i<con_inf->count;i++) {
|
||||||
if (strcmp(con_inf->keys[i], "recipient") == 0) {
|
if (strcmp(con_inf->keys[i], "recipient") == 0) {
|
||||||
@ -881,8 +907,9 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
|||||||
replyid = con_inf->values[i];
|
replyid = con_inf->values[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!www_send_msg(con_inf->user, to, subj, conference, area, replyid, body)) {
|
if (!www_send_msg(con_inf->user, to, subj, conference, area, replyid, body)) {
|
||||||
page = (char *)malloc(50);
|
page = (char *)malloc(31);
|
||||||
if (page == NULL) {
|
if (page == NULL) {
|
||||||
free(header);
|
free(header);
|
||||||
free(footer);
|
free(footer);
|
||||||
@ -890,7 +917,7 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
|||||||
}
|
}
|
||||||
sprintf(page, "<h1>Error Sending Message</h1>");
|
sprintf(page, "<h1>Error Sending Message</h1>");
|
||||||
} else {
|
} else {
|
||||||
page = (char *)malloc(21);
|
page = (char *)malloc(23);
|
||||||
if (page == NULL) {
|
if (page == NULL) {
|
||||||
free(header);
|
free(header);
|
||||||
free(footer);
|
free(footer);
|
||||||
|
@ -80,10 +80,16 @@ int www_send_email(struct user_record *user, char *recipient, char *subject, cha
|
|||||||
int i;
|
int i;
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
|
if (recipient == NULL || subject == NULL || ibody == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (check_user(recipient)) {
|
if (check_user(recipient)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uname(&name);
|
uname(&name);
|
||||||
|
|
||||||
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s \r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, conf.default_tagline);
|
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s \r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, conf.default_tagline);
|
||||||
@ -159,7 +165,7 @@ char *www_new_email() {
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
sprintf(buffer, "<form action=\"/email/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded\">\n");
|
sprintf(buffer, "<form action=\"%semail/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded\">\n", conf.www_url);
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
@ -380,7 +386,7 @@ char *www_email_display(struct user_record *user, int email) {
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
sprintf(buffer, "<form action=\"/email/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded\">\n");
|
sprintf(buffer, "<form action=\"%semail/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded\">\n", conf.www_url);
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
@ -612,7 +618,7 @@ sqlite3_busy_timeout(db, 5000);
|
|||||||
date = (time_t)sqlite3_column_int(res, 4);
|
date = (time_t)sqlite3_column_int(res, 4);
|
||||||
localtime_r(&date, &msg_date);
|
localtime_r(&date, &msg_date);
|
||||||
if (seen == 0) {
|
if (seen == 0) {
|
||||||
sprintf(buffer, "<div class=\"email-summary\"><div class=\"email-id\">%d</div><div class=\"email-subject\"><a href=\"/email/%d\">%s</a></div><div class=\"email-from\">%s</div><div class=\"email-date\">%.2d:%.2d %.2d-%.2d-%.2d</div><div class=\"email-delete\"><a href=\"/email/delete/%d\"><img src=\"/static/delete.png\" alt=\"delete\" /></a></div></div>\n", msgid + 1, msgid + 1, subject, from, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100, id);
|
sprintf(buffer, "<div class=\"email-summary\"><div class=\"email-id\">%d</div><div class=\"email-subject\"><a href=\"%semail/%d\">%s</a></div><div class=\"email-from\">%s</div><div class=\"email-date\">%.2d:%.2d %.2d-%.2d-%.2d</div><div class=\"email-delete\"><a href=\"%semail/delete/%d\"><img src=\"%sstatic/delete.png\" alt=\"delete\" /></a></div></div>\n", msgid + 1, conf.www_url, msgid + 1, subject, from, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100, conf.www_url, id, conf.www_url);
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
@ -620,7 +626,7 @@ sqlite3_busy_timeout(db, 5000);
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
} else {
|
} else {
|
||||||
sprintf(buffer, "<div class=\"email-summary-seen\"><div class=\"email-id\">%d</div><div class=\"email-subject\"><a href=\"/email/%d\">%s</a></div><div class=\"email-from\">%s</div><div class=\"email-date\">%.2d:%.2d %.2d-%.2d-%.2d</div><div class=\"email-delete\"><a href=\"/email/delete/%d\"><img src=\"/static/delete.png\" alt=\"delete\" /></a></div></div>\n", msgid + 1, msgid + 1, subject, from, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100, id);
|
sprintf(buffer, "<div class=\"email-summary-seen\"><div class=\"email-id\">%d</div><div class=\"email-subject\"><a href=\"%semail/%d\">%s</a></div><div class=\"email-from\">%s</div><div class=\"email-date\">%.2d:%.2d %.2d-%.2d-%.2d</div><div class=\"email-delete\"><a href=\"%semail/delete/%d\"><img src=\"%sstatic/delete.png\" alt=\"delete\" /></a></div></div>\n", msgid + 1, conf.www_url, msgid + 1, subject, from, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100, conf.www_url, id, conf.www_url);
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
|
@ -141,9 +141,9 @@ char *www_msgs_arealist(struct user_record *user) {
|
|||||||
if (conf.mail_conferences[i]->mail_areas[j]->read_sec_level <= user->sec_level) {
|
if (conf.mail_conferences[i]->mail_areas[j]->read_sec_level <= user->sec_level) {
|
||||||
|
|
||||||
if (new_messages(user, i, j) > 0) {
|
if (new_messages(user, i, j) > 0) {
|
||||||
sprintf(buffer, "<div class=\"area-list-new\"><a href=\"/msgs/%d/%d/\">%s</a></div>\n", i, j, conf.mail_conferences[i]->mail_areas[j]->name);
|
sprintf(buffer, "<div class=\"area-list-new\"><a href=\"%smsgs/%d/%d/\">%s</a></div>\n", conf.www_url, i, j, conf.mail_conferences[i]->mail_areas[j]->name);
|
||||||
} else {
|
} else {
|
||||||
sprintf(buffer, "<div class=\"area-list-item\"><a href=\"/msgs/%d/%d/\">%s</a></div>\n", i, j, conf.mail_conferences[i]->mail_areas[j]->name);
|
sprintf(buffer, "<div class=\"area-list-item\"><a href=\"%smsgs/%d/%d/\">%s</a></div>\n", conf.www_url, i, j, conf.mail_conferences[i]->mail_areas[j]->name);
|
||||||
}
|
}
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
@ -192,7 +192,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
|||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
if (conf.mail_conferences[conference]->mail_areas[area]->type != TYPE_NETMAIL_AREA) {
|
if (conf.mail_conferences[conference]->mail_areas[area]->type != TYPE_NETMAIL_AREA) {
|
||||||
sprintf(buffer, "<div class=\"button\"><a href=\"/msgs/new/%d/%d\">New Message</a></div>\n", conference, area);
|
sprintf(buffer, "<div class=\"button\"><a href=\"%smsgs/new/%d/%d\">New Message</a></div>\n", conf.www_url, conference, area);
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
@ -246,15 +246,15 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
|||||||
subject = www_sanitize(mhrs->msgs[i]->subject);
|
subject = www_sanitize(mhrs->msgs[i]->subject);
|
||||||
if (mhrs->msgs[i]->msg_h->MsgNum > jlr.HighReadMsg) {
|
if (mhrs->msgs[i]->msg_h->MsgNum > jlr.HighReadMsg) {
|
||||||
if (conf.date_style == 1) {
|
if (conf.date_style == 1) {
|
||||||
sprintf(buffer, "<div class=\"msg-summary\"><div class=\"msg-summary-id\">%d</div><div class=\"msg-summary-subject\"><a href=\"/msgs/%d/%d/%d\">%s</a></div><div class=\"msg-summary-from\">%s</div><div class=\"msg-summary-to\">%s</div><div class=\"msg-summary-date\">%.2d:%.2d %.2d-%.2d-%.2d</div></div>\n", mhrs->msgs[i]->msg_no + 1, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mon + 1, msg_date.tm_mday, msg_date.tm_year - 100);
|
sprintf(buffer, "<div class=\"msg-summary\"><div class=\"msg-summary-id\">%d</div><div class=\"msg-summary-subject\"><a href=\"%smsgs/%d/%d/%d\">%s</a></div><div class=\"msg-summary-from\">%s</div><div class=\"msg-summary-to\">%s</div><div class=\"msg-summary-date\">%.2d:%.2d %.2d-%.2d-%.2d</div></div>\n", mhrs->msgs[i]->msg_no + 1, conf.www_url, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mon + 1, msg_date.tm_mday, msg_date.tm_year - 100);
|
||||||
} else {
|
} else {
|
||||||
sprintf(buffer, "<div class=\"msg-summary\"><div class=\"msg-summary-id\">%d</div><div class=\"msg-summary-subject\"><a href=\"/msgs/%d/%d/%d\">%s</a></div><div class=\"msg-summary-from\">%s</div><div class=\"msg-summary-to\">%s</div><div class=\"msg-summary-date\">%.2d:%.2d %.2d-%.2d-%.2d</div></div>\n", mhrs->msgs[i]->msg_no + 1, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
|
sprintf(buffer, "<div class=\"msg-summary\"><div class=\"msg-summary-id\">%d</div><div class=\"msg-summary-subject\"><a href=\"%smsgs/%d/%d/%d\">%s</a></div><div class=\"msg-summary-from\">%s</div><div class=\"msg-summary-to\">%s</div><div class=\"msg-summary-date\">%.2d:%.2d %.2d-%.2d-%.2d</div></div>\n", mhrs->msgs[i]->msg_no + 1, conf.www_url, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (conf.date_style == 1) {
|
if (conf.date_style == 1) {
|
||||||
sprintf(buffer, "<div class=\"msg-summary-seen\"><div class=\"msg-summary-id\">%d</div><div class=\"msg-summary-subject\"><a href=\"/msgs/%d/%d/%d\">%s</a></div><div class=\"msg-summary-from\">%s</div><div class=\"msg-summary-to\">%s</div><div class=\"msg-summary-date\">%.2d:%.2d %.2d-%.2d-%.2d</div></div>\n", mhrs->msgs[i]->msg_no + 1, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mon + 1, msg_date.tm_mday, msg_date.tm_year - 100);
|
sprintf(buffer, "<div class=\"msg-summary-seen\"><div class=\"msg-summary-id\">%d</div><div class=\"msg-summary-subject\"><a href=\"%smsgs/%d/%d/%d\">%s</a></div><div class=\"msg-summary-from\">%s</div><div class=\"msg-summary-to\">%s</div><div class=\"msg-summary-date\">%.2d:%.2d %.2d-%.2d-%.2d</div></div>\n", mhrs->msgs[i]->msg_no + 1, conf.www_url, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mon + 1, msg_date.tm_mday, msg_date.tm_year - 100);
|
||||||
} else {
|
} else {
|
||||||
sprintf(buffer, "<div class=\"msg-summary-seen\"><div class=\"msg-summary-id\">%d</div><div class=\"msg-summary-subject\"><a href=\"/msgs/%d/%d/%d\">%s</a></div><div class=\"msg-summary-from\">%s</div><div class=\"msg-summary-to\">%s</div><div class=\"msg-summary-date\">%.2d:%.2d %.2d-%.2d-%.2d</div></div>\n", mhrs->msgs[i]->msg_no + 1, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
|
sprintf(buffer, "<div class=\"msg-summary-seen\"><div class=\"msg-summary-id\">%d</div><div class=\"msg-summary-subject\"><a href=\"%smsgs/%d/%d/%d\">%s</a></div><div class=\"msg-summary-from\">%s</div><div class=\"msg-summary-to\">%s</div><div class=\"msg-summary-date\">%.2d:%.2d %.2d-%.2d-%.2d</div></div>\n", mhrs->msgs[i]->msg_no + 1, conf.www_url, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,9 +279,9 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
|||||||
|
|
||||||
if (skip > 0) {
|
if (skip > 0) {
|
||||||
if (skip - 50 < 0) {
|
if (skip - 50 < 0) {
|
||||||
sprintf(buffer, "<div class=\"msg-summary-prev\"><a href=\"/msgs/%d/%d/\">Prev</a></div>\n", conference, area);
|
sprintf(buffer, "<div class=\"msg-summary-prev\"><a href=\"%smsgs/%d/%d/\">Prev</a></div>\n", conf.www_url, conference, area);
|
||||||
} else {
|
} else {
|
||||||
sprintf(buffer, "<div class=\"msg-summary-prev\"><a href=\"/msgs/%d/%d/?skip=%d\">Prev</a></div>\n", conference, area, skip - 50);
|
sprintf(buffer, "<div class=\"msg-summary-prev\"><a href=\"%smsgs/%d/%d/?skip=%d\">Prev</a></div>\n", conf.www_url, conference, area, skip - 50);
|
||||||
}
|
}
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
@ -292,7 +292,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (skip + 50 <= mhrs->msg_count) {
|
if (skip + 50 <= mhrs->msg_count) {
|
||||||
sprintf(buffer, "<div class=\"msg-summary-next\"><a href=\"/msgs/%d/%d/?skip=%d\">Next</a></div>\n", conference, area, skip + 50);
|
sprintf(buffer, "<div class=\"msg-summary-next\"><a href=\"%smsgs/%d/%d/?skip=%d\">Next</a></div>\n", conf.www_url, conference, area, skip + 50);
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
@ -458,7 +458,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
|||||||
len = 0;
|
len = 0;
|
||||||
memset(page, 0, 4096);
|
memset(page, 0, 4096);
|
||||||
|
|
||||||
sprintf(buffer, "<div class=\"content-header\"><a href=\"/msgs/%d/%d\"><h2>%s - %s</h2></a></div>\n", conference, area, conf.mail_conferences[conference]->name, conf.mail_conferences[conference]->mail_areas[area]->name);
|
sprintf(buffer, "<div class=\"content-header\"><a href=\"%smsgs/%d/%d\"><h2>%s - %s</h2></a></div>\n", conf.www_url, conference, area, conf.mail_conferences[conference]->name, conf.mail_conferences[conference]->mail_areas[area]->name);
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
@ -579,7 +579,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
sprintf(buffer, "<form action=\"/msgs/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded\">\n");
|
sprintf(buffer, "<form action=\"%smsgs/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded\">\n", conf.www_url);
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
@ -757,6 +757,9 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
|||||||
if (conference < 0 || conference >= conf.mail_conference_count || area < 0 || area >= conf.mail_conferences[conference]->mail_area_count) {
|
if (conference < 0 || conference >= conf.mail_conference_count || area < 0 || area >= conf.mail_conferences[conference]->mail_area_count) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (subj == NULL || to == NULL || body == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (conf.mail_conferences[conference]->mail_areas[area]->write_sec_level <= user->sec_level && conf.mail_conferences[conference]->mail_areas[area]->type != TYPE_NETMAIL_AREA) {
|
if (conf.mail_conferences[conference]->mail_areas[area]->write_sec_level <= user->sec_level && conf.mail_conferences[conference]->mail_areas[area]->type != TYPE_NETMAIL_AREA) {
|
||||||
jb = open_jam_base(conf.mail_conferences[conference]->mail_areas[area]->path);
|
jb = open_jam_base(conf.mail_conferences[conference]->mail_areas[area]->path);
|
||||||
if (!jb) {
|
if (!jb) {
|
||||||
@ -933,7 +936,7 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
sprintf(buffer, "<form action=\"/msgs/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded\">\n");
|
sprintf(buffer, "<form action=\"%smsgs/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded\">\n", conf.www_url);
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
|
Reference in New Issue
Block a user