Mercurial > hgrepos > hgweb.cgi > after5
changeset 18:399f24a71eb9 draft
Add required files.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sun, 01 Apr 2012 17:03:01 +0900 |
parents | 904bbce89e71 |
children | d654c341f1a2 |
files | .hgignore Makefile a5.c after5.cgi after5.css after5.png after5.rb holiday |
diffstat | 8 files changed, 153 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sun Apr 01 17:03:01 2012 +0900 @@ -0,0 +1,3 @@ +syntax: glob +*/* +*.tar.gz
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile Sun Apr 01 17:03:01 2012 +0900 @@ -0,0 +1,21 @@ +# +# makefile for after5 cgi wrapper +# + +CC = gcc +VERSION = `head after5.cgi|awk '/Id:/{print $$4}'` +PNAME = after5-${VERSION} + +FILES = a5.c Makefile after5.cgi after5.css after5.png after5.rb \ + holiday +GTAR = gtar + +a5.cgi: a5.c + ${CC} -o a5.cgi a5.c + chmod u+s a5.cgi + +package: + -mkdir /tmp/${PNAME} + ${GTAR} cf - ${FILES} | (cd /tmp/${PNAME}; ${GTAR} -xvpf - --unlink) + ${GTAR} zcfC /tmp/${PNAME}.tar.gz /tmp ${PNAME} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/a5.c Sun Apr 01 17:03:01 2012 +0900 @@ -0,0 +1,58 @@ +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <unistd.h> +#include <sys/stat.h> +#include <string.h> + +#define AFTER5PATH "./after5.cgi" + +int main(int argc, char *argv[]) +{ + char *path=malloc(strlen(argv[0])); + char *p; + uid_t euid = geteuid(); + struct stat st; + if (0 == euid) { + fputs("Do not call this program with suid 0\n", stderr); + exit(0); + } + strcpy(path, argv[0]); + p = strrchr(path, '/'); + if (p) { + *p = '\0'; + } else { + fputs("Cannot detect the directory where this program located.\n", stderr); + exit(1); + } + + if (-1 == chdir(path)) { + fprintf(stderr, "Cannot chdir to %s\n", path); + exit(2); + } + if (0 > stat(AFTER5PATH, &st)) { + fprintf(stderr, "Cannot access %s\n", AFTER5PATH); + exit(3); + } + if (st.st_uid != euid) { + fputs("UID of cgi program mismatch\n", stderr); + fputs("Do chown so that wrapper and cgi files' uid matches.\n", stderr); + exit(4); + } + if (0 > stat(".", &st)) { + fputs("Cannot stat current directory\n", stderr); + fputs("Please ensure installed directory is readable.\n", stderr); + exit(5); + } + if (st.st_uid != euid) { + fputs("UID of directory mismatch\n", stderr); + fputs("Do chown so that wrapper and directorys' uid matches.\n", stderr); + exit(6); + } + if (st.st_mode & (S_IWGRP | S_IWOTH)) { + fputs("This directory is writable for group/others.\n", stderr); + fputs("Do chmod og-w for installed directory.\n", stderr); + exit(7); + } + execv("./after5.cgi", argv); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/after5.cgi Sun Apr 01 17:03:01 2012 +0900 @@ -0,0 +1,1 @@ +after5.rb \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/after5.css Sun Apr 01 17:03:01 2012 +0900 @@ -0,0 +1,45 @@ +body {background: ivory;} +body.personal {background: mistyrose;} +a:hover {background-color: lavender;} +.main td {width: 13%; vertical-align: top;} +.dayline {text-align: right; margin-bottom: 0; white-space: pre;} +.todayline {text-align: right; margin-bottom: 0; background: #f4d9f1; + white-space: pre;} +.dayline p {margin-top: 0;} +.sun, .holiday {background: lightpink;} +th.mon, th .mon {background: #aac9ff;} +th.tue, th .tue {background: #ffe1ce;} +th.wed, th .wed{background: #4cebff;} +th.thu, th .thu{background: #d3c2c2;} +th.fri, th .fri{background: gold;} +.sat {background: #bfefff;} +.time {background: lavender;} +.who {background: lemonchiffon; width: 10em;} +.group {background: honeydew; width: 10em;} +.monthlink {background: #c1ffc1; height: 1.4em;} /* DarkSeeGreen1 */ +.admin {background: lemonchiffon;} +.warn {color: red;} +.listup {border: 1px solid navy; margin-left: 2%; background: white; + padding: grppx;} +.topic {font-size: 90%;} +.recent {background: lavender;} /* $B:G6a$N9`L\(B */ +.c {text-align: center;} +th {background: lavender;} +h1 {text-align: center; color: blue;} +h2 {text-decoration: underline; color: #00008b; + border-top: solid thin navy; /* margin-right: 30%; */ + padding-top: 0.5ex;} +h2+p {margin-top: 0.1ex;} +.list { + background-color: khaki; + margin-left: 5%; margin-right: 5%; + border: 1px none black; + padding: 0px 1ex; +} +.screen { + background-color: #606060; color: white; + margin-left: 5%; + border: 1px none navy; + padding: 0.1ex 1ex 0.1nex 1ex; +} +.screen .u {color: cyan;}
--- a/after5.rb Sun Apr 01 05:18:57 2012 +0859 +++ b/after5.rb Sun Apr 01 17:03:01 2012 +0900 @@ -2,9 +2,10 @@ # -*- coding: euc-jp -*- # # Associative Scheduling Table - after5 -# (C)2003, 2004, 2006, 2008 by HIROSE Yuuji [yuuji@gentei.org] -# $Id: after5.rb,v 1.18 2012/04/01 05:18:57 yuuji Exp $ -# Last modified Sun Apr 1 14:17:05 2012 on firestorm +# (C)2003, 2004, 2006, 2008, 2012 by HIROSE Yuuji [yuuji@gentei.org] +# $Id: after5.rb,v 1.18 2012/04/01 05:18:57 yuuji Exp yuuji $ +# $HGid$ +# Last modified Sun Apr 1 16:41:56 2012 on firestorm # See http://www.gentei.org/~yuuji/software/after5/ # このスクリプトはEUCで保存してください。 @@ -1121,6 +1122,7 @@ 'mailerror' => ['メイルアドレスが違います', 'Invalid email address'], 'pswderror' => ['パスワードが違います', 'Password incorrect'], 'fmtdaysschedule'=> ['%s〜の予定', 'Schedule from %s'], + 'schedtable' => ['予定表', 'Schedule Table'], 'noplan' => ['登録されている予定はありません', 'No plans'], 'allday' => ['全日', 'whole day'], 'addsched' => ['新規予定項目の登録', 'Register new schedule'], @@ -2021,7 +2023,7 @@ personal = (/personal/i =~ @params['displaymode']) @params['displaydays'] = @params['displaydays'] || @cookie['displaydays'] days = @params['displaydays'].to_i - days = (days > 0 ? days : 1) + days = (days > 0 ? days : 3) # str = @sc.day_all(date, user, personal) outstr = dayTableString(user, date, days, personal) @@ -2029,6 +2031,7 @@ @O.print @H.element("h1", nil){ sprintf msg('fmtdaysschedule'), date } + @O.print @H.element("h2"){msg('schedtable')} ## @O.print @H.p() @O.print @H.elementln("form", {'action'=>@myname+"?-show+#{date}", 'method'=>'POST'}){ @H.elementln("p"){
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/holiday Sun Apr 01 17:03:01 2012 +0900 @@ -0,0 +1,18 @@ +# +# caltab - holiday table for cal.exe, 1994 +# +01/01 元日 +01/w2mon 成人の日 +02/11 建国記念の日 +03/20 春分の日 +04/29 昭和の日 +05/03 憲法記念日 +05/04 みどりの日 +05/05 こどもの日 +07/w3mon 海の日 +09/w3mon 敬老の日 +09/23 秋分の日 +10/w2mon 体育の日 +11/03 文化の日 +11/23 勤労感謝の日 +12/23 天皇誕生日