From 529b55fe61e017417faae092fe221bbd41368aa5 Mon Sep 17 00:00:00 2001 From: rich Date: Sat, 23 Oct 2004 15:00:13 +0000 Subject: [PATCH 01/16] Multiple changes and improvements to the handling of users: User preferences. User can change their email address, and it is verified. User can change their email notification status. Invite user to join is now much less of a hack. This option has moved to the front page. Don't send email notifications to non-accepting users. Administrator can see who has not yet accepted their invitations. Delete user works again. Stylesheet fixes throughout user management. In the database: Added users.invite Added pending_email_changes table. Updated MANIFEST. --- MANIFEST | 5 + Makefile.config | 4 +- cocanwiki.sql | 181 ++++++++++++++++++++------------ conf/cocanwiki.conf | 4 +- debian/changelog | 2 +- debian/control | 5 +- html/_css/users.css | 24 +---- scripts/delete_user.ml | 13 ++- scripts/edit_user.ml | 11 +- scripts/email_change.ml | 63 +++++++++++ scripts/invite_user.ml | 42 +++++--- scripts/invite_user_confirm.ml | 21 ++-- scripts/invite_user_confirm_form.ml | 30 +++--- scripts/lib/cocanwiki_emailnotify.ml | 8 +- scripts/page.ml | 7 +- scripts/user_prefs.ml | 109 +++++++++++++++++++ scripts/user_prefs_form.ml | 68 ++++++++++++ scripts/users.ml | 9 +- templates/create_user_form.html | 3 +- templates/delete_user_form.html | 3 +- templates/edit_user_form.html | 8 +- templates/invite_user.txt | 2 +- templates/invite_user_confirm_form.html | 2 +- templates/page.html | 10 +- templates/set_password_form.html | 3 +- templates/user_prefs_email_change.txt | 7 ++ templates/user_prefs_form.html | 47 +++++++++ templates/users.html | 21 ++-- 28 files changed, 533 insertions(+), 179 deletions(-) create mode 100644 scripts/email_change.ml create mode 100644 scripts/user_prefs.ml create mode 100644 scripts/user_prefs_form.ml create mode 100644 templates/user_prefs_email_change.txt create mode 100644 templates/user_prefs_form.html diff --git a/MANIFEST b/MANIFEST index 7232ac0..91fec43 100644 --- a/MANIFEST +++ b/MANIFEST @@ -103,6 +103,7 @@ scripts/edit_page_title_form.ml scripts/edit_sitemenu.ml scripts/edit_user.ml scripts/edit_user_form.ml +scripts/email_change.ml scripts/file.ml scripts/files.ml scripts/forgot_password.ml @@ -183,6 +184,8 @@ scripts/upload_file.ml scripts/upload_file_form.ml scripts/upload_image.ml scripts/upload_image_form.ml +scripts/user_prefs.ml +scripts/user_prefs_form.ml scripts/users.ml scripts/visualise_links.ml. scripts/what_links_here.ml @@ -262,6 +265,8 @@ templates/undelete_file_form.html templates/undelete_image_form.html templates/upload_file_form.html templates/upload_image_form.html +templates/user_prefs_email_change.txt +templates/user_prefs_form.html templates/users.html templates/visualise_links.html templates/what_links_here.html diff --git a/Makefile.config b/Makefile.config index 72db2a9..c757f68 100644 --- a/Makefile.config +++ b/Makefile.config @@ -1,7 +1,7 @@ -# $Id: Makefile.config,v 1.11 2004/10/22 17:18:12 rich Exp $ +# $Id: Makefile.config,v 1.12 2004/10/23 15:00:13 rich Exp $ PACKAGE := cocanwiki -VERSION := 1.3.1 +VERSION := 1.3.2 # Normally ignored. However, if you are installing centrally (using # 'make pkg-install'), then the components are installed in the diff --git a/cocanwiki.sql b/cocanwiki.sql index 0f720f3..8d20a39 100644 --- a/cocanwiki.sql +++ b/cocanwiki.sql @@ -48,7 +48,7 @@ GRANT ALL ON TABLE pages TO "www-data"; -- --- TOC entry 48 (OID 536004) +-- TOC entry 50 (OID 536004) -- Name: pages_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -81,7 +81,7 @@ GRANT ALL ON TABLE contents TO "www-data"; -- --- TOC entry 49 (OID 536021) +-- TOC entry 51 (OID 536021) -- Name: contents_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -121,7 +121,7 @@ GRANT ALL ON TABLE hosts TO "www-data"; -- --- TOC entry 50 (OID 536371) +-- TOC entry 52 (OID 536371) -- Name: hosts_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -185,7 +185,7 @@ GRANT ALL ON TABLE images TO "www-data"; -- --- TOC entry 51 (OID 537151) +-- TOC entry 53 (OID 537151) -- Name: images_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -220,7 +220,7 @@ GRANT ALL ON TABLE files TO "www-data"; -- --- TOC entry 52 (OID 537166) +-- TOC entry 54 (OID 537166) -- Name: files_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -247,7 +247,8 @@ CREATE TABLE users ( can_edit_global_css boolean DEFAULT false NOT NULL, force_password_change boolean DEFAULT false NOT NULL, can_import_mail boolean DEFAULT false NOT NULL, - email_notify boolean DEFAULT true NOT NULL + email_notify boolean DEFAULT true NOT NULL, + invite text ); @@ -261,7 +262,7 @@ GRANT ALL ON TABLE users TO "www-data"; -- --- TOC entry 53 (OID 540816) +-- TOC entry 55 (OID 540816) -- Name: users_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -334,7 +335,7 @@ GRANT ALL ON TABLE contacts TO "www-data"; -- --- TOC entry 54 (OID 542605) +-- TOC entry 56 (OID 542605) -- Name: contacts_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -499,7 +500,7 @@ GRANT SELECT ON TABLE templates TO "www-data"; -- --- TOC entry 55 (OID 547939) +-- TOC entry 57 (OID 547939) -- Name: templates_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -552,7 +553,7 @@ GRANT ALL ON TABLE messages TO "www-data"; -- --- TOC entry 56 (OID 551675) +-- TOC entry 58 (OID 551675) -- Name: messages_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -603,7 +604,29 @@ GRANT SELECT ON TABLE powered_by TO "www-data"; -- --- TOC entry 63 (OID 536388) +-- TOC entry 48 (OID 607136) +-- Name: pending_email_changes; Type: TABLE; Schema: public; Owner: rich +-- + +CREATE TABLE pending_email_changes ( + "key" text NOT NULL, + change_date date DEFAULT ('now'::text)::date NOT NULL, + userid integer NOT NULL, + email text NOT NULL +); + + +-- +-- TOC entry 49 (OID 607136) +-- Name: pending_email_changes; Type: ACL; Schema: public; Owner: rich +-- + +REVOKE ALL ON TABLE pending_email_changes FROM PUBLIC; +GRANT ALL ON TABLE pending_email_changes TO "www-data"; + + +-- +-- TOC entry 65 (OID 536388) -- Name: hostnames_hostid_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -611,7 +634,7 @@ CREATE UNIQUE INDEX hostnames_hostid_name_uq ON hostnames USING btree (hostid, n -- --- TOC entry 64 (OID 536389) +-- TOC entry 66 (OID 536389) -- Name: hostnams_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -619,7 +642,7 @@ CREATE UNIQUE INDEX hostnams_name_uq ON hostnames USING btree (name); -- --- TOC entry 60 (OID 536419) +-- TOC entry 62 (OID 536419) -- Name: pages_url_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -627,7 +650,7 @@ CREATE UNIQUE INDEX pages_url_uq ON pages USING btree (hostid, url); -- --- TOC entry 65 (OID 540251) +-- TOC entry 67 (OID 540251) -- Name: images_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -635,7 +658,7 @@ CREATE UNIQUE INDEX images_name_uq ON images USING btree (hostid, name); -- --- TOC entry 67 (OID 540252) +-- TOC entry 69 (OID 540252) -- Name: files_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -643,7 +666,7 @@ CREATE UNIQUE INDEX files_name_uq ON files USING btree (hostid, name); -- --- TOC entry 70 (OID 540831) +-- TOC entry 72 (OID 540831) -- Name: users_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -651,7 +674,7 @@ CREATE UNIQUE INDEX users_name_uq ON users USING btree (hostid, name); -- --- TOC entry 69 (OID 540946) +-- TOC entry 71 (OID 540946) -- Name: users_id_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -659,7 +682,7 @@ CREATE UNIQUE INDEX users_id_uq ON users USING btree (hostid, id); -- --- TOC entry 72 (OID 540970) +-- TOC entry 74 (OID 540970) -- Name: sitemenu_ordering_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -667,7 +690,7 @@ CREATE UNIQUE INDEX sitemenu_ordering_uq ON sitemenu USING btree (hostid, orderi -- --- TOC entry 73 (OID 540971) +-- TOC entry 75 (OID 540971) -- Name: sitemenu_url_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -675,7 +698,7 @@ CREATE UNIQUE INDEX sitemenu_url_uq ON sitemenu USING btree (hostid, url); -- --- TOC entry 76 (OID 542626) +-- TOC entry 78 (OID 542626) -- Name: contact_emails_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -683,7 +706,7 @@ CREATE UNIQUE INDEX contact_emails_uq ON contact_emails USING btree (contactid, -- --- TOC entry 77 (OID 543505) +-- TOC entry 79 (OID 543505) -- Name: themes_theme_css_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -691,7 +714,7 @@ CREATE UNIQUE INDEX themes_theme_css_uq ON themes USING btree (theme_css); -- --- TOC entry 78 (OID 543763) +-- TOC entry 80 (OID 543763) -- Name: page_emails_email_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -699,7 +722,7 @@ CREATE UNIQUE INDEX page_emails_email_uq ON page_emails USING btree (hostid, url -- --- TOC entry 79 (OID 543795) +-- TOC entry 81 (OID 543795) -- Name: mailing_lists_email_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -707,7 +730,7 @@ CREATE UNIQUE INDEX mailing_lists_email_uq ON mailing_lists USING btree (hostid, -- --- TOC entry 74 (OID 543880) +-- TOC entry 76 (OID 543880) -- Name: contacts_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -715,7 +738,7 @@ CREATE UNIQUE INDEX contacts_name_uq ON contacts USING btree (hostid, name); -- --- TOC entry 80 (OID 544454) +-- TOC entry 82 (OID 544454) -- Name: links_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -723,7 +746,7 @@ CREATE UNIQUE INDEX links_uq ON links USING btree (hostid, from_url, to_url); -- --- TOC entry 81 (OID 547951) +-- TOC entry 83 (OID 547951) -- Name: templates_ext_ord_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -731,7 +754,7 @@ CREATE UNIQUE INDEX templates_ext_ord_uq ON templates USING btree (extension, or -- --- TOC entry 83 (OID 547952) +-- TOC entry 85 (OID 547952) -- Name: templates_title_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -739,7 +762,7 @@ CREATE UNIQUE INDEX templates_title_uq ON templates USING btree (title_regexp); -- --- TOC entry 84 (OID 547953) +-- TOC entry 86 (OID 547953) -- Name: templates_url_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -747,7 +770,7 @@ CREATE UNIQUE INDEX templates_url_uq ON templates USING btree (url_regexp); -- --- TOC entry 85 (OID 551151) +-- TOC entry 87 (OID 551151) -- Name: recently_visited_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -755,7 +778,7 @@ CREATE UNIQUE INDEX recently_visited_uq ON recently_visited USING btree (userid, -- --- TOC entry 86 (OID 552155) +-- TOC entry 88 (OID 552155) -- Name: messages_inet_message_id_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -763,7 +786,7 @@ CREATE UNIQUE INDEX messages_inet_message_id_uq ON messages USING btree (hostid, -- --- TOC entry 59 (OID 552684) +-- TOC entry 61 (OID 552684) -- Name: pages_url_ix; Type: INDEX; Schema: public; Owner: rich -- @@ -771,7 +794,7 @@ CREATE INDEX pages_url_ix ON pages USING btree (url); -- --- TOC entry 58 (OID 552685) +-- TOC entry 60 (OID 552685) -- Name: pages_redirect_ix; Type: INDEX; Schema: public; Owner: rich -- @@ -779,7 +802,7 @@ CREATE INDEX pages_redirect_ix ON pages USING btree (redirect); -- --- TOC entry 57 (OID 536012) +-- TOC entry 59 (OID 536012) -- Name: pages_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -788,7 +811,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 61 (OID 536027) +-- TOC entry 63 (OID 536027) -- Name: contents_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -797,7 +820,7 @@ ALTER TABLE ONLY contents -- --- TOC entry 62 (OID 536377) +-- TOC entry 64 (OID 536377) -- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -806,7 +829,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 66 (OID 537158) +-- TOC entry 68 (OID 537158) -- Name: images_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -815,7 +838,7 @@ ALTER TABLE ONLY images -- --- TOC entry 68 (OID 537173) +-- TOC entry 70 (OID 537173) -- Name: files_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -824,7 +847,7 @@ ALTER TABLE ONLY files -- --- TOC entry 71 (OID 540825) +-- TOC entry 73 (OID 540825) -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -833,7 +856,7 @@ ALTER TABLE ONLY users -- --- TOC entry 75 (OID 542611) +-- TOC entry 77 (OID 542611) -- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -842,7 +865,7 @@ ALTER TABLE ONLY contacts -- --- TOC entry 82 (OID 547945) +-- TOC entry 84 (OID 547945) -- Name: templates_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -851,7 +874,7 @@ ALTER TABLE ONLY templates -- --- TOC entry 87 (OID 551681) +-- TOC entry 89 (OID 551681) -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -860,7 +883,7 @@ ALTER TABLE ONLY messages -- --- TOC entry 88 (OID 607081) +-- TOC entry 90 (OID 607081) -- Name: powered_by_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -869,7 +892,16 @@ ALTER TABLE ONLY powered_by -- --- TOC entry 93 (OID 536029) +-- TOC entry 91 (OID 607141) +-- Name: pending_email_changes_pkey; Type: CONSTRAINT; Schema: public; Owner: rich +-- + +ALTER TABLE ONLY pending_email_changes + ADD CONSTRAINT pending_email_changes_pkey PRIMARY KEY ("key"); + + +-- +-- TOC entry 96 (OID 536029) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -878,7 +910,7 @@ ALTER TABLE ONLY contents -- --- TOC entry 97 (OID 536384) +-- TOC entry 100 (OID 536384) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -887,7 +919,7 @@ ALTER TABLE ONLY hostnames -- --- TOC entry 94 (OID 536394) +-- TOC entry 97 (OID 536394) -- Name: hosts_hostname_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -896,7 +928,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 89 (OID 536404) +-- TOC entry 92 (OID 536404) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -905,7 +937,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 98 (OID 537160) +-- TOC entry 101 (OID 537160) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -914,7 +946,7 @@ ALTER TABLE ONLY images -- --- TOC entry 99 (OID 537175) +-- TOC entry 102 (OID 537175) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -923,7 +955,7 @@ ALTER TABLE ONLY files -- --- TOC entry 90 (OID 539155) +-- TOC entry 93 (OID 539155) -- Name: pages_redirect_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -932,7 +964,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 100 (OID 540827) +-- TOC entry 103 (OID 540827) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -941,7 +973,7 @@ ALTER TABLE ONLY users -- --- TOC entry 101 (OID 540837) +-- TOC entry 104 (OID 540837) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -950,7 +982,7 @@ ALTER TABLE ONLY usercookies -- --- TOC entry 91 (OID 540942) +-- TOC entry 94 (OID 540942) -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -959,7 +991,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 92 (OID 540947) +-- TOC entry 95 (OID 540947) -- Name: pages_user_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -968,7 +1000,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 102 (OID 540966) +-- TOC entry 105 (OID 540966) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -977,7 +1009,7 @@ ALTER TABLE ONLY sitemenu -- --- TOC entry 103 (OID 540972) +-- TOC entry 106 (OID 540972) -- Name: sitemenu_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -986,7 +1018,7 @@ ALTER TABLE ONLY sitemenu -- --- TOC entry 104 (OID 542613) +-- TOC entry 107 (OID 542613) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -995,7 +1027,7 @@ ALTER TABLE ONLY contacts -- --- TOC entry 105 (OID 542622) +-- TOC entry 108 (OID 542622) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1004,7 +1036,7 @@ ALTER TABLE ONLY contact_emails -- --- TOC entry 95 (OID 543506) +-- TOC entry 98 (OID 543506) -- Name: hosts_theme_css_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1013,7 +1045,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 106 (OID 543759) +-- TOC entry 109 (OID 543759) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1022,7 +1054,7 @@ ALTER TABLE ONLY page_emails -- --- TOC entry 107 (OID 543764) +-- TOC entry 110 (OID 543764) -- Name: page_emails_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1031,7 +1063,7 @@ ALTER TABLE ONLY page_emails -- --- TOC entry 108 (OID 543791) +-- TOC entry 111 (OID 543791) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1040,7 +1072,7 @@ ALTER TABLE ONLY mailing_lists -- --- TOC entry 109 (OID 544450) +-- TOC entry 112 (OID 544450) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1049,7 +1081,7 @@ ALTER TABLE ONLY links -- --- TOC entry 110 (OID 544455) +-- TOC entry 113 (OID 544455) -- Name: links_from_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1058,7 +1090,7 @@ ALTER TABLE ONLY links -- --- TOC entry 111 (OID 551129) +-- TOC entry 114 (OID 551129) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1067,7 +1099,7 @@ ALTER TABLE ONLY recently_visited -- --- TOC entry 112 (OID 551133) +-- TOC entry 115 (OID 551133) -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1076,7 +1108,7 @@ ALTER TABLE ONLY recently_visited -- --- TOC entry 113 (OID 551137) +-- TOC entry 116 (OID 551137) -- Name: recently_visited_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1085,7 +1117,7 @@ ALTER TABLE ONLY recently_visited -- --- TOC entry 114 (OID 551141) +-- TOC entry 117 (OID 551141) -- Name: recently_visited_userid_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1094,7 +1126,7 @@ ALTER TABLE ONLY recently_visited -- --- TOC entry 116 (OID 551690) +-- TOC entry 119 (OID 551690) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1103,7 +1135,7 @@ ALTER TABLE ONLY msg_references -- --- TOC entry 115 (OID 551694) +-- TOC entry 118 (OID 551694) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1112,7 +1144,7 @@ ALTER TABLE ONLY messages -- --- TOC entry 96 (OID 607083) +-- TOC entry 99 (OID 607083) -- Name: hosts_powered_by_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1121,6 +1153,15 @@ ALTER TABLE ONLY hosts -- +-- TOC entry 120 (OID 607143) +-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich +-- + +ALTER TABLE ONLY pending_email_changes + ADD CONSTRAINT "$1" FOREIGN KEY (userid) REFERENCES users(id); + + +-- -- TOC entry 3 (OID 2200) -- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres -- diff --git a/conf/cocanwiki.conf b/conf/cocanwiki.conf index 874a94b..a46300a 100644 --- a/conf/cocanwiki.conf +++ b/conf/cocanwiki.conf @@ -1,5 +1,5 @@ # Apache configuration for COCANWIKI. -# $Id: cocanwiki.conf,v 1.15 2004/10/18 13:34:21 rich Exp $ +# $Id: cocanwiki.conf,v 1.16 2004/10/23 15:00:14 rich Exp $ # Uncomment the following lines if necessary. You will probably need # to adjust the paths to reflect where cocanwiki is really installed. @@ -54,6 +54,7 @@ RewriteRule ^/robots.txt /robots.txt [PT,L] # Global scripts. RewriteRule ^/_admin$ /_bin/admin/admin.cmo [PT,L,QSA] RewriteRule ^/_contact$ /_bin/contact.cmo [PT,L,QSA] +RewriteRule ^/_email_change$ /_bin/email_change.cmo [PT,L,QSA] RewriteRule ^/_files$ /_bin/files.cmo [PT,L,QSA] RewriteRule ^/_global.css$ /_bin/hoststyle.cmo [PT,L,QSA] RewriteRule ^/_images$ /_bin/images.cmo [PT,L,QSA] @@ -67,6 +68,7 @@ RewriteRule ^/_pe_confirm$ /_bin/page_email_confirm.cmo [PT,L,QSA] RewriteRule ^/_pe_unsub$ /_bin/page_email_unsubscribe.cmo [PT,L,QSA] RewriteRule ^/_recent$ /_bin/recent.cmo [PT,L,QSA] RewriteRule ^/_sitemap$ /_bin/sitemap.cmo [PT,L,QSA] +RewriteRule ^/_userprefs$ /_bin/user_prefs_form.cmo [PT,L,QSA] RewriteRule ^/_users$ /_bin/users.cmo [PT,L,QSA] # Image and file downloads. diff --git a/debian/changelog b/debian/changelog index 94107c1..7890726 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cocanwiki (1.3.1-1) unstable; urgency=low +cocanwiki (1.3.2-1) unstable; urgency=low * Initial Release. diff --git a/debian/control b/debian/control index 6036d0e..3eef237 100644 --- a/debian/control +++ b/debian/control @@ -1,14 +1,15 @@ Source: cocanwiki Priority: optional Maintainer: Richard W.M. Jones -Build-Depends: debhelper (>= 4.0.0), libpcre-ocaml-dev, libpgsql-ocaml-dev, libextlib-ocaml-dev, ocaml-findlib, ocaml-nox-3.08, libapache-mod-caml, libtemplate-ocaml-dev, ocamldsort (>= 0.14.2) +Build-Depends: debhelper (>= 4.0.0), libpcre-ocaml-dev, libpgsql-ocaml-dev, libextlib-ocaml-dev, ocaml-findlib, ocaml-nox-3.08, libapache-mod-caml (>= 1.3.2), libtemplate-ocaml-dev (>= 1.3.2), ocamldsort (>= 0.14.2) Standards-Version: 3.6.1 Package: cocanwiki Section: web Architecture: all Depends: libpgsql-ocaml, libdbi-ocaml (>= 0.9.9), libpcre-ocaml, - ocaml-base-nox-3.08, libapache-mod-caml, libtemplate-ocaml-dev, + ocaml-base-nox-3.08, libapache-mod-caml (>= 1.3.2), + libtemplate-ocaml-dev (>= 1.3.2), libocamlnet-ocaml-dev (>= 0.98), imagemagick, curl (>= 7.12.1) Suggests: apache diff --git a/html/_css/users.css b/html/_css/users.css index 28e1a3d..8235c30 100644 --- a/html/_css/users.css +++ b/html/_css/users.css @@ -1,24 +1,8 @@ /* Stylesheet for COCANWIKI, derived from EWM. - * $Id: users.css,v 1.3 2004/09/08 12:45:37 rich Exp $ + * $Id: users.css,v 1.4 2004/10/23 15:00:14 rich Exp $ */ -table#users { - border-collapse: collapse; -} - -table#users th { - border: 1px solid #000; - vertical-align: top; - text-align: center; - padding: 6px; -} - -table#users td { - border: 1px solid #eee; - padding: 6px; -} - -table#edit_user th { - vertical-align: top; - text-align: right; +span.pending { + font-weight: bold; + color: #f00; } diff --git a/scripts/delete_user.ml b/scripts/delete_user.ml index ab2b8a4..469e45c 100644 --- a/scripts/delete_user.ml +++ b/scripts/delete_user.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: delete_user.ml,v 1.2 2004/09/23 11:56:47 rich Exp $ + * $Id: delete_user.ml,v 1.3 2004/10/23 15:00:14 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,6 +55,17 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} self = | _ -> () in (* Delete the user. *) + let sth = + dbh#prepare_cached "delete from recently_visited + where userid = ? and hostid = ?" in + sth#execute [`Int userid; `Int hostid]; + + let sth = + dbh#prepare_cached "delete from pending_email_changes + where userid = ?" in + sth#execute [`Int userid]; + + let sth = dbh#prepare_cached "delete from usercookies where userid = ?" in sth#execute [`Int userid]; diff --git a/scripts/edit_user.ml b/scripts/edit_user.ml index 2f861c7..234c5a6 100644 --- a/scripts/edit_user.ml +++ b/scripts/edit_user.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: edit_user.ml,v 1.7 2004/10/11 14:13:04 rich Exp $ + * $Id: edit_user.ml,v 1.8 2004/10/23 15:00:14 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -66,10 +66,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ self = sth#execute [`String name; `Int hostid; `Int userid] ); - (* Change email address and permissions. *) - let email = trim (q#param "email") in - let email = if email = "" then `Null else `String email in - + (* Change permissions. *) let can_edit = q#param_true "can_edit" in let can_manage_users = q#param_true "can_manage_users" in let can_manage_contacts = q#param_true "can_manage_contacts" in @@ -87,14 +84,14 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ self = return () | _ -> ()); - let sth = dbh#prepare_cached "update users set email = ?, + let sth = dbh#prepare_cached "update users set can_edit = ?, can_manage_users = ?, can_manage_contacts = ?, can_manage_site = ?, can_edit_global_css = ?, can_import_mail = ? where hostid = ? and id = ?" in - sth#execute [email; `Bool can_edit; `Bool can_manage_users; + sth#execute [`Bool can_edit; `Bool can_manage_users; `Bool can_manage_contacts; `Bool can_manage_site; `Bool can_edit_global_css; `Bool can_import_mail; `Int hostid; `Int userid]; diff --git a/scripts/email_change.ml b/scripts/email_change.ml new file mode 100644 index 0000000..702bee8 --- /dev/null +++ b/scripts/email_change.ml @@ -0,0 +1,63 @@ +(* COCANWIKI - a wiki written in Objective CAML. + * Written by Richard W.M. Jones . + * Copyright (C) 2004 Merjis Ltd. + * $Id: email_change.ml,v 1.1 2004/10/23 15:00:14 rich Exp $ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + *) + +open Apache +open Registry +open Cgi +open Printf + +open Cocanwiki +open Cocanwiki_ok + +let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = + (* Get the key in the pending_email_changes table. *) + let key = q#param "key" in + + let sth = dbh#prepare_cached "select userid, email from pending_email_changes + where key = ?" in + sth#execute [`String key]; + + let userid, email = + try + (match sth#fetch1 () with + [ `Int userid; `String email ] -> userid, email + | _ -> assert false) + with + Not_found -> + error ~title:"Already verified" + q ("It looks like you have already verified this email address."); + return () in + + (* Update the database. *) + let sth = dbh#prepare_cached "delete from pending_email_changes + where key = ?" in + sth#execute [`String key]; + + let sth = dbh#prepare_cached "update users set email = ? where id = ?" in + sth#execute [`String email; `Int userid]; + + dbh#commit (); + + ok ~title:"Email address verified" + q "Thank you for verifying your new email address." + +let () = + register_script run diff --git a/scripts/invite_user.ml b/scripts/invite_user.ml index a2d3bab..bca130f 100644 --- a/scripts/invite_user.ml +++ b/scripts/invite_user.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: invite_user.ml,v 1.1 2004/10/14 15:57:15 rich Exp $ + * $Id: invite_user.ml,v 1.2 2004/10/23 15:00:15 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -68,32 +68,40 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = *) List.iter (fun email -> - let sth = dbh#prepare_cached "select id from users + let sth = dbh#prepare_cached "select id, invite from users where hostid = ? and (email = ? or name = ?)" in sth#execute [`Int hostid; `String email; `String email]; - let userid = try Some (sth#fetch1int ()) with Not_found -> None in - let body = - match userid with - Some userid -> - (* Existing user account - send reminder. *) - template_exists#set "username" username; - template_exists#set "hostname" hostname; - template_exists#to_string - - | None -> + try + (match sth#fetch1 () with + [ `Int userid; `Null ] -> + (* Existing user account - send reminder. *) + template_exists#set "username" username; + template_exists#set "hostname" hostname; + template_exists#to_string + + | [ `Int userid; `String invite ] -> + (* Existing user account - resend the invite. *) + template#set "username" username; + template#set "hostname" hostname; + template#set "invite" invite; + template#to_string + + | _ -> assert false) + with + Not_found -> (* Add user account. *) - let password = random_sessionid () in + let invite = random_sessionid () in let sth = dbh#prepare_cached "insert into users (hostid, name, - password, email) values (?, ?, ?, ?)" in - sth#execute [`Int hostid; `String email; `String password; - `String email]; + password, email, invite) values (?, ?, ?, ?, ?)" in + sth#execute [`Int hostid; `String email; `String invite; + `String email; `String invite]; template#set "username" username; template#set "hostname" hostname; - template#set "password" password; + template#set "invite" invite; template#to_string in (* Send the email. *) diff --git a/scripts/invite_user_confirm.ml b/scripts/invite_user_confirm.ml index 3f45c34..45374c5 100644 --- a/scripts/invite_user_confirm.ml +++ b/scripts/invite_user_confirm.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: invite_user_confirm.ml,v 1.1 2004/10/14 15:57:15 rich Exp $ + * $Id: invite_user_confirm.ml,v 1.2 2004/10/23 15:00:15 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,16 +33,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = let template = _get_template "invite_user_confirm.txt" in let username = q#param "username" in - let old_password = q#param "old_password" in + let invite = q#param "invite" in - assert (String.length old_password = 32 && - string_for_all isxdigit old_password); - - (* Verify the username, old_password combination. *) + (* Verify the username, invite combination. *) let sth = dbh#prepare_cached "select email, id from users where hostid = ? and - name = ? and password = ?" in - sth#execute [`Int hostid; `String username; `String old_password]; + name = ? and invite = ?" in + sth#execute [`Int hostid; `String username; `String invite]; let email, userid = try @@ -51,9 +48,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = | [ `Null; `Int userid ] -> None, userid | _ -> assert false with Not_found -> - error ~title:"Bad password" - ~back_button:true - q "The password you gave is wrong."; + error ~title:"Already signed up" + q "It looks like you have already used your invitation."; return () in let password1 = q#param "password1" in @@ -76,7 +72,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = (* Change the password. *) let sth = dbh#prepare_cached - "update users set password = ?, force_password_change = false + "update users set password = ?, invite = null, + force_password_change = false where hostid = ? and id = ?" in sth#execute [`String password; `Int hostid; `Int userid]; diff --git a/scripts/invite_user_confirm_form.ml b/scripts/invite_user_confirm_form.ml index 93e6dd8..a61726d 100644 --- a/scripts/invite_user_confirm_form.ml +++ b/scripts/invite_user_confirm_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: invite_user_confirm_form.ml,v 1.1 2004/10/14 15:57:15 rich Exp $ + * $Id: invite_user_confirm_form.ml,v 1.2 2004/10/23 15:00:15 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,28 +27,30 @@ open Printf open Cocanwiki open Cocanwiki_ok open Cocanwiki_template -open Cocanwiki_strings let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = let template = get_template dbh hostid "invite_user_confirm_form.html" in - (* Get the password. It's supposed to be unique so we can look up the - * user by this. Do a bit of sanity checking on it, however, to make - * sure we can't just use it to search for passwords, or some other type - * of strange exploit. - *) - let password = q#param "p" in - assert (String.length password = 32 && string_for_all isxdigit password); + (* Get the invite ID. *) + let invite = q#param "p" in let sth = dbh#prepare_cached "select name from users - where hostid = ? and password = ?" in - sth#execute [`Int hostid; `String password]; - - let username = sth#fetch1string () in + where hostid = ? and invite = ?" in + sth#execute [`Int hostid; `String invite]; + + let username = + try sth#fetch1string () + with + Not_found -> + error ~title:"Already signed up" + q ("It looks like you have already used your invitation. If " ^ + "you cannot get to your account, please contact the " ^ + "administrator."); + return () in (* Update the template so that the user can set their preferred password. *) template#set "username" username; - template#set "old_password" password; + template#set "invite" invite; q#template template diff --git a/scripts/lib/cocanwiki_emailnotify.ml b/scripts/lib/cocanwiki_emailnotify.ml index 648a746..07e7597 100644 --- a/scripts/lib/cocanwiki_emailnotify.ml +++ b/scripts/lib/cocanwiki_emailnotify.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: cocanwiki_emailnotify.ml,v 1.2 2004/10/21 19:54:29 rich Exp $ + * $Id: cocanwiki_emailnotify.ml,v 1.3 2004/10/23 15:00:16 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,11 +43,13 @@ let email_notify ~subject ~body ?user (dbh : Dbi.connection) hostid = (* Send a change email to everyone who hasn't opted out using * their preferences. This behaviour replaces the old - * 'email_notify' table. + * 'email_notify' table. Don't send email to invited accounts + * who have not yet confirmed. *) let sth = dbh#prepare_cached "select email, name from users where hostid = ? and id <> ? and email_notify - and email is not null" in + and email is not null + and invite is null" in sth#execute [`Int hostid; `Int own_userid]; let to_addr = sth#map (function diff --git a/scripts/page.ml b/scripts/page.ml index 496efe8..bf3fd30 100644 --- a/scripts/page.ml +++ b/scripts/page.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: page.ml,v 1.35 2004/10/23 12:00:23 rich Exp $ + * $Id: page.ml,v 1.36 2004/10/23 15:00:15 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -76,8 +76,9 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid navigation | _ -> assert false in - (* Can the user edit? *) + (* User permissions. *) let can_edit = can_edit host user in + let can_manage_users = can_manage_users host user in (* Do we have a stats page set up? *) let has_stats = server_settings_stats_page dbh <> None in @@ -198,6 +199,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid t#conditional "navigation" navigation; t#conditional "can_edit" can_edit; + t#conditional "can_manage_users" can_manage_users; t#conditional "has_stats" has_stats; (* Pull out the sections in this page. *) @@ -376,6 +378,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid t#conditional "has_host_css" has_host_css; t#conditional "can_edit" can_edit; + t#conditional "can_manage_users" can_manage_users; t#conditional "has_stats" has_stats; q#template t diff --git a/scripts/user_prefs.ml b/scripts/user_prefs.ml new file mode 100644 index 0000000..41d2f9d --- /dev/null +++ b/scripts/user_prefs.ml @@ -0,0 +1,109 @@ +(* COCANWIKI - a wiki written in Objective CAML. + * Written by Richard W.M. Jones . + * Copyright (C) 2004 Merjis Ltd. + * $Id: user_prefs.ml,v 1.1 2004/10/23 15:00:16 rich Exp $ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + *) + +open Apache +open Registry +open Cgi +open Printf + +open Cocanwiki +open Cocanwiki_ok +open Cocanwiki_template +open Cocanwiki_strings + +let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname=hostname} user = + let email_change_template = _get_template "user_prefs_email_change.txt" in + + (* Get the fields. *) + let new_email = trim (q#param "email") in + let email_notify = q#param_true "email_notify" in + + let userid = + match user with + Anonymous -> assert false + | User (userid, _, _) -> userid in + + (* Update the email notify field. *) + let sth = + dbh#prepare_cached "update users set email_notify = ? + where hostid = ? and id = ?" in + sth#execute [`Bool email_notify; `Int hostid; `Int userid]; + + (* Have we changed the email address? *) + let confirm_needed = + if new_email = "" then ( + (* Set the email field in the database to null. No need for + * any confirmation. + *) + let sth = dbh#prepare_cached "update users set email = null + where hostid = ? and id = ?" in + sth#execute [`Int hostid; `Int userid]; + + false + ) else ( + (* Is the new email address different from the one currently recorded + * in the database? + *) + let sth = dbh#prepare_cached "select ? = coalesce (email, '') + from users where hostid = ? and id = ?" in + sth#execute [`Int hostid; `Int userid]; + + let changed = + match sth#fetch1 () with [ `Bool b ] -> b | _ -> assert false in + + if changed then ( + let key = random_sessionid () in + (* Changed, so we add to the pending_email_changes table. *) + let sth = dbh#prepare_cached "insert into pending_email_changes + (key, userid, email) values (?, ?, ?)" in + sth#execute [`String key; `Int userid; `String new_email]; + + (* Send the confirm email. *) + email_change_template#set "hostname" hostname; + email_change_template#set "key" key; + let body = email_change_template#to_string in + + let subject = "Please verify your new email address at " ^ hostname in + Sendmail.send_mail ~subject ~to_addr:[new_email] ~body () + ); + + changed + ) in + + (* Good place to remove old rows in the pending_email_changes table. *) + let sth = dbh#prepare_cached "delete from pending_email_changes + where change_date - current_date > 7" in + sth#execute []; + + (* Commit and finish off. *) + dbh#commit (); + + ok ~title:"Preferences updated" + q ("Your user preferences were updated. " ^ + if confirm_needed then + ("Because you changed your email address, we have sent a " ^ + "confirmation email to your new address. You will need to " ^ + "click on the link in that email to verify your new address.") + else + "") + +let () = + register_script ~anonymous:false run diff --git a/scripts/user_prefs_form.ml b/scripts/user_prefs_form.ml new file mode 100644 index 0000000..c346f17 --- /dev/null +++ b/scripts/user_prefs_form.ml @@ -0,0 +1,68 @@ +(* COCANWIKI - a wiki written in Objective CAML. + * Written by Richard W.M. Jones . + * Copyright (C) 2004 Merjis Ltd. + * $Id: user_prefs_form.ml,v 1.1 2004/10/23 15:00:16 rich Exp $ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + *) + +open Apache +open Registry +open Cgi +open Printf + +open Cocanwiki +open Cocanwiki_template +open Cocanwiki_date + +let run r (q : cgi) (dbh : Dbi.connection) hostid _ user = + let template = get_template dbh hostid "user_prefs_form.html" in + + let userid = + match user with + | Anonymous -> assert false + | User (userid, _, _) -> userid in + + (* Pull out the preferences. *) + let sth = + dbh#prepare_cached + "select name, email, registration_date, can_edit, email_notify + from users where hostid = ? and id = ?" in + sth#execute [`Int hostid; `Int userid]; + + let name, email, has_email, registration_date, can_edit, email_notify = + match sth#fetch1 () with + [ `String name; (`Null | `String _) as email; + `Date registration_date; `Bool can_edit; `Bool email_notify ] -> + let email, has_email = + match email with + `Null -> "", false + | `String email -> email, true in + name, email, has_email, registration_date, + can_edit, email_notify + | _ -> assert false in + + template#set "name" name; + template#set "email" email; + template#conditional "has_email" has_email; + template#set "registration_date" (printable_date' registration_date); + template#conditional "can_edit" can_edit; + template#conditional "email_notify" email_notify; + + q#template template + +let () = + register_script ~anonymous:false run diff --git a/scripts/users.ml b/scripts/users.ml index b16d817..5af40e5 100644 --- a/scripts/users.ml +++ b/scripts/users.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: users.ml,v 1.7 2004/10/11 14:13:04 rich Exp $ + * $Id: users.ml,v 1.8 2004/10/23 15:00:16 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,7 +33,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = let sth = dbh#prepare_cached - "select id, name, email, registration_date, can_edit, can_manage_users, + "select id, name, email, registration_date, invite is not null, + can_edit, can_manage_users, can_manage_contacts, can_manage_site, can_edit_global_css, can_import_mail from users where hostid = ? order by name" in @@ -43,7 +44,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = sth#map (function [`Int userid; `String name; (`Null | `String _) as email; - `Date registration_date; + `Date registration_date; `Bool invite_pending; `Bool can_edit; `Bool can_manage_users; `Bool can_manage_contacts; `Bool can_manage_site; `Bool can_edit_global_css; `Bool can_import_mail] -> @@ -53,6 +54,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = "email", Template.VarString email; "registration_date", Template.VarString (printable_date' registration_date); + "invite_pending", + Template.VarConditional invite_pending; "can_edit", Template.VarConditional can_edit; "can_manage_users", Template.VarConditional can_manage_users; "can_manage_contacts", diff --git a/templates/create_user_form.html b/templates/create_user_form.html index 1231dbf..9e6ce17 100644 --- a/templates/create_user_form.html +++ b/templates/create_user_form.html @@ -5,13 +5,12 @@ -

Create a user account

- +
diff --git a/templates/delete_user_form.html b/templates/delete_user_form.html index 2776f9c..dafd850 100644 --- a/templates/delete_user_form.html +++ b/templates/delete_user_form.html @@ -5,7 +5,6 @@ -

Delete user: ::username_html::

@@ -14,7 +13,7 @@ Are you sure you want to delete this user?

-
Username:
+
diff --git a/templates/edit_user_form.html b/templates/edit_user_form.html index 14c9a5a..cd02152 100644 --- a/templates/edit_user_form.html +++ b/templates/edit_user_form.html @@ -3,8 +3,8 @@ User: ::name_html:: - - + +

User: ::name_html::

@@ -18,7 +18,7 @@ -
Username: ::username_html::
+
@@ -26,7 +26,7 @@ - + diff --git a/templates/invite_user.txt b/templates/invite_user.txt index 9a7f58a..4001b53 100644 --- a/templates/invite_user.txt +++ b/templates/invite_user.txt @@ -3,4 +3,4 @@ To accept this invitation, click here: -http://::hostname::/_invite?p=::password:: \ No newline at end of file +http://::hostname::/_invite?p=::invite:: \ No newline at end of file diff --git a/templates/invite_user_confirm_form.html b/templates/invite_user_confirm_form.html index 36c659e..7b6af52 100644 --- a/templates/invite_user_confirm_form.html +++ b/templates/invite_user_confirm_form.html @@ -16,7 +16,7 @@ Please choose a password for your account: - +
Username:
Email: ::email_html::
Permissions:
diff --git a/templates/page.html b/templates/page.html index c15b307..c1cd142 100644 --- a/templates/page.html +++ b/templates/page.html @@ -62,7 +62,7 @@ diff --git a/templates/set_password_form.html b/templates/set_password_form.html index 3e1558e..65f1107 100644 --- a/templates/set_password_form.html +++ b/templates/set_password_form.html @@ -5,14 +5,13 @@ -

Set password for this user

-
Username:
+
diff --git a/templates/user_prefs_email_change.txt b/templates/user_prefs_email_change.txt new file mode 100644 index 0000000..92bf7c3 --- /dev/null +++ b/templates/user_prefs_email_change.txt @@ -0,0 +1,7 @@ +You (or someone claiming to be you) requested a change of email +address at ::hostname::. + +To proceed with this change of email address, please verify by +clicking on the link below: + +http://::hostname::/_email_change?key=::invite:: \ No newline at end of file diff --git a/templates/user_prefs_form.html b/templates/user_prefs_form.html new file mode 100644 index 0000000..ee204a6 --- /dev/null +++ b/templates/user_prefs_form.html @@ -0,0 +1,47 @@ + + + +Your preferences + + + + + +

Your preferences

+ + +
Username:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Username: ::name_html::
Password: Change your password ...
Email address:
User since: ::registration_date_html::
Edit permission: ::if(can_edit)::Yes::else::No::end::
+
+ +::include(footer.html):: + + \ No newline at end of file diff --git a/templates/users.html b/templates/users.html index 420f5cb..39ab050 100644 --- a/templates/users.html +++ b/templates/users.html @@ -15,10 +15,9 @@
  • Create a user account
  • - +
    - - + @@ -33,9 +32,13 @@ ::table(users):: - - - + + @@ -44,9 +47,13 @@ ::end:: -
    Username Email address Username, email address Registration Permissions
    ::name_html:: ::email_html:: ::registration_date_html:: + ::name_html::
    + ::email_html:: +
    + ::registration_date_html::::if(invite_pending)::*::end:: + ::if(can_edit)::Can edit::end:: ::if(can_manage_users)::Can manage users::end:: ::if(can_manage_contacts)::Can manage contacts::end:: ::if(can_import_mail)::Can import mail::end::
    +

    +* User has been invited, but has not yet +accepted the invitation. +

    +

    Explanation of permissions

    -- 1.8.3.1 From 7c61259403b6ecfad9d7924f319bb9dc3d252e17 Mon Sep 17 00:00:00 2001 From: rich Date: Sat, 23 Oct 2004 15:05:07 +0000 Subject: [PATCH 02/16] Fixed a few bugs in the previous check-in. Updated deps. --- scripts/.depend | 22 ++++++++++++++-------- scripts/user_prefs.ml | 9 +++++---- templates/user_prefs_email_change.txt | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/scripts/.depend b/scripts/.depend index 6f9188f..ae973c3 100644 --- a/scripts/.depend +++ b/scripts/.depend @@ -4,6 +4,8 @@ lib/cocanwiki_create_host.cmo: lib/cocanwiki_create_host.cmi lib/cocanwiki_create_host.cmx: lib/cocanwiki_create_host.cmi lib/cocanwiki_diff.cmo: lib/cocanwiki_files.cmo lib/cocanwiki_diff.cmx: lib/cocanwiki_files.cmx +lib/cocanwiki_emailnotify.cmo: lib/cocanwiki.cmo +lib/cocanwiki_emailnotify.cmx: lib/cocanwiki.cmx lib/cocanwiki_ext_calendar.cmo: lib/cocanwiki.cmo lib/cocanwiki_date.cmo \ lib/cocanwiki_strings.cmo lib/cocanwiki_template.cmi lib/cocanwiki_ext_calendar.cmx: lib/cocanwiki.cmx lib/cocanwiki_date.cmx \ @@ -140,6 +142,8 @@ edit_user_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_date.cmo \ lib/cocanwiki_template.cmi edit_user_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_date.cmx \ lib/cocanwiki_template.cmx +email_change.cmo: lib/cocanwiki.cmo lib/cocanwiki_ok.cmo +email_change.cmx: lib/cocanwiki.cmx lib/cocanwiki_ok.cmx file.cmo: lib/cocanwiki.cmo file.cmx: lib/cocanwiki.cmx files.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi @@ -171,9 +175,9 @@ invite_user_confirm.cmo: lib/cocanwiki.cmo lib/cocanwiki_ok.cmo \ invite_user_confirm.cmx: lib/cocanwiki.cmx lib/cocanwiki_ok.cmx \ lib/cocanwiki_strings.cmx lib/cocanwiki_template.cmx invite_user_confirm_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_ok.cmo \ - lib/cocanwiki_strings.cmo lib/cocanwiki_template.cmi + lib/cocanwiki_template.cmi invite_user_confirm_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_ok.cmx \ - lib/cocanwiki_strings.cmx lib/cocanwiki_template.cmx + lib/cocanwiki_template.cmx invite_user_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi invite_user_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_template.cmx largest_pages.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi @@ -304,6 +308,14 @@ upload_image.cmx: lib/cocanwiki.cmx lib/cocanwiki_emailnotify.cmx \ lib/cocanwiki_images.cmx lib/cocanwiki_ok.cmx upload_image_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi upload_image_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_template.cmx +user_prefs.cmo: lib/cocanwiki.cmo lib/cocanwiki_ok.cmo \ + lib/cocanwiki_strings.cmo lib/cocanwiki_template.cmi +user_prefs.cmx: lib/cocanwiki.cmx lib/cocanwiki_ok.cmx \ + lib/cocanwiki_strings.cmx lib/cocanwiki_template.cmx +user_prefs_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_date.cmo \ + lib/cocanwiki_template.cmi +user_prefs_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_date.cmx \ + lib/cocanwiki_template.cmx users.cmo: lib/cocanwiki.cmo lib/cocanwiki_date.cmo \ lib/cocanwiki_template.cmi users.cmx: lib/cocanwiki.cmx lib/cocanwiki_date.cmx \ @@ -322,12 +334,6 @@ admin/create_host.cmx: lib/cocanwiki.cmx lib/cocanwiki_create_host.cmx \ lib/cocanwiki_ok.cmx lib/cocanwiki_strings.cmx admin/create_host_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi admin/create_host_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_template.cmx -admin/edit_emails.cmo: lib/cocanwiki.cmo lib/cocanwiki_ok.cmo \ - lib/cocanwiki_strings.cmo -admin/edit_emails.cmx: lib/cocanwiki.cmx lib/cocanwiki_ok.cmx \ - lib/cocanwiki_strings.cmx -admin/edit_emails_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi -admin/edit_emails_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_template.cmx admin/edit_host_css.cmo: lib/cocanwiki.cmo lib/cocanwiki_ok.cmo \ lib/cocanwiki_strings.cmo admin/edit_host_css.cmx: lib/cocanwiki.cmx lib/cocanwiki_ok.cmx \ diff --git a/scripts/user_prefs.ml b/scripts/user_prefs.ml index 41d2f9d..3c1f713 100644 --- a/scripts/user_prefs.ml +++ b/scripts/user_prefs.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: user_prefs.ml,v 1.1 2004/10/23 15:00:16 rich Exp $ + * $Id: user_prefs.ml,v 1.2 2004/10/23 15:05:07 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,9 +62,9 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname=hostname} user = (* Is the new email address different from the one currently recorded * in the database? *) - let sth = dbh#prepare_cached "select ? = coalesce (email, '') + let sth = dbh#prepare_cached "select ? <> coalesce (email, '') from users where hostid = ? and id = ?" in - sth#execute [`Int hostid; `Int userid]; + sth#execute [`String new_email; `Int hostid; `Int userid]; let changed = match sth#fetch1 () with [ `Bool b ] -> b | _ -> assert false in @@ -96,7 +96,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname=hostname} user = (* Commit and finish off. *) dbh#commit (); - ok ~title:"Preferences updated" + let buttons = [ ok_button "/_userprefs" ] in + ok ~title:"Preferences updated" ~buttons q ("Your user preferences were updated. " ^ if confirm_needed then ("Because you changed your email address, we have sent a " ^ diff --git a/templates/user_prefs_email_change.txt b/templates/user_prefs_email_change.txt index 92bf7c3..4fbc01f 100644 --- a/templates/user_prefs_email_change.txt +++ b/templates/user_prefs_email_change.txt @@ -4,4 +4,4 @@ address at ::hostname::. To proceed with this change of email address, please verify by clicking on the link below: -http://::hostname::/_email_change?key=::invite:: \ No newline at end of file +http://::hostname::/_email_change?key=::key:: \ No newline at end of file -- 1.8.3.1 From ae2b49ecd15143bb99835f227a08fc49d35f59b9 Mon Sep 17 00:00:00 2001 From: rich Date: Sat, 23 Oct 2004 16:34:57 +0000 Subject: [PATCH 03/16] Fixed some annoying showstopper bugs with stats: * Stats top frame now has styling so you can actually see the buttons. * Redirect to the canonical_hostname page, so we actually go to the right place. Updated MANIFEST. Bumped version for release. --- MANIFEST | 1 + debian/changelog | 2 +- html/_css/stats_top.css | 25 +++++++++++++++++++++++++ scripts/stats.ml | 7 ++++--- scripts/stats_top.ml | 7 ++++--- templates/stats.html | 4 ++-- templates/stats_top.html | 3 +-- 7 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 html/_css/stats_top.css diff --git a/MANIFEST b/MANIFEST index 91fec43..86bdce6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -23,6 +23,7 @@ html/_css/login.css html/_css/markup.css html/_css/print.css html/_css/standard.css +html/_css/stats.css html/_css/tables.css html/_css/users.css html/_css/visualise_links.css diff --git a/debian/changelog b/debian/changelog index 7890726..8470276 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cocanwiki (1.3.2-1) unstable; urgency=low +cocanwiki (1.3.2-2) unstable; urgency=low * Initial Release. diff --git a/html/_css/stats_top.css b/html/_css/stats_top.css new file mode 100644 index 0000000..d0feb76 --- /dev/null +++ b/html/_css/stats_top.css @@ -0,0 +1,25 @@ +/* $Id: stats_top.css,v 1.1 2004/10/23 16:34:58 rich Exp $ */ + +body { + background: #fff; + color: #000; + font-family: trebuchet ms, palatino, georgia, arial, helvetica, sans-serif; +} + +/* Menus. */ +ul.menu { + padding: 0px; + margin-left: 1em; + list-style: none; +} + +ul.menu li { + display: inline; + border-left: 1px solid #666; + padding-left: 5px; +} + +ul.menu li.first { + border-left: none; + padding-left: 0px; +} diff --git a/scripts/stats.ml b/scripts/stats.ml index 3d29afb..1369474 100644 --- a/scripts/stats.ml +++ b/scripts/stats.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: stats.ml,v 1.2 2004/10/07 16:54:24 rich Exp $ + * $Id: stats.ml,v 1.3 2004/10/23 16:34:58 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,8 @@ open Cocanwiki open Cocanwiki_template open Cocanwiki_server_settings -let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = +let run r (q : cgi) (dbh : Dbi.connection) hostid + { canonical_hostname = canonical_hostname } _ = let template = get_template dbh hostid "stats.html" in let page = q#param "page" in @@ -64,7 +65,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = template#set "page" page; template#set "url" url; template#set "hash" h; - template#set "hostname" hostname; + template#set "hostname" canonical_hostname; q#template template diff --git a/scripts/stats_top.ml b/scripts/stats_top.ml index 48ddea9..cf16da4 100644 --- a/scripts/stats_top.ml +++ b/scripts/stats_top.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: stats_top.ml,v 1.1 2004/09/23 15:16:21 rich Exp $ + * $Id: stats_top.ml,v 1.2 2004/10/23 16:34:58 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +28,8 @@ open Cocanwiki open Cocanwiki_template open Cocanwiki_server_settings -let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = +let run r (q : cgi) (dbh : Dbi.connection) hostid + { canonical_hostname = canonical_hostname } _ = let template = get_template dbh hostid "stats_top.html" in let page = q#param "page" in @@ -40,7 +41,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = | Some s -> s in template#set "stats_page" stats_page; - template#set "hostname" hostname; + template#set "hostname" canonical_hostname; template#set "page" page; q#template template diff --git a/templates/stats.html b/templates/stats.html index dc39df1..13d5ca0 100644 --- a/templates/stats.html +++ b/templates/stats.html @@ -7,8 +7,8 @@ - - + + diff --git a/templates/stats_top.html b/templates/stats_top.html index cddd1e8..bafe9da 100644 --- a/templates/stats_top.html +++ b/templates/stats_top.html @@ -4,8 +4,7 @@ <title>Stats navigation frame</title> <meta name="robots" content="noindex,nofollow"/> <meta name="author" content="http://www.merjis.com/" /> -<link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/> -<link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/> +<link rel="stylesheet" href="/_css/stats_top.css" type="text/css" title="Standard"/> </head><body> <ul class="menu"> -- 1.8.3.1 From beb97ab97c1a00a4ed42ac7306c2e3de7e7af9f1 Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Sat, 23 Oct 2004 16:35:20 +0000 Subject: [PATCH 04/16] Fixed MANIFEST. --- MANIFEST | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST b/MANIFEST index 86bdce6..093cf9f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -23,7 +23,7 @@ html/_css/login.css html/_css/markup.css html/_css/print.css html/_css/standard.css -html/_css/stats.css +html/_css/stats_top.css html/_css/tables.css html/_css/users.css html/_css/visualise_links.css -- 1.8.3.1 From 1d51371de1d046beac8f0519c6f789490c8033b1 Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Sun, 24 Oct 2004 08:48:38 +0000 Subject: [PATCH 05/16] For image/file theft, throw 404 instead of 500 error. Crash report shows canonical hostname. Bumped version for release. --- debian/changelog | 2 +- scripts/crash.ml | 6 ++++-- scripts/file.ml | 8 +++++--- scripts/image.ml | 8 +++++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8470276..6ae2f55 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cocanwiki (1.3.2-2) unstable; urgency=low +cocanwiki (1.3.2-3) unstable; urgency=low * Initial Release. diff --git a/scripts/crash.ml b/scripts/crash.ml index 0e2e720..07d8839 100644 --- a/scripts/crash.ml +++ b/scripts/crash.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones <rich@merjis.com>. * Copyright (C) 2004 Merjis Ltd. - * $Id: crash.ml,v 1.2 2004/10/23 12:00:16 rich Exp $ + * $Id: crash.ml,v 1.3 2004/10/24 08:48:38 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,8 @@ open Cocanwiki open Cocanwiki_template open Cocanwiki_server_settings -let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = +let run r (q : cgi) (dbh : Dbi.connection) hostid + { canonical_hostname = canonical_hostname } _ = let template = get_template dbh hostid "crash.html" in let crash_email = server_settings_crash_email dbh in @@ -53,6 +54,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = let subject = "Crash notify: There was a 500 internal server error" in let body = "Crash at " ^ time ^ "\n" ^ + "Hostname is " ^ canonical_hostname ^ "\n" ^ "Please see the error log for details." in Sendmail.send_mail ~subject ~body ~to_addr:[email] (); diff --git a/scripts/file.ml b/scripts/file.ml index c9032aa..eb45b71 100644 --- a/scripts/file.ml +++ b/scripts/file.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones <rich@merjis.com>. * Copyright (C) 2004 Merjis Ltd. - * $Id: file.ml,v 1.9 2004/10/23 12:00:16 rich Exp $ + * $Id: file.ml,v 1.10 2004/10/24 08:48:38 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,8 +63,10 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = try String.find referer "/_files?deleted"; true with String.Invalid_string -> false in - if not ok then - failwith "file.ml: bandwidth theft avoided" + if not ok then ( + prerr_endline "file.ml: bandwidth theft avoided"; + raise (HttpError cHTTP_NOT_FOUND) + ) ); if version <> None then diff --git a/scripts/image.ml b/scripts/image.ml index bfffbfd..a625d78 100644 --- a/scripts/image.ml +++ b/scripts/image.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones <rich@merjis.com>. * Copyright (C) 2004 Merjis Ltd. - * $Id: image.ml,v 1.9 2004/10/23 12:00:23 rich Exp $ + * $Id: image.ml,v 1.10 2004/10/24 08:48:38 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,8 +65,10 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = try String.find referer "/_images?deleted"; true with String.Invalid_string -> false in - if not ok then - failwith "image.ml: bandwidth theft avoided" + if not ok then ( + prerr_endline "image.ml: bandwidth theft avoided"; + raise (HttpError cHTTP_NOT_FOUND) + ) ); if version <> None then -- 1.8.3.1 From 42d92aaedc15a6800d4b7211860180282f2dce71 Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Sun, 24 Oct 2004 11:12:42 +0000 Subject: [PATCH 06/16] More image spam. All image spam seen so far comes from people searching on google for the phrase "upload image". Adding noindex headers to the relevant images and files pages should eliminate this entirely. Bumped version for release. --- templates/delete_file_form.html | 1 + templates/delete_image_form.html | 1 + templates/files.html | 1 + templates/images.html | 1 + templates/undelete_file_form.html | 1 + templates/undelete_image_form.html | 1 + templates/upload_file_form.html | 1 + templates/upload_image_form.html | 1 + 8 files changed, 8 insertions(+) diff --git a/templates/delete_file_form.html b/templates/delete_file_form.html index 31062ae..48ee840 100644 --- a/templates/delete_file_form.html +++ b/templates/delete_file_form.html @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Delete file</title> +<meta name="robots" content="noindex,nofollow"/> <meta name="author" content="http://www.merjis.com/" /> <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/> <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/> diff --git a/templates/delete_image_form.html b/templates/delete_image_form.html index e46c83e..900fe8c 100644 --- a/templates/delete_image_form.html +++ b/templates/delete_image_form.html @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Delete image</title> +<meta name="robots" content="noindex,nofollow"/> <meta name="author" content="http://www.merjis.com/" /> <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/> <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/> diff --git a/templates/files.html b/templates/files.html index 71a7bc5..c47b8b0 100644 --- a/templates/files.html +++ b/templates/files.html @@ -1,6 +1,7 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> +<meta name="robots" content="noindex,nofollow"/> <title>Files</title> <meta name="author" content="http://www.merjis.com/" /> <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/> diff --git a/templates/images.html b/templates/images.html index 3010085..4022872 100644 --- a/templates/images.html +++ b/templates/images.html @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Images</title> +<meta name="robots" content="noindex,nofollow"/> <meta name="author" content="http://www.merjis.com/" /> <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/> <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/> diff --git a/templates/undelete_file_form.html b/templates/undelete_file_form.html index 1d325e1..7160645 100644 --- a/templates/undelete_file_form.html +++ b/templates/undelete_file_form.html @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Restore file</title> +<meta name="robots" content="noindex,nofollow"/> <meta name="author" content="http://www.merjis.com/" /> <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/> <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/> diff --git a/templates/undelete_image_form.html b/templates/undelete_image_form.html index 31b7b47..4d899c5 100644 --- a/templates/undelete_image_form.html +++ b/templates/undelete_image_form.html @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Restore image</title> +<meta name="robots" content="noindex,nofollow"/> <meta name="author" content="http://www.merjis.com/" /> <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/> <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/> diff --git a/templates/upload_file_form.html b/templates/upload_file_form.html index 118165d..3197713 100644 --- a/templates/upload_file_form.html +++ b/templates/upload_file_form.html @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Upload file</title> +<meta name="robots" content="noindex,nofollow"/> <meta name="author" content="http://www.merjis.com/" /> <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/> <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/> diff --git a/templates/upload_image_form.html b/templates/upload_image_form.html index 0b21685..01c2a21 100644 --- a/templates/upload_image_form.html +++ b/templates/upload_image_form.html @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Upload image</title> +<meta name="robots" content="noindex,nofollow"/> <meta name="author" content="http://www.merjis.com/" /> <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/> <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/> -- 1.8.3.1 From 88f1f0935766a84d8adfa7076882cd70a05481d6 Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Sun, 24 Oct 2004 11:13:11 +0000 Subject: [PATCH 07/16] Bumped version for release. --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 6ae2f55..eb013d0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cocanwiki (1.3.2-3) unstable; urgency=low +cocanwiki (1.3.2-4) unstable; urgency=low * Initial Release. -- 1.8.3.1 From 3f0bcc30ff112dc38e882f4f08b8c37d693799ef Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Sun, 24 Oct 2004 11:34:37 +0000 Subject: [PATCH 08/16] Non-existant files and images throw 404, instead of 500, errors. Bumped version for release. --- debian/changelog | 2 +- scripts/file.ml | 13 ++++++++----- scripts/image.ml | 13 ++++++++----- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index eb013d0..63d9fe5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cocanwiki (1.3.2-4) unstable; urgency=low +cocanwiki (1.3.2-5) unstable; urgency=low * Initial Release. diff --git a/scripts/file.ml b/scripts/file.ml index eb45b71..28685df 100644 --- a/scripts/file.ml +++ b/scripts/file.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones <rich@merjis.com>. * Copyright (C) 2004 Merjis Ltd. - * $Id: file.ml,v 1.10 2004/10/24 08:48:38 rich Exp $ + * $Id: file.ml,v 1.11 2004/10/24 11:34:37 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,10 +48,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = sth#execute args; let data, mime_type, deleted = - match sth#fetch1 () with - [ `Binary data; `String mime_type; `Bool deleted ] -> - data, mime_type, deleted - | _ -> assert false in + try + (match sth#fetch1 () with + [ `Binary data; `String mime_type; `Bool deleted ] -> + data, mime_type, deleted + | _ -> assert false) + with + Not_found -> raise (HttpError cHTTP_NOT_FOUND) in (* If deleted, refuse to serve this file except if called from the * deleted files page. diff --git a/scripts/image.ml b/scripts/image.ml index a625d78..0558950 100644 --- a/scripts/image.ml +++ b/scripts/image.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones <rich@merjis.com>. * Copyright (C) 2004 Merjis Ltd. - * $Id: image.ml,v 1.10 2004/10/24 08:48:38 rich Exp $ + * $Id: image.ml,v 1.11 2004/10/24 11:34:37 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,10 +50,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = sth#execute args; let data, mime_type, deleted = - match sth#fetch1 () with - [ `Binary data; `String mime_type; `Bool deleted ] -> - data, mime_type, deleted - | _ -> assert false in + try + (match sth#fetch1 () with + [ `Binary data; `String mime_type; `Bool deleted ] -> + data, mime_type, deleted + | _ -> assert false) + with + Not_found -> raise (HttpError cHTTP_NOT_FOUND) in (* If deleted, refuse to serve this image except if called from the * deleted images page. -- 1.8.3.1 From f281fd7b2ac035be5a15cc1519d395b4e383eb84 Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Sun, 24 Oct 2004 17:32:54 +0000 Subject: [PATCH 09/16] "New page" button for creating new pages interactively. --- MANIFEST | 5 +++++ html/_css/new_page.css | 6 ++++++ html/_css/standard.css | 7 ++++++- html/_graphics/new.png | Bin 0 -> 247 bytes html/_js/new_page.js | 35 ++++++++++++++++++++++++++++++++ scripts/.depend | 2 ++ scripts/lib/wikilib.ml | 5 ++++- scripts/new_page_form.ml | 36 +++++++++++++++++++++++++++++++++ templates/new_page_form.html | 47 +++++++++++++++++++++++++++++++++++++++++++ templates/page.html | 3 ++- 10 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 html/_css/new_page.css create mode 100644 html/_graphics/new.png create mode 100644 html/_js/new_page.js create mode 100644 scripts/new_page_form.ml create mode 100644 templates/new_page_form.html diff --git a/MANIFEST b/MANIFEST index 093cf9f..7f1643b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -21,6 +21,7 @@ html/_css/files.css html/_css/images.css html/_css/login.css html/_css/markup.css +html/_css/new_page.css html/_css/print.css html/_css/standard.css html/_css/stats_top.css @@ -41,6 +42,7 @@ html/_graphics/images.png html/_graphics/maillist.png html/_graphics/mailto.png html/_graphics/markup-preview.png +html/_graphics/new.png html/_graphics/newpage.png html/_graphics/ok.png html/_graphics/pinkhatch.png @@ -52,6 +54,7 @@ html/_graphics/versions.png html/_graphics/wlh.png html/_graphics/xml.png html/_js/editor.js +html/_js/new_page.js html/_js/visualise_links.js html/_js/wz_jsgraphics.js html/_static/markup.html @@ -155,6 +158,7 @@ scripts/mailing_list_form.ml scripts/mailing_list_send.ml scripts/mailing_list_unsubscribe.ml scripts/mailing_list_view.ml +scripts/new_page_form.ml scripts/page.ml scripts/page_email_confirm.ml scripts/page_email_form.ml @@ -244,6 +248,7 @@ templates/mailing_list_form.html templates/mailing_list_send.txt templates/mailing_list_view.html templates/mailing_list_view.txt +templates/new_page_form.html templates/ok_error.html templates/page.html templates/page_404.html diff --git a/html/_css/new_page.css b/html/_css/new_page.css new file mode 100644 index 0000000..053e91f --- /dev/null +++ b/html/_css/new_page.css @@ -0,0 +1,6 @@ +/* $Id: new_page.css,v 1.1 2004/10/24 17:32:54 rich Exp $ */ + +div#show_link { + width: 25em; + height: 8em; +} \ No newline at end of file diff --git a/html/_css/standard.css b/html/_css/standard.css index e26105f..39d4379 100644 --- a/html/_css/standard.css +++ b/html/_css/standard.css @@ -1,5 +1,5 @@ /* Stylesheet for COCANWIKI. - * $Id: standard.css,v 1.23 2004/10/23 09:47:24 rich Exp $ + * $Id: standard.css,v 1.24 2004/10/24 17:32:54 rich Exp $ */ /* Based on the basic stylesheet. */ @@ -196,6 +196,11 @@ li.maillist_li a { background: url(/_graphics/maillist.png) center left no-repeat; } +li.new_li a { + padding-left: 16px; + background: url(/_graphics/new.png) center left no-repeat; +} + li.recent_li a { padding-left: 18px; background: url(/_graphics/recent.png) center left no-repeat; diff --git a/html/_graphics/new.png b/html/_graphics/new.png new file mode 100644 index 0000000000000000000000000000000000000000..16d1846ce796d52d5d2da745c10b42c9ea225c61 GIT binary patch literal 247 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPWmjoY&_LsS5K}O1!xJHyX=jZ08=9Mrw7o{eaq^2m8 zXO?6rgk+>DxO@5ryiZZh11gO6ba4!+xRsnBk#T?{S>n9S=l^daLp+m{+1fV0RO>k+ zIkoJWy;XvTHS@s=24ThG|L0B84y1E9GD}=Oe`s%q@4VIpZ!_2?zF~4oxYCfA$iQ86 i?BLXh2a?>~77SZ1YMFPnEPW2NhQZU-&t;ucLK6Ul`%x+Y literal 0 HcmV?d00001 diff --git a/html/_js/new_page.js b/html/_js/new_page.js new file mode 100644 index 0000000..f4e3d16 --- /dev/null +++ b/html/_js/new_page.js @@ -0,0 +1,35 @@ +/* $Id: new_page.js,v 1.1 2004/10/24 17:32:54 rich Exp $ */ + +var div; +var timer; + +function init () +{ + document.f.title.focus (); + document.f.submit.disabled = true; + div = document.getElementById ("show_link"); +} + +function update () +{ + if (timer) clearTimeout (timer); + timer = setTimeout ("update_now ()", 1); +} + +function update_now () +{ + timer = null; + + var title = document.f.title.value; + if (title.search (/[a-z0-9]/gi) == -1) { + document.f.submit.disabled = true; + div.innerHTML = ""; + } else { + document.f.submit.disabled = false; + title = title.replace (/&/g, "&amp;"); + title = title.replace (/</g, "&lt;"); + title = title.replace (/>/g, "&gt;"); + title = title.replace (/\"/g, "&quot;"); + div.innerHTML = "You can create links to this page when editing by putting two square brackets around the page name, like this: <br/><br/> <code>[[" + title + "]]</code>"; + } +} diff --git a/scripts/.depend b/scripts/.depend index ae973c3..6eff1f2 100644 --- a/scripts/.depend +++ b/scripts/.depend @@ -216,6 +216,8 @@ mailing_list_view.cmo: lib/cocanwiki.cmo lib/cocanwiki_date.cmo \ lib/cocanwiki_template.cmi mailing_list_view.cmx: lib/cocanwiki.cmx lib/cocanwiki_date.cmx \ lib/cocanwiki_template.cmx +new_page_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi +new_page_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_template.cmx page.cmo: lib/cocanwiki.cmo lib/cocanwiki_date.cmo lib/cocanwiki_links.cmi \ lib/cocanwiki_ok.cmo lib/cocanwiki_server_settings.cmo \ lib/cocanwiki_template.cmi lib/wikilib.cmi diff --git a/scripts/lib/wikilib.ml b/scripts/lib/wikilib.ml index 0ba0425..7916201 100644 --- a/scripts/lib/wikilib.ml +++ b/scripts/lib/wikilib.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones <rich@merjis.com>. * Copyright (C) 2004 Merjis Ltd. - * $Id: wikilib.ml,v 1.1 2004/10/21 11:42:05 rich Exp $ + * $Id: wikilib.ml,v 1.2 2004/10/24 17:32:55 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,6 +55,9 @@ let generate_url_of_title (dbh : Dbi.connection) hostid title = (* URL cannot begin with '_'. *) else if url.[0] = '_' then GenURL_BadURL + (* Titles which begin or end with spaces are probably mistakes. *) + else if isspace title.[0] || isspace title.[String.length title - 1] then + GenURL_BadURL else ( (* Check that the URL doesn't already exist in the database. If it does * then it probably means that another page exists with similar enough diff --git a/scripts/new_page_form.ml b/scripts/new_page_form.ml new file mode 100644 index 0000000..f68ab9b --- /dev/null +++ b/scripts/new_page_form.ml @@ -0,0 +1,36 @@ +(* COCANWIKI - a wiki written in Objective CAML. + * Written by Richard W.M. Jones <rich@merjis.com>. + * Copyright (C) 2004 Merjis Ltd. + * $Id: new_page_form.ml,v 1.1 2004/10/24 17:32:54 rich Exp $ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + *) + +open Apache +open Registry +open Cgi +open Printf + +open Cocanwiki +open Cocanwiki_template + +let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = + let template = get_template dbh hostid "new_page_form.html" in + + q#template template + +let () = + register_script ~restrict:[CanEdit] run diff --git a/templates/new_page_form.html b/templates/new_page_form.html new file mode 100644 index 0000000..c9b5e16 --- /dev/null +++ b/templates/new_page_form.html @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<title>New page</title> +<meta name="robots" content="noindex,nofollow"/> +<meta name="author" content="http://www.merjis.com/" /> +<link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/> +<link rel="stylesheet" href="/_css/new_page.css" type="text/css" title="Standard"/> +<link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/> +<script src="/_js/new_page.js" type="text/javascript"></script> +</head><body onload="init();"> + +<h1>New page</h1> + +<p> +<em> Note that you would normally create a new page just by +clicking on any <a href="#" class="newpage" title="Shows a link in the distinctive style for links to unknown pages.">link like this</a>. </em> +</p> + +<form method="post" action="/_bin/edit.cmo" name="f"> +<table class="left_table"> +<tr> +<th> Page name: </th> +<td> <input name="title" value="" size="50" onkeypress="update(); return true;"/> </td> +</tr> +<tr> +<td></td> +<td> + <div id="show_link"> + <noscript> + You can create links to this page when editing by putting + two square brackets around the page name, like this: <br/><br/> + <code>[[page name]]</code> + </noscript> + </div> +</td> +</tr> +<tr> +<td></td> +<td> <input type="submit" name="submit" value="Create new page"/> </td> +</tr> +</table> +</form> + +::include(footer.html):: +</body> +</html> \ No newline at end of file diff --git a/templates/page.html b/templates/page.html index c1cd142..92d4a29 100644 --- a/templates/page.html +++ b/templates/page.html @@ -70,7 +70,8 @@ <li class="versions_li"> <a href="/::page_html_tag::/history">Versions of this page</a> </li> <li class="wlh_li"> <a href="/_bin/what_links_here.cmo?page=::page_url::">What links here?</a> </li> <li class="stylesheet_li"> <a href="/::page_html_tag::/editcss">Edit stylesheet</a> </li> -<li> <a href="/::page_html_tag::/edittitle">Rename page</a> </li> +<li class="edittitle_li"> <a href="/::page_html_tag::/edittitle">Rename page</a> </li> +<li class="new_li"> <a href="/_bin/new_page_form.cmo">New page</a> </li> <li class="images_li"> <a href="/_images">Images</a> </li> <li class="files_li"> <a href="/_files">Files</a> </li> ::if(has_stats):: -- 1.8.3.1 From e278b9ca61b1f0219fc5cb0d6a7cc3797049f15c Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Sun, 24 Oct 2004 19:25:20 +0000 Subject: [PATCH 10/16] Use the GregorianDate library. --- debian/control | 3 ++- scripts/Makefile | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/control b/debian/control index 3eef237..b1d9a6a 100644 --- a/debian/control +++ b/debian/control @@ -1,13 +1,14 @@ Source: cocanwiki Priority: optional Maintainer: Richard W.M. Jones <rich@annexia.org> -Build-Depends: debhelper (>= 4.0.0), libpcre-ocaml-dev, libpgsql-ocaml-dev, libextlib-ocaml-dev, ocaml-findlib, ocaml-nox-3.08, libapache-mod-caml (>= 1.3.2), libtemplate-ocaml-dev (>= 1.3.2), ocamldsort (>= 0.14.2) +Build-Depends: debhelper (>= 4.0.0), libpcre-ocaml-dev, libpgsql-ocaml-dev, libextlib-ocaml-dev, libgregoriandate-ocaml-dev, ocaml-findlib, ocaml-nox-3.08, libapache-mod-caml (>= 1.3.2), libtemplate-ocaml-dev (>= 1.3.2), ocamldsort (>= 0.14.2) Standards-Version: 3.6.1 Package: cocanwiki Section: web Architecture: all Depends: libpgsql-ocaml, libdbi-ocaml (>= 0.9.9), libpcre-ocaml, + libgregoriandate-ocaml, ocaml-base-nox-3.08, libapache-mod-caml (>= 1.3.2), libtemplate-ocaml-dev (>= 1.3.2), libocamlnet-ocaml-dev (>= 0.98), diff --git a/scripts/Makefile b/scripts/Makefile index c24a331..cca402c 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -1,13 +1,12 @@ # Makefile for COCANWIKI. -# $Id: Makefile,v 1.44 2004/10/21 11:48:21 rich Exp $ +# $Id: Makefile,v 1.45 2004/10/24 19:25:20 rich Exp $ include ../Makefile.config OCAMLC := ocamlc -# XXX Move GregorianDate out of +merjis. OCAMLCFLAGS := -w s \ -I +apache -I +pcre -I +dbi -I +extlib -I +netstring \ - -I +merjis -I lib + -I +gregoriandate -I lib CPP := cpp SRCS := $(wildcard *.ml) -- 1.8.3.1 From 5299233f3dd6720c62bcaa6fc5f562e529c34793 Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Sun, 24 Oct 2004 19:26:12 +0000 Subject: [PATCH 11/16] Bumped version for release. --- Makefile.config | 4 ++-- debian/changelog | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.config b/Makefile.config index c757f68..a72eabd 100644 --- a/Makefile.config +++ b/Makefile.config @@ -1,7 +1,7 @@ -# $Id: Makefile.config,v 1.12 2004/10/23 15:00:13 rich Exp $ +# $Id: Makefile.config,v 1.13 2004/10/24 19:26:12 rich Exp $ PACKAGE := cocanwiki -VERSION := 1.3.2 +VERSION := 1.3.3 # Normally ignored. However, if you are installing centrally (using # 'make pkg-install'), then the components are installed in the diff --git a/debian/changelog b/debian/changelog index 63d9fe5..174f60d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cocanwiki (1.3.2-5) unstable; urgency=low +cocanwiki (1.3.3-1) unstable; urgency=low * Initial Release. -- 1.8.3.1 From bfc0f85bc1869f5139505dd6ffbacecb1af564a4 Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Mon, 25 Oct 2004 07:44:55 +0000 Subject: [PATCH 12/16] Fix for crashing bug: When one user hits "cancel" on a page which another user has edited. --- Makefile.config | 4 ++-- debian/changelog | 2 +- scripts/edit.ml | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile.config b/Makefile.config index a72eabd..5e2a3ce 100644 --- a/Makefile.config +++ b/Makefile.config @@ -1,7 +1,7 @@ -# $Id: Makefile.config,v 1.13 2004/10/24 19:26:12 rich Exp $ +# $Id: Makefile.config,v 1.14 2004/10/25 07:44:55 rich Exp $ PACKAGE := cocanwiki -VERSION := 1.3.3 +VERSION := 1.3.4 # Normally ignored. However, if you are installing centrally (using # 'make pkg-install'), then the components are installed in the diff --git a/debian/changelog b/debian/changelog index 174f60d..76550d5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cocanwiki (1.3.3-1) unstable; urgency=low +cocanwiki (1.3.4-1) unstable; urgency=low * Initial Release. diff --git a/scripts/edit.ml b/scripts/edit.ml index af885a1..abf8e3c 100644 --- a/scripts/edit.ml +++ b/scripts/edit.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones <rich@merjis.com>. * Copyright (C) 2004 Merjis Ltd. - * $Id: edit.ml,v 1.21 2004/10/21 19:54:29 rich Exp $ + * $Id: edit.ml,v 1.22 2004/10/25 07:44:55 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -442,7 +442,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = let cancel id = let url = if id <> 0 then ( - let sth = dbh#prepare_cached "select url from pages + let sth = dbh#prepare_cached "select coalesce (url, url_deleted) + from pages where hostid = ? and id = ?" in sth#execute [`Int hostid; `Int id]; sth#fetch1string () -- 1.8.3.1 From 86d9f5778bbf054c836f02a6a51a601956ddc9eb Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Mon, 25 Oct 2004 16:39:09 +0000 Subject: [PATCH 13/16] Better README file - points to online resources. --- README | 89 ++---------------------------------------------------------------- 1 file changed, 2 insertions(+), 87 deletions(-) diff --git a/README b/README index f71bd17..cd7921e 100644 --- a/README +++ b/README @@ -7,93 +7,8 @@ This is a Wiki, written in Objective CAML by Richard W.M. Jones It is licensed to you under the GNU General Public License (GNU GPL). Please see the file COPYING in this directory for full details. -Requirements ------------- - -* Apache (probably Apache version 1.3, unless you want to build your - own version of Apache 2.0 which doesn't include PCRE). - -* Objective CAML 3.07 or above. - -* PCRE library for OCaml. - -* ExtLib for OCaml. - http://ocaml-lib.sourceforge.net/ - -* mod_caml and DBI libraries for OCaml. - http://www.merjis.com/developers/mod_caml/ - -* PostgreSQL database 7.3 or above. - -* Postgres bindings for OCaml. - http://www.eleves.ens.fr/home/frisch/soft#postgres - (Markus Mottl's later version, renamed PostgreSQL, will probably work, but - you may need to modify a little bit of the code in scripts/cocanwiki.ml so - it connects to the right database using the right driver). - -Installation ------------- - -First install all of the above requirements, and check that they're -working. - -Type 'make all install' (you don't need to be root). - -Then create a UNICODE database called 'cocanwiki' and load the schema -from 'cocanwiki.sql'. - -Create a Wiki site by hand in the database: - - begin work; - set constraints "hosts_hostname_cn" deferred; - insert into hosts (canonical_hostname) values ('test.cocan.org'); - -- HOSTID is the value of hosts.id, normally 1 - insert into hostnames (hostid, name) values (HOSTID, 'test.cocan.org'); - commit work; - -Create an index page by hand in the database: - - insert into pages (hostid, url, title, description) values (HOSTID, 'index', - 'Index Page', 'Index Page'); - -Modify your Apache configuration, adding: - - CamlLoad ...path/to/html/_bin/cocanwiki.cma - - <VirtualHost test.cocan.org> - ServerAdmin you@example.com - DocumentRoot ...path/to/html - ServerName test.cocan.org - Include ....path/to/conf/cocanwiki.conf - </VirtualHost> - -(Change 'test.cocan.org' to a suitable local server name, and set the -paths as appropriate). - -Set any necessary environment variables and start up the server: - - export COCANWIKI_TEMPLATES=...path/to/templates - # The following is not required if the database is running locally: - export PGHOST=hostname.of.database - # Replace this with however you would normally start your webserver: - /usr/bin/apache - -Try connecting to the local server using your browser. If it doesn't -work, look in the Apache error_log file. - -More notes on setting environment variables -------------------------------------------- - -You CANNOT use SetEnv to set COCANWIKI_TEMPLATES and/or PGHOST. This -is because SetEnv runs too late in the Apache handler cycle for it to -be picked up by the scripts. - -On Debian you must modify /etc/init.d/apache in order to set up -environment variables. On the line which reads: - -ENV="env -i ...." - -remove the -i option from env (Debian bug #252627, marked as WONTFIX). +Depends: http://sandbox.merjis.com/dependencies +Installation: http://sandbox.merjis.com/installation Directory layout ---------------- -- 1.8.3.1 From 2fc07b4198bff92c1d1df849372144c44df00efb Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Tue, 26 Oct 2004 10:17:25 +0000 Subject: [PATCH 14/16] Add <span> inside <h1> and <h2> to allow FIR. --- templates/page.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/page.html b/templates/page.html index 92d4a29..d46ac5e 100644 --- a/templates/page.html +++ b/templates/page.html @@ -11,7 +11,7 @@ ::if(has_page_css)::<link rel="stylesheet" href="/::page_html_tag::/styles.css::if(is_old_version)::?version=::old_version::::end::" type="text/css" title="Standard"/>::end:: </head><body> -<h1>::title_html::</h1> +<h1><span>::title_html::</span></h1> ::if(navigation)::<div id="navigation_space_div"></div>::end:: @@ -35,7 +35,7 @@ <div id="content_div"> ::table(sections):: -::if(has_divname)::<div id="::divname_html_tag::">::end::::if(can_edit)::<p class="edit_link">[<a href="/::page_html_tag::/edit#::ordering::" title="Edit this section">edit</a>]</p>::end::::if(has_sectionname)::<a name="::linkname_html_tag::"></a><h2>::sectionname_html::</h2>::end:: +::if(has_divname)::<div id="::divname_html_tag::">::end::::if(can_edit)::<p class="edit_link">[<a href="/::page_html_tag::/edit#::ordering::" title="Edit this section">edit</a>]</p>::end::::if(has_sectionname)::<a name="::linkname_html_tag::"></a><h2><span>::sectionname_html::</span></h2>::end:: ::content:: ::if(has_divname)::</div>::end::::end:: </div> -- 1.8.3.1 From 244c775083cd8d32bb8f39038797954fa911f73b Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Tue, 26 Oct 2004 10:17:41 +0000 Subject: [PATCH 15/16] Bumped version for release. --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 76550d5..787766a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cocanwiki (1.3.4-1) unstable; urgency=low +cocanwiki (1.3.4-2) unstable; urgency=low * Initial Release. -- 1.8.3.1 From 8ae70f575a6448b042cb4e71711512590476523f Mon Sep 17 00:00:00 2001 From: rich <rich> Date: Tue, 26 Oct 2004 11:05:19 +0000 Subject: [PATCH 16/16] Added <span> around menu items for FIR. **NB** Same change must be made in all the other template files. This will fall apart as soon as someone clicks to any of the other pages. --- templates/page.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/page.html b/templates/page.html index d46ac5e..7f0e9f9 100644 --- a/templates/page.html +++ b/templates/page.html @@ -54,10 +54,10 @@ <div id="menu_div"> <ul id="bottommenu" class="menu"> -<li id="index_li" class="first"> ::if(is_homepage)::::else::<a href="/">::end::Home&nbsp;page::if(is_homepage)::::else::</a>::end:: </li> -::table(sitemenu)::<li id="::url::_li"> ::if(is_linked)::<a href="/::url_html_tag::">::end::::label_html::::if(is_linked)::</a>::end:: </li> +<li id="index_li" class="first"> ::if(is_homepage)::::else::<a href="/">::end::<span>Home&nbsp;page</span>::if(is_homepage)::::else::</a>::end:: </li> +::table(sitemenu)::<li id="::url::_li"> ::if(is_linked)::<a href="/::url_html_tag::">::end::<span>::label_html::</span>::if(is_linked)::</a>::end:: </li> ::end:: -<li id="sitemap_li"> <a href="/_sitemap">Sitemap</a> </li> +<li id="sitemap_li"> <a href="/_sitemap"><span>Sitemap</span></a> </li> </ul> <ul id="editmenu" class="menu"> -- 1.8.3.1