mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-14 20:33:48 +00:00
Changed indentation
SVN revision: 1327
This commit is contained in:
parent
cd3f7ce1a4
commit
f11204d096
64
src/elogd.c
64
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.632 2005/04/19 06:43:45 ritt
|
||||||
|
Changed indentation
|
||||||
|
|
||||||
Revision 1.631 2005/04/18 20:39:32 ritt
|
Revision 1.631 2005/04/18 20:39:32 ritt
|
||||||
Added SMTP error reporting
|
Added SMTP error reporting
|
||||||
|
|
||||||
@ -1008,7 +1011,7 @@
|
|||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
/* Version of ELOG */
|
/* Version of ELOG */
|
||||||
#define VERSION "2.5.8-3"
|
#define VERSION "2.5.8-4"
|
||||||
char cvs_revision[] = "$Id$";
|
char cvs_revision[] = "$Id$";
|
||||||
|
|
||||||
/* ELOG identification */
|
/* ELOG identification */
|
||||||
@ -2548,8 +2551,7 @@ int check_smtp_error(char *str, int expected, char *error, int error_size)
|
|||||||
|
|
||||||
INT sendmail(LOGBOOK * lbs, char *smtp_host, char *from, char *to,
|
INT sendmail(LOGBOOK * lbs, char *smtp_host, char *from, char *to,
|
||||||
char *subject, char *text, BOOL email_to, char *url,
|
char *subject, char *text, BOOL email_to, char *url,
|
||||||
char att_file[MAX_ATTACHMENTS][256], char *error,
|
char att_file[MAX_ATTACHMENTS][256], char *error, int error_size)
|
||||||
int error_size)
|
|
||||||
{
|
{
|
||||||
struct sockaddr_in bind_addr;
|
struct sockaddr_in bind_addr;
|
||||||
struct hostent *phe;
|
struct hostent *phe;
|
||||||
@ -7955,17 +7957,18 @@ void attrib_from_param(int n_attr, char attrib[MAX_N_ATTR][NAME_LENGTH])
|
|||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
|
|
||||||
void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL bupload, BOOL breedit, BOOL bduplicate)
|
void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL bupload, BOOL breedit,
|
||||||
|
BOOL bduplicate)
|
||||||
{
|
{
|
||||||
int i, j, n, index, aindex, size, width, height, fh, length, input_size, input_maxlen,
|
int i, j, n, index, aindex, size, width, height, fh, length, input_size, input_maxlen,
|
||||||
format_flags[MAX_N_ATTR], year, month, day, hour, min, sec, n_attr, n_disp_attr, attr_index[MAX_N_ATTR];
|
format_flags[MAX_N_ATTR], year, month, day, hour, min, sec, n_attr, n_disp_attr,
|
||||||
|
attr_index[MAX_N_ATTR];
|
||||||
char str[1000], preset[1000], *p, *pend, star[80], comment[10000], reply_string[256],
|
char str[1000], preset[1000], *p, *pend, star[80], comment[10000], reply_string[256],
|
||||||
list[MAX_N_ATTR][NAME_LENGTH], file_name[256], *buffer, format[256], date[80],
|
list[MAX_N_ATTR][NAME_LENGTH], file_name[256], *buffer, format[256], date[80],
|
||||||
attrib[MAX_N_ATTR][NAME_LENGTH], *text, orig_tag[80],
|
attrib[MAX_N_ATTR][NAME_LENGTH], *text, orig_tag[80], reply_tag[MAX_REPLY_TO * 10],
|
||||||
reply_tag[MAX_REPLY_TO * 10], att[MAX_ATTACHMENTS][256], encoding[80],
|
att[MAX_ATTACHMENTS][256], encoding[80], slist[MAX_N_ATTR + 10][NAME_LENGTH],
|
||||||
slist[MAX_N_ATTR + 10][NAME_LENGTH], svalue[MAX_N_ATTR + 10][NAME_LENGTH],
|
svalue[MAX_N_ATTR + 10][NAME_LENGTH], owner[256], locked_by[256], class_value[80], class_name[80],
|
||||||
owner[256], locked_by[256], class_value[80], class_name[80], condition[256],
|
condition[256], ua[NAME_LENGTH], mid[80], title[256], login_name[256];
|
||||||
ua[NAME_LENGTH], mid[80], title[256], login_name[256];
|
|
||||||
time_t now, ltime;
|
time_t now, ltime;
|
||||||
char fl[8][NAME_LENGTH];
|
char fl[8][NAME_LENGTH];
|
||||||
struct tm *pts;
|
struct tm *pts;
|
||||||
@ -10471,7 +10474,8 @@ int save_user_config(LOGBOOK * lbs, char *user, BOOL new_user, BOOL activate)
|
|||||||
sprintf(url + strlen(url), "?cmd=Login&unm=%s", getparam("new_user_name"));
|
sprintf(url + strlen(url), "?cmd=Login&unm=%s", getparam("new_user_name"));
|
||||||
sprintf(mail_text + strlen(mail_text), "%s %s\r\n", loc("You can access it at"), url);
|
sprintf(mail_text + strlen(mail_text), "%s %s\r\n", loc("You can access it at"), url);
|
||||||
|
|
||||||
sendmail(lbs, smtp_host, mail_from, getparam("new_user_email"), subject, mail_text, TRUE, url, NULL, NULL, 0);
|
sendmail(lbs, smtp_host, mail_from, getparam("new_user_email"), subject, mail_text, TRUE, url, NULL,
|
||||||
|
NULL, 0);
|
||||||
} else {
|
} else {
|
||||||
if (getcfg(lbs->name, "Admin user", admin_user, sizeof(admin_user))) {
|
if (getcfg(lbs->name, "Admin user", admin_user, sizeof(admin_user))) {
|
||||||
pl = strtok(admin_user, " ,");
|
pl = strtok(admin_user, " ,");
|
||||||
@ -10524,8 +10528,7 @@ int save_user_config(LOGBOOK * lbs, char *user, BOOL new_user, BOOL activate)
|
|||||||
url_encode(enc_pwd, sizeof(enc_pwd));
|
url_encode(enc_pwd, sizeof(enc_pwd));
|
||||||
sprintf(mail_text + strlen(mail_text), "?cmd=Activate&new_user_name=%s&new_full_name=%s",
|
sprintf(mail_text + strlen(mail_text), "?cmd=Activate&new_user_name=%s&new_full_name=%s",
|
||||||
getparam("new_user_name"), str);
|
getparam("new_user_name"), str);
|
||||||
sprintf(mail_text + strlen(mail_text), "&new_user_email=%s",
|
sprintf(mail_text + strlen(mail_text), "&new_user_email=%s", getparam("new_user_email"));
|
||||||
getparam("new_user_email"));
|
|
||||||
|
|
||||||
for (i = 0; lb_list[i].name[0]; i++) {
|
for (i = 0; lb_list[i].name[0]; i++) {
|
||||||
sprintf(str, "sub_lb%d", i);
|
sprintf(str, "sub_lb%d", i);
|
||||||
@ -10533,15 +10536,15 @@ int save_user_config(LOGBOOK * lbs, char *user, BOOL new_user, BOOL activate)
|
|||||||
sprintf(mail_text + strlen(mail_text), "&%s=1", str);
|
sprintf(mail_text + strlen(mail_text), "&%s=1", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(mail_text + strlen(mail_text),"&encpwd=%s&unm=%s\r\n",
|
sprintf(mail_text + strlen(mail_text), "&encpwd=%s&unm=%s\r\n", enc_pwd, pl);
|
||||||
enc_pwd, pl);
|
|
||||||
} else {
|
} else {
|
||||||
sprintf(mail_text + strlen(mail_text),
|
sprintf(mail_text + strlen(mail_text),
|
||||||
"\r\n%s URL : %s?cmd=Config&cfg_user=%s&unm=%s\r\n",
|
"\r\n%s URL : %s?cmd=Config&cfg_user=%s&unm=%s\r\n",
|
||||||
loc("Logbook"), url, getparam("new_user_name"), pl);
|
loc("Logbook"), url, getparam("new_user_name"), pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendmail(lbs, smtp_host, mail_from, email_addr, subject, mail_text, TRUE, url, NULL, NULL, 0);
|
sendmail(lbs, smtp_host, mail_from, email_addr, subject, mail_text, TRUE, url, NULL, NULL,
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pl = strtok(NULL, " ,");
|
pl = strtok(NULL, " ,");
|
||||||
@ -10859,7 +10862,8 @@ void show_forgot_pwd_page(LOGBOOK * lbs)
|
|||||||
strlcat(mail_text, "\r\n\r\n", sizeof(mail_text));
|
strlcat(mail_text, "\r\n\r\n", sizeof(mail_text));
|
||||||
sprintf(mail_text + strlen(mail_text), "ELOG Version %s\r\n", VERSION);
|
sprintf(mail_text + strlen(mail_text), "ELOG Version %s\r\n", VERSION);
|
||||||
|
|
||||||
if (sendmail(lbs, smtp_host, mail_from, user_email, subject, mail_text, TRUE, url, NULL, NULL, 0) != -1) {
|
if (sendmail(lbs, smtp_host, mail_from, user_email, subject, mail_text, TRUE, url, NULL, NULL, 0)
|
||||||
|
!= -1) {
|
||||||
/* save new password */
|
/* save new password */
|
||||||
change_pwd(lbs, login_name, pwd_encrypted);
|
change_pwd(lbs, login_name, pwd_encrypted);
|
||||||
|
|
||||||
@ -14271,7 +14275,8 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
|
|||||||
strlcat(thumb_name, ".thumb", sizeof(thumb_name));
|
strlcat(thumb_name, ".thumb", sizeof(thumb_name));
|
||||||
|
|
||||||
if (!show_attachments) {
|
if (!show_attachments) {
|
||||||
rsprintf("<a href=\"%s\" target=\"_blank\">%s</a> ", ref, attachment[index] + 14);
|
rsprintf("<a href=\"%s\" target=\"_blank\">%s</a> ", ref,
|
||||||
|
attachment[index] + 14);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (file_exist(thumb_name)) {
|
if (file_exist(thumb_name)) {
|
||||||
@ -17048,14 +17053,22 @@ int compose_email(LOGBOOK * lbs, char *mail_to, int message_id,
|
|||||||
status = 0;
|
status = 0;
|
||||||
if (flags & 16) {
|
if (flags & 16) {
|
||||||
if (getcfg(lbs->name, "Omit Email to", str, sizeof(str)) && atoi(str) == 1)
|
if (getcfg(lbs->name, "Omit Email to", str, sizeof(str)) && atoi(str) == 1)
|
||||||
status = sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, FALSE, url, att_file, error, sizeof(error));
|
status =
|
||||||
|
sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, FALSE, url, att_file, error,
|
||||||
|
sizeof(error));
|
||||||
else
|
else
|
||||||
status = sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, TRUE, url, att_file, error, sizeof(error));
|
status =
|
||||||
|
sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, TRUE, url, att_file, error,
|
||||||
|
sizeof(error));
|
||||||
} else {
|
} else {
|
||||||
if (getcfg(lbs->name, "Omit Email to", str, sizeof(str)) && atoi(str) == 1)
|
if (getcfg(lbs->name, "Omit Email to", str, sizeof(str)) && atoi(str) == 1)
|
||||||
status = sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, FALSE, url, NULL, error, sizeof(error));
|
status =
|
||||||
|
sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, FALSE, url, NULL, error,
|
||||||
|
sizeof(error));
|
||||||
else
|
else
|
||||||
status = sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, TRUE, url, NULL, error, sizeof(error));
|
status =
|
||||||
|
sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, TRUE, url, NULL, error,
|
||||||
|
sizeof(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
@ -18885,7 +18898,8 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
|
|||||||
("<tr><td nowrap width=\"10%%\" class=\"attribname\">%s %d:</td>\n",
|
("<tr><td nowrap width=\"10%%\" class=\"attribname\">%s %d:</td>\n",
|
||||||
loc("Attachment"), index + 1);
|
loc("Attachment"), index + 1);
|
||||||
|
|
||||||
rsprintf("<td class=\"attribvalue\"><a href=\"%s\" target=\"_blank\">%s</a>\n", ref, attachment[index] + 14);
|
rsprintf("<td class=\"attribvalue\"><a href=\"%s\" target=\"_blank\">%s</a>\n", ref,
|
||||||
|
attachment[index] + 14);
|
||||||
|
|
||||||
rsprintf(" <span class=\"bytes\">");
|
rsprintf(" <span class=\"bytes\">");
|
||||||
|
|
||||||
@ -20447,8 +20461,8 @@ void interprete(char *lbook, char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strieq(command, loc("New")) || strieq(command, loc("Edit")) || strieq(command, loc("Reply")) ||
|
if (strieq(command, loc("New")) || strieq(command, loc("Edit")) || strieq(command, loc("Reply")) ||
|
||||||
strieq(command, loc("Duplicate")) || strieq(command, loc("Delete")) || strieq(command, loc("Upload")) ||
|
strieq(command, loc("Duplicate")) || strieq(command, loc("Delete")) || strieq(command, loc("Upload"))
|
||||||
strieq(command, loc("Submit"))) {
|
|| strieq(command, loc("Submit"))) {
|
||||||
sprintf(str, "%s?cmd=%s", path, command);
|
sprintf(str, "%s?cmd=%s", path, command);
|
||||||
if (!check_password(lbs, "Write password", getparam("wpwd"), str))
|
if (!check_password(lbs, "Write password", getparam("wpwd"), str))
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user