summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-10-09 21:01:47 +0000
committerDries Buytaert <dries@buytaert.net>2001-10-09 21:01:47 +0000
commitf1932821bedfe603eb7a5a7c210e0a7e4c1b4157 (patch)
tree9686b19c30d852f11d5e85f7db104fcf24e22a67
parent47c6fce5ce33e510fb3a4e51ce7c34db082590c4 (diff)
downloadbrdo-f1932821bedfe603eb7a5a7c210e0a7e4c1b4157.tar.gz
brdo-f1932821bedfe603eb7a5a7c210e0a7e4c1b4157.tar.bz2
- PEAR-ification of Drupal by claw: you can now host Drupal on a wide
range of databases including MySQL, PostgreSQL, MSSQL, and others. For additional information and an 'how to upgrade', check the mails sent to the mailing list.
-rw-r--r--CHANGELOG11
-rw-r--r--database/database.pgsql1886
-rw-r--r--includes/comment.inc12
-rw-r--r--includes/common.inc2
-rw-r--r--includes/conf.php7
-rw-r--r--includes/database.inc69
-rw-r--r--includes/module.inc6
-rw-r--r--includes/node.inc60
-rw-r--r--includes/theme.inc7
-rw-r--r--modules/aggregator.module2
-rw-r--r--modules/aggregator/aggregator.module2
-rw-r--r--modules/blog.module14
-rw-r--r--modules/blog/blog.module14
-rw-r--r--modules/book.module2
-rw-r--r--modules/book/book.module2
-rw-r--r--modules/comment.module8
-rw-r--r--modules/comment/comment.module8
-rw-r--r--modules/import.module2
-rw-r--r--modules/node.module25
-rw-r--r--modules/node/node.module25
-rw-r--r--modules/queue.module4
-rw-r--r--modules/rating.module10
-rw-r--r--modules/search.module9
-rw-r--r--modules/search/search.module9
-rw-r--r--modules/tracker.module4
-rw-r--r--modules/tracker/tracker.module4
-rw-r--r--modules/user.module77
-rw-r--r--modules/user/user.module77
-rw-r--r--modules/watchdog.module6
-rw-r--r--modules/watchdog/watchdog.module6
-rw-r--r--modules/weblogs.module2
-rw-r--r--updates/3.00-to-x.xx.sql9
32 files changed, 2199 insertions, 182 deletions
diff --git a/CHANGELOG b/CHANGELOG
index dcff747bb..74f681041 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,21 +1,10 @@
drupal x.xx, xx/xx/xxxx
-----------------------
-- improved comment.inc:
- * anonymous users can now change the comment settings
- * moved the "Moderate comments" button to the "Comment control" block
- rewrote the user system:
* added support for Drupal authentication through XML-RPC and through
a Jabber server.
- * merged access.module, user.inc, account.php and user.module.
-- rewrote the search module:
- * imrproved look and feel.
-- added new tracker module:
- * helps visitors to track the latests comments.
-- added new weblog module:
- * notifies weblogs.com when an update occured.
- various updates:
* improved the search system by making it context sensitive.
- * fixed various HTML/XHTML typos.
drupal 3.00, 15/09/2001
-----------------------
diff --git a/database/database.pgsql b/database/database.pgsql
new file mode 100644
index 000000000..bb8592684
--- /dev/null
+++ b/database/database.pgsql
@@ -0,0 +1,1886 @@
+--
+-- Selected TOC Entries:
+--
+--- \connect - postgres
+--
+-- TOC Entry ID 174 (OID 18720)
+--
+-- Name: "plpgsql_call_handler" () Type: FUNCTION Owner: postgres
+--
+
+--- CREATE FUNCTION "plpgsql_call_handler" () RETURNS opaque AS '/usr/lib/postgresql/lib/plpgsql.so', 'plpgsql_call_handler' LANGUAGE 'C';
+
+--
+-- TOC Entry ID 175 (OID 18721)
+--
+-- Name: plpgsql Type: PROCEDURAL LANGUAGE Owner:
+--
+
+--- CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' HANDLER "plpgsql_call_handler" LANCOMPILER 'PL/pgSQL';
+
+\connect - root
+--
+-- TOC Entry ID 62 (OID 20075)
+--
+-- Name: pga_queries Type: TABLE Owner: root
+--
+
+CREATE TABLE "pga_queries" (
+ "queryname" character varying(64),
+ "querytype" character(1),
+ "querycommand" text,
+ "querytables" text,
+ "querylinks" text,
+ "queryresults" text,
+ "querycomments" text
+);
+
+--
+-- TOC Entry ID 63 (OID 20075)
+--
+-- Name: pga_queries Type: ACL Owner:
+--
+
+REVOKE ALL on "pga_queries" from PUBLIC;
+GRANT ALL on "pga_queries" to PUBLIC;
+GRANT ALL on "pga_queries" to "root";
+
+--
+-- TOC Entry ID 64 (OID 20106)
+--
+-- Name: pga_forms Type: TABLE Owner: root
+--
+
+CREATE TABLE "pga_forms" (
+ "formname" character varying(64),
+ "formsource" text
+);
+
+--
+-- TOC Entry ID 65 (OID 20106)
+--
+-- Name: pga_forms Type: ACL Owner:
+--
+
+REVOKE ALL on "pga_forms" from PUBLIC;
+GRANT ALL on "pga_forms" to PUBLIC;
+GRANT ALL on "pga_forms" to "root";
+
+--
+-- TOC Entry ID 66 (OID 20132)
+--
+-- Name: pga_scripts Type: TABLE Owner: root
+--
+
+CREATE TABLE "pga_scripts" (
+ "scriptname" character varying(64),
+ "scriptsource" text
+);
+
+--
+-- TOC Entry ID 67 (OID 20132)
+--
+-- Name: pga_scripts Type: ACL Owner:
+--
+
+REVOKE ALL on "pga_scripts" from PUBLIC;
+GRANT ALL on "pga_scripts" to PUBLIC;
+GRANT ALL on "pga_scripts" to "root";
+
+--
+-- TOC Entry ID 68 (OID 20158)
+--
+-- Name: pga_reports Type: TABLE Owner: root
+--
+
+CREATE TABLE "pga_reports" (
+ "reportname" character varying(64),
+ "reportsource" text,
+ "reportbody" text,
+ "reportprocs" text,
+ "reportoptions" text
+);
+
+--
+-- TOC Entry ID 69 (OID 20158)
+--
+-- Name: pga_reports Type: ACL Owner:
+--
+
+REVOKE ALL on "pga_reports" from PUBLIC;
+GRANT ALL on "pga_reports" to PUBLIC;
+GRANT ALL on "pga_reports" to "root";
+
+--
+-- TOC Entry ID 70 (OID 20187)
+--
+-- Name: pga_schema Type: TABLE Owner: root
+--
+
+CREATE TABLE "pga_schema" (
+ "schemaname" character varying(64),
+ "schematables" text,
+ "schemalinks" text
+);
+
+--
+-- TOC Entry ID 71 (OID 20187)
+--
+-- Name: pga_schema Type: ACL Owner:
+--
+
+REVOKE ALL on "pga_schema" from PUBLIC;
+GRANT ALL on "pga_schema" to PUBLIC;
+GRANT ALL on "pga_schema" to "root";
+
+--
+-- TOC Entry ID 2 (OID 20214)
+--
+-- Name: access_aid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "access_aid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 3 (OID 20214)
+--
+-- Name: access_aid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "access_aid_seq" from PUBLIC;
+GRANT ALL on "access_aid_seq" to "root";
+GRANT ALL on "access_aid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 72 (OID 20233)
+--
+-- Name: access Type: TABLE Owner: root
+--
+
+CREATE TABLE "access" (
+ "aid" integer DEFAULT nextval('"access_aid_seq"'::text) NOT NULL,
+ "mask" character varying(255) NOT NULL,
+ "type" character varying(255) NOT NULL,
+ "status" smallint NOT NULL,
+ Constraint "access_pkey" Primary Key ("aid")
+);
+
+--
+-- TOC Entry ID 73 (OID 20233)
+--
+-- Name: access Type: ACL Owner:
+--
+
+REVOKE ALL on "access" from PUBLIC;
+GRANT ALL on "access" to "root";
+GRANT ALL on "access" to "wallaby";
+
+--
+-- TOC Entry ID 4 (OID 20269)
+--
+-- Name: blog_lid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "blog_lid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 5 (OID 20269)
+--
+-- Name: blog_lid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "blog_lid_seq" from PUBLIC;
+GRANT ALL on "blog_lid_seq" to "root";
+GRANT ALL on "blog_lid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 74 (OID 20288)
+--
+-- Name: blog Type: TABLE Owner: root
+--
+
+CREATE TABLE "blog" (
+ "lid" integer DEFAULT nextval('"blog_lid_seq"'::text) NOT NULL,
+ "nid" integer NOT NULL,
+ "body" text NOT NULL,
+ Constraint "blog_pkey" Primary Key ("lid")
+);
+
+--
+-- TOC Entry ID 75 (OID 20288)
+--
+-- Name: blog Type: ACL Owner:
+--
+
+REVOKE ALL on "blog" from PUBLIC;
+GRANT ALL on "blog" to "root";
+GRANT ALL on "blog" to "wallaby";
+
+--
+-- TOC Entry ID 6 (OID 20319)
+--
+-- Name: book_lid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "book_lid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 7 (OID 20319)
+--
+-- Name: book_lid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "book_lid_seq" from PUBLIC;
+GRANT ALL on "book_lid_seq" to "root";
+GRANT ALL on "book_lid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 8 (OID 20374)
+--
+-- Name: boxes_bid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "boxes_bid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 9 (OID 20374)
+--
+-- Name: boxes_bid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "boxes_bid_seq" from PUBLIC;
+GRANT ALL on "boxes_bid_seq" to "root";
+GRANT ALL on "boxes_bid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 76 (OID 20393)
+--
+-- Name: boxes Type: TABLE Owner: root
+--
+
+CREATE TABLE "boxes" (
+ "bid" integer DEFAULT nextval('"boxes_bid_seq"'::text) NOT NULL,
+ "title" character varying(64) NOT NULL,
+ "body" text NOT NULL,
+ "info" character varying(128) NOT NULL,
+ "type" smallint NOT NULL,
+ Constraint "boxes_pkey" Primary Key ("bid")
+);
+
+--
+-- TOC Entry ID 77 (OID 20393)
+--
+-- Name: boxes Type: ACL Owner:
+--
+
+REVOKE ALL on "boxes" from PUBLIC;
+GRANT ALL on "boxes" to "root";
+GRANT ALL on "boxes" to "wallaby";
+
+--
+-- TOC Entry ID 10 (OID 20435)
+--
+-- Name: bundle_bid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "bundle_bid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 11 (OID 20435)
+--
+-- Name: bundle_bid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "bundle_bid_seq" from PUBLIC;
+GRANT ALL on "bundle_bid_seq" to "root";
+GRANT ALL on "bundle_bid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 78 (OID 20454)
+--
+-- Name: bundle Type: TABLE Owner: root
+--
+
+CREATE TABLE "bundle" (
+ "bid" integer DEFAULT nextval('"bundle_bid_seq"'::text) NOT NULL,
+ "title" character varying(255) NOT NULL,
+ "attributes" character varying(255) NOT NULL,
+ Constraint "bundle_pkey" Primary Key ("bid")
+);
+
+--
+-- TOC Entry ID 79 (OID 20454)
+--
+-- Name: bundle Type: ACL Owner:
+--
+
+REVOKE ALL on "bundle" from PUBLIC;
+GRANT ALL on "bundle" to "root";
+GRANT ALL on "bundle" to "wallaby";
+
+--
+-- TOC Entry ID 80 (OID 20470)
+--
+-- Name: cache Type: TABLE Owner: root
+--
+
+CREATE TABLE "cache" (
+ "url" character varying(255) NOT NULL,
+ "data" text NOT NULL,
+ "timestamp" integer NOT NULL,
+ Constraint "cache_pkey" Primary Key ("url")
+);
+
+--
+-- TOC Entry ID 81 (OID 20470)
+--
+-- Name: cache Type: ACL Owner:
+--
+
+REVOKE ALL on "cache" from PUBLIC;
+GRANT ALL on "cache" to "root";
+GRANT ALL on "cache" to "wallaby";
+
+--
+-- TOC Entry ID 12 (OID 20500)
+--
+-- Name: category_cid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "category_cid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 13 (OID 20500)
+--
+-- Name: category_cid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "category_cid_seq" from PUBLIC;
+GRANT ALL on "category_cid_seq" to "root";
+GRANT ALL on "category_cid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 82 (OID 20519)
+--
+-- Name: category Type: TABLE Owner: root
+--
+
+CREATE TABLE "category" (
+ "cid" integer DEFAULT nextval('"category_cid_seq"'::text) NOT NULL,
+ "name" character varying(32) NOT NULL,
+ "type" character varying(16) NOT NULL,
+ "post" integer NOT NULL,
+ "dump" integer NOT NULL,
+ "expire" integer NOT NULL,
+ "comment" integer NOT NULL,
+ "submission" integer NOT NULL,
+ "promote" integer NOT NULL,
+ Constraint "category_pkey" Primary Key ("cid")
+);
+
+--
+-- TOC Entry ID 83 (OID 20519)
+--
+-- Name: category Type: ACL Owner:
+--
+
+REVOKE ALL on "category" from PUBLIC;
+GRANT ALL on "category" to "root";
+GRANT ALL on "category" to "wallaby";
+
+--
+-- TOC Entry ID 14 (OID 20544)
+--
+-- Name: channel_id_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "channel_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 15 (OID 20544)
+--
+-- Name: channel_id_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "channel_id_seq" from PUBLIC;
+GRANT ALL on "channel_id_seq" to "root";
+GRANT ALL on "channel_id_seq" to "wallaby";
+
+--
+-- TOC Entry ID 84 (OID 20563)
+--
+-- Name: channel Type: TABLE Owner: root
+--
+
+CREATE TABLE "channel" (
+ "id" integer DEFAULT nextval('"channel_id_seq"'::text) NOT NULL,
+ "site" character varying(255) NOT NULL,
+ "file" character varying(255) NOT NULL,
+ "url" character varying(255) NOT NULL,
+ "contact" character varying(255) NOT NULL,
+ "timestamp" integer NOT NULL,
+ Constraint "channel_pkey" Primary Key ("id")
+);
+
+--
+-- TOC Entry ID 85 (OID 20563)
+--
+-- Name: channel Type: ACL Owner:
+--
+
+REVOKE ALL on "channel" from PUBLIC;
+GRANT ALL on "channel" to "root";
+GRANT ALL on "channel" to "wallaby";
+
+--
+-- TOC Entry ID 16 (OID 20591)
+--
+-- Name: chatevents_id_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "chatevents_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 17 (OID 20591)
+--
+-- Name: chatevents_id_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "chatevents_id_seq" from PUBLIC;
+GRANT ALL on "chatevents_id_seq" to "root";
+GRANT ALL on "chatevents_id_seq" to "wallaby";
+
+--
+-- TOC Entry ID 86 (OID 20610)
+--
+-- Name: chatevents Type: TABLE Owner: root
+--
+
+CREATE TABLE "chatevents" (
+ "id" integer DEFAULT nextval('"chatevents_id_seq"'::text) NOT NULL,
+ "body" character varying(255) NOT NULL,
+ "timestamp" integer NOT NULL,
+ Constraint "chatevents_pkey" Primary Key ("id")
+);
+
+--
+-- TOC Entry ID 87 (OID 20610)
+--
+-- Name: chatevents Type: ACL Owner:
+--
+
+REVOKE ALL on "chatevents" from PUBLIC;
+GRANT ALL on "chatevents" to "root";
+GRANT ALL on "chatevents" to "wallaby";
+
+--
+-- TOC Entry ID 18 (OID 20626)
+--
+-- Name: chatmembers_id_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "chatmembers_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 19 (OID 20626)
+--
+-- Name: chatmembers_id_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "chatmembers_id_seq" from PUBLIC;
+GRANT ALL on "chatmembers_id_seq" to "root";
+GRANT ALL on "chatmembers_id_seq" to "wallaby";
+
+--
+-- TOC Entry ID 88 (OID 20645)
+--
+-- Name: chatmembers Type: TABLE Owner: root
+--
+
+CREATE TABLE "chatmembers" (
+ "id" integer DEFAULT nextval('"chatmembers_id_seq"'::text) NOT NULL,
+ "nick" character varying(32) NOT NULL,
+ "timestamp" integer NOT NULL,
+ Constraint "chatmembers_pkey" Primary Key ("id")
+);
+
+--
+-- TOC Entry ID 89 (OID 20645)
+--
+-- Name: chatmembers Type: ACL Owner:
+--
+
+REVOKE ALL on "chatmembers" from PUBLIC;
+GRANT ALL on "chatmembers" to "root";
+GRANT ALL on "chatmembers" to "wallaby";
+
+--
+-- TOC Entry ID 20 (OID 20680)
+--
+-- Name: collection_cid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "collection_cid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 21 (OID 20680)
+--
+-- Name: collection_cid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "collection_cid_seq" from PUBLIC;
+GRANT ALL on "collection_cid_seq" to "root";
+GRANT ALL on "collection_cid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 90 (OID 20699)
+--
+-- Name: collection Type: TABLE Owner: root
+--
+
+CREATE TABLE "collection" (
+ "cid" integer DEFAULT nextval('"collection_cid_seq"'::text) NOT NULL,
+ "name" character varying(32) NOT NULL,
+ "types" character varying(128) NOT NULL,
+ Constraint "collection_pkey" Primary Key ("cid")
+);
+
+--
+-- TOC Entry ID 91 (OID 20699)
+--
+-- Name: collection Type: ACL Owner:
+--
+
+REVOKE ALL on "collection" from PUBLIC;
+GRANT ALL on "collection" to "root";
+GRANT ALL on "collection" to "wallaby";
+
+--
+-- TOC Entry ID 22 (OID 20718)
+--
+-- Name: comments_cid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "comments_cid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 23 (OID 20718)
+--
+-- Name: comments_cid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "comments_cid_seq" from PUBLIC;
+GRANT ALL on "comments_cid_seq" to "root";
+GRANT ALL on "comments_cid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 92 (OID 20780)
+--
+-- Name: cvs Type: TABLE Owner: root
+--
+
+CREATE TABLE "cvs" (
+ "username" character varying(32) NOT NULL,
+ "files" text NOT NULL,
+ "status" smallint NOT NULL,
+ "message" text NOT NULL,
+ "timestamp" integer NOT NULL
+);
+
+--
+-- TOC Entry ID 93 (OID 20780)
+--
+-- Name: cvs Type: ACL Owner:
+--
+
+REVOKE ALL on "cvs" from PUBLIC;
+GRANT ALL on "cvs" to "root";
+GRANT ALL on "cvs" to "wallaby";
+
+--
+-- TOC Entry ID 94 (OID 20828)
+--
+-- Name: diaries Type: TABLE Owner: root
+--
+
+CREATE TABLE "diaries" (
+ "id" integer DEFAULT nextval('"diary_id_seq"'::text) NOT NULL,
+ "author" integer NOT NULL,
+ "text" text NOT NULL,
+ "timestamp" text NOT NULL
+);
+
+--
+-- TOC Entry ID 95 (OID 20828)
+--
+-- Name: diaries Type: ACL Owner:
+--
+
+REVOKE ALL on "diaries" from PUBLIC;
+GRANT ALL on "diaries" to "root";
+GRANT ALL on "diaries" to "wallaby";
+
+--
+-- TOC Entry ID 96 (OID 20860)
+--
+-- Name: pga_layout Type: TABLE Owner: root
+--
+
+CREATE TABLE "pga_layout" (
+ "tablename" character varying(64),
+ "nrcols" smallint,
+ "colnames" text,
+ "colwidth" text
+);
+
+--
+-- TOC Entry ID 97 (OID 20860)
+--
+-- Name: pga_layout Type: ACL Owner:
+--
+
+REVOKE ALL on "pga_layout" from PUBLIC;
+GRANT ALL on "pga_layout" to PUBLIC;
+GRANT ALL on "pga_layout" to "root";
+
+--
+-- TOC Entry ID 24 (OID 21124)
+--
+-- Name: diary_lid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "diary_lid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 25 (OID 21124)
+--
+-- Name: diary_lid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "diary_lid_seq" from PUBLIC;
+GRANT ALL on "diary_lid_seq" to "root";
+GRANT ALL on "diary_lid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 98 (OID 21143)
+--
+-- Name: diary Type: TABLE Owner: root
+--
+
+CREATE TABLE "diary" (
+ "lid" integer DEFAULT nextval('"diary_lid_seq"'::text) NOT NULL,
+ "nid" integer NOT NULL,
+ "body" text NOT NULL,
+ Constraint "diary_pkey" Primary Key ("lid")
+);
+
+--
+-- TOC Entry ID 99 (OID 21143)
+--
+-- Name: diary Type: ACL Owner:
+--
+
+REVOKE ALL on "diary" from PUBLIC;
+GRANT ALL on "diary" to "root";
+GRANT ALL on "diary" to "wallaby";
+
+--
+-- TOC Entry ID 26 (OID 21174)
+--
+-- Name: entry_eid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "entry_eid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 27 (OID 21174)
+--
+-- Name: entry_eid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "entry_eid_seq" from PUBLIC;
+GRANT ALL on "entry_eid_seq" to "root";
+GRANT ALL on "entry_eid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 100 (OID 21193)
+--
+-- Name: entry Type: TABLE Owner: root
+--
+
+CREATE TABLE "entry" (
+ "eid" integer DEFAULT nextval('"entry_eid_seq"'::text) NOT NULL,
+ "name" character varying NOT NULL,
+ "attributes" character varying(32) NOT NULL,
+ "collection" character varying(32),
+ Constraint "entry_pkey" Primary Key ("eid")
+);
+
+--
+-- TOC Entry ID 101 (OID 21193)
+--
+-- Name: entry Type: ACL Owner:
+--
+
+REVOKE ALL on "entry" from PUBLIC;
+GRANT ALL on "entry" to "root";
+GRANT ALL on "entry" to "wallaby";
+
+--
+-- TOC Entry ID 28 (OID 21225)
+--
+-- Name: feed_fid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "feed_fid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 29 (OID 21225)
+--
+-- Name: feed_fid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "feed_fid_seq" from PUBLIC;
+GRANT ALL on "feed_fid_seq" to "root";
+GRANT ALL on "feed_fid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 102 (OID 21244)
+--
+-- Name: feed Type: TABLE Owner: root
+--
+
+CREATE TABLE "feed" (
+ "fid" integer DEFAULT nextval('"feed_fid_seq"'::text) NOT NULL,
+ "title" character varying(255) NOT NULL,
+ "url" character varying(255) NOT NULL,
+ "refresh" integer NOT NULL,
+ "uncache" integer NOT NULL,
+ "timestamp" integer NOT NULL,
+ "attributes" character varying(255) NOT NULL,
+ "link" character varying(255) NOT NULL,
+ "description" text NOT NULL,
+ Constraint "feed_pkey" Primary Key ("fid")
+);
+
+--
+-- TOC Entry ID 103 (OID 21244)
+--
+-- Name: feed Type: ACL Owner:
+--
+
+REVOKE ALL on "feed" from PUBLIC;
+GRANT ALL on "feed" to "root";
+GRANT ALL on "feed" to "wallaby";
+
+--
+-- TOC Entry ID 30 (OID 21287)
+--
+-- Name: file_lid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "file_lid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 31 (OID 21287)
+--
+-- Name: file_lid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "file_lid_seq" from PUBLIC;
+GRANT ALL on "file_lid_seq" to "root";
+GRANT ALL on "file_lid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 104 (OID 21306)
+--
+-- Name: file Type: TABLE Owner: root
+--
+
+CREATE TABLE "file" (
+ "lid" integer DEFAULT nextval('"file_lid_seq"'::text) NOT NULL,
+ "nid" integer NOT NULL,
+ "version" character varying(10) NOT NULL,
+ "url" character varying(255) NOT NULL,
+ "downloads" integer NOT NULL,
+ "abstract" text NOT NULL,
+ "description" text NOT NULL,
+ "homepage" character varying(255) NOT NULL,
+ Constraint "file_pkey" Primary Key ("lid")
+);
+
+--
+-- TOC Entry ID 105 (OID 21306)
+--
+-- Name: file Type: ACL Owner:
+--
+
+REVOKE ALL on "file" from PUBLIC;
+GRANT ALL on "file" to "root";
+GRANT ALL on "file" to "wallaby";
+
+--
+-- TOC Entry ID 32 (OID 21342)
+--
+-- Name: forum_lid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "forum_lid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 33 (OID 21342)
+--
+-- Name: forum_lid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "forum_lid_seq" from PUBLIC;
+GRANT ALL on "forum_lid_seq" to "root";
+GRANT ALL on "forum_lid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 106 (OID 21361)
+--
+-- Name: forum Type: TABLE Owner: root
+--
+
+CREATE TABLE "forum" (
+ "lid" integer DEFAULT nextval('"forum_lid_seq"'::text) NOT NULL,
+ "nid" integer NOT NULL,
+ "body" text NOT NULL,
+ Constraint "forum_pkey" Primary Key ("lid")
+);
+
+--
+-- TOC Entry ID 107 (OID 21361)
+--
+-- Name: forum Type: ACL Owner:
+--
+
+REVOKE ALL on "forum" from PUBLIC;
+GRANT ALL on "forum" to "root";
+GRANT ALL on "forum" to "wallaby";
+
+--
+-- TOC Entry ID 34 (OID 21392)
+--
+-- Name: item_iid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "item_iid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 35 (OID 21392)
+--
+-- Name: item_iid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "item_iid_seq" from PUBLIC;
+GRANT ALL on "item_iid_seq" to "root";
+GRANT ALL on "item_iid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 108 (OID 21411)
+--
+-- Name: item Type: TABLE Owner: root
+--
+
+CREATE TABLE "item" (
+ "iid" integer DEFAULT nextval('"item_iid_seq"'::text) NOT NULL,
+ "fid" integer NOT NULL,
+ "title" character varying(255) NOT NULL,
+ "link" character varying(255) NOT NULL,
+ "author" character varying(255) NOT NULL,
+ "description" text NOT NULL,
+ "timestamp" integer NOT NULL,
+ "attributes" character varying(255) NOT NULL,
+ Constraint "item_pkey" Primary Key ("iid")
+);
+
+--
+-- TOC Entry ID 109 (OID 21411)
+--
+-- Name: item Type: ACL Owner:
+--
+
+REVOKE ALL on "item" from PUBLIC;
+GRANT ALL on "item" to "root";
+GRANT ALL on "item" to "wallaby";
+
+--
+-- TOC Entry ID 110 (OID 21447)
+--
+-- Name: layout Type: TABLE Owner: root
+--
+
+CREATE TABLE "layout" (
+ "userid" integer NOT NULL,
+ "block" character varying(64) NOT NULL
+);
+
+--
+-- TOC Entry ID 111 (OID 21447)
+--
+-- Name: layout Type: ACL Owner:
+--
+
+REVOKE ALL on "layout" from PUBLIC;
+GRANT ALL on "layout" to "root";
+GRANT ALL on "layout" to "wallaby";
+
+--
+-- TOC Entry ID 36 (OID 21458)
+--
+-- Name: locales_id_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "locales_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 37 (OID 21458)
+--
+-- Name: locales_id_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "locales_id_seq" from PUBLIC;
+GRANT ALL on "locales_id_seq" to "root";
+GRANT ALL on "locales_id_seq" to "wallaby";
+
+--
+-- TOC Entry ID 112 (OID 21477)
+--
+-- Name: locales Type: TABLE Owner: root
+--
+
+CREATE TABLE "locales" (
+ "id" integer DEFAULT nextval('"locales_id_seq"'::text) NOT NULL,
+ "location" character varying(128) NOT NULL,
+ "string" text NOT NULL,
+ "da" text NOT NULL,
+ "fi" text NOT NULL,
+ "fr" text NOT NULL,
+ "en" text NOT NULL,
+ "es" text NOT NULL,
+ "nl" text NOT NULL,
+ "no" text NOT NULL,
+ "sw" text NOT NULL,
+ Constraint "locales_pkey" Primary Key ("id")
+);
+
+--
+-- TOC Entry ID 113 (OID 21477)
+--
+-- Name: locales Type: ACL Owner:
+--
+
+REVOKE ALL on "locales" from PUBLIC;
+GRANT ALL on "locales" to "root";
+GRANT ALL on "locales" to "wallaby";
+
+--
+-- TOC Entry ID 114 (OID 21516)
+--
+-- Name: modules Type: TABLE Owner: root
+--
+
+CREATE TABLE "modules" (
+ "name" character varying(64) NOT NULL,
+ Constraint "modules_pkey" Primary Key ("name")
+);
+
+--
+-- TOC Entry ID 115 (OID 21516)
+--
+-- Name: modules Type: ACL Owner:
+--
+
+REVOKE ALL on "modules" from PUBLIC;
+GRANT ALL on "modules" to "root";
+GRANT ALL on "modules" to "wallaby";
+
+--
+-- TOC Entry ID 38 (OID 21529)
+--
+-- Name: node_nid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "node_nid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 39 (OID 21529)
+--
+-- Name: node_nid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "node_nid_seq" from PUBLIC;
+GRANT ALL on "node_nid_seq" to "root";
+GRANT ALL on "node_nid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 116 (OID 22296)
+--
+-- Name: notify Type: TABLE Owner: root
+--
+
+CREATE TABLE "notify" (
+ "uid" integer NOT NULL,
+ "status" integer NOT NULL,
+ "node" integer NOT NULL,
+ "comment" integer NOT NULL,
+ "attempts" integer NOT NULL,
+ Constraint "notify_pkey" Primary Key ("uid")
+);
+
+--
+-- TOC Entry ID 117 (OID 22296)
+--
+-- Name: notify Type: ACL Owner:
+--
+
+REVOKE ALL on "notify" from PUBLIC;
+GRANT ALL on "notify" to "root";
+GRANT ALL on "notify" to "wallaby";
+
+--
+-- TOC Entry ID 40 (OID 22313)
+--
+-- Name: page_lid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "page_lid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 41 (OID 22313)
+--
+-- Name: page_lid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "page_lid_seq" from PUBLIC;
+GRANT ALL on "page_lid_seq" to "root";
+GRANT ALL on "page_lid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 118 (OID 22332)
+--
+-- Name: page Type: TABLE Owner: root
+--
+
+CREATE TABLE "page" (
+ "lid" integer DEFAULT nextval('"page_lid_seq"'::text) NOT NULL,
+ "nid" integer NOT NULL,
+ "link" character varying(128) DEFAULT '' NOT NULL,
+ "body" text NOT NULL,
+ "format" integer NOT NULL,
+ Constraint "page_pkey" Primary Key ("lid")
+);
+
+--
+-- TOC Entry ID 119 (OID 22332)
+--
+-- Name: page Type: ACL Owner:
+--
+
+REVOKE ALL on "page" from PUBLIC;
+GRANT ALL on "page" to "root";
+GRANT ALL on "page" to "wallaby";
+
+--
+-- TOC Entry ID 42 (OID 22366)
+--
+-- Name: poll_lid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "poll_lid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 43 (OID 22366)
+--
+-- Name: poll_lid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "poll_lid_seq" from PUBLIC;
+GRANT ALL on "poll_lid_seq" to "root";
+GRANT ALL on "poll_lid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 120 (OID 22385)
+--
+-- Name: poll Type: TABLE Owner: root
+--
+
+CREATE TABLE "poll" (
+ "lid" integer DEFAULT nextval('"poll_lid_seq"'::text) NOT NULL,
+ "nid" integer NOT NULL,
+ "runtime" integer NOT NULL,
+ "voters" text NOT NULL,
+ "active" integer NOT NULL,
+ Constraint "poll_pkey" Primary Key ("lid")
+);
+
+--
+-- TOC Entry ID 121 (OID 22385)
+--
+-- Name: poll Type: ACL Owner:
+--
+
+REVOKE ALL on "poll" from PUBLIC;
+GRANT ALL on "poll" to "root";
+GRANT ALL on "poll" to "wallaby";
+
+--
+-- TOC Entry ID 44 (OID 22418)
+--
+-- Name: poll_choices_chid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "poll_choices_chid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 45 (OID 22418)
+--
+-- Name: poll_choices_chid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "poll_choices_chid_seq" from PUBLIC;
+GRANT ALL on "poll_choices_chid_seq" to "root";
+GRANT ALL on "poll_choices_chid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 122 (OID 22437)
+--
+-- Name: poll_choices Type: TABLE Owner: root
+--
+
+CREATE TABLE "poll_choices" (
+ "chid" integer DEFAULT nextval('"poll_choices_chid_seq"'::text) NOT NULL,
+ "nid" integer NOT NULL,
+ "chtext" character varying(128) DEFAULT '' NOT NULL,
+ "chvotes" integer NOT NULL,
+ "chorder" integer NOT NULL,
+ Constraint "poll_choices_pkey" Primary Key ("chid")
+);
+
+--
+-- TOC Entry ID 123 (OID 22437)
+--
+-- Name: poll_choices Type: ACL Owner:
+--
+
+REVOKE ALL on "poll_choices" from PUBLIC;
+GRANT ALL on "poll_choices" to "root";
+GRANT ALL on "poll_choices" to "wallaby";
+
+--
+-- TOC Entry ID 124 (OID 22456)
+--
+-- Name: rating Type: TABLE Owner: root
+--
+
+CREATE TABLE "rating" (
+ "userid" integer NOT NULL,
+ "new" integer NOT NULL,
+ "old" integer NOT NULL,
+ Constraint "user_pkey" Primary Key ("userid")
+);
+
+--
+-- TOC Entry ID 125 (OID 22456)
+--
+-- Name: rating Type: ACL Owner:
+--
+
+REVOKE ALL on "rating" from PUBLIC;
+GRANT ALL on "rating" to "root";
+GRANT ALL on "rating" to "wallaby";
+
+--
+-- TOC Entry ID 126 (OID 22471)
+--
+-- Name: referer Type: TABLE Owner: root
+--
+
+CREATE TABLE "referer" (
+ "url" character varying(255) DEFAULT '' NOT NULL,
+ "timestamp" integer NOT NULL
+);
+
+--
+-- TOC Entry ID 127 (OID 22471)
+--
+-- Name: referer Type: ACL Owner:
+--
+
+REVOKE ALL on "referer" from PUBLIC;
+GRANT ALL on "referer" to "root";
+GRANT ALL on "referer" to "wallaby";
+
+--
+-- TOC Entry ID 46 (OID 22483)
+--
+-- Name: role_rid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "role_rid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 47 (OID 22483)
+--
+-- Name: role_rid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "role_rid_seq" from PUBLIC;
+GRANT ALL on "role_rid_seq" to "root";
+GRANT ALL on "role_rid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 48 (OID 22534)
+--
+-- Name: site_sid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "site_sid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 49 (OID 22534)
+--
+-- Name: site_sid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "site_sid_seq" from PUBLIC;
+GRANT ALL on "site_sid_seq" to "root";
+GRANT ALL on "site_sid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 128 (OID 22553)
+--
+-- Name: site Type: TABLE Owner: root
+--
+
+CREATE TABLE "site" (
+ "sid" integer DEFAULT nextval('"site_sid_seq"'::text) NOT NULL,
+ "name" character varying(128) DEFAULT '' NOT NULL,
+ "link" character varying(255) DEFAULT '' NOT NULL,
+ "size" text NOT NULL,
+ "timestamp" integer NOT NULL,
+ "feed" character varying(255) DEFAULT '' NOT NULL,
+ Constraint "site_pkey" Primary Key ("sid")
+);
+
+--
+-- TOC Entry ID 129 (OID 22553)
+--
+-- Name: site Type: ACL Owner:
+--
+
+REVOKE ALL on "site" from PUBLIC;
+GRANT ALL on "site" to "root";
+GRANT ALL on "site" to "wallaby";
+
+--
+-- TOC Entry ID 50 (OID 22590)
+--
+-- Name: story_lid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "story_lid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 51 (OID 22590)
+--
+-- Name: story_lid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "story_lid_seq" from PUBLIC;
+GRANT ALL on "story_lid_seq" to "root";
+GRANT ALL on "story_lid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 130 (OID 22609)
+--
+-- Name: story Type: TABLE Owner: root
+--
+
+CREATE TABLE "story" (
+ "lid" integer DEFAULT nextval('"story_lid_seq"'::text) NOT NULL,
+ "nid" integer NOT NULL,
+ "abstract" text NOT NULL,
+ "body" text NOT NULL,
+ Constraint "story_pkey" Primary Key ("lid")
+);
+
+--
+-- TOC Entry ID 131 (OID 22609)
+--
+-- Name: story Type: ACL Owner:
+--
+
+REVOKE ALL on "story" from PUBLIC;
+GRANT ALL on "story" to "root";
+GRANT ALL on "story" to "wallaby";
+
+--
+-- TOC Entry ID 52 (OID 22641)
+--
+-- Name: tag_tid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "tag_tid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 53 (OID 22641)
+--
+-- Name: tag_tid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "tag_tid_seq" from PUBLIC;
+GRANT ALL on "tag_tid_seq" to "root";
+GRANT ALL on "tag_tid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 132 (OID 22660)
+--
+-- Name: tag Type: TABLE Owner: root
+--
+
+CREATE TABLE "tag" (
+ "tid" integer DEFAULT nextval('"tag_tid_seq"'::text) NOT NULL,
+ "name" character varying(32) DEFAULT '' NOT NULL,
+ "attributes" character varying(255) DEFAULT '' NOT NULL,
+ "collections" character varying(32) DEFAULT '' NOT NULL,
+ Constraint "tag_pkey" Primary Key ("tid")
+);
+
+--
+-- TOC Entry ID 133 (OID 22660)
+--
+-- Name: tag Type: ACL Owner:
+--
+
+REVOKE ALL on "tag" from PUBLIC;
+GRANT ALL on "tag" to "root";
+GRANT ALL on "tag" to "wallaby";
+
+--
+-- TOC Entry ID 54 (OID 22680)
+--
+-- Name: topic_tid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "topic_tid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 55 (OID 22680)
+--
+-- Name: topic_tid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "topic_tid_seq" from PUBLIC;
+GRANT ALL on "topic_tid_seq" to "root";
+GRANT ALL on "topic_tid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 134 (OID 22699)
+--
+-- Name: topic Type: TABLE Owner: root
+--
+
+CREATE TABLE "topic" (
+ "tid" integer DEFAULT nextval('"topic_tid_seq"'::text) NOT NULL,
+ "pid" integer NOT NULL,
+ "name" character varying(32) DEFAULT '' NOT NULL,
+ "moderate" text NOT NULL,
+ Constraint "topic_pkey" Primary Key ("tid")
+);
+
+--
+-- TOC Entry ID 135 (OID 22699)
+--
+-- Name: topic Type: ACL Owner:
+--
+
+REVOKE ALL on "topic" from PUBLIC;
+GRANT ALL on "topic" to "root";
+GRANT ALL on "topic" to "wallaby";
+
+--
+-- TOC Entry ID 56 (OID 22732)
+--
+-- Name: trip_link_lid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "trip_link_lid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 57 (OID 22732)
+--
+-- Name: trip_link_lid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "trip_link_lid_seq" from PUBLIC;
+GRANT ALL on "trip_link_lid_seq" to "root";
+GRANT ALL on "trip_link_lid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 136 (OID 22751)
+--
+-- Name: trip_link Type: TABLE Owner: root
+--
+
+CREATE TABLE "trip_link" (
+ "lid" integer DEFAULT nextval('"trip_link_lid_seq"'::text) NOT NULL,
+ "nid" integer NOT NULL,
+ "url" text NOT NULL,
+ "body" text NOT NULL,
+ Constraint "trip_link_pkey" Primary Key ("lid")
+);
+
+--
+-- TOC Entry ID 137 (OID 22751)
+--
+-- Name: trip_link Type: ACL Owner:
+--
+
+REVOKE ALL on "trip_link" from PUBLIC;
+GRANT ALL on "trip_link" to "root";
+GRANT ALL on "trip_link" to "wallaby";
+
+--
+-- TOC Entry ID 58 (OID 22783)
+--
+-- Name: users_uid_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "users_uid_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 59 (OID 22783)
+--
+-- Name: users_uid_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "users_uid_seq" from PUBLIC;
+GRANT ALL on "users_uid_seq" to "root";
+GRANT ALL on "users_uid_seq" to "wallaby";
+
+--
+-- TOC Entry ID 138 (OID 22855)
+--
+-- Name: variable Type: TABLE Owner: root
+--
+
+CREATE TABLE "variable" (
+ "name" character varying(32) DEFAULT '' NOT NULL,
+ "value" text NOT NULL,
+ Constraint "variable_pkey" Primary Key ("name")
+);
+
+--
+-- TOC Entry ID 139 (OID 22855)
+--
+-- Name: variable Type: ACL Owner:
+--
+
+REVOKE ALL on "variable" from PUBLIC;
+GRANT ALL on "variable" to "root";
+GRANT ALL on "variable" to "wallaby";
+
+--
+-- TOC Entry ID 60 (OID 22885)
+--
+-- Name: watchdog_id_seq Type: SEQUENCE Owner: root
+--
+
+CREATE SEQUENCE "watchdog_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+
+--
+-- TOC Entry ID 61 (OID 22885)
+--
+-- Name: watchdog_id_seq Type: ACL Owner:
+--
+
+REVOKE ALL on "watchdog_id_seq" from PUBLIC;
+GRANT ALL on "watchdog_id_seq" to "root";
+GRANT ALL on "watchdog_id_seq" to "wallaby";
+
+--
+-- TOC Entry ID 140 (OID 22904)
+--
+-- Name: watchdog Type: TABLE Owner: root
+--
+
+CREATE TABLE "watchdog" (
+ "id" integer DEFAULT nextval('"watchdog_id_seq"'::text) NOT NULL,
+ "userid" integer NOT NULL,
+ "type" character varying(16) DEFAULT '' NOT NULL,
+ "message" character varying(255) DEFAULT '' NOT NULL,
+ "location" character varying(128) DEFAULT '' NOT NULL,
+ "hostname" character varying(128) DEFAULT '' NOT NULL,
+ "timestamp" integer NOT NULL,
+ Constraint "watchdog_pkey" Primary Key ("id")
+);
+
+--
+-- TOC Entry ID 141 (OID 22904)
+--
+-- Name: watchdog Type: ACL Owner:
+--
+
+REVOKE ALL on "watchdog" from PUBLIC;
+GRANT ALL on "watchdog" to "root";
+GRANT ALL on "watchdog" to "wallaby";
+
+--
+-- TOC Entry ID 142 (OID 23291)
+--
+-- Name: users Type: TABLE Owner: root
+--
+
+CREATE TABLE "users" (
+ "uid" integer DEFAULT nextval('"users_uid_seq"'::text) NOT NULL,
+ "name" character varying(60) DEFAULT '' NOT NULL,
+ "mail" character varying(64) DEFAULT '',
+ "homepage" character varying(128) DEFAULT '',
+ "mode" integer,
+ "sort" integer,
+ "threshold" integer,
+ "theme" character varying(255) DEFAULT '',
+ "signature" character varying(255) DEFAULT '',
+ "last_access" integer,
+ "last_host" character varying(255),
+ "status" integer NOT NULL,
+ "timezone" character varying(8),
+ "rating" numeric(8,2),
+ "language" character(2) DEFAULT '',
+ "role" character varying(32) DEFAULT '' NOT NULL,
+ "session" character varying(128) DEFAULT '',
+ "hostname" character varying(128) DEFAULT '',
+ "timestamp" integer NOT NULL,
+ "jabber" character varying(128) DEFAULT '',
+ "drupal" character varying(128) DEFAULT '',
+ "init" character varying(64) DEFAULT '',
+ "real_email" character varying(64) DEFAULT '',
+ "pass" character varying(32) DEFAULT '',
+ Constraint "users_pkey" Primary Key ("uid")
+);
+
+--
+-- TOC Entry ID 143 (OID 23291)
+--
+-- Name: users Type: ACL Owner:
+--
+
+REVOKE ALL on "users" from PUBLIC;
+GRANT ALL on "users" to "root";
+GRANT ALL on "users" to "wallaby";
+
+--
+-- TOC Entry ID 144 (OID 23453)
+--
+-- Name: blocks Type: TABLE Owner: root
+--
+
+CREATE TABLE "blocks" (
+ "name" character varying(64) NOT NULL,
+ "module" character varying(64) NOT NULL,
+ "delta" smallint NOT NULL,
+ "status" smallint,
+ "weight" smallint,
+ "region" smallint,
+ "remove" smallint,
+ Constraint "blocks_pkey" Primary Key ("name")
+);
+
+--
+-- TOC Entry ID 145 (OID 23453)
+--
+-- Name: blocks Type: ACL Owner:
+--
+
+REVOKE ALL on "blocks" from PUBLIC;
+GRANT ALL on "blocks" to "root";
+GRANT ALL on "blocks" to "wallaby";
+
+--
+-- TOC Entry ID 146 (OID 23732)
+--
+-- Name: role Type: TABLE Owner: root
+--
+
+CREATE TABLE "role" (
+ "rid" integer DEFAULT nextval('"role_rid_seq"'::text) NOT NULL,
+ "name" character varying(32) DEFAULT '' NOT NULL,
+ "perm" text,
+ Constraint "role_pkey" Primary Key ("rid")
+);
+
+--
+-- TOC Entry ID 147 (OID 23732)
+--
+-- Name: role Type: ACL Owner:
+--
+
+REVOKE ALL on "role" from PUBLIC;
+GRANT ALL on "role" to "root";
+GRANT ALL on "role" to "wallaby";
+
+--
+-- TOC Entry ID 148 (OID 23996)
+--
+-- Name: node Type: TABLE Owner: root
+--
+
+CREATE TABLE "node" (
+ "nid" integer DEFAULT nextval('"node_nid_seq"'::text) NOT NULL,
+ "lid" integer NOT NULL,
+ "type" character varying(16) NOT NULL,
+ "score" integer NOT NULL,
+ "votes" integer NOT NULL,
+ "author" integer NOT NULL,
+ "status" integer NOT NULL,
+ "timestamp" integer NOT NULL,
+ "comment" smallint NOT NULL,
+ "promote" smallint NOT NULL,
+ "moderate" text NOT NULL,
+ "users" text,
+ "timestamp_posted" integer,
+ "timestamp_queued" integer,
+ "timestamp_hidden" integer,
+ "attributes" character varying(255),
+ "title" character varying(128),
+ Constraint "node_pkey" Primary Key ("nid")
+);
+
+--
+-- TOC Entry ID 149 (OID 23996)
+--
+-- Name: node Type: ACL Owner:
+--
+
+REVOKE ALL on "node" from PUBLIC;
+GRANT ALL on "node" to "root";
+GRANT ALL on "node" to "wallaby";
+
+--
+-- TOC Entry ID 150 (OID 24087)
+--
+-- Name: book Type: TABLE Owner: root
+--
+
+CREATE TABLE "book" (
+ "lid" integer DEFAULT nextval('"book_lid_seq"'::text) NOT NULL,
+ "nid" integer NOT NULL,
+ "body" text NOT NULL,
+ "section" integer,
+ "parent" integer NOT NULL,
+ "weight" integer NOT NULL,
+ "pid" integer NOT NULL,
+ "log" text NOT NULL,
+ Constraint "book_pkey" Primary Key ("lid")
+);
+
+--
+-- TOC Entry ID 151 (OID 24087)
+--
+-- Name: book Type: ACL Owner:
+--
+
+REVOKE ALL on "book" from PUBLIC;
+GRANT ALL on "book" to "root";
+GRANT ALL on "book" to "wallaby";
+
+--
+-- TOC Entry ID 152 (OID 24321)
+--
+-- Name: moderate Type: TABLE Owner: root
+--
+
+CREATE TABLE "moderate" (
+ "cid" integer,
+ "nid" integer,
+ "uid" integer NOT NULL,
+ "score" smallint NOT NULL,
+ "timestamp" integer NOT NULL
+);
+
+--
+-- TOC Entry ID 153 (OID 24321)
+--
+-- Name: moderate Type: ACL Owner:
+--
+
+REVOKE ALL on "moderate" from PUBLIC;
+GRANT ALL on "moderate" to "root";
+GRANT ALL on "moderate" to "wallaby";
+
+--
+-- TOC Entry ID 154 (OID 24599)
+--
+-- Name: comments Type: TABLE Owner: root
+--
+
+CREATE TABLE "comments" (
+ "cid" integer DEFAULT nextval('"comments_cid_seq"'::text) NOT NULL,
+ "pid" integer NOT NULL,
+ "lid" integer NOT NULL,
+ "author" integer NOT NULL,
+ "subject" character varying(64) NOT NULL,
+ "comment" text NOT NULL,
+ "hostname" character varying(128) NOT NULL,
+ "timestamp" integer NOT NULL,
+ "link" character varying(16) NOT NULL,
+ Constraint "comments_pkey" Primary Key ("cid")
+);
+
+--
+-- TOC Entry ID 155 (OID 24599)
+--
+-- Name: comments Type: ACL Owner:
+--
+
+REVOKE ALL on "comments" from PUBLIC;
+GRANT ALL on "comments" to "root";
+GRANT ALL on "comments" to "wallaby";
+
+--
+-- TOC Entry ID 156 (OID 20233)
+--
+-- Name: "mask_access_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "mask_access_ukey" on "access" using btree ( "mask" "varchar_ops" );
+
+--
+-- TOC Entry ID 157 (OID 20393)
+--
+-- Name: "title_boxes_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "title_boxes_ukey" on "boxes" using btree ( "title" "varchar_ops" );
+
+--
+-- TOC Entry ID 158 (OID 20393)
+--
+-- Name: "info_boxes_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "info_boxes_ukey" on "boxes" using btree ( "info" "varchar_ops" );
+
+--
+-- TOC Entry ID 159 (OID 20519)
+--
+-- Name: "name_category_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "name_category_ukey" on "category" using btree ( "name" "varchar_ops" );
+
+--
+-- TOC Entry ID 160 (OID 20563)
+--
+-- Name: "url_channel_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "url_channel_ukey" on "channel" using btree ( "url" "varchar_ops" );
+
+--
+-- TOC Entry ID 161 (OID 20563)
+--
+-- Name: "file_channel_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "file_channel_ukey" on "channel" using btree ( "file" "varchar_ops" );
+
+--
+-- TOC Entry ID 162 (OID 20563)
+--
+-- Name: "site_channel_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "site_channel_ukey" on "channel" using btree ( "site" "varchar_ops" );
+
+--
+-- TOC Entry ID 163 (OID 20699)
+--
+-- Name: "name_collection_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "name_collection_ukey" on "collection" using btree ( "name" "varchar_ops" );
+
+--
+-- TOC Entry ID 169 (OID 21193)
+--
+-- Name: "entry_namcoll_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "entry_namcoll_ukey" on "entry" using btree ( "name" "varchar_ops", "collection" "varchar_ops" );
+
+--
+-- TOC Entry ID 164 (OID 21244)
+--
+-- Name: "url_feed_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "url_feed_ukey" on "feed" using btree ( "url" "varchar_ops" );
+
+--
+-- TOC Entry ID 165 (OID 21244)
+--
+-- Name: "title_feed_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "title_feed_ukey" on "feed" using btree ( "title" "varchar_ops" );
+
+--
+-- TOC Entry ID 166 (OID 22553)
+--
+-- Name: "link_site_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "link_site_ukey" on "site" using btree ( "link" "varchar_ops" );
+
+--
+-- TOC Entry ID 167 (OID 22553)
+--
+-- Name: "name_site_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "name_site_ukey" on "site" using btree ( "name" "varchar_ops" );
+
+--
+-- TOC Entry ID 170 (OID 22660)
+--
+-- Name: "tag_namecoll_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "tag_namecoll_ukey" on "tag" using btree ( "name" "varchar_ops", "collections" "varchar_ops" );
+
+--
+-- TOC Entry ID 168 (OID 22699)
+--
+-- Name: "name_topic_ukey" Type: INDEX Owner: root
+--
+
+CREATE UNIQUE INDEX "name_topic_ukey" on "topic" using btree ( "name" "varchar_ops" );
+
+--
+-- TOC Entry ID 171 (OID 24321)
+--
+-- Name: "moderate_cid_key" Type: INDEX Owner: root
+--
+
+CREATE INDEX "moderate_cid_key" on "moderate" using btree ( "cid" "int4_ops" );
+
+--
+-- TOC Entry ID 172 (OID 24321)
+--
+-- Name: "moderate_nid_key" Type: INDEX Owner: root
+--
+
+CREATE INDEX "moderate_nid_key" on "moderate" using btree ( "nid" "int4_ops" );
+
+--
+-- TOC Entry ID 173 (OID 24599)
+--
+-- Name: "lid_comments_key" Type: INDEX Owner: root
+--
+
+CREATE INDEX "lid_comments_key" on "comments" using btree ( "lid" "int4_ops" );
+
diff --git a/includes/comment.inc b/includes/comment.inc
index fb1b48e79..4f4531e14 100644
--- a/includes/comment.inc
+++ b/includes/comment.inc
@@ -78,7 +78,7 @@ function comment_reply($pid, $id) {
global $theme;
if ($pid) {
- $item = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.cid = '$pid'"));
+ $item = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN users u ON c.author = u.uid WHERE c.cid = '$pid'"));
comment_view(new Comment($item->uid, $item->name, $item->subject, $item->comment, $item->timestamp, $item->url, $item->cid, $item->lid), t("reply to this comment"));
}
else {
@@ -150,7 +150,7 @@ function comment_moderation($comment) {
$options .= " <option value=\"$key\"". ($moderate->score == $key ? " selected=\"selected\"" : "") .">$value</option>\n";
}
- $output .= "<select name=\"moderate[comment][$comment->cid]\">$options</select><br />". ($comment->score ? $comment->score : "--") ." / $comment->votes";
+ $output .= "<select name=\"moderate[comment][$comment->cid]\">$options</select><br />". ($comment->score ? $comment->score : "--") ." / $comment->votes";
return $output;
}
@@ -176,7 +176,7 @@ function comment_order($order) {
function comment_query($lid, $order, $pid = -1) {
- $query .= "SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.lid = '$lid'";
+ $query .= "SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN users u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.lid = '$lid'";
if ($pid >= 0) {
$query .= " AND pid = '$pid'";
@@ -235,7 +235,7 @@ function comment_view($comment, $folded = 0) {
function comment_thread_min($cid, $threshold) {
global $user;
- $result = db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.pid = '$cid' GROUP BY c.cid ORDER BY c.timestamp, c.cid");
+ $result = db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN users u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.pid = '$cid' GROUP BY c.cid ORDER BY c.timestamp, c.cid");
while ($comment = db_fetch_object($result)) {
print "<ul>";
@@ -257,7 +257,7 @@ function comment_thread_max($cid, $mode, $threshold, $level = 0, $dummy = 0) {
** in terms of speed and size.
*/
- $result = db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.pid = '$cid' GROUP BY c.cid ORDER BY c.timestamp, c.cid");
+ $result = db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN users u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.pid = '$cid' GROUP BY c.cid ORDER BY c.timestamp, c.cid");
while ($comment = db_fetch_object($result)) {
print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td width=\"". ($level * 25) ."\">&nbsp;</td><td>\n";
@@ -307,7 +307,7 @@ function comment_render($lid, $cid) {
$theme->box(t("Control panel"), $theme->comment_controls($threshold, $mode, $order));
if ($cid > 0) {
- $result = db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.cid = '$cid' GROUP BY c.cid");
+ $result = db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN users u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.cid = '$cid' GROUP BY c.cid");
if ($comment = db_fetch_object($result)) {
comment_view($comment, comment_links($comment));
}
diff --git a/includes/common.inc b/includes/common.inc
index 822ac0a1b..594140a54 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -34,7 +34,7 @@ function error_handler($errno, $message, $filename, $line, $variables) {
function watchdog($type, $message) {
global $user;
- db_query("INSERT INTO watchdog (user, type, message, location, hostname, timestamp) VALUES ('$user->uid', '". check_input($type) ."', '". check_input($message) ."', '". check_input(getenv("REQUEST_URI")) ."', '". check_input(getenv("REMOTE_ADDR")) ."', '". time() ."')");
+ db_query("INSERT INTO watchdog (userid, type, message, location, hostname, timestamp) VALUES ('$user->uid', '". check_input($type) ."', '". check_input($message) ."', '". check_input(getenv("REQUEST_URI")) ."', '". check_input(getenv("REMOTE_ADDR")) ."', '". time() ."')");
}
function throttle($type, $rate) {
diff --git a/includes/conf.php b/includes/conf.php
index a0443d75a..7a89970c2 100644
--- a/includes/conf.php
+++ b/includes/conf.php
@@ -3,10 +3,9 @@
#
# Database settings:
#
-$db_host = "localhost";
-$db_user = "drop"; // username
-$db_pass = "drop"; // password
-$db_name = "database"; // database
+
+# $db_url = "pgsql://userer:password@hostname/database";
+# $db_url = "mysql://userer:password@hostname/database";
#
# Themes:
diff --git a/includes/database.inc b/includes/database.inc
index 8aa5787fa..be3bdbf17 100644
--- a/includes/database.inc
+++ b/includes/database.inc
@@ -1,44 +1,63 @@
<?php
-function db_connect($host, $user, $pass, $name) {
- mysql_pconnect($host, $user, $pass) or die(mysql_error());
- mysql_select_db($name) or die ("unable to select database");
- // NOTE: we are using a persistent connection!
-}
+require_once 'DB.php';
+/*
+** Setup a database connection:
+*/
-function db_query($query, $debug = 0) {
- $result = mysql_query($query);
- if ($debug) print "<P>query: $query<BR>error:". mysql_error() ."</P>";
- if ($result) return $result;
- else watchdog("error", "database: ". mysql_error() ."\nquery: ". htmlspecialchars($query));
+$db_handle = DB::connect($db_url);
+if (DB::isError($db_handle)) {
+ die ("Database problem: ". $db_handle->getMessage());
}
+$db_handle->setFetchMode(DB_FETCHMODE_ASSOC);
-function db_fetch_object($qid) {
- if ($qid) return mysql_fetch_object($qid);
-}
+function db_query($sql, $debug = 0) {
+ global $db_handle;
-function db_num_rows($qid) {
- if ($qid) return mysql_num_rows($qid);
+ $result = $db_handle->query($sql);
+ if (DB::isError($result)) {
+ //if ($debug) {
+ print "<p>query: $sql<br />error:". $result->getMessage() ."</p>";
+ //}
+ watchdog("error", "database: ". $result->getMessage() ."\nquery: ". htmlspecialchars($sql));
+ }
+ return $result;
}
-function db_fetch_row($qid) {
- if ($qid) return mysql_fetch_row($qid);
+function db_fetch_object($result) {
+ if ($result) {
+ return $result->fetchRow(DB_FETCHMODE_OBJECT);
+ }
}
-function db_fetch_array($qid) {
- if ($qid) return mysql_fetch_array($qid, MYSQL_ASSOC);
+function db_fetch_array($result) {
+ if ($result) {
+ return $result->fetchRow(DB_FETCHMODE_ASSOC);
+ }
}
-function db_result($qid, $field = 0) {
- if ($qid) return mysql_result($qid, $field);
+function db_num_rows($result) {
+ if ($result) {
+ return $result->numRows($result);
+ }
}
-function db_insert_id() {
- return mysql_insert_id();
+function db_result($result, $field = 0) {
+ if ($result) {
+ $tmp = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ return $tmp[$field];
+ }
}
-// Setup database connection:
-db_connect($db_host, $db_user, $db_pass, $db_name);
+function db_error($result) {
+ global $db_handle;
+
+ if (DB::isError($db_handle)) {
+ return 1;
+ }
+
+ return 0;
+}
?> \ No newline at end of file
diff --git a/includes/module.inc b/includes/module.inc
index 651c2e404..4b6959c34 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -59,10 +59,10 @@ function module_rehash_blocks($name) {
$block[$item] = addslashes($data);
}
if (!db_fetch_object(db_query("SELECT * FROM blocks WHERE module = '$name' AND name = '$block[info]'"))) {
- db_query("INSERT INTO blocks (name, module, offset) VALUES ('$block[info]', '$name', '$offset')");
+ db_query("INSERT INTO blocks (name, module, delta) VALUES ('$block[info]', '$name', '$offset')");
}
else {
- db_query("UPDATE blocks SET offset = '$offset', remove = '0' WHERE module = '$name' AND name = '$block[info]'");
+ db_query("UPDATE blocks SET delta = '$offset', remove = '0' WHERE module = '$name' AND name = '$block[info]'");
}
}
}
@@ -88,4 +88,4 @@ function module_rehash($name) {
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/node.inc b/includes/node.inc
index 67c8a51f0..747c8d8b4 100644
--- a/includes/node.inc
+++ b/includes/node.inc
@@ -18,7 +18,19 @@ function _node_get($conditions) {
}
if ($type) {
- return db_query("SELECT n.*, l.*, u.uid, u.name, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN user u ON n.author = u.uid LEFT JOIN moderate m ON m.nid = n.nid WHERE $where GROUP BY n.nid ORDER BY n.timestamp DESC");
+ $result = db_query("SELECT n.*, l.*, u.uid, u.name FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.uid WHERE $where ORDER BY n.timestamp DESC");
+
+/*
+ db_query ("BEGIN");
+ db_query ("CREATE TEMPORARY TABLE modhole AS SELECT n.nid, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.uid LEFT JOIN moderate m ON m.nid = n.nid WHERE $where GROUP BY n.nid");
+ $result = db_query ("SELECT n.*, l.*, u.uid, u.name, m.score AS score, m.votes AS votes FROM node n INNER JOIN modhole m ON m.nid = n.nid LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.uid WHERE $where ORDER BY n.timestamp DESC");
+ db_query("DROP TABLE modhole");
+ db_query("COMMIT");
+
+ 'score' isn't in GROUP BY
+*/
+
+ return $result;
}
}
@@ -64,6 +76,8 @@ function node_get_comments($nid) {
}
function node_save($node, $filter) {
+ global $db_handle;
+
$rows = array(nid, lid, cid, tid, type, title, score, votes, author, status, comment, promote, moderate, attributes, timestamp, timestamp_posted, timestamp_queued, timestamp_hidden);
if ($node[nid] > 0) {
@@ -118,26 +132,34 @@ function node_save($node, $filter) {
$f2 = implode(", ", $f2);
$v2 = implode(", ", $v2);
- // insert data, try to roll-back when something goes wrong:
- $result = db_query("INSERT INTO node ($f1) VALUES ($v1)");
- if ($result && $nid = db_insert_id()) {
- $result = db_query("INSERT INTO $filter[type] ($f2, nid) VALUES ($v2, $nid)");
- if ($result && $lid = db_insert_id()) {
- $result = db_query("UPDATE node SET lid = '$lid' WHERE nid = '$nid'");
- if ($result) {
- watchdog("special", "node: added $filter[type] '$node[title]'");
+
+ $result = db_query ("BEGIN");
+ if (db_error ($result)) {
+ watchdog ("error", "database: ". $result->getMessage () ."\nquery: ". htmlspecialchars ("BEGIN"));
+ }
+ else {
+
+ $nid = $db_handle->nextId ("node_nid");
+ $lid = $db_handle->nextId ($filter[type] . "_lid");
+
+ $result = db_query ("INSERT INTO node ($f1, nid, lid) VALUES ($v1, '$nid', '$lid')");
+ if (db_error ($result)) {
+ watchdog("warning", "node: added $filter[type] '$node[title]' - failed");
+ }
+ else {
+ $result = db_query ("INSERT INTO $filter[type] ($f2, nid, lid) VALUES ($v2, '$nid', '$lid')");
+ if (db_error ($result)) {
+ watchdog("warning", "node: added $filter[type] '$node[title]' - failed");
}
else {
- watchdog("warning", "node: added $filter[type] '$node[title]' - failed");
+ $result = db_query ("COMMIT");
+ if (db_error ($result)) {
+ watchdog ("error", "database: ". $result->getMessage () ."\nquery: ". htmlspecialchars ("BEGIN"));
+ $db_handle->rollback ();
+ }
+ watchdog("special", "node: added $filter[type] '$node[title]'");
}
}
- else {
- db_query("DELETE FROM node WHERE nid = '$nid'");
- watchdog("warning", "node: added $filter[type] '$node[title]' - failed");
- }
- }
- else {
- watchdog("warning", "node: added $filter[type] '$node[title]' - failed");
}
}
@@ -163,9 +185,7 @@ function node_form($node) {
}
function node_status($value) {
-
$status = array("dumped", "expired", "queued", "posted");
-
if (module_exist($value)) {
return array_intersect($status, node_invoke($value, "status"));
}
@@ -278,4 +298,4 @@ function node_moderation($nid) {
return $output;
}
-?> \ No newline at end of file
+?>
diff --git a/includes/theme.inc b/includes/theme.inc
index 345275617..a4d0eb2a6 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -96,12 +96,13 @@ function theme_blocks($region, $theme) {
}
break;
case "/index.php":
- if ($user->uid) $result = db_query("SELECT * FROM blocks b LEFT JOIN layout l ON b.name = l.block WHERE (b.status = 2 OR (b.status = 1 AND l.user = '$user->uid'))". (($region == "left" || $region == "right") ? ($region == "left" ? " AND b.region = 0" : " AND b.region = 1") : "") ." ORDER BY weight");
+
+ if ($user->uid) $result = db_query("SELECT * FROM blocks b LEFT JOIN layout l ON b.name = l.block WHERE (b.status = 2 OR (b.status = 1 AND l.userid = '$user->uid'))". (($region == "left" || $region == "right") ? ($region == "left" ? " AND b.region = 0" : " AND b.region = 1") : "") ." ORDER BY weight");
else $result = db_query("SELECT * FROM blocks WHERE status = 2". (($region == "left" || $region == "right") ? ($region == "left" ? " AND region = 0" : " AND region = 1") : "") ." ORDER BY weight");
- while ($block = db_fetch_object($result)) {
+ while ($result && ($block = db_fetch_object($result))) {
$blocks = module_invoke($block->module, "block");
if ($blocks[$block->offset]["content"])
- $theme->box(t($blocks[$block->offset]["subject"]), $blocks[$block->offset]["content"], $region);
+ $theme->box(t($blocks[$block->delta]["subject"]), $blocks[$block->delta]["content"], $region);
}
break;
}
diff --git a/modules/aggregator.module b/modules/aggregator.module
index d3d1af4ce..7798d1f5f 100644
--- a/modules/aggregator.module
+++ b/modules/aggregator.module
@@ -313,7 +313,7 @@ function import_get_bundle($bid) {
}
function import_view() {
- $result = db_query("SELECT f.*, COUNT(i.iid) AS items FROM feed f LEFT JOIN item i ON f.fid = i.fid GROUP BY f.fid ORDER BY f.title");
+ $result = db_query("SELECT f.*, COUNT(i.iid) AS items FROM feed f LEFT JOIN item i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.uncache, f.timestamp, f.attributes, f.link, f.description ORDER BY f.title");
$output .= "<h3>Feed overview</h3>";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index d3d1af4ce..7798d1f5f 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -313,7 +313,7 @@ function import_get_bundle($bid) {
}
function import_view() {
- $result = db_query("SELECT f.*, COUNT(i.iid) AS items FROM feed f LEFT JOIN item i ON f.fid = i.fid GROUP BY f.fid ORDER BY f.title");
+ $result = db_query("SELECT f.*, COUNT(i.iid) AS items FROM feed f LEFT JOIN item i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.uncache, f.timestamp, f.attributes, f.link, f.description ORDER BY f.title");
$output .= "<h3>Feed overview</h3>";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
diff --git a/modules/blog.module b/modules/blog.module
index 19e8b97e1..56d7bfa0c 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -15,7 +15,7 @@ function blog_help() {
}
function blog_cron() {
- $result = db_query("SELECT n.nid, n.timestamp, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN moderate m ON m.nid = n.nid WHERE n.type = 'blog' AND n.status = '". node_status("posted") ."' GROUP BY n.nid ORDER BY n.timestamp DESC LIMIT 30");
+ $result = db_query("SELECT n.nid, n.timestamp, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN moderate m ON m.nid = n.nid WHERE n.type = 'blog' AND n.status = '". node_status("posted") ."' GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.timestamp DESC LIMIT 30");
while ($node = db_fetch_object($result)) {
if ($node->score > 3 && $node->votes > 4) {
db_query("UPDATE node SET promote = '1' WHERE nid = '$node->nid'");
@@ -49,12 +49,14 @@ function blog_feed_user($uid = 0, $date = 0) {
$date = time();
}
- $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN user u ON n.author = u.uid WHERE u.uid = '$uid' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.lid DESC LIMIT 15");
+ $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid WHERE u.uid = '$uid' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.lid DESC LIMIT 15");
while ($blog = db_fetch_object($result)) {
$items .= format_rss_item($blog->title, path_uri() ."node.php?id=$blog->nid", $blog->body);
}
$output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
+ $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n";
+ $output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
$output .= "<rss version=\"0.91\">\n";
$output .= format_rss_channel("$account->name's blog", path_uri() ."module.php?mod=blog&op=view&id=$account->uid", "$account->name's blog", $items);
$output .= "</rss>\n";
@@ -66,7 +68,7 @@ function blog_feed_user($uid = 0, $date = 0) {
}
function blog_feed_last() {
- $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN user u ON n.author = u.uid ORDER BY b.lid DESC LIMIT 15");
+ $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid ORDER BY b.lid DESC LIMIT 15");
while ($blog = db_fetch_object($result)) {
$items .= format_rss_item($blog->title, path_uri() ."module.php?mod=blog&op=view&id=$blog->uid", $blog->body);
}
@@ -96,7 +98,7 @@ function blog_page_user($uid = 0, $date = 0) {
$date = time();
}
- $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN user u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid WHERE u.uid = '$account->uid' AND n.timestamp <= '$date' AND n.timestamp >= '". ($date - 2592000) ."' GROUP BY n.nid ORDER BY n.nid DESC LIMIT 20");
+ $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid WHERE u.uid = '$account->uid' AND n.timestamp <= '$date' AND n.timestamp >= '". ($date - 2592000) ."' GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20");
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">";
@@ -136,7 +138,7 @@ function blog_page_user($uid = 0, $date = 0) {
function blog_page_last() {
global $theme, $user;
- $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN user u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid GROUP BY n.nid ORDER BY n.nid DESC LIMIT 20");
+ $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20");
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">";
@@ -349,7 +351,7 @@ function blog_link($type, $node = 0) {
function blog_block() {
global $user;
- $result = db_query("SELECT u.uid, u.name, n.timestamp, n.title, n.nid FROM node n LEFT JOIN user u ON n.author = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10");
+ $result = db_query("SELECT u.uid, u.name, n.timestamp, n.title, n.nid FROM node n LEFT JOIN users u ON n.author = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10");
while ($node = db_fetch_object($result)) {
$output .= "<a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a><br />\n";
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 19e8b97e1..56d7bfa0c 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -15,7 +15,7 @@ function blog_help() {
}
function blog_cron() {
- $result = db_query("SELECT n.nid, n.timestamp, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN moderate m ON m.nid = n.nid WHERE n.type = 'blog' AND n.status = '". node_status("posted") ."' GROUP BY n.nid ORDER BY n.timestamp DESC LIMIT 30");
+ $result = db_query("SELECT n.nid, n.timestamp, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN moderate m ON m.nid = n.nid WHERE n.type = 'blog' AND n.status = '". node_status("posted") ."' GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.timestamp DESC LIMIT 30");
while ($node = db_fetch_object($result)) {
if ($node->score > 3 && $node->votes > 4) {
db_query("UPDATE node SET promote = '1' WHERE nid = '$node->nid'");
@@ -49,12 +49,14 @@ function blog_feed_user($uid = 0, $date = 0) {
$date = time();
}
- $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN user u ON n.author = u.uid WHERE u.uid = '$uid' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.lid DESC LIMIT 15");
+ $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid WHERE u.uid = '$uid' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.lid DESC LIMIT 15");
while ($blog = db_fetch_object($result)) {
$items .= format_rss_item($blog->title, path_uri() ."node.php?id=$blog->nid", $blog->body);
}
$output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
+ $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n";
+ $output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
$output .= "<rss version=\"0.91\">\n";
$output .= format_rss_channel("$account->name's blog", path_uri() ."module.php?mod=blog&op=view&id=$account->uid", "$account->name's blog", $items);
$output .= "</rss>\n";
@@ -66,7 +68,7 @@ function blog_feed_user($uid = 0, $date = 0) {
}
function blog_feed_last() {
- $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN user u ON n.author = u.uid ORDER BY b.lid DESC LIMIT 15");
+ $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid ORDER BY b.lid DESC LIMIT 15");
while ($blog = db_fetch_object($result)) {
$items .= format_rss_item($blog->title, path_uri() ."module.php?mod=blog&op=view&id=$blog->uid", $blog->body);
}
@@ -96,7 +98,7 @@ function blog_page_user($uid = 0, $date = 0) {
$date = time();
}
- $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN user u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid WHERE u.uid = '$account->uid' AND n.timestamp <= '$date' AND n.timestamp >= '". ($date - 2592000) ."' GROUP BY n.nid ORDER BY n.nid DESC LIMIT 20");
+ $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid WHERE u.uid = '$account->uid' AND n.timestamp <= '$date' AND n.timestamp >= '". ($date - 2592000) ."' GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20");
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">";
@@ -136,7 +138,7 @@ function blog_page_user($uid = 0, $date = 0) {
function blog_page_last() {
global $theme, $user;
- $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN user u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid GROUP BY n.nid ORDER BY n.nid DESC LIMIT 20");
+ $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20");
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">";
@@ -349,7 +351,7 @@ function blog_link($type, $node = 0) {
function blog_block() {
global $user;
- $result = db_query("SELECT u.uid, u.name, n.timestamp, n.title, n.nid FROM node n LEFT JOIN user u ON n.author = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10");
+ $result = db_query("SELECT u.uid, u.name, n.timestamp, n.title, n.nid FROM node n LEFT JOIN users u ON n.author = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10");
while ($node = db_fetch_object($result)) {
$output .= "<a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a><br />\n";
diff --git a/modules/book.module b/modules/book.module
index 429f1296b..c66907ea0 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -83,7 +83,7 @@ function book_view($node, $main = 0) {
function book_search($keys) {
global $PHP_SELF, $status;
- $result = db_query("SELECT n.*, u.name FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid LEFT JOIN user u ON n.author = u.uid WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20");
+ $result = db_query("SELECT n.*, u.name FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid LEFT JOIN users u ON n.author = u.uid WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20");
while ($node = db_fetch_object($result)) {
$find[$i++] = array("title" => check_output($node->title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->name, "date" => $node->timestamp);
}
diff --git a/modules/book/book.module b/modules/book/book.module
index 429f1296b..c66907ea0 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -83,7 +83,7 @@ function book_view($node, $main = 0) {
function book_search($keys) {
global $PHP_SELF, $status;
- $result = db_query("SELECT n.*, u.name FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid LEFT JOIN user u ON n.author = u.uid WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20");
+ $result = db_query("SELECT n.*, u.name FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid LEFT JOIN users u ON n.author = u.uid WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20");
while ($node = db_fetch_object($result)) {
$find[$i++] = array("title" => check_output($node->title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->name, "date" => $node->timestamp);
}
diff --git a/modules/comment.module b/modules/comment.module
index 35d7c1ccd..d87b89724 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -2,7 +2,7 @@
function comment_search($keys) {
global $PHP_SELF;
- $result = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20");
+ $result = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.author = u.uid WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20");
while ($comment = db_fetch_object($result)) {
$find[$i++] = array("title" => check_output($comment->subject), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->name, "date" => $comment->timestamp);
}
@@ -23,7 +23,7 @@ function comment_link($type) {
function comment_edit($id) {
- $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.cid = '$id'");
+ $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON c.author = u.uid WHERE c.cid = '$id'");
$comment = db_fetch_object($result);
$form .= form_item(t("Author"), format_name($comment));
@@ -40,7 +40,7 @@ function comment_save($id, $edit) {
}
function comment_overview() {
- $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN user u ON u.uid = c.author ORDER BY timestamp DESC LIMIT 50");
+ $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON u.uid = c.author ORDER BY timestamp DESC LIMIT 50");
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>subject</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"2\">operations</TH></TR>\n";
@@ -89,4 +89,4 @@ function comment_admin() {
}
}
-?> \ No newline at end of file
+?>
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 35d7c1ccd..d87b89724 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -2,7 +2,7 @@
function comment_search($keys) {
global $PHP_SELF;
- $result = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20");
+ $result = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.author = u.uid WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20");
while ($comment = db_fetch_object($result)) {
$find[$i++] = array("title" => check_output($comment->subject), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->name, "date" => $comment->timestamp);
}
@@ -23,7 +23,7 @@ function comment_link($type) {
function comment_edit($id) {
- $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.cid = '$id'");
+ $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON c.author = u.uid WHERE c.cid = '$id'");
$comment = db_fetch_object($result);
$form .= form_item(t("Author"), format_name($comment));
@@ -40,7 +40,7 @@ function comment_save($id, $edit) {
}
function comment_overview() {
- $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN user u ON u.uid = c.author ORDER BY timestamp DESC LIMIT 50");
+ $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON u.uid = c.author ORDER BY timestamp DESC LIMIT 50");
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>subject</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"2\">operations</TH></TR>\n";
@@ -89,4 +89,4 @@ function comment_admin() {
}
}
-?> \ No newline at end of file
+?>
diff --git a/modules/import.module b/modules/import.module
index d3d1af4ce..7798d1f5f 100644
--- a/modules/import.module
+++ b/modules/import.module
@@ -313,7 +313,7 @@ function import_get_bundle($bid) {
}
function import_view() {
- $result = db_query("SELECT f.*, COUNT(i.iid) AS items FROM feed f LEFT JOIN item i ON f.fid = i.fid GROUP BY f.fid ORDER BY f.title");
+ $result = db_query("SELECT f.*, COUNT(i.iid) AS items FROM feed f LEFT JOIN item i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.uncache, f.timestamp, f.attributes, f.link, f.description ORDER BY f.title");
$output .= "<h3>Feed overview</h3>";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
diff --git a/modules/node.module b/modules/node.module
index 0fb93cbe5..0f0573815 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -114,7 +114,7 @@ function node_overview($query) {
$color = array("#ffffff", "#e5e5e5");
$query = node_query($query ? $query : 0);
- $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN user u ON n.author = u.uid $query[1] LIMIT 50");
+ $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.author = u.uid $query[1] LIMIT 50");
$output .= status($query[0]);
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
@@ -274,6 +274,21 @@ function node_admin_save($edit) {
}
}
+function node_module_find() {
+
+ foreach (module_list() as $name) {
+ if (module_hook($name, "user")) {
+ $options .= "<OPTION VALUE=\"$name\">$name</OPTION>\n";
+ }
+ }
+
+ $output .= " <input size=\"50\" value=\"". check_form($keys) ."\" name=\"keys\" type=\"text\">\n";
+ $output .= " <select name=\"type\">$options</select>\n";
+ $output .= " <input type=\"submit\" value=\"Search\">\n";
+
+ return form($output);
+}
+
function node_edit($node) {
$output .= form_item("Title", $node->title);
$output .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
@@ -303,7 +318,8 @@ function node_admin() {
print node_help();
break;
case "search":
- print search_type($type, "admin.php?mod=node&op=search", $keys, 1);
+ print node_module_find($id);
+ print search_data($keys, $type);
break;
case "status":
print node_edit_status($id);
@@ -336,7 +352,7 @@ function node_admin() {
print node_setting();
break;
case "Reset to defaults":
- print status(system_default($edit));
+ print status(conf_default($edit));
print node_setting();
break;
case "Save node":
@@ -389,6 +405,7 @@ function node_feed() {
}
$output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
+ $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n";
$output .= "<rss version=\"0.91\">\n";
$output .= format_rss_channel(variable_get("site_name", "drupal"), path_uri() ."module.php?mod=node&op=feed", variable_get("site_slogan", ""), $items);
$output .= "</rss>\n";
@@ -400,7 +417,7 @@ function node_feed() {
}
function node_page() {
- global $op, $theme, $meta, $date;
+ global $op, $theme;
if ($op == "feed") {
node_feed();
diff --git a/modules/node/node.module b/modules/node/node.module
index 0fb93cbe5..0f0573815 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -114,7 +114,7 @@ function node_overview($query) {
$color = array("#ffffff", "#e5e5e5");
$query = node_query($query ? $query : 0);
- $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN user u ON n.author = u.uid $query[1] LIMIT 50");
+ $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.author = u.uid $query[1] LIMIT 50");
$output .= status($query[0]);
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
@@ -274,6 +274,21 @@ function node_admin_save($edit) {
}
}
+function node_module_find() {
+
+ foreach (module_list() as $name) {
+ if (module_hook($name, "user")) {
+ $options .= "<OPTION VALUE=\"$name\">$name</OPTION>\n";
+ }
+ }
+
+ $output .= " <input size=\"50\" value=\"". check_form($keys) ."\" name=\"keys\" type=\"text\">\n";
+ $output .= " <select name=\"type\">$options</select>\n";
+ $output .= " <input type=\"submit\" value=\"Search\">\n";
+
+ return form($output);
+}
+
function node_edit($node) {
$output .= form_item("Title", $node->title);
$output .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
@@ -303,7 +318,8 @@ function node_admin() {
print node_help();
break;
case "search":
- print search_type($type, "admin.php?mod=node&op=search", $keys, 1);
+ print node_module_find($id);
+ print search_data($keys, $type);
break;
case "status":
print node_edit_status($id);
@@ -336,7 +352,7 @@ function node_admin() {
print node_setting();
break;
case "Reset to defaults":
- print status(system_default($edit));
+ print status(conf_default($edit));
print node_setting();
break;
case "Save node":
@@ -389,6 +405,7 @@ function node_feed() {
}
$output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
+ $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n";
$output .= "<rss version=\"0.91\">\n";
$output .= format_rss_channel(variable_get("site_name", "drupal"), path_uri() ."module.php?mod=node&op=feed", variable_get("site_slogan", ""), $items);
$output .= "</rss>\n";
@@ -400,7 +417,7 @@ function node_feed() {
}
function node_page() {
- global $op, $theme, $meta, $date;
+ global $op, $theme;
if ($op == "feed") {
node_feed();
diff --git a/modules/queue.module b/modules/queue.module
index 676d3fc3a..7ba88f5c8 100644
--- a/modules/queue.module
+++ b/modules/queue.module
@@ -64,7 +64,7 @@ function queue_vote($id, $vote) {
function queue_overview() {
global $status, $theme, $user;
- $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN user u ON n.author = u.uid WHERE n.status = '$status[queued]'");
+ $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.author = u.uid WHERE n.status = '$status[queued]'");
$content .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n";
$content .= " <TR><TH>". t("Subject") ."</TH><TH>". t("Author") ."</TH><TH>". t("Type") ."</TH><TH>". t("Score") ."</TH></TR>\n";
@@ -86,7 +86,7 @@ function queue_node($id) {
$node = node_get_object(array(nid => $id));
if ($user->uid == $node->author || field_get($node->users, $user->uid)) {
- drupal_goto("node.php?id=$node->nid");
+ header("Location: node.php?id=$node->nid");
}
else {
$queue_votes = array("neutral (+0)" => "+ 0", "post it (+1)" => "+ 1", "dump it (-1)" => "- 1");
diff --git a/modules/rating.module b/modules/rating.module
index 68f18776f..062f89f5b 100644
--- a/modules/rating.module
+++ b/modules/rating.module
@@ -29,17 +29,17 @@ function rating_cron() {
if (time() - variable_get("rating_cron_last", 0) > variable_get("rating_cron_time", time())) {
variable_set("rating_cron_last", time());
- $r1 = db_query("SELECT uid FROM user ORDER BY rating DESC");
+ $r1 = db_query("SELECT uid FROM users ORDER BY rating DESC");
while ($account = db_fetch_object($r1)) {
- db_query("UPDATE user SET rating = '". rating_gravity($account->uid) ."' WHERE uid = '$account->uid'");
+ db_query("UPDATE users SET rating = '". rating_gravity($account->uid) ."' WHERE uid = '$account->uid'");
$rating[$account->uid] = ++$i;
}
db_query("DELETE FROM rating");
- $r2 = db_query("SELECT uid FROM user ORDER BY rating DESC");
+ $r2 = db_query("SELECT uid FROM users ORDER BY rating DESC");
while ($account = db_fetch_object($r2)) {
- db_query("INSERT INTO rating (user, new, old) VALUES ('$account->uid', '". ++$j ."', '". $rating[$account->uid] ."')");
+ db_query("INSERT INTO rating (userid, new, old) VALUES ('$account->uid', '". ++$j ."', '". $rating[$account->uid] ."')");
}
}
}
@@ -81,7 +81,7 @@ function rating_gravity($id) {
}
function rating_list($limit) {
- $result = db_query("SELECT u.rating, u.name, u.uid, r.* FROM user u LEFT JOIN rating r ON u.uid = r.user ORDER BY u.rating DESC LIMIT $limit");
+ $result = db_query("SELECT u.rating, u.name, u.uid, r.* FROM users u LEFT JOIN rating r ON u.uid = r.userid ORDER BY u.rating DESC LIMIT $limit");
$output .= "<TABLE CELLPADDING=\"1\" CELLSPACING=\"1\">\n";
while ($account = db_fetch_object($result)) {
diff --git a/modules/search.module b/modules/search.module
index e047f6ca9..91d395678 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -29,6 +29,13 @@ function search_page() {
if (user_access("search content")) {
/*
+ ** Verify the user input:
+ */
+
+ $type = check_input($type);
+ $keys = check_input($keys);
+
+ /*
** Construct the search form:
*/
@@ -88,4 +95,4 @@ function search_page() {
}
}
-?> \ No newline at end of file
+?>
diff --git a/modules/search/search.module b/modules/search/search.module
index e047f6ca9..91d395678 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -29,6 +29,13 @@ function search_page() {
if (user_access("search content")) {
/*
+ ** Verify the user input:
+ */
+
+ $type = check_input($type);
+ $keys = check_input($keys);
+
+ /*
** Construct the search form:
*/
@@ -88,4 +95,4 @@ function search_page() {
}
}
-?> \ No newline at end of file
+?>
diff --git a/modules/tracker.module b/modules/tracker.module
index f8c9ab81c..8fe01f194 100644
--- a/modules/tracker.module
+++ b/modules/tracker.module
@@ -12,10 +12,10 @@ function tracker_comments($id = 0) {
global $theme, $user;
if ($id) {
- $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.author = '". check_input($id) ."' GROUP BY n.nid DESC ORDER BY c.timestamp DESC LIMIT 10");
+ $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.author = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY c.timestamp DESC LIMIT 10");
}
else {
- $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid GROUP BY n.nid DESC ORDER BY c.timestamp DESC LIMIT 10");
+ $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid GROUP BY n.nid, n.title DESC ORDER BY c.timestamp DESC LIMIT 10");
}
while ($node = db_fetch_object($sresult)) {
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index f8c9ab81c..8fe01f194 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -12,10 +12,10 @@ function tracker_comments($id = 0) {
global $theme, $user;
if ($id) {
- $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.author = '". check_input($id) ."' GROUP BY n.nid DESC ORDER BY c.timestamp DESC LIMIT 10");
+ $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.author = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY c.timestamp DESC LIMIT 10");
}
else {
- $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid GROUP BY n.nid DESC ORDER BY c.timestamp DESC LIMIT 10");
+ $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid GROUP BY n.nid, n.title DESC ORDER BY c.timestamp DESC LIMIT 10");
}
while ($node = db_fetch_object($sresult)) {
diff --git a/modules/user.module b/modules/user.module
index d20abe685..bd2748910 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -22,13 +22,13 @@ function sess_read($key) {
function sess_write($key, $value) {
global $HTTP_SERVER_VARS;
- db_query("UPDATE user SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', timestamp = '". time() ."' WHERE session = '$key'");
+ db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', timestamp = '". time() ."' WHERE session = '$key'");
}
function sess_destroy($key) {
global $HTTP_SERVER_VARS;
- db_query("UPDATE user SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', timestamp = '". time() ."', session = '' WHERE session = '$key'");
+ db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', timestamp = '". time() ."', session = '' WHERE session = '$key'");
}
function sess_gc($lifetime) {
@@ -45,16 +45,18 @@ function user_load($array = array()) {
foreach ($array as $key => $value) {
if ($key == "pass") {
- $query .= "u.$key = PASSWORD('". addslashes($value) ."') AND ";
+ $query .= "u.$key = '" . md5($value) . "' AND ";
}
else {
$query .= "u.$key = '". addslashes($value) ."' AND ";
}
}
+ $result = db_query("SELECT u.*, r.perm FROM users u LEFT JOIN role r ON u.role = r.name WHERE $query u.status < 3");
- $result = db_query("SELECT u.*, r.perm FROM user u LEFT JOIN role r ON u.role = r.name WHERE $query u.status < 3");
+ $user = db_fetch_object($result);
+
+ return $user;
- return db_fetch_object($result);
}
@@ -64,25 +66,40 @@ function user_save($account, $array = array()) {
** Dynamically compose a SQL query:
*/
- foreach ($array as $key => $value) {
- if ($key == "pass") {
- $query .= "$key = PASSWORD('". addslashes($value) ."'), ";
- }
- else {
- $query .= "$key = '". addslashes($value) ."', ";
- }
- }
/*
** Update existing or insert new user account:
*/
if ($account->uid) {
- db_query("UPDATE user SET $query timestamp = '". time() ."' WHERE uid = '$account->uid'");
+ foreach ($array as $key => $value) {
+ if ($key == "pass") {
+ $query .= "$key = '". md5($value) ."', ";
+ }
+ else {
+ $query .= "$key = '". addslashes($value) ."', ";
+ }
+ }
+ db_query("UPDATE users SET $query timestamp = '". time() ."' WHERE uid = '$account->uid'");
return user_load(array("uid" => $account->uid));
}
else {
- db_query("INSERT INTO user SET $query timestamp = '". time() ."'");
+ $fields = "(";
+ $values = "(";
+ $num = 0;
+
+ foreach ($array as $key => $value) {
+ $fields .= ($num ? ", " : "") . $key;
+ $values .= ($num ? ", " : "") . (($key == "pass") ? "'" . md5 ($value) . "'" : "'" . addslashes ($value) . "'");
+ $num = 1;
+ }
+
+ $fields .= ($num ? ", " : "") . "timestamp";
+ $values .= ($num ? ", " : "") . "'" . time() ."'";
+ $fields .= ")";
+ $values .= ")";
+
+ db_query("INSERT INTO users $fields VALUES $values");
return user_load(array("name" => $array["name"]));
}
@@ -109,7 +126,6 @@ function user_validate_name($name) {
if (eregi(" ", $name)) return t("The name can not contain multiple spaces in a row.");
if (eregi("[^a-zA-Z0-9 ]", $name)) return t("The name contains an illegal character.");
if (strlen($name) > 32) return t("The name '$name' is too long: it must be less than 32 characters.");
-
}
function user_validate_mail($mail) {
@@ -218,7 +234,7 @@ function user_perm() {
function user_search($keys) {
global $PHP_SELF;
- $result = db_query("SELECT * FROM user WHERE name LIKE '%$keys%' LIMIT 20");
+ $result = db_query("SELECT * FROM users WHERE name LIKE '%$keys%' LIMIT 20");
while ($account = db_fetch_object($result)) {
$find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=user&op=edit&id=$account->uid" : "module.php?mod=user&op=view&id=$account->uid"), "user" => $account->name);
}
@@ -441,6 +457,10 @@ function user_login($edit = array()) {
$user = user_load(array("name" => $name, "pass" => $pass, "status" => 1));
}
+print "user = $user->uid, $user->name<br />";
+
+die("foo");
+
/*
** Try to log on the user through Drupal:
*/
@@ -505,7 +525,7 @@ function user_login($edit = array()) {
** Display login form:
*/
- $output .= form_textfield(t("Username"), "name", $edit["name"], 20, 64, t("Enter your local username, a Drupal ID or a Jabber ID."));
+ $output .= form_textfield(t("Username"), "name", $edit["name"], 20, 64, t("Enter your local username, a Drupal ID or a Jabber ID."));
$output .= form_password(t("Password"), "pass", $pass, 20, 64, t("Enter the password that accompanies your username."));
$output .= form_submit(t("Log in"));
@@ -537,7 +557,7 @@ function user_logout() {
function user_pass($edit = array()) {
if ($edit["name"] && $edit["mail"]) {
- if ($account = db_fetch_object(db_query("SELECT uid FROM user WHERE name = '". check_input($edit["name"]) ."' AND mail = '". check_input($edit["mail"]) ."'"))) {
+ if ($account = db_fetch_object(db_query("SELECT uid FROM users WHERE name = '". check_input($edit["name"]) ."' AND mail = '". check_input($edit["mail"]) ."'"))) {
$from = variable_get("site_mail", "root@localhost");
$pass = user_password();
@@ -593,10 +613,10 @@ function user_register($edit = array()) {
else if (user_deny("mail", $edit["mail"])) {
$error = sprintf(t("The e-mail address '%s' has been denied access."), $edit["mail"]);
}
- else if (db_num_rows(db_query("SELECT name FROM user WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
+ else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
$error = sprintf(t("The name '%s' is already taken."), $edit["name"]);
}
- else if (db_num_rows(db_query("SELECT mail FROM user WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
+ else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
$error = sprintf(t("The e-mail address '%s' is already taken."), $edit["mail"]);
}
else if (variable_get("user_register", 1) == 0) {
@@ -660,13 +680,13 @@ function user_edit($edit = array()) {
else if ($error = user_validate_mail($edit["mail"])) {
// do nothing
}
- else if (db_num_rows(db_query("SELECT uid FROM user WHERE uid != '$user->uid' AND LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
+ else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
$error = sprintf(t("The name '%s' is already taken."), $edit["name"]);
}
- else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM user WHERE uid != '$user->uid' AND LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
+ else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
$error = sprintf(t("The e-mail address '%s' is already taken."), $edit["mail"]);
}
- else if ($edit["jabber"] && db_num_rows(db_query("SELECT uid FROM user WHERE uid != '$user->uid' AND LOWER(jabber) = LOWER('". $edit["jabber"] ."')")) > 0) {
+ else if ($edit["jabber"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(jabber) = LOWER('". $edit["jabber"] ."')")) > 0) {
$error = sprintf(t("The Jabber ID '%s' is already taken."), $edit["jabber"]);
}
else if ($user->uid) {
@@ -852,10 +872,10 @@ function user_admin_create($edit = array()) {
else if ($error = user_validate_mail($edit["mail"])) {
// do nothing
}
- else if (db_num_rows(db_query("SELECT name FROM user WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
+ else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
$error = sprintf(t("The name '%s' is already taken."), $edit["name"]);
}
- else if (db_num_rows(db_query("SELECT mail FROM user WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
+ else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
$error = sprintf(t("The e-mail address '%s' is already taken."), $edit["mail"]);
}
else {
@@ -985,6 +1005,7 @@ function user_admin_perm($edit = array()) {
*/
$result = db_query("SELECT * FROM role ORDER BY name");
+ $roles = array ();
while ($role = db_fetch_object($result)) {
$roles[$role->name] = $role->perm;
}
@@ -1067,7 +1088,7 @@ function user_admin_edit($edit = array()) {
}
else if ($op == "Delete account") {
if ($edit["status"] == 0) {
- db_query("DELETE FROM user WHERE uid = '$account->uid'");
+ db_query("DELETE FROM users WHERE uid = '$account->uid'");
$output .= "The account has been deleted.";
}
else {
@@ -1108,7 +1129,7 @@ function user_admin_account() {
$queries = array(array("ORDER BY timestamp DESC", "active users"), array("ORDER BY uid DESC", "new users"), array("WHERE status = 0 ORDER BY uid DESC", "blocked users"), array("WHERE role != 'authenticated user' ORDER BY uid DESC", "special users"));
- $result = db_query("SELECT uid, name, timestamp FROM user ". $queries[$query ? $query : 0][0] ." LIMIT 50");
+ $result = db_query("SELECT uid, name, timestamp FROM users ". $queries[$query ? $query : 0][0] ." LIMIT 50");
foreach ($queries as $key => $value) {
$links[] = "<a href=\"admin.php?mod=user&op=account&query=$key\">$value[1]</a>";
diff --git a/modules/user/user.module b/modules/user/user.module
index d20abe685..bd2748910 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -22,13 +22,13 @@ function sess_read($key) {
function sess_write($key, $value) {
global $HTTP_SERVER_VARS;
- db_query("UPDATE user SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', timestamp = '". time() ."' WHERE session = '$key'");
+ db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', timestamp = '". time() ."' WHERE session = '$key'");
}
function sess_destroy($key) {
global $HTTP_SERVER_VARS;
- db_query("UPDATE user SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', timestamp = '". time() ."', session = '' WHERE session = '$key'");
+ db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', timestamp = '". time() ."', session = '' WHERE session = '$key'");
}
function sess_gc($lifetime) {
@@ -45,16 +45,18 @@ function user_load($array = array()) {
foreach ($array as $key => $value) {
if ($key == "pass") {
- $query .= "u.$key = PASSWORD('". addslashes($value) ."') AND ";
+ $query .= "u.$key = '" . md5($value) . "' AND ";
}
else {
$query .= "u.$key = '". addslashes($value) ."' AND ";
}
}
+ $result = db_query("SELECT u.*, r.perm FROM users u LEFT JOIN role r ON u.role = r.name WHERE $query u.status < 3");
- $result = db_query("SELECT u.*, r.perm FROM user u LEFT JOIN role r ON u.role = r.name WHERE $query u.status < 3");
+ $user = db_fetch_object($result);
+
+ return $user;
- return db_fetch_object($result);
}
@@ -64,25 +66,40 @@ function user_save($account, $array = array()) {
** Dynamically compose a SQL query:
*/
- foreach ($array as $key => $value) {
- if ($key == "pass") {
- $query .= "$key = PASSWORD('". addslashes($value) ."'), ";
- }
- else {
- $query .= "$key = '". addslashes($value) ."', ";
- }
- }
/*
** Update existing or insert new user account:
*/
if ($account->uid) {
- db_query("UPDATE user SET $query timestamp = '". time() ."' WHERE uid = '$account->uid'");
+ foreach ($array as $key => $value) {
+ if ($key == "pass") {
+ $query .= "$key = '". md5($value) ."', ";
+ }
+ else {
+ $query .= "$key = '". addslashes($value) ."', ";
+ }
+ }
+ db_query("UPDATE users SET $query timestamp = '". time() ."' WHERE uid = '$account->uid'");
return user_load(array("uid" => $account->uid));
}
else {
- db_query("INSERT INTO user SET $query timestamp = '". time() ."'");
+ $fields = "(";
+ $values = "(";
+ $num = 0;
+
+ foreach ($array as $key => $value) {
+ $fields .= ($num ? ", " : "") . $key;
+ $values .= ($num ? ", " : "") . (($key == "pass") ? "'" . md5 ($value) . "'" : "'" . addslashes ($value) . "'");
+ $num = 1;
+ }
+
+ $fields .= ($num ? ", " : "") . "timestamp";
+ $values .= ($num ? ", " : "") . "'" . time() ."'";
+ $fields .= ")";
+ $values .= ")";
+
+ db_query("INSERT INTO users $fields VALUES $values");
return user_load(array("name" => $array["name"]));
}
@@ -109,7 +126,6 @@ function user_validate_name($name) {
if (eregi(" ", $name)) return t("The name can not contain multiple spaces in a row.");
if (eregi("[^a-zA-Z0-9 ]", $name)) return t("The name contains an illegal character.");
if (strlen($name) > 32) return t("The name '$name' is too long: it must be less than 32 characters.");
-
}
function user_validate_mail($mail) {
@@ -218,7 +234,7 @@ function user_perm() {
function user_search($keys) {
global $PHP_SELF;
- $result = db_query("SELECT * FROM user WHERE name LIKE '%$keys%' LIMIT 20");
+ $result = db_query("SELECT * FROM users WHERE name LIKE '%$keys%' LIMIT 20");
while ($account = db_fetch_object($result)) {
$find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=user&op=edit&id=$account->uid" : "module.php?mod=user&op=view&id=$account->uid"), "user" => $account->name);
}
@@ -441,6 +457,10 @@ function user_login($edit = array()) {
$user = user_load(array("name" => $name, "pass" => $pass, "status" => 1));
}
+print "user = $user->uid, $user->name<br />";
+
+die("foo");
+
/*
** Try to log on the user through Drupal:
*/
@@ -505,7 +525,7 @@ function user_login($edit = array()) {
** Display login form:
*/
- $output .= form_textfield(t("Username"), "name", $edit["name"], 20, 64, t("Enter your local username, a Drupal ID or a Jabber ID."));
+ $output .= form_textfield(t("Username"), "name", $edit["name"], 20, 64, t("Enter your local username, a Drupal ID or a Jabber ID."));
$output .= form_password(t("Password"), "pass", $pass, 20, 64, t("Enter the password that accompanies your username."));
$output .= form_submit(t("Log in"));
@@ -537,7 +557,7 @@ function user_logout() {
function user_pass($edit = array()) {
if ($edit["name"] && $edit["mail"]) {
- if ($account = db_fetch_object(db_query("SELECT uid FROM user WHERE name = '". check_input($edit["name"]) ."' AND mail = '". check_input($edit["mail"]) ."'"))) {
+ if ($account = db_fetch_object(db_query("SELECT uid FROM users WHERE name = '". check_input($edit["name"]) ."' AND mail = '". check_input($edit["mail"]) ."'"))) {
$from = variable_get("site_mail", "root@localhost");
$pass = user_password();
@@ -593,10 +613,10 @@ function user_register($edit = array()) {
else if (user_deny("mail", $edit["mail"])) {
$error = sprintf(t("The e-mail address '%s' has been denied access."), $edit["mail"]);
}
- else if (db_num_rows(db_query("SELECT name FROM user WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
+ else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
$error = sprintf(t("The name '%s' is already taken."), $edit["name"]);
}
- else if (db_num_rows(db_query("SELECT mail FROM user WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
+ else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
$error = sprintf(t("The e-mail address '%s' is already taken."), $edit["mail"]);
}
else if (variable_get("user_register", 1) == 0) {
@@ -660,13 +680,13 @@ function user_edit($edit = array()) {
else if ($error = user_validate_mail($edit["mail"])) {
// do nothing
}
- else if (db_num_rows(db_query("SELECT uid FROM user WHERE uid != '$user->uid' AND LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
+ else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
$error = sprintf(t("The name '%s' is already taken."), $edit["name"]);
}
- else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM user WHERE uid != '$user->uid' AND LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
+ else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
$error = sprintf(t("The e-mail address '%s' is already taken."), $edit["mail"]);
}
- else if ($edit["jabber"] && db_num_rows(db_query("SELECT uid FROM user WHERE uid != '$user->uid' AND LOWER(jabber) = LOWER('". $edit["jabber"] ."')")) > 0) {
+ else if ($edit["jabber"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(jabber) = LOWER('". $edit["jabber"] ."')")) > 0) {
$error = sprintf(t("The Jabber ID '%s' is already taken."), $edit["jabber"]);
}
else if ($user->uid) {
@@ -852,10 +872,10 @@ function user_admin_create($edit = array()) {
else if ($error = user_validate_mail($edit["mail"])) {
// do nothing
}
- else if (db_num_rows(db_query("SELECT name FROM user WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
+ else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
$error = sprintf(t("The name '%s' is already taken."), $edit["name"]);
}
- else if (db_num_rows(db_query("SELECT mail FROM user WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
+ else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
$error = sprintf(t("The e-mail address '%s' is already taken."), $edit["mail"]);
}
else {
@@ -985,6 +1005,7 @@ function user_admin_perm($edit = array()) {
*/
$result = db_query("SELECT * FROM role ORDER BY name");
+ $roles = array ();
while ($role = db_fetch_object($result)) {
$roles[$role->name] = $role->perm;
}
@@ -1067,7 +1088,7 @@ function user_admin_edit($edit = array()) {
}
else if ($op == "Delete account") {
if ($edit["status"] == 0) {
- db_query("DELETE FROM user WHERE uid = '$account->uid'");
+ db_query("DELETE FROM users WHERE uid = '$account->uid'");
$output .= "The account has been deleted.";
}
else {
@@ -1108,7 +1129,7 @@ function user_admin_account() {
$queries = array(array("ORDER BY timestamp DESC", "active users"), array("ORDER BY uid DESC", "new users"), array("WHERE status = 0 ORDER BY uid DESC", "blocked users"), array("WHERE role != 'authenticated user' ORDER BY uid DESC", "special users"));
- $result = db_query("SELECT uid, name, timestamp FROM user ". $queries[$query ? $query : 0][0] ." LIMIT 50");
+ $result = db_query("SELECT uid, name, timestamp FROM users ". $queries[$query ? $query : 0][0] ." LIMIT 50");
foreach ($queries as $key => $value) {
$links[] = "<a href=\"admin.php?mod=user&op=account&query=$key\">$value[1]</a>";
diff --git a/modules/watchdog.module b/modules/watchdog.module
index 974914dba..a98ebb550 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -33,7 +33,7 @@ function watchdog_overview($type) {
$color = array(user => "#FFEEAA", message => "#FFFFFF", special => "#A49FFF", warning => "#FFAA22", httpd => "#99DD99", error => "#EE4C4C");
$query = array(user => "WHERE type = 'user'", regular => "WHERE type = 'message'", special => "WHERE type = 'special'", warning => "WHERE type = 'warning'", error => "WHERE type = 'error'", httpd => "WHERE type = 'httpd'");
- $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN user u ON w.user = u.uid ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000");
+ $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.userid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000");
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>date</TH><TH>message</TH><TH>user</TH><TH>operations</TH></TR>\n";
@@ -48,7 +48,7 @@ function watchdog_overview($type) {
}
function watchdog_view($id) {
- $result = db_query("SELECT l.*, u.name, u.uid FROM watchdog l LEFT JOIN user u ON l.user = u.uid WHERE l.id = '$id'");
+ $result = db_query("SELECT l.*, u.name, u.uid FROM watchdog l LEFT JOIN users u ON l.userid = u.uid WHERE l.id = '$id'");
if ($watchdog = db_fetch_object($result)) {
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
@@ -87,4 +87,4 @@ function watchdog_admin() {
}
}
-?> \ No newline at end of file
+?>
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index 974914dba..a98ebb550 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -33,7 +33,7 @@ function watchdog_overview($type) {
$color = array(user => "#FFEEAA", message => "#FFFFFF", special => "#A49FFF", warning => "#FFAA22", httpd => "#99DD99", error => "#EE4C4C");
$query = array(user => "WHERE type = 'user'", regular => "WHERE type = 'message'", special => "WHERE type = 'special'", warning => "WHERE type = 'warning'", error => "WHERE type = 'error'", httpd => "WHERE type = 'httpd'");
- $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN user u ON w.user = u.uid ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000");
+ $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.userid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000");
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>date</TH><TH>message</TH><TH>user</TH><TH>operations</TH></TR>\n";
@@ -48,7 +48,7 @@ function watchdog_overview($type) {
}
function watchdog_view($id) {
- $result = db_query("SELECT l.*, u.name, u.uid FROM watchdog l LEFT JOIN user u ON l.user = u.uid WHERE l.id = '$id'");
+ $result = db_query("SELECT l.*, u.name, u.uid FROM watchdog l LEFT JOIN users u ON l.userid = u.uid WHERE l.id = '$id'");
if ($watchdog = db_fetch_object($result)) {
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
@@ -87,4 +87,4 @@ function watchdog_admin() {
}
}
-?> \ No newline at end of file
+?>
diff --git a/modules/weblogs.module b/modules/weblogs.module
index 50660cffa..c7e31fabb 100644
--- a/modules/weblogs.module
+++ b/modules/weblogs.module
@@ -21,4 +21,4 @@ function weblogs_notify($name, $url) {
}
}
-?> \ No newline at end of file
+?>
diff --git a/updates/3.00-to-x.xx.sql b/updates/3.00-to-x.xx.sql
index 4beb5d8b8..a905bf27d 100644
--- a/updates/3.00-to-x.xx.sql
+++ b/updates/3.00-to-x.xx.sql
@@ -46,3 +46,12 @@ CREATE TABLE moderate (
ALTER TABLE comments DROP score;
ALTER TABLE comments DROP votes;
ALTER TABLE comments DROP users;
+
+# PEAR
+
+ALTER TABLE user RENAME AS users;
+ALTER TABLE users CHANGE pass pass varchar(32) DEFAULT '' NOT NULL;
+ALTER TABLE watchdog CHANGE user userid int(10) DEFAULT '0' NOT NULL;
+ALTER TABLE rating CHANGE user userid int(10) DEFAULT '0' NOT NULL;
+ALTER TABLE layout CHANGE user userid int(10) DEFAULT '0' NOT NULL;
+ALTER TABLE blocks CHANGE offset delta tinyint(2) DEFAULT '0' NOT NULL;