Skip to content
Commits on Source (260)
Drupal x.x.x, xxxx-xx-xx
Drupal 4.4.2, 2004-07-04
------------------------
- fixed bugs: no critical bugs were identified.
Drupal 4.4.1, 2004-05-01
------------------------
- fixed bugs: no critical bugs were identified.
Drupal 4.4.0, 2004-04-01
------------------------
- added support for the MetaWeblog API and MovableType extensions.
......@@ -20,7 +32,9 @@ Drupal x.x.x, xxxx-xx-xx
* made all theme functions return their output.
* migrated away from using the BaseTheme class.
* added many new theme functions and refactored existing theme functions.
* replaced theme "UnConeD" by "Chameleon".
* added avatar support to 'Xtemplate'.
* replaced theme 'UnConeD' by 'Chameleon'.
* replaced theme 'Marvin' by 'Pushbutton'.
- usability:
* added breadcrumb navigation to all pages.
* made it possible to add context-sensitive help to all pages.
......@@ -34,6 +48,8 @@ Drupal x.x.x, xxxx-xx-xx
- refactored 404 (file not found) handling to support custom 404 pages.
- documentation:
* added PHPDoc/Doxygen comments.
- improved the filter system to prevent conflicts between filters:
* made it possible to change the order in which filters are applied.
Drupal 4.3.2, 2004-01-01
------------------------
......
......@@ -16,8 +16,8 @@ LEGEND
--------------------------------------------------------------------------------
BLOCK SYSTEM
M: Kjartan Mannes <kjartan@drupal.org>
BLOG API
M:James Walker <walkah@walkah.net>
S: maintained
CODING STYLE CHECKER
......@@ -28,20 +28,8 @@ DISTRIBUTED AUTHENTICATION MODULES
M: Moshe Weitzman <weitzman@tejasa.com>
S: maintained
FORUM MODULE
M: Marco Molinari <marco@porciletto.org>
S: maintained
POLL MODULE
M: Alastair Maw <me@almaw.com>
S: maintained
LANGUAGE
M: Alastair Maw <me@almaw.com>
S: maintained
MSSQL PORT
M: Moshe Weitzman <weitzman@tejasa.com>
LOCALE MODULE
M: Gabor Hojtsy <goba@php.net>
S: maintained
POSTGRES PORT
......@@ -52,17 +40,13 @@ STATISTICS MODULE
M: Jeremy Andrews <jeremy@kerneltrap.com>
S: maintained
TAXONOMY SYSTEM
M: Marco Molinari <marco@porciletto.org>
S: maintained
USER SYSTEM
M: Moshe Weitzman <weitzman@tejasa.com>
S: maintained
DEBIAN PACKAGE
M: Hugo Espuny <hec@debian.org>
S: fixes/patches
M: Hilko Bengen <bengen@debian.org>
S: maintained
THE REST:
M: Dries <dries@drupal.org>
---
--- Table definitions
---
CREATE TABLE [dbo].[access] (
[aid] [smallint] NULL ,
[mask] [varchar] (255) NOT NULL ,
[type] [varchar] (255) NOT NULL ,
[status] [smallint] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[accesslog] (
[nid] [numeric](11, 0) NULL ,
[url] [varchar] (255) NULL ,
[hostname] [varchar] (128) NULL ,
[uid] [numeric](10, 0) NULL ,
[timestamp] [numeric](11, 0) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[authmap] (
[aid] [numeric](10, 0) IDENTITY NULL ,
[uid] [int] NOT NULL ,
[authname] [varchar] (128) NOT NULL ,
[module] [varchar] (128) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[blocks] (
[module] [varchar] (64) NOT NULL ,
[delta] [varchar] (32) NOT NULL ,
[status] [smallint] NOT NULL ,
[weight] [smallint] NOT NULL ,
[region] [smallint] NOT NULL ,
[path] [varchar] (255) NOT NULL ,
[custom] [smallint] NOT NULL,
[throttle] [smallint] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[book] (
[nid] [numeric](4, 0) NOT NULL ,
[parent] [int] NOT NULL ,
[weight] [smallint] NOT NULL ,
[format] [smallint] NULL ,
[log] [text] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[boxes] (
[bid] [smallint] NULL ,
[title] [varchar] (64) NOT NULL ,
[body] [text] NULL ,
[info] [varchar] (128) NOT NULL ,
[type] [smallint] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[bundle] (
[bid] [int] NULL ,
[title] [varchar] (255) NOT NULL ,
[attributes] [varchar] (255) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[cache] (
[cid] [varchar] (255) NOT NULL ,
[data] [text] NULL ,
[expire] [int] NOT NULL ,
[created] [int] NOT NULL ,
[headers] [text] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[comments] (
[cid] [int] NULL ,
[pid] [int] NOT NULL ,
[nid] [int] NOT NULL ,
[uid] [int] NOT NULL ,
[subject] [varchar] (64) NOT NULL ,
[comment] [varchar] (8000) NOT NULL ,
[hostname] [varchar] (128) NOT NULL ,
[timestamp] [int] NOT NULL ,
[link] [varchar] (16) NULL ,
[score] [int] NOT NULL ,
[status] [tinyint] NOT NULL ,
[thread] [varchar] (255) NOT NULL ,
[users] [varchar] (8000) NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[directory] (
[link] [varchar] (255) NOT NULL ,
[name] [varchar] (128) NOT NULL ,
[mail] [varchar] (128) NOT NULL ,
[slogan] [text] NOT NULL ,
[mission] [text] NOT NULL ,
[timestamp] [int] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[feed] (
[fid] [int] NULL ,
[title] [varchar] (255) NOT NULL ,
[url] [varchar] (255) NOT NULL ,
[refresh] [int] NOT NULL ,
[checked] [int] MOT NULL ,
[attributes] [varchar] (255) NULL ,
[link] [varchar] (255) NULL ,
[description] [varchar] (8000) NULL ,
[image] [varchar] (512) NULL ,
[etag] [varchar] (255) NULL ,
[modified] [int] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[forum] (
[nid] [numeric](10, 0) NOT NULL ,
[tid] [numeric](10, 0) NOT NULL ,
[icon] [varchar] (255) NULL ,
[shadow] [numeric](10, 0) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[history] (
[uid] [int] NOT NULL ,
[nid] [int] NOT NULL ,
[timestamp] [int] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[item] (
[iid] [int] NULL ,
[fid] [int] NOT NULL ,
[title] [varchar] (255) NOT NULL ,
[link] [varchar] (255) NOT NULL ,
[author] [varchar] (255) NOT NULL ,
[description] [text] NOT NULL ,
[timestamp] [int] NULL ,
[attributes] [varchar] (255) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[locales] (
[lid] [int] NULL ,
[location] [varchar] (128) NOT NULL ,
[string] [nvarchar] (4000) NOT NULL ,
[da] [text] NULL ,
[fi] [text] NULL ,
[fr] [text] NULL ,
[en] [text] NULL ,
[es] [text] NULL ,
[nl] [text] NULL ,
[no] [text] NULL ,
[sw] [text] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[menu] (
[name] [varchar] (255) NOT NULL ,
[link] [varchar] (255) NOT NULL ,
[help] [text] NULL ,
[title] [varchar] (255) NOT NULL ,
[parent] [varchar] (255) NOT NULL ,
[weight] [smallint] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[moderation_filters] (
[fid] [numeric](10, 0) NULL ,
[filter] [varchar] (255) NOT NULL ,
[minimum] [smallint] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[moderation_roles] (
[rid] [numeric](4, 0) NOT NULL ,
[mid] [numeric](4, 0) NOT NULL ,
[value] [smallint] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[moderation_votes] (
[mid] [numeric](10, 0) NULL ,
[vote] [varchar] (255) NULL ,
[weight] [smallint] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[node] (
[nid] [numeric](10, 0) NULL ,
[type] [varchar] (16) NOT NULL ,
[title] [varchar] (128) NOT NULL ,
[path] [varchar] (250) NULL ,
[score] [int] NOT NULL ,
[votes] [int] NOT NULL ,
[uid] [int] NOT NULL ,
[status] [int] NOT NULL ,
[created] [int] NOT NULL ,
[comment] [int] NOT NULL ,
[promote] [int] NOT NULL ,
[moderate] [int] NOT NULL ,
[users] [text] NULL ,
[attributes] [varchar] (255) NULL ,
[teaser] [text] NOT NULL ,
[body] [text] NOT NULL ,
[changed] [int] NOT NULL ,
[revisions] [text] NULL ,
[static] [int] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[page] (
[nid] [numeric](10, 0) NOT NULL ,
[link] [varchar] (128) NOT NULL ,
[format] [smallint] NOT NULL ,
[description] [varchar] (128) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[url_alias] (
[pid] numeric (10, 0) NOT NULL,
[dst] [varchar] (128) NOT NULL,
[src] [varchar] (128) NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[url_alias] WITH NOCHECK ADD
CONSTRAINT [DF_[url_alias_pid] DEFAULT (0) FOR [pid],
CONSTRAINT [DF_url_alias_dst] DEFAULT ('') FOR [dst],
CONSTRAINT [DF_url_alias_src] DEFAULT ('') FOR [src]
GO
CREATE INDEX [url_alias_src_idx] ON [dbo].[url_alias]([src]) ON [PRIMARY]
CREATE INDEX url_alias_dst_idx ON url_alias(dst);
GO
CREATE TABLE [dbo].[permission] (
[rid] [numeric](4, 0) NOT NULL ,
[perm] [text] NULL ,
[tid] [numeric](4, 0) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[poll] (
[nid] [numeric](4, 0) NOT NULL ,
[runtime] [int] NOT NULL ,
[voters] [text] NOT NULL ,
[active] [numeric](4, 0) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[poll_choices] (
[chid] [numeric](10, 0) NULL ,
[nid] [numeric](10, 0) NOT NULL ,
[chtext] [varchar] (128) NOT NULL ,
[chvotes] [int] NOT NULL ,
[chorder] [int] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[role] (
[rid] [numeric](10, 0) IDENTITY (1, 1) NOT NULL ,
[name] [varchar] (32) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[search_index] (
[word] [varchar] (50) NOT NULL ,
[lno] [numeric](10, 0) NOT NULL ,
[type] [varchar] (16) NULL ,
[count] [numeric](10, 0) NULL
) ON [PRIMARY]
GO
CREATE TABLE sessions (
[sid] [varchar] (32) NOT NULL,
[uid] [int] NOT NULL,
[hostname] [varchar] (128) NOT NULL,
[timestamp] [integer] NOT NULL,
[session] [text],
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[sequences] (
[name] [varchar] (255) NOT NULL ,
[id] [numeric](10, 0) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[node_counter] (
[nid] [int] NOT NULL ,
[totalcount] [numeric](20, 0) NOT NULL ,
[daycount] [numeric](4, 0) NOT NULL ,
[timestamp] [numeric](4, 0) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[system] (
[filename] [varchar] (255) NOT NULL ,
[name] [varchar] (255) NOT NULL ,
[type] [varchar] (255) NOT NULL ,
[description] [varchar] (255) NOT NULL ,
[status] [int] NOT NULL ,
[throttle] [smallint] NOT NULL ,
[bootstrap] [int] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[term_data] (
[tid] [numeric](10, 0) NOT NULL ,
[vid] [numeric](10, 0) NOT NULL ,
[name] [varchar] (255) NOT NULL ,
[description] [text] NULL ,
[weight] [smallint] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[term_hierarchy] (
[tid] [numeric](4, 0) NOT NULL ,
[parent] [numeric](4, 0) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[term_node] (
[nid] [numeric](4, 0) NOT NULL ,
[tid] [numeric](4, 0) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[term_relation] (
[tid1] [numeric](4, 0) NOT NULL ,
[tid2] [numeric](4, 0) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[term_synonym] (
[tid] [numeric](10, 0) NOT NULL ,
[name] [varchar] (255) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[users] (
[uid] [numeric](10, 0) NULL ,
[name] [varchar] (60) NOT NULL ,
[pass] [varchar] (32) NOT NULL ,
[mail] [varchar] (64) NULL ,
[mode] [smallint] NOT NULL ,
[sort] [smallint] NULL ,
[threshold] [smallint] NULL ,
[theme] [varchar] (255) NULL ,
[signature] [varchar] (255) NULL ,
[timestamp] [float] NOT NULL ,
[status] [smallint] NOT NULL ,
[timezone] [varchar] (8) NULL ,
[language] [char] (2) NULL ,
[init] [varchar] (128) NULL ,
[data] [varchar] (8000) NULL ,
[rid] [int] NOT NULL
)
--ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[users_uid_seq] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[vapor] [int] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[variable] (
[name] [varchar] (48) NOT NULL ,
[value] [varchar] (8000) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[vocabulary] (
[vid] [numeric](10, 0) NULL ,
[name] [varchar] (255) NOT NULL ,
[description] [text] NULL ,
[relations] [tinyint] NOT NULL ,
[hierarchy] [tinyint] NOT NULL ,
[multiple] [tinyint] NOT NULL ,
[required] [tinyint] NOT NULL ,
[nodes] [text] NULL ,
[weight] [smallint] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[watchdog] (
[wid] [int] IDENTITY (1, 1) NOT NULL ,
[uid] [int] NOT NULL ,
[type] [varchar] (16) NOT NULL ,
[message] [text] NOT NULL ,
[link] [varchar] (255) NOT NULL ,
[location] [varchar] (128) NOT NULL ,
[hostname] [varchar] (128) NOT NULL ,
[timestamp] [int] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[role] WITH NOCHECK ADD
CONSTRAINT [PK_role] PRIMARY KEY CLUSTERED
(
[rid]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[watchdog] WITH NOCHECK ADD
PRIMARY KEY CLUSTERED
(
[wid]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[cache] WITH NOCHECK ADD
CONSTRAINT [DF_cache_created] DEFAULT (0) FOR [created]
GO
CREATE INDEX [forum_tid_idx] ON [dbo].[forum]([tid]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[node] WITH NOCHECK ADD
CONSTRAINT [DF_node_score] DEFAULT (0) FOR [score],
CONSTRAINT [DF_node_votes] DEFAULT (0) FOR [votes],
CONSTRAINT [DF_node_uid] DEFAULT (0) FOR [uid],
CONSTRAINT [DF_node_status] DEFAULT (1) FOR [status],
CONSTRAINT [DF_node_created] DEFAULT (0) FOR [created],
CONSTRAINT [DF_node_comment] DEFAULT (2) FOR [comment],
CONSTRAINT [DF_node_promote] DEFAULT (0) FOR [promote],
CONSTRAINT [DF_node_moderate] DEFAULT (0) FOR [moderate],
CONSTRAINT [DF_node_changed] DEFAULT (0) FOR [changed],
CONSTRAINT [DF_node_static] DEFAULT (0) FOR [static]
GO
CREATE INDEX [IX_role] ON [dbo].[role]([rid]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[term_data] WITH NOCHECK ADD
CONSTRAINT [DF_term_data_vid] DEFAULT (0) FOR [vid]
GO
ALTER TABLE [dbo].[users] WITH NOCHECK ADD
CONSTRAINT [DF_users_mode] DEFAULT (0) FOR [mode],
CONSTRAINT [DF_users_sort] DEFAULT (0) FOR [sort],
CONSTRAINT [DF_users_threshold] DEFAULT (0) FOR [threshold],
CONSTRAINT [DF_users_status] DEFAULT (0) FOR [status],
CONSTRAINT [DF_users_timestamp] DEFAULT (0) FOR [timestamp],
CONSTRAINT [DF_users_rid] DEFAULT (0) FOR [rid],
CONSTRAINT [DF_users_pass] DEFAULT ('') FOR [pass],
CONSTRAINT [DF_users_homepage] DEFAULT ('') FOR [homepage],
CONSTRAINT [DF_users_theme] DEFAULT ('') FOR [theme],
CONSTRAINT [DF_users_signature] DEFAULT ('') FOR [signature],
CONSTRAINT [DF_users_language] DEFAULT ('') FOR [language]
GO
CREATE INDEX [IX_sid] ON [dbo].[sessions]([sid]) ON [PRIMARY]
GO
CREATE INDEX [IX_users] ON [dbo].[users]([uid]) ON [PRIMARY]
GO
CREATE INDEX [IX_timestamp] ON [dbo].[users]([timestamp]) ON [PRIMARY]
GO
CREATE INDEX [sessions_sid_idx] ON [dbo].[sessions]([sid]) ON [PRIMARY]
GO
CREATE INDEX [users_timestamp_idx] ON [dbo].[users]([timestamp]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[watchdog] WITH NOCHECK ADD
CONSTRAINT [DF__watchdog__uid__41EDCAC5] DEFAULT ('0') FOR [uid],
CONSTRAINT [DF__watchdog__type__42E1EEFE] DEFAULT ('') FOR [type],
CONSTRAINT [DF__watchdog__messag__43D61337] DEFAULT ('') FOR [message],
CONSTRAINT [DF__watchdog__link__44CA3770] DEFAULT ('') FOR [link],
CONSTRAINT [DF__watchdog__locati__45BE5BA9] DEFAULT ('') FOR [location],
CONSTRAINT [DF__watchdog__hostna__46B27FE2] DEFAULT ('') FOR [hostname],
CONSTRAINT [DF__watchdog__timest__47A6A41B] DEFAULT ('0') FOR [timestamp]
GO
--
-- Insert some default values
--
INSERT INTO system VALUES ('modules/admin.module','admin','module','',1,0,0);
INSERT INTO system VALUES ('modules/block.module','block','module','',1,0,0);
INSERT INTO system VALUES ('modules/comment.module','comment','module','',1,0,0);
INSERT INTO system VALUES ('modules/help.module','help','module','',1,0,0);
INSERT INTO system VALUES ('modules/node.module','node','module','',1,0,0);
INSERT INTO system VALUES ('modules/page.module','page','module','',1,0,0);
INSERT INTO system VALUES ('modules/story.module','story','module','',1,0,0);
INSERT INTO system VALUES ('modules/taxonomy.module','taxonomy','module','',1,0,0);
INSERT INTO system VALUES ('themes/xtemplate/xtemplate.theme','xtemplate','theme','Internet explorer, Netscape, Opera',1,0,0);
INSERT INTO variable(name,value) VALUES('update_start', 's:10:"2003-10-27";');
INSERT INTO variable(name,value) VALUES('theme_default','s:9:"xtemplate";');
INSERT INTO users(uid,name,mail,rid) VALUES(0,'','','1');
INSERT INTO blocks(module,delta,status,custom,region,weight,path) VALUES('user', 0, 1, 0, 1, 0, '');
INSERT INTO blocks(module,delta,status,custom,region,weight,path) VALUES('user', 1, 1, 0, 1, 0, '');
---
--- Functions. Functions first available in SQL Server 2000. GREATEST() used by forum.module, tracker.module at the moment.
---
GO
CREATE FUNCTION GREATEST (@a int, @b int)
RETURNS int AS
BEGIN
IF (@a > @b)
BEGIN
RETURN @a;
END
RETURN @b;
END
......@@ -68,7 +68,6 @@ CREATE TABLE book (
format tinyint(2) default '0',
log longtext,
PRIMARY KEY (nid),
KEY nid (nid),
KEY parent (parent)
) TYPE=MyISAM;
......@@ -125,7 +124,6 @@ CREATE TABLE comments (
comment longtext NOT NULL,
hostname varchar(128) NOT NULL default '',
timestamp int(11) NOT NULL default '0',
link varchar(16) NOT NULL default '',
score mediumint(9) NOT NULL default '0',
status tinyint(3) unsigned NOT NULL default '0',
thread varchar(255) NOT NULL,
......@@ -169,6 +167,16 @@ CREATE TABLE feed (
UNIQUE KEY title (title)
) TYPE=MyISAM;
--
-- Table structure for table 'filters'
--
CREATE TABLE filters (
module varchar(64) NOT NULL default '',
weight tinyint(2) DEFAULT '0' NOT NULL,
KEY weight (weight)
) TYPE=MyISAM;
--
-- Table structure for table 'forum'
--
......@@ -176,9 +184,9 @@ CREATE TABLE feed (
CREATE TABLE forum (
nid int(10) unsigned NOT NULL default '0',
tid int(10) unsigned NOT NULL default '0',
icon varchar(255) NOT NULL default '',
shadow int(10) unsigned NOT NULL default '0',
PRIMARY KEY (nid)
PRIMARY KEY (nid),
KEY tid (tid)
) TYPE=MyISAM;
--
......@@ -278,7 +286,6 @@ CREATE TABLE node (
promote int(2) NOT NULL default '0',
moderate int(2) NOT NULL default '0',
users longtext NOT NULL,
attributes varchar(255) NOT NULL default '',
teaser longtext NOT NULL,
body longtext NOT NULL,
changed int(11) NOT NULL default '0',
......@@ -302,8 +309,7 @@ CREATE TABLE page (
link varchar(128) NOT NULL default '',
format tinyint(2) NOT NULL default '0',
description varchar(128) NOT NULL default '',
PRIMARY KEY (nid),
KEY nid (nid)
PRIMARY KEY (nid)
) TYPE=MyISAM;
--
......@@ -577,10 +583,14 @@ INSERT INTO system VALUES ('modules/story.module','story','module','',1,0,0);
INSERT INTO system VALUES ('modules/taxonomy.module','taxonomy','module','',1,0,0);
INSERT INTO system VALUES ('themes/xtemplate/xtemplate.theme','xtemplate','theme','Internet explorer, Netscape, Opera',1,0,0);
INSERT INTO users (uid, name, mail, rid) VALUES ('0', '', '', '1');
INSERT INTO role (rid, name) VALUES (1, 'anonymous user');
INSERT INTO permission VALUES (1,'access content',0);
INSERT INTO role (rid, name) VALUES (2, 'authenticated user');
INSERT INTO permission VALUES (2,'access comments, access content, post comments, post comments without approval',0);
REPLACE variable SET name='update_start', value='s:10:"2003-10-27;"';
REPLACE variable SET name='update_start', value='s:10:"2004-02-21;"';
REPLACE variable SET name='theme_default', value='s:9:"xtemplate";';
REPLACE blocks SET module = 'user', delta = '0', status = '1';
......
......@@ -123,7 +123,6 @@ CREATE TABLE comments (
comment text NOT NULL default '',
hostname varchar(128) NOT NULL default '',
timestamp integer NOT NULL default '0',
link varchar(16) NOT NULL default '',
score integer NOT NULL default '0',
status smallint NOT NULL default '0',
thread varchar(255) default '',
......@@ -167,6 +166,16 @@ CREATE TABLE feed (
UNIQUE (url)
);
--
-- Table structure for table 'filters'
--
CREATE TABLE filters (
module varchar(64) NOT NULL default '',
weight smallint DEFAULT '0' NOT NULL,
PRIMARY KEY (weight)
);
--
-- Table structure for table 'forum'
--
......@@ -174,7 +183,6 @@ CREATE TABLE feed (
CREATE TABLE forum (
nid integer NOT NULL default '0',
tid integer NOT NULL default '0',
icon varchar(255) NOT NULL default '',
shadow integer NOT NULL default '0',
PRIMARY KEY (nid)
);
......@@ -277,7 +285,6 @@ CREATE TABLE node (
promote integer NOT NULL default '0',
moderate integer NOT NULL default '0',
users text NOT NULL default '',
attributes varchar(255) NOT NULL default '',
teaser text NOT NULL default '',
body text NOT NULL default '',
changed integer NOT NULL default '0',
......@@ -575,10 +582,14 @@ INSERT INTO system VALUES ('modules/story.module','story','module','',1,0,0);
INSERT INTO system VALUES ('modules/taxonomy.module','taxonomy','module','',1,0,0);
INSERT INTO system VALUES ('themes/xtemplate/xtemplate.theme','xtemplate','theme','Internet explorer, Netscape, Opera',1,0,0);
INSERT INTO variable(name,value) VALUES('update_start', 's:10:"2003-10-27";');
INSERT INTO variable(name,value) VALUES('update_start', 's:10:"2004-02-21";');
INSERT INTO variable(name,value) VALUES('theme_default','s:9:"xtemplate";');
INSERT INTO users(uid,name,mail,rid) VALUES(0,'','', '1');
INSERT INTO role (rid, name) VALUES (1, 'anonymous user');
INSERT INTO permission VALUES (1,'access content',0);
INSERT INTO role (rid, name) VALUES (2, 'authenticated user');
INSERT INTO permission VALUES (2,'access comments, access content, post comments, post comments without approval',0);
INSERT INTO blocks(module,delta,status) VALUES('user', '0', '1');
......
<?php
/* $Id$ */
// Define the various updates in an array("date : comment" => "function");
$sql_updates = array(
"2002-06-22: first update since Drupal 4.0.0 release" => "update_32",
"2002-07-07" => "update_33",
"2002-07-31" => "update_34",
"2002-08-10" => "update_35",
"2002-08-16" => "update_36",
"2002-08-19" => "update_37",
"2002-08-26" => "update_38",
"2002-09-15" => "update_39",
"2002-09-17" => "update_40",
"2002-10-13" => "update_41",
"2002-10-17" => "update_42",
"2002-10-26" => "update_43",
"2002-11-08" => "update_44",
"2002-11-20" => "update_45",
"2002-12-10: first update since Drupal 4.1.0 release" => "update_46",
"2002-12-29" => "update_47",
"2003-01-03" => "update_48",
"2003-01-05" => "update_49",
"2003-01-15" => "update_50",
"2003-04-19" => "update_51",
"2003-04-20" => "update_52",
"2003-05-18" => "update_53",
"2003-05-24" => "update_54",
"2003-05-31" => "update_55",
"2003-06-04" => "update_56",
"2003-06-08" => "update_57",
"2003-06-08: first update since Drupal 4.2.0 release" => "update_58",
"2003-08-05" => "update_59",
"2003-08-15" => "update_60",
"2003-08-20" => "update_61",
"2003-08-27" => "update_62",
"2003-09-09" => "update_63",
"2003-09-10" => "update_64",
"2003-09-29" => "update_65",
"2003-09-30" => "update_66",
"2003-10-11" => "update_67",
"2003-10-20" => "update_68",
"2003-10-22" => "update_69",
"2003-10-27" => "update_70",
"2003-11-17: first update since Drupal 4.3.0 release" => "update_71",
"2003-11-27" => "update_72",
"2003-12-03" => "update_73",
"2003-12-06" => "update_74",
"2004-01-06" => "update_75",
"2004-01-11" => "update_76",
"2004-01-13" => "update_77",
"2004-02-03" => "update_78",
"2004-02-21" => "update_79"
);
function update_32() {
$ret = array();
$ret[] = update_sql("ALTER TABLE users ADD index (sid(4))");
$ret[] = update_sql("ALTER TABLE users ADD index (timestamp)");
$ret[] = update_sql("ALTER TABLE users ADD UNIQUE KEY name (name)");
return $ret;
}
function update_33() {
$ret = array();
$result = db_query("SELECT * FROM variable WHERE value NOT LIKE 's:%;'");
// NOTE: the "WHERE"-part of the query above avoids variables to get serialized twice.
while ($variable = db_fetch_object($result)) {
variable_set($variable->name, $variable->value);
}
return $ret;
}
function update_34() {
$ret = array();
$ret[] = update_sql("ALTER TABLE feed MODIFY refresh int(10) NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE feed MODIFY timestamp int (10) NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE users CHANGE session session TEXT");
return $ret;
}
function update_35() {
$ret = array();
$ret[] = update_sql("ALTER TABLE poll_choices ADD INDEX (nid)");
return $ret;
}
function update_36() {
$ret = array();
$ret[] = update_sql("ALTER TABLE rating CHANGE old previous int(6) NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE rating CHANGE new current int(6) NOT NULL default '0'");
return $ret;
}
function update_37() {
$ret = array();
$ret[] = update_sql("DROP TABLE IF EXISTS sequences");
$ret[] = update_sql("CREATE TABLE sequences (
name VARCHAR(255) NOT NULL PRIMARY KEY,
id INT UNSIGNED NOT NULL
) TYPE=MyISAM");
if ($max = db_result(db_query("SELECT MAX(nid) FROM node"))) {
$ret[] = update_sql("REPLACE INTO sequences VALUES ('node', $max)");
}
if ($max = db_result(db_query("SELECT MAX(cid) FROM comments"))) {
$ret[] = update_sql("REPLACE INTO sequences VALUES ('comments', $max)");
}
// NOTE: move the comments bit down as soon as we switched to use the new comment module!
if ($max = db_result(db_query("SELECT MAX(tid) FROM term_data"))) {
$ret[] = update_sql("REPLACE INTO sequences VALUES ('term_data', $max)");
}
return $ret;
}
function update_38() {
$ret = array();
$ret[] = update_sql("ALTER TABLE watchdog CHANGE message message text NOT NULL default ''");
return $ret;
}
function update_39() {
$ret = array();
$ret[] = update_sql("DROP TABLE moderate");
$ret[] = update_sql("ALTER TABLE comments ADD score MEDIUMINT NOT NULL");
$ret[] = update_sql("ALTER TABLE comments ADD status TINYINT UNSIGNED NOT NULL");
$ret[] = update_sql("ALTER TABLE comments ADD users MEDIUMTEXT");
$ret[] = update_sql("CREATE TABLE moderation_votes (
mid INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
vote VARCHAR(255),
weight TINYINT NOT NULL
)");
$ret[] = update_sql("CREATE TABLE moderation_roles (
rid INT UNSIGNED NOT NULL,
mid INT UNSIGNED NOT NULL,
value TINYINT NOT NULL
)");
$ret[] = update_sql("ALTER TABLE moderation_roles ADD INDEX (rid)");
$ret[] = update_sql("ALTER TABLE moderation_roles ADD INDEX (mid)");
$ret[] = update_sql("CREATE TABLE moderation_filters (
fid INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
filter VARCHAR(255) NOT NULL,
minimum SMALLINT NOT NULL
)");
$ret[] = update_sql("DELETE FROM moderation_votes");
$ret[] = update_sql("INSERT INTO moderation_votes VALUES (1, '+1', 0)");
$ret[] = update_sql("INSERT INTO moderation_votes VALUES (2, '-1', 1)");
$ret[] = update_sql("DELETE FROM moderation_roles");
$ret[] = update_sql("INSERT INTO moderation_roles VALUES (2, 1, 1)");
$ret[] = update_sql("INSERT INTO moderation_roles VALUES (2, 2, -1)");
$ret[] = update_sql("CREATE TABLE forum (
nid int unsigned not null primary key,
icon varchar(255) not null,
shadow int unsigned not null
)");
return $ret;
}
function update_40() {
$ret = array();
if ($max = db_result(db_query("SELECT MAX(cid) FROM comments"))) {
$ret[] = update_sql("REPLACE INTO sequences VALUES ('comments', $max)");
}
return $ret;
}
function update_41() {
$ret = array();
$ret[] = update_sql("CREATE TABLE statistics (
nid int(11) NOT NULL,
totalcount bigint UNSIGNED DEFAULT '0' NOT NULL,
daycount mediumint UNSIGNED DEFAULT '0' NOT NULL,
timestamp int(11) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (nid),
INDEX (totalcount),
INDEX (daycount),
INDEX (timestamp)
)");
$ret[] = update_sql("CREATE TABLE accesslog (
nid int(11) UNSIGNED DEFAULT '0',
url varchar(255),
hostname varchar(128),
uid int(10) UNSIGNED DEFAULT '0',
timestamp int(11) UNSIGNED NOT NULL
)");
return $ret;
}
function update_42() {
$ret = array();
$ret[] = update_sql("DROP TABLE modules");
$ret[] = update_sql("DROP TABLE layout");
$ret[] = update_sql("DROP TABLE referrer");
return $ret;
}
function update_43() {
$ret = array();
$ret[] = update_sql("ALTER TABLE blocks DROP remove");
$ret[] = update_sql("ALTER TABLE blocks DROP name");
$ret[] = update_sql("UPDATE boxes SET type = 0 WHERE type = 1");
$ret[] = update_sql("UPDATE boxes SET type = 1 WHERE type = 2");
return $ret;
}
function update_44() {
$ret = array();
$ret[] = update_sql("UPDATE system SET filename = CONCAT('modules/', filename) WHERE type = 'module'");
return $ret;
}
function update_45() {
$ret = array();
$ret[] = update_sql("ALTER TABLE page ADD description varchar(128) NOT NULL default ''");
return $ret;
}
function update_46() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("ALTER TABLE cache ADD created integer");
}
else {
$ret[] = update_sql("ALTER TABLE cache ADD created int(11) NOT NULL default '0'");
}
return $ret;
}
function update_47() {
$ret = array();
if ($max = db_result(db_query("SELECT MAX(vid) FROM vocabulary"))) {
$ret[] = update_sql("REPLACE INTO sequences VALUES ('vocabulary', $max)");
}
return $ret;
}
function update_48() {
$ret = array();
$ret[] = update_sql("ALTER TABLE watchdog ADD link varchar(255) DEFAULT '' NULL");
return $ret;
}
function update_49() {
$ret = array();
/*
** Make sure the admin module is added to the system table or the
** admin menus won't show up.
*/
$ret[] = update_sql("DELETE FROM system WHERE name = 'admin';");
$ret[] = update_sql("INSERT INTO system VALUES ('modules/admin.module','admin','module','',1)");
return $ret;
}
function update_50() {
$ret = array();
$ret[] = update_sql("ALTER TABLE forum ADD tid INT UNSIGNED NOT NULL");
$result = db_queryd("SELECT n.nid, t.tid FROM node n, term_node t WHERE n.nid = t.nid AND type = 'forum'");
while ($node = db_fetch_object($result)) {
db_queryd("UPDATE forum SET tid = %d WHERE nid = %d", $node->tid, $node->nid);
}
$ret[] = update_sql("ALTER TABLE forum ADD INDEX (tid)");
return $ret;
}
function update_51() {
$ret = array();
$ret[] = update_sql("ALTER TABLE blocks CHANGE delta delta varchar(32) NOT NULL default '0'");
return $ret;
}
function update_52() {
$ret = array();
$ret[] = update_sql("UPDATE sequences SET name = 'comments_cid' WHERE name = 'comments';");
$ret[] = update_sql("UPDATE sequences SET name = 'node_nid' WHERE name = 'node';");
$ret[] = update_sql("DELETE FROM sequences WHERE name = 'import'");
$ret[] = update_sql("DELETE FROM sequences WHERE name = 'bundle_bid'"); // in case we would run this entry twice
$ret[] = update_sql("DELETE FROM sequences WHERE name = 'feed_fid'"); // in case we would run this entry twice
$bundles = db_result(db_query("SELECT MAX(bid) FROM bundle;"));
$ret[] = update_sql("INSERT INTO sequences (name, id) VALUES ('bundle_bid', '$bundles')");
$feeds = db_result(db_query("SELECT MAX(fid) FROM feed;"));
$ret[] = update_sql("INSERT INTO sequences (name, id) VALUES ('feed_fid', '$feeds')");
$ret[] = update_sql("UPDATE sequences SET name = 'vocabulary_vid' WHERE name = 'vocabulary';");
$ret[] = update_sql("UPDATE sequences SET name = 'term_data_tid' WHERE name = 'term_data'");
return $ret;
}
function update_53() {
$ret = array();
$ret[] = update_sql("CREATE INDEX book_parent ON book(parent);");
return $ret;
}
function update_54() {
$ret = array();
$ret[] = update_sql("ALTER TABLE locales CHANGE string string BLOB DEFAULT '' NOT NULL");
return $ret;
}
function update_55() {
$ret = array();
$ret[] = update_sql("ALTER TABLE site ADD checked INT(11) NOT NULL;");
$ret[] = update_sql("ALTER TABLE site CHANGE timestamp changed INT(11) NOT NULL;");
return $ret;
}
function update_56() {
$ret = array();
$ret[] = update_sql("ALTER TABLE vocabulary CHANGE types nodes TEXT DEFAULT '' NOT NULL");
return $ret;
}
function update_57() {
$ret = array();
$ret[] = update_sql("DELETE FROM variable WHERE name = 'site_charset'");
return $ret;
}
function update_58() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("ALTER TABLE {node} ADD path varchar(250) NULL");
$ret[] = update_sql("ALTER TABLE {node} ALTER COLUMN path SET DEFAULT ''");
}
else {
$ret[] = update_sql("ALTER TABLE {node} ADD path varchar(250) NULL default ''");
}
return $ret;
}
function update_59() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("ALTER TABLE {comments} ADD thread VARCHAR(255)");
$ret[] = update_sql("ALTER TABLE {comments} ALTER COLUMN thread SET NOT NULL");
}
else {
$ret[] = update_sql("ALTER TABLE {comments} ADD thread VARCHAR(255) NOT NULL");
}
$result = db_query("SELECT DISTINCT(nid) FROM {comments} WHERE thread = ''");
while ($node = db_fetch_object($result)) {
$result2 = db_query("SELECT cid, pid FROM {comments} where nid = '%d' ORDER BY timestamp", $node->nid);
$comments = array();
while ($comment = db_fetch_object($result2)) {
$comments[$comment->cid] = $comment;
}
$structure = array();
$structure = _update_thread_structure($comments, 0, -1, $structure);
foreach ($structure as $cid => $thread) {
$new_parts = array();
foreach(explode(".", $thread) as $part) {
if ($part > 9) {
$start = substr($part, 0, strlen($part) - 1);
$end = substr($part, -1, 1);
$new_parts[] = str_repeat("9", $start).$end;
}
else {
$new_parts[] = $part;
}
}
$thread = implode(".", $new_parts);
db_query("UPDATE {comments} SET thread = '%s' WHERE cid = '%d'", $thread."/", $comments[$cid]->cid);
}
}
return $ret;
}
function _update_thread_structure($comments, $pid, $depth, $structure) {
$ret = array();
$depth++;
foreach ($comments as $key => $comment) {
if ($comment->pid == $pid) {
if ($structure[$comment->pid]) {
$structure[$comment->cid] = $structure[$comment->pid]."."._update_next_thread($structure, $structure[$comment->pid]);
}
else {
$structure[$comment->cid] = _update_next_thread($structure, "");
}
$structure = _update_thread_structure($comments, $comment->cid, $depth, $structure);
}
}
return $structure;
return $ret;
}
function update_60() {
$ret = array();
$ret[] = update_sql("ALTER TABLE {forum} DROP icon");
return $ret;
}
function update_61() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("CREATE TABLE {sessions} (
uid integer NOT NULL,
sid varchar(32) NOT NULL default '',
hostname varchar(128) NOT NULL default '',
timestamp integer NOT NULL default '0',
session text,
PRIMARY KEY (sid)
);");
$ret[] = update_sql("ALTER TABLE {users} DROP session;");
$ret[] = update_sql("ALTER TABLE {users} DROP hostname;");
$ret[] = update_sql("ALTER TABLE {users} DROP sid;");
}
else {
$ret[] = update_sql("CREATE TABLE IF NOT EXISTS {sessions} (
uid int(10) unsigned NOT NULL,
sid varchar(32) NOT NULL default '',
hostname varchar(128) NOT NULL default '',
timestamp int(11) NOT NULL default '0',
session text,
KEY uid (uid),
KEY sid (sid(4)),
KEY timestamp (timestamp)
)");
$ret[] = update_sql("ALTER TABLE {users} DROP session;");
$ret[] = update_sql("ALTER TABLE {users} DROP hostname;");
$ret[] = update_sql("ALTER TABLE {users} DROP sid;");
}
return $ret;
}
function update_62() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("CREATE INDEX accesslog_timestamp ON {accesslog} (timestamp)");
$ret[] = update_sql("DROP INDEX node_type_idx");
$ret[] = update_sql("DROP INDEX node_title_idx");
$ret[] = update_sql("DROP INDEX node_promote_idx");
$ret[] = update_sql("CREATE INDEX node_type ON {node} (type)");
$ret[] = update_sql("CREATE INDEX node_title_type ON {node} (title,type)");
$ret[] = update_sql("CREATE INDEX node_moderate ON {node} (moderate)");
$ret[] = update_sql("CREATE INDEX node_path ON {node} (path)");
$ret[] = update_sql("CREATE INDEX node_promote_status ON {node} (promote, status)");
}
else {
$ret[] = update_sql("ALTER TABLE {accesslog} ADD INDEX accesslog_timestamp (timestamp)");
$ret[] = update_sql("ALTER TABLE {node} DROP INDEX type");
$ret[] = update_sql("ALTER TABLE {node} DROP INDEX title");
$ret[] = update_sql("ALTER TABLE {node} DROP INDEX promote");
$ret[] = update_sql("ALTER TABLE {node} ADD INDEX node_type (type(4))");
$ret[] = update_sql("ALTER TABLE {node} ADD INDEX node_title_type (title,type(4))");
$ret[] = update_sql("ALTER TABLE {node} ADD INDEX node_moderate (moderate)");
$ret[] = update_sql("ALTER TABLE {node} ADD INDEX node_path (path(5))");
$ret[] = update_sql("ALTER TABLE {node} ADD INDEX node_promote_status (promote, status)");
}
return $ret;
}
function _update_next_thread($structure, $parent) {
$ret = array();
do {
$val++;
if ($parent) {
$thread = "$parent.$val";
}
else {
$thread = $val;
}
} while (array_search($thread, $structure));
return $val;
return $ret;
}
function update_63() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("INSERT INTO {users} (uid, name, mail, timestamp) VALUES ('0', '', '', '". time() ."')");
}
else {
$ret[] = update_sql("ALTER TABLE {users} CHANGE uid uid int(10) unsigned NOT NULL default '0'");
$ret[] = update_sql("INSERT INTO {users} (uid, name, mail, timestamp) VALUES ('0', '', '', '". time() ."')");
$users = db_result(db_query("SELECT MAX(uid) FROM {users};"));
$ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('users_uid', '$users')");
}
return $ret;
}
function update_64() {
$ret = array();
$ret[] = update_sql("UPDATE {users} SET rid = 1 WHERE uid = 0");
return $ret;
}
function update_65() {
$ret = array();
// PostgreSQL-only update.
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("CREATE FUNCTION \"rand\"() RETURNS float AS '
BEGIN
RETURN random();
END;' LANGUAGE 'plpgsql'");
}
return $ret;
}
function update_66() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("CREATE TABLE {path} (
pid serial,
src varchar(128) NOT NULL default '',
dst varchar(128) NOT NULL default '',
PRIMARY KEY (pid)
)");
$ret[] = update_sql("CREATE INDEX path_src_idx ON {path}(src)");
$ret[] = update_sql("CREATE INDEX path_dst_idx ON {path}(dst)");
$result = db_query("SELECT nid, path FROM {node} WHERE path != ''");
while ($node = db_fetch_object($result)) {
$ret[] = update_sql("INSERT INTO {path} (src, dst) VALUES ('node/view/$node->nid', '". check_query($node->path) ."')");
}
}
else {
$ret[] = update_sql("CREATE TABLE {path} (
pid int(10) unsigned NOT NULL auto_increment,
src varchar(128) NOT NULL default '',
dst varchar(128) NOT NULL default '',
PRIMARY KEY (pid),
UNIQUE KEY src (src),
UNIQUE KEY dst (dst)
)");
// Migrate the existing paths:
$result = db_query("SELECT nid, path FROM {node} WHERE path != ''");
while ($node = db_fetch_object($result)) {
$ret[] = update_sql("INSERT INTO {path} (src, dst) VALUES ('node/view/$node->nid', '". check_query($node->path) ."')");
}
$ret[] = update_sql("ALTER TABLE {node} DROP path");
}
return $ret;
}
function update_67() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
// Taking no action. PostgreSQL is not always capable of dropping columns.
}
else {
$ret[] = update_sql("ALTER TABLE {users} DROP homepage");
}
return $ret;
}
function update_68() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
// Unneccesary. The PostgreSQL port was already using a sequence.
}
else {
$max = db_result(db_query("SELECT MAX(aid) FROM {access};"));
$ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('access_aid', '$max')");
$ret[] = update_sql("ALTER TABLE {access} CHANGE aid aid tinyint(10) NOT NULL ");
}
return $ret;
}
function update_69() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
/* Rename the statistics table to node_counter */
$ret[] = update_sql("ALTER TABLE {statistics} RENAME TO {node_counter}");
$ret[] = update_sql("DROP INDEX {statistics}_totalcount_idx");
$ret[] = update_sql("DROP INDEX {statistics}_daycount_idx");
$ret[] = update_sql("DROP INDEX {statistics}_timestamp_idx");
$ret[] = update_sql("CREATE INDEX {node_counter}_totalcount_idx ON {node_counter}(totalcount)");
$ret[] = update_sql("CREATE INDEX {node_counter}_daycount_idx ON {node_counter}(daycount)");
$ret[] = update_sql("CREATE INDEX {node_counter}_timestamp_idx ON {node_counter}(timestamp)");
/* Rename the path table to url_alias */
$ret[] = update_sql("ALTER TABLE {path} RENAME TO {url_alias}");
$ret[] = update_sql("ALTER TABLE {path}_pid_seq RENAME TO {url_alias}_pid_seq");
}
else {
$ret[] = update_sql("ALTER TABLE {statistics} RENAME TO {node_counter}");
$ret[] = update_sql("ALTER TABLE {path} RENAME TO {url_alias}");
$ret[] = update_sql("UPDATE {sequences} SET name = '{url_alias}_pid' WHERE name = '{path}_pid'");
}
$ret[] = update_sql("UPDATE {users} SET name = '' WHERE uid = 0;");
return $ret;
}
function update_70() {
$ret = array();
$ret[] = update_sql("ALTER TABLE {variable} CHANGE name name varchar(48) NOT NULL");
return $ret;
}
function update_71() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("ALTER TABLE {system} ADD bootstrap integer");
}
else {
$ret[] = update_sql("ALTER TABLE {system} ADD bootstrap int(2)");
}
return $ret;
}
function update_72() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("ALTER TABLE {blocks} ADD throttle smallint");
$ret[] = update_sql("ALTER TABLE {blocks} ALTER COLUMN throttle SET DEFAULT '0'");
$ret[] = update_sql("UPDATE {blocks} SET throttle = 0");
$ret[] = update_sql("ALTER TABLE {blocks} ALTER COLUMN throttle SET NOT NULL");
}
else {
$ret[] = update_sql("ALTER TABLE {blocks} ADD throttle tinyint(1) NOT NULL DEFAULT '0'");
}
return $ret;
}
function update_73() {
$ret = array();
/* MySQL only update */
if ($GLOBALS["db_type"] == "mysql") {
$ret[] = update_sql("ALTER TABLE {book} CHANGE log log longtext");
$ret[] = update_sql("ALTER TABLE {boxes} CHANGE body body longtext");
$ret[] = update_sql("ALTER TABLE {cache} CHANGE data data longtext");
$ret[] = update_sql("ALTER TABLE {comments} CHANGE comment comment longtext");
$ret[] = update_sql("ALTER TABLE {comments} CHANGE users users longtext");
$ret[] = update_sql("ALTER TABLE {directory} CHANGE slogan slogan longtext");
$ret[] = update_sql("ALTER TABLE {directory} CHANGE mission mission longtext");
$ret[] = update_sql("ALTER TABLE {feed} CHANGE description description longtext");
$ret[] = update_sql("ALTER TABLE {item} CHANGE description description longtext");
$ret[] = update_sql("ALTER TABLE {node} CHANGE users users longtext");
$ret[] = update_sql("ALTER TABLE {node} CHANGE teaser teaser longtext");
$ret[] = update_sql("ALTER TABLE {node} CHANGE body body longtext");
$ret[] = update_sql("ALTER TABLE {node} CHANGE revisions revisions longtext");
$ret[] = update_sql("ALTER TABLE {permission} CHANGE perm perm longtext");
$ret[] = update_sql("ALTER TABLE {poll} CHANGE voters voters longtext");
$ret[] = update_sql("ALTER TABLE {sessions} CHANGE session session longtext");
$ret[] = update_sql("ALTER TABLE {term_data} CHANGE description description longtext");
$ret[] = update_sql("ALTER TABLE {users} CHANGE data data longtext");
$ret[] = update_sql("ALTER TABLE {variable} CHANGE value value longtext");
$ret[] = update_sql("ALTER TABLE {vocabulary} CHANGE description description longtext");
$ret[] = update_sql("ALTER TABLE {vocabulary} CHANGE nodes nodes longtext");
$ret[] = update_sql("ALTER TABLE {watchdog} CHANGE message message longtext");
}
return $ret;
}
function update_74() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("ALTER TABLE {system} ADD throttle smallint");
$ret[] = update_sql("ALTER TABLE {system} ALTER COLUMN throttle SET DEFAULT '0'");
$ret[] = update_sql("UPDATE {system} SET throttle = 0");
$ret[] = update_sql("ALTER TABLE {system} ALTER COLUMN throttle SET NOT NULL");
}
else {
$ret[] = update_sql("ALTER TABLE {system} ADD throttle tinyint(1) NOT NULL DEFAULT '0'");
}
return $ret;
}
function update_75() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("ALTER TABLE {feed} ADD etag text");
$ret[] = update_sql("ALTER TABLE {feed} ALTER COLUMN etag SET DEFAULT ''");
$ret[] = update_sql("ALTER TABLE {feed} ALTER COLUMN etag SET NOT NULL");
$ret[] = update_sql("ALTER TABLE {feed} ADD modified integer");
$ret[] = update_sql("ALTER TABLE {feed} ALTER COLUMN modified SET DEFAULT '0'");
$ret[] = update_sql("UPDATE {feed} SET modified = 0");
$ret[] = update_sql("ALTER TABLE {feed} ALTER COLUMN modified SET NOT NULL");
$ret[] = update_sql("ALTER TABLE {feed} RENAME timestamp TO checked");
$ret[] = update_sql("UPDATE {blocks} SET module = 'aggregator' WHERE module = 'import'");
$ret[] = update_sql("UPDATE {system} SET filename = 'modules/aggregator.module', name = 'aggregator' WHERE filename = 'modules/import.module'");
}
else {
$ret[] = update_sql("ALTER TABLE {feed} ADD etag varchar(255) NOT NULL DEFAULT ''");
$ret[] = update_sql("ALTER TABLE {feed} ADD modified int(10) NOT NULL DEFAULT 0");
$ret[] = update_sql("ALTER TABLE {feed} CHANGE timestamp checked int(10) NOT NULL DEFAULT 0");
$ret[] = update_sql("UPDATE {blocks} SET module = 'aggregator' WHERE module = 'import'");
$ret[] = update_sql("UPDATE {system} SET filename = 'modules/aggregator.module', name = 'aggregator' WHERE filename = 'modules/import.module'");
}
return $ret;
}
function update_76() {
$ret = array();
if ($GLOBALS["db_type"] == "pgsql") {
$ret[] = update_sql("ALTER TABLE {feed} ADD image text");
} else {
$ret[] = update_sql("ALTER TABLE {feed} ADD image longtext");
}
return $ret;
}
function update_77() {
$ret = array();
$ret[] = update_sql("ALTER TABLE {cache} ADD headers text");
return $ret;
}
function update_78() {
$ret = array();
if ($GLOBALS["db_type"] == "mysql") {
$ret[] = update_sql("CREATE TABLE {filters} (
module varchar(64) NOT NULL default '',
weight tinyint(2) DEFAULT '0' NOT NULL,
KEY weight (weight)
)");
}
else {
$ret[] = update_sql("CREATE TABLE {filters} (
module varchar(64) NOT NULL DEFAULT '',
weight smallint NOT NULL DEFAULT 0
);");
$ret[] = update_sql("CREATE INDEX {filters_weight} ON {filters} (weight);");
}
return $ret;
}
function update_79() {
$ret = array();
// Works for both mysql and postgresql
$ret[] = update_sql("ALTER TABLE {node} DROP attributes");
$ret[] = update_sql("ALTER TABLE {comments} DROP link");
return $ret;
}
function update_sql($sql) {
$edit = $_POST["edit"];
$result = db_query($sql);
if ($result) {
return array('1', nl2br(htmlentities($sql)) ." ", "<div style=\"color: green;\">OK</div>\n");
}
else {
return array('0', nl2br(htmlentities($sql)) ." ", "<div style=\"color: red;\">FAILED</div>\n");
}
}
?>
......@@ -137,20 +137,26 @@ function drupal_page_header() {
// Send appropriate response:
header("Last-Modified: $date");
header("ETag: $etag");
header($cache->headers);
/*
** Send the original request's headers. We send them one after
** another so PHP's header() function can deal with duplicate
** headers.
*/
$headers = explode("\n", $cache->headers);
foreach ($headers as $header) {
header($header);
}
print $cache->data;
/*
** call all init() and exit() hooks without including all modules
** only use those hooks for critical operations
*/
foreach (module_list(0, 1) as $module) {
if (is_array($module) && $module['bootstrap']) {
include_once $module['filename'];
foreach (bootstrap_hooks() as $hook) {
module_invoke($module['name'], $hook);
}
}
foreach (bootstrap_hooks() as $hook) {
module_invoke_all($hook);
}
exit();
}
......
......@@ -107,9 +107,9 @@ function drupal_set_html_head($data = NULL) {
function drupal_get_html_head() {
global $base_url;
$output = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
$output = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
$output .= "<base href=\"$base_url/\" />\n";
$output .= "<style type=\"text/css\">\n";
$output .= "<style type=\"text/css\" media=\"all\">\n";
$output .= "@import url(misc/drupal.css);\n";
$output .= "</style>\n";
......@@ -118,10 +118,10 @@ function drupal_get_html_head() {
/* @} */
/**
* @name URL path
* @name URL path alias
* @ingroup common
*
* Function to handle path aliases.
* Functions to handle path aliases.
*/
function drupal_get_path_map($action = "") {
static $map = NULL;
......@@ -131,6 +131,7 @@ function drupal_get_path_map($action = "") {
}
if (is_null($map)) {
$map = array(); // make $map non-null in case no aliases are defined
$result = db_query("SELECT * FROM {url_alias}");
while ($data = db_fetch_object($result)) {
$map[$data->dst] = $data->src;
......@@ -143,15 +144,34 @@ function drupal_get_path_map($action = "") {
function drupal_rebuild_path_map() {
drupal_get_path_map("rebuild");
}
/* @} */
/**
* @name HTTP handling
* @ingroup common
*
* Functions to properly handle HTTP responses.
* @{
* Given an old url, return the alias.
*/
function drupal_get_path_alias($path) {
if (($map = drupal_get_path_map()) && ($newpath = array_search($path, $map))) {
return $newpath;
}
elseif (function_exists("conf_url_rewrite")) {
return conf_url_rewrite($path, 'outgoing');
}
}
/**
* Given an alias, return the default url.
*/
function drupal_get_normal_path($path) {
if (($map = drupal_get_path_map()) && isset($map[$path])) {
return $map[$path];
}
elseif (function_exists("conf_url_rewrite")) {
return conf_url_rewrite($path, 'incoming');
}
else {
return $path;
}
}
/* @} */
/**
* @name HTTP headers
......@@ -175,21 +195,31 @@ function drupal_get_headers() {
}
/* @} */
/**
* @name HTTP handling
* @ingroup common
*
* Functions to properly handle HTTP responses.
* @{
*/
/**
* HTTP redirects. Makes sure the redirected url is formatted correctly and
* includes the session ID.
*
* @note This function ends the request.
*
* @param $url A string containing a fully qualified URI.
* @param $url A Drupal URL
* @param $query Query string component
* @param $fragment Fragment identifier
*/
function drupal_goto($url) {
function drupal_goto($url = NULL, $query = NULL, $fragment = NULL) {
/*
** Translate &amp; to simply &
** Translate &amp; to simply & in the absolute URL
*/
$url = str_replace("&amp;", "&", $url);
$url = str_replace("&amp;", "&", url($url, $query, $fragment, TRUE));
/*
** It is advised to use "drupal_goto()" instead of PHP's "header()" as
......@@ -236,7 +266,7 @@ function drupal_not_found() {
menu_execute_active_handler();
}
else {
print theme("page", '<h1>'. t('Page not found') .'</h1>');
print theme('page', '', t('Page not found'));
}
}
......@@ -303,27 +333,25 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
fwrite($fp, $request);
// Fetch response.
while (!feof($fp) && $data = fgets($fp)) {
$response[] = $data;
$response = '';
while (!feof($fp) && $data = fread($fp, 1024)) {
$response .= $data;
}
fclose($fp);
// Parse response.
list($protocol, $code, $text) = explode(' ', trim(array_shift($response)), 3);
list($headers, $result->data) = explode("\r\n\r\n", $response, 2);
$headers = preg_split("/\r\n|\n|\r/", $headers);
list($protocol, $code, $text) = explode(' ', trim(array_shift($headers)), 3);
$result->headers = array();
$result->data = '';
// Parse headers.
while ($line = trim(array_shift($response))) {
if ($line == '') {
break;
}
while ($line = trim(array_shift($headers))) {
list($header, $value) = explode(':', $line, 2);
$result->headers[$header] = trim($value);
}
$result->data = implode('', $response);
$responses = array(
100 => 'Continue', 101 => 'Switching Protocols',
200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content',
......@@ -374,15 +402,6 @@ function error_handler($errno, $message, $filename, $line, $variables) {
}
}
function throttle($type, $rate) {
if (!user_access("access administration pages")) {
if ($throttle = db_fetch_object(db_query("SELECT * FROM {watchdog} WHERE type = '%s' AND hostname = '%s' AND %d - timestamp < %d", $type, $_SERVER['REMOTE_ADDR'], time(), $rate))) {
watchdog("warning", "throttle: '". $_SERVER['REMOTE_ADDR'] ."' exceeded submission rate - $throttle->type");
die(message_throttle());
}
}
}
function _fix_gpc_magic(&$item, $key) {
if (is_array($item)) {
array_walk($item, '_fix_gpc_magic');
......@@ -452,9 +471,6 @@ function message_na() {
return t("n/a");
}
function message_throttle() {
return t("You exceeded the maximum submission rate. Please wait a few minutes and try again.");
}
/* @} */
function locale_init() {
......@@ -519,6 +535,7 @@ function drupal_specialchars($input, $quotes = ENT_NOQUOTES) {
* @ingroup common
*
* Functions to validate user input.
* @{
*/
/**
......@@ -530,7 +547,7 @@ function drupal_specialchars($input, $quotes = ENT_NOQUOTES) {
*/
function valid_email_address($mail) {
$user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+';
$domain = '(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]\.?)+';
$domain = '(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.?)+';
$ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}';
$ipv6 = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}';
......@@ -553,7 +570,7 @@ function valid_input_data($data) {
*/
foreach ($data as $key => $value) {
if (!valid_input_data($value)) {
if (!valid_input_data($key) || !valid_input_data($value)) {
return 0;
}
}
......@@ -662,15 +679,13 @@ function search_data($keys = NULL) {
if (isset($keys)) {
foreach (module_list() as $name) {
if (module_hook($name, "search") && (!$edit["type"] || $edit["type"][$name]) && ($result = module_invoke($name, "search", $keys))) {
if ($name == "node" || $name == "comment") {
$output .= "<p><strong>". t("Matching %names ranked in order of relevance:", array("%name" => $name)) ."</strong></p>";
}
else {
$output .= "<p><strong>". t("Matching {$name}s") .":</strong></p>";
}
foreach ($result as $entry) {
$output .= search_item($entry, $name);
if (module_hook($name, "search") && (!$edit["type"] || $edit["type"][$name])) {
list($title, $results) = module_invoke($name, "search", $keys);
if ($results) {
$output .= "<h2>$title</h2>";
foreach ($results as $entry) {
$output .= search_item($entry, $name);
}
}
}
}
......@@ -704,6 +719,14 @@ function check_file($filename) {
return is_uploaded_file($filename);
}
/**
* @name Formatting
* @ingroup common
*
* Functions to format numbers, strings, dates, etc.
* @{
*/
function format_rss_channel($title, $link, $description, $items, $language = "en", $args = array()) {
// arbitrary elements may be added using the $args associative array
......@@ -748,11 +771,18 @@ function format_rss_item($title, $link, $description, $args = array()) {
* @param $plural The string for the plural case. Please make sure it's clear
* this is plural, to ease translation. Use %count in places of the item
* count, as in "%count new comments".
* @return Translated string
*/
function format_plural($count, $singular, $plural) {
return t($count == 1 ? $singular : $plural, array("%count" => $count));
}
/**
* Generates a string representation for the given byte count.
*
* @param $size The size in bytes
* @return Translated string representation of the size
*/
function format_size($size) {
$suffix = t("bytes");
if ($size > 1024) {
......@@ -766,52 +796,102 @@ function format_size($size) {
return t("%size %suffix", array("%size" => $size, "%suffix" => $suffix));
}
function format_interval($timestamp) {
/**
* Formats a time interval with the requested granularity.
*
* @param $timestamp The length of the interval in seconds
* @param $granularity How much units to consider when generating the string
* @return Translated string representation of the interval
*/
function format_interval($timestamp, $granularity = 2) {
$units = array("1 year|%count years" => 31536000, "1 week|%count weeks" => 604800, "1 day|%count days" => 86400, "1 hour|%count hours" => 3600, "1 min|%count min" => 60, "1 sec|%count sec" => 1);
foreach ($units as $key => $value) {
$key = explode("|", $key);
if ($timestamp >= $value) {
$output .= ($output ? " " : "") . format_plural(floor($timestamp / $value), $key[0], $key[1]);
$timestamp %= $value;
$granularity--;
}
if ($granularity == 0) {
break;
}
}
return ($output) ? $output : t("0 sec");
}
function format_date($timestamp, $type = "medium", $format = "") {
global $user;
/**
* Formats a date with the given configured format or a custom format string.
* Drupal allows administrators to select formatting strings for 'small',
* 'medium' and 'large' date formats. This function can handle these formats,
* as well as any custom format.
*
* @param $timestamp The exact date to format
* @param $type Could be 'small', 'medium' or 'large' for the preconfigured
* date formats. If 'custom' is specified, the next parameter
* should contain the format string
* @param $format Format string (as required by the PHP date() function).
* Only required if 'custom' date format is requested.
* @param $timezone Timezone offset in seconds in case the user timezone
* should not be used.
* @return Translated date string in the requested format
*/
function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL) {
if ($timezone === NULL) {
global $user;
$timezone = $user->uid ? $user->timezone : variable_get('date_default_timezone', 0);
}
$timestamp += ($user->timezone) ? $user->timezone - date("Z") : 0;
$timestamp += $timezone;
switch ($type) {
case "small":
$format = variable_get("date_format_short", "m/d/Y - H:i");
case 'small':
$format = variable_get('date_format_short', 'm/d/Y - H:i');
break;
case "large":
$format = variable_get("date_format_long", "l, F j, Y - H:i");
case 'large':
$format = variable_get('date_format_long', 'l, F j, Y - H:i');
break;
case "custom":
case 'custom':
// No change to format
break;
case "medium":
case 'medium':
default:
$format = variable_get("date_format_medium", "D, m/d/Y - H:i");
$format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
}
for ($i = strlen($format); $i >= 0; $c = $format[--$i]) {
if (strstr("DFlMSw", $c)) {
$date = t(date($c, $timestamp)) . $date;
$max = strlen($format);
for ($i = 0; $i <= $max; $c = $format{$i++}) {
if (strpos('AaDFlM', $c)) {
$date .= t(gmdate($c, $timestamp));
}
else if (strpos('BdgGhHiIjLmnsStTUwWYyz', $c)) {
$date .= gmdate($c, $timestamp);
}
else if ($c == 'r') {
$date .= format_date($timestamp - $timezone, 'custom', 'D, d M Y H:i:s O', $timezone);
}
else if (strstr("AaBdgGhHiIjLmnOrstTUWYyZz", $c)) {
$date = date($c, $timestamp) . $date;
else if ($c == 'O') {
$date .= sprintf('%s%02d%02d', ($timezone < 0 ? '-' : '+'), abs($timezone / 3600), abs($timezone % 3600) / 60);
}
else if ($c == 'Z') {
$date .= $timezone;
}
else {
$date = $c.$date;
$date .= $c;
}
}
return $date;
}
/**
* Formats a username.
*
* @param $object User object
* @return String containing a HTML link to the user's page if the
* passed object suggests that this is a site user. Otherwise
* only the user name is returned.
*/
function format_name($object) {
if ($object->uid && $object->name) {
......@@ -821,13 +901,13 @@ function format_name($object) {
*/
if (strlen($object->name) > 20) {
$name = substr($object->name, 0, 15) ."...";
$name = truncate_utf8($object->name, 15) ."...";
}
else {
$name = $object->name;
}
if (arg(0) == "admin") {
if (arg(0) == "admin" and user_access("administer users")) {
$output = l($name, "admin/user/edit/$object->uid", array("title" => t("Administer user profile.")));
}
else {
......@@ -850,16 +930,17 @@ function format_name($object) {
return $output;
}
/* @} */
/**
* @defgroup from Form generation
* @{
*/
function form($form, $method = "post", $action = 0, $options = 0) {
function form($form, $method = "post", $action = NULL, $attributes = NULL) {
if (!$action) {
$action = request_uri();
}
return "<form action=\"$action\" method=\"$method\"". drupal_attributes($options) .">\n$form\n</form>\n";
return "<form action=\"$action\" method=\"$method\"". drupal_attributes($attributes) .">\n$form\n</form>\n";
}
function form_item($title, $value, $description = NULL, $id = NULL) {
......@@ -871,20 +952,28 @@ function form_group($legend, $group, $description = NULL) {
}
function form_radio($title, $name, $value = 1, $checked = 0, $description = NULL, $attributes = NULL) {
return theme("form_element", NULL, "<input type=\"radio\" class=\"form-radio\" name=\"edit[$name]\" value=\"$value\"". ($checked ? " checked=\"checked\"" : "") . drupal_attributes($attributes) ." /> $title", $description);
$element = "<input type=\"radio\" class=\"form-radio\" name=\"edit[$name]\" value=\"$value\"". ($checked ? " checked=\"checked\"" : "") . drupal_attributes($attributes) .' />';
if (!is_null($title)) {
$element = "<label class=\"option\">$element $title</label>";
}
return theme('form_element', NULL, $element, $description);
}
function form_radios($title, $name, $value, $options, $description = NULL) {
if (count($options) > 0) {
foreach ($options as $key => $choice) {
$choices .= "<input type=\"radio\" class=\"form-radio\" name=\"edit[$name]\" value=\"$key\"". ($key == $value ? " checked=\"checked\"" : "") ." /> $choice<br />";
$choices .= "<label class=\"option\"><input type=\"radio\" class=\"form-radio\" name=\"edit[$name]\" value=\"$key\"". ($key == $value ? " checked=\"checked\"" : "") ." /> $choice</label><br />";
}
return theme("form_element", $title, $choices, $description);
return theme('form_element', $title, $choices, $description);
}
}
function form_checkbox($title, $name, $value = 1, $checked = 0, $description = NULL, $attributes = NULL) {
return form_hidden($name, 0) . theme("form_element", NULL, "<input type=\"checkbox\" class=\"form-checkbox\" name=\"edit[$name]\" value=\"". $value ."\"". ($checked ? " checked=\"checked\"" : "") . drupal_attributes($attributes) ." /> $title", $description);
$element = "<input type=\"checkbox\" class=\"form-checkbox\" name=\"edit[$name]\" id=\"edit-$name\" value=\"". $value ."\"". ($checked ? " checked=\"checked\"" : "") . drupal_attributes($attributes) .' />';
if (!is_null($title)) {
$element = "<label class=\"option\">$element $title</label>";
}
return form_hidden($name, 0) . theme('form_element', NULL, $element, $description);
}
function form_textfield($title, $name, $value, $size, $maxlength, $description = NULL, $attributes = NULL) {
......@@ -933,42 +1022,11 @@ function form_weight($title = NULL, $name = "weight", $value = 0, $delta = 10, $
return form_select($title, $name, $value, $weights, $description, $extra);
}
function form_allowed_tags_text() {
return variable_get("allowed_html", "") ? (t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))) : "";
}
/* @} */
/**
* Given an old url, return the alias.
*/
function drupal_get_path_alias($path) {
if (($map = drupal_get_path_map()) && ($newpath = array_search($path, $map))) {
return $newpath;
}
elseif (function_exists("conf_url_rewrite")) {
return conf_url_rewrite($path, 'outgoing');
}
}
/**
* Given an alias, return the default url.
*/
function drupal_get_normal_path($path) {
if (($map = drupal_get_path_map()) && isset($map[$path])) {
return $map[$path];
}
elseif (function_exists("conf_url_rewrite")) {
return conf_url_rewrite($path, 'incoming');
}
else {
return $path;
}
}
function url($url = NULL, $query = NULL, $fragment = NULL) {
function url($url = NULL, $query = NULL, $fragment = NULL, $absolute = NULL) {
global $base_url;
static $script;
if (empty($script)) {
......@@ -988,60 +1046,71 @@ function url($url = NULL, $query = NULL, $fragment = NULL) {
$fragment = "#$fragment";
}
$base = ($absolute ? $base_url . '/' : '');
if (variable_get("clean_url", "0") == "0") {
if (isset($url)) {
if (isset($query)) {
return "$base_url/$script?q=$url&amp;$query$fragment";
return "$base$script?q=$url&amp;$query$fragment";
}
else {
return "$base_url/$script?q=$url$fragment";
return "$base$script?q=$url$fragment";
}
}
else {
if (isset($query)) {
return "$base_url/$script?$query$fragment";
return "$base$script?$query$fragment";
}
else {
return "$base_url/$fragment";
return "$base$fragment";
}
}
}
else {
if (isset($url)) {
if (isset($query)) {
return "$base_url/$url?$query$fragment";
return "$base$url?$query$fragment";
}
else {
return "$base_url/$url$fragment";
return "$base$url$fragment";
}
}
else {
if (isset($query)) {
return "$base_url/$script?$query$fragment";
return "$base$script?$query$fragment";
}
else {
return "$base_url/$fragment";
return "$base$fragment";
}
}
}
}
function drupal_attributes($attributes = NULL) {
if (is_array($attributes)) {
function drupal_attributes($attributes = array()) {
if (count($attributes)) {
$t = array();
foreach ($attributes as $key => $value) {
$t[] = "$key=\"$value\"";
}
return " ". implode($t, " ");
}
}
function l($text, $url, $attributes = array(), $query = NULL, $fragment = NULL) {
return "<a href=\"". url($url, $query, $fragment) ."\"". ($url == $_GET['q'] ? ' class="active"' : NULL) . drupal_attributes($attributes) .">$text</a>";
function l($text, $url, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = NULL) {
if (drupal_get_normal_path($url) == $_GET['q']) {
if (isset($attributes['class'])) {
$attributes['class'] .= ' active';
}
else {
$attributes['class'] = 'active';
}
}
return "<a href=\"". url($url, $query, $fragment, $absolute) ."\"". drupal_attributes($attributes) .">$text</a>";
}
function field_get($string, $name) {
ereg(",?$name=([^,]+)", ", $string", $regs);
ereg(",$name=([^,]+)", ",$string", $regs);
return $regs[1];
}
......@@ -1083,6 +1152,33 @@ function drupal_page_footer() {
module_invoke_all("exit");
}
/**
* Walks through the provided array and constructs an associative
* array out of it. The keys of the resulting array will be the
* values of the passed array. The values will either be the same
* (if no function was specified), or the results of the function
* given the value.
*
* @param $array An array
* @param $function A name of a function to apply to all values
*/
function drupal_map_assoc($array, $function = NULL) {
if (!isset($function)) {
$result = array();
foreach ($array as $value) {
$result[$value] = $value;
}
return $result;
}
elseif (function_exists($function)) {
$result = array();
foreach($array as $value) {
$result[$value] = $function($value);
}
return $result;
}
}
/**
* Wrapper around xml_parser_create() which extracts the encoding from the XML
* data first and sets the output encoding to UTF-8. This function should be
......@@ -1102,15 +1198,50 @@ function drupal_xml_parser_create(&$data) {
}
/*
* Note: unsupported encodings will need to be converted here into UTF-8,
* and $encoding set to 'utf-8'.
* Unsupported encodings are converted here into UTF-8.
* Requires iconv, see http://www.php.net/iconv
*/
$php_supported = array('utf-8', 'iso-8859-1', 'us-ascii');
if (!in_array(strtolower($encoding), $php_supported)) {
if (function_exists('iconv')) {
$out = iconv($encoding, 'utf-8', $data);
if ($out !== false) {
$data = $out;
$encoding = 'utf-8';
}
}
}
$xml_parser = xml_parser_create($encoding);
xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, 'utf-8');
return $xml_parser;
}
/**
* UTF-8-safe string truncation
* If the end position is in the middle of a UTF-8 sequence, it scans backwards
* until the beginning of the byte sequence.
*
* Use this function whenever you want to chop off a string at an unsure
* location. On the other hand, if you're sure that you're splitting on a
* character boundary (e.g. after using strpos or similar), you can safely use
* substr() instead.
*
* @param $string The string to truncate
* @param $len An upper limit on the returned string length.
*/
function truncate_utf8($string, $len) {
$slen = strlen($string);
if ($slen <= $len) {
return $string;
}
if ((ord($string[$len]) < 0x80) || (ord($string[$len]) >= 0xC0)) {
return substr($string, 0, $len);
}
while (ord($string[--$len]) < 0xC0) {};
return substr($string, 0, $len);
}
include_once "includes/theme.inc";
include_once "includes/pager.inc";
include_once "includes/menu.inc";
......@@ -1122,7 +1253,7 @@ function drupal_xml_parser_create(&$data) {
set_error_handler("error_handler");
// spit out the correct charset http header
header("Content-Type: text/html; charset=utf-8");
drupal_set_header("Content-Type: text/html; charset=utf-8");
// initialize the _GET["q"] prior to loading the modules and invoking their 'init' hook:
if (!empty($_GET["q"])) {
......
......@@ -14,7 +14,6 @@
# $db_url = "mysql://user:password@hostname/database";
# $db_url = "pgsql://user:password@hostname/database";
# $db_url = "mssql://user:password@hostname/database";
$db_url = "mysql://drupal:drupal@localhost/drupal";
# If $db_prefix is specified all database table names will be
......
......@@ -115,6 +115,7 @@ function file_check_upload($source) {
*/
function file_check_location($source, $directory = 0) {
$source = realpath($source);
$directory = realpath($directory);
if ($directory && strpos($source, $directory) !== 0) {
return 0;
}
......@@ -172,12 +173,19 @@ function file_copy(&$source, $dest = 0, $replace = 0) {
if (file_exists($dest) && !$replace) {
// Destination file already exists and we can't replace is so we try and
// and find a new filename.
list($name, $ext) = explode('.', $basename, 2);
$ext = $ext ? ".$ext" : '';
$pos = strrpos($basename, '.');
$name = substr($basename, 0, $pos);
if ($pos = strrpos($basename, '.')) {
$name = substr($basename, 0, $pos);
$ext = substr($basename, $pos);
}
else {
$name = $basename;
}
$counter = 0;
do {
$dest = $directory . FILE_SEPARATOR . $name .'_'. $counter++ . $ext;
$counter++;
} while (file_exists($dest));
}
......@@ -247,13 +255,18 @@ function file_save_upload($source, $dest = 0, $replace = 0) {
// Check for file upload errors.
switch ($file->error) {
case UPLOAD_ERR_PARTIAL:
case UPLOAD_ERR_NO_FILE:
case 0: // UPLOAD_ERR_OK
break;
case 1: // UPLOAD_ERR_INI_SIZE
case 2: // UPLOAD_ERR_FORM_SIZE
drupal_set_message(t("file upload failed: file size too big."), 'error');
return 0;
case 3: // UPLOAD_ERR_PARTIAL
case 4: // UPLOAD_ERR_NO_FILE
drupal_set_message(t("file upload failed: incomplete upload."), 'error');
return 0;
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
drupal_set_message(t("file upload failed: file size too big."), 'error');
default: // Unknown error
drupal_set_message(t("file upload failed: unkown error."), 'error');
return 0;
}
......@@ -294,7 +307,7 @@ function file_transfer($source, $headers) {
// Transfer file in 1024 byte chunks to save memory usage.
$fd = fopen($source, 'rb');
while (!feof($fd)) {
print fgets($fd);
print fgets($fd, 1024);
}
fclose($fd);
exit();
......
......@@ -140,11 +140,11 @@ function menu_execute_active_handler() {
if ($_list[$path]["callback"]) {
$arg = substr($_GET["q"], strlen($path) + 1);
if (empty($arg)) {
return call_user_func($_list[$path]["callback"]);
if (isset($arg)) {
return call_user_func_array($_list[$path]["callback"], explode("/", $arg));
}
else {
return call_user_func_array($_list[$path]["callback"], explode("/", $arg));
return call_user_func($_list[$path]["callback"]);
}
}
}
......@@ -170,6 +170,23 @@ function menu_in_active_trail($path) {
return in_array($path, $trail);
}
/**
* Returns true when the menu has visisble children.
*/
function menu_has_visible_children($item) {
global $_list;
if ($_list[$item]['children']) {
foreach ($_list[$item]['children'] as $child) {
if ($_list[$child]['hidden'] == MENU_SHOW) {
return true;
}
}
}
return false;
}
/**
* Returns a rendered menu tree.
*/
......@@ -191,8 +208,11 @@ function menu_tree($parent = "", $hidden = 0) {
** nor children. The latter check avoids that useless links are being
** rendered.
*/
if (($_list[$item]["hidden"] == MENU_SHOW && ($_list[$item]["callback"] || $_list[$item]["children"])) || ($_list[$item]["hidden"] == MENU_HIDE_NOCHILD && $_list[$item]["children"])) {
$style = ($_list[$item]["children"] ? (menu_in_active_trail($item) ? "expanded" : "collapsed") : "leaf");
$visible = menu_has_visible_children($item);
if (($_list[$item]["hidden"] == MENU_SHOW && $_list[$item]["callback"]) ||
($_list[$item]["hidden"] == MENU_SHOW && $visible) ||
($_list[$item]["hidden"] == MENU_HIDE_NOCHILD && $visible)) {
$style = ($visible ? (menu_in_active_trail($item) ? "expanded" : "collapsed") : "leaf");
$output .= "<li class=\"$style\">";
$output .= _render_item($item);
if (menu_in_active_trail($item)) {
......
......@@ -51,7 +51,12 @@ function module_list($refresh = 0, $bootstrap = 0) {
if (!$list) {
$list = array("admin" => "admin", "filter" => "filter", "system" => "system", "user" => "user", "watchdog" => "watchdog");
$result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = '1' ORDER BY name");
if ($bootstrap) {
$result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1 AND bootstrap = 1");
}
else {
$result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1");
}
while ($module = db_fetch_object($result)) {
if (file_exists($module->filename)) {
/*
......@@ -59,17 +64,14 @@ function module_list($refresh = 0, $bootstrap = 0) {
** loaded based on server load. We have to directly access the
** throttle variables as the throttle.module may not be loaded yet.
*/
$throttle = (variable_get("throttle_enable", 0) && $module->throttle && (variable_get("throttle_level", 0) >= 5));
if ($bootstrap && !$throttle) {
$list[$module->name] = array("name"=> $module->name, "bootstrap" => $module->bootstrap, "filename" => $module->filename);
}
else if (!$throttle) {
$throttle = ($module->throttle && variable_get("throttle_level", 0) > 4);
if (!$throttle) {
$list[$module->name] = $module->name;
include_once $module->filename;
}
}
}
natcasesort($list);
asort($list);
}
return $list;
}
......
......@@ -106,7 +106,7 @@ function pager_first($text, $limit, $element = 0, $attributes = array()) {
global $pager_from_array;
if ($pager_from_array[$element]) {
return "<a href=\"". pager_link(pager_load_array(0, $element, $pager_from_array), $attributes) ."\">$text</a>";
return "<a href=\"". pager_link(pager_load_array(0, $element, $pager_from_array), $element, $attributes) ."\">$text</a>";
}
else {
// we are already at the first page, return nothing
......@@ -132,7 +132,7 @@ function pager_previous($text, $limit, $element = 0, $n = 1, $attributes = array
if ($from_new[$element] < 1) {
return pager_first($text, $limit, $element, $attributes);
}
return "<a href=\"". pager_link($from_new, $attributes) ."\">$text</a>";
return "<a href=\"". pager_link($from_new, $element, $attributes) ."\">$text</a>";
}
/**
......@@ -151,7 +151,7 @@ function pager_next($text, $limit, $element = 0, $n = 1, $attributes = array())
global $pager_from_array, $pager_total;
$from_new = pager_load_array(((int)$pager_from_array[$element] + ((int)$limit * (int)$n)), $element, $pager_from_array);
if ($from_new[$element] < $pager_total[$element]) {
return "<a href=\"". pager_link($from_new, $attributes) ."\">$text</a>";
return "<a href=\"". pager_link($from_new, $element, $attributes) ."\">$text</a>";
}
return " ";
}
......@@ -170,12 +170,12 @@ function pager_next($text, $limit, $element = 0, $n = 1, $attributes = array())
function pager_last($text, $limit, $element = 0, $attributes = array()) {
global $pager_from_array, $pager_total;
$from_new = pager_load_array(($pager_total[$element] - $limit), $element, $pager_from_array);
$from_new = pager_load_array(($pager_total[$element] - ($pager_total[$element] % $limit)), $element, $pager_from_array);
if ($from_new[$element] < ($pager_from_array[$element] + $limit)) {
return pager_next($text, $limit, $element, 1, $attributes);
}
if (($from_new[$element] > $pager_from_array[$element]) && ($from_new[$element] > 0) && $from_new[$element] < $pager_total[$element]) {
return "<a href=\"". pager_link($from_new, $attributes) ."\">$text</a>";
return "<a href=\"". pager_link($from_new, $element, $attributes) ."\">$text</a>";
}
return " ";
}
......@@ -281,18 +281,20 @@ function pager_list($limit, $element = 0, $quantity = 5, $text = "", $attributes
}
/* @} End of member group pager pieces */
function pager_link($from_new, $attributes = array()) {
function pager_link($from_new, $element, $attributes = array()) {
$q = $_GET["q"];
$from = $_GET["from"];
foreach($attributes as $key => $value) {
$query[] = "$key=$value";
}
$from_new = pager_load_array($from_new[$element], $element, explode("," ,$from));
if (count($attributes)) {
$url = url($q, "from=". $from_new[0] ."&amp;". implode("&amp;", $query));
$url = url($q, "from=". implode($from_new, ",") ."&amp;". implode("&amp;", $query));
}
else {
$url = url($q, "from=". $from_new[0]);
$url = url($q, "from=". implode($from_new, ","));
}
return $url;
......
......@@ -17,7 +17,7 @@ function sess_close() {
function sess_read($key) {
global $user;
$result = db_query_range("SELECT u.*, s.*, r.name AS role FROM {users} u INNER JOIN {role} r ON u.rid = r.rid INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = '%s' AND u.status < 3", $key, 0, 1);
$result = db_query_range("SELECT u.*, s.*, r.name AS role FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid LEFT JOIN {role} r ON u.rid = r.rid WHERE s.sid = '%s' AND u.status < 3", $key, 0, 1);
if (!db_num_rows($result)) {
$result = db_query("SELECT u.*, r.name AS role FROM {users} u INNER JOIN {role} r ON u.rid = r.rid WHERE u.uid = 0");
......
......@@ -5,10 +5,10 @@ function tablesort_init($header) {
static $ts;
if (empty($ts)) {
$ts["order"] = tablesort_get_order($header);
$ts["order_sql"] = tablesort_get_order_sql($header, $ts["order"]);
$ts["sort"] = tablesort_get_sort($header);
$ts["query_string"] = tablesort_get_querystring();
$ts['order'] = tablesort_get_order($header);
$ts['order_sql'] = tablesort_get_order_sql($header, $ts['order']);
$ts['sort'] = tablesort_get_sort($header);
$ts['query_string'] = tablesort_get_querystring();
}
return $ts;
......@@ -16,39 +16,43 @@ function tablesort_init($header) {
function tablesort_pager() {
$cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
unset($cgi["q"], $cgi["from"]);
unset($cgi['q'], $cgi["from"]);
return $cgi;
}
function tablesort_sql($header) {
$ts = tablesort_init($header);
return " ORDER BY ". $ts["order_sql"]. " ". strtoupper($ts["sort"]);
return " ORDER BY ". $ts['order_sql']. " ". strtoupper($ts['sort']);
}
function tablesort($cell, $header) {
$ts = tablesort_init($header);
$title = t("sort by %s", array("%s" => $cell["data"]));
$title = t("sort by %s", array("%s" => $cell['data']));
// special formatting for the currently sorted column header
if ($cell["data"] == $ts["order"]) {
$cell["class"] = "cell-highlight";
$image = "&nbsp;<img border=\"0\" src=\"". theme("image", "arrow-". $ts["sort"]. ".gif"). "\"></img>";
$dir = array("asc" => "ascending", "desc" => "descending");
$title = t("sort ". $dir[$ts["sort"]]);
if ($cell['data'] == $ts['order']) {
$ts['sort'] = (($ts['sort'] == 'asc') ? 'desc' : 'asc');
$cell['class'] = 'cell-highlight';
$image = '&nbsp;<img src="' . theme('image', 'arrow-' . $ts['sort'] . '.gif') . '" alt="'. t('sort icon') .'" />';
$title = ($ts['sort'] == 'asc' ? t("sort ascending") : t("sort descending"));
} else {
// If the user clicks a different header, we want to sort ascending initially.
$ts["sort"] = "asc";
$ts['sort'] = "asc";
}
$cell["data"] = l($cell["data"] . $image, $_GET["q"], array("title" => $title), "sort=". $ts["sort"]. "&order=". urlencode($cell["data"]). $ts["query_string"]);
$cell['data'] = l($cell['data'] . $image, $_GET['q'], array("title" => $title), "sort=". $ts['sort']. "&amp;order=". urlencode($cell['data']). $ts['query_string']);
unset($cell['field']);
unset($cell['sort']);
return $cell;
}
function tablesort_get_querystring() {
$cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
foreach ($cgi as $key => $val) {
if ($key != "order" && $key != "sort" && $key != "q") {
$query_string .= "&" . $key . "=" . $val;
if ($key != 'order' && $key != 'sort' && $key != 'q') {
$query_string .= "&amp;". $key ."=". $val;
}
}
return $query_string;
......@@ -78,21 +82,21 @@ function tablesort_get_order($headers) {
function tablesort_get_order_sql($header, $order) {
foreach ($header as $cell) {
if ($cell["data"] == $order) {
return $cell["field"];
if ($cell['data'] == $order) {
return $cell['field'];
}
}
}
function tablesort_get_sort($headers) {
if ($_GET['sort']) {
return ($_GET['sort'] == 'desc') ? 'asc' : 'desc';
return ($_GET['sort'] == 'desc') ? 'desc' : 'asc';
}
// user has not specified a sort. check module for default and if none, use 'asc'
else {
foreach ($headers as $header) {
if (isset($header["sort"])) {
return $header["sort"];
if (is_array($header) && isset($header['sort'])) {
return $header['sort'];
}
}
}
......
......@@ -21,7 +21,7 @@
* @return a string containing the help output.
*/
function theme_help($section) {
$output = "";
$output = '';
switch ($section) {
case 'admin/system/themes#description':
......@@ -96,7 +96,7 @@ function theme() {
$args = func_get_args();
$function = array_shift($args);
if (($theme != "") && (function_exists($theme ."_". $function))) {
if (($theme != '') && (function_exists($theme ."_". $function))) {
return call_user_func_array($theme ."_". $function, $args);
}
elseif (function_exists("theme_". $function)){
......@@ -128,19 +128,29 @@ function path_to_theme() {
*/
/**
* Returns the theme header.
* Returns an entire Drupal page displaying the supplied content.
*
* @param $content a string containing the content to display
* @param $title (optional) page title (\<head>\<title>)
* @param $breadcrumb (optional) page breadcrumb
*
* @see drupal_breadcrumb
*
* @return a string containing the @a header output.
* @return a string containing the @a page output.
*/
function theme_header() {
function theme_page($content, $title = NULL, $breadcrumb = NULL) {
if (isset($title)) {
drupal_set_title($title);
}
if (isset($breadcrumb)) {
drupal_set_breadcrumb($breadcrumb);
}
$output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
$output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
$output .= "<head>";
$output .= " <title>". (drupal_get_title() ? drupal_get_title() : variable_get('site_name', "drupal")) ."</title>";
$output .= drupal_get_html_head();
$output .= " <style type=\"text/css\" media=\"all\">";
$output .= " @import url(misc/drupal.css);";
$output .= " </style>";
$output .= " </head>";
$output .= " <body style=\"background-color: #fff; color: #000;\"". theme("onload_attribute"). "\">";
......@@ -156,31 +166,13 @@ function theme_header() {
$output .= "<small>$help</small><hr />";
}
return $output;
}
/**
* Returns an entire Drupal page displaying the supplied content.
*
* @param $content a string containing the content to display
* @param $title (optional) page title (\<head>\<title>)
* @param $breadcrumb (optional) page breadcrumb
*
* @see drupal_breadcrumb
*
* @return a string containing the @a page output.
*/
function theme_page($content, $title = NULL, $breadcrumb = NULL) {
if (isset($title)) {
drupal_set_title($title);
}
if (isset($breadcrumb)) {
drupal_set_breadcrumb($breadcrumb);
}
$output = theme("header");
$output .= "\n<!-- begin content -->\n";
$output .= $content;
$output .= theme("footer");
$output .= "\n<!-- end content -->\n";
$output .= "</td></tr></table>";
$output .= theme_closure();
$output .= "</body></html>";
return $output;
}
......@@ -216,7 +208,7 @@ function theme_image($name) {
* @return a string containing the @a breadcrumb output.
*/
function theme_breadcrumb($breadcrumb) {
return "<div class=\"breadcrumb\">". implode($breadcrumb, " &raquo; ") ."</div>";
return "<div class=\"breadcrumb\">". implode($breadcrumb, ' &raquo; ') ."</div>";
}
/**
......@@ -253,7 +245,7 @@ function theme_node($node, $main = 0, $page = 0) {
}
if (count($terms)) {
$output .= " <small>(". theme("links", $terms) .")</small><br />";
$output .= " <small>(". theme('links', $terms) .")</small><br />";
}
if ($main && $node->teaser) {
......@@ -264,7 +256,7 @@ function theme_node($node, $main = 0, $page = 0) {
}
if ($links = link_node($node, $main)) {
$output .= "<div class=\"links\">". theme("links", $links) ."</div>";
$output .= "<div class=\"links\">". theme('links', $links) ."</div>";
}
return $output;
......@@ -278,7 +270,7 @@ function theme_node($node, $main = 0, $page = 0) {
* @param $description the form element's description or explanation
* @param $id the form element's ID used by the &lt;label&gt; tag
*
* @return a string containing the @a node output.
* @return a string representing the form element
*/
function theme_form_element($title, $value, $description = NULL, $id = NULL) {
......@@ -293,7 +285,7 @@ function theme_form_element($title, $value, $description = NULL, $id = NULL) {
}
else {
if ($id) {
$title = "<label for=\"$id\" />";
$title = "<label for=\"$id\"></label>";
// TODO: does this make sense to do?
}
}
......@@ -308,15 +300,16 @@ function theme_form_element($title, $value, $description = NULL, $id = NULL) {
/**
* Returns themed table.
*
* @param $header
* @param $rows
* @param $header array of table header strings
* @param $rows array of arrays containing the table cells
* @param $attributes attribute array for the table tag
*
* @return a string containing the @a node output.
* @return a string representing the table.
*/
function theme_table($header, $rows) {
function theme_table($header, $rows, $attributes = NULL) {
$output = "<table>\n";
$output = "<table ". drupal_attributes($attributes) .">\n";
/*
** Emit the table header:
......@@ -325,7 +318,7 @@ function theme_table($header, $rows) {
if (is_array($header)) {
$output .= " <tr>";
foreach ($header as $cell) {
if (is_array($cell) && $cell["field"]) {
if (is_array($cell) && $cell['field']) {
$cell = tablesort($cell, $header);
}
$output .= _theme_table_cell($cell, 1);
......@@ -367,8 +360,8 @@ function theme_table($header, $rows) {
*
* @return a string containing the @a box output.
*/
function theme_box($title, $content, $region = "main") {
$output = "<h2 class=\"title\">$title</h2><p>$content</p>";
function theme_box($title, $content, $region = 'main') {
$output = "<h2 class=\"title\">$title</h2><div>$content</div>";
return $output;
}
......@@ -394,18 +387,6 @@ function theme_block($block) {
return $output;
}
/**
* Returns themed page footer.
*
* @return a string containing the @a footer output.
*/
function theme_footer() {
$output = "</td></tr></table>";
$output .= theme_closure();
$output .= "</body></html>";
return $output;
}
/**
* Returns themed marker, useful for marking new comments or required form
* elements.
......@@ -413,7 +394,7 @@ function theme_footer() {
* @return a string containing the @a mark output.
*/
function theme_mark() {
return "<span class=\"marker\">*</span>";
return '<span class="marker">*</span>';
}
/**
......@@ -470,7 +451,7 @@ function theme_xml_icon($url) {
* @return a string containing the @a closure output.
*/
function theme_closure($main = 0) {
$footer = module_invoke_all("footer", $main);
$footer = module_invoke_all('footer', $main);
return implode($footer, "\n");
}
......@@ -492,7 +473,7 @@ function theme_onload_attribute($theme_onloads = array()) {
if (count($onloads)) {
return " onload=\"" . implode("; ", $onloads) . "\"";
}
return "";
return '';
}
/**
......@@ -503,7 +484,7 @@ function theme_onload_attribute($theme_onloads = array()) {
* @return a string containing the @a blocks output.
*/
function theme_blocks($region) {
$output = "";
$output = '';
if ($list = module_invoke('block', 'list', $region)) {
foreach ($list as $key => $block) {
......@@ -513,13 +494,13 @@ function theme_blocks($region) {
}
return $output;
}
/* @} End of defgroup themeable */
/* @} */
function _theme_table_cell($cell, $header = 0) {
if (is_array($cell)) {
$data = $cell["data"];
$data = $cell['data'];
foreach ($cell as $key => $value) {
if ($key != "data") {
if ($key != 'data') {
$attributes .= " $key=\"$value\"";
}
}
......
......@@ -19,14 +19,20 @@ img {
li.expanded {
list-style-type: circle;
list-style-image: url(menu-expanded.gif);
padding: 0.2em 0.5em 0 0;
margin: 0;
}
li.collapsed {
list-style-type: disc;
list-style-image: url(menu-collapsed.gif);
padding: 0.2em 0.5em 0 0;
margin: 0;
}
li.leaf {
list-style-type: square;
list-style-image: url(menu-leaf.gif);
padding: 0.2em 0.5em 0 0;
margin: 0;
}
li a.active {
color: #000;
......@@ -78,8 +84,9 @@ li a.active {
}
.book .nav {
border-top: 1px solid #888;
padding-bottom: 2em;
border-bottom: 1px solid #888;
padding-bottom: 3em;
padding-top: 1em;
clear: both;
}
.book .nav .links {
......@@ -92,13 +99,11 @@ li a.active {
float: left;
text-align: left;
width: 45%;
padding-bottom: 0.5em;
}
.book .nav .next {
float: right;
text-align: right;
width: 45%;
padding-bottom: 0.5em;
}
.book .nav .up {
text-align: center;
......@@ -145,6 +150,9 @@ li a.active {
.form-item label {
font-weight: bold;
}
.form-item label.option {
font-weight: normal;
}
.form-submit {
margin: 0.5em 0;
}
......@@ -204,18 +212,13 @@ li a.active {
.poll .bar {
height: 1em;
margin: 1px 0;
}
.poll .bar .background {
background-color: #ddd;
float: left;
height: 1em;
margin-left: -1px;
}
.poll .bar .foreground {
background-color: #000;
float: left;
height: 1em;
margin-right: -1px;
clear: left;
float: left;
}
.poll .links {
text-align: center;
......@@ -234,6 +237,9 @@ li a.active {
margin: 0 auto;
display: table;
}
.node-form .poll-form fieldset {
display: block;
}
.more-link {
text-align: right;
}
......@@ -298,12 +304,7 @@ pre, code {
border: none;
text-align:left;
}
.menu li {
margin: 0;
padding: 0.2em 0.5em 0 0;
}
.menu li a {
display: block;
width: 100%;
text-decoration: none;
}
......