Preparing to use a separate 6.x drupal
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 6 Jan 2009 12:32:53 +0000 (12:32 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 6 Jan 2009 12:32:53 +0000 (12:32 +0000)
* taking out everything that originally belonged to drupal
* the new module temporarily moved in drupal.module
* httpd config renamed as planetlab.conf

171 files changed:
CHANGELOG.txt [deleted file]
INSTALL.mysql.txt [deleted file]
INSTALL.pgsql.txt [deleted file]
INSTALL.txt [deleted file]
LICENSE.txt [deleted file]
MAINTAINERS.txt [deleted file]
PLCWWW.spec
UPGRADE.txt [deleted file]
cron.php [deleted file]
database/database.4.0.mysql [deleted file]
database/database.4.1.mysql [deleted file]
database/database.pgsql [deleted file]
database/updates.inc [deleted file]
drupal.module/planetlab.info [new file with mode: 0644]
drupal.module/planetlab.module [moved from modules/planetlab.module with 100% similarity]
includes/bootstrap.inc [deleted file]
includes/common.inc [deleted file]
includes/database.inc [deleted file]
includes/database.mysql.inc [deleted file]
includes/database.mysqli.inc [deleted file]
includes/database.pgsql.inc [deleted file]
includes/file.inc [deleted file]
includes/form.inc [deleted file]
includes/image.inc [deleted file]
includes/install.inc [deleted file]
includes/locale.inc [deleted file]
includes/menu.inc [deleted file]
includes/module.inc [deleted file]
includes/pager.inc [deleted file]
includes/path.inc [deleted file]
includes/session.inc [deleted file]
includes/tablesort.inc [deleted file]
includes/theme.inc [deleted file]
includes/unicode.inc [deleted file]
includes/xmlrpc.inc [deleted file]
includes/xmlrpcs.inc [deleted file]
index.php [deleted file]
modules/aggregator.module [deleted file]
modules/archive.module [deleted file]
modules/block.module [deleted file]
modules/blog.module [deleted file]
modules/blogapi.module [deleted file]
modules/book.module [deleted file]
modules/comment.module [deleted file]
modules/contact.module [deleted file]
modules/drupal.module [deleted file]
modules/filter.module [deleted file]
modules/forum.module [deleted file]
modules/help.module [deleted file]
modules/legacy.module [deleted file]
modules/locale.module [deleted file]
modules/menu.module [deleted file]
modules/node.module [deleted file]
modules/page.module [deleted file]
modules/path.module [deleted file]
modules/ping.module [deleted file]
modules/poll.module [deleted file]
modules/profile.module [deleted file]
modules/search.module [deleted file]
modules/statistics.module [deleted file]
modules/story.module [deleted file]
modules/system.module [deleted file]
modules/taxonomy.module [deleted file]
modules/taxonomy_block/LICENSE.txt [deleted file]
modules/taxonomy_block/README.txt [deleted file]
modules/taxonomy_block/taxonomy_block.install [deleted file]
modules/taxonomy_block/taxonomy_block.module [deleted file]
modules/throttle.module [deleted file]
modules/tracker.module [deleted file]
modules/upload.module [deleted file]
modules/user.module [deleted file]
modules/watchdog.module [deleted file]
planetlab.conf [moved from drupal.conf with 100% similarity]
plot-latlong/.mapimages/Africa.png [deleted file]
plot-latlong/.mapimages/Australia.png [deleted file]
plot-latlong/.mapimages/Belgium.png [deleted file]
plot-latlong/.mapimages/Canada.png [deleted file]
plot-latlong/.mapimages/Caribbean.png [deleted file]
plot-latlong/.mapimages/CentralAmerica.png [deleted file]
plot-latlong/.mapimages/China.png [deleted file]
plot-latlong/.mapimages/Europe.png [deleted file]
plot-latlong/.mapimages/France.png [deleted file]
plot-latlong/.mapimages/Germany.png [deleted file]
plot-latlong/.mapimages/Hawaii.png [deleted file]
plot-latlong/.mapimages/India.png [deleted file]
plot-latlong/.mapimages/Italy.png [deleted file]
plot-latlong/.mapimages/Japan.png [deleted file]
plot-latlong/.mapimages/Korea.png [deleted file]
plot-latlong/.mapimages/MalaysiaIndonesia.png [deleted file]
plot-latlong/.mapimages/MiddleEast.png [deleted file]
plot-latlong/.mapimages/NOSEFI.png [deleted file]
plot-latlong/.mapimages/Netherlands.png [deleted file]
plot-latlong/.mapimages/NewZealand.png [deleted file]
plot-latlong/.mapimages/Philippines.png [deleted file]
plot-latlong/.mapimages/SouthAmerica.png [deleted file]
plot-latlong/.mapimages/UK.png [deleted file]
plot-latlong/.mapimages/USA100.png [deleted file]
plot-latlong/.mapimages/USA200.png [deleted file]
plot-latlong/.mapimages/USA50-new.png [deleted file]
plot-latlong/.mapimages/World100.png [deleted file]
plot-latlong/.mapimages/World50-new.png [deleted file]
plot-latlong/.mapinfo [deleted file]
plot-latlong/CONFIG [deleted file]
plot-latlong/README [deleted file]
plot-latlong/plot-latlong [deleted file]
scripts/code-clean.sh [deleted file]
scripts/code-style.pl [deleted file]
scripts/cron-curl.sh [deleted file]
scripts/cron-lynx.sh [deleted file]
scripts/prefix.sh [deleted file]
sites/default/settings.php [deleted file]
themes/bluemarine/block.tpl.php [deleted file]
themes/bluemarine/box.tpl.php [deleted file]
themes/bluemarine/comment.tpl.php [deleted file]
themes/bluemarine/logo.png [deleted file]
themes/bluemarine/node.tpl.php [deleted file]
themes/bluemarine/page.tpl.php [deleted file]
themes/bluemarine/screenshot.png [deleted file]
themes/bluemarine/style.css [deleted file]
themes/chameleon/background.png [deleted file]
themes/chameleon/chameleon.theme [deleted file]
themes/chameleon/common.css [deleted file]
themes/chameleon/logo.png [deleted file]
themes/chameleon/marvin/bullet.png [deleted file]
themes/chameleon/marvin/druplicon-watermark.png [deleted file]
themes/chameleon/marvin/logo.png [deleted file]
themes/chameleon/marvin/screenshot.png [deleted file]
themes/chameleon/marvin/style.css [deleted file]
themes/chameleon/screenshot.png [deleted file]
themes/chameleon/style.css [deleted file]
themes/engines/phptemplate/block.tpl.php [deleted file]
themes/engines/phptemplate/box.tpl.php [deleted file]
themes/engines/phptemplate/comment.tpl.php [deleted file]
themes/engines/phptemplate/default.tpl.php [deleted file]
themes/engines/phptemplate/node.tpl.php [deleted file]
themes/engines/phptemplate/phptemplate.engine [deleted file]
themes/pushbutton/arrow-next-hover.png [deleted file]
themes/pushbutton/arrow-next-visited.png [deleted file]
themes/pushbutton/arrow-next.png [deleted file]
themes/pushbutton/arrow-prev-hover.png [deleted file]
themes/pushbutton/arrow-prev-visited.png [deleted file]
themes/pushbutton/arrow-prev.png [deleted file]
themes/pushbutton/arrow-up-hover.png [deleted file]
themes/pushbutton/arrow-up-visited.png [deleted file]
themes/pushbutton/arrow-up.png [deleted file]
themes/pushbutton/background.png [deleted file]
themes/pushbutton/block.tpl.php [deleted file]
themes/pushbutton/box.tpl.php [deleted file]
themes/pushbutton/comment.tpl.php [deleted file]
themes/pushbutton/forum-container.jpg [deleted file]
themes/pushbutton/forum-link.png [deleted file]
themes/pushbutton/header-a.jpg [deleted file]
themes/pushbutton/header-b.jpg [deleted file]
themes/pushbutton/header-c.png [deleted file]
themes/pushbutton/icon-block.png [deleted file]
themes/pushbutton/icon-comment.png [deleted file]
themes/pushbutton/logo-active.jpg [deleted file]
themes/pushbutton/logo-background.jpg [deleted file]
themes/pushbutton/logo-hover.jpg [deleted file]
themes/pushbutton/logo.png [deleted file]
themes/pushbutton/node.tpl.php [deleted file]
themes/pushbutton/page.tpl.php [deleted file]
themes/pushbutton/screenshot.png [deleted file]
themes/pushbutton/style.css [deleted file]
themes/pushbutton/tabs-off.png [deleted file]
themes/pushbutton/tabs-on.png [deleted file]
themes/pushbutton/tabs-option-hover.png [deleted file]
themes/pushbutton/tabs-option-off.png [deleted file]
themes/pushbutton/tabs-option-on.png [deleted file]
update.php [deleted file]
xmlrpc.php [deleted file]

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
deleted file mode 100644 (file)
index decbbf2..0000000
+++ /dev/null
@@ -1,542 +0,0 @@
-// $Id: CHANGELOG.txt 144 2007-03-28 07:52:20Z thierry $
-
-Drupal 4.7.3, 2006-08-02
-------------------------
-- fixed security issue (XSS), see SA-2006-011
-
-Drupal 4.7.2, 2006-06-01
-------------------------
-- fixed critical upload issue, see SA-2006-007
-- fixed taxonomy XSS issue, see SA-2006-008
-- fixed a variety of small bugs.
-
-Drupal 4.7.1, 2006-05-24
-------------------------
-- fixed critical SQL issue, see SA-2006-005
-- fixed a serious upgrade related bug.
-- fixed a variety of small bugs.
-
-Drupal 4.7.0, 2006-05-01
-------------------------
-- added free tagging support.
-- added a site-wide contact form.
-- theme system:
-    * added the PHPTemplate theme engine and removed the Xtemplate engine.
-    * converted the bluemarine theme from XTemplate to PHPTemplate.
-    * converted the pushbutton theme from XTemplate to PHPTemplate.
-- usability:
-    * reworked the 'request new password' functionality.
-    * reworked the node and comment edit forms.
-    * made it easy to add nodes to the navigation menu.
-    * added site 'offline for maintenance' feature.
-    * added support for auto-complete forms (AJAX).
-    * added support for collapsible page sections (JS).
-    * added support for resizable text fields (JS).
-    * improved file upload functionality (AJAX).
-    * reorganized some settings pages.
-    * added friendly database error screens.
-    * improved styling of update.php.
-- refactored the forms API.
-    * made it possible to alter, extend or theme forms.
-- comment system:
-    * added support for "mass comment operations" to ease repetitive tasks.
-    * comment moderation has been removed.
-- node system:
-    * reworked the revision functionality.
-    * removed the bookmarklet code. Third-party modules can now handle
-      this.
-- upgrade system:
-    * allows contributed modules to plug into the upgrade system.
-- profiles:
-    * added a block to display author information along with posts.
-    * added support for private profile fields.
-- statistics module:
-    * added the ability to track page generation times.
-    * made it possible to block certain IPs/hostnames.
-- block system:
-    * added support for theme-specific block regions.
-- syndication:
-    * made the aggregator module parse Atom feeds.
-    * made the aggregator generate RSS feeds.
-    * added RSS feed settings.
-- XML-RPC:
-    * replaced the XML-RPC library by a better one.
-- performance:
-    * added 'loose caching' option for high-traffic sites.
-    * improved performance of path aliasing.
-    * added the ability to track page generation times.
-- internationalization:
-    * improved Unicode string handling API.
-    * added support for PHP's multibyte string module.
-- added support for PHP5's 'mysqli' extension.
-- search module:
-    * made indexer smarter and more robust.
-    * added advanced search operators (e.g. phrase, node type, ...).
-    * added customizable result ranking.
-- PostgreSQL support:
-    * removed dependency on PL/pgSQL procedural language.
-- menu system:
-    * added support for external URLs.
-- queue module:
-    * removed from core.
-- HTTP handling:
-    * added support for a tolerant Base URL.
-    * output URIs relative to the root, without a base tag.
-
-Drupal 4.6.6, 2006-03-13
-------------------------
-- fixed bugs, including 4 security vulnerabilities.
-
-Drupal 4.6.5, 2005-12-12
-------------------------
-- fixed bugs: no critical bugs were identified.
-
-Drupal 4.6.4, 2005-11-30
-------------------------
-- fixed bugs, including 3 security vulnerabilities.
-
-Drupal 4.6.3, 2005-08-15
-------------------------
-- fixed bugs, including a critical "arbitrary PHP code execution" bug.
-
-Drupal 4.6.2, 2005-06-29
-------------------------
-- fixed bugs, including two critical "arbitrary PHP code execution" bugs.
-
-Drupal 4.6.1, 2005-06-01
-------------------------
-- fixed bugs, including a critical input validation bug.
-
-Drupal 4.6.0, 2005-04-15
-------------------------
-- PHP5 compliance
-- search:
-    * added UTF-8 support to make it work with all languages.
-    * improved search indexing algorithm.
-    * improved search output.
-    * impose a throttle on indexing of large sites.
-    * added search block.
-- syndication:
-    * made the ping module ping pingomatic.com which, in turn, will ping all the major ping services.
-    * made Drupal generate RSS 2.0 feeds.
-    * made RSS feeds extensible.
-    * added categories to RSS feeds.
-    * added enclosures to RSS feeds.
-- flood control mechanism:
-    * added a mechanism to throttle certain operations.
-- usability:
-    * refactored the block configuration pages.
-    * refactored the statistics pages.
-    * refactored the watchdog pages.
-    * refactored the throttle module configuration.
-    * refactored the access rules page.
-    * refactored the content administration page.
-    * introduced forum configuration pages.
-    * added a 'add child page' link to book pages.
-- contact module:
-    * added a simple contact module that allows users to contact each other using e-mail.
-- multi-site configuration:
-    * made it possible to run multiple sites from a single code base.
-- added an image API: enables better image handling.
-- block system:
-    * extended the block visibility settings.
-- theme system:
-    * added new theme functions.
-- database backend:
-    * the PEAR database backend is no longer supported.
-- performance:
-    * improved performance of the forum topics block.
-    * improved performance of the tracker module.
-    * improved performance of the node pages.
-- documentation:
-    * improved and extended PHPDoc/Doxygen comments.
-
-Drupal 4.5.8, 2006-03-13
-------------------------
-- fixed bugs, including 3 security vulnerabilities.
-
-Drupal 4.5.7, 2005-12-12
-------------------------
-- fixed bugs: no critical bugs were identified.
-
-Drupal 4.5.6, 2005-11-30
-------------------------
-- fixed bugs, including 3 security vulnerabilities.
-
-Drupal 4.5.5, 2005-08-15
-------------------------
-- fixed bugs, including a critical "arbitrary PHP code execution" bug.
-
-Drupal 4.5.4, 2005-06-29
-------------------------
-- fixed bugs, including two critical "arbitrary PHP code execution" bugs.
-
-Drupal 4.5.3, 2005-06-01
-------------------------
-- fixed bugs, including a critical input validation bug.
-
-Drupal 4.5.2, 2005-01-15
-------------------------
-- fixed bugs: a cross-site scripting (XSS) vulnerability has been fixed.
-
-Drupal 4.5.1, 2004-12-01
-------------------------
-- fixed bugs: no critical bugs were identified.
-
-Drupal 4.5.0, 2004-10-18
-------------------------
-- navigation:
-    * made it possible to add, delete, rename and move menu items.
-    * introduced tabs and subtabs for local tasks.
-    * reorganized the navigation menus.
-- user management:
-    * added support for multiple roles per user.
-    * made it possible to add custom profile fields.
-    * made it possible to browse user profiles by field.
-- node system:
-    * added support for node-level permissions.
-- comment module:
-    * made it possible to leave contact information without having to register.
-- upload module:
-    * added support for uploading documents (includes images).
-- forum module:
-    * added support for sticky forum topics.
-    * made it possible to track forum topics.
-- syndication:
-    * added support for RSS ping-notifications of http://technorati.com/.
-    * refactored the categorization of syndicated news items.
-    * added an URL alias for 'rss.xml'.
-    * improved date parsing.
-- database backend:
-    * added support for multiple database connections.
-    * the PostgreSQL backend does no longer require PEAR.
-- theme system:
-    * changed all GIFs to PNGs.
-    * reorganised the handling of themes, template engines, templates and styles.
-    * unified and extended the available theme settings.
-    * added theme screenshots.
-- blocks:
-    * added 'recent comments' block.
-    * added 'categories' block.
-- blogger API:
-    * added support for auto-discovery of blogger API via RSD.
-- performance:
-    * added support for sending gzip compressed pages.
-    * improved performance of the forum module.
-- accessibility:
-    * improved the accessibility of the archive module's calendar.
-    * improved form handling and error reporting.
-    * added HTTP redirects to prevent submitting twice when refreshing right after a form submission.
-- refactored 403 (forbidden) handling and added support for custom 403 pages.
-- documentation:
-    * added PHPDoc/Doxygen comments.
-- filter system:
-    * added support for using multiple input formats on the site
-    * expanded the embedded PHP-code feature so it can be used everywhere
-    * added support for role-dependant filtering, through input formats
-- UI translation:
-    * managing translations is now completely done through the administration interface
-    * added support for importing/exporting gettext .po files
-
-Drupal 4.4.3, 2005-06-01
-------------------------
-- fixed bugs, including a critical input validation bug.
-
-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.
-- added a file API: enables better document management.
-- improved the watchdog and search module to log search keys.
-- news aggregator:
-    * added support for conditional GET.
-    * added OPML feed subscription list.
-    * added support for <image>, <pubDate>, <dc:date>, <dcterms:created>, <dcterms:issued> and <dcterms:modified>.
-- comment module:
-    * made it possible to disable the "comment viewing controls".
-- performance:
-    * improved module loading when serving cached pages.
-    * made it possible to automatically disable modules when under heavy load.
-    * made it possible to automatically disable blocks when under heavy load.
-    * improved performance and memory footprint of the locale module.
-- theme system:
-    * made all theme functions start with 'theme_'.
-    * made all theme functions return their output.
-    * migrated away from using the BaseTheme class.
-    * added many new theme functions and refactored existing theme functions.
-    * 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.
-    * replaced drop-down menus by radio buttons where appropriate.
-    * removed the 'magic_quotes_gpc = 0' requirement.
-    * added a 'book navigation' block.
-- accessibility:
-    * made themes degrade gracefully in absence of CSS.
-    * grouped form elements using '<fieldset>' and '<legend>' tags.
-    * added '<label>' tags to form elements.
-- refactored 404 (file not found) handling and added support for custom 404 pages.
-- improved the filter system to prevent conflicts between filters:
-    * made it possible to change the order in which filters are applied.
-- documentation:
-    * added PHPDoc/Doxygen comments.
-
-Drupal 4.3.2, 2004-01-01
-------------------------
-- fixed bugs: no critical bugs were identified.
-
-Drupal 4.3.1, 2003-12-01
-------------------------
-- fixed bugs: no critical bugs were identified.
-
-Drupal 4.3.0, 2003-11-01
-------------------------
-- added support for configurable URLs.
-- added support for sortable table columns.
-- database backend:
-    * added support for selective database table prefixing.
-- performance:
-    * optimized many SQL queries for speed by converting left joins to inner joins.
-- comment module:
-    * rewrote the comment housekeeping code to be much more efficient and scalable.
-    * changed the comment module to use the standard pager.
-- user module:
-    * added support for multiple sessions per user.
-    * added support for anonymous user sessions.
-- forum module:
-    * improved the forum views and the themability thereof.
-- book module:
-    * improved integration of non-book nodes in the book outline.
-- usability:
-    * added support for "mass node operations" to ease repetitive tasks.
-    * added support for breadcrumb navigation to several modules' user pages.
-    * integrated the administration pages with the normal user pages.
-
-Drupal 4.2.0, 2003-08-01
-------------------------
-- added support for clean URLs.
-- added textarea hook and support for onload attributes: enables integration of WYSIWYG editors.
-- rewrote the RSS/RDF parser:
-    * it will now use PHP's built-in XML parser to parse news feeds.
-- rewrote the administration pages:
-    * improved the navigational elements and added breadcrumb navigation.
-    * improved the look and feel.
-    * added context-sensitive help.
-- database backend:
-    * fixed numerous SQL queries to make Drupal ANSI compliant.
-    * added MSSQL database scheme.
-- search module:
-    * changed the search module to use implicit AND'ing instead of implicit OR'ing.
-- node system:
-    * replaced the "post content" permission by more fine-grained permissions.
-    * improved content submission:
-        + improved teasers: teasers are now optional, teaser length can be configured, teaser and body are edited in a single textarea, users will no longer be bothered with teasers when the post is too short for one.
-        + added the ability to preview both the short and the full version of your posts.
-    * extended the node API which allows for better integration.
-    * added default node settings to control the behavior for promotion, moderation and other options.
-- themes:
-    * replaced theme "Goofy" by "Xtemplate", a template driven theme.
-- removed the 'register_globals = on' requirement.
-- added better installation instructions.
-
-Drupal 4.1.0, 2003-02-01
-------------------------
-- collaboratively revised and expanded the Drupal documentation.
-- rewrote comment.module:
-    * reintroduced comment rating/moderation.
-    * added support for comment paging.
-    * performance improvements: improved comment caching, faster SQL queries, etc.
-- rewrote block.module:
-    * performance improvements: blocks are no longer rendered when not displayed.
-- rewrote forum.module:
-    * added a lot of features one can find in stand-alone forum software including but not limited to support for topic paging, added support for icons, rewrote the statistics module, etc.
-- rewrote statistics.module:
-    * collects access counts for each node, referrer logs, number of users/guests.
-    * export blocks displaying top viewed nodes over last 24 hour period, top viewed nodes over all time, last nodes viewed, how many users/guest online.
-- added throttle.module:
-    * auto-throttle congestion control mechanism: Drupal can adapt itself based on the server load.
-- added profile.module:
-    * enables to extend the user and registration page.
-- added pager support to the main page.
-- replaced weblogs.module by ping.module:
-    * added support for normal and RSS notifications of http://blo.gs/.
-    * added support for RSS ping-notifications of http://weblogs.com/.
-- removed the rating module
-- themes:
-    * removed a significant portion of hard-coded mark-up.
-
-Drupal 4.0.0, 2002-06-15
-------------------------
-- added tracker.module:
-    * replaces the previous "your [site]" links (recent comments and nodes).
-- added weblogs.module:
-    * this will ping weblogs.com when new content is promoted.
-- added taxonomy module which replaces the meta module.
-    * supports relations, hierarchies and synonyms.
-- added a caching system:
-    * speeds up pages for anonymous users and reduces system load.
-- added support for external SMTP libraries.
-- added an archive extension to the calendar.
-- added support for the Blogger API.
-- themes:
-    * cleaned up the theme system.
-    * moved themes that are not maintained to contributions CVS repository.
-- database backend:
-    * changed to PEAR database abstraction layer.
-    * using ANSI SQL queries to be more portable.
-- rewrote the user system:
-    * added support for Drupal authentication through XML-RPC and through a Jabber server.
-    * added support for modules to add more user data.
-    * users may delete their own account.
-    * added who's new and who's online blocks.
-- changed block system:
-    * various hard coded blocks are now dynamic.
-    * blocks can now be enabled and/or be set by the user.
-    * blocks can be set to only show up on some pages.
-    * merged box module with block module.
-- node system:
-    * blogs can be updated.
-    * teasers (abstracts) on all node types.
-    * improved error checking.
-    * content versioning support.
-    * usability improvements.
-- improved book module to support text, HTML and PHP pages.
-- improved comment module to mark new comments.
-- added a general outliner which will let any node type be linked to a book.
-- added an update script that lets you upgrade from previous releases or on a day to day basis when using the development tree.
-- search module:
-    * improved the search system by making it context sensitive.
-    * added indexing.
-- various updates:
-    * changed output to valid XHTML.
-    * improved multiple sites using the same Drupal database support.
-    * added support for session IDs in URLs instead of cookies.
-    * made the type of content on the front page configurable.
-    * made each cloud site have its own settings.
-    * modules and themes can now be enabled/disabled using the administration pages.
-    * added URL abstraction for links.
-    * usability changes (renamed links, better UI, etc).
-- collaboratively revised and expanded the Drupal documentation.
-
-Drupal 3.0.1, 2001-10-15
-------------------------
-- various updates:
-    * added missing translations
-    * updated the themes: tidied up some HTML code and added new Drupal logos.
-
-Drupal 3.0.0, 2001-09-15
-------------------------
-- major overhaul of the entire underlying design:
-    * everything is based on nodes: nodes are a conceptual "black box" to couple and manage different types of content and that promotes reusing existing code, thus reducing the complexity and size of Drupal as well as improving long-term stability.
-- rewrote submission/moderation queue and renamed it to queue.module.
-- removed FAQ and documentation module and merged them into a "book module".
-- removed ban module and integrated it into account.module as "access control":
-    * access control is based on much more powerful regular expressions (regex) now rather than on MySQL pattern matching.
-- rewrote watchdog and submission throttle:
-    * improved watchdog messages and added watchdog filter.
-- rewrote headline code and renamed it to import.module and export.module:
-    * added various improvements, including a better parser, bundles and better control over individual feeds.
-- rewrote section code and renamed it to meta.module:
-    * supports unlimited amount of nested topics.  Topics can be nested to create a multi-level hierarchy.
-- rewrote configuration file resolving:
-    * Drupal tries to locate a configuration file that matches your domain name or uses conf.php if the former failed.  Note also that the configuration files got renamed from .conf to .php for security's sake on mal-configured Drupal sites.
-- added caching support which makes Drupal extremely scalable.
-- added access.module:
-    * allows you to setup 'roles' (groups) and to bind a set of permissions to each group.
-- added blog.module.
-- added poll.module.
-- added system.module:
-    * moved most of the configuration options from hostname.conf to the new administration section.
-    * added support for custom "filters".
-- added statistics.module
-- added moderate.module:
-    * allows to assign users editorial/moderator rights to certain nodes or topics.
-- added page.module:
-    * allows creation of static (and dynamic) pages through the administration interface.
-- added help.module:
-    * groups all available module documentation on a single page.
-- added forum.module:
-    * added an integrated forum.
-- added cvs.module and cvs-to-sql.pl:
-    * allows to display and mail CVS log messages as daily digests.
-- added book.module:
-    * allows collaborative handbook writing: primary used for Drupal documentation.
-- removed cron.module and integrated it into conf.module.
-- removed module.module as it was no longer needed.
-- various updates:
-    * added "auto-post new submissions" feature versus "moderate new submissions".
-    * introduced links/Drupal tags: [[link]]
-    * added preview functionality when submitting new content (such as a story) from the administration pages.
-    * made the administration section only show those links a user has access to.
-    * made all modules use specific form_* functions to guarantee a rock-solid forms and more consistent layout.
-    * improved scheduler:
-        + content can be scheduled to be 'posted', 'queued' and 'hidden'.
-    * improved account module:
-        + added "access control" to allow/deny certain usernames/e-mail addresses/hostnames.
-    * improved locale module:
-        + added new overview to easy the translation process.
-    * improved comment module:
-        + made it possible to permanently delete comments.
-    * improved rating module
-    * improved story module:
-        + added preview functionality for administrators.
-        + made it possible to permanently delete stories.
-    * improved themes:
-        + W3C validation on a best effort basis.
-        + removed $theme->control() from themes.
-        + added theme "goofy".
-- collaboratively revised and expanded the Drupal documentation.
-
-Drupal 2.0.0, 2001-03-15
-------------------------
-- rewrote the comment/discussion code:
-    * comment navigation should be less confusing now.
-    * additional/alternative display and order methods have been added.
-    * modules can be extended with a "comment system": modules can embed the existing comment system without having to write their own, duplicate comment system.
-- added sections and section manager:
-    * story sections can be maintained from the administration pages.
-    * story sections make the open submission more adaptive in that you can set individual post, dump and expiration thresholds for each section according to the story type and urgency level: stories in certain sections do not "expire" and might stay interesting and active as time passes by, whereas news-related stories are only considered "hot" over a short period of time.
-- multiple vhosts + multiple directories:
-    * you can setup multiple Drupal sites on top of the same physical source tree either by using vhosts or sub-directories.
-- added "user ratings" similar to SlashCode's Karma or Scoop's Mojo:
-    * all rating logic is packed into a module to ease experimenting with different rating heuristics/algorithms.
-- added "search infrastructure":
-    * improved search page and integrated search functionality in the administration pages.
-- added translation / localization / internationalization support:
-    * because many people would love to see their website showing a lot less of English, and far more of their own language, Drupal provides a framework to setup a multi-lingual website or to overwrite the default English text in English.
-- added fine-grained user permission (or group) system:
-    * users can be granted access to specific administration sections.  Example: a FAQ maintainer can be given access to maintain the FAQ and translators can be given access to the translation pages.
-- added FAQ module
-- changed the "open submission queue" into a (optional) module.
-- various updates:
-    * improved account module:
-        + user accounts can be deleted.
-        + added fine-grained permission support.
-    * improved block module
-    * improved diary module:
-        + diary entries can be deleted
-    * improved headline module:
-        + improved parser to support more "generic" RDF/RSS/XML backend.
-    * improved module module
-    * improved watchdog module
-    * improved database abstraction layer
-    * improved themes:
-        + W3C validation on a best effort basis
-        + added theme "example" (alias "Stone Age")
-    * added new scripts to directory "scripts"
-    * added directory "misc"
-    * added CREDITS file
-- revised documentation
-
-Drupal 1.0.0, 2001-01-15
-------------------------
-- initial release
diff --git a/INSTALL.mysql.txt b/INSTALL.mysql.txt
deleted file mode 100644 (file)
index 2320c17..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-// $Id: INSTALL.mysql.txt 144 2007-03-28 07:52:20Z thierry $
-
-CONTENTS OF THIS FILE
----------------------
-
- * Introduction
- * Installation and configuration:
-    - Database and user creation
-    - Drupal schema loading
-
-INTRODUCTION
-------------
-
-This file describes how to create a MySQL database for Drupal.
-
-If you control your databases through a web-based control panel,
-check its documentation, as the following instructions are for the
-command line only.
-
-INSTALLATION AND CONFIGURATION
-------------------------------
-
-1. CREATE THE DRUPAL DATABASE
-
-   This step is only necessary if you don't already have a database
-   set-up (e.g. by your host). In the following examples, 'dba_user' is
-   an example MySQL user which has the CREATE and GRANT privileges. Use
-   the appropriate user name for your system.
-
-   First, you must create a new database for your Drupal site
-   (here, 'databasename' is the name of the new database):
-
-     mysqladmin -u dba_user -p create databasename
-
-   MySQL will prompt for the 'dba_user' database password and then create
-   the initial database files. Next you must login and set the access
-   database rights:
-
-     mysql -u dba_user -p
-
-   Again, you will be asked for the 'dba_user' database password.
-   At the MySQL prompt, enter following command:
-
-     GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX,
-     ALTER, CREATE TEMPORARY TABLES, LOCK TABLES
-     ON databasename.*
-     TO 'username'@'localhost' IDENTIFIED BY 'password';
-
-   where
-
-    'databasename' is the name of your database
-    'username@localhost' is the username of your MySQL account
-    'password' is the password required for that username
-
-   Note: Unless your database user has all of the privileges listed
-   above, you will not be able to run Drupal.
-
-   If successful, MySQL will reply with:
-
-     Query OK, 0 rows affected
-
-   To activate the new permissions, enter the following command:
-
-     FLUSH PRIVILEGES;
-
-2. LOAD THE DRUPAL DATABASE SCHEMA
-
-   Once you have a database, you must load the required tables into it.
-   Depending on the version of MySQL you are using, you must use the
-   file 'database.4.0.mysql' (for MySQL 4.0 or lower) or
-   'database.4.1.mysql' (for MySQL 4.1 or higher). Both files are
-   located in Drupal's database directory.
-
-   If you use a web-based control panel, you should be able to upload
-   the appropriate file and run it directly as SQL commands.
-
-   From the command line, use (again, replacing 'username' and
-   'databasename' with your MySQL username and database name):
-
-   for MySQL 4.0 or lower:
-     mysql -u username -p databasename < database/database.4.0.mysql
-
-   for MySQL 4.1 or higher:
-     mysql -u username -p databasename < database/database.4.1.mysql
-
diff --git a/INSTALL.pgsql.txt b/INSTALL.pgsql.txt
deleted file mode 100644 (file)
index f59e07e..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// $Id: INSTALL.pgsql.txt 144 2007-03-28 07:52:20Z thierry $
-
-CONTENTS OF THIS FILE
----------------------
-
- * Introduction
- * Installation and configuration:
-    - Database and user creation
-    - Drupal schema loading
-
-INTRODUCTION
-------------
-
-This file describes how to create a PostgreSQL database for Drupal.
-
-If you control your databases through a web-based control panel,
-check its documentation, as the following instructions are for the
-command line only.
-
-INSTALLATION AND CONFIGURATION
-------------------------------
-
-1. CREATE DATABASE USER
-
-   This step is only necessary if you don't already have a user setup
-   (e.g. by your host) or you want to create new user for use with Drupal
-   only. The following command creates a new user named "username" and
-   asks for a password for that user:
-
-     createuser --pwprompt --encrypted --no-adduser --no-createdb username
-
-   If everything works correctly, you'll see a "CREATE USER" notice.
-
-2. CREATE THE DRUPAL DATABASE
-
-   This step is only necessary if you don't already have a database
-   setup (e.g. by your host) or you want to create new database for
-   use with Drupal only. The following command creates a new database
-   named "databasename", which is owned by previously created "username":
-
-     createdb --encoding=UNICODE --owner=username databasename
-
-   If everything works correctly, you'll see a "CREATE DATABASE" notice.
-   Note that the database must be created with UTF-8 (Unicode) encoding.
-
-3. LOAD THE DRUPAL DATABASE SCHEMA
-
-   Once the database has been created, load the required tables into it:
-
-     psql -q -f database/database.pgsql databasename username
-
-   If everything works correctly, you won't see any messages.
-
diff --git a/INSTALL.txt b/INSTALL.txt
deleted file mode 100644 (file)
index 895e01a..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-// $Id: INSTALL.txt 144 2007-03-28 07:52:20Z thierry $
-
-CONTENTS OF THIS FILE
----------------------
-
- * Requirements
- * Optional requirements
- * Installation
-    - Drupal administration
-    - Customizing your theme(s)
- * More Information
-
-REQUIREMENTS
-------------
-
-Drupal requires a web server, PHP4 (4.3.3 or greater) or PHP5
-(http://www.php.net/) and either MySQL (http://www.mysql.com/)
-or PostgreSQL (http://www.postgresql.org/). Your database user
-will also need sufficient privileges to run Drupal. Please
-check the INSTALL.mysql.txt and INSTALL.pgsql.txt for more
-detailed information.
-
-NOTE: the Apache web server and MySQL database are recommended;
-other web server and database combinations such as IIS and PostgreSQL
-are possible but tested to a lesser extent.
-
-OPTIONAL REQUIREMENTS
----------------------
-
-- To use XML-based services such as the Blogger API, Jabber, and RSS
-  syndication, you will need PHP's XML extension. This extension is
-  enabled by default.
-
-- If you want support for clean URLs, you'll need mod_rewrite and
-  the ability to use local .htaccess files. (More information can
-  be found in the Drupal handbook on drupal.org.)
-
-INSTALLATION
-------------
-
-1. DOWNLOAD DRUPAL
-
-   You can obtain the latest Drupal release from http://drupal.org/.
-   The files are in .tar.gz format and can be extracted using most
-   compression tools. On a typical Unix command line, use:
-
-     wget http://drupal.org/files/projects/drupal-x.x.x.tar.gz
-     tar -zxvf drupal-x.x.x.tar.gz
-
-   This will create a new directory drupal-x.x.x/ containing all
-   Drupal files and directories. Move the contents of that directory
-   into a directory within your web server's document root or your
-   public HTML directory:
-
-     mv drupal-x.x.x/* drupal-x.x.x/.htaccess /var/www/html
-
-2. CREATE AND PREPARE THE DRUPAL DATABASE
-
-   Before you proceed to the next step you should know:
-    - "username"      - the username for connecting to the database
-    - "password"      - the password for that username
-    - "databasename"  - the name of the database
-
-   Depending on the database of your choice, please read either
-   INSTALL.mysql.txt (for MySQL) or INSTALL.pgsql.txt (for PostgreSQL).
-
-3. CONNECTING DRUPAL
-
-   The default configuration can be found in the
-   'sites/default/settings.php' file within your Drupal installation.
-   Before you can run Drupal, you must set the database URL. Open the
-   configuration file and edit the $db_url line to match the database
-   defined in the previous step:
-
-     $db_url = "mysql://username:password@localhost/databasename";
-
-   If you use PostgreSQL, change "mysql" to "pgsql" in the above line.
-
-   In addition, a single Drupal installation can host several
-   Drupal-powered sites, each with its own individual configuration.
-   If you don't need multiple Drupal sites, skip to the next section.
-
-   Additional site configurations are created in subdirectories within
-   the 'sites' directory. Each subdirectory must have a 'settings.php'
-   file which specifies the configuration settings. The easiest way to
-   create additional sites is to copy the 'default' directory and modify
-   the 'settings.php' file as appropriate. The new directory name is
-   constructed from the site's URL. The configuration for www.example.com
-   could be in 'sites/example.com/settings.php' (note that 'www.' should
-   be omitted if users can access your site at http://example.com/).
-
-   Sites do not each have to have a different domain. You can use
-   subdomains and subdirectories for Drupal sites also. For example,
-   example.com, sub.example.com, and sub.example.com/site3 can all be
-   defined as independent Drupal sites. The setup for a configuration
-   such as this would look like the following:
-
-     sites/default/settings.php
-     sites/example.com/settings.php
-     sites/sub.example.com/settings.php
-     sites/sub.example.com.site3/settings.php
-
-   When searching for a site configuration (for example
-   www.sub.example.com/site3), Drupal will search for configuration
-   files in the following order, using the first configuration it finds:
-
-     sites/www.sub.example.com.site3/settings.php
-     sites/sub.example.com.site3/settings.php
-     sites/example.com.site3/settings.php
-     sites/www.sub.example.com/settings.php
-     sites/sub.example.com/settings.php
-     sites/example.com/settings.php
-     sites/default/settings.php
-
-   If you are installing on a non-standard port, the port number is
-   treated as the deepest subdomain. For example: http://www.example.com:8080/
-   could be loaded from sites/8080.www.example.com/. The port number
-   will be removed according to the pattern above if no port-specific
-   configuration is found, just like a real subdomain.
-
-   Each site configuration can have its own site-specific modules and
-   themes that will be made available in addition to those installed
-   in the standard 'modules' and 'themes' directories. To use
-   site-specific modules or themes, simply create a 'modules' or
-   'themes' directory within the site configuration directory. For
-   example, if sub.example.com has a custom theme and a custom module
-   that should not be accessible to other sites, the setup would look
-   like this:
-
-     sites/sub.example.com/:
-       settings.php
-       themes/custom_theme
-       modules/custom_module
-
-   NOTE: for more information about multiple virtual hosts or the
-   configuration settings, consult the Drupal handbook at drupal.org.
-
-4. CONFIGURE DRUPAL
-
-   You should consider creating a "files" subdirectory in your Drupal
-   installation directory. This subdirectory stores files such as
-   custom logos, user avatars, and other media associated with your
-   new site. The sub-directory requires "read and write" permission
-   by the Drupal server process. You can change the name of this
-   subdirectory at "Administer > Settings > File system settings".
-
-   SECURITY NOTICE: Certain Apache configurations can be vulnerable
-   to a security exploit allowing arbitrary code execution. Drupal
-   will attempt to automatically create a .htaccess file in your
-   "files" directory to protect you. If you already have a .htaccess
-   file in that location, please add the following lines:
-
-     SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
-     Options None
-     <IfModule mod_rewrite.c>
-       RewriteEngine off
-     </IfModule>
-
-   You can now launch your browser and point it to your Drupal site.
-
-   Create an account and login. The first account will automatically
-   become the main administrator account with total control.
-
-5. CRON TASKS
-
-   Many Drupal modules (such as the search functionality) have periodic
-   tasks that must be triggered by a cron job. To activate these tasks,
-   call the cron page by visiting http://www.example.com/cron.php --
-   this will pass control to the modules and the modules will decide if
-   and what they must do.
-
-   Most systems support the crontab utility for scheduling tasks like
-   this. The following example crontab line will activate the cron
-   tasks automatically on the hour:
-
-   0   *   *   *   *   wget -O - -q http://www.example.com/cron.php
-
-   More information about the cron scripts are available in the admin
-   help pages and in the Drupal handbook at drupal.org. Example
-   scripts can be found in the scripts/ directory.
-
-DRUPAL ADMINISTRATION
----------------------
-
-Upon a new installation, your Drupal website defaults to a very basic
-configuration with only a few active modules, one theme, and minimal
-user access rights.
-
-Use your administration panel to enable and configure services. For
-example, set some general settings for your site with "Administer >
-Settings". Enable modules via "Administer > Modules". User permissions
-can be set with "Administer > Users > Configure > Permissions".
-
-For more information on configuration options, read the
-instructions which accompany the different configuration settings and
-consult the various help pages available in the administration panel.
-
-Community-contributed modules and themes are available at http://drupal.org/.
-
-CUSTOMIZING YOUR THEME(S)
--------------------------
-
-Now that your server is running, you will want to customize the look
-of your site. Several sample themes are included in the Drupal
-installation and more can be downloaded from drupal.org.
-
-Simple customization of your theme can be done using only CSS. Further
-changes require understanding the phptemplate engine that is now part
-of Drupal. See http://drupal.org/handbook/customization to find out more.
-
-
-MORE INFORMATION
-----------------
-
-For platform specific configuration issues and other installation and
-administration assistance, please consult the Drupal handbook at
-http://drupal.org/handbook. You can view the wide range of other
-support options available at http://drupal.org/support.
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644 (file)
index b382031..0000000
+++ /dev/null
@@ -1,342 +0,0 @@
-// $Id: LICENSE.txt 144 2007-03-28 07:52:20Z thierry $
-
-        GNU GENERAL PUBLIC LICENSE
-           Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-          Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-        GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-          NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-         END OF TERMS AND CONDITIONS
-
-      How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/MAINTAINERS.txt b/MAINTAINERS.txt
deleted file mode 100644 (file)
index 241cc93..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// $Id: MAINTAINERS.txt 144 2007-03-28 07:52:20Z thierry $
-
-List of maintainers
---------------------------------------------------------------------------------
-
-LEGEND
-======
-
-- M: the maintainer
-- S: status:
-      "supported"     : someone is actually paid to look after this.
-      "maintained"    : someone actually looks after it.
-      "fixes/patches" : it has a maintainer but they don't have time to
-                        do much other than throw the odd patch in.
-      "orphan"        : no current maintainer, but maybe you could take
-                        the role as you write new code?
-- W: website with status or information
-
---------------------------------------------------------------------------------
-
-BLOG API
-M: James Walker <walkah@walkah.net>
-S: maintained
-
-DISTRIBUTED AUTHENTICATION MODULES
-M: Moshe Weitzman <weitzman@tejasa.com>
-S: maintained
-
-DOCUMENTATION COORDINATOR
-M: Charlie Lowe <cel4145@cyberdash.com>
-S: maintained
-
-FILTER SYSTEM
-M: Steven Wittens <unconed@drupal.org>
-S: maintained
-
-FORM SYSTEM
-M: Károly Négyesi <chx@mail.tvnet.hu>
-S: maintained
-
-LOCALE MODULE
-M: Gabor Hojtsy <goba@php.net>
-S: maintained
-
-MENU SYSTEM
-M: Richard Archer <drupal@juggernaut.com.au>
-S: maintained
-
-PATH MODULE
-M: Matt Westgate <drupal@asitis.org>
-S: maintained
-
-POSTGRESQL PORT
-M: Piotr Krukowiecki <pgsql@cvbge.org>
-S: maintained
-
-SECURITY COORDINATOR
-M: Károly Négyesi <chx@mail.tvnet.hu>
-S: maintained
-
-STATISTICS MODULE
-M: Jeremy Andrews <jeremy@kerneltrap.com>
-S: maintained
-
-XML-RPC SERVER/CLIENT
-M: Károly Négyesi <chx@mail.tvnet.hu>
-S: maintained
-
-DEBIAN PACKAGE
-M: Hilko Bengen <bengen@debian.org>
-S: maintained
-
-TRANSLATIONS COORDINATOR
-M: Gerhard Killesreiter <gerhard@killesreiter.de>
-S: maintained
-
-THE REST:
-M: Dries <dries@drupal.org>
index 2f6e888..79fcce3 100644 (file)
@@ -1,13 +1,13 @@
 #
 # $Id: PLCWWW.spec 1206 2008-03-03 15:49:07Z thierry $
 #
-%define module_taglevel_varname subversion
 %define name PLCWWW
 %define version PLE.5.0
-%define subversion 0
+%define taglevel 0
 
-#%define release %{subversion}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
-%define release %{subversion}%{?date:.%{date}}
+# no need to mention pldistro as this module differs in both distros
+#%define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
+%define release %{taglevel}%{?date:.%{date}}
 
 Summary: PlanetLab Central (PLC) Web Pages
 Name: %{name}
@@ -53,13 +53,13 @@ rm -rf $RPM_BUILD_ROOT
 # plcwww
 #
 
-echo "* PLCWWW: Installing web pages"
+echo "* PLEWWW: Installing web pages"
 mkdir -p $RPM_BUILD_ROOT/var/www/html
 # let's be conservative and exclude codebase files, though there should not be any
 rsync -a --exclude \*.spec --exclude .svn --exclude CVS ./ $RPM_BUILD_ROOT/var/www/html/
 
-echo "* PLCWWW: Installing drupal config for httpd"
-install -D -m 644 drupal.conf $RPM_BUILD_ROOT/etc/httpd/conf.d/drupal-plcwww.conf
+echo "* PLEWWW: Installing config for httpd"
+install -D -m 644 planetlab.conf $RPM_BUILD_ROOT/etc/httpd/conf.d/planetlab.conf
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -67,7 +67,7 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(-,root,root,-)
 /var/www/html
-/etc/httpd/conf.d/drupal-plcwww.conf
+/etc/httpd/conf.d/planetlab.conf
 
 %changelog
 * Fri Apr 25 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - PLCWWW-onelab.4.2-11
diff --git a/UPGRADE.txt b/UPGRADE.txt
deleted file mode 100644 (file)
index 2f981c0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// $Id: UPGRADE.txt 144 2007-03-28 07:52:20Z thierry $
-
-UPGRADING
----------
-
-1. Backup your database and Drupal directory - especially your
-   configuration file in 'sites/default/settings.php'.
-
-2. Log on as the user with user ID 1.
-
-3. Remove all the old Drupal files then unpack the new Drupal
-   files into the directory that you run Drupal from.
-
-4. Modify the new configuration file to make sure
-   it has the latest and correct information.
-
-5. Run update.php by visiting http://www.example.com/update.php.
-
diff --git a/cron.php b/cron.php
deleted file mode 100644 (file)
index 17da640..0000000
--- a/cron.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-// $Id: cron.php 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).
- */
-
-include_once './includes/bootstrap.inc';
-drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-
-// If not in 'safe mode', increase the maximum execution time:
-if (!ini_get('safe_mode')) {
-  set_time_limit(240);
-}
-
-// Check if the last cron run completed
-if (variable_get('cron_busy', false)) {
-  watchdog('cron', t('Last cron run did not complete.'), WATCHDOG_WARNING);
-}
-else {
-  variable_set('cron_busy', true);
-}
-
-// Iterate through the modules calling their cron handlers (if any):
-module_invoke_all('cron');
-
-// Clean up
-variable_set('cron_busy', false);
-variable_set('cron_last', time());
-watchdog('cron', t('Cron run completed'));
diff --git a/database/database.4.0.mysql b/database/database.4.0.mysql
deleted file mode 100644 (file)
index 6a14b6a..0000000
+++ /dev/null
@@ -1,873 +0,0 @@
--- $Id: database.4.0.mysql 144 2007-03-28 07:52:20Z thierry $
-
---
--- Table structure for table 'access'
---
-CREATE TABLE access (
-  aid tinyint(10) NOT NULL auto_increment,
-  mask varchar(255) NOT NULL default '',
-  type varchar(255) NOT NULL default '',
-  status tinyint(2) NOT NULL default '0',
-  PRIMARY KEY (aid)
-);
-
---
--- Table structure for table 'accesslog'
---
-
-CREATE TABLE accesslog (
-  aid int(10) NOT NULL auto_increment,
-  sid varchar(32) NOT NULL default '',
-  title varchar(255) default NULL,
-  path varchar(255) default NULL,
-  url varchar(255) default NULL,
-  hostname varchar(128) default NULL,
-  uid int(10) unsigned default '0',
-  timer int(10) unsigned NOT NULL default '0',
-  timestamp int(11) unsigned NOT NULL default '0',
-  KEY accesslog_timestamp (timestamp),
-  PRIMARY KEY (aid)
-);
-
---
--- Table structure for table 'aggregator_category'
---
-
-CREATE TABLE aggregator_category (
-  cid int(10) NOT NULL auto_increment,
-  title varchar(255) NOT NULL default '',
-  description longtext NOT NULL,
-  block tinyint(2) NOT NULL default '0',
-  PRIMARY KEY (cid),
-  UNIQUE KEY title (title)
-);
-
---
--- Table structure for table 'aggregator_category_feed'
---
-
-CREATE TABLE aggregator_category_feed (
-  fid int(10) NOT NULL default '0',
-  cid int(10) NOT NULL default '0',
-  PRIMARY KEY (fid,cid)
-);
-
---
--- Table structure for table 'aggregator_category_item'
---
-
-CREATE TABLE aggregator_category_item (
-  iid int(10) NOT NULL default '0',
-  cid int(10) NOT NULL default '0',
-  PRIMARY KEY (iid,cid)
-);
-
---
--- Table structure for table 'aggregator_feed'
---
-
-CREATE TABLE aggregator_feed (
-  fid int(10) NOT NULL auto_increment,
-  title varchar(255) NOT NULL default '',
-  url varchar(255) NOT NULL default '',
-  refresh int(10) NOT NULL default '0',
-  checked int(10) NOT NULL default '0',
-  link varchar(255) NOT NULL default '',
-  description longtext NOT NULL,
-  image longtext NOT NULL,
-  etag varchar(255) NOT NULL default '',
-  modified int(10) NOT NULL default '0',
-  block tinyint(2) NOT NULL default '0',
-  PRIMARY KEY (fid),
-  UNIQUE KEY link (url),
-  UNIQUE KEY title (title)
-);
-
---
--- Table structure for table 'aggregator_item'
---
-
-CREATE TABLE aggregator_item (
-  iid int(10) NOT NULL auto_increment,
-  fid int(10) NOT NULL default '0',
-  title varchar(255) NOT NULL default '',
-  link varchar(255) NOT NULL default '',
-  author varchar(255) NOT NULL default '',
-  description longtext NOT NULL,
-  timestamp int(11) default NULL,
-  PRIMARY KEY (iid)
-);
-
---
--- Table structure for table 'authmap'
---
-
-CREATE TABLE authmap (
-  aid int(10) unsigned NOT NULL auto_increment,
-  uid int(10) NOT NULL default '0',
-  authname varchar(128) NOT NULL default '',
-  module varchar(128) NOT NULL default '',
-  PRIMARY KEY (aid),
-  UNIQUE KEY authname (authname)
-);
-
---
--- Table structure for table 'blocks'
---
-
-CREATE TABLE blocks (
-  module varchar(64) DEFAULT '' NOT NULL,
-  delta varchar(32) NOT NULL default '0',
-  theme varchar(255) NOT NULL default '',
-  status tinyint(2) DEFAULT '0' NOT NULL,
-  weight tinyint(1) DEFAULT '0' NOT NULL,
-  region varchar(64) DEFAULT 'left' NOT NULL,
-  custom tinyint(2) DEFAULT '0' NOT NULL,
-  throttle tinyint(1) DEFAULT '0' NOT NULL,
-  visibility tinyint(1) DEFAULT '0' NOT NULL,
-  pages text DEFAULT '' NOT NULL
-);
-
---
--- Table structure for table 'book'
---
-
-CREATE TABLE book (
-  vid int(10) unsigned NOT NULL default '0',
-  nid int(10) unsigned NOT NULL default '0',
-  parent int(10) NOT NULL default '0',
-  weight tinyint(3) NOT NULL default '0',
-  PRIMARY KEY (vid),
-  KEY nid (nid),
-  KEY parent (parent)
-);
-
---
--- Table structure for table 'boxes'
---
-
-CREATE TABLE boxes (
-  bid tinyint(4) NOT NULL auto_increment,
-  title varchar(64) NOT NULL default '',
-  body longtext,
-  info varchar(128) NOT NULL default '',
-  format int(4) NOT NULL default '0',
-  PRIMARY KEY (bid),
-  UNIQUE KEY info (info)
-);
-
---
--- Table structure for table 'cache'
---
-
-CREATE TABLE cache (
-  cid varchar(255) NOT NULL default '',
-  data longblob,
-  expire int(11) NOT NULL default '0',
-  created int(11) NOT NULL default '0',
-  headers text,
-  PRIMARY KEY (cid),
-  INDEX expire (expire)
-);
-
---
--- Table structure for table 'comments'
---
-
-CREATE TABLE comments (
-  cid int(10) NOT NULL auto_increment,
-  pid int(10) NOT NULL default '0',
-  nid int(10) NOT NULL default '0',
-  uid int(10) NOT NULL default '0',
-  subject varchar(64) NOT NULL default '',
-  comment longtext NOT NULL,
-  hostname varchar(128) NOT NULL default '',
-  timestamp int(11) NOT NULL default '0',
-  score mediumint(9) NOT NULL default '0',
-  status tinyint(3) unsigned NOT NULL default '0',
-  format int(4) NOT NULL default '0',
-  thread varchar(255) NOT NULL,
-  users longtext,
-  name varchar(60) default NULL,
-  mail varchar(64) default NULL,
-  homepage varchar(255) default NULL,
-  PRIMARY KEY (cid),
-  KEY lid (nid)
-);
-
---
--- Table structre for table 'contact'
---
-
-CREATE TABLE contact (
-  cid int(10) unsigned NOT NULL auto_increment,
-  category varchar(255) NOT NULL default '',
-  recipients longtext NOT NULL default '',
-  reply longtext NOT NULL default '',
-  weight tinyint(3) NOT NULL default '0',
-  selected tinyint(1) NOT NULL default '0',
-  PRIMARY KEY (cid),
-  UNIQUE KEY category (category)
-);
-
---
--- Table structre for table 'node_comment_statistics'
---
-
-CREATE TABLE node_comment_statistics (
-  nid int(10) unsigned NOT NULL auto_increment,
-  last_comment_timestamp int(11) NOT NULL default '0',
-  last_comment_name varchar(60) default NULL,
-  last_comment_uid int(10) NOT NULL default '0',
-  comment_count int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY (nid),
-  KEY node_comment_timestamp (last_comment_timestamp)
-);
-
---
--- Table structure for table 'client'
---
-
-CREATE TABLE client (
-  cid int(10) unsigned NOT NULL auto_increment,
-  link varchar(255) NOT NULL default '',
-  name varchar(128) NOT NULL default '',
-  mail varchar(128) NOT NULL default '',
-  slogan longtext NOT NULL,
-  mission longtext NOT NULL,
-  users int(10) NOT NULL default '0',
-  nodes int(10) NOT NULL default '0',
-  version varchar(35) NOT NULL default'',
-  created int(11) NOT NULL default '0',
-  changed int(11) NOT NULL default '0',
-  PRIMARY KEY (cid)
-);
-
---
--- Table structure for table 'client_system'
---
-
-CREATE TABLE client_system (
-  cid int(10) NOT NULL default '0',
-  name varchar(255) NOT NULL default '',
-  type varchar(255) NOT NULL default '',
-  PRIMARY KEY (cid,name)
-);
-
---
--- Table structure for table 'files'
---
-
-CREATE TABLE files (
-  fid int(10) unsigned NOT NULL default 0,
-  nid int(10) unsigned NOT NULL default 0,
-  filename varchar(255) NOT NULL default '',
-  filepath varchar(255) NOT NULL default '',
-  filemime varchar(255) NOT NULL default '',
-  filesize int(10) unsigned NOT NULL default 0,
-  PRIMARY KEY (fid)
-);
-
---
--- Table structure for table 'file_revisions'
---
-
-CREATE TABLE file_revisions (
-  fid int(10) unsigned NOT NULL default 0,
-  vid int(10) unsigned NOT NULL default 0,
-  description varchar(255) NOT NULL default '',
-  list tinyint(1) unsigned NOT NULL default 0,
-  PRIMARY KEY (fid, vid)
-);
-
---
--- Table structure for table 'filter_formats'
---
-
-CREATE TABLE filter_formats (
-  format int(4) NOT NULL auto_increment,
-  name varchar(255) NOT NULL default '',
-  roles varchar(255) NOT NULL default '',
-  cache tinyint(2) NOT NULL default '0',
-  PRIMARY KEY (format),
-  UNIQUE KEY (name)
-);
-
---
--- Table structure for table 'filters'
---
-
-CREATE TABLE filters (
-  format int(4) NOT NULL default '0',
-  module varchar(64) NOT NULL default '',
-  delta tinyint(2) DEFAULT '0' NOT NULL,
-  weight tinyint(2) DEFAULT '0' NOT NULL,
-  INDEX (weight)
-);
-
---
--- Table structure for table 'flood'
---
-
-CREATE TABLE flood (
-  event varchar(64) NOT NULL default '',
-  hostname varchar(128) NOT NULL default '',
-  timestamp int(11) NOT NULL default '0'
-);
-
---
--- Table structure for table 'forum'
---
-
-CREATE TABLE forum (
-  nid int(10) unsigned NOT NULL default '0',
-  vid int(10) unsigned NOT NULL default '0',
-  tid int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY (vid),
-  KEY nid (nid),
-  KEY tid (tid)
-);
-
---
--- Table structure for table 'history'
---
-
-CREATE TABLE history (
-  uid int(10) NOT NULL default '0',
-  nid int(10) NOT NULL default '0',
-  timestamp int(11) NOT NULL default '0',
-  PRIMARY KEY (uid,nid)
-);
-
---
--- Table structure for table 'locales_meta'
---
-
-CREATE TABLE locales_meta (
-  locale varchar(12) NOT NULL default '',
-  name varchar(64) NOT NULL default '',
-  enabled int(2) NOT NULL default '0',
-  isdefault int(2) NOT NULL default '0',
-  plurals int(1) NOT NULL default '0',
-  formula varchar(128) NOT NULL default '',
-  PRIMARY KEY (locale)
-);
-
---
--- Table structure for table 'locales_source'
---
-
-CREATE TABLE locales_source (
-  lid int(11) NOT NULL auto_increment,
-  location varchar(255) NOT NULL default '',
-  source blob NOT NULL,
-  PRIMARY KEY (lid)
-);
-
---
--- Table structure for table 'locales_target'
---
-
-CREATE TABLE locales_target (
-  lid int(11) NOT NULL default '0',
-  translation blob NOT NULL,
-  locale varchar(12) NOT NULL default '',
-  plid int(11) NOT NULL default '0',
-  plural int(1) NOT NULL default '0',
-  KEY lid (lid),
-  KEY lang (locale),
-  KEY plid (plid),
-  KEY plural (plural)
-);
-
---
--- Table structure for table 'menu'
---
-
-CREATE TABLE menu (
-  mid int(10) unsigned NOT NULL default '0',
-  pid int(10) unsigned NOT NULL default '0',
-  path varchar(255) NOT NULL default '',
-  title varchar(255) NOT NULL default '',
-  description varchar(255) NOT NULL default '',
-  weight tinyint(4) NOT NULL default '0',
-  type int(2) unsigned NOT NULL default '0',
-  PRIMARY KEY (mid)
-);
-
---
--- Table structure for table 'node'
---
-
-CREATE TABLE node (
-  nid int(10) unsigned NOT NULL auto_increment,
-  vid int(10) unsigned NOT NULL default '0',
-  type varchar(32) NOT NULL default '',
-  title varchar(128) NOT NULL default '',
-  uid int(10) NOT NULL default '0',
-  status int(4) NOT NULL default '1',
-  created int(11) NOT NULL default '0',
-  changed int(11) NOT NULL default '0',
-  comment int(2) NOT NULL default '0',
-  promote int(2) NOT NULL default '0',
-  moderate int(2) NOT NULL default '0',
-  sticky int(2) NOT NULL default '0',
-  PRIMARY KEY  (nid, vid),
-  UNIQUE KEY vid (vid),
-  KEY node_type (type(4)),
-  KEY node_title_type (title, type(4)),
-  KEY status (status),
-  KEY uid (uid),
-  KEY node_moderate (moderate),
-  KEY node_promote_status (promote, status),
-  KEY node_created (created),
-  KEY node_changed (changed),
-  KEY node_status_type (status, type, nid),
-  KEY nid (nid)
-);
-
---
--- Table structure for table `node_access`
---
-
-CREATE TABLE node_access (
-  nid int(10) unsigned NOT NULL default '0',
-  gid int(10) unsigned NOT NULL default '0',
-  realm varchar(255) NOT NULL default '',
-  grant_view tinyint(1) unsigned NOT NULL default '0',
-  grant_update tinyint(1) unsigned NOT NULL default '0',
-  grant_delete tinyint(1) unsigned NOT NULL default '0',
-  PRIMARY KEY (nid,gid,realm)
-);
-
---
--- Table structure for table 'node_revisions'
---
-
-CREATE TABLE node_revisions (
-  nid int(10) unsigned NOT NULL,
-  vid int(10) unsigned NOT NULL,
-  uid int(10) NOT NULL default '0',
-  title varchar(128) NOT NULL default '',
-  body longtext NOT NULL default '',
-  teaser longtext NOT NULL default '',
-  log longtext NOT NULL default '',
-  timestamp int(11) NOT NULL default '0',
-  format int(4) NOT NULL default '0',
-  PRIMARY KEY  (vid),
-  KEY nid (nid),
-  KEY uid (uid)
-);
-
---
--- Table structure for table 'profile_fields'
---
-
-CREATE TABLE profile_fields (
-  fid int(10) NOT NULL auto_increment,
-  title varchar(255) default NULL,
-  name varchar(128) default NULL,
-  explanation TEXT default NULL,
-  category varchar(255) default NULL,
-  page varchar(255) default NULL,
-  type varchar(128) default NULL,
-  weight tinyint(1) DEFAULT '0' NOT NULL,
-  required tinyint(1) DEFAULT '0' NOT NULL,
-  register tinyint(1) DEFAULT '0' NOT NULL,
-  visibility tinyint(1) DEFAULT '0' NOT NULL,
-  autocomplete tinyint(1) DEFAULT '0' NOT NULL,
-  options text,
-  KEY category (category),
-  UNIQUE KEY name (name),
-  PRIMARY KEY (fid)
-);
-
---
--- Table structure for table 'profile_values'
---
-
-CREATE TABLE profile_values (
-  fid int(10) unsigned default '0',
-  uid int(10) unsigned default '0',
-  value text,
-  KEY uid (uid),
-  KEY fid (fid)
-);
-
-
---
--- Table structure for table 'url_alias'
---
-
-CREATE TABLE url_alias (
-  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 dst (dst),
-  KEY src (src)
-);
-
---
--- Table structure for table 'permission'
---
-
-CREATE TABLE permission (
-  rid int(10) unsigned NOT NULL default '0',
-  perm longtext,
-  tid int(10) unsigned NOT NULL default '0',
-  KEY rid (rid)
-);
-
---
--- Table structure for table 'poll'
---
-
-CREATE TABLE poll (
-  nid int(10) unsigned NOT NULL default '0',
-  runtime int(10) NOT NULL default '0',
-  active int(2) unsigned NOT NULL default '0',
-  PRIMARY KEY (nid)
-);
-
---
--- Table structure for table 'poll_votes'
---
-
-CREATE TABLE poll_votes (
-  nid int(10) unsigned NOT NULL,
-  uid int(10) unsigned NOT NULL default 0,
-  hostname varchar(128) NOT NULL default '',
-  INDEX (nid),
-  INDEX (uid),
-  INDEX (hostname)
-);
-
---
--- Table structure for table 'poll_choices'
---
-
-CREATE TABLE poll_choices (
-  chid int(10) unsigned NOT NULL auto_increment,
-  nid int(10) unsigned NOT NULL default '0',
-  chtext varchar(128) NOT NULL default '',
-  chvotes int(6) NOT NULL default '0',
-  chorder int(2) NOT NULL default '0',
-  PRIMARY KEY (chid),
-  KEY nid (nid)
-);
-
---
--- Table structure for table 'role'
---
-
-CREATE TABLE role (
-  rid int(10) unsigned NOT NULL auto_increment,
-  name varchar(32) NOT NULL default '',
-  PRIMARY KEY (rid),
-  UNIQUE KEY name (name)
-);
-
---
--- Table structure for table 'search_dataset'
---
-CREATE TABLE search_dataset (
-  sid int(10) unsigned NOT NULL default '0',
-  type varchar(16) default NULL,
-  data longtext NOT NULL,
-  KEY sid_type (sid, type)
-);
-
---
--- Table structure for table 'search_index'
---
-
-CREATE TABLE search_index (
-  word varchar(50) NOT NULL default '',
-  sid int(10) unsigned NOT NULL default '0',
-  type varchar(16) default NULL,
-  fromsid int(10) unsigned NOT NULL default '0',
-  fromtype varchar(16) default NULL,
-  score float default NULL,
-  KEY sid_type (sid, type),
-  KEY from_sid_type (fromsid, fromtype),
-  KEY word (word)
-);
-
---
--- Table structure for table 'search_total'
---
-
-CREATE TABLE search_total (
-  word varchar(50) NOT NULL default '',
-  count float default NULL,
-  PRIMARY KEY (word)
-);
-
---
--- Table structure for table 'sessions'
---
-
-
-CREATE TABLE 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',
-  cache int(11) NOT NULL default '0',
-  session longtext,
-  KEY uid (uid),
-  PRIMARY KEY (sid),
-  KEY timestamp (timestamp)
-);
-
---
--- Table structure for table 'sequences'
---
-
-CREATE TABLE sequences (
-  name varchar(255) NOT NULL default '',
-  id int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY (name)
-);
-
---
--- Table structure for table 'node_counter'
---
-
-CREATE TABLE node_counter (
-  nid int(10) NOT NULL default '0',
-  totalcount bigint(20) unsigned NOT NULL default '0',
-  daycount mediumint(8) unsigned NOT NULL default '0',
-  timestamp int(11) unsigned NOT NULL default '0',
-  PRIMARY KEY (nid),
-  KEY totalcount (totalcount),
-  KEY daycount (daycount),
-  KEY timestamp (timestamp)
-);
-
---
--- Table structure for table 'system'
---
-
-CREATE TABLE system (
-  filename varchar(255) NOT NULL default '',
-  name varchar(255) NOT NULL default '',
-  type varchar(255) NOT NULL default '',
-  description varchar(255) NOT NULL default '',
-  status int(2) NOT NULL default '0',
-  throttle tinyint(1) DEFAULT '0' NOT NULL,
-  bootstrap int(2) NOT NULL default '0',
-  schema_version smallint(3) NOT NULL default -1,
-  weight int(2) NOT NULL default '0',
-  PRIMARY KEY (filename),
-  KEY (weight)
-);
-
---
--- Table structure for table 'term_data'
---
-
-CREATE TABLE term_data (
-  tid int(10) unsigned NOT NULL auto_increment,
-  vid int(10) unsigned NOT NULL default '0',
-  name varchar(255) NOT NULL default '',
-  description longtext,
-  weight tinyint(4) NOT NULL default '0',
-  PRIMARY KEY (tid),
-  KEY vid (vid)
-);
-
---
--- Table structure for table 'term_hierarchy'
---
-
-CREATE TABLE term_hierarchy (
-  tid int(10) unsigned NOT NULL default '0',
-  parent int(10) unsigned NOT NULL default '0',
-  KEY tid (tid),
-  KEY parent (parent),
-  PRIMARY KEY (tid, parent)
-);
-
---
--- Table structure for table 'term_node'
---
-
-CREATE TABLE term_node (
-  nid int(10) unsigned NOT NULL default '0',
-  tid int(10) unsigned NOT NULL default '0',
-  KEY nid (nid),
-  KEY tid (tid),
-  PRIMARY KEY (tid,nid)
-);
-
---
--- Table structure for table 'term_relation'
---
-
-CREATE TABLE term_relation (
-  tid1 int(10) unsigned NOT NULL default '0',
-  tid2 int(10) unsigned NOT NULL default '0',
-  KEY tid1 (tid1),
-  KEY tid2 (tid2)
-);
-
---
--- Table structure for table 'term_synonym'
---
-
-CREATE TABLE term_synonym (
-  tid int(10) unsigned NOT NULL default '0',
-  name varchar(255) NOT NULL default '',
-  KEY tid (tid),
-  KEY name (name(3))
-);
-
---
--- Table structure for table 'users'
---
-
-CREATE TABLE users (
-  uid int(10) unsigned NOT NULL default '0',
-  name varchar(60) NOT NULL default '',
-  pass varchar(32) NOT NULL default '',
-  mail varchar(64) default '',
-  mode tinyint(1) NOT NULL default '0',
-  sort tinyint(1) default '0',
-  threshold tinyint(1) default '0',
-  theme varchar(255) NOT NULL default '',
-  signature varchar(255) NOT NULL default '',
-  created int(11) NOT NULL default '0',
-  access int(11) NOT NULL default '0',
-  login int(11) NOT NULL default '0',
-  status tinyint(4) NOT NULL default '0',
-  timezone varchar(8) default NULL,
-  language varchar(12) NOT NULL default '',
-  picture varchar(255) NOT NULL DEFAULT '',
-  init varchar(64) default '',
-  data longtext,
-  PRIMARY KEY (uid),
-  UNIQUE KEY name (name),
-  KEY access (access)
-);
-
---
--- Table structure for table 'users_roles'
---
-
-CREATE TABLE users_roles (
-  uid int(10) unsigned NOT NULL default '0',
-  rid int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY (uid, rid)
-);
-
---
--- Table structure for table 'variable'
---
-
-CREATE TABLE variable (
-  name varchar(48) NOT NULL default '',
-  value longtext NOT NULL,
-  PRIMARY KEY (name)
-);
-
---
--- Table structure for table 'vocabulary'
---
-
-CREATE TABLE vocabulary (
-  vid int(10) unsigned NOT NULL auto_increment,
-  name varchar(255) NOT NULL default '',
-  description longtext,
-  help varchar(255) NOT NULL default '',
-  relations tinyint(3) unsigned NOT NULL default '0',
-  hierarchy tinyint(3) unsigned NOT NULL default '0',
-  multiple tinyint(3) unsigned NOT NULL default '0',
-  required tinyint(3) unsigned NOT NULL default '0',
-  tags tinyint(3) unsigned NOT NULL default '0',
-  module varchar(255) NOT NULL default '',
-  weight tinyint(4) NOT NULL default '0',
-  PRIMARY KEY (vid)
-);
-
---
--- Table structure for table 'vocabulary_node_types'
---
-
-CREATE TABLE vocabulary_node_types (
-  vid int(10) unsigned NOT NULL DEFAULT '0',
-  type varchar(32) NOT NULL DEFAULT '',
-  PRIMARY KEY (vid, type)
-);
-
---
--- Table structure for table 'watchdog'
---
-
-CREATE TABLE watchdog (
-  wid int(5) NOT NULL auto_increment,
-  uid int(10) NOT NULL default '0',
-  type varchar(16) NOT NULL default '',
-  message longtext NOT NULL,
-  severity tinyint(3) unsigned NOT NULL default '0',
-  link varchar(255) NOT NULL default '',
-  location varchar(128) NOT NULL default '',
-  referer varchar(128) NOT NULL default '',
-  hostname varchar(128) NOT NULL default '',
-  timestamp int(11) NOT NULL default '0',
-  PRIMARY KEY (wid)
-);
-
---
--- Insert some default values
---
-
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/block.module', 'block', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/comment.module', 'comment', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/filter.module', 'filter', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/help.module', 'help', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/menu.module', 'menu', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/node.module', 'node', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/page.module', 'page', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/story.module', 'story', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/system.module', 'system', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/taxonomy.module', 'taxonomy', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/user.module', 'user', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/watchdog.module', 'watchdog', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/engines/phptemplate/phptemplate.engine', 'phptemplate', 'theme_engine', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/bluemarine/page.tpl.php', 'bluemarine', 'theme', 'themes/engines/phptemplate/phptemplate.engine', 1, 0, 0, 0);
-INSERT INTO users (uid, name, mail) VALUES ('0', '', '');
-
-INSERT INTO role (rid, name) VALUES (1, 'anonymous user');
-INSERT INTO role (rid, name) VALUES (2, 'authenticated user');
-
-INSERT INTO permission VALUES (1,'access content',0);
-INSERT INTO permission VALUES (2,'access comments, access content, post comments, post comments without approval',0);
-
-INSERT INTO variable (name, value) VALUES ('theme_default', 's:10:"bluemarine";');
-
-INSERT INTO blocks (module, delta, theme, status, pages) VALUES ('user', '0', 'bluemarine', '1', '');
-INSERT INTO blocks (module, delta, theme, status, pages) VALUES ('user', '1', 'bluemarine', '1', '');
-
-INSERT INTO sequences (name, id) VALUES ('menu_mid', 2);
-
-INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);
-
-INSERT INTO filter_formats VALUES (1,'Filtered HTML',',1,2,',1);
-INSERT INTO filter_formats VALUES (2,'PHP code','',0);
-INSERT INTO filter_formats VALUES (3,'Full HTML','',1);
-INSERT INTO filters VALUES (1,'filter',0,0);
-INSERT INTO filters VALUES (1,'filter',2,1);
-INSERT INTO filters VALUES (2,'filter',1,0);
-INSERT INTO filters VALUES (3,'filter',2,0);
-INSERT INTO variable (name,value) VALUES ('filter_html_1','i:1;');
-
-INSERT INTO locales_meta (locale, name, enabled, isdefault) VALUES ('en', 'English', '1', '1');
-
-INSERT INTO variable (name, value) VALUES ('node_options_forum', 'a:1:{i:0;s:6:"status";}');
-
-INSERT INTO menu VALUES (2, 0, '', 'Primary links', '', 0, 115);
-INSERT INTO variable VALUES ('menu_primary_menu', 'i:2;');
-INSERT INTO variable VALUES ('menu_secondary_menu', 'i:2;');
-
diff --git a/database/database.4.1.mysql b/database/database.4.1.mysql
deleted file mode 100644 (file)
index 1a1bacf..0000000
+++ /dev/null
@@ -1,930 +0,0 @@
--- $Id: database.4.1.mysql 144 2007-03-28 07:52:20Z thierry $
-
---
--- Table structure for table 'access'
---
-CREATE TABLE access (
-  aid tinyint(10) NOT NULL auto_increment,
-  mask varchar(255) NOT NULL default '',
-  type varchar(255) NOT NULL default '',
-  status tinyint(2) NOT NULL default '0',
-  PRIMARY KEY (aid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'accesslog'
---
-
-CREATE TABLE accesslog (
-  aid int(10) NOT NULL auto_increment,
-  sid varchar(32) NOT NULL default '',
-  title varchar(255) default NULL,
-  path varchar(255) default NULL,
-  url varchar(255) default NULL,
-  hostname varchar(128) default NULL,
-  uid int(10) unsigned default '0',
-  timer int(10) unsigned NOT NULL default '0',
-  timestamp int(11) unsigned NOT NULL default '0',
-  KEY accesslog_timestamp (timestamp),
-  PRIMARY KEY (aid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'aggregator_category'
---
-
-CREATE TABLE aggregator_category (
-  cid int(10) NOT NULL auto_increment,
-  title varchar(255) NOT NULL default '',
-  description longtext NOT NULL,
-  block tinyint(2) NOT NULL default '0',
-  PRIMARY KEY (cid),
-  UNIQUE KEY title (title)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'aggregator_category_feed'
---
-
-CREATE TABLE aggregator_category_feed (
-  fid int(10) NOT NULL default '0',
-  cid int(10) NOT NULL default '0',
-  PRIMARY KEY (fid,cid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'aggregator_category_item'
---
-
-CREATE TABLE aggregator_category_item (
-  iid int(10) NOT NULL default '0',
-  cid int(10) NOT NULL default '0',
-  PRIMARY KEY (iid,cid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'aggregator_feed'
---
-
-CREATE TABLE aggregator_feed (
-  fid int(10) NOT NULL auto_increment,
-  title varchar(255) NOT NULL default '',
-  url varchar(255) NOT NULL default '',
-  refresh int(10) NOT NULL default '0',
-  checked int(10) NOT NULL default '0',
-  link varchar(255) NOT NULL default '',
-  description longtext NOT NULL,
-  image longtext NOT NULL,
-  etag varchar(255) NOT NULL default '',
-  modified int(10) NOT NULL default '0',
-  block tinyint(2) NOT NULL default '0',
-  PRIMARY KEY (fid),
-  UNIQUE KEY link (url),
-  UNIQUE KEY title (title)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'aggregator_item'
---
-
-CREATE TABLE aggregator_item (
-  iid int(10) NOT NULL auto_increment,
-  fid int(10) NOT NULL default '0',
-  title varchar(255) NOT NULL default '',
-  link varchar(255) NOT NULL default '',
-  author varchar(255) NOT NULL default '',
-  description longtext NOT NULL,
-  timestamp int(11) default NULL,
-  PRIMARY KEY (iid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'authmap'
---
-
-CREATE TABLE authmap (
-  aid int(10) unsigned NOT NULL auto_increment,
-  uid int(10) NOT NULL default '0',
-  authname varchar(128) NOT NULL default '',
-  module varchar(128) NOT NULL default '',
-  PRIMARY KEY (aid),
-  UNIQUE KEY authname (authname)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'blocks'
---
-
-CREATE TABLE blocks (
-  module varchar(64) DEFAULT '' NOT NULL,
-  delta varchar(32) NOT NULL default '0',
-  theme varchar(255) NOT NULL default '',
-  status tinyint(2) DEFAULT '0' NOT NULL,
-  weight tinyint(1) DEFAULT '0' NOT NULL,
-  region varchar(64) DEFAULT 'left' NOT NULL,
-  custom tinyint(2) DEFAULT '0' NOT NULL,
-  throttle tinyint(1) DEFAULT '0' NOT NULL,
-  visibility tinyint(1) DEFAULT '0' NOT NULL,
-  pages text DEFAULT '' NOT NULL
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'book'
---
-
-CREATE TABLE book (
-  vid int(10) unsigned NOT NULL default '0',
-  nid int(10) unsigned NOT NULL default '0',
-  parent int(10) NOT NULL default '0',
-  weight tinyint(3) NOT NULL default '0',
-  PRIMARY KEY (vid),
-  KEY nid (nid),
-  KEY parent (parent)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'boxes'
---
-
-CREATE TABLE boxes (
-  bid tinyint(4) NOT NULL auto_increment,
-  title varchar(64) NOT NULL default '',
-  body longtext,
-  info varchar(128) NOT NULL default '',
-  format int(4) NOT NULL default '0',
-  PRIMARY KEY (bid),
-  UNIQUE KEY info (info)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'cache'
---
-
-CREATE TABLE cache (
-  cid varchar(255) NOT NULL default '',
-  data longblob,
-  expire int(11) NOT NULL default '0',
-  created int(11) NOT NULL default '0',
-  headers text,
-  PRIMARY KEY (cid),
-  INDEX expire (expire)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'comments'
---
-
-CREATE TABLE comments (
-  cid int(10) NOT NULL auto_increment,
-  pid int(10) NOT NULL default '0',
-  nid int(10) NOT NULL default '0',
-  uid int(10) NOT NULL default '0',
-  subject varchar(64) NOT NULL default '',
-  comment longtext NOT NULL,
-  hostname varchar(128) NOT NULL default '',
-  timestamp int(11) NOT NULL default '0',
-  score mediumint(9) NOT NULL default '0',
-  status tinyint(3) unsigned NOT NULL default '0',
-  format int(4) NOT NULL default '0',
-  thread varchar(255) NOT NULL,
-  users longtext,
-  name varchar(60) default NULL,
-  mail varchar(64) default NULL,
-  homepage varchar(255) default NULL,
-  PRIMARY KEY (cid),
-  KEY lid (nid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structre for table 'contact'
---
-
-CREATE TABLE contact (
-  cid int(10) unsigned NOT NULL auto_increment,
-  category varchar(255) NOT NULL default '',
-  recipients longtext NOT NULL default '',
-  reply longtext NOT NULL default '',
-  weight tinyint(3) NOT NULL default '0',
-  selected tinyint(1) NOT NULL default '0',
-  PRIMARY KEY (cid),
-  UNIQUE KEY category (category)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structre for table 'node_comment_statistics'
---
-
-CREATE TABLE node_comment_statistics (
-  nid int(10) unsigned NOT NULL auto_increment,
-  last_comment_timestamp int(11) NOT NULL default '0',
-  last_comment_name varchar(60) default NULL,
-  last_comment_uid int(10) NOT NULL default '0',
-  comment_count int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY (nid),
-  KEY node_comment_timestamp (last_comment_timestamp)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'client'
---
-
-CREATE TABLE client (
-  cid int(10) unsigned NOT NULL auto_increment,
-  link varchar(255) NOT NULL default '',
-  name varchar(128) NOT NULL default '',
-  mail varchar(128) NOT NULL default '',
-  slogan longtext NOT NULL,
-  mission longtext NOT NULL,
-  users int(10) NOT NULL default '0',
-  nodes int(10) NOT NULL default '0',
-  version varchar(35) NOT NULL default'',
-  created int(11) NOT NULL default '0',
-  changed int(11) NOT NULL default '0',
-  PRIMARY KEY (cid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'client_system'
---
-
-CREATE TABLE client_system (
-  cid int(10) NOT NULL default '0',
-  name varchar(255) NOT NULL default '',
-  type varchar(255) NOT NULL default '',
-  PRIMARY KEY (cid,name)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'files'
---
-
-CREATE TABLE files (
-  fid int(10) unsigned NOT NULL default 0,
-  nid int(10) unsigned NOT NULL default 0,
-  filename varchar(255) NOT NULL default '',
-  filepath varchar(255) NOT NULL default '',
-  filemime varchar(255) NOT NULL default '',
-  filesize int(10) unsigned NOT NULL default 0,
-  PRIMARY KEY (fid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'file_revisions'
---
-
-CREATE TABLE file_revisions (
-  fid int(10) unsigned NOT NULL default 0,
-  vid int(10) unsigned NOT NULL default 0,
-  description varchar(255) NOT NULL default '',
-  list tinyint(1) unsigned NOT NULL default 0,
-  PRIMARY KEY (fid, vid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'filter_formats'
---
-
-CREATE TABLE filter_formats (
-  format int(4) NOT NULL auto_increment,
-  name varchar(255) NOT NULL default '',
-  roles varchar(255) NOT NULL default '',
-  cache tinyint(2) NOT NULL default '0',
-  PRIMARY KEY (format),
-  UNIQUE KEY (name)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'filters'
---
-
-CREATE TABLE filters (
-  format int(4) NOT NULL default '0',
-  module varchar(64) NOT NULL default '',
-  delta tinyint(2) DEFAULT '0' NOT NULL,
-  weight tinyint(2) DEFAULT '0' NOT NULL,
-  INDEX (weight)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'flood'
---
-
-CREATE TABLE flood (
-  event varchar(64) NOT NULL default '',
-  hostname varchar(128) NOT NULL default '',
-  timestamp int(11) NOT NULL default '0'
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'forum'
---
-
-CREATE TABLE forum (
-  nid int(10) unsigned NOT NULL default '0',
-  vid int(10) unsigned NOT NULL default '0',
-  tid int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY (vid),
-  KEY nid (nid),
-  KEY tid (tid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'history'
---
-
-CREATE TABLE history (
-  uid int(10) NOT NULL default '0',
-  nid int(10) NOT NULL default '0',
-  timestamp int(11) NOT NULL default '0',
-  PRIMARY KEY (uid,nid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'locales_meta'
---
-
-CREATE TABLE locales_meta (
-  locale varchar(12) NOT NULL default '',
-  name varchar(64) NOT NULL default '',
-  enabled int(2) NOT NULL default '0',
-  isdefault int(2) NOT NULL default '0',
-  plurals int(1) NOT NULL default '0',
-  formula varchar(128) NOT NULL default '',
-  PRIMARY KEY (locale)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'locales_source'
---
-
-CREATE TABLE locales_source (
-  lid int(11) NOT NULL auto_increment,
-  location varchar(255) NOT NULL default '',
-  source blob NOT NULL,
-  PRIMARY KEY (lid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'locales_target'
---
-
-CREATE TABLE locales_target (
-  lid int(11) NOT NULL default '0',
-  translation blob NOT NULL,
-  locale varchar(12) NOT NULL default '',
-  plid int(11) NOT NULL default '0',
-  plural int(1) NOT NULL default '0',
-  KEY lid (lid),
-  KEY lang (locale),
-  KEY plid (plid),
-  KEY plural (plural)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'menu'
---
-
-CREATE TABLE menu (
-  mid int(10) unsigned NOT NULL default '0',
-  pid int(10) unsigned NOT NULL default '0',
-  path varchar(255) NOT NULL default '',
-  title varchar(255) NOT NULL default '',
-  description varchar(255) NOT NULL default '',
-  weight tinyint(4) NOT NULL default '0',
-  type int(2) unsigned NOT NULL default '0',
-  PRIMARY KEY (mid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'node'
---
-
-CREATE TABLE node (
-  nid int(10) unsigned NOT NULL auto_increment,
-  vid int(10) unsigned NOT NULL default '0',
-  type varchar(32) NOT NULL default '',
-  title varchar(128) NOT NULL default '',
-  uid int(10) NOT NULL default '0',
-  status int(4) NOT NULL default '1',
-  created int(11) NOT NULL default '0',
-  changed int(11) NOT NULL default '0',
-  comment int(2) NOT NULL default '0',
-  promote int(2) NOT NULL default '0',
-  moderate int(2) NOT NULL default '0',
-  sticky int(2) NOT NULL default '0',
-  PRIMARY KEY  (nid, vid),
-  UNIQUE KEY vid (vid),
-  KEY node_type (type(4)),
-  KEY node_title_type (title, type(4)),
-  KEY status (status),
-  KEY uid (uid),
-  KEY node_moderate (moderate),
-  KEY node_promote_status (promote, status),
-  KEY node_created (created),
-  KEY node_changed (changed),
-  KEY node_status_type (status, type, nid),
-  KEY nid (nid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table `node_access`
---
-
-CREATE TABLE node_access (
-  nid int(10) unsigned NOT NULL default '0',
-  gid int(10) unsigned NOT NULL default '0',
-  realm varchar(255) NOT NULL default '',
-  grant_view tinyint(1) unsigned NOT NULL default '0',
-  grant_update tinyint(1) unsigned NOT NULL default '0',
-  grant_delete tinyint(1) unsigned NOT NULL default '0',
-  PRIMARY KEY (nid,gid,realm)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'node_revisions'
---
-
-CREATE TABLE node_revisions (
-  nid int(10) unsigned NOT NULL,
-  vid int(10) unsigned NOT NULL,
-  uid int(10) NOT NULL default '0',
-  title varchar(128) NOT NULL default '',
-  body longtext NOT NULL default '',
-  teaser longtext NOT NULL default '',
-  log longtext NOT NULL default '',
-  timestamp int(11) NOT NULL default '0',
-  format int(4) NOT NULL default '0',
-  PRIMARY KEY  (vid),
-  KEY nid (nid),
-  KEY uid (uid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'profile_fields'
---
-
-CREATE TABLE profile_fields (
-  fid int(10) NOT NULL auto_increment,
-  title varchar(255) default NULL,
-  name varchar(128) default NULL,
-  explanation TEXT default NULL,
-  category varchar(255) default NULL,
-  page varchar(255) default NULL,
-  type varchar(128) default NULL,
-  weight tinyint(1) DEFAULT '0' NOT NULL,
-  required tinyint(1) DEFAULT '0' NOT NULL,
-  register tinyint(1) DEFAULT '0' NOT NULL,
-  visibility tinyint(1) DEFAULT '0' NOT NULL,
-  autocomplete tinyint(1) DEFAULT '0' NOT NULL,
-  options text,
-  KEY category (category),
-  UNIQUE KEY name (name),
-  PRIMARY KEY (fid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'profile_values'
---
-
-CREATE TABLE profile_values (
-  fid int(10) unsigned default '0',
-  uid int(10) unsigned default '0',
-  value text,
-  KEY uid (uid),
-  KEY fid (fid)
-)
-DEFAULT CHARACTER SET utf8;
-
-
---
--- Table structure for table 'url_alias'
---
-
-CREATE TABLE url_alias (
-  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 dst (dst),
-  KEY src (src)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'permission'
---
-
-CREATE TABLE permission (
-  rid int(10) unsigned NOT NULL default '0',
-  perm longtext,
-  tid int(10) unsigned NOT NULL default '0',
-  KEY rid (rid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'poll'
---
-
-CREATE TABLE poll (
-  nid int(10) unsigned NOT NULL default '0',
-  runtime int(10) NOT NULL default '0',
-  active int(2) unsigned NOT NULL default '0',
-  PRIMARY KEY (nid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'poll_votes'
---
-
-CREATE TABLE poll_votes (
-  nid int(10) unsigned NOT NULL,
-  uid int(10) unsigned NOT NULL default 0,
-  hostname varchar(128) NOT NULL default '',
-  INDEX (nid),
-  INDEX (uid),
-  INDEX (hostname)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'poll_choices'
---
-
-CREATE TABLE poll_choices (
-  chid int(10) unsigned NOT NULL auto_increment,
-  nid int(10) unsigned NOT NULL default '0',
-  chtext varchar(128) NOT NULL default '',
-  chvotes int(6) NOT NULL default '0',
-  chorder int(2) NOT NULL default '0',
-  PRIMARY KEY (chid),
-  KEY nid (nid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'role'
---
-
-CREATE TABLE role (
-  rid int(10) unsigned NOT NULL auto_increment,
-  name varchar(32) NOT NULL default '',
-  PRIMARY KEY (rid),
-  UNIQUE KEY name (name)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'search_dataset'
---
-CREATE TABLE search_dataset (
-  sid int(10) unsigned NOT NULL default '0',
-  type varchar(16) default NULL,
-  data longtext NOT NULL,
-  KEY sid_type (sid, type)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'search_index'
---
-
-CREATE TABLE search_index (
-  word varchar(50) NOT NULL default '',
-  sid int(10) unsigned NOT NULL default '0',
-  type varchar(16) default NULL,
-  fromsid int(10) unsigned NOT NULL default '0',
-  fromtype varchar(16) default NULL,
-  score float default NULL,
-  KEY sid_type (sid, type),
-  KEY from_sid_type (fromsid, fromtype),
-  KEY word (word)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'search_total'
---
-
-CREATE TABLE search_total (
-  word varchar(50) NOT NULL default '',
-  count float default NULL,
-  PRIMARY KEY (word)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'sessions'
---
-
-
-CREATE TABLE 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',
-  cache int(11) NOT NULL default '0',
-  session longtext,
-  KEY uid (uid),
-  PRIMARY KEY (sid),
-  KEY timestamp (timestamp)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'sequences'
---
-
-CREATE TABLE sequences (
-  name varchar(255) NOT NULL default '',
-  id int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY (name)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'node_counter'
---
-
-CREATE TABLE node_counter (
-  nid int(10) NOT NULL default '0',
-  totalcount bigint(20) unsigned NOT NULL default '0',
-  daycount mediumint(8) unsigned NOT NULL default '0',
-  timestamp int(11) unsigned NOT NULL default '0',
-  PRIMARY KEY (nid),
-  KEY totalcount (totalcount),
-  KEY daycount (daycount),
-  KEY timestamp (timestamp)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'system'
---
-
-CREATE TABLE system (
-  filename varchar(255) NOT NULL default '',
-  name varchar(255) NOT NULL default '',
-  type varchar(255) NOT NULL default '',
-  description varchar(255) NOT NULL default '',
-  status int(2) NOT NULL default '0',
-  throttle tinyint(1) DEFAULT '0' NOT NULL,
-  bootstrap int(2) NOT NULL default '0',
-  schema_version smallint(3) NOT NULL default -1,
-  weight int(2) NOT NULL default '0',
-  PRIMARY KEY (filename),
-  KEY (weight)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'term_data'
---
-
-CREATE TABLE term_data (
-  tid int(10) unsigned NOT NULL auto_increment,
-  vid int(10) unsigned NOT NULL default '0',
-  name varchar(255) NOT NULL default '',
-  description longtext,
-  weight tinyint(4) NOT NULL default '0',
-  PRIMARY KEY (tid),
-  KEY vid (vid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'term_hierarchy'
---
-
-CREATE TABLE term_hierarchy (
-  tid int(10) unsigned NOT NULL default '0',
-  parent int(10) unsigned NOT NULL default '0',
-  KEY tid (tid),
-  KEY parent (parent),
-  PRIMARY KEY (tid, parent)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'term_node'
---
-
-CREATE TABLE term_node (
-  nid int(10) unsigned NOT NULL default '0',
-  tid int(10) unsigned NOT NULL default '0',
-  KEY nid (nid),
-  KEY tid (tid),
-  PRIMARY KEY (tid,nid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'term_relation'
---
-
-CREATE TABLE term_relation (
-  tid1 int(10) unsigned NOT NULL default '0',
-  tid2 int(10) unsigned NOT NULL default '0',
-  KEY tid1 (tid1),
-  KEY tid2 (tid2)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'term_synonym'
---
-
-CREATE TABLE term_synonym (
-  tid int(10) unsigned NOT NULL default '0',
-  name varchar(255) NOT NULL default '',
-  KEY tid (tid),
-  KEY name (name(3))
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'users'
---
-
-CREATE TABLE users (
-  uid int(10) unsigned NOT NULL default '0',
-  name varchar(60) NOT NULL default '',
-  pass varchar(32) NOT NULL default '',
-  mail varchar(64) default '',
-  mode tinyint(1) NOT NULL default '0',
-  sort tinyint(1) default '0',
-  threshold tinyint(1) default '0',
-  theme varchar(255) NOT NULL default '',
-  signature varchar(255) NOT NULL default '',
-  created int(11) NOT NULL default '0',
-  access int(11) NOT NULL default '0',
-  login int(11) NOT NULL default '0',
-  status tinyint(4) NOT NULL default '0',
-  timezone varchar(8) default NULL,
-  language varchar(12) NOT NULL default '',
-  picture varchar(255) NOT NULL DEFAULT '',
-  init varchar(64) default '',
-  data longtext,
-  PRIMARY KEY (uid),
-  UNIQUE KEY name (name),
-  KEY access (access)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'users_roles'
---
-
-CREATE TABLE users_roles (
-  uid int(10) unsigned NOT NULL default '0',
-  rid int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY (uid, rid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'variable'
---
-
-CREATE TABLE variable (
-  name varchar(48) NOT NULL default '',
-  value longtext NOT NULL,
-  PRIMARY KEY (name)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'vocabulary'
---
-
-CREATE TABLE vocabulary (
-  vid int(10) unsigned NOT NULL auto_increment,
-  name varchar(255) NOT NULL default '',
-  description longtext,
-  help varchar(255) NOT NULL default '',
-  relations tinyint(3) unsigned NOT NULL default '0',
-  hierarchy tinyint(3) unsigned NOT NULL default '0',
-  multiple tinyint(3) unsigned NOT NULL default '0',
-  required tinyint(3) unsigned NOT NULL default '0',
-  tags tinyint(3) unsigned NOT NULL default '0',
-  module varchar(255) NOT NULL default '',
-  weight tinyint(4) NOT NULL default '0',
-  PRIMARY KEY (vid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'vocabulary_node_types'
---
-
-CREATE TABLE vocabulary_node_types (
-  vid int(10) unsigned NOT NULL DEFAULT '0',
-  type varchar(32) NOT NULL DEFAULT '',
-  PRIMARY KEY (vid, type)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Table structure for table 'watchdog'
---
-
-CREATE TABLE watchdog (
-  wid int(5) NOT NULL auto_increment,
-  uid int(10) NOT NULL default '0',
-  type varchar(16) NOT NULL default '',
-  message longtext NOT NULL,
-  severity tinyint(3) unsigned NOT NULL default '0',
-  link varchar(255) NOT NULL default '',
-  location varchar(128) NOT NULL default '',
-  referer varchar(128) NOT NULL default '',
-  hostname varchar(128) NOT NULL default '',
-  timestamp int(11) NOT NULL default '0',
-  PRIMARY KEY (wid)
-)
-DEFAULT CHARACTER SET utf8;
-
---
--- Insert some default values
---
-
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/block.module', 'block', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/comment.module', 'comment', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/filter.module', 'filter', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/help.module', 'help', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/menu.module', 'menu', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/node.module', 'node', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/page.module', 'page', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/story.module', 'story', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/system.module', 'system', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/taxonomy.module', 'taxonomy', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/user.module', 'user', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/watchdog.module', 'watchdog', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/engines/phptemplate/phptemplate.engine', 'phptemplate', 'theme_engine', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/bluemarine/page.tpl.php', 'bluemarine', 'theme', 'themes/engines/phptemplate/phptemplate.engine', 1, 0, 0, 0);
-INSERT INTO users (uid, name, mail) VALUES ('0', '', '');
-
-INSERT INTO role (rid, name) VALUES (1, 'anonymous user');
-INSERT INTO role (rid, name) VALUES (2, 'authenticated user');
-
-INSERT INTO permission VALUES (1,'access content',0);
-INSERT INTO permission VALUES (2,'access comments, access content, post comments, post comments without approval',0);
-
-INSERT INTO variable (name, value) VALUES ('theme_default', 's:10:"bluemarine";');
-
-INSERT INTO blocks (module, delta, theme, status, pages) VALUES ('user', '0', 'bluemarine', '1', '');
-INSERT INTO blocks (module, delta, theme, status, pages) VALUES ('user', '1', 'bluemarine', '1', '');
-
-INSERT INTO sequences (name, id) VALUES ('menu_mid', 2);
-
-INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);
-
-INSERT INTO filter_formats VALUES (1,'Filtered HTML',',1,2,',1);
-INSERT INTO filter_formats VALUES (2,'PHP code','',0);
-INSERT INTO filter_formats VALUES (3,'Full HTML','',1);
-INSERT INTO filters VALUES (1,'filter',0,0);
-INSERT INTO filters VALUES (1,'filter',2,1);
-INSERT INTO filters VALUES (2,'filter',1,0);
-INSERT INTO filters VALUES (3,'filter',2,0);
-INSERT INTO variable (name,value) VALUES ('filter_html_1','i:1;');
-
-INSERT INTO locales_meta (locale, name, enabled, isdefault) VALUES ('en', 'English', '1', '1');
-
-INSERT INTO variable (name, value) VALUES ('node_options_forum', 'a:1:{i:0;s:6:"status";}');
-
-INSERT INTO menu VALUES (2, 0, '', 'Primary links', '', 0, 115);
-INSERT INTO variable VALUES ('menu_primary_menu', 'i:2;');
-INSERT INTO variable VALUES ('menu_secondary_menu', 'i:2;');
-
diff --git a/database/database.pgsql b/database/database.pgsql
deleted file mode 100644 (file)
index ef00e82..0000000
+++ /dev/null
@@ -1,915 +0,0 @@
--- $Id: database.pgsql 144 2007-03-28 07:52:20Z thierry $
-
--- Do not show NOTICE: messages, it's hard to spot errors.
-set client_min_messages = 'warning';
-
---
--- Table structure for access
---
-
-CREATE TABLE access (
-  aid SERIAL,
-  mask varchar(255) NOT NULL default '',
-  type varchar(255) NOT NULL default '',
-  status smallint NOT NULL default '0',
-  PRIMARY KEY (aid)
-);
-
---
--- Table structure for accesslog
---
-
-CREATE TABLE accesslog (
-  aid SERIAL,
-  sid varchar(32) NOT NULL default '',
-  title varchar(255) default NULL,
-  path text default NULL,
-  url text default NULL,
-  hostname varchar(128) default NULL,
-  uid integer default '0',
-  timer integer NOT NULL default '0',
-  timestamp integer NOT NULL default '0',
-  PRIMARY KEY (aid)
-);
-CREATE INDEX accesslog_timestamp_idx ON accesslog (timestamp);
-
---
--- Table structure for table 'aggregator_category'
---
-
-CREATE TABLE aggregator_category (
-  cid serial,
-  title varchar(255) NOT NULL default '',
-  description text,
-  block smallint NOT NULL default '0',
-  PRIMARY KEY (cid),
-  UNIQUE (title)
-);
-
---
--- Table structure for table 'aggregator_category_feed'
---
-
-CREATE TABLE aggregator_category_feed (
-  fid integer NOT NULL default '0',
-  cid integer NOT NULL default '0',
-  PRIMARY KEY (fid,cid)
-);
-
---
--- Table structure for table 'aggregator_category_item'
---
-
-CREATE TABLE aggregator_category_item (
-  iid integer NOT NULL default '0',
-  cid integer NOT NULL default '0',
-  PRIMARY KEY (iid,cid)
-);
-
---
--- Table structure for table 'aggregator_feed'
---
-
-CREATE TABLE aggregator_feed (
-  fid serial,
-  title varchar(255) NOT NULL default '',
-  url varchar(255) NOT NULL default '',
-  refresh integer NOT NULL default '0',
-  checked integer NOT NULL default '0',
-  link varchar(255) NOT NULL default '',
-  description text,
-  image text,
-  etag varchar(255) NOT NULL default '',
-  modified integer NOT NULL default '0',
-  block smallint NOT NULL default '0',
-  PRIMARY KEY (fid),
-  UNIQUE (url),
-  UNIQUE (title)
-);
-
---
--- Table structure for table 'aggregator_item'
---
-
-CREATE TABLE aggregator_item (
-  iid SERIAL,
-  fid integer NOT NULL default '0',
-  title varchar(255) NOT NULL default '',
-  link varchar(255) NOT NULL default '',
-  author varchar(255) NOT NULL default '',
-  description text,
-  timestamp integer default NULL,
-  PRIMARY KEY (iid)
-);
-
---
--- Table structure for authmap
---
-
-CREATE TABLE authmap (
-  aid SERIAL,
-  uid integer NOT NULL default '0',
-  authname varchar(128) NOT NULL default '',
-  module varchar(128) NOT NULL default '',
-  PRIMARY KEY (aid),
-  UNIQUE (authname)
-);
-
---
--- Table structure for blocks
---
-
-CREATE TABLE blocks (
-  module varchar(64) NOT NULL default '',
-  delta varchar(32) NOT NULL default '0',
-  theme varchar(255) NOT NULL default '',
-  status smallint NOT NULL default '0',
-  weight smallint NOT NULL default '0',
-  region varchar(64) DEFAULT 'left' NOT NULL,
-  custom smallint NOT NULL default '0',
-  throttle smallint NOT NULL default '0',
-  visibility smallint NOT NULL default '0',
-  pages text NOT NULL default ''
-);
-
---
--- Table structure for book
---
-
-CREATE TABLE book (
-  vid integer NOT NULL default '0',
-  nid integer NOT NULL default '0',
-  parent integer NOT NULL default '0',
-  weight smallint NOT NULL default '0',
-  PRIMARY KEY (vid)
-);
-CREATE INDEX book_nid_idx ON book(nid);
-CREATE INDEX book_parent_idx ON book(parent);
-
---
--- Table structure for boxes
---
-
-CREATE TABLE boxes (
-  bid SERIAL,
-  title varchar(64) NOT NULL default '',
-  body text default '',
-  info varchar(128) NOT NULL default '',
-  format smallint NOT NULL default '0',
-  PRIMARY KEY (bid),
-  UNIQUE (info)
-);
-
---
--- Table structure for cache
---
-
-CREATE TABLE cache (
-  cid varchar(255) NOT NULL default '',
-  data bytea default '',
-  expire integer NOT NULL default '0',
-  created integer NOT NULL default '0',
-  headers text default '',
-  PRIMARY KEY (cid)
-);
-CREATE INDEX cache_expire_idx ON cache(expire);
-
---
--- Table structure for comments
---
-
-CREATE TABLE comments (
-  cid SERIAL,
-  pid integer NOT NULL default '0',
-  nid integer NOT NULL default '0',
-  uid integer NOT NULL default '0',
-  subject varchar(64) NOT NULL default '',
-  comment text NOT NULL default '',
-  hostname varchar(128) NOT NULL default '',
-  timestamp integer NOT NULL default '0',
-  score integer NOT NULL default '0',
-  status smallint NOT NULL default '0',
-  format smallint NOT NULL default '0',
-  thread varchar(255) default '',
-  users text default '',
-  name varchar(60) default NULL,
-  mail varchar(64) default NULL,
-  homepage varchar(255) default NULL,
-  PRIMARY KEY (cid)
-);
-CREATE INDEX comments_nid_idx ON comments(nid);
-
---
--- Table structre for table 'contact'
---
-
-CREATE TABLE contact (
-  cid SERIAL,
-  category varchar(255) NOT NULL default '',
-  recipients text NOT NULL default '',
-  reply text NOT NULL default '',
-  weight smallint NOT NULL default '0',
-  selected smallint NOT NULL default '0',
-  PRIMARY KEY (cid),
-  UNIQUE (category)
-);
-
---
--- Table structre for table 'node_comment_statistics'
---
-
-CREATE TABLE node_comment_statistics (
-  nid integer NOT NULL,
-  last_comment_timestamp integer NOT NULL default '0',
-  last_comment_name varchar(60) default NULL,
-  last_comment_uid integer NOT NULL default '0',
-  comment_count integer NOT NULL default '0',
-  PRIMARY KEY (nid)
-);
-CREATE INDEX node_comment_statistics_last_comment_timestamp_idx ON node_comment_statistics(last_comment_timestamp);
-
---
--- Table structure for directory
---
-
-CREATE TABLE client (
-  cid SERIAL,
-  link varchar(255) NOT NULL default '',
-  name varchar(128) NOT NULL default '',
-  mail varchar(128) NOT NULL default '',
-  slogan text NOT NULL default '',
-  mission text NOT NULL default '',
-  users integer NOT NULL default '0',
-  nodes integer NOT NULL default '0',
-  version varchar(35) NOT NULL default'',
-  created integer NOT NULL default '0',
-  changed integer NOT NULL default '0',
-  PRIMARY KEY (cid)
-);
-
---
--- Table structure for table 'client_system'
---
-
-CREATE TABLE client_system (
-  cid integer NOT NULL,
-  name varchar(255) NOT NULL default '',
-  type varchar(255) NOT NULL default '',
-  PRIMARY KEY (cid,name)
-);
-
---
--- Table structure for table 'files'
---
-
-CREATE TABLE files (
-  fid SERIAL,
-  nid integer NOT NULL default 0,
-  filename varchar(255) NOT NULL default '',
-  filepath varchar(255) NOT NULL default '',
-  filemime varchar(255) NOT NULL default '',
-  filesize integer NOT NULL default 0,
-  PRIMARY KEY (fid)
-);
-
---
--- Table structure for table 'file_revisions'
---
-
-CREATE TABLE file_revisions (
-  fid integer NOT NULL default 0,
-  vid integer NOT NULL default 0,
-  description varchar(255) NOT NULL default '',
-  list smallint NOT NULL default 0,
-  PRIMARY KEY (fid, vid)
-);
-
---
--- Table structure for table 'filter_formats'
---
-
-CREATE TABLE filter_formats (
-  format SERIAL,
-  name varchar(255) NOT NULL default '',
-  roles varchar(255) NOT NULL default '',
-  cache smallint NOT NULL default '0',
-  PRIMARY KEY (format),
-  UNIQUE (name)
-);
-
---
--- Table structure for table 'filters'
---
-
-CREATE TABLE filters (
-  format integer NOT NULL DEFAULT '0',
-  module varchar(64) NOT NULL DEFAULT '',
-  delta smallint NOT NULL DEFAULT 0,
-  weight smallint DEFAULT '0' NOT NULL
-);
-CREATE INDEX filters_weight_idx ON filters(weight);
-
---
--- Table structure for table 'flood'
---
-
-CREATE TABLE flood (
-  event varchar(64) NOT NULL default '',
-  hostname varchar(128) NOT NULL default '',
-  timestamp integer NOT NULL default '0'
-);
-
---
--- Table structure for table 'forum'
---
-
-CREATE TABLE forum (
-  nid integer NOT NULL default '0',
-  vid integer NOT NULL default '0',
-  tid integer NOT NULL default '0',
-  PRIMARY KEY (vid)
-);
-CREATE INDEX forum_tid_idx ON forum(tid);
-CREATE INDEX forum_nid_idx ON forum(nid);
-
---
--- Table structure for history
---
-
-CREATE TABLE history (
-  uid integer NOT NULL default '0',
-  nid integer NOT NULL default '0',
-  timestamp integer NOT NULL default '0',
-  PRIMARY KEY (uid,nid)
-);
-
---
--- Table structure for locales_meta
---
-
-CREATE TABLE locales_meta (
-  locale varchar(12) NOT NULL default '',
-  name varchar(64) NOT NULL default '',
-  enabled int4 NOT NULL default '0',
-  isdefault int4 NOT NULL default '0',
-  plurals int4 NOT NULL default '0',
-  formula varchar(128) NOT NULL default '',
-  PRIMARY KEY (locale)
-);
-
---
--- Table structure for locales_source
---
-
-
-CREATE TABLE locales_source (
-  lid SERIAL,
-  location varchar(255) NOT NULL default '',
-  source text NOT NULL,
-  PRIMARY KEY (lid)
-);
-
---
--- Table structure for locales_target
---
-
-CREATE TABLE locales_target (
-  lid int4 NOT NULL default '0',
-  translation text DEFAULT '' NOT NULL,
-  locale varchar(12) NOT NULL default '',
-  plid int4 NOT NULL default '0',
-  plural int4 NOT NULL default '0'
-);
-CREATE INDEX locales_target_lid_idx ON locales_target(lid);
-CREATE INDEX locales_target_locale_idx ON locales_target(locale);
-CREATE INDEX locales_target_plid_idx ON locales_target(plid);
-CREATE INDEX locales_target_plural_idx ON locales_target(plural);
-
---
--- Table structure for table 'menu'
---
-
-
-CREATE SEQUENCE menu_mid_seq START 2;
-CREATE TABLE menu (
-  mid integer NOT NULL DEFAULT nextval('menu_mid_seq'),
-  pid integer NOT NULL default '0',
-  path varchar(255) NOT NULL default '',
-  title varchar(255) NOT NULL default '',
-  description varchar(255) NOT NULL default '',
-  weight smallint NOT NULL default '0',
-  type smallint NOT NULL default '0',
-  PRIMARY KEY (mid)
-);
-
---
--- Table structure for node
---
-
-CREATE TABLE node (
-  nid SERIAL,
-  vid integer NOT NULL default '0',
-  type varchar(32) NOT NULL default '',
-  title varchar(128) NOT NULL default '',
-  uid integer NOT NULL default '0',
-  status integer NOT NULL default '1',
-  created integer NOT NULL default '0',
-  changed integer NOT NULL default '0',
-  comment integer NOT NULL default '0',
-  promote integer NOT NULL default '0',
-  moderate integer NOT NULL default '0',
-  sticky integer NOT NULL default '0',
-  PRIMARY KEY (nid, vid)
-);
-CREATE INDEX node_nid_idx ON node(nid);
-CREATE INDEX node_type_idx ON node(type);
-CREATE INDEX node_title_type_idx ON node(title,type);
-CREATE INDEX node_status_idx ON node(status);
-CREATE INDEX node_uid_idx ON node(uid);
-CREATE UNIQUE INDEX node_vid_idx ON node(vid);
-CREATE INDEX node_moderate_idx ON node (moderate);
-CREATE INDEX node_promote_status_idx ON node (promote, status);
-CREATE INDEX node_created_idx ON node(created);
-CREATE INDEX node_changed_idx ON node(changed);
-CREATE INDEX node_status_type_nid_idx ON node(status,type,nid);
-
---
--- Table structure for table `node_access`
---
-
-CREATE TABLE node_access (
-  nid SERIAL,
-  gid integer NOT NULL default '0',
-  realm varchar(255) NOT NULL default '',
-  grant_view smallint NOT NULL default '0',
-  grant_update smallint NOT NULL default '0',
-  grant_delete smallint NOT NULL default '0',
-  PRIMARY KEY (nid,gid,realm)
-);
-
---
--- Table structure for table 'node_revisions'
---
-
-CREATE TABLE node_revisions (
-  nid integer NOT NULL default '0',
-  vid integer NOT NULL default '0',
-  uid integer NOT NULL default '0',
-  title varchar(128) NOT NULL default '',
-  body text NOT NULL default '',
-  teaser text NOT NULL default '',
-  log text NOT NULL default '',
-  timestamp integer NOT NULL default '0',
-  format int NOT NULL default '0',
-  PRIMARY KEY  (vid)
-);
-CREATE INDEX node_revisions_nid_idx ON node_revisions(nid);
-CREATE INDEX node_revisions_uid_idx ON node_revisions(uid);
-CREATE SEQUENCE node_revisions_vid_seq INCREMENT 1 START 1;
-
---
--- Table structure for table 'url_alias'
---
-
-CREATE TABLE profile_fields (
-  fid serial,
-  title varchar(255) default NULL,
-  name varchar(128) default NULL,
-  explanation TEXT default NULL,
-  category varchar(255) default NULL,
-  page varchar(255) default NULL,
-  type varchar(128) default NULL,
-  weight smallint DEFAULT '0' NOT NULL,
-  required smallint DEFAULT '0' NOT NULL,
-  register smallint DEFAULT '0' NOT NULL,
-  visibility smallint DEFAULT '0' NOT NULL,
-  autocomplete smallint DEFAULT '0' NOT NULL,
-  options text,
-  UNIQUE (name),
-  PRIMARY KEY (fid)
-);
-CREATE INDEX profile_fields_category_idx ON profile_fields (category);
-
---
--- Table structure for table 'profile_values'
---
-
-CREATE TABLE profile_values (
-  fid integer default '0',
-  uid integer default '0',
-  value text
-);
-CREATE INDEX profile_values_uid ON profile_values (uid);
-CREATE INDEX profile_values_fid ON profile_values (fid);
-
-CREATE TABLE url_alias (
-  pid serial,
-  src varchar(128) NOT NULL default '',
-  dst varchar(128) NOT NULL default '',
-  PRIMARY KEY (pid)
-);
-CREATE UNIQUE INDEX url_alias_dst_idx ON url_alias(dst);
-CREATE INDEX url_alias_src_idx ON url_alias(src);
-
---
--- Table structure for permission
---
-
-CREATE TABLE permission (
-  rid integer NOT NULL default '0',
-  perm text default '',
-  tid integer NOT NULL default '0'
-);
-CREATE INDEX permission_rid_idx ON permission(rid);
-
---
--- Table structure for poll
---
-
-CREATE TABLE poll (
-  nid integer NOT NULL default '0',
-  runtime integer NOT NULL default '0',
-  active integer NOT NULL default '0',
-  PRIMARY KEY (nid)
-);
-
---
--- Table structure for poll_votes
---
-
-CREATE TABLE poll_votes (
-  nid int NOT NULL,
-  uid int NOT NULL default 0,
-  hostname varchar(128) NOT NULL default ''
-);
-CREATE INDEX poll_votes_nid_idx ON poll_votes (nid);
-CREATE INDEX poll_votes_uid_idx ON poll_votes (uid);
-CREATE INDEX poll_votes_hostname_idx ON poll_votes (hostname);
-
---
--- Table structure for poll_choices
---
-
-CREATE TABLE poll_choices (
-  chid SERIAL,
-  nid integer NOT NULL default '0',
-  chtext varchar(128) NOT NULL default '',
-  chvotes integer NOT NULL default '0',
-  chorder integer NOT NULL default '0',
-  PRIMARY KEY (chid)
-);
-CREATE INDEX poll_choices_nid_idx ON poll_choices(nid);
-
---
--- Table structure for role
---
-
-CREATE TABLE role (
-  rid SERIAL,
-  name varchar(32) NOT NULL default '',
-  PRIMARY KEY (rid),
-  UNIQUE (name)
-);
-
---
--- Table structure for table 'search_dataset'
---
-CREATE TABLE search_dataset (
-  sid integer NOT NULL default '0',
-  type varchar(16) default NULL,
-  data text NOT NULL default ''
-);
-CREATE INDEX search_dataset_sid_type_idx ON search_dataset(sid, type);
-
---
--- Table structure for search_index
---
-
-CREATE TABLE search_index (
-  word varchar(50) NOT NULL default '',
-  sid integer NOT NULL default '0',
-  type varchar(16) default NULL,
-  fromsid integer NOT NULL default '0',
-  fromtype varchar(16) default NULL,
-  score float default NULL
-);
-CREATE INDEX search_index_sid_type_idx ON search_index(sid, type);
-CREATE INDEX search_index_fromsid_fromtype_idx ON search_index(fromsid, fromtype);
-CREATE INDEX search_index_word_idx ON search_index(word);
-
---
--- Table structures for search_total
---
-
-CREATE TABLE search_total (
-  word varchar(50) NOT NULL default '',
-  count float default NULL,
-  PRIMARY KEY(word)
-);
-
---
--- Table structure for sessions
---
-
-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',
-  cache integer NOT NULL default '0',
-  session text,
-  PRIMARY KEY (sid)
-);
-CREATE INDEX sessions_uid_idx ON sessions(uid);
-CREATE INDEX sessions_timestamp_idx ON sessions(timestamp);
-
---
--- Table structure for sequences
--- This is only used under MySQL, co commented out
---
---
--- CREATE TABLE sequences (
---   name varchar(255) NOT NULL,
---   id integer NOT NULL,
---   PRIMARY KEY (name)
--- );
-
---
--- Table structure for table 'node_counter'
---
-
-CREATE TABLE node_counter (
-  nid integer NOT NULL default '0',
-  totalcount integer NOT NULL default '0',
-  daycount integer NOT NULL default '0',
-  timestamp integer NOT NULL default '0',
-  PRIMARY KEY (nid)
-);
-CREATE INDEX node_counter_totalcount_idx ON node_counter(totalcount);
-CREATE INDEX node_counter_daycount_idx ON node_counter(daycount);
-CREATE INDEX node_counter_timestamp_idx ON node_counter(timestamp);
-
---
--- Table structure for system
---
-
-CREATE TABLE system (
-  filename varchar(255) NOT NULL default '',
-  name varchar(255) NOT NULL default '',
-  type varchar(255) NOT NULL default '',
-  description varchar(255) NOT NULL default '',
-  status integer NOT NULL default '0',
-  throttle smallint NOT NULL default '0',
-  bootstrap integer NOT NULL default '0',
-  schema_version smallint NOT NULL default -1,
-  weight smallint NOT NULL default 0,
-  PRIMARY KEY (filename)
-);
-CREATE INDEX system_weight_idx ON system(weight);
-
---
--- Table structure for term_data
---
-
-CREATE TABLE term_data (
-  tid SERIAL,
-  vid integer NOT NULL default '0',
-  name varchar(255) NOT NULL default '',
-  description text default '',
-  weight smallint NOT NULL default '0',
-  PRIMARY KEY (tid)
-);
-CREATE INDEX term_data_vid_idx ON term_data(vid);
-
---
--- Table structure for term_hierarchy
---
-
-CREATE TABLE term_hierarchy (
-  tid integer NOT NULL default '0',
-  parent integer NOT NULL default '0',
-  PRIMARY KEY (tid, parent)
-);
-CREATE INDEX term_hierarchy_tid_idx ON term_hierarchy(tid);
-CREATE INDEX term_hierarchy_parent_idx ON term_hierarchy(parent);
-
---
--- Table structure for term_node
---
-
-CREATE TABLE term_node (
-  nid integer NOT NULL default '0',
-  tid integer NOT NULL default '0',
-  PRIMARY KEY (tid,nid)
-);
-CREATE INDEX term_node_nid_idx ON term_node(nid);
-CREATE INDEX term_node_tid_idx ON term_node(tid);
-
---
--- Table structure for term_relation
---
-
-CREATE TABLE term_relation (
-  tid1 integer NOT NULL default '0',
-  tid2 integer NOT NULL default '0'
-);
-CREATE INDEX term_relation_tid1_idx ON term_relation(tid1);
-CREATE INDEX term_relation_tid2_idx ON term_relation(tid2);
-
---
--- Table structure for term_synonym
---
-
-CREATE TABLE term_synonym (
-  tid integer NOT NULL default '0',
-  name varchar(255) NOT NULL default ''
-);
-CREATE INDEX term_synonym_tid_idx ON term_synonym(tid);
-CREATE INDEX term_synonym_name_idx ON term_synonym(name);
-
---
--- Table structure for users
---
-
-CREATE TABLE users (
-  uid integer NOT NULL default '0',
-  name varchar(60) NOT NULL default '',
-  pass varchar(32) NOT NULL default '',
-  mail varchar(64) default '',
-  mode smallint NOT NULL default '0',
-  sort smallint default '0',
-  threshold smallint default '0',
-  theme varchar(255) NOT NULL default '',
-  signature varchar(255) NOT NULL default '',
-  created integer NOT NULL default '0',
-  access integer NOT NULL default '0',
-  login integer NOT NULL default '0',
-  status smallint NOT NULL default '0',
-  timezone varchar(8) default NULL,
-  language varchar(12) NOT NULL default '',
-  picture varchar(255) NOT NULL DEFAULT '',
-  init varchar(64) default '',
-  data text default '',
-  PRIMARY KEY (uid),
-  UNIQUE (name)
-);
-CREATE INDEX users_access_idx ON users(access);
-
-CREATE SEQUENCE users_uid_seq INCREMENT 1 START 1;
-
---
--- Table structure for users_roles
---
-
-CREATE TABLE users_roles (
-  uid integer NOT NULL default '0',
-  rid integer NOT NULL default '0',
-  PRIMARY KEY (uid, rid)
-);
-
---
--- Table structure for variable
---
-
-CREATE TABLE variable (
-  name varchar(48) NOT NULL default '',
-  value text NOT NULL default '',
-  PRIMARY KEY (name)
-);
-
---
--- Table structure for vocabulary
---
-
-CREATE TABLE vocabulary (
-  vid SERIAL,
-  name varchar(255) NOT NULL default '',
-  description text default '',
-  help varchar(255) NOT NULL default '',
-  relations smallint NOT NULL default '0',
-  hierarchy smallint NOT NULL default '0',
-  multiple smallint NOT NULL default '0',
-  required smallint NOT NULL default '0',
-  tags smallint NOT NULL default '0',
-  module varchar(255) NOT NULL default '',
-  weight smallint NOT NULL default '0',
-  PRIMARY KEY (vid)
-);
-
---
--- Table structure for vocabulary_node_types
---
-
-CREATE TABLE vocabulary_node_types (
-  vid integer NOT NULL default '0',
-  type varchar(32) NOT NULL default '',
-  PRIMARY KEY (vid, type)
-);
-
---
--- Table structure for watchdog
---
-
-CREATE TABLE watchdog (
-  wid SERIAL,
-  uid integer NOT NULL default '0',
-  type varchar(16) NOT NULL default '',
-  message text NOT NULL default '',
-  severity smallint NOT NULL default '0',
-  link text NOT NULL default '',
-  location text NOT NULL default '',
-  referer text NOT NULL default '',
-  hostname varchar(128) NOT NULL default '',
-  timestamp integer NOT NULL default '0',
-  PRIMARY KEY (wid)
-);
-
---
--- Insert some default values
---
-
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/block.module', 'block', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/comment.module', 'comment', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/filter.module', 'filter', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/help.module', 'help', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/menu.module', 'menu', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/node.module', 'node', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/page.module', 'page', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/story.module', 'story', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/system.module', 'system', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/taxonomy.module', 'taxonomy', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/user.module', 'user', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/watchdog.module', 'watchdog', 'module', '', 1, 0, 0, 0);
--- PlanetLab: Enable path and planetlab modules
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/path.module', 'path', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/planetlab.module', 'planetlab', 'module', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/engines/phptemplate/phptemplate.engine', 'phptemplate', 'theme_engine', '', 1, 0, 0, 0);
-INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/bluemarine/page.tpl.php', 'bluemarine', 'theme', 'themes/engines/phptemplate/phptemplate.engine', 1, 0, 0, 0);
-
-INSERT INTO users(uid,name,mail) VALUES(0,'','');
--- PlanetLab: Create a default superuser
-INSERT INTO users(uid,name,mail) VALUES(1,'drupal','');
-
-INSERT INTO role (name) VALUES ('anonymous user');
-INSERT INTO role (name) VALUES ('authenticated user');
-
-INSERT INTO permission VALUES (1,'access content',0);
-INSERT INTO permission VALUES (2,'access comments, access content, post comments, post comments without approval',0);
-
-INSERT INTO variable(name,value) VALUES('theme_default', 's:10:"bluemarine";');
-
--- PlanetLab: Replace default user login block with PlanetLab login block
--- INSERT INTO blocks(module,delta,theme,status) VALUES('user', 0, 'bluemarine', 1);
-INSERT INTO blocks(module,delta,theme,status) VALUES('planetlab', 0, 'bluemarine', 1);
-INSERT INTO blocks(module,delta,theme,status) VALUES('user', 1, 'bluemarine', 1);
-
-INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);
-
-INSERT INTO filter_formats (name, roles, cache) VALUES ('Filtered HTML',',1,2,',1);
-INSERT INTO filter_formats (name, roles, cache) VALUES ('PHP code','',0);
-INSERT INTO filter_formats (name, roles, cache) VALUES ('Full HTML','',1);
-INSERT INTO filters VALUES (1,'filter',0,0);
-INSERT INTO filters VALUES (1,'filter',2,1);
-INSERT INTO filters VALUES (2,'filter',1,0);
-INSERT INTO filters VALUES (3,'filter',2,0);
-INSERT INTO variable (name,value) VALUES ('filter_html_1','i:1;');
-
-INSERT INTO locales_meta (locale, name, enabled, isdefault) VALUES ('en', 'English', '1', '1');
-
-INSERT INTO variable (name, value) VALUES ('node_options_forum', 'a:1:{i:0;s:6:"status";}');
-
-INSERT INTO menu(pid, path, title, description, weight, type) VALUES (0, '', 'Primary links', '', 0, 115);
-INSERT INTO variable VALUES ('menu_primary_menu', 'i:2;');
-INSERT INTO variable VALUES ('menu_secondary_menu', 'i:2;');
-
----
---- Functions
----
-
---- Always installed in 'public' as prefix isn't appended to function names
-SET search_path TO public;
-
-CREATE OR REPLACE FUNCTION "greatest"(numeric, numeric) RETURNS numeric AS '
-  SELECT CASE WHEN (($1 > $2) OR ($2 IS NULL)) THEN $1 ELSE $2 END;
-' LANGUAGE 'sql';
-
-CREATE OR REPLACE FUNCTION "greatest"(numeric, numeric, numeric) RETURNS numeric AS '
-  SELECT greatest($1, greatest($2, $3));
-' LANGUAGE 'sql';
-
-CREATE OR REPLACE FUNCTION "rand"() RETURNS float AS '
-  SELECT random();
-' LANGUAGE 'sql';
-
-CREATE OR REPLACE FUNCTION "concat"(text, text) RETURNS text AS '
-  SELECT $1 || $2;
-' LANGUAGE 'sql';
-
-CREATE OR REPLACE FUNCTION "if"(boolean, text, text) RETURNS text AS '
-  SELECT CASE WHEN $1 THEN $2 ELSE $3 END;
-' LANGUAGE 'sql';
-
-CREATE OR REPLACE FUNCTION "if"(boolean, integer, integer) RETURNS integer AS '
-  SELECT CASE WHEN $1 THEN $2 ELSE $3 END;
-' LANGUAGE 'sql';
-
diff --git a/database/updates.inc b/database/updates.inc
deleted file mode 100644 (file)
index 2b545c3..0000000
+++ /dev/null
@@ -1,2015 +0,0 @@
-<?php
-// $Id: updates.inc 144 2007-03-28 07:52:20Z thierry $
-
-function system_update_110() {
-  $ret = array();
-
-  // TODO: needs PGSQL version
-  if ($GLOBALS['db_type'] == 'mysql') {
-    /*
-    ** Search
-    */
-
-    $ret[] = update_sql('DROP TABLE {search_index}');
-    $ret[] = update_sql("CREATE TABLE {search_index} (
-      word varchar(50) NOT NULL default '',
-      sid int(10) unsigned NOT NULL default '0',
-      type varchar(16) default NULL,
-      fromsid int(10) unsigned NOT NULL default '0',
-      fromtype varchar(16) default NULL,
-      score int(10) unsigned default NULL,
-      KEY sid (sid),
-      KEY fromsid (fromsid),
-      KEY word (word)
-      )");
-
-    $ret[] = update_sql("CREATE TABLE {search_total} (
-      word varchar(50) NOT NULL default '',
-      count int(10) unsigned default NULL,
-      PRIMARY KEY word (word)
-      )");
-
-
-    /*
-    ** Blocks
-    */
-
-    $ret[] = update_sql('ALTER TABLE {blocks} DROP path');
-    $ret[] = update_sql('ALTER TABLE {blocks} ADD visibility tinyint(1) NOT NULL');
-    $ret[] = update_sql('ALTER TABLE {blocks} ADD pages text NOT NULL');
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    /*
-    ** Search
-    */
-    $ret[] = update_sql('DROP TABLE {search_index}');
-    $ret[] = update_sql("CREATE TABLE {search_index} (
-      word varchar(50) NOT NULL default '',
-      sid integer NOT NULL default '0',
-      type varchar(16) default NULL,
-      fromsid integer NOT NULL default '0',
-      fromtype varchar(16) default NULL,
-      score integer default NULL
-      )");
-    $ret[] = update_sql("CREATE INDEX {search_index}_sid_idx on {search_index}(sid)");
-    $ret[] = update_sql("CREATE INDEX {search_index}_fromsid_idx on {search_index}(fromsid)");
-    $ret[] = update_sql("CREATE INDEX {search_index}_word_idx on {search_index}(word)");
-
-    $ret[] = update_sql("CREATE TABLE {search_total} (
-      word varchar(50) NOT NULL default '' PRIMARY KEY,
-      count integer default NULL
-      )");
-
-
-    /*
-    ** Blocks
-    */
-    // Postgres can only drop columns since 7.4
-    #$ret[] = update_sql('ALTER TABLE {blocks} DROP path');
-
-    $ret[] = update_sql('ALTER TABLE {blocks} ADD visibility smallint');
-    $ret[] = update_sql("ALTER TABLE {blocks} ALTER COLUMN visibility set default 0");
-    $ret[] = update_sql('UPDATE {blocks} SET visibility = 0');
-    $ret[] = update_sql('ALTER TABLE {blocks} ALTER COLUMN visibility SET NOT NULL');
-    $ret[] = update_sql('ALTER TABLE {blocks} ADD pages text');
-    $ret[] = update_sql("ALTER TABLE {blocks} ALTER COLUMN pages set default ''");
-    $ret[] = update_sql("UPDATE {blocks} SET pages = ''");
-    $ret[] = update_sql('ALTER TABLE {blocks} ALTER COLUMN pages SET NOT NULL');
-
-  }
-
-  $ret[] = update_sql("DELETE FROM {variable} WHERE name = 'node_cron_last'");
-
-  $ret[] = update_sql('UPDATE {blocks} SET status = 1, custom = 2 WHERE status = 0 AND custom = 1');
-
-  return $ret;
-}
-
-function system_update_111() {
-  $ret = array();
-
-  $ret[] = update_sql("DELETE FROM {variable} WHERE name LIKE 'throttle_%'");
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql('ALTER TABLE {sessions} ADD PRIMARY KEY sid (sid)');
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql('ALTER TABLE {sessions} ADD UNIQUE(sid)');
-  }
-
-  return $ret;
-}
-
-function system_update_112() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("CREATE TABLE {flood} (
-      event varchar(64) NOT NULL default '',
-      hostname varchar(128) NOT NULL default '',
-      timestamp int(11) NOT NULL default '0'
-     );");
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql("CREATE TABLE {flood} (
-      event varchar(64) NOT NULL default '',
-      hostname varchar(128) NOT NULL default '',
-      timestamp integer NOT NULL default 0
-     );");
-  }
-
-  return $ret;
-}
-
-function system_update_113() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql('ALTER TABLE {accesslog} ADD aid int(10) NOT NULL auto_increment, ADD PRIMARY KEY (aid)');
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql("SELECT * INTO TEMPORARY {accesslog}_t FROM {accesslog}");
-    $ret[] = update_sql("DROP TABLE {accesslog}");
-    $ret[] = update_sql("CREATE TABLE {accesslog} (
-      aid serial,
-      title varchar(255) default NULL,
-      path varchar(255) default NULL,
-      url varchar(255) default NULL,
-      hostname varchar(128) default NULL,
-      uid integer default '0',
-      timestamp integer NOT NULL default '0'
-    )");
-    $ret[] = update_sql("INSERT INTO {accesslog} (title, path, url, hostname, uid, timestamp) SELECT title, path, url, hostname, uid, timestamp FROM {accesslog}_t");
-
-    $ret[] = update_sql("DROP TABLE {accesslog}_t");
-    $ret[] = update_sql("CREATE INDEX {accesslog}_timestamp_idx ON {accesslog} (timestamp);");
-
-  }
-
-  // Flush the menu cache:
-  cache_clear_all('menu:', TRUE);
-
-  return $ret;
-}
-
-function system_update_114() {
-  $ret = array();
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("CREATE TABLE {queue} (
-      nid int(10) unsigned NOT NULL,
-      uid int(10) unsigned NOT NULL,
-      vote int(3) NOT NULL default '0',
-      PRIMARY KEY (nid, uid)
-     )");
-  }
-  else if ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql("CREATE TABLE {queue} (
-      nid integer NOT NULL default '0',
-      uid integer NOT NULL default '0',
-      vote integer NOT NULL default '0',
-      PRIMARY KEY (nid, uid)
-    )");
-    $ret[] = update_sql("CREATE INDEX {queue}_nid_idx ON queue(nid)");
-    $ret[] = update_sql("CREATE INDEX {queue}_uid_idx ON queue(uid)");
-  }
-
-  $result = db_query("SELECT nid, votes, score, users FROM {node}");
-  while ($node = db_fetch_object($result)) {
-    if (isset($node->users)) {
-      $arr = explode(',', $node->users);
-      unset($node->users);
-      foreach ($arr as $value) {
-        $arr2 = explode('=', trim($value));
-        if (isset($arr2[0]) && isset($arr2[1])) {
-          switch ($arr2[1]) {
-            case '+ 1':
-              db_query("INSERT INTO {queue} (nid, uid, vote) VALUES (%d, %d, %d)", $node->nid, (int)$arr2[0], 1);
-              break;
-            case '- 1':
-              db_query("INSERT INTO {queue} (nid, uid, vote) VALUES (%d, %d, %d)", $node->nid, (int)$arr2[0], -1);
-              break;
-            default:
-              db_query("INSERT INTO {queue} (nid, uid, vote) VALUES (%d, %d, %d)", $node->nid, (int)$arr2[0], 0);
-          }
-        }
-      }
-    }
-  }
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    // Postgres only supports dropping of columns since 7.4
-    $ret[] = update_sql("ALTER TABLE {node} DROP votes");
-    $ret[] = update_sql("ALTER TABLE {node} DROP score");
-    $ret[] = update_sql("ALTER TABLE {node} DROP users");
-  }
-
-  return $ret;
-}
-
-function system_update_115() {
-  $ret = array();
-
-  // This update has been moved to update_fix_watchdog_115 in update.php because it
-  // is needed for the basic functioning of the update script.
-
-  return $ret;
-}
-
-function system_update_116() {
-  return array(update_sql("DELETE FROM {system} WHERE name = 'admin'"));
-}
-
-function system_update_117() {
-  $ret = array();
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("CREATE TABLE {vocabulary_node_types} (
-                         vid int(10) NOT NULL default '0',
-                         type varchar(16) NOT NULL default '',
-                         PRIMARY KEY (vid, type))");
-  }
-  else if ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql("CREATE TABLE {vocabulary_node_types} (
-                         vid serial,
-                         type varchar(16) NOT NULL default '',
-                          PRIMARY KEY (vid, type)) ");
-  }
-  return $ret;
-}
-
-function system_update_118() {
-  $ret = array();
-  $node_types = array();
-  $result = db_query('SELECT vid, nodes FROM {vocabulary}');
-  while ($vocabulary = db_fetch_object($result)) {
-    $node_types[$vocabulary->vid] = explode(',', $vocabulary->nodes);
-  }
-  foreach ($node_types as $vid => $type_array) {
-    foreach ($type_array as $type) {
-      db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $vid, $type);
-    }
-  }
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("ALTER TABLE {vocabulary} DROP nodes");
-  }
-  return $ret;
-}
-
-function system_update_119() {
-  $ret = array();
-
-  foreach (node_get_types() as $type => $name) {
-    $node_options = array();
-    if (variable_get('node_status_'. $type, 1)) {
-      $node_options[] = 'status';
-    }
-    if (variable_get('node_moderate_'. $type, 0)) {
-      $node_options[] = 'moderate';
-    }
-    if (variable_get('node_promote_'. $type, 1)) {
-      $node_options[] = 'promote';
-    }
-    if (variable_get('node_sticky_'. $type, 0)) {
-      $node_options[] = 'sticky';
-    }
-    if (variable_get('node_revision_'. $type, 0)) {
-      $node_options[] = 'revision';
-    }
-    variable_set('node_options_'. $type, $node_options);
-    variable_del('node_status_'. $type);
-    variable_del('node_moderate_'. $type);
-    variable_del('node_promote_'. $type);
-    variable_del('node_sticky_'. $type);
-    variable_del('node_revision_'. $type);
-  }
-
-  return $ret;
-}
-
-function system_update_120() {
-  $ret = array();
-
-  // Rewrite old URL aliases. Works for both PostgreSQL and MySQL
-  $result = db_query("SELECT pid, src FROM {url_alias} WHERE src LIKE 'blog/%%'");
-  while ($alias = db_fetch_object($result)) {
-    list(, $page, $op, $uid) = explode('/', $alias->src);
-    if ($page == 'feed') {
-      $new = "blog/$uid/feed";
-      update_sql("UPDATE {url_alias} SET src = '%s' WHERE pid = '%s'", $new, $alias->pid);
-    }
-  }
-
-  return $ret;
-}
-
-function system_update_121() {
-  $ret = array();
-
-  // Remove the unused page table.
-  $ret[] = update_sql('DROP TABLE {page}');
-
-  return $ret;
-}
-
-function system_update_122() {
-
-  $ret = array();
-  $ret[] = update_sql("ALTER TABLE {blocks} ADD types text");
-  return $ret;
-
-}
-
-function system_update_123() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("ALTER TABLE {vocabulary} ADD module varchar(255) NOT NULL default ''");
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql("ALTER TABLE {vocabulary} ADD module varchar(255)");
-    $ret[] = update_sql("UPDATE {vocabulary} SET module = ''");
-    $ret[] = update_sql("ALTER TABLE {vocabulary} ALTER COLUMN module SET NOT NULL");
-    $ret[] = update_sql("ALTER TABLE {vocabulary} ALTER COLUMN module SET DEFAULT ''");
-  }
-
-  $ret[] = update_sql("UPDATE {vocabulary} SET module = 'taxonomy'");
-  $vid = variable_get('forum_nav_vocabulary', '');
-  if (!empty($vid)) {
-    $ret[] = update_sql("UPDATE {vocabulary} SET module = 'forum' WHERE vid = " . $vid);
-  }
-
-  return $ret;
-}
-
-function system_update_124() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    // redo update_105, correctly creating node_comment_statistics
-    $ret[] = update_sql("DROP TABLE IF EXISTS {node_comment_statistics}");
-
-    $ret[] = update_sql("CREATE TABLE {node_comment_statistics} (
-      nid int(10) unsigned NOT NULL auto_increment,
-      last_comment_timestamp int(11) NOT NULL default '0',
-      last_comment_name varchar(60) default NULL,
-      last_comment_uid int(10) NOT NULL default '0',
-      comment_count int(10) unsigned NOT NULL default '0',
-      PRIMARY KEY (nid),
-      KEY node_comment_timestamp (last_comment_timestamp)
-      )");
-  }
-
-  else {
-    // also drop incorrectly named table for PostgreSQL
-    $ret[] = update_sql("DROP TABLE {node}_comment_statistics");
-
-    $ret[] = update_sql("CREATE TABLE {node_comment_statistics} (
-      nid integer NOT NULL,
-      last_comment_timestamp integer NOT NULL default '0',
-      last_comment_name varchar(60)  default NULL,
-      last_comment_uid integer NOT NULL default '0',
-      comment_count integer NOT NULL default '0',
-      PRIMARY KEY (nid)
-    )");
-
-    $ret[] = update_sql("CREATE INDEX {node_comment_statistics}_timestamp_idx ON {node_comment_statistics}(last_comment_timestamp);
-");
-  }
-
-  // initialize table
-  $ret[] = update_sql("INSERT INTO {node_comment_statistics} (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) SELECT n.nid, n.changed, NULL, 0, 0 FROM {node} n");
-
-  // fill table
-  $result = db_query("SELECT c.nid, c.timestamp, c.name, c.uid, COUNT(c.nid) as comment_count FROM {node} n LEFT JOIN {comments} c ON c.nid = n.nid WHERE c.status = 0 GROUP BY c.nid, c.timestamp, c.name, c.uid");
-  while ($comment_record = db_fetch_object($result)) {
-    $count = db_result(db_query('SELECT COUNT(cid) FROM {comments} WHERE nid = %d AND status = 0', $comment_record->nid));
-    db_query("UPDATE {node_comment_statistics} SET comment_count = %d, last_comment_timestamp = %d, last_comment_name = '%s', last_comment_uid = %d WHERE nid = %d", $count, $comment_record->timestamp, $comment_record->name, $comment_record->uid, $comment_record->nid);
-  }
-
-  return $ret;
-}
-
-function system_update_125() {
-  // Postgres only update.
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'pgsql') {
-
-    $ret[] = update_sql("CREATE OR REPLACE FUNCTION if(boolean, anyelement, anyelement) RETURNS anyelement AS '
-          SELECT CASE WHEN $1 THEN $2 ELSE $3 END;
-        ' LANGUAGE 'sql'");
-
-    $ret[] = update_sql("CREATE FUNCTION greatest(integer, integer, integer) RETURNS integer AS '
-                          SELECT greatest($1, greatest($2, $3));
-                        ' LANGUAGE 'sql'");
-
-  }
-
-  return $ret;
-}
-
-function system_update_126() {
-  variable_set('forum_block_num_0', variable_get('forum_block_num', 5));
-  variable_set('forum_block_num_1', variable_get('forum_block_num', 5));
-  variable_del('forum_block_num');
-
-  return array();
-}
-
-function system_update_127() {
-  $ret = array();
-  if ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql("ALTER TABLE {poll} RENAME voters TO polled");
-  }
-  else if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("ALTER TABLE {poll} CHANGE voters polled longtext");
-  }
-  return $ret;
-}
-
-function system_update_128() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql('ALTER TABLE {term_node} ADD PRIMARY KEY (tid,nid)');
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql('ALTER TABLE {term_node} ADD PRIMARY KEY (tid,nid)');
-  }
-
-  return $ret;
-}
-
-function system_update_129() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("ALTER TABLE {vocabulary} ADD tags tinyint(3) unsigned default '0' NOT NULL");
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    db_add_column($ret, 'vocabulary', 'tags', 'smallint', array('default' => 0, 'not null' => TRUE));
-  }
-
-  return $ret;
-}
-
-function system_update_130() {
-  $ret = array();
-
-  // This update has been moved to update_fix_sessions in update.php because it
-  // is needed for the basic functioning of the update script.
-
-  return $ret;
-}
-
-function system_update_131() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("ALTER TABLE {boxes} DROP INDEX title");
-    // Removed recreation of the index, which is not present in the db schema
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql("ALTER TABLE {boxes} DROP CONSTRAINT {boxes}_title_key");
-  }
-
-  return $ret;
-}
-
-function system_update_132() {
-  /**
-   * PostgreSQL only update.
-   */
-  $ret = array();
-
-  if (!variable_get('update_132_done', FALSE)) {
-    if ($GLOBALS['db_type'] == 'pgsql') {
-      $ret[] = update_sql('DROP TABLE {search_total}');
-      $ret[] = update_sql("CREATE TABLE {search_total} (
-        word varchar(50) NOT NULL default '',
-             count float default NULL)");
-      $ret[] = update_sql('CREATE INDEX {search_total}_word_idx ON {search_total}(word)');
-
-      /**
-       * Wipe the search index
-       */
-      include_once './modules/search.module';
-      search_wipe();
-    }
-
-    variable_del('update_132_done');
-  }
-
-  return $ret;
-}
-
-function system_update_133() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("CREATE TABLE {contact} (
-      subject varchar(255) NOT NULL default '',
-      recipients longtext NOT NULL default '',
-      reply longtext NOT NULL default ''
-      )");
-    $ret[] = update_sql("ALTER TABLE {users} ADD login int(11) NOT NULL default '0'");
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    // Table {contact} is changed in update_143() so I have moved it's creation there.
-    // It was never created here for postgres because of errors.
-
-    db_add_column($ret, 'users', 'login', 'int', array('default' => 0, 'not null' => TRUE));
-  }
-
-  return $ret;
-}
-
-function system_update_134() {
-  $ret = array();
-  $ret[] = update_sql('ALTER TABLE {blocks} DROP types');
-  return $ret;
-}
-
-function system_update_135() {
-  if (!variable_get('update_135_done', FALSE)) {
-    $result = db_query("SELECT delta FROM {blocks} WHERE module = 'aggregator'");
-    while ($block = db_fetch_object($result)) {
-      list($type, $id) = explode(':', $block->delta);
-      db_query("UPDATE {blocks} SET delta = '%s' WHERE module = 'aggregator' AND delta = '%s'", $type .'-'. $id, $block->delta);
-    }
-
-    variable_del('update_135_done');
-  }
-  return array();
-}
-
-function system_update_136() {
-  $ret = array();
-
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      $ret[] = update_sql("DROP INDEX {users}_changed_idx"); // We drop the index first because it won't be renamed
-      $ret[] = update_sql("ALTER TABLE {users} RENAME changed TO access");
-      $ret[] = update_sql("CREATE INDEX {users}_access_idx on {users}(access)"); // Re-add the index
-      break;
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {users} CHANGE COLUMN changed access int(11) NOT NULL default '0'");
-      break;
-  }
-
-  $ret[] = update_sql('UPDATE {users} SET access = login WHERE login > created');
-  $ret[] = update_sql('UPDATE {users} SET access = created WHERE access = 0');
-  return $ret;
-}
-
-function system_update_137() {
-  $ret = array();
-
-  if (!variable_get('update_137_done', FALSE)) {
-    if ($GLOBALS['db_type'] == 'mysql') {
-      $ret[] = update_sql("ALTER TABLE {locales_source} CHANGE location location varchar(255) NOT NULL default ''");
-    }
-    elseif ($GLOBALS['db_type'] == 'pgsql') {
-      db_change_column($ret, 'locales_source', 'location', 'location', 'varchar(255)', array('not null' => TRUE, 'default' => "''"));
-    }
-    variable_del('update_137_done');
-  }
-
-  return $ret;
-}
-
-function system_update_138() {
-  $ret = array();
-  // duplicate of update_97 which never got into the default database.* files.
-  $ret[] = update_sql("INSERT INTO {url_alias} (src, dst) VALUES ('node/feed', 'rss.xml')");
-  return $ret;
-}
-
-function system_update_139() {
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      db_add_column($ret, 'accesslog', 'timer', 'int', array('not null' => TRUE, 'default' => 0));
-      break;
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {accesslog} ADD timer int(10) unsigned NOT NULL default '0'");
-      break;
-  }
-
-  return $ret;
-}
-
-function system_update_140() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("ALTER TABLE {url_alias} ADD INDEX (src)");
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql("CREATE INDEX {url_alias}_src_idx ON {url_alias}(src)");
-  }
-  return $ret;
-}
-
-function system_update_141() {
-  $ret = array();
-
-  variable_del('upload_maxsize_total');
-
-  return $ret;
-}
-
-function system_update_142() {
-  $ret = array();
-
-  // This update has been moved to update_fix_sessions in update.php because it
-  // is needed for the basic functioning of the update script.
-
-  return $ret;
-}
-
-function system_update_143() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("ALTER TABLE {contact} CHANGE subject category VARCHAR(255) NOT NULL ");
-    $ret[] = update_sql("ALTER TABLE {contact} ADD PRIMARY KEY (category)");
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    // Why the table is created here? See update_133().
-    $ret[] = update_sql("CREATE TABLE {contact} (
-      category varchar(255) NOT NULL default '',
-      recipients text NOT NULL default '',
-      reply text NOT NULL default '',
-      PRIMARY KEY (category))");
-  }
-
-  return $ret;
-}
-
-function system_update_144() {
-  $ret = array();
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("ALTER TABLE {node} CHANGE type type VARCHAR(32) NOT NULL");
-  }
-  elseif ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql("DROP INDEX {node}_type_idx"); // Drop indexes using "type" column
-    $ret[] = update_sql("DROP INDEX {node}_title_idx");
-    db_change_column($ret, 'node', 'type', 'type', 'varchar(32)', array('not null' => TRUE, 'default' => "''"));
-    // Let's recreate the indexes
-    $ret[] = update_sql("CREATE INDEX {node}_type_idx ON {node}(type)");
-    $ret[] = update_sql("CREATE INDEX {node}_title_type_idx ON {node}(title,type)");
-    $ret[] = update_sql("CREATE INDEX {node}_status_type_nid_idx ON {node}(status,type,nid)");
-  }
-  return $ret;
-}
-
-function system_update_145() {
-  $default_theme = variable_get('theme_default', 'bluemarine');
-
-  $themes = list_themes();
-  if (!array_key_exists($default_theme, $themes)) {
-      variable_set('theme_default', 'bluemarine');
-      $default_theme = 'bluemarine';
-   }
-
-  $ret = array();
-
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      db_change_column($ret, 'blocks', 'region', 'region', 'varchar(64)', array('default' => "'left'", 'not null' => TRUE));
-      db_add_column($ret, 'blocks', 'theme', 'varchar(255)', array('not null' => TRUE, 'default' => "''"));
-      break;
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {blocks} CHANGE region region varchar(64) default 'left' NOT NULL");
-      $ret[] = update_sql("ALTER TABLE {blocks} ADD theme varchar(255) NOT NULL default ''");
-      break;
-  }
-
-  // Intialize block data for default theme
-  $ret[] = update_sql("UPDATE {blocks} SET region = 'left' WHERE region = '0'");
-  $ret[] = update_sql("UPDATE {blocks} SET region = 'right' WHERE region = '1'");
-  db_query("UPDATE {blocks} SET theme = '%s'", $default_theme);
-
-  // Initialze block data for other enabled themes.
-  $themes = list_themes();
-  foreach (array_keys($themes) as $theme) {
-    if (($theme != $default_theme) && $themes[$theme]->status == 1) {
-      system_initialize_theme_blocks($theme);
-    }
-  }
-
-  return $ret;
-}
-
-function system_update_146() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("CREATE TABLE {node_revisions}
-                                SELECT nid, nid AS vid, uid, type, title, body, teaser, changed AS timestamp, format
-                                FROM {node}");
-
-    $ret[] = update_sql("ALTER TABLE {node_revisions} CHANGE nid nid int(10) unsigned NOT NULL default '0'");
-    $ret[] = update_sql("ALTER TABLE {node_revisions} ADD log longtext");
-
-    $ret[] = update_sql("ALTER TABLE {node} ADD vid int(10) unsigned NOT NULL default '0'");
-    $ret[] = update_sql("ALTER TABLE {files} ADD vid int(10) unsigned NOT NULL default '0'");
-    $ret[] = update_sql("ALTER TABLE {book} ADD vid int(10) unsigned NOT NULL default '0'");
-    $ret[] = update_sql("ALTER TABLE {forum} ADD vid int(10) unsigned NOT NULL default '0'");
-
-    $ret[] = update_sql("ALTER TABLE {book} DROP PRIMARY KEY");
-    $ret[] = update_sql("ALTER TABLE {forum} DROP PRIMARY KEY");
-    $ret[] = update_sql("ALTER TABLE {files} DROP PRIMARY KEY");
-
-    $ret[] = update_sql("UPDATE {node} SET vid = nid");
-    $ret[] = update_sql("UPDATE {forum} SET vid = nid");
-    $ret[] = update_sql("UPDATE {book} SET vid = nid");
-    $ret[] = update_sql("UPDATE {files} SET vid = nid");
-
-    $ret[] = update_sql("ALTER TABLE {book} ADD PRIMARY KEY vid (vid)");
-    $ret[] = update_sql("ALTER TABLE {forum} ADD PRIMARY KEY vid (vid)");
-    $ret[] = update_sql("ALTER TABLE {node_revisions} ADD PRIMARY KEY vid (vid)");
-    $ret[] = update_sql("ALTER TABLE {node_revisions} ADD KEY nid (nid)");
-    $ret[] = update_sql("ALTER TABLE {node_revisions} ADD KEY uid (uid)");
-
-    $ret[] = update_sql("CREATE TABLE {old_revisions} SELECT nid, type, revisions FROM {node} WHERE revisions != ''");
-
-    $ret[] = update_sql("ALTER TABLE {book} ADD KEY nid (nid)");
-    $ret[] = update_sql("ALTER TABLE {forum} ADD KEY nid (nid)");
-    $ret[] = update_sql("ALTER TABLE {files} ADD KEY fid (fid)");
-    $ret[] = update_sql("ALTER TABLE {files} ADD KEY vid (vid)");
-    $vid = db_next_id('{node}_nid');
-    $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{node_revisions}_vid', $vid)");
-  }
-  else { // pgsql
-    $ret[] = update_sql("CREATE TABLE {node_revisions} (
-      nid integer NOT NULL default '0',
-      vid integer NOT NULL default '0',
-      uid integer NOT NULL default '0',
-      title varchar(128) NOT NULL default '',
-      body text NOT NULL default '',
-      teaser text NOT NULL default '',
-      log text NOT NULL default '',
-      timestamp integer NOT NULL default '0',
-      format int NOT NULL default '0',
-      PRIMARY KEY (vid))");
-    $ret[] = update_sql("INSERT INTO {node_revisions} (nid, vid, uid, title, body, teaser, timestamp, format)
-      SELECT nid, nid AS vid, uid, title, body, teaser, changed AS timestamp, format
-      FROM {node}");
-    $ret[] = update_sql('CREATE INDEX {node_revisions}_nid_idx ON {node_revisions}(nid)');
-    $ret[] = update_sql('CREATE INDEX {node_revisions}_uid_idx ON {node_revisions}(uid)');
-    $vid = db_next_id('{node}_nid');
-    $ret[] = update_sql("CREATE SEQUENCE {node_revisions}_vid_seq INCREMENT 1 START $vid");
-
-    db_add_column($ret, 'node',  'vid', 'int', array('not null' => TRUE, 'default' => 0));
-    db_add_column($ret, 'files', 'vid', 'int', array('not null' => TRUE, 'default' => 0));
-    db_add_column($ret, 'book',  'vid', 'int', array('not null' => TRUE, 'default' => 0));
-    db_add_column($ret, 'forum', 'vid', 'int', array('not null' => TRUE, 'default' => 0));
-
-    $ret[] = update_sql("ALTER TABLE {book} DROP CONSTRAINT {book}_pkey");
-    $ret[] = update_sql("ALTER TABLE {forum} DROP CONSTRAINT {forum}_pkey");
-    $ret[] = update_sql("ALTER TABLE {files} DROP CONSTRAINT {files}_pkey");
-
-    $ret[] = update_sql("UPDATE {node} SET vid = nid");
-    $ret[] = update_sql("UPDATE {forum} SET vid = nid");
-    $ret[] = update_sql("UPDATE {book} SET vid = nid");
-    $ret[] = update_sql("UPDATE {files} SET vid = nid");
-
-    $ret[] = update_sql("ALTER TABLE {book} ADD PRIMARY KEY (vid)");
-    $ret[] = update_sql("ALTER TABLE {forum} ADD PRIMARY KEY (vid)");
-
-    $ret[] = update_sql("CREATE TABLE {old_revisions} AS SELECT nid, type, revisions FROM {node} WHERE revisions != ''");
-
-    $ret[] = update_sql('CREATE INDEX {node}_vid_idx ON {node}(vid)');
-    $ret[] = update_sql('CREATE INDEX {forum}_nid_idx ON {forum}(nid)');
-    $ret[] = update_sql('CREATE INDEX {files}_fid_idx ON {files}(fid)');
-    $ret[] = update_sql('CREATE INDEX {files}_vid_idx ON {files}(vid)');
-  }
-
-  // Move logs too.
-  $result = db_query("SELECT nid, log FROM {book} WHERE log != ''");
-  while ($row = db_fetch_object($result)) {
-    db_query("UPDATE {node_revisions} SET log = '%s' WHERE vid = %d", $row->log, $row->nid);
-  }
-
-  $ret[] = update_sql("ALTER TABLE {book} DROP log");
-  $ret[] = update_sql("ALTER TABLE {node} DROP teaser");
-  $ret[] = update_sql("ALTER TABLE {node} DROP body");
-  $ret[] = update_sql("ALTER TABLE {node} DROP format");
-  $ret[] = update_sql("ALTER TABLE {node} DROP revisions");
-
-  return $ret;
-}
-
-function system_update_147() {
-  $ret = array();
-
-  // this update is mysql only, pgsql should get it right in the first try.
-  if ($GLOBALS['db_type'] == 'mysql') {
-    $ret[] = update_sql("ALTER TABLE {node_revisions} DROP type");
-  }
-
-  return $ret;
-}
-
-function system_update_148() {
-  $ret = array();
-
-  // Add support for tracking users' session ids (useful for tracking anon users)
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      db_add_column($ret, 'accesslog', 'sid', 'varchar(32)', array('not null' => TRUE, 'default' => "''"));
-      break;
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {accesslog} ADD sid varchar(32) NOT NULL default ''");
-      break;
-  }
-
-  return $ret;
-}
-
-function system_update_149() {
-  $ret = array();
-
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      db_add_column($ret, 'files', 'description', 'varchar(255)', array('not null' => TRUE, 'default' => "''"));
-      break;
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {files} ADD COLUMN description VARCHAR(255) NOT NULL DEFAULT ''");
-      break;
-    default:
-      break;
-  }
-
-  return $ret;
-}
-
-function system_update_150() {
-  $ret = array();
-
-  $ret[] = update_sql("DELETE FROM {variable} WHERE name = 'node_cron_last'");
-  $ret[] = update_sql("DELETE FROM {variable} WHERE name = 'minimum_word_size'");
-  $ret[] = update_sql("DELETE FROM {variable} WHERE name = 'remove_short'");
-
-  $ret[] = update_sql("DELETE FROM {node_counter} WHERE nid = 0");
-
-  $ret[] = update_sql('DROP TABLE {search_index}');
-  $ret[] = update_sql('DROP TABLE {search_total}');
-
-  switch ($GLOBALS['db_type']) {
-    case 'mysqli':
-    case 'mysql':
-      $ret[] = update_sql("CREATE TABLE {search_dataset} (
-                           sid int(10) unsigned NOT NULL default '0',
-                           type varchar(16) default NULL,
-                           data longtext NOT NULL,
-                           KEY sid_type (sid, type)
-                           )");
-
-      $ret[] = update_sql("CREATE TABLE {search_index} (
-                           word varchar(50) NOT NULL default '',
-                           sid int(10) unsigned NOT NULL default '0',
-                           type varchar(16) default NULL,
-                           fromsid int(10) unsigned NOT NULL default '0',
-                           fromtype varchar(16) default NULL,
-                           score float default NULL,
-                           KEY sid_type (sid, type),
-                           KEY from_sid_type (fromsid, fromtype),
-                           KEY word (word)
-                           )");
-
-      $ret[] = update_sql("CREATE TABLE {search_total} (
-                           word varchar(50) NOT NULL default '',
-                           count float default NULL,
-                           PRIMARY KEY word (word)
-                           )");
-      break;
-    case 'pgsql':
-      $ret[] = update_sql("CREATE TABLE {search_dataset} (
-        sid integer NOT NULL default '0',
-        type varchar(16) default NULL,
-        data text NOT NULL default '')");
-      $ret[] = update_sql("CREATE INDEX {search_dataset}_sid_type_idx ON {search_dataset}(sid, type)");
-
-      $ret[] = update_sql("CREATE TABLE {search_index} (
-        word varchar(50) NOT NULL default '',
-        sid integer NOT NULL default '0',
-        type varchar(16) default NULL,
-        fromsid integer NOT NULL default '0',
-        fromtype varchar(16) default NULL,
-        score float default NULL)");
-      $ret[] = update_sql("CREATE INDEX {search_index}_sid_type_idx ON {search_index}(sid, type)");
-      $ret[] = update_sql("CREATE INDEX {search_index}_fromsid_fromtype_idx ON {search_index}(fromsid, fromtype)");
-      $ret[] = update_sql("CREATE INDEX {search_index}_word_idx ON {search_index}(word)");
-
-      $ret[] = update_sql("CREATE TABLE {search_total} (
-        word varchar(50) NOT NULL default '',
-        count float default NULL,
-        PRIMARY KEY(word))");
-      break;
-    default:
-      break;
-  }
-  return $ret;
-}
-
-function system_update_151() {
-  $ret = array();
-
-  $ts = variable_get('theme_settings', null);
-
-  // set up data array so we can loop over both sets of links
-  $menus = array(0 => array('links_var' => 'primary_links',
-                            'toggle_var' => 'toggle_primary_links',
-                            'more_var' => 'primary_links_more',
-                            'menu_name' => 'Primary links',
-                            'menu_var' => 'menu_primary_menu',
-                            'pid' => 0),
-                 1 => array('links_var' => 'secondary_links',
-                            'toggle_var' => 'toggle_secondary_links',
-                            'more_var' => 'secondary_links_more',
-                            'menu_name' => 'Secondary links',
-                            'menu_var' => 'menu_secondary_menu',
-                            'pid' => 0));
-
-  for ($loop = 0; $loop <= 1 ; $loop ++) {
-    // create new Primary and Secondary links menus
-    $menus[$loop]['pid'] = db_next_id('{menu}_mid');
-    $ret[] = update_sql("INSERT INTO {menu} (mid, pid, path, title, description, weight, type) " .
-                         "VALUES ({$menus[$loop]['pid']}, 0, '', '{$menus[$loop]['menu_name']}', '', 0, 115)");
-
-    // Gather links from various settings into a single array.
-    $phptemplate_links = variable_get("phptemplate_". $menus[$loop]['links_var'], array());
-    if (empty($phptemplate_links)) {
-      $phptemplate_links = array('text' => array(), 'link' => array());
-    }
-    if (isset($ts) && is_array($ts)) {
-      if (is_array($ts[$menus[$loop]['links_var']])) {
-        $theme_links = $ts[$menus[$loop]['links_var']];
-      }
-      else {
-        // Convert old xtemplate style links.
-        preg_match_all('/<a\s+.*?href=[\"\'\s]?(.*?)[\"\'\s]?>(.*?)<\/a>/i', $ts[$menus[$loop]['links_var']], $urls);
-        $theme_links['text'] = $urls[2];
-        $theme_links['link'] = $urls[1];
-      }
-    }
-    else {
-      $theme_links = array('text' => array(), 'link' => array());
-    }
-    $links['text'] = array_merge($phptemplate_links['text'], $theme_links['text']);
-    $links['link'] = array_merge($phptemplate_links['link'], $theme_links['link']);
-
-    // insert all entries from theme links into new menus
-    $num_inserted = 0;
-    for ($i = 0; $i < count($links['text']); $i++) {
-      if ($links['text'][$i] != "" && $links['link'][$i] != "") {
-        $num_inserted ++;
-        $node_unalias = db_fetch_array(db_query("SELECT src FROM {url_alias} WHERE dst = '%s'", $links['link'][$i]));
-        if (isset($node_unalias) && is_array($node_unalias)) {
-          $link_path = $node_unalias['src'];
-        }
-        else {
-          $link_path = $links['link'][$i];
-        }
-
-        $mid = db_next_id('{menu}_mid');
-        $ret[] = update_sql("INSERT INTO {menu} (mid, pid, path, title, description, weight, type) " .
-                             "VALUES ($mid, {$menus[$loop]['pid']}, '" . db_escape_string($link_path) .
-                             "', '" . db_escape_string($links['text'][$i]) .
-                             "', '" . db_escape_string($links['description'][$i]) . "', 0, 118)");
-      }
-    }
-    // delete Secondary links if not populated.
-    if ($loop == 1 && $num_inserted == 0) {
-      db_query("DELETE FROM {menu} WHERE mid={$menus[$loop]['pid']}");
-    }
-
-    // Set menu_primary_menu and menu_primary_menu variables if links were
-    // imported. If the user had links but the toggle display was off, they
-    // will need to disable the new links manually in admins/settings/menu.
-    if ($num_inserted == 0) {
-      variable_set($menus[$loop]['menu_var'], 0);
-    }
-    else {
-      variable_set($menus[$loop]['menu_var'], $menus[$loop]['pid']);
-    }
-    variable_del('phptemplate_' .$menus[$loop]['links_var']);
-    variable_del('phptemplate_'. $menus[$loop]['links_var'] .'_more');
-    variable_del($menus[$loop]['toggle_var']);
-    variable_del($menus[$loop]['more_var']);
-    // If user has old xtemplate links in a string, leave them in the var.
-    if (isset($ts) && is_array($ts) && is_array($ts[$menus[$loop]['links_var']])) {
-      variable_del($menus[$loop]['links_var']);
-    }
-  }
-
-  if (isset($ts) && is_array($ts)) {
-    variable_set('theme_settings', $ts);
-  }
-
-  $ret[] = update_sql("UPDATE {system} SET status = 1 WHERE name = 'menu'");
-
-  return $ret;
-}
-
-function system_update_152() {
-  $ret = array();
-
-  // Postgresql only update
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      $ret[] = update_sql("ALTER TABLE {forum} DROP shadow");
-      break;
-    case 'mysql':
-    case 'mysqli':
-      break;
-  }
-
-  return $ret;
-}
-
-function system_update_153(){
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      $ret[] = update_sql("ALTER TABLE {contact} DROP CONSTRAINT {contact}_pkey");
-      $ret[] = update_sql("CREATE SEQUENCE {contact}_cid_seq");
-      db_add_column($ret, 'contact', 'cid', 'int', array('not null' => TRUE, 'default' => "nextval('{contact}_cid_seq')"));
-      $ret[] = update_sql("ALTER TABLE {contact} ADD PRIMARY KEY (cid)");
-      $ret[] = update_sql("ALTER TABLE {contact} ADD CONSTRAINT {contact}_category_key UNIQUE (category)");
-      break;
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {contact} DROP PRIMARY KEY");
-      $ret[] = update_sql("ALTER TABLE {contact} ADD COLUMN cid int(11) NOT NULL PRIMARY KEY auto_increment");
-      $ret[] = update_sql("ALTER TABLE {contact} ADD UNIQUE KEY category (category)");
-      break;
-  }
-  return $ret;
-}
-
-function system_update_154() {
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      db_add_column($ret, 'contact', 'weight', 'smallint', array('not null' => TRUE, 'default' => 0));
-      db_add_column($ret, 'contact', 'selected', 'smallint', array('not null' => TRUE, 'default' => 0));
-      break;
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {contact} ADD COLUMN weight tinyint(3) NOT NULL DEFAULT 0");
-      $ret[] = update_sql("ALTER TABLE {contact} ADD COLUMN selected tinyint(1) NOT NULL DEFAULT 0");
-      break;
-  }
-  return $ret;
-}
-
-function system_update_155() {
-  $ret = array();
-
-  // Postgresql only update
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      $ret[] = update_sql("DROP TABLE {cache}");
-      $ret[] = update_sql("CREATE TABLE {cache} (
-        cid varchar(255) NOT NULL default '',
-        data bytea default '',
-        expire integer NOT NULL default '0',
-        created integer NOT NULL default '0',
-        headers text default '',
-        PRIMARY KEY (cid)
-        )");
-      $ret[] = update_sql("CREATE INDEX {cache}_expire_idx ON {cache}(expire)");
-      break;
-    case 'mysql':
-    case 'mysqli':
-      break;
-  }
-
-  return $ret;
-}
-
-function system_update_156() {
-  $ret = array();
-  $ret[] = update_sql("DELETE FROM {cache}");
-  system_themes();
-  return $ret;
-}
-
-function system_update_157() {
-  $ret = array();
-  $ret[] = update_sql("DELETE FROM {url_alias} WHERE src = 'node/feed' AND dst = 'rss.xml'");
-  $ret[] = update_sql("INSERT INTO {url_alias} (src, dst) VALUES ('rss.xml', 'node/feed')");
-  return $ret;
-}
-
-function system_update_158() {
-  $ret = array();
-
-  switch ($GLOBALS['db_type']) {
-    case 'mysqli':
-    case 'mysql':
-      $ret[] = update_sql("ALTER TABLE {old_revisions} ADD done tinyint(1) NOT NULL DEFAULT 0");
-      $ret[] = update_sql("ALTER TABLE {old_revisions} ADD INDEX (done)");
-      break;
-
-    case 'pgsql':
-      db_add_column($ret, 'old_revisions', 'done', 'smallint', array('not null' => TRUE, 'default' => 0));
-      $ret[] = update_sql('CREATE INDEX {old_revisions}_done_idx ON {old_revisions}(done)');
-      break;
-  }
-
-  return $ret;
-}
-
-/**
- * Retrieve data out of the old_revisions table and put into new revision
- * system.
- *
- * The old_revisions table is not deleted because any data which could not be
- * put into the new system is retained.
- */
-function system_update_159() {
-  $ret = array();
-
-  $result = db_query_range("SELECT * FROM {old_revisions} WHERE done = 0 AND type IN ('page', 'story', 'poll', 'book', 'forum', 'blog') ORDER BY nid DESC", 0, 20);
-
-  if (db_num_rows($result)) {
-    $vid = db_next_id('{node_revisions}_vid');
-    while ($node = db_fetch_object($result)) {
-      $revisions = unserialize($node->revisions);
-      if (isset($revisions) && is_array($revisions) && count($revisions) > 0) {
-        $revisions_query = array();
-        $revisions_args = array();
-        $book_query = array();
-        $book_args = array();
-        $forum_query = array();
-        $forum_args = array();
-        foreach ($revisions as $version) {
-          $revision = array();
-          foreach ($version['node'] as $node_field => $node_value) {
-            $revision[$node_field] = $node_value;
-          }
-          $revision['uid'] = $version['uid'];
-          $revision['timestamp'] = $version['timestamp'];
-          $vid++;
-          $revisions_query[] = "(%d, %d, %d, '%s', '%s', '%s', '%s', %d, %d)";
-          $revisions_args = array_merge($revisions_args, array($node->nid, $vid, $revision['uid'], $revision['title'], $revision['body'], $revision['teaser'], $revision['log'], $revision['timestamp'], $revision['format']));
-          switch ($node->type) {
-            case 'forum':
-              if ($revision['tid'] > 0) {
-                $forum_query[] = "(%d, %d, %d)";
-                $forum_args = array_merge($forum_args, array($vid, $node->nid, $revision['tid']));
-              }
-              break;
-
-            case 'book':
-              $book_query[] = "(%d, %d, %d, %d)";
-              $book_args = array_merge($book_args, array($vid, $node->nid, $revision['parent'], $revision['weight']));
-              break;
-          }
-        }
-        if (count($revisions_query)) {
-          $revision_status = db_query("INSERT INTO {node_revisions} (nid, vid, uid, title, body, teaser, log, timestamp, format) VALUES ". implode(',', $revisions_query), $revisions_args);
-        }
-        if (count($forum_query)) {
-          $forum_status = db_query("INSERT INTO {forum} (vid, nid, tid) VALUES ". implode(',', $forum_query), $forum_args);
-        }
-        if (count($book_query)) {
-          $book_status = db_query("INSERT INTO {book} (vid, nid, parent, weight) VALUES ". implode(',', $book_query), $book_args);
-        }
-        $delete = FALSE;
-        switch ($node->type) {
-          case 'forum':
-            if ($forum_status && $revision_status) {
-              $delete = TRUE;
-            }
-            break;
-
-          case 'book':
-            if ($book_status && $revision_status) {
-              $delete = TRUE;
-            }
-            break;
-
-          default:
-            if ($revision_status) {
-              $delete = TRUE;
-            }
-            break;
-        }
-
-        if ($delete) {
-          db_query('DELETE FROM {old_revisions} WHERE nid = %d', $node->nid);
-        }
-        else {
-          db_query('UPDATE {old_revisions} SET done = 1 WHERE nid = %d', $node->nid);
-        }
-
-        switch ($GLOBALS['db_type']) {
-          case 'mysqli':
-          case 'mysql':
-            $ret[] = update_sql("UPDATE {sequences} SET id = $vid WHERE name = '{node_revisions}_vid'");
-            break;
-
-          case 'pgsql':
-            $ret[] = update_sql("SELECT setval('{node_revisions}_vid_seq', $vid)");
-            break;
-        }
-      }
-      else {
-        db_query('UPDATE {old_revisions} SET done = 1 WHERE nid = %d', $node->nid);
-        watchdog('php', "Recovering old revisions for node $node->nid failed.", WATCHDOG_WARNING);
-      }
-    }
-  }
-
-  if (db_num_rows($result) < 20) {
-    $ret[] = update_sql('ALTER TABLE {old_revisions} DROP done');
-  }
-  else {
-    $ret['#finished'] = FALSE;
-  }
-
-  return $ret;
-}
-
-function system_update_160() {
-  $types = module_invoke('node', 'get_types');
-  if (is_array($types)) {
-    foreach($types as $type) {
-      if (!is_array(variable_get("node_options_$type", array()))) {
-        variable_set("node_options_$type", array());
-      }
-    }
-  }
-  return array();
-}
-
-function system_update_161() {
-  variable_del('forum_icon_path');
-  return array();
-}
-
-function system_update_162() {
-  $ret = array();
-
-  // PostgreSQL only update
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-
-      $ret[] = update_sql('DROP INDEX {book}_parent');
-      $ret[] = update_sql('CREATE INDEX {book}_parent_idx ON {book}(parent)');
-
-      $ret[] = update_sql('DROP INDEX {node_comment_statistics}_timestamp_idx');
-      $ret[] = update_sql('CREATE INDEX {node_comment_statistics}_last_comment_timestamp_idx ON {node_comment_statistics}(last_comment_timestamp)');
-
-      $ret[] = update_sql('ALTER TABLE {filters} ALTER delta SET DEFAULT 0');
-      $ret[] = update_sql('DROP INDEX {filters}_module_idx');
-
-      $ret[] = update_sql('DROP INDEX {locales_target}_lid_idx');
-      $ret[] = update_sql('DROP INDEX {locales_target}_lang_idx');
-      $ret[] = update_sql('CREATE INDEX {locales_target}_locale_idx ON {locales_target}(locale)');
-
-      $ret[] = update_sql('DROP INDEX {node}_created');
-      $ret[] = update_sql('CREATE INDEX {node}_created_idx ON {node}(created)');
-      $ret[] = update_sql('DROP INDEX {node}_changed');
-      $ret[] = update_sql('CREATE INDEX {node}_changed_idx ON {node}(changed)');
-
-      $ret[] = update_sql('DROP INDEX {profile_fields}_category');
-      $ret[] = update_sql('CREATE INDEX {profile_fields}_category_idx ON {profile_fields}(category)');
-
-      $ret[] = update_sql('DROP INDEX {url_alias}_dst_idx');
-      $ret[] = update_sql('CREATE UNIQUE INDEX {url_alias}_dst_idx ON {url_alias}(dst)');
-
-      $ret[] = update_sql('CREATE INDEX {sessions}_uid_idx ON {sessions}(uid)');
-      $ret[] = update_sql('CREATE INDEX {sessions}_timestamp_idx ON {sessions}(timestamp)');
-
-      $ret[] = update_sql('ALTER TABLE {accesslog} DROP mask');
-
-      db_change_column($ret, 'accesslog', 'path', 'path', 'text');
-      db_change_column($ret, 'accesslog', 'url', 'url', 'text');
-      db_change_column($ret, 'watchdog', 'link', 'link', 'text', array('not null' => TRUE, 'default' => "''"));
-      db_change_column($ret, 'watchdog', 'location', 'location', 'text', array('not null' => TRUE, 'default' => "''"));
-      db_change_column($ret, 'watchdog', 'referer', 'referer', 'text', array('not null' => TRUE, 'default' => "''"));
-
-      break;
-  }
-
-  return $ret;
-}
-
-function system_update_163() {
-  $ret = array();
-  if ($GLOBALS['db_type'] == 'mysql' || $GLOBALS['db_type'] == 'mysqli') {
-    $ret[] = update_sql('ALTER TABLE {cache} CHANGE data data LONGBLOB');
-  }
-  return $ret;
-}
-
-function system_update_164() {
-  $ret = array();
-
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("CREATE TABLE {poll_votes} (
-          nid int(10) unsigned NOT NULL,
-          uid int(10) unsigned NOT NULL default 0,
-          hostname varchar(128) NOT NULL default '',
-          INDEX (nid),
-          INDEX (uid),
-          INDEX (hostname)
-      )");
-      break;
-
-    case 'pgsql':
-      $ret[] = update_sql("CREATE TABLE {poll_votes} (
-          nid int NOT NULL,
-          uid int NOT NULL default 0,
-          hostname varchar(128) NOT NULL default ''
-      )");
-      $ret[] = update_sql('CREATE INDEX {poll_votes}_nid_idx ON {poll_votes} (nid)');
-      $ret[] = update_sql('CREATE INDEX {poll_votes}_uid_idx ON {poll_votes} (uid)');
-      $ret[] = update_sql('CREATE INDEX {poll_votes}_hostname_idx ON {poll_votes} (hostname)');
-      break;
-  }
-
-  $result = db_query('SELECT nid, polled FROM {poll}');
-  while ($poll = db_fetch_object($result)) {
-    foreach (explode(' ', $poll->polled) as $polled) {
-      if ($polled[0] == '_') {
-        // $polled is a user id
-        db_query('INSERT INTO {poll_votes} (nid, uid) VALUES (%d, %d)', $poll->nid, substr($polled, 1, -1));
-      }
-      else {
-        // $polled is a host
-        db_query("INSERT INTO {poll_votes} (nid, hostname) VALUES (%d, '%s')", $poll->nid, $polled);
-      }
-    }
-  }
-
-  $ret[] = update_sql('ALTER TABLE {poll} DROP polled');
-
-  return $ret;
-}
-
-function system_update_165() {
-  $cron_last = max(variable_get('drupal_cron_last', 0), variable_get('ping_cron_last', 0));
-  variable_set('cron_last', $cron_last);
-  variable_del('drupal_cron_last');
-  variable_del('ping_cron_last');
-  return array();
-}
-
-function system_update_166() {
-  $ret = array();
-
-  $ret[] = update_sql("DROP TABLE {directory}");
-  switch ($GLOBALS['db_type']) {
-    case 'mysqli':
-    case 'mysql':
-      $ret[] = update_sql("CREATE TABLE {client} (
-        cid int(10) unsigned NOT NULL auto_increment,
-        link varchar(255) NOT NULL default '',
-        name varchar(128) NOT NULL default '',
-        mail varchar(128) NOT NULL default '',
-        slogan longtext NOT NULL,
-        mission longtext NOT NULL,
-        users int(10) NOT NULL default '0',
-        nodes int(10) NOT NULL default '0',
-        version varchar(35) NOT NULL default'',
-        created int(11) NOT NULL default '0',
-        changed int(11) NOT NULL default '0',
-        PRIMARY KEY (cid)
-      )");
-      $ret[] = update_sql("CREATE TABLE {client_system} (
-        cid int(10) NOT NULL default '0',
-        name varchar(255) NOT NULL default '',
-        type varchar(255) NOT NULL default '',
-        PRIMARY KEY (cid,name)
-      )");
-      break;
-
-    case 'pgsql':
-      $ret[] = update_sql("CREATE TABLE {client} (
-        cid SERIAL,
-        link varchar(255) NOT NULL default '',
-        name varchar(128) NOT NULL default '',
-        mail varchar(128) NOT NULL default '',
-        slogan text NOT NULL default '',
-        mission text NOT NULL default '',
-        users integer NOT NULL default '0',
-        nodes integer NOT NULL default '0',
-        version varchar(35) NOT NULL default'',
-        created integer NOT NULL default '0',
-        changed integer NOT NULL default '0',
-        PRIMARY KEY (cid)
-      )");
-      $ret[] = update_sql("CREATE TABLE {client_system} (
-        cid integer NOT NULL,
-        name varchar(255) NOT NULL default '',
-        type varchar(255) NOT NULL default '',
-        PRIMARY KEY (cid,name)
-      )");
-      break;
-  }
-
-  return $ret;
-}
-
-function system_update_167() {
-  $ret = array();
-
-  switch ($GLOBALS['db_type']) {
-    case 'mysqli':
-    case 'mysql':
-      $ret[] = update_sql("ALTER TABLE {vocabulary_node_types} CHANGE type type varchar(32) NOT NULL default ''");
-      break;
-    case 'pgsql':
-      db_change_column($ret, 'vocabulary_node_types', 'type', 'type', 'varchar(32)', array('not null' => TRUE, 'default' => "''"));
-      $ret[] = update_sql("ALTER TABLE {vocabulary_node_types} ADD PRIMARY KEY (vid, type)");
-      break;
-  }
-
-  return $ret;
-}
-
-function system_update_168() {
-  $ret = array();
-
-  $ret[] = update_sql("ALTER TABLE {term_hierarchy} ADD PRIMARY KEY (tid, parent)");
-
-  return $ret;
-}
-
-function system_update_169() {
-  // Warn PGSQL admins if their database is set up incorrectly
-  if ($GLOBALS['db_type'] == 'pgsql') {
-    $encoding = db_result(db_query('SHOW server_encoding'));
-    if (!in_array(strtolower($encoding), array('unicode', 'utf8'))) {
-      $msg = 'Your PostgreSQL database is set up with the wrong character encoding ('. $encoding .'). It is possible it will not work as expected. It is advised to recreate it with UTF-8/Unicode encoding. More information can be found in the <a href="http://www.postgresql.org/docs/7.4/interactive/multibyte.html">PostgreSQL documentation</a>.';
-      watchdog('php', $msg, WATCHDOG_WARNING);
-      drupal_set_message($msg, 'status');
-    }
-  }
-
-  // Note: 'access' table manually updated in update.php
-  return _system_update_utf8(array(
-    'accesslog', 'aggregator_category',
-    'aggregator_category_feed', 'aggregator_category_item',
-    'aggregator_feed', 'aggregator_item', 'authmap', 'blocks',
-    'book', 'boxes', 'cache', 'comments', 'contact',
-    'node_comment_statistics', 'client', 'client_system', 'files',
-    'filter_formats', 'filters', 'flood', 'forum', 'history',
-    'locales_meta', 'locales_source', 'locales_target', 'menu',
-    'node', 'node_access', 'node_revisions', 'profile_fields',
-    'profile_values', 'url_alias', 'permission', 'poll', 'poll_votes',
-    'poll_choices', 'role', 'search_dataset', 'search_index',
-    'search_total', 'sessions', 'sequences', 'node_counter',
-    'system', 'term_data', 'term_hierarchy', 'term_node',
-    'term_relation', 'term_synonym', 'users', 'users_roles', 'variable',
-    'vocabulary', 'vocabulary_node_types', 'watchdog'
-  ));
-}
-
-/**
- * Converts a set of tables to UTF-8 encoding.
- *
- * This update is designed to be re-usable by contrib modules and is
- * used by system_update_169().
- */
-function _system_update_utf8($tables) {
-  // Are we starting this update for the first time?
-  if (!isset($_SESSION['update_utf8'])) {
-    switch ($GLOBALS['db_type']) {
-      // Only for MySQL 4.1+
-      case 'mysqli':
-        break;
-      case 'mysql':
-        if (version_compare(mysql_get_server_info($GLOBALS['active_db']), '4.1.0', '<')) {
-          return array();
-        }
-        break;
-      case 'pgsql':
-        return array();
-    }
-
-    // See if database uses UTF-8 already
-    global $db_url;
-    $url = parse_url(is_array($db_url) ? $db_url['default'] : $db_url);
-    $db_name = substr($url['path'], 1);
-    $result = db_fetch_array(db_query('SHOW CREATE DATABASE `%s`', $db_name));
-    if (preg_match('/utf8/i', array_pop($result))) {
-      return array();
-    }
-
-    // Make list of tables to convert
-    $_SESSION['update_utf8'] = $tables;
-    // Keep track of total for progress bar
-    $_SESSION['update_utf8_total'] = count($tables);
-  }
-
-  // Fetch remaining tables list and convert next table
-  $list = &$_SESSION['update_utf8'];
-
-  $ret = update_convert_table_utf8(array_shift($list));
-
-  // Are we done?
-  if (count($list) == 0) {
-    unset($_SESSION['update_utf8']);
-    unset($_SESSION['update_utf8_total']);
-    return $ret;
-  }
-
-  // Progress percentage
-  $ret['#finished'] = 1 - (count($list) / $_SESSION['update_utf8_total']);
-  return $ret;
-}
-
-function system_update_170() {
-  if (!variable_get('update_170_done', false)) {
-    switch ($GLOBALS['db_type']) {
-      case 'pgsql':
-        $ret = array();
-        db_change_column($ret, 'system', 'schema_version', 'schema_version', 'smallint', array('not null' => TRUE, 'default' => -1));
-        break;
-
-      case 'mysql':
-      case 'mysqli':
-        db_query('ALTER TABLE {system} CHANGE schema_version schema_version smallint(3) not null default -1');
-        break;
-    }
-    // Set schema version -1 (uninstalled) for disabled modules (only affects contrib).
-    db_query('UPDATE {system} SET schema_version = -1 WHERE status = 0 AND schema_version = 0');
-  }
-  return array();
-}
-
-function system_update_171() {
-  $ret = array();
-  $ret[] = update_sql('DELETE FROM {users_roles} WHERE rid IN ('. DRUPAL_ANONYMOUS_RID. ', '. DRUPAL_AUTHENTICATED_RID. ')');
-  return $ret;
-}
-
-function system_update_172() {
-  // Multi-part update
-  if (!isset($_SESSION['system_update_172'])) {
-    $_SESSION['system_update_172'] = 0;
-    $_SESSION['system_update_172_max'] = db_result(db_query('SELECT MAX(cid) FROM {comments}'));
-  }
-
-  include_once './modules/comment.module';
-
-  $limit = 20;
-  $result = db_query_range("SELECT cid, thread FROM {comments} WHERE cid > %d ORDER BY cid ASC", $_SESSION['system_update_172'], 0, $limit);
-  while ($comment = db_fetch_object($result)) {
-    $_SESSION['system_update_172'] = $comment->cid;
-    $thread = explode('.', rtrim($comment->thread, '/'));
-    foreach ($thread as $i => $offset) {
-      // Decode old-style comment codes: 1,2,...,9,90,91,92,...,99,990,991,...
-      $thread[$i] = int2vancode((strlen($offset) - 1) * 10 + substr($offset, -1, 1));
-    }
-    $thread = implode('.', $thread) .'/';
-    db_query("UPDATE {comments} SET thread = '%s' WHERE cid = %d", $thread, $comment->cid);
-  }
-
-  if ($_SESSION['system_update_172'] == $_SESSION['system_update_172_max']) {
-    unset($_SESSION['system_update_172']);
-    unset($_SESSION['system_update_172_max']);
-    return array();
-  }
-  return array('#finished' => $_SESSION['system_update_172'] / $_SESSION['system_update_172_max']);
-}
-
-function system_update_173() {
-  $ret = array();
-  // State tracker to determine whether we keep a backup of the files table or not.
-  $safe = TRUE;
-
-  // PostgreSQL needs CREATE TABLE foobar _AS_ SELECT ...
-  $AS = ($GLOBALS['db_type'] == 'pgsql') ? 'AS' : '';
-
-  // Backup the files table.
-  $ret[] = update_sql("CREATE TABLE {files_backup} $AS SELECT * FROM {files}");
-
-  // Do some files table sanity checking and cleanup.
-  $ret[] = update_sql('DELETE FROM {files} WHERE fid = 0');
-  $ret[] = update_sql('UPDATE {files} SET vid = nid WHERE vid = 0');
-
-  // Create a temporary table to build the new file_revisions and files tables from.
-  $ret[] = update_sql("CREATE TABLE {files_tmp} $AS SELECT * FROM {files}");
-  $ret[] = update_sql('DROP TABLE {files}');
-
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      // create file_revisions table
-      $ret[] = update_sql("CREATE TABLE {file_revisions} (
-        fid integer NOT NULL default 0,
-        vid integer NOT NULL default 0,
-        description varchar(255) NOT NULL default '',
-        list smallint NOT NULL default 0,
-        PRIMARY KEY (fid, vid))");
-      $result = update_sql("INSERT INTO {file_revisions} SELECT DISTINCT ON (fid,vid) fid, vid, description, list FROM {files_tmp}");
-      $ret[] = $result;
-      if ($result['success'] === FALSE) {
-        $safe = FALSE;
-      }
-
-      // Create normalized files table
-      $ret[] = update_sql("CREATE TABLE {files} (
-        fid SERIAL,
-        nid integer NOT NULL default 0,
-        filename varchar(255) NOT NULL default '',
-        filepath varchar(255) NOT NULL default '',
-        filemime varchar(255) NOT NULL default '',
-        filesize integer NOT NULL default 0,
-        PRIMARY KEY (fid))");
-      $result = update_sql("INSERT INTO {files} SELECT DISTINCT ON (fid) fid, nid, filename, filepath, filemime, filesize FROM {files_tmp}");
-      $ret[] = $result;
-      if ($result['success'] === FALSE) {
-        $safe = FALSE;
-      }
-
-      $ret[] = update_sql("SELECT setval('{files}_fid_seq', max(fid)) FROM {files}");
-
-      break;
-
-    case 'mysqli':
-    case 'mysql':
-      // create file_revisions table
-      $ret[] = update_sql("CREATE TABLE {file_revisions} (
-        fid int(10) unsigned NOT NULL default 0,
-        vid int(10) unsigned NOT NULL default 0,
-        description varchar(255) NOT NULL default '',
-        list tinyint(1) unsigned NOT NULL default 0,
-        PRIMARY KEY (fid, vid)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */");
-
-      // Try as you might mysql only does distinct row if you are selecting more than 1 column.
-      $result = update_sql('INSERT INTO {file_revisions} SELECT DISTINCT fid , vid, description, list FROM {files_tmp}');
-      $ret[] = $result;
-      if ($result['success'] === FALSE) {
-        $safe = FALSE;
-      }
-
-      $ret[] = update_sql("CREATE TABLE {files} (
-        fid int(10) unsigned NOT NULL default 0,
-        nid int(10) unsigned NOT NULL default 0,
-        filename varchar(255) NOT NULL default '',
-        filepath varchar(255) NOT NULL default '',
-        filemime varchar(255) NOT NULL default '',
-        filesize int(10) unsigned NOT NULL default 0,
-        PRIMARY KEY (fid)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */");
-      $result = update_sql("INSERT INTO {files} SELECT DISTINCT fid, nid, filename, filepath, filemime, filesize FROM {files_tmp}");
-      $ret[] = $result;
-      if ($result['success'] === FALSE) {
-        $safe = FALSE;
-      }
-
-      break;
-  }
-
-  $ret[] = update_sql("DROP TABLE {files_tmp}");
-
-  // Remove original files table if all went well. Otherwise preserve it and notify user.
-  if ($safe) {
-    $ret[] = update_sql("DROP TABLE {files_backup}");
-  }
-  else {
-    drupal_set_message('Normalizing files table failed. A backup of the original table called {files_backup} remains in your database.');
-  }
-
-  return $ret;
-}
-
-function system_update_174() {
-  // This update (update comments system variables on upgrade) has been removed.
-  return array();
-}
-
-function system_update_175() {
-  $result = db_query('SELECT * FROM {url_alias}');
-  while ($path = db_fetch_object($result)) {
-    $path->src = urldecode($path->src);
-    $path->dst = urldecode($path->dst);
-    db_query("UPDATE {url_alias} SET dst = '%s', src = '%s' WHERE pid = %d", $path->dst, $path->src, $path->pid);
-  }
-  return array();
-}
-
-function system_update_176() {
-  $ret = array();
-  $ret[] = update_sql('ALTER TABLE {filter_formats} ADD UNIQUE (name)');
-  return $ret;
-}
-
-function system_update_177() {
-  $ret = array();
-  $message_ids = array(
-    'welcome_subject' => 'Welcome subject',
-    'welcome_body' => 'Welcome body text',
-    'approval_subject' => 'Approval subject',
-    'approval_body' => 'Approval body text',
-    'pass_subject' => 'Password reset subject',
-    'pass_body' => 'Password reset body text',
-  );
-  foreach ($message_ids as $message_id => $message_text) {
-    if ($admin_setting = variable_get('user_mail_'. $message_id, FALSE)) {
-      // Insert newlines and escape for display as HTML
-      $admin_setting = nl2br(check_plain($message_text ."\n\n". $admin_setting));
-      watchdog('legacy', $admin_setting);
-      $last = db_fetch_object(db_query('SELECT max(wid) AS wid FROM {watchdog}'));
-      // Deleting is required, because _user_mail_text() checks for the existance of the variable.
-      variable_del('user_mail_'. $message_id);
-      $ret[] = array(
-        'query' => strtr('The mail template %message_id has been reset to the default. The old template <a href="%url">has been saved</a>.', array('%message_id' => 'user_mail_'. $message_id, '%url' => url('admin/logs/event/'. $last->wid))),
-        'success' => TRUE
-      );
-    }
-  }
-  return $ret;
-}
-
-function _update_178_url_fix($text) {
-  // Key is the attribute to replace.
-  $urlpatterns['href'] = "/<a[^>]+href=\"([^\"]+)/i";
-  $urlpatterns['src']  = "/<img[^>]+src=\"([^\"]+)/i";
-
-  $old = $text;
-  foreach ($urlpatterns as $type => $pattern) {
-    if (preg_match_all($pattern, $text, $matches)) {
-      foreach ($matches[1] as $url) {
-        if ($url != '' && !strstr($url, 'mailto:') && !strstr($url, '://') && !strstr($url, '../') && !strstr($url, './') && $url[0] != '/' && $url[0] != '#') {
-          $text = preg_replace('|'. $type .'\s*=\s*"'. preg_quote($url) .'\s*"|', $type. '="'.base_path(). $url  .'"', $text);
-        }
-      }
-    }
-  }
-  return $text != $old ? $text : FALSE;
-}
-
-function _update_178_url_formats() {
-  $formats = array();
-
-  // Any format with the HTML filter in it
-  $result = db_query("SELECT format FROM {filters} WHERE module = 'filter' AND delta = 0");
-  while ($format = db_fetch_object($result)) {
-    $formats[$format->format] = true;
-  }
-
-  // Any format with only the linebreak filter in it
-  $result = db_query("SELECT format FROM {filters} WHERE module = 'filter' AND delta = 2");
-  while ($format = db_fetch_object($result)) {
-    if (db_result(db_query('SELECT COUNT(*) FROM {filters} WHERE format = %d', $format->format)) == 1) {
-      $formats[$format->format] = true;
-    }
-  }
-
-  // Any format with 'HTML' in its name
-  $result = db_query("SELECT format FROM {filter_formats} WHERE name LIKE '%HTML%'");
-  while ($format = db_fetch_object($result)) {
-    $formats[$format->format] = true;
-  }
-
-  return $formats;
-}
-
-/**
- * Update base paths for relative URLs in node and comment content.
- */
-function system_update_178() {
-
-  if (variable_get('clean_url', 0) == 1) {
-    // Multi-part update
-    if (!isset($_SESSION['system_update_178_comment'])) {
-      // Check which formats need to be converted
-      $formats = _update_178_url_formats();
-      if (count($formats) == 0) {
-        return array();
-      }
-
-      // Build format query string
-      $_SESSION['formats'] = array_keys($formats);
-      $_SESSION['format_string'] = '('. substr(str_repeat('%d, ', count($formats)), 0, -2) .')';
-
-      // Begin update
-      $_SESSION['system_update_178_comment'] = 0;
-      $_SESSION['system_update_178_node'] = 0;
-      $_SESSION['system_update_178_comment_max'] = db_result(db_query('SELECT MAX(cid) FROM {comments} WHERE format IN '. $_SESSION['format_string'], $_SESSION['formats']));
-      $_SESSION['system_update_178_node_max'] = db_result(db_query('SELECT MAX(vid) FROM {node_revisions} WHERE format IN '. $_SESSION['format_string'], $_SESSION['formats']));
-    }
-
-    $limit = 20;
-
-    // Comments
-    if ($_SESSION['system_update_178_comment'] != $_SESSION['system_update_178_comment_max']) {
-      $args = array_merge(array($_SESSION['system_update_178_comment']), $_SESSION['formats']);
-      $result = db_query_range("SELECT cid, comment FROM {comments} WHERE cid > %d AND format IN ". $_SESSION['format_string'] .' ORDER BY cid ASC', $args, 0, $limit);
-      while ($comment = db_fetch_object($result)) {
-        $_SESSION['system_update_178_comment'] = $comment->cid;
-        $comment->comment = _update_178_url_fix($comment->comment);
-        if ($comment->comment !== FALSE) {
-          db_query("UPDATE {comments} SET comment = '%s' WHERE cid = %d", $comment->comment, $comment->cid);
-        }
-      }
-    }
-
-    // Node revisions
-    $args = array_merge(array($_SESSION['system_update_178_node']), $_SESSION['formats']);
-    $result = db_query_range("SELECT vid, teaser, body FROM {node_revisions} WHERE vid > %d AND format IN ". $_SESSION['format_string'] .' ORDER BY vid ASC', $args, 0, $limit);
-    while ($node = db_fetch_object($result)) {
-      $_SESSION['system_update_178_node'] = $node->vid;
-      $set = array();
-      $args = array();
-
-      $node->teaser = _update_178_url_fix($node->teaser);
-      if ($node->teaser !== FALSE) {
-        $set[] = "teaser = '%s'";
-        $args[] = $node->teaser;
-      }
-
-      $node->body = _update_178_url_fix($node->body);
-      if ($node->body !== FALSE) {
-        $set[] = "body = '%s'";
-        $args[] = $node->body;
-      }
-
-      if (count($set)) {
-        $args[] = $node->vid;
-        db_query('UPDATE {node_revisions} SET '. implode(', ', $set) .' WHERE vid = %d', $args);
-      }
-
-    }
-
-    if ($_SESSION['system_update_178_comment'] == $_SESSION['system_update_178_comment_max'] &&
-        $_SESSION['system_update_178_node'] == $_SESSION['system_update_178_node_max']) {
-      unset($_SESSION['system_update_178_comment']);
-      unset($_SESSION['system_update_178_comment_max']);
-      unset($_SESSION['system_update_178_node']);
-      unset($_SESSION['system_update_178_node_max']);
-      return array();
-    }
-    else {
-      // Report percentage finished
-      return array('#finished' =>
-        ($_SESSION['system_update_178_comment'] + $_SESSION['system_update_178_node']) /
-        ($_SESSION['system_update_178_comment_max'] + $_SESSION['system_update_178_node_max'])
-      );
-    }
-  }
-
-  return array();
-}
-
-/**
- * Update base paths for relative URLs in custom blocks, profiles and various variables.
- */
-function system_update_179() {
-
-  if (variable_get('clean_url', 0) == 1) {
-    // Multi-part update
-    if (!isset($_SESSION['system_update_179_uid'])) {
-      // Check which formats need to be converted
-      $formats = _update_178_url_formats();
-      if (count($formats) == 0) {
-        return array();
-      }
-
-      // Custom Blocks (too small for multipart)
-      $format_string = '('. substr(str_repeat('%d, ', count($formats)), 0, -2) .')';
-      $result = db_query("SELECT bid, body FROM {boxes} WHERE format IN ". $format_string, array_keys($formats));
-      while ($block = db_fetch_object($result)) {
-        $block->body = _update_178_url_fix($block->body);
-        if ($block->body !== FALSE) {
-          db_query("UPDATE {boxes} SET body = '%s' WHERE bid = %d", $block->body, $block->bid);
-        }
-      }
-
-      // Variables (too small for multipart)
-      $vars = array('site_mission', 'site_footer', 'user_registration_help');
-      foreach (node_get_types() as $type => $name) {
-        $vars[] = $type .'_help';
-      }
-      foreach ($vars as $var) {
-        $value = variable_get($var, NULL);
-        if (!is_null($value)) {
-          $value = _update_178_url_fix($value);
-          if ($value !== FALSE) {
-            variable_set($var, $value);
-          }
-        }
-      }
-
-      // See if profiles need to be updated: is the default format HTML?
-      if (!isset($formats[variable_get('filter_default_format', 1)])) {
-        return array();
-      }
-      $result = db_query("SELECT fid FROM {profile_fields} WHERE type = 'textarea'");
-      $fields = array();
-      while ($field = db_fetch_object($result)) {
-        $fields[] = $field->fid;
-      }
-      if (count($fields) == 0) {
-        return array();
-      }
-
-      // Begin multi-part update for profiles
-      $_SESSION['system_update_179_fields'] = $fields;
-      $_SESSION['system_update_179_field_string'] = '('. substr(str_repeat('%d, ', count($fields)), 0, -2) .')';
-      $_SESSION['system_update_179_uid'] = 0;
-      $_SESSION['system_update_179_fid'] = 0;
-      $_SESSION['system_update_179_max'] = db_result(db_query('SELECT MAX(uid) FROM {profile_values} WHERE fid IN '. $_SESSION['system_update_179_field_string'], $_SESSION['system_update_179_fields']));
-    }
-
-    // Fetch next 20 profile values to convert
-    $limit = 20;
-    $args = array_merge(array($_SESSION['system_update_179_uid'], $_SESSION['system_update_179_fid'], $_SESSION['system_update_179_uid']), $_SESSION['system_update_179_fields']);
-    $result = db_query_range("SELECT fid, uid, value FROM {profile_values} WHERE ((uid = %d AND fid > %d) OR uid > %d) AND fid IN ". $_SESSION['system_update_179_field_string'] .' ORDER BY uid ASC, fid ASC', $args, 0, $limit);
-    while ($field = db_fetch_object($result)) {
-      $_SESSION['system_update_179_uid'] = $field->uid;
-      $_SESSION['system_update_179_fid'] = $field->fid;
-      $field->value = _update_178_url_fix($field->value);
-      if ($field->value !== FALSE) {
-        db_query("UPDATE {profile_values} SET value = '%s' WHERE uid = %d AND fid = %d", $field->value, $field->uid, $field->fid);
-      }
-
-    }
-
-    // Done?
-    if (db_num_rows($result) == 0) {
-      unset($_SESSION['system_update_179_uid']);
-      unset($_SESSION['system_update_179_fid']);
-      unset($_SESSION['system_update_179_max']);
-      return array();
-    }
-    else {
-      // Report percentage finished
-      // (Note: make sure we complete all fields for the last user by not reporting 100% too early)
-      return array('#finished' => $_SESSION['system_update_179_uid'] / ($_SESSION['system_update_179_max'] + 1));
-    }
-  }
-
-  return array();
-}
-
-function system_update_180() {
-  $ret = array();
-
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {node} DROP PRIMARY KEY");
-      $ret[] = update_sql("ALTER TABLE {node} ADD PRIMARY KEY (nid, vid)");
-      $ret[] = update_sql("ALTER TABLE {node} ADD UNIQUE (vid)");
-      $ret[] = update_sql("ALTER TABLE {node} ADD INDEX (nid)");
-
-      $ret[] = update_sql("ALTER TABLE {node_counter} CHANGE nid nid INT(10) NOT NULL DEFAULT '0'");
-      break;
-    case 'pgsql':
-      $ret[] = update_sql("ALTER TABLE {node} DROP CONSTRAINT {node}_pkey"); // Change PK
-      $ret[] = update_sql("ALTER TABLE {node} ADD PRIMARY KEY (nid, vid)");
-      $ret[] = update_sql('DROP INDEX {node}_vid_idx'); // Change normal index to UNIQUE index
-      $ret[] = update_sql('CREATE UNIQUE INDEX {node}_vid_idx ON {node}(vid)');
-      $ret[] = update_sql('CREATE INDEX {node}_nid_idx ON {node}(nid)'); // Add index on nid
-      break;
-  }
-
-  return $ret;
-}
-
-function system_update_181() {
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {profile_fields} ADD autocomplete TINYINT(1) NOT NULL AFTER visibility ;");
-      break;
-    case 'pgsql':
-      db_add_column($ret, 'profile_fields', 'autocomplete', 'smallint', array('not null' => TRUE, 'default' => 0));
-      break;
-  }
-  return $ret;
-}
-
-/**
- * The lid field in pgSQL should not be UNIQUE, but an INDEX.
- */
-function system_update_182() {
-  $ret = array();
-
-  if ($GLOBALS['db_type'] == 'pgsql') {
-    $ret[] = update_sql('ALTER TABLE {locales_target} DROP CONSTRAINT {locales_target}_lid_key');
-    $ret[] = update_sql('CREATE INDEX {locales_target}_lid_idx ON {locales_target} (lid)');
-  }
-
-  return $ret;
-}
diff --git a/drupal.module/planetlab.info b/drupal.module/planetlab.info
new file mode 100644 (file)
index 0000000..1626518
--- /dev/null
@@ -0,0 +1,6 @@
+; $Id: aggregator.info,v 1.3 2006/11/21 20:55:33 dries Exp $
+name = "PlanetLab"
+description = "Provides a web UI to the PLC API"
+package = "PLEWWW"
+version = "5.0"
+
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
deleted file mode 100644 (file)
index dd7a477..0000000
+++ /dev/null
@@ -1,797 +0,0 @@
-<?php
-// $Id: bootstrap.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Functions that need to be loaded on every Drupal request.
- */
-
-define('CACHE_PERMANENT', 0);
-define('CACHE_TEMPORARY', -1);
-
-define('CACHE_DISABLED', 0);
-define('CACHE_ENABLED', 1);
-
-define('WATCHDOG_NOTICE', 0);
-define('WATCHDOG_WARNING', 1);
-define('WATCHDOG_ERROR', 2);
-
-define('DRUPAL_BOOTSTRAP_DATABASE', 0);
-define('DRUPAL_BOOTSTRAP_SESSION', 1);
-define('DRUPAL_BOOTSTRAP_PAGE_CACHE', 2);
-define('DRUPAL_BOOTSTRAP_PATH', 3);
-define('DRUPAL_BOOTSTRAP_FULL', 4);
-
-// these values should match the'role' table
-define('DRUPAL_ANONYMOUS_RID', 1);
-define('DRUPAL_AUTHENTICATED_RID', 2);
-
-/**
- * Start the timer with the specified name.  If you start and stop
- * the same timer multiple times, the measured intervals will be
- * accumulated.
- *
- * @param name
- *   The name of the timer.
- */
-function timer_start($name) {
-  global $timers;
-
-  list($usec, $sec) = explode(' ', microtime());
-  $timers[$name]['start'] = (float)$usec + (float)$sec;
-  $timers[$name]['count'] = isset($timers[$name]['count']) ? ++$timers[$name]['count'] : 1;
-}
-
-/**
- * Read the current timer value without stopping the timer.
- *
- * @param name
- *   The name of the timer.
- * @return
- *   The current timer value in ms.
- */
-function timer_read($name) {
-  global $timers;
-
-  list($usec, $sec) = explode(' ', microtime());
-  $stop = (float)$usec + (float)$sec;
-  $diff = round(($stop - $timers[$name]['start']) * 1000, 2);
-
-  return $timers[$name]['time'] + $diff;
-}
-
-/**
- * Stop the timer with the specified name.
- *
- * @param name
- *   The name of the timer.
- * @return
- *   A timer array.  The array contains the number of times the
- *   timer has been started and stopped (count) and the accumulated
- *   timer value in ms (time).
- */
-function timer_stop($name) {
-  global $timers;
-
-  $timers[$name]['time'] = timer_read($name);
-  unset($timers[$name]['start']);
-
-  return $timers[$name];
-}
-
-/**
- * Find the appropriate configuration directory.
- *
- * Try finding a matching configuration directory by stripping the website's
- * hostname from left to right and pathname from right to left. The first
- * configuration file found will be used, the remaining will ignored. If no
- * configuration file is found, return a default value '$confdir/default'.
- *
- * Example for a fictitious site installed at
- * http://www.drupal.org:8080/mysite/test/ the 'settings.php' is searched in
- * the following directories:
- *
- *  1. $confdir/8080.www.drupal.org.mysite.test
- *  2. $confdir/www.drupal.org.mysite.test
- *  3. $confdir/drupal.org.mysite.test
- *  4. $confdir/org.mysite.test
- *
- *  5. $confdir/8080.www.drupal.org.mysite
- *  6. $confdir/www.drupal.org.mysite
- *  7. $confdir/drupal.org.mysite
- *  8. $confdir/org.mysite
- *
- *  9. $confdir/8080.www.drupal.org
- * 10. $confdir/www.drupal.org
- * 11. $confdir/drupal.org
- * 12. $confdir/org
- *
- * 13. $confdir/default
- */
-function conf_path() {
-  static $conf = '';
-
-  if ($conf) {
-    return $conf;
-  }
-
-  $confdir = 'sites';
-  $uri = explode('/', $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME']);
-  $server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
-  for ($i = count($uri) - 1; $i > 0; $i--) {
-    for ($j = count($server); $j > 0; $j--) {
-      $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
-      if (file_exists("$confdir/$dir/settings.php")) {
-        $conf = "$confdir/$dir";
-        return $conf;
-      }
-    }
-  }
-  $conf = "$confdir/default";
-  return $conf;
-}
-
-/**
- * Unsets all disallowed global variables. See $allowed for what's allowed.
- */
-function drupal_unset_globals() {
-  if (ini_get('register_globals')) {
-    $allowed = array('_ENV' => 1, '_GET' => 1, '_POST' => 1, '_COOKIE' => 1, '_FILES' => 1, '_SERVER' => 1, '_REQUEST' => 1, 'access_check' => 1, 'GLOBALS' => 1);
-    foreach ($GLOBALS as $key => $value) {
-      if (!isset($allowed[$key])) {
-        unset($GLOBALS[$key]);
-      }
-    }
-  }
-}
-
-/**
- * Loads the configuration and sets the base URL correctly.
- */
-function conf_init() {
-  global $db_url, $db_prefix, $base_url, $base_path, $base_root, $conf;
-  $conf = array();
-  require_once './'. conf_path() .'/settings.php';
-
-  if (isset($base_url)) {
-    // Parse fixed base URL from settings.php.
-    $parts = parse_url($base_url);
-    if (!isset($parts['path'])) {
-      $parts['path'] = '';
-    }
-    $base_path = $parts['path'] . '/';
-    // Build $base_root (everything until first slash after "scheme://").
-    $base_root = substr($base_url, 0, strlen($base_url) - strlen($parts['path']));
-  }
-  else {
-    // Create base URL
-    $base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
-    $base_url = $base_root .= '://'. $_SERVER['HTTP_HOST'];
-    if ($dir = trim(dirname($_SERVER['SCRIPT_NAME']), '\,/')) {
-      $base_path = "/$dir";
-      $base_url .= $base_path;
-      $base_path .= '/';
-    }
-    else {
-      $base_path = '/';
-    }
-  }
-}
-
-/**
- * Returns and optionally sets the filename for a system item (module,
- * theme, etc.).  The filename, whether provided, cached, or retrieved
- * from the database, is only returned if the file exists.
- *
- * @param $type
- *   The type of the item (i.e. theme, theme_engine, module).
- * @param $name
- *   The name of the item for which the filename is requested.
- * @param $filename
- *   The filename of the item if it is to be set explicitly rather
- *   than by consulting the database.
- *
- * @return
- *   The filename of the requested item.
- */
-function drupal_get_filename($type, $name, $filename = NULL) {
-  static $files = array();
-
-  if (!isset($files[$type])) {
-    $files[$type] = array();
-  }
-
-  if (!empty($filename) && file_exists($filename)) {
-    $files[$type][$name] = $filename;
-  }
-  elseif (isset($files[$type][$name])) {
-    // nothing
-  }
-  elseif (($file = db_result(db_query("SELECT filename FROM {system} WHERE name = '%s' AND type = '%s'", $name, $type))) && file_exists($file)) {
-    $files[$type][$name] = $file;
-  }
-  else {
-    $config = conf_path();
-    $dir = (($type == 'theme_engine') ? 'themes/engines' : "${type}s");
-    $file = (($type == 'theme_engine') ? "$name.engine" : "$name.$type");
-
-    foreach (array("$config/$dir/$file", "$config/$dir/$name/$file", "$dir/$file", "$dir/$name/$file") as $file) {
-      if (file_exists($file)) {
-        $files[$type][$name] = $file;
-        break;
-      }
-    }
-  }
-
-  return $files[$type][$name];
-}
-
-/**
- * Load the persistent variable table.
- *
- * The variable table is composed of values that have been saved in the table
- * with variable_set() as well as those explicitly specified in the configuration
- * file.
- */
-function variable_init($conf = array()) {
-  // NOTE: caching the variables improves performance with 20% when serving cached pages.
-  if ($cached = cache_get('variables')) {
-    $variables = unserialize($cached->data);
-  }
-  else {
-    $result = db_query('SELECT * FROM {variable}');
-    while ($variable = db_fetch_object($result)) {
-      $variables[$variable->name] = unserialize($variable->value);
-    }
-    cache_set('variables', serialize($variables));
-  }
-
-  foreach ($conf as $name => $value) {
-    $variables[$name] = $value;
-  }
-
-  return $variables;
-}
-
-/**
- * Return a persistent variable.
- *
- * @param $name
- *   The name of the variable to return.
- * @param $default
- *   The default value to use if this variable has never been set.
- * @return
- *   The value of the variable.
- */
-function variable_get($name, $default) {
-  global $conf;
-
-  return isset($conf[$name]) ? $conf[$name] : $default;
-}
-
-/**
- * Set a persistent variable.
- *
- * @param $name
- *   The name of the variable to set.
- * @param $value
- *   The value to set. This can be any PHP data type; these functions take care
- *   of serialization as necessary.
- */
-function variable_set($name, $value) {
-  global $conf;
-
-  db_lock_table('variable');
-  db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
-  db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value));
-  db_unlock_tables();
-
-  cache_clear_all('variables');
-
-  $conf[$name] = $value;
-}
-
-/**
- * Unset a persistent variable.
- *
- * @param $name
- *   The name of the variable to undefine.
- */
-function variable_del($name) {
-  global $conf;
-
-  db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
-  cache_clear_all('variables');
-
-  unset($conf[$name]);
-}
-
-/**
- * Return data from the persistent cache.
- *
- * @param $key
- *   The cache ID of the data to retrieve.
- */
-function cache_get($key) {
-  global $user;
-
-  // Garbage collection necessary when enforcing a minimum cache lifetime
-  $cache_flush = variable_get('cache_flush', 0);
-  if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= time())) {
-    // Time to flush old cache data
-    db_query("DELETE FROM {cache} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush);
-    variable_set('cache_flush', 0);
-  }
-
-  $cache = db_fetch_object(db_query("SELECT data, created, headers, expire FROM {cache} WHERE cid = '%s'", $key));
-  if (isset($cache->data)) {
-    // If the data is permanent or we're not enforcing a minimum cache lifetime
-    // always return the cached data.
-    if ($cache->expire == CACHE_PERMANENT || !variable_get('cache_lifetime', 0)) {
-      $cache->data = db_decode_blob($cache->data);
-    }
-    // If enforcing a minimum cache lifetime, validate that the data is
-    // currently valid for this user before we return it by making sure the
-    // cache entry was created before the timestamp in the current session's
-    // cache timer.  The cache variable is loaded into the $user object by
-    // sess_read() in session.inc.
-    else {
-      if (isset($user->cache) && ($user->cache > $cache->created)) {
-        // This cache data is too old and thus not valid for us, ignore it.
-        return 0;
-      }
-      else {
-        $cache->data = db_decode_blob($cache->data);
-      }
-    }
-    return $cache;
-  }
-  return 0;
-}
-
-/**
- * Store data in the persistent cache.
- *
- * @param $cid
- *   The cache ID of the data to store.
- * @param $data
- *   The data to store in the cache. Complex data types must be serialized first.
- * @param $expire
- *   One of the following values:
- *   - CACHE_PERMANENT: Indicates that the item should never be removed unless
- *     explicitly told to using cache_clear_all() with a cache ID.
- *   - CACHE_TEMPORARY: Indicates that the item should be removed at the next
- *     general cache wipe.
- *   - A Unix timestamp: Indicates that the item should be kept at least until
- *     the given time, after which it behaves like CACHE_TEMPORARY.
- * @param $headers
- *   A string containing HTTP header information for cached pages.
- */
-function cache_set($cid, $data, $expire = CACHE_PERMANENT, $headers = NULL) {
-  db_lock_table('cache');
-  db_query("UPDATE {cache} SET data = %b, created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $data, time(), $expire, $headers, $cid);
-  if (!db_affected_rows()) {
-    @db_query("INSERT INTO {cache} (cid, data, created, expire, headers) VALUES ('%s', %b, %d, %d, '%s')", $cid, $data, time(), $expire, $headers);
-  }
-  db_unlock_tables();
-}
-
-/**
- * Expire data from the cache.
- *
- * @param $cid
- *   If set, the cache ID to delete. Otherwise, all cache entries that can
- *   expire are deleted.
- *
- * @param $wildcard
- *   If set to true, the $cid is treated as a substring to match rather than a
- *   complete ID.
- */
-function cache_clear_all($cid = NULL, $wildcard = false) {
-  global $user;
-
-  if (empty($cid)) {
-    if (variable_get('cache_lifetime', 0)) {
-      // We store the time in the current user's $user->cache variable which
-      // will be saved into the sessions table by sess_write().  We then
-      // simulate that the cache was flushed for this user by not returning
-      // cached data that was cached before the timestamp.
-      $user->cache = time();
-
-      $cache_flush = variable_get('cache_flush', 0);
-      if ($cache_flush == 0) {
-        // This is the first request to clear the cache, start a timer.
-        variable_set('cache_flush', time());
-      }
-      else if (time() > ($cache_flush + variable_get('cache_lifetime', 0))) {
-        // Clear the cache for everyone, cache_flush_delay seconds have
-        // passed since the first request to clear the cache.
-        db_query("DELETE FROM {cache} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time());
-        variable_set('cache_flush', 0);
-      }
-    }
-    else {
-      // No minimum cache lifetime, flush all temporary cache entries now.
-      db_query("DELETE FROM {cache} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time());
-    }
-  }
-  else {
-    if ($wildcard) {
-      db_query("DELETE FROM {cache} WHERE cid LIKE '%%%s%%'", $cid);
-    }
-    else {
-      db_query("DELETE FROM {cache} WHERE cid = '%s'", $cid);
-    }
-  }
-}
-
-/**
- * Retrieve the current page from the cache.
- *
- * Note, we do not serve cached pages when status messages are waiting (from
- * a redirected form submission which was completed).
- * Because the output handler is not activated, the resulting page will not
- * get cached either.
- */
-function page_get_cache() {
-  global $user, $base_root;
-
-  $cache = NULL;
-
-  if (!$user->uid && $_SERVER['REQUEST_METHOD'] == 'GET' && count(drupal_set_message()) == 0) {
-    $cache = cache_get($base_root . request_uri());
-
-    if (empty($cache)) {
-      ob_start();
-    }
-  }
-
-  return $cache;
-}
-
-/**
- * Call all init or exit hooks without including all modules.
- *
- * @param $hook
- *   The name of the bootstrap hook we wish to invoke.
- */
-function bootstrap_invoke_all($hook) {
-  foreach (module_list(FALSE, TRUE) as $module) {
-    drupal_load('module', $module);
-    module_invoke($module, $hook);
- }
-}
-
-/**
- * Includes a file with the provided type and name.  This prevents
- * including a theme, engine, module, etc., more than once.
- *
- * @param $type
- *   The type of item to load (i.e. theme, theme_engine, module).
- * @param $name
- *   The name of the item to load.
- *
- * @return
- *   TRUE if the item is loaded or has already been loaded.
- */
-function drupal_load($type, $name) {
-  static $files = array();
-
-  if (isset($files[$type][$name])) {
-    return TRUE;
-  }
-
-  $filename = drupal_get_filename($type, $name);
-
-  if ($filename) {
-    include_once "./$filename";
-    $files[$type][$name] = TRUE;
-
-    return TRUE;
-  }
-
-  return FALSE;
-}
-
-/**
- * Set HTTP headers in preparation for a page response.
- *
- * @see page_set_cache
- */
-function drupal_page_header() {
-  if (variable_get('cache', 0) && $cache = page_get_cache()) {
-    bootstrap_invoke_all('init');
-    // Set default values:
-    $date = gmdate('D, d M Y H:i:s', $cache->created) .' GMT';
-    $etag = '"'. md5($date) .'"';
-
-    // Check http headers:
-    $modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $date : NULL;
-    if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && ($timestamp = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) > 0) {
-      $modified_since = $cache->created <= $timestamp;
-    }
-    else {
-      $modified_since = NULL;
-    }
-    $none_match = !empty($_SERVER['HTTP_IF_NONE_MATCH']) ? $_SERVER['HTTP_IF_NONE_MATCH'] == $etag : NULL;
-
-    // The type checking here is very important, be careful when changing entries.
-    if (($modified_since !== NULL || $none_match !== NULL) && $modified_since !== false && $none_match !== false) {
-      header('HTTP/1.0 304 Not Modified');
-      exit();
-    }
-
-    // Send appropriate response:
-    header("Last-Modified: $date");
-    header("ETag: $etag");
-
-    // Determine if the browser accepts gzipped data.
-    if (@strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === false && function_exists('gzencode')) {
-      // Strip the gzip header and run uncompress.
-      $cache->data = gzinflate(substr(substr($cache->data, 10), 0, -8));
-    }
-    elseif (function_exists('gzencode')) {
-      header('Content-Encoding: gzip');
-    }
-
-    // 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;
-    bootstrap_invoke_all('exit');
-    exit();
-  }
-  else {
-    header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
-    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
-    header("Cache-Control: no-store, no-cache, must-revalidate");
-    header("Cache-Control: post-check=0, pre-check=0", false);
-    header("Pragma: no-cache");
-  }
-}
-
-/**
- * Define the critical hooks that force modules to always be loaded.
- */
-function bootstrap_hooks() {
-  return array('init', 'exit');
-}
-
-/**
- * Unserializes and appends elements from a serialized string.
- *
- * @param $obj
- *   The object to which the elements are appended.
- * @param $field
- *   The attribute of $obj whose value should be unserialized.
- */
-function drupal_unpack($obj, $field = 'data') {
-  if ($obj->$field && $data = unserialize($obj->$field)) {
-    foreach ($data as $key => $value) {
-      if (!isset($obj->$key)) {
-        $obj->$key = $value;
-      }
-    }
-  }
-  return $obj;
-}
-
-/**
- * Return the URI of the referring page.
- */
-function referer_uri() {
-  if (isset($_SERVER['HTTP_REFERER'])) {
-    return $_SERVER['HTTP_REFERER'];
-  }
-}
-
-/**
- * Encode special characters in a plain-text string for display as HTML.
- */
-function check_plain($text) {
-  return htmlspecialchars($text, ENT_QUOTES);
-}
-
-/**
- * Since request_uri() is only available on Apache, we generate an
- * equivalent using other environment variables.
- */
-function request_uri() {
-
-  if (isset($_SERVER['REQUEST_URI'])) {
-    $uri = $_SERVER['REQUEST_URI'];
-  }
-  else {
-    if (isset($_SERVER['argv'])) {
-      $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0];
-    }
-    else {
-      $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
-    }
-  }
-
-  return $uri;
-}
-
-/**
- * Log a system message.
- *
- * @param $type
- *   The category to which this message belongs.
- * @param $message
- *   The message to store in the log.
- * @param $severity
- *   The severity of the message. One of the following values:
- *   - WATCHDOG_NOTICE
- *   - WATCHDOG_WARNING
- *   - WATCHDOG_ERROR
- * @param $link
- *   A link to associate with the message.
- */
-function watchdog($type, $message, $severity = WATCHDOG_NOTICE, $link = NULL) {
-  global $user, $base_root;
-
-  $current_db = db_set_active();
-
-  // Note: log the exact, entire absolute URL.
-  $request_uri = $base_root . request_uri();
-
-  db_query("INSERT INTO {watchdog} (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (%d, '%s', '%s', %d, '%s', '%s', '%s', '%s', %d)", $user->uid, $type, $message, $severity, $link, $request_uri, referer_uri(), $_SERVER['REMOTE_ADDR'], time());
-
-  if ($current_db) {
-    db_set_active($current_db);
-  }
-}
-
-/**
- * Set a message which reflects the status of the performed operation.
- *
- * If the function is called with no arguments, this function returns all set
- * messages without clearing them.
- *
- * @param $message
- *   The message should begin with a capital letter and always ends with a
- *   period '.'.
- * @param $type
- *   The type of the message. One of the following values are possible:
- *   - 'status'
- *   - 'error'
- */
-function drupal_set_message($message = NULL, $type = 'status') {
-  if ($message) {
-    if (!isset($_SESSION['messages'])) {
-      $_SESSION['messages'] = array();
-    }
-
-    if (!isset($_SESSION['messages'][$type])) {
-      $_SESSION['messages'][$type] = array();
-    }
-
-    $_SESSION['messages'][$type][] = $message;
-  }
-
-  // messages not set when DB connection fails
-  return isset($_SESSION['messages']) ? $_SESSION['messages'] : NULL;
-}
-
-/**
- * Return all messages that have been set.
- *
- * As a side effect, this function clears the message queue.
- */
-function drupal_get_messages() {
-  if ($messages = drupal_set_message()) {
-    unset($_SESSION['messages']);
-  }
-
-  return $messages;
-}
-
-/**
- * Perform an access check for a given mask and rule type. Rules are usually created via admin/access/rules page.
- */
-function drupal_is_denied($type, $mask) {
-  $allow = db_fetch_object(db_query("SELECT * FROM {access} WHERE status = 1 AND type = '%s' AND LOWER('%s') LIKE LOWER(mask)", $type, $mask));
-  $deny = db_fetch_object(db_query("SELECT * FROM {access} WHERE status = 0 AND type = '%s' AND LOWER('%s') LIKE LOWER(mask)", $type, $mask));
-
-  return $deny && !$allow;
-}
-
-/**
- * A string describing a phase of Drupal to load. Each phase adds to the
- * previous one, so invoking a later phase automatically runs the earlier
- * phases too. The most important usage is that if you want to access
- * Drupal database from a script without loading anything else, you can
- * include bootstrap.inc, and call drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE).
- *
- * @param $phase
- *   A constant. Allowed values are:
- *     DRUPAL_BOOTSTRAP_DATABASE: initialize database layer.
- *     DRUPAL_BOOTSTRAP_SESSION: initialize session handling.
- *     DRUPAL_BOOTSTRAP_PAGE_CACHE: load bootstrap.inc and module.inc, start
- *       the variable system and try to serve a page from the cache.
- *     DRUPAL_BOOTSTRAP_FULL: Drupal is fully loaded, validate and fix input
- *       data.
- */
-function drupal_bootstrap($phase) {
-  static $phases = array(DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_PAGE_CACHE, DRUPAL_BOOTSTRAP_PATH, DRUPAL_BOOTSTRAP_FULL);
-
-  while (!is_null($current_phase = array_shift($phases))) {
-    _drupal_bootstrap($current_phase);
-    if ($phase == $current_phase) {
-      return;
-    }
-  }
-}
-
-function _drupal_bootstrap($phase) {
-  global $conf;
-
-  switch ($phase) {
-    case DRUPAL_BOOTSTRAP_DATABASE:
-      drupal_unset_globals();
-      // Initialize the configuration
-      conf_init();
-      // Initialize the default database.
-      require_once './includes/database.inc';
-      db_set_active();
-      break;
-
-    case DRUPAL_BOOTSTRAP_SESSION:
-      require_once './includes/session.inc';
-      session_set_save_handler("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc");
-      register_shutdown_function('session_write_close');
-      session_start();
-      break;
-
-    case DRUPAL_BOOTSTRAP_PAGE_CACHE:
-      require_once './includes/module.inc';
-      // Start a page timer:
-      timer_start('page');
-
-      // deny access to hosts which were banned. t() is not yet available.
-      if (drupal_is_denied('host', $_SERVER['REMOTE_ADDR'])) {
-        header('HTTP/1.0 403 Forbidden');
-        print 'Sorry, '. $_SERVER['REMOTE_ADDR']. ' has been banned.';
-        exit();
-      }
-
-      // Initialize configuration variables, using values from conf.php if available.
-      $conf = variable_init(isset($conf) ? $conf : array());
-      drupal_page_header();
-      break;
-
-    case DRUPAL_BOOTSTRAP_PATH:
-      require_once './includes/path.inc';
-      // Initialize $_GET['q'] prior to loading modules and invoking hook_init().
-      drupal_init_path();
-      break;
-
-    case DRUPAL_BOOTSTRAP_FULL:
-      require_once './includes/common.inc';
-      _drupal_bootstrap_full();
-      break;
-  }
-}
-
-/**
- * Enables use of the theme system without requiring database access. Since
- * there is not database access no theme will be enabled and the default
- * themeable functions will be called. Some themeable functions can not be used
- * without the full Drupal API loaded. For example, theme_page() is
- * unavailable and theme_maintenance_page() must be used in its place.
- */
-function drupal_maintenance_theme() {
-  global $theme;
-  require_once './includes/path.inc';
-  require_once './includes/theme.inc';
-  require_once './includes/common.inc';
-  require_once './includes/unicode.inc';
-  unicode_check();
-  $theme = '';
-}
diff --git a/includes/common.inc b/includes/common.inc
deleted file mode 100644 (file)
index fac3658..0000000
+++ /dev/null
@@ -1,1424 +0,0 @@
-<?php
-// $Id: common.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Common functions that many Drupal modules will need to reference.
- *
- * The functions that are critical and need to be available even when serving
- * a cached page are instead located in bootstrap.inc.
- */
-
-/**
- * Return status for saving which involved creating a new item.
- */
-define('SAVED_NEW', 1);
-
-/**
- * Return status for saving which involved an update to an existing item.
- */
-define('SAVED_UPDATED', 2);
-
-/**
- * Return status for saving which deleted an existing item.
- */
-define('SAVED_DELETED', 3);
-
-/**
- * Set content for a specified region.
- *
- * @param $region
- *   Page region the content is assigned to.
- *
- * @param $data
- *   Content to be set.
- */
-function drupal_set_content($region = null, $data = null) {
-  static $content = array();
-
-  if (!is_null($region) && !is_null($data)) {
-    $content[$region][] = $data;
-  }
-  return $content;
-}
-
-/**
- * Get assigned content.
- *
- * @param $region
- *   A specified region to fetch content for.  If null, all regions will be returned.
- *
- * @param $delimiter
- *   Content to be inserted between exploded array elements.
- */
-function drupal_get_content($region = NULL, $delimiter = ' ') {
-  $content = drupal_set_content();
-  if (isset($region)) {
-    if (isset($content[$region]) && is_array($content[$region])) {
-      return implode($delimiter, $content[$region]);
-    }
-  }
-  else {
-    foreach (array_keys($content) as $region) {
-      if (is_array($content[$region])) {
-        $content[$region] = implode($delimiter, $content[$region]);
-      }
-    }
-    return $content;
-  }
-}
-
-/**
- * Set the breadcrumb trail for the current page.
- *
- * @param $breadcrumb
- *   Array of links, starting with "home" and proceeding up to but not including
- *   the current page.
- */
-function drupal_set_breadcrumb($breadcrumb = NULL) {
-  static $stored_breadcrumb;
-
-  if (!is_null($breadcrumb)) {
-    $stored_breadcrumb = $breadcrumb;
-  }
-  return $stored_breadcrumb;
-}
-
-/**
- * Get the breadcrumb trail for the current page.
- */
-function drupal_get_breadcrumb() {
-  $breadcrumb = drupal_set_breadcrumb();
-
-  if (is_null($breadcrumb)) {
-    $breadcrumb = menu_get_active_breadcrumb();
-  }
-
-  return $breadcrumb;
-}
-
-/**
- * Add output to the head tag of the HTML page.
- * This function can be called as long the headers aren't sent.
- */
-function drupal_set_html_head($data = NULL) {
-  static $stored_head = '';
-
-  if (!is_null($data)) {
-    $stored_head .= $data ."\n";
-  }
-  return $stored_head;
-}
-
-/**
- * Retrieve output to be displayed in the head tag of the HTML page.
- */
-function drupal_get_html_head() {
-  $output = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
-  $output .= theme('stylesheet_import', base_path() .'misc/drupal.css');
-  return $output . drupal_set_html_head();
-}
-
-/**
- * Reset the static variable which holds the aliases mapped for this request.
- */
-function drupal_clear_path_cache() {
-  drupal_lookup_path('wipe');
-}
-
-/**
- * Set an HTTP response header for the current page.
- */
-function drupal_set_header($header = NULL) {
-  // We use an array to guarantee there are no leading or trailing delimiters.
-  // Otherwise, header('') could get called when serving the page later, which
-  // ends HTTP headers prematurely on some PHP versions.
-  static $stored_headers = array();
-
-  if (strlen($header)) {
-    header($header);
-    $stored_headers[] = $header;
-  }
-  return implode("\n", $stored_headers);
-}
-
-/**
- * Get the HTTP response headers for the current page.
- */
-function drupal_get_headers() {
-  return drupal_set_header();
-}
-
-/**
- * @name HTTP handling
- * @{
- * Functions to properly handle HTTP responses.
- */
-
-/**
- * Parse an array into a valid urlencoded query string.
- *
- * @param $query
- *   The array to be processed e.g. $_GET
- * @param $exclude
- *   The array filled with keys to be excluded. Use parent[child] to exclude nested items.
- * @param $urlencode
- *   If TRUE, the keys and values are both urlencoded.
- * @param $parent
- *   Should not be passed, only used in recursive calls
- * @return
- *   urlencoded string which can be appended to/as the URL query string
- */
-function drupal_query_string_encode($query, $exclude = array(), $parent = '') {
-  $params = array();
-
-  foreach ($query as $key => $value) {
-    $key = drupal_urlencode($key);
-    if ($parent) {
-      $key = $parent .'['. $key .']';
-    }
-
-    if (in_array($key, $exclude)) {
-      continue;
-    }
-
-    if (is_array($value)) {
-      $params[] = drupal_query_string_encode($value, $exclude, $key);
-    }
-    else {
-      $params[] = $key .'='. drupal_urlencode($value);
-    }
-  }
-
-  return implode('&', $params);
-}
-
-/**
- * Prepare a destination query string for use in combination with
- * drupal_goto(). Used to direct the user back to the referring page
- * after completing a form. By default the current URL is returned.
- * If a destination exists in the previous request, that destination
- * is returned.  As such, a destination can persist across multiple
- * pages.
- *
- * @see drupal_goto()
- */
-function drupal_get_destination() {
-  if (isset($_REQUEST['destination'])) {
-    return 'destination='. urlencode($_REQUEST['destination']);
-  }
-  else {
-    // Use $_REQUEST here to retrieve the original path.
-    $path = isset($_REQUEST['q']) ? $_REQUEST['q'] : '';
-    $query = drupal_query_string_encode($_GET, array('q'));
-    if ($query != '') {
-      $path .= '?'. $query;
-    }
-    return 'destination='. urlencode($path);
-  }
-}
-
-/**
- * Send the user to a different Drupal page.
- *
- * This issues an on-site HTTP redirect. The function makes sure the redirected
- * URL is formatted correctly.
- *
- * Usually the redirected URL is constructed from this function's input
- * parameters.  However you may override that behavior by setting a
- * <em>destination</em> in either the $_REQUEST-array (i.e. by using
- * the query string of an URI) or the $_REQUEST['edit']-array (i.e. by
- * using a hidden form field).  This is used to direct the user back to
- * the proper page after completing a form.  For example, after editing
- * a post on the 'admin/node'-page or after having logged on using the
- * 'user login'-block in a sidebar.  The function drupal_get_destination()
- * can be used to help set the destination URL.
- *
- * It is advised to use drupal_goto() instead of PHP's header(), because
- * drupal_goto() will append the user's session ID to the URI when PHP is
- * compiled with "--enable-trans-sid".
- *
- * This function ends the request; use it rather than a print theme('page')
- * statement in your menu callback.
- *
- * @param $path
- *   A Drupal path.
- * @param $query
- *   The query string component, if any.
- * @param $fragment
- *   The destination fragment identifier (named anchor).
- *
- * @see drupal_get_destination()
- */
-function drupal_goto($path = '', $query = NULL, $fragment = NULL) {
-  if (isset($_REQUEST['destination'])) {
-    extract(parse_url($_REQUEST['destination']));
-  }
-  else if (isset($_REQUEST['edit']['destination'])) {
-    extract(parse_url($_REQUEST['edit']['destination']));
-  }
-
-  $url = url($path, $query, $fragment, TRUE);
-
-  // Before the redirect, allow modules to react to the end of the page request.
-  module_invoke_all('exit', $url);
-
-  header('Location: '. $url);
-
-  // The "Location" header sends a REDIRECT status code to the http
-  // daemon. In some cases this can go wrong, so we make sure none
-  // of the code below the drupal_goto() call gets executed when we redirect.
-  exit();
-}
-
-/**
- * Generates a site off-line message
- */
-function drupal_site_offline() {
-  drupal_set_header('HTTP/1.0 503 Service unavailable');
-  drupal_set_title(t('Site off-line'));
-  print theme('maintenance_page', filter_xss_admin(variable_get('site_offline_message',
-    t('%site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('%site' => variable_get('site_name', t('This Drupal site')))))));
-}
-
-/**
- * Generates a 404 error if the request can not be handled.
- */
-function drupal_not_found() {
-  drupal_set_header('HTTP/1.0 404 Not Found');
-  watchdog('page not found', t('%page not found.', array('%page' => theme('placeholder', $_GET['q']))), WATCHDOG_WARNING);
-
-  // Keep old path for reference
-  if (!isset($_REQUEST['destination'])) {
-    $_REQUEST['destination'] = $_GET['q'];
-  }
-
-  $path = drupal_get_normal_path(variable_get('site_404', ''));
-  if ($path && $path != $_GET['q']) {
-    menu_set_active_item($path);
-    $return = menu_execute_active_handler();
-  }
-  else {
-    // Redirect to a non-existent menu item to make possible tabs disappear.
-    menu_set_active_item('');
-  }
-
-  if (empty($return)) {
-    drupal_set_title(t('Page not found'));
-  }
-  print theme('page', $return);
-}
-
-/**
- * Generates a 403 error if the request is not allowed.
- */
-function drupal_access_denied() {
-  drupal_set_header('HTTP/1.0 403 Forbidden');
-  watchdog('access denied', t('%page denied access.', array('%page' => theme('placeholder', $_GET['q']))), WATCHDOG_WARNING, l(t('view'), $_GET['q']));
-
-  // Keep old path for reference
-  if (!isset($_REQUEST['destination'])) {
-    $_REQUEST['destination'] = $_GET['q'];
-  }
-
-  $path = drupal_get_normal_path(variable_get('site_403', ''));
-  if ($path && $path != $_GET['q']) {
-    menu_set_active_item($path);
-    $return = menu_execute_active_handler();
-  }
-  else {
-    // Redirect to a non-existent menu item to make possible tabs disappear.
-    menu_set_active_item('');
-  }
-
-  if (empty($return)) {
-    drupal_set_title(t('Access denied'));
-    $return = t('You are not authorized to access this page.');
-  }
-  print theme('page', $return);
-}
-
-/**
- * Perform an HTTP request.
- *
- * This is a flexible and powerful HTTP client implementation. Correctly handles
- * GET, POST, PUT or any other HTTP requests. Handles redirects.
- *
- * @param $url
- *   A string containing a fully qualified URI.
- * @param $headers
- *   An array containing an HTTP header => value pair.
- * @param $method
- *   A string defining the HTTP request to use.
- * @param $data
- *   A string containing data to include in the request.
- * @param $retry
- *   An integer representing how many times to retry the request in case of a
- *   redirect.
- * @return
- *   An object containing the HTTP request headers, response code, headers,
- *   data, and redirect status.
- */
-function drupal_http_request($url, $headers = array(), $method = 'GET', $data = NULL, $retry = 3) {
-  $result = new StdClass();
-
-  // Parse the URL, and make sure we can handle the schema.
-  $uri = parse_url($url);
-  switch ($uri['scheme']) {
-    case 'http':
-      $port = isset($uri['port']) ? $uri['port'] : 80;
-      $host = $uri['host'] . ($port != 80 ? ':'. $port : '');
-      $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
-      break;
-    case 'https':
-      // Note: Only works for PHP 4.3 compiled with OpenSSL.
-      $port = isset($uri['port']) ? $uri['port'] : 443;
-      $host = $uri['host'] . ($port != 443 ? ':'. $port : '');
-      $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20);
-      break;
-    default:
-      $result->error = 'invalid schema '. $uri['scheme'];
-      return $result;
-  }
-
-  // Make sure the socket opened properly.
-  if (!$fp) {
-    $result->error = trim($errno .' '. $errstr);
-    return $result;
-  }
-
-  // Construct the path to act on.
-  $path = isset($uri['path']) ? $uri['path'] : '/';
-  if (isset($uri['query'])) {
-    $path .= '?'. $uri['query'];
-  }
-
-  // Create HTTP request.
-  $defaults = array(
-    // RFC 2616: "non-standard ports MUST, default ports MAY be included".
-    // We don't add the port to prevent from breaking rewrite rules checking
-    // the host that do not take into account the port number.
-    'Host' => "Host: $host",
-    'User-Agent' => 'User-Agent: Drupal (+http://drupal.org/)',
-    'Content-Length' => 'Content-Length: '. strlen($data)
-  );
-
-  foreach ($headers as $header => $value) {
-    $defaults[$header] = $header .': '. $value;
-  }
-
-  $request = $method .' '. $path ." HTTP/1.0\r\n";
-  $request .= implode("\r\n", $defaults);
-  $request .= "\r\n\r\n";
-  if ($data) {
-    $request .= $data ."\r\n";
-  }
-  $result->request = $request;
-
-  fwrite($fp, $request);
-
-  // Fetch response.
-  $response = '';
-  while (!feof($fp) && $chunk = fread($fp, 1024)) {
-    $response .= $chunk;
-  }
-  fclose($fp);
-
-  // Parse response.
-  list($split, $result->data) = explode("\r\n\r\n", $response, 2);
-  $split = preg_split("/\r\n|\n|\r/", $split);
-
-  list($protocol, $code, $text) = explode(' ', trim(array_shift($split)), 3);
-  $result->headers = array();
-
-  // Parse headers.
-  while ($line = trim(array_shift($split))) {
-    list($header, $value) = explode(':', $line, 2);
-    if (isset($result->headers[$header]) && $header == 'Set-Cookie') {
-      // RFC 2109: the Set-Cookie response header comprises the token Set-
-      // Cookie:, followed by a comma-separated list of one or more cookies.
-      $result->headers[$header] .= ','. trim($value);
-    }
-    else {
-      $result->headers[$header] = trim($value);
-    }
-  }
-
-  $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',
-    300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect',
-    400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed',
-    500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported'
-  );
-  // RFC 2616 states that all unknown HTTP codes must be treated the same as
-  // the base code in their class.
-  if (!isset($responses[$code])) {
-    $code = floor($code / 100) * 100;
-  }
-
-  switch ($code) {
-    case 200: // OK
-    case 304: // Not modified
-      break;
-    case 301: // Moved permanently
-    case 302: // Moved temporarily
-    case 307: // Moved temporarily
-      $location = $result->headers['Location'];
-
-      if ($retry) {
-        $result = drupal_http_request($result->headers['Location'], $headers, $method, $data, --$retry);
-        $result->redirect_code = $result->code;
-      }
-      $result->redirect_url = $location;
-
-      break;
-    default:
-      $result->error = $text;
-  }
-
-  $result->code = $code;
-  return $result;
-}
-/**
- * @} End of "HTTP handling".
- */
-
-/**
- * Log errors as defined by administrator
- * Error levels:
- *  0 = Log errors to database.
- *  1 = Log errors to database and to screen.
- */
-function error_handler($errno, $message, $filename, $line) {
-  if ($errno & (E_ALL ^ E_NOTICE)) {
-    $types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning');
-    $entry = $types[$errno] .': '. $message .' in '. $filename .' on line '. $line .'.';
-
-    // Note: force display of error messages in update.php
-    if (variable_get('error_level', 1) == 1 || strstr($_SERVER['PHP_SELF'], 'update.php')) {
-      drupal_set_message($entry, 'error');
-    }
-
-    watchdog('php', t('%message in %file on line %line.', array('%error' => $types[$errno], '%message' => $message, '%file' => $filename, '%line' => $line)), WATCHDOG_ERROR);
-  }
-}
-
-function _fix_gpc_magic(&$item) {
-  if (is_array($item)) {
-    array_walk($item, '_fix_gpc_magic');
-  }
-  else {
-    $item = stripslashes($item);
-  }
-}
-
-/**
- * Correct double-escaping problems caused by "magic quotes" in some PHP
- * installations.
- */
-function fix_gpc_magic() {
-  static $fixed = false;
-  if (!$fixed && ini_get('magic_quotes_gpc')) {
-    array_walk($_GET, '_fix_gpc_magic');
-    array_walk($_POST, '_fix_gpc_magic');
-    array_walk($_COOKIE, '_fix_gpc_magic');
-    array_walk($_REQUEST, '_fix_gpc_magic');
-    $fixed = true;
-  }
-}
-
-/**
- * @name Messages
- * @{
- * Frequently used messages.
- */
-
-/**
- * Return a string with a "not applicable" message.
- */
-function message_na() {
-  return t('n/a');
-}
-
-/**
- * @} End of "Messages".
- */
-
-/**
- * Initialize the localization system.
- */
-function locale_initialize() {
-  global $user;
-
-  if (function_exists('i18n_get_lang')) {
-    return i18n_get_lang();
-  }
-
-  if (function_exists('locale')) {
-    $languages = locale_supported_languages();
-    $languages = $languages['name'];
-  }
-  else {
-    // Ensure the locale/language is correctly returned, even without locale.module.
-    // Useful for e.g. XML/HTML 'lang' attributes.
-    $languages = array('en' => 'English');
-  }
-  if ($user->uid && isset($languages[$user->language])) {
-    return $user->language;
-  }
-  else {
-    return key($languages);
-  }
-}
-
-/**
- * Translate strings to the current locale.
- *
- * When using t(), try to put entire sentences and strings in one t() call.
- * This makes it easier for translators. HTML markup within translation strings
- * is acceptable, if necessary. The suggested syntax for a link embedded
- * within a translation string is:
- * @code
- *   $msg = t('You must log in below or <a href="%url">create a new
- *             account</a> before viewing the next page.', array('%url'
- *             => url('user/register')));
- * @endcode
- * We suggest the same syntax for links to other sites. This makes it easy to
- * change link URLs if needed (which happens often) without requiring updates
- * to translations.
- *
- * @param $string
- *   A string containing the English string to translate.
- * @param $args
- *   An associative array of replacements to make after translation. Incidences
- *   of any key in this array are replaced with the corresponding value.
- * @return
- *   The translated string.
- */
-function t($string, $args = 0) {
-  global $locale;
-  if (function_exists('locale') && $locale != 'en') {
-    $string = locale($string);
-  }
-
-  if (!$args) {
-    return $string;
-  }
-  else {
-    return strtr($string, $args);
-  }
-}
-
-/**
- * @defgroup validation Input validation
- * @{
- * Functions to validate user input.
- */
-
-/**
- * Verify the syntax of the given e-mail address.
- *
- * Empty e-mail addresses are allowed. See RFC 2822 for details.
- *
- * @param $mail
- *   A string containing an e-mail address.
- * @return
- *   TRUE if the address is in a valid format.
- */
-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])\.?)+';
-  $ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}';
-  $ipv6 = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}';
-
-  return preg_match("/^$user@($domain|(\[($ipv4|$ipv6)\]))$/", $mail);
-}
-
-/**
- * Verify the syntax of the given URL.
- *
- * @param $url
- *   The URL to verify.
- * @param $absolute
- *   Whether the URL is absolute (beginning with a scheme such as "http:").
- * @return
- *   TRUE if the URL is in a valid format.
- */
-function valid_url($url, $absolute = FALSE) {
-  $allowed_characters = '[a-z0-9\/:_\-_\.\?\$,~=#&%\+]';
-  if ($absolute) {
-    return preg_match("/^(http|https|ftp):\/\/". $allowed_characters ."+$/i", $url);
-  }
-  else {
-    return preg_match("/^". $allowed_characters ."+$/i", $url);
-  }
-}
-
-/**
- * Register an event for the current visitor (hostname/IP) to the flood control mechanism.
- *
- * @param $name
- *   The name of the event.
- */
-function flood_register_event($name) {
-  db_query("INSERT INTO {flood} (event, hostname, timestamp) VALUES ('%s', '%s', %d)", $name, $_SERVER['REMOTE_ADDR'], time());
-}
-
-/**
- * Check if the current visitor (hostname/IP) is allowed to proceed with the specified event.
- * The user is allowed to proceed if he did not trigger the specified event more than
- * $threshold times per hour.
- *
- * @param $name
- *   The name of the event.
- * @param $number
- *   The maximum number of the specified event per hour (per visitor).
- * @return
- *   True if the user did not exceed the hourly threshold.  False otherwise.
- */
-function flood_is_allowed($name, $threshold) {
-  $number = db_num_rows(db_query("SELECT event FROM {flood} WHERE event = '%s' AND hostname = '%s' AND timestamp > %d", $name, $_SERVER['REMOTE_ADDR'], time() - 3600));
-  return ($number < $threshold ? TRUE : FALSE);
-}
-
-function check_file($filename) {
-  return is_uploaded_file($filename);
-}
-
-/**
- * Prepare a URL for use in an HTML attribute. Strips harmful protocols.
- *
- */
-function check_url($uri) {
-  return filter_xss_bad_protocol($uri, FALSE);
-}
-
-/**
- * @defgroup format Formatting
- * @{
- * Functions to format numbers, strings, dates, etc.
- */
-
-/**
- * Formats an RSS channel.
- *
- * Arbitrary elements may be added using the $args associative array.
- */
-function format_rss_channel($title, $link, $description, $items, $language = 'en', $args = array()) {
-  // arbitrary elements may be added using the $args associative array
-
-  $output = "<channel>\n";
-  $output .= ' <title>'. check_plain($title) ."</title>\n";
-  $output .= ' <link>'. check_url($link) ."</link>\n";
-
-  // The RSS 2.0 "spec" doesn't indicate HTML can be used in the description.
-  // We strip all HTML tags, but need to prevent double encoding from properly
-  // escaped source data (such as &amp becoming &amp;amp;).
-  $output .= ' <description>'. check_plain(decode_entities(strip_tags($description))) ."</description>\n";
-  $output .= ' <language>'. check_plain($language) ."</language>\n";
-  $output .= format_xml_elements($args);
-  $output .= $items;
-  $output .= "</channel>\n";
-
-  return $output;
-}
-
-/**
- * Format a single RSS item.
- *
- * Arbitrary elements may be added using the $args associative array.
- */
-function format_rss_item($title, $link, $description, $args = array()) {
-  $output = "<item>\n";
-  $output .= ' <title>'. check_plain($title) ."</title>\n";
-  $output .= ' <link>'. check_url($link) ."</link>\n";
-  $output .= ' <description>'. check_plain($description) ."</description>\n";
-  $output .= format_xml_elements($args);
-  $output .= "</item>\n";
-
-  return $output;
-}
-
-/**
- * Format XML elements.
- *
- * @param $array
- *   An array where each item represent an element and is either a:
- *   - (key => value) pair (<key>value</key>)
- *   - Associative array with fields:
- *     - 'key': element name
- *     - 'value': element contents
- *     - 'attributes': associative array of element attributes
- *
- * In both cases, 'value' can be a simple string, or it can be another array
- * with the same format as $array itself for nesting.
- */
-function format_xml_elements($array) {
-  foreach ($array as $key => $value) {
-    if (is_numeric($key)) {
-      if ($value['key']) {
-        $output .= ' <'. $value['key'];
-        if (isset($value['attributes']) && is_array($value['attributes'])) {
-          $output .= drupal_attributes($value['attributes']);
-        }
-
-        if ($value['value'] != '') {
-          $output .= '>'. (is_array($value['value']) ? format_xml_tags($value['value']) : check_plain($value['value'])) .'</'. $value['key'] .">\n";
-        }
-        else {
-          $output .= " />\n";
-        }
-      }
-    }
-    else {
-      $output .= ' <'. $key .'>'. (is_array($value) ? format_xml_tags($value) : check_plain($value)) ."</$key>\n";
-    }
-  }
-  return $output;
-}
-
-/**
- * Format a string containing a count of items.
- *
- * This function ensures that the string is pluralized correctly. Since t() is
- * called by this function, make sure not to pass already-localized strings to it.
- *
- * @param $count
- *   The item count to display.
- * @param $singular
- *   The string for the singular case. Please make sure it is clear this is
- *   singular, to ease translation (e.g. use "1 new comment" instead of "1 new").
- * @param $plural
- *   The string for the plural case. Please make sure it is clear this is plural,
- *   to ease translation. Use %count in place of the item count, as in "%count
- *   new comments".
- * @return
- *   A translated string.
- */
-function format_plural($count, $singular, $plural) {
-  if ($count == 1) return t($singular, array("%count" => $count));
-
-  // get the plural index through the gettext formula
-  $index = (function_exists('locale_get_plural')) ? locale_get_plural($count) : -1;
-  if ($index < 0) { // backward compatibility
-    return t($plural, array("%count" => $count));
-  }
-  else {
-    switch ($index) {
-      case "0":
-        return t($singular, array("%count" => $count));
-      case "1":
-        return t($plural, array("%count" => $count));
-      default:
-        return t(strtr($plural, array("%count" => '%count['. $index .']')), array('%count['. $index .']' => $count));
-    }
-  }
-}
-
-/**
- * Generate a string representation for the given byte count.
- *
- * @param $size
- *   The size in bytes.
- * @return
- *   A translated string representation of the size.
- */
-function format_size($size) {
-  $suffix = t('bytes');
-  if ($size >= 1024) {
-    $size = round($size / 1024, 2);
-    $suffix = t('KB');
-  }
-  if ($size >= 1024) {
-    $size = round($size / 1024, 2);
-    $suffix = t('MB');
-  }
-  return t('%size %suffix', array('%size' => $size, '%suffix' => $suffix));
-}
-
-/**
- * Format a time interval with the requested granularity.
- *
- * @param $timestamp
- *   The length of the interval in seconds.
- * @param $granularity
- *   How many different units to display in the string.
- * @return
- *   A 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);
-  $output = '';
-  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');
-}
-
-/**
- * Format 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, as a UNIX timestamp.
- * @param $type
- *   The format to use. Can be "small", "medium" or "large" for the preconfigured
- *   date formats. If "custom" is specified, then $format is required as well.
- * @param $format
- *   A PHP date format string as required by date(). A backslash should be used
- *   before a character to avoid interpreting the character as part of a date
- *   format.
- * @param $timezone
- *   Time zone offset in seconds; if omitted, the user's time zone is used.
- * @return
- *   A translated date string in the requested format.
- */
-function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL) {
-  if (!isset($timezone)) {
-    global $user;
-    if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
-      $timezone = $user->timezone;
-    }
-    else {
-      $timezone = variable_get('date_default_timezone', 0);
-    }
-  }
-
-  $timestamp += $timezone;
-
-  switch ($type) {
-    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');
-      break;
-    case 'custom':
-      // No change to format
-      break;
-    case 'medium':
-    default:
-      $format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
-  }
-
-  $max = strlen($format);
-  $date = '';
-  for ($i = 0; $i < $max; $i++) {
-    $c = $format[$i];
-    if (strpos('AaDFlM', $c) !== false) {
-      $date .= t(gmdate($c, $timestamp));
-    }
-    else if (strpos('BdgGhHiIjLmnsStTUwWYyz', $c) !== false) {
-      $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 ($c == 'O') {
-      $date .= sprintf('%s%02d%02d', ($timezone < 0 ? '-' : '+'), abs($timezone / 3600), abs($timezone % 3600) / 60);
-    }
-    else if ($c == 'Z') {
-      $date .= $timezone;
-    }
-    else if ($c == '\\') {
-      $date .= $format[++$i];
-    }
-    else {
-      $date .= $c;
-    }
-  }
-
-  return $date;
-}
-
-/**
- * @} End of "defgroup format".
- */
-
-/**
- * Generate a URL from a Drupal menu path. Will also pass-through existing URLs.
- *
- * @param $path
- *   The Drupal path being linked to, such as "admin/node", or an existing URL
- *   like "http://drupal.org/".
- * @param $query
- *   A query string to append to the link or URL.
- * @param $fragment
- *   A fragment identifier (named anchor) to append to the link. If an existing
- *   URL with a fragment identifier is used, it will be replaced. Note, do not
- *   include the '#'.
- * @param $absolute
- *   Whether to force the output to be an absolute link (beginning with http:).
- *   Useful for links that will be displayed outside the site, such as in an
- *   RSS feed.
- * @return
- *   a string containing a URL to the given path.
- *
- * When creating links in modules, consider whether l() could be a better
- * alternative than url().
- */
-function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
-  if (isset($fragment)) {
-    $fragment = '#'. $fragment;
-  }
-
-  // Return an external link if $path contains an allowed absolute URL.
-  // Only call the slow filter_xss_bad_protocol if $path contains a ':'.
-  if (strpos($path, ':') !== FALSE && filter_xss_bad_protocol($path, FALSE) == check_plain($path)) {
-    // Split off the fragment
-    if (strpos($path, '#')) {
-      list($path, $old_fragment) = explode('#', $path, 2);
-      if (isset($old_fragment) && !isset($fragment)) {
-        $fragment = '#'. $old_fragment;
-      }
-    }
-    // Append the query
-    if (isset($query)) {
-      $path .= (strpos($path, '?') ? '&' : '?') . $query;
-    }
-    // Reassemble
-    return $path . $fragment;
-  }
-
-  global $base_url;
-  static $script;
-  static $clean_url;
-
-  if (empty($script)) {
-    // On some web servers, such as IIS, we can't omit "index.php".  So, we
-    // generate "index.php?q=foo" instead of "?q=foo" on anything that is not
-    // Apache.
-    $script = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === false) ? 'index.php' : '';
-  }
-
-  // Cache the clean_url variable to improve performance.
-  if (!isset($clean_url)) {
-    $clean_url = (bool)variable_get('clean_url', '0');
-  }
-
-  $base = ($absolute ? $base_url . '/' : base_path());
-
-  // The special path '<front>' links to the default front page.
-  if (!empty($path) && $path != '<front>') {
-    $path = drupal_get_path_alias($path);
-    $path = drupal_urlencode($path);
-    if (!$clean_url) {
-      if (isset($query)) {
-        return $base . $script .'?q='. $path .'&'. $query . $fragment;
-      }
-      else {
-        return $base . $script .'?q='. $path . $fragment;
-      }
-    }
-    else {
-      if (isset($query)) {
-        return $base . $path .'?'. $query . $fragment;
-      }
-      else {
-        return $base . $path . $fragment;
-      }
-    }
-  }
-  else {
-    if (isset($query)) {
-      return $base . $script .'?'. $query . $fragment;
-    }
-    else {
-      return $base . $fragment;
-    }
-  }
-}
-
-/**
- * Format an attribute string to insert in a tag.
- *
- * @param $attributes
- *   An associative array of HTML attributes.
- * @return
- *   An HTML string ready for insertion in a tag.
- */
-function drupal_attributes($attributes = array()) {
-  if (is_array($attributes)) {
-    $t = '';
-    foreach ($attributes as $key => $value) {
-      $t .= " $key=".'"'. check_plain($value) .'"';
-    }
-    return $t;
-  }
-}
-
-/**
- * Format an internal Drupal link.
- *
- * This function correctly handles aliased paths, and allows themes to highlight
- * links to the current page correctly, so all internal links output by modules
- * should be generated by this function if possible.
- *
- * @param $text
- *   The text to be enclosed with the anchor tag.
- * @param $path
- *   The Drupal path being linked to, such as "admin/node". Can be an external
- *   or internal URL.
- *     - If you provide the full URL, it will be considered an
- *   external URL.
- *     - If you provide only the path (e.g. "admin/node"), it is considered an
- *   internal link. In this case, it must be a system URL as the url() function
- *   will generate the alias.
- * @param $attributes
- *   An associative array of HTML attributes to apply to the anchor tag.
- * @param $query
- *   A query string to append to the link.
- * @param $fragment
- *   A fragment identifier (named anchor) to append to the link.
- * @param $absolute
- *   Whether to force the output to be an absolute link (beginning with http:).
- *   Useful for links that will be displayed outside the site, such as in an RSS
- *   feed.
- * @param $html
- *   Whether the title is HTML, or just plain-text. For example for making an
- *   image a link, this must be set to TRUE, or else you will see the encoded
- *   HTML.
- * @return
- *   an HTML string containing a link to the given path.
- */
-function l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE) {
-  if ($path == $_GET['q']) {
-    if (isset($attributes['class'])) {
-      $attributes['class'] .= ' active';
-    }
-    else {
-      $attributes['class'] = 'active';
-    }
-  }
-  return '<a href="'. check_url(url($path, $query, $fragment, $absolute)) .'"'. drupal_attributes($attributes) .'>'. ($html ? $text : check_plain($text)) .'</a>';
-}
-
-/**
- * Perform end-of-request tasks.
- *
- * This function sets the page cache if appropriate, and allows modules to
- * react to the closing of the page by calling hook_exit().
- */
-function drupal_page_footer() {
-  if (variable_get('cache', 0)) {
-    page_set_cache();
-  }
-
-  module_invoke_all('exit');
-}
-
-/**
- * Form an associative array from a linear array.
- *
- * This function 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
- * input array. The values will be the same as the keys unless a function is
- * specified, in which case the output of the function is used for the values
- * instead.
- *
- * @param $array
- *   A linear array.
- * @param $function
- *   The name of a function to apply to all values before output.
- * @result
- *   An associative array.
- */
-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;
-  }
-}
-
-/**
- * Evaluate a string of PHP code.
- *
- * This is a wrapper around PHP's eval(). It uses output buffering to capture both
- * returned and printed text. Unlike eval(), we require code to be surrounded by
- * <?php ?> tags; in other words, we evaluate the code as if it were a stand-alone
- * PHP file.
- *
- * Using this wrapper also ensures that the PHP code which is evaluated can not
- * overwrite any variables in the calling code, unlike a regular eval() call.
- *
- * @param $code
- *   The code to evaluate.
- * @return
- *   A string containing the printed output of the code, followed by the returned
- *   output of the code.
- */
-function drupal_eval($code) {
-  ob_start();
-  print eval('?>'. $code);
-  $output = ob_get_contents();
-  ob_end_clean();
-  return $output;
-}
-
-/**
- * Returns the path to a system item (module, theme, etc.).
- *
- * @param $type
- *   The type of the item (i.e. theme, theme_engine, module).
- * @param $name
- *   The name of the item for which the path is requested.
- *
- * @return
- *   The path to the requested item.
- */
-function drupal_get_path($type, $name) {
-  return dirname(drupal_get_filename($type, $name));
-}
-
-/**
- * Returns the base URL path of the Drupal installation.
- * At the very least, this will always default to /.
- */
-function base_path() {
-  return $GLOBALS['base_path'];
-}
-
-/**
- * Provide a substitute clone() function for PHP4.
- */
-function drupal_clone($object) {
-  return version_compare(phpversion(), '5.0') < 0 ? $object : clone($object);
-}
-
-/**
- * Add a <link> tag to the page's HEAD.
- */
-function drupal_add_link($attributes) {
-  drupal_set_html_head('<link'. drupal_attributes($attributes) ." />\n");
-}
-
-/**
- * Add a JavaScript file to the output.
- *
- * The first time this function is invoked per page request,
- * it adds "misc/drupal.js" to the output. Other scripts
- * depends on the 'killswitch' inside it.
- */
-function drupal_add_js($file, $nocache = FALSE) {
-  static $sent = array();
-
-  $postfix = $nocache ? '?'. time() : '';
-  if (!isset($sent['misc/drupal.js'])) {
-    drupal_set_html_head('<script type="text/javascript" src="'. base_path() .'misc/drupal.js'. $postfix .'"></script>');
-    $sent['misc/drupal.js'] = true;
-  }
-  if (!isset($sent[$file])) {
-    drupal_set_html_head('<script type="text/javascript" src="'. check_url(base_path() . $file) . $postfix .'"></script>');
-    $sent[$file] = true;
-  }
-}
-
-/**
- * Generates a Javascript call, while importing the arguments as is.
- * PHP arrays are turned into JS objects to preserve keys. This means the array
- * keys must conform to JS's member naming rules.
- *
- * @param $function
- *   The name of the function to call.
- * @param $arguments
- *   An array of arguments.
- */
-function drupal_call_js($function) {
-  $arguments = func_get_args();
-  array_shift($arguments);
-  $args = array();
-  foreach ($arguments as $arg) {
-    $args[] = drupal_to_js($arg);
-  }
-  $output = '<script type="text/javascript">'. $function .'('. implode(', ', $args) .');</script>';
-  return $output;
-}
-
-/**
- * Converts a PHP variable into its Javascript equivalent.
- *
- * We use HTML-safe strings, i.e. with <, > and & escaped.
- */
-function drupal_to_js($var) {
-  switch (gettype($var)) {
-    case 'boolean':
-      return $var ? 'true' : 'false'; // Lowercase necessary!
-    case 'integer':
-    case 'double':
-      return $var;
-    case 'resource':
-    case 'string':
-      return '"'. str_replace(array("\r", "\n", "<", ">", "&"),
-                              array('\r', '\n', '\x3c', '\x3e', '\x26'),
-                              addslashes($var)) .'"';
-    case 'array':
-      if (array_keys($var) === range(0, sizeof($var) - 1)) {
-        $output = array();
-        foreach($var as $v) {
-          $output[] = drupal_to_js($v);
-        }
-        return '[ '. implode(', ', $output) .' ]';
-      }
-      // Fall through
-    case 'object':
-      $output = array();
-      foreach ($var as $k => $v) {
-        $output[] = drupal_to_js(strval($k)) .': '. drupal_to_js($v);
-      }
-      return '{ '. implode(', ', $output) .' }';
-    default:
-      return 'null';
-  }
-}
-
-/**
- * Wrapper around urlencode() which avoids Apache quirks.
- *
- * Should be used when placing arbitrary data in an URL. Note that Drupal paths
- * are urlencoded() when passed through url() and do not require urlencoding()
- * of individual components.
- *
- * Notes:
- * - For esthetic reasons, we do not escape slashes. This also avoids a 'feature'
- *   in Apache where it 404s on any path containing '%2F'.
- * - mod_rewrite's unescapes %-encoded ampersands and hashes when clean URLs
- *   are used, which are interpreted as delimiters by PHP. These characters are
- *   double escaped so PHP will still see the encoded version.
- *
- * @param $text
- *   String to encode
- */
-function drupal_urlencode($text) {
-  if (variable_get('clean_url', '0')) {
-    return str_replace(array('%2F', '%26', '%23'),
-                       array('/', '%2526', '%2523'),
-                       urlencode($text));
-  }
-  else {
-    return str_replace('%2F', '/', urlencode($text));    
-  }
-}
-
-/**
- * Performs one or more XML-RPC request(s).
- *
- * @param $url
- *   An absolute URL of the XML-RPC endpoint.
- *     Example:
- *     http://www.domain.com/xmlrpc.php
- * @param ...
- *   For one request:
- *     The method name followed by a variable number of arguments to the method.
- *   For multiple requests (system.multicall):
- *     An array of call arrays. Each call array follows the pattern of the single
- *     request: method name followed by the arguments to the method.
- * @return
- *   For one request:
- *     Either the return value of the method on success, or FALSE.
- *     If FALSE is returned, see xmlrpc_errno() and xmlrpc_error_msg().
- *   For multiple requests:
- *     An array of results. Each result will either be the result
- *     returned by the method called, or an xmlrpc_error object if the call
- *     failed. See xmlrpc_error().
- */
-function xmlrpc($url) {
-  require_once './includes/xmlrpc.inc';
-  $args = func_get_args();
-  return call_user_func_array('_xmlrpc', $args);
-}
-
-function _drupal_bootstrap_full() {
-  static $called;
-  global $locale;
-
-  if ($called) {
-    return;
-  }
-  $called = 1;
-  require_once './includes/theme.inc';
-  require_once './includes/pager.inc';
-  require_once './includes/menu.inc';
-  require_once './includes/tablesort.inc';
-  require_once './includes/file.inc';
-  require_once './includes/unicode.inc';
-  require_once './includes/image.inc';
-  require_once './includes/form.inc';
-  // Set the Drupal custom error handler.
-  set_error_handler('error_handler');
-  // Emit the correct charset HTTP header.
-  drupal_set_header('Content-Type: text/html; charset=utf-8');
-  // Detect string handling method
-  unicode_check();
-  // Undo magic quotes
-  fix_gpc_magic();
-  // Load all enabled modules
-  module_load_all();
-  // Initialize the localization system. Depends on i18n.module being loaded already.
-  $locale = locale_initialize();
-  // Let all modules take action before menu system handles the reqest
-  module_invoke_all('init');
-
-}
-
-/**
- * Store the current page in the cache.
- *
- * We try to store a gzipped version of the cache. This requires the
- * PHP zlib extension (http://php.net/manual/en/ref.zlib.php).
- * Presence of the extension is checked by testing for the function
- * gzencode. There are two compression algorithms: gzip and deflate.
- * The majority of all modern browsers support gzip or both of them.
- * We thus only deal with the gzip variant and unzip the cache in case
- * the browser does not accept gzip encoding.
- *
- * @see drupal_page_header
- */
-function page_set_cache() {
-  global $user, $base_root;
-
-  if (!$user->uid && $_SERVER['REQUEST_METHOD'] == 'GET') {
-    // This will fail in some cases, see page_get_cache() for the explanation.
-    if ($data = ob_get_contents()) {
-      $cache = TRUE;
-      if (function_exists('gzencode')) {
-        // We do not store the data in case the zlib mode is deflate.
-        // This should be rarely happening.
-        if (zlib_get_coding_type() == 'deflate') {
-          $cache = FALSE;
-        }
-        else if (zlib_get_coding_type() == FALSE) {
-          $data = gzencode($data, 9, FORCE_GZIP);
-        }
-        // The remaining case is 'gzip' which means the data is
-        // already compressed and nothing left to do but to store it.
-      }
-      ob_end_flush();
-      if ($cache && $data) {
-        cache_set($base_root . request_uri(), $data, CACHE_TEMPORARY, drupal_get_headers());
-      }
-    }
-  }
-}
diff --git a/includes/database.inc b/includes/database.inc
deleted file mode 100644 (file)
index 11129ef..0000000
+++ /dev/null
@@ -1,390 +0,0 @@
-<?php
-// $Id: database.inc 1119 2008-01-04 11:08:59Z thierry $
-
-/**
- * @file
- * Wrapper for database interface code.
- */
-
-/**
- * @defgroup database Database abstraction layer
- * @{
- * Allow the use of different database servers using the same code base.
- *
- * Drupal provides a slim database abstraction layer to provide developers with
- * the ability to support multiple database servers easily. The intent of this
- * layer is to preserve the syntax and power of SQL as much as possible, while
- * letting Drupal control the pieces of queries that need to be written
- * differently for different servers and provide basic security checks.
- *
- * Most Drupal database queries are performed by a call to db_query() or
- * db_query_range(). Module authors should also consider using pager_query() for
- * queries that return results that need to be presented on multiple pages, and
- * tablesort_sql() for generating appropriate queries for sortable tables.
- *
- * For example, one might wish to return a list of the most recent 10 nodes
- * authored by a given user. Instead of directly issuing the SQL query
- * @code
- *   SELECT n.title, n.body, n.created FROM node n WHERE n.uid = $uid LIMIT 0, 10;
- * @endcode
- * one would instead call the Drupal functions:
- * @code
- *   $result = db_query_range('SELECT n.title, n.body, n.created
- *     FROM {node} n WHERE n.uid = %d', $uid, 0, 10);
- *   while ($node = db_fetch_object($result)) {
- *     // Perform operations on $node->body, etc. here.
- *   }
- * @endcode
- * Curly braces are used around "node" to provide table prefixing via
- * db_prefix_tables(). The explicit use of a user ID is pulled out into an
- * argument passed to db_query() so that SQL injection attacks from user input
- * can be caught and nullified. The LIMIT syntax varies between database servers,
- * so that is abstracted into db_query_range() arguments. Finally, note the
- * common pattern of iterating over the result set using db_fetch_object().
- */
-
-/**
- * Append a database prefix to all tables in a query.
- *
- * Queries sent to Drupal should wrap all table names in curly brackets. This
- * function searches for this syntax and adds Drupal's table prefix to all
- * tables, allowing Drupal to coexist with other systems in the same database if
- * necessary.
- *
- * @param $sql
- *   A string containing a partial or entire SQL query.
- * @return
- *   The properly-prefixed string.
- */
-function db_prefix_tables($sql) {
-  global $db_prefix;
-
-  if (is_array($db_prefix)) {
-    if (array_key_exists('default', $db_prefix)) {
-      $tmp = $db_prefix;
-      unset($tmp['default']);
-      foreach ($tmp as $key => $val) {
-        $sql = strtr($sql, array('{'. $key. '}' => $val. $key));
-      }
-      return strtr($sql, array('{' => $db_prefix['default'], '}' => ''));
-    }
-    else {
-      foreach ($db_prefix as $key => $val) {
-        $sql = strtr($sql, array('{'. $key. '}' => $val. $key));
-      }
-      return strtr($sql, array('{' => '', '}' => ''));
-    }
-  }
-  else {
-    return strtr($sql, array('{' => $db_prefix, '}' => ''));
-  }
-}
-
-/**
- * Fixed parse_url() function.
- *
- * The builtin parse_url() cannot handle passwords with @ in them.
- */
-function db_parse_url($url, $component = NULL) {
-  // scheme://user:pass@host:port/path?query#fragment
-
-  $pattern = '(.*)://'; // scheme (before ://)
-  $pattern .= '((.*)?:(.*)?@)?'; // user:pass@ (optional, before @, separated by :)
-  $pattern .= '([^:]*)'; // host (until :)
-  $pattern .= '(:(.*))?'; // port (optional, after :)
-  $pattern .= '(/[^?]*)'; // path (after and including /, until ?)
-  $pattern .= '(\?([^#]*))?'; // query (optional, after ?, until #)
-  $pattern .= '(#(.*))?'; // fragment (optional, after #)
-
-  preg_match('|' . $pattern . '|', $url, $matches);
-
-  if ($matches) {
-    $url = array();
-
-    list($full_match,
-        $url['scheme'],
-        $user_pass, $url['user'], $url['pass'],
-        $url['host'],
-        $optional_port, $url['port'],
-        $url['path']) = $matches;
-
-    if (count($matches) > 9)
-      list($optional_query, $url['query']) = array_slice($matches, 9);
-
-    if (count($matches) > 10)
-      list($optional_fragment, $url['fragment']) = array_slice($matches, 10);
-
-    /* thierry : on fc6 an empty component matches PHP_URL_SCHEME=0 ! */
-    if ($component) {
-     if (defined('PHP_URL_SCHEME')) {
-      switch ($component) {
-      case PHP_URL_SCHEME: return $url['scheme'];
-      case PHP_URL_HOST: return $url['host'];
-      case PHP_URL_PORT: return $url['port'];
-      case PHP_URL_USER: return $url['user'];
-      case PHP_URL_PASS: return $url['pass'];
-      case PHP_URL_PATH: return $url['path'];
-      case PHP_URL_QUERY: return $url['query'];
-      case PHP_URL_FRAGMENT: return $url['fragment'];
-      }
-     }
-    }
-
-    # Remove unmatched fields
-    $url = array_filter($url, 'strlen');
-
-    return $url;
-  }
-
-  return FALSE;
-}
-
-/**
- * Activate a database for future queries.
- *
- * If it is necessary to use external databases in a project, this function can
- * be used to change where database queries are sent. If the database has not
- * yet been used, it is initialized using the URL specified for that name in
- * Drupal's configuration file. If this name is not defined, a duplicate of the
- * default connection is made instead.
- *
- * Be sure to change the connection back to the default when done with custom
- * code.
- *
- * @param $name
- *   The name assigned to the newly active database connection. If omitted, the
- *   default connection will be made active.
- *
- * @return the name of the previously active database or FALSE if non was found.
- */
-function db_set_active($name = 'default') {
-  global $db_url, $db_type, $active_db;
-  static $db_conns;
-
-  if (!isset($db_conns[$name])) {
-    // Initiate a new connection, using the named DB URL specified.
-    if (is_array($db_url)) {
-      $connect_url = array_key_exists($name, $db_url) ? $db_url[$name] : $db_url['default'];
-    }
-    else {
-      $connect_url = $db_url;
-    }
-
-    $db_type = substr($connect_url, 0, strpos($connect_url, '://'));
-    $handler = "./includes/database.$db_type.inc";
-
-    if (is_file($handler)) {
-      include_once $handler;
-    }
-    else {
-      drupal_maintenance_theme();
-      drupal_set_title('Unsupported database type');
-      print theme('maintenance_page', '<p>The database type '. theme('placeholder', $db_type) .' is unsupported. Please use either <var>mysql</var> for MySQL 3.x &amp; 4.0.x databases, <var>mysqli</var> for MySQL 4.1.x+ databases, or <var>pgsql</var> for PostgreSQL databases. The database information is in your <code>settings.php</code> file.</p>
-<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
-      exit;
-    }
-
-    $db_conns[$name] = db_connect($connect_url);
-  }
-
-  $previous_db = $active_db;
-  // Set the active connection.
-  $active_db = $db_conns[$name];
-
-  return array_search($previous_db, $db_conns);
-}
-
-/**
- * Helper function for db_query().
- */
-function _db_query_callback($match, $init = FALSE) {
-  static $args = NULL;
-  if ($init) {
-    $args = $match;
-    return;
-  }
-
-  switch ($match[1]) {
-    case '%d': // We must use type casting to int to convert false/null/(true?)
-      return (int) array_shift($args); // We don't need db_escape_string as numbers are db-safe
-    case '%s':
-      return db_escape_string(array_shift($args));
-    case '%%':
-      return '%';
-    case '%f':
-      return (float) array_shift($args);
-    case '%b': // binary data
-      return db_encode_blob(array_shift($args));
-  }
-}
-
-define('DB_QUERY_REGEXP', '/(%d|%s|%%|%f|%b)/');
-
-/**
- * Runs a basic query in the active database.
- *
- * User-supplied arguments to the query should be passed in as separate
- * parameters so that they can be properly escaped to avoid SQL injection
- * attacks.
- *
- * @param $query
- *   A string containing an SQL query.
- * @param ...
- *   A variable number of arguments which are substituted into the query
- *   using printf() syntax. Instead of a variable number of query arguments,
- *   you may also pass a single array containing the query arguments.
-
- *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
- *
- *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
- *   and TRUE values to decimal 1.
- *
- * @return
- *   A database query result resource, or FALSE if the query was not
- *   executed correctly.
- */
-function db_query($query) {
-  $args = func_get_args();
-  array_shift($args);
-  $query = db_prefix_tables($query);
-  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
-    $args = $args[0];
-  }
-  _db_query_callback($args, TRUE);
-  $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query);
-  return _db_query($query);
-}
-
-/**
- * Debugging version of db_query().
- *
- * Echoes the query to the browser.
- */
-function db_queryd($query) {
-  $args = func_get_args();
-  array_shift($args);
-  $query = db_prefix_tables($query);
-  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
-    $args = $args[0];
-  }
-  _db_query_callback($args, TRUE);
-  $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query);
-  return _db_query($query, 1);
-}
-
-/**
- * Helper function for db_rewrite_sql.
- *
- * Collects JOIN and WHERE statements via hook_sql.
- * Decides whether to select primary_key or DISTINCT(primary_key)
- *
- * @param $query
- *   Query to be rewritten.
- * @param $primary_table
- *   Name or alias of the table which has the primary key field for this query. Possible values are: comments, forum, node, menu, term_data, vocabulary.
- * @param $primary_field
- *   Name of the primary field.
- * @param $args
- *   Array of additional arguments.
- * @return
- *   An array: join statements, where statements, field or DISTINCT(field).
- */
-function _db_rewrite_sql($query = '', $primary_table = 'n', $primary_field = 'nid', $args = array()) {
-  $where = array();
-  $join = array();
-  $distinct = FALSE;
-  foreach (module_implements('db_rewrite_sql') as $module) {
-    $result = module_invoke($module, 'db_rewrite_sql', $query, $primary_table, $primary_field, $args);
-    if (isset($result) && is_array($result)) {
-      if (isset($result['where'])) {
-        $where[] = $result['where'];
-      }
-      if (isset($result['join'])) {
-        $join[] = $result['join'];
-      }
-      if (isset($result['distinct']) && $result['distinct']) {
-        $distinct = TRUE;
-      }
-    }
-    elseif (isset($result)) {
-      $where[] = $result;
-    }
-  }
-
-  $where = empty($where) ? '' : '('. implode(') AND (', $where) .')';
-  $join = empty($join) ? '' : implode(' ', $join);
-
-  return array($join, $where, $distinct);
-}
-
-/**
- * Rewrites node, taxonomy and comment queries. Use it for listing queries. Do not
- * use FROM table1, table2 syntax, use JOIN instead.
- *
- * @param $query
- *   Query to be rewritten.
- * @param $primary_table
- *   Name or alias of the table which has the primary key field for this query. Possible values are: comments, forum, node, menu, term_data, vocabulary.
- * @param $primary_field
- *   Name of the primary field.
- * @param $args
- *   An array of arguments, passed to the implementations of hook_db_rewrite_sql.
- * @return
- *   The original query with JOIN and WHERE statements inserted from hook_db_rewrite_sql implementations. nid is rewritten if needed.
- */
-function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid',  $args = array()) {
-  list($join, $where, $distinct) = _db_rewrite_sql($query, $primary_table, $primary_field, $args);
-
-  if ($distinct) {
-    $field_to_select = 'DISTINCT('. $primary_table .'.'. $primary_field .')';
-    // (?<!text) is a negative look-behind (no need to rewrite queries that already use DISTINCT).
-    $query = preg_replace('/(SELECT.*)('. $primary_table .'\.)?(?<!DISTINCT\()(?<!DISTINCT\('. $primary_table .'\.)'. $primary_field .'(.*FROM)/AUsi', '\1'. $field_to_select .'\3', $query);
-  }
-
-  if (!empty($where) || !empty($join)) {
-    if (!empty($where)) {
-      $new = " WHERE $where ";
-    }
-    $new = " $join $new";
-    if (strpos($query, 'WHERE')) {
-      $replace = 'WHERE';
-      $add = 'AND';
-    }
-    elseif (strpos($query, 'GROUP')) {
-      $replace = 'GROUP';
-      $add = 'GROUP';
-    }
-    elseif (strpos($query, 'ORDER')) {
-      $replace = 'ORDER';
-      $add = 'ORDER';
-    }
-    elseif (strpos($query, 'LIMIT')) {
-      $replace = 'LIMIT';
-      $add = 'LIMIT';
-    }
-    else {
-      $query .= $new;
-    }
-    if (isset($replace)) {
-      $query = str_replace($replace, "$new $add ", $query);
-    }
-  }
-
-  return $query;
-}
-
-/**
- * Restrict a dynamic tablename to safe characters.
- *
- * Only keeps alphanumeric and underscores.
- */
-function db_escape_table($string) {
-  return preg_replace('/[^A-Za-z0-9_]+/', '', $string);
-}
-
-/**
- * @} End of "defgroup database".
- */
-
-
diff --git a/includes/database.mysql.inc b/includes/database.mysql.inc
deleted file mode 100644 (file)
index 7ecf826..0000000
+++ /dev/null
@@ -1,370 +0,0 @@
-<?php
-// $Id: database.mysql.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Database interface code for MySQL database servers.
- */
-
-/**
- * @ingroup database
- * @{
- */
-
-/**
- * Initialize a database connection.
- *
- * Note that you can change the mysql_connect() call to mysql_pconnect() if you
- * want to use persistent connections. This is not recommended on shared hosts,
- * and might require additional database/webserver tuning. It can increase
- * performance, however, when the overhead to connect to your database is high
- * (e.g. your database and web server live on different machines).
- */
-function db_connect($url) {
-  // Check if MySQL support is present in PHP
-  if (!function_exists('mysql_connect')) {
-    drupal_maintenance_theme();
-    drupal_set_title('PHP MySQL support not enabled');
-    print theme('maintenance_page', '<p>We were unable to use the MySQL database because the MySQL extension for PHP is not installed. Check your <code>PHP.ini</code> to see how you can enable it.</p>
-<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
-    exit;
-  }
-
-  $url = db_parse_url($url);
-
-  // Decode url-encoded information in the db connection string
-  $url['user'] = urldecode($url['user']);
-  $url['pass'] = urldecode($url['pass']);
-  $url['host'] = urldecode($url['host']);
-  $url['path'] = urldecode($url['path']);
-
-  // Allow for non-standard MySQL port.
-  if (isset($url['port'])) {
-     $url['host'] = $url['host'] .':'. $url['port'];
-  }
-
-  // - TRUE makes mysql_connect() always open a new link, even if
-  //   mysql_connect() was called before with the same parameters.
-  //   This is important if you are using two databases on the same
-  //   server.
-  // - 2 means CLIENT_FOUND_ROWS: return the number of found
-  //   (matched) rows, not the number of affected rows.
-  $connection = @mysql_connect($url['host'], $url['user'], $url['pass'], TRUE, 2);
-  if (!$connection) {
-    drupal_maintenance_theme();
-    drupal_set_title('Unable to connect to database server');
-    print theme('maintenance_page', '<p>This either means that the username and password information in your <code>settings.php</code> file is incorrect or we can\'t contact the MySQL database server. This could mean your hosting provider\'s database server is down.</p>
-<p>The MySQL error was: '. theme('placeholder', mysql_error()) .'.</p>
-<p>Currently, the username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>
-<ul>
-  <li>Are you sure you have the correct username and password?</li>
-  <li>Are you sure that you have typed the correct hostname?</li>
-  <li>Are you sure that the database server is running?</li>
-</ul>
-<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
-    exit;
-  }
-
-  if (!mysql_select_db(substr($url['path'], 1))) {
-    drupal_maintenance_theme();
-    drupal_set_title('Unable to select database');
-    print theme('maintenance_page', '<p>We were able to connect to the MySQL database server (which means your username and password are okay) but not able to select the database.</p>
-<p>The MySQL error was: '. theme('placeholder', mysql_error($connection)) .'.</p>
-<p>Currently, the database is '. theme('placeholder', substr($url['path'], 1)) .'. The username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>
-<ul>
-  <li>Are you sure you have the correct database name?</li>
-  <li>Are you sure the database exists?</li>
-  <li>Are you sure the username has permission to access the database?</li>
-</ul>
-<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
-    exit;
-  }
-
-  /* On MySQL 4.1 and later, force UTF-8 */
-  if (version_compare(mysql_get_server_info(), '4.1.0', '>=')) {
-    mysql_query('SET NAMES "utf8"', $connection);
-  }
-  return $connection;
-}
-
-/**
- * Helper function for db_query().
- */
-function _db_query($query, $debug = 0) {
-  global $active_db, $queries;
-
-  if (variable_get('dev_query', 0)) {
-    list($usec, $sec) = explode(' ', microtime());
-    $timer = (float)$usec + (float)$sec;
-  }
-
-  $result = mysql_query($query, $active_db);
-
-  if (variable_get('dev_query', 0)) {
-    $bt = debug_backtrace();
-    $query = $bt[2]['function'] . "\n" . $query;
-    list($usec, $sec) = explode(' ', microtime());
-    $stop = (float)$usec + (float)$sec;
-    $diff = $stop - $timer;
-    $queries[] = array($query, $diff);
-  }
-
-  if ($debug) {
-    print '<p>query: '. $query .'<br />error:'. mysql_error($active_db) .'</p>';
-  }
-
-  if (!mysql_errno($active_db)) {
-    return $result;
-  }
-  else {
-    trigger_error(check_plain(mysql_error($active_db) ."\nquery: ". $query), E_USER_WARNING);
-    return FALSE;
-  }
-}
-
-/**
- * Fetch one result row from the previous query as an object.
- *
- * @param $result
- *   A database query result resource, as returned from db_query().
- * @return
- *   An object representing the next row of the result. The attributes of this
- *   object are the table fields selected by the query.
- */
-function db_fetch_object($result) {
-  if ($result) {
-    return mysql_fetch_object($result);
-  }
-}
-
-/**
- * Fetch one result row from the previous query as an array.
- *
- * @param $result
- *   A database query result resource, as returned from db_query().
- * @return
- *   An associative array representing the next row of the result. The keys of
- *   this object are the names of the table fields selected by the query, and
- *   the values are the field values for this result row.
- */
-function db_fetch_array($result) {
-  if ($result) {
-    return mysql_fetch_array($result, MYSQL_ASSOC);
-  }
-}
-
-/**
- * Determine how many result rows were found by the preceding query.
- *
- * @param $result
- *   A database query result resource, as returned from db_query().
- * @return
- *   The number of result rows.
- */
-function db_num_rows($result) {
-  if ($result) {
-    return mysql_num_rows($result);
-  }
-}
-
-/**
- * Return an individual result field from the previous query.
- *
- * Only use this function if exactly one field is being selected; otherwise,
- * use db_fetch_object() or db_fetch_array().
- *
- * @param $result
- *   A database query result resource, as returned from db_query().
- * @param $row
- *   The index of the row whose result is needed.
- * @return
- *   The resulting field.
- */
-function db_result($result, $row = 0) {
-  if ($result && mysql_num_rows($result) > $row) {
-    return mysql_result($result, $row);
-  }
-}
-
-/**
- * Determine whether the previous query caused an error.
- */
-function db_error() {
-  global $active_db;
-  return mysql_errno($active_db);
-}
-
-/**
- * Return a new unique ID in the given sequence.
- *
- * For compatibility reasons, Drupal does not use auto-numbered fields in its
- * database tables. Instead, this function is used to return a new unique ID
- * of the type requested. If necessary, a new sequence with the given name
- * will be created.
- */
-function db_next_id($name) {
-  $name = db_prefix_tables($name);
-  db_query('LOCK TABLES {sequences} WRITE');
-  $id = db_result(db_query("SELECT id FROM {sequences} WHERE name = '%s'", $name)) + 1;
-  db_query("REPLACE INTO {sequences} VALUES ('%s', %d)", $name, $id);
-  db_query('UNLOCK TABLES');
-
-  return $id;
-}
-
-/**
- * Determine the number of rows changed by the preceding query.
- */
-function db_affected_rows() {
-  global $active_db;
-  return mysql_affected_rows($active_db);
-}
-
-/**
- * Runs a limited-range query in the active database.
- *
- * Use this as a substitute for db_query() when a subset of the query is to be
- * returned.
- * User-supplied arguments to the query should be passed in as separate parameters
- * so that they can be properly escaped to avoid SQL injection attacks.
- *
- * Note that if you need to know how many results were returned, you should do
- * a SELECT COUNT(*) on the temporary table afterwards. db_num_rows() and
- * db_affected_rows() do not give consistent result across different database
- * types in this case.
- *
- * @param $query
- *   A string containing an SQL query.
- * @param ...
- *   A variable number of arguments which are substituted into the query
- *   using printf() syntax. The query arguments can be enclosed in one
- *   array instead.
- *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
- *
- *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
- *   and TRUE values to decimal 1.
- *
- * @param $from
- *   The first result row to return.
- * @param $count
- *   The maximum number of result rows to return.
- * @return
- *   A database query result resource, or FALSE if the query was not executed
- *   correctly.
- */
-function db_query_range($query) {
-  $args = func_get_args();
-  $count = array_pop($args);
-  $from = array_pop($args);
-  array_shift($args);
-
-  $query = db_prefix_tables($query);
-  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
-    $args = $args[0];
-  }
-  _db_query_callback($args, TRUE);
-  $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query);
-  $query .= ' LIMIT '. (int)$from .', '. (int)$count;
-  return _db_query($query);
-}
-
-/**
- * Runs a SELECT query and stores its results in a temporary table.
- *
- * Use this as a substitute for db_query() when the results need to stored
- * in a temporary table. Temporary tables exist for the duration of the page
- * request.
- * User-supplied arguments to the query should be passed in as separate parameters
- * so that they can be properly escaped to avoid SQL injection attacks.
- *
- * Note that if you need to know how many results were returned, you should do
- * a SELECT COUNT(*) on the temporary table afterwards. db_num_rows() and
- * db_affected_rows() do not give consistent result across different database
- * types in this case.
- *
- * @param $query
- *   A string containing a normal SELECT SQL query.
- * @param ...
- *   A variable number of arguments which are substituted into the query
- *   using printf() syntax. The query arguments can be enclosed in one
- *   array instead.
- *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
- *
- *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
- *   and TRUE values to decimal 1.
- *
- * @param $table
- *   The name of the temporary table to select into. This name will not be
- *   prefixed as there is no risk of collision.
- * @return
- *   A database query result resource, or FALSE if the query was not executed
- *   correctly.
- */
-function db_query_temporary($query) {
-  $args = func_get_args();
-  $tablename = array_pop($args);
-  array_shift($args);
-
-  $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE '. $tablename .' SELECT', db_prefix_tables($query));
-  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
-    $args = $args[0];
-  }
-  _db_query_callback($args, TRUE);
-  $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query);
-  return _db_query($query);
-}
-
-/**
- * Returns a properly formatted Binary Large OBject value.
- *
- * @param $data
- *   Data to encode.
- * @return
- *  Encoded data.
- */
-function db_encode_blob($data) {
-  global $active_db;
-  return "'" . mysql_real_escape_string($data, $active_db) . "'";
-}
-
-/**
- * Returns text from a Binary Large Object value.
- *
- * @param $data
- *   Data to decode.
- * @return
- *  Decoded data.
- */
-function db_decode_blob($data) {
-  return $data;
-}
-
-/**
- * Prepare user input for use in a database query, preventing SQL injection attacks.
- */
-function db_escape_string($text) {
-  global $active_db;
-  return mysql_real_escape_string($text, $active_db);
-}
-
-/**
- * Lock a table.
- */
-function db_lock_table($table) {
-  db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE');
-}
-
-/**
- * Unlock all locked tables.
- */
-function db_unlock_tables() {
-  db_query('UNLOCK TABLES');
-}
-
-/**
- * @} End of "ingroup database".
- */
-
-
diff --git a/includes/database.mysqli.inc b/includes/database.mysqli.inc
deleted file mode 100644 (file)
index 41d06cc..0000000
+++ /dev/null
@@ -1,371 +0,0 @@
-<?php
-// $Id: database.mysqli.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Database interface code for MySQL database servers using the mysqli client libraries. mysqli is included in PHP 5 by default and allows developers to use the advanced features of MySQL 4.1.x, 5.0.x and beyond.
- */
-
-/* Maintainers of this file should consult
- * http://www.php.net/manual/en/ref.mysqli.php
- */
-
-/**
- * @ingroup database
- * @{
- */
-
-/**
- * Initialise a database connection.
- *
- * Note that mysqli does not support persistent connections.
- */
-function db_connect($url) {
-  // Check if MySQLi support is present in PHP
-  if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) {
-    drupal_maintenance_theme();
-    drupal_set_title('PHP MySQLi support not enabled');
-    print theme('maintenance_page', '<p>We were unable to use the MySQLi database because the MySQLi extension for PHP is not installed. Check your <code>PHP.ini</code> to see how you can enable it.</p>
-<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
-    exit;
-  }
-
-  $url = parse_url($url);
-
-  // Decode url-encoded information in the db connection string
-  $url['user'] = urldecode($url['user']);
-  $url['pass'] = urldecode($url['pass']);
-  $url['host'] = urldecode($url['host']);
-  $url['path'] = urldecode($url['path']);
-
-  $connection = mysqli_init();
-  @mysqli_real_connect($connection, $url['host'], $url['user'], $url['pass'], substr($url['path'], 1), $url['port'], NULL, MYSQLI_CLIENT_FOUND_ROWS);
-
-  // Find all database connection errors and error 1045 for access denied for user account
-  if (mysqli_connect_errno() >= 2000 || mysqli_connect_errno() == 1045) {
-    drupal_maintenance_theme();
-    drupal_set_title('Unable to connect to database server');
-    print theme('maintenance_page', '<p>This either means that the username and password information in your <code>settings.php</code> file is incorrect or we can\'t contact the MySQL database server through the mysqli libraries. This could also mean your hosting provider\'s database server is down.</p>
-<p>The MySQL error was: '. theme('placeholder', mysqli_error($connection)) .'.</p>
-<p>Currently, the username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>
-<ul>
-  <li>Are you sure you have the correct username and password?</li>
-  <li>Are you sure that you have typed the correct hostname?</li>
-  <li>Are you sure that the database server is running?</li>
-  <li>Are you sure that the mysqli libraries are compiled in your PHP installation? Try using the mysql library instead by editing your <code>settings.php</code> configuration file in Drupal.</li>
-</ul>
-<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
-    exit;
-  }
-  else if (mysqli_connect_errno() > 0) {
-    drupal_maintenance_theme();
-    drupal_set_title('Unable to select database');
-    print theme('maintenance_page', '<p>We were able to connect to the MySQL database server (which means your username and password are okay) but not able to select the database.</p>
-<p>The MySQL error was: '. theme('placeholder', mysqli_error($connection)) .'.</p>
-<p>Currently, the database is '. theme('placeholder', substr($url['path'], 1)) .'. The username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>
-<ul>
-  <li>Are you sure you have the correct database name?</li>
-  <li>Are you sure the database exists?</li>
-  <li>Are you sure the username has permission to access the database?</li>
-</ul>
-<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
-    exit;
-  }
-
-  /* Force UTF-8 */
-  mysqli_query($connection, 'SET NAMES "utf8"');
-
-  /**
-   * from: http://bugs.php.net/bug.php?id=33772
-   * Write and Close handlers are called after destructing objects since PHP
-   * 5.0.5. Thus destructors can use sessions but session handler can't use
-   * objects. In prior versions, they were called in the opposite order. It
-   * is possible to call session_write_close() from the destructor to solve
-   * this chicken and egg problem.
-   */
-  register_shutdown_function('session_write_close');
-
-  return $connection;
-}
-
-/**
- * Helper function for db_query().
- */
-function _db_query($query, $debug = 0) {
-  global $active_db, $queries;
-
-  if (variable_get('dev_query', 0)) {
-    list($usec, $sec) = explode(' ', microtime());
-    $timer = (float)$usec + (float)$sec;
-  }
-
-  $result = mysqli_query($active_db, $query);
-
-  if (variable_get('dev_query', 0)) {
-    $bt = debug_backtrace();
-    $query = $bt[2]['function'] . "\n" . $query;
-    list($usec, $sec) = explode(' ', microtime());
-    $stop = (float)$usec + (float)$sec;
-    $diff = $stop - $timer;
-    $queries[] = array($query, $diff);
-  }
-
-  if ($debug) {
-    print '<p>query: '. $query .'<br />error:'. mysqli_error($active_db) .'</p>';
-  }
-
-  if (!mysqli_errno($active_db)) {
-    return $result;
-  }
-  else {
-    trigger_error(check_plain(mysqli_error($active_db) ."\nquery: ". $query), E_USER_WARNING);
-    return FALSE;
-  }
-}
-
-/**
- * Fetch one result row from the previous query as an object.
- *
- * @param $result
- *   A database query result resource, as returned from db_query().
- * @return
- *   An object representing the next row of the result. The attributes of this
- *   object are the table fields selected by the query.
- */
-function db_fetch_object($result) {
-  if ($result) {
-    return mysqli_fetch_object($result);
-  }
-}
-
-/**
- * Fetch one result row from the previous query as an array.
- *
- * @param $result
- *   A database query result resource, as returned from db_query().
- * @return
- *   An associative array representing the next row of the result. The keys of
- *   this object are the names of the table fields selected by the query, and
- *   the values are the field values for this result row.
- */
-function db_fetch_array($result) {
-  if ($result) {
-    return mysqli_fetch_array($result, MYSQLI_ASSOC);
-  }
-}
-
-/**
- * Determine how many result rows were found by the preceding query.
- *
- * @param $result
- *   A database query result resource, as returned from db_query().
- * @return
- *   The number of result rows.
- */
-function db_num_rows($result) {
-  if ($result) {
-    return mysqli_num_rows($result);
-  }
-}
-
-/**
-* Return an individual result field from the previous query.
-*
-* Only use this function if exactly one field is being selected; otherwise,
-* use db_fetch_object() or db_fetch_array().
-*
-* @param $result
-*   A database query result resource, as returned from db_query().
-* @param $row
-*   The index of the row whose result is needed.
-* @return
-*   The resulting field.
-*/
-function db_result($result, $row = 0) {
-  if ($result && mysqli_num_rows($result) > $row) {
-    $array = mysqli_fetch_array($result, MYSQLI_NUM);
-    return $array[0];
-  }
-}
-
-/**
- * Determine whether the previous query caused an error.
- */
-function db_error() {
-  global $active_db;
-  return mysqli_errno($active_db);
-}
-
-/**
- * Return a new unique ID in the given sequence.
- *
- * For compatibility reasons, Drupal does not use auto-numbered fields in its
- * database tables. Instead, this function is used to return a new unique ID
- * of the type requested. If necessary, a new sequence with the given name
- * will be created.
- */
-function db_next_id($name) {
-  $name = db_prefix_tables($name);
-  db_query('LOCK TABLES {sequences} WRITE');
-  $id = db_result(db_query("SELECT id FROM {sequences} WHERE name = '%s'", $name)) + 1;
-  db_query("REPLACE INTO {sequences} VALUES ('%s', %d)", $name, $id);
-  db_query('UNLOCK TABLES');
-
-  return $id;
-}
-
-/**
- * Determine the number of rows changed by the preceding query.
- */
-function db_affected_rows() {
-  global $active_db; /* mysqli connection resource */
-  return mysqli_affected_rows($active_db);
-}
-
-/**
- * Runs a limited-range query in the active database.
- *
- * Use this as a substitute for db_query() when a subset of the query is to be
- * returned.
- * User-supplied arguments to the query should be passed in as separate parameters
- * so that they can be properly escaped to avoid SQL injection attacks.
- *
- * Note that if you need to know how many results were returned, you should do
- * a SELECT COUNT(*) on the temporary table afterwards. db_num_rows() and
- * db_affected_rows() do not give consistent result across different database
- * types in this case.
- *
- * @param $query
- *   A string containing an SQL query.
- * @param ...
- *   A variable number of arguments which are substituted into the query
- *   using printf() syntax. The query arguments can be enclosed in one
- *   array instead.
- *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
- *
- *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
- *   and TRUE values to decimal 1.
- *
- * @param $from
- *   The first result row to return.
- * @param $count
- *   The maximum number of result rows to return.
- * @return
- *   A database query result resource, or FALSE if the query was not executed
- *   correctly.
- */
-function db_query_range($query) {
-  $args = func_get_args();
-  $count = array_pop($args);
-  $from = array_pop($args);
-  array_shift($args);
-
-  $query = db_prefix_tables($query);
-  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
-    $args = $args[0];
-  }
-  _db_query_callback($args, TRUE);
-  $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query);
-  $query .= ' LIMIT '. (int)$from .', '. (int)$count;
-  return _db_query($query);
-}
-
-/**
- * Runs a SELECT query and stores its results in a temporary table.
- *
- * Use this as a substitute for db_query() when the results need to stored
- * in a temporary table. Temporary tables exist for the duration of the page
- * request.
- * User-supplied arguments to the query should be passed in as separate parameters
- * so that they can be properly escaped to avoid SQL injection attacks.
- *
- * Note that if you need to know how many results were returned, you should do
- * a SELECT COUNT(*) on the temporary table afterwards. db_num_rows() and
- * db_affected_rows() do not give consistent result across different database
- * types in this case.
- *
- * @param $query
- *   A string containing a normal SELECT SQL query.
- * @param ...
- *   A variable number of arguments which are substituted into the query
- *   using printf() syntax. The query arguments can be enclosed in one
- *   array instead.
- *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
- *
- *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
- *   and TRUE values to decimal 1.
- *
- * @param $table
- *   The name of the temporary table to select into. This name will not be
- *   prefixed as there is no risk of collision.
- * @return
- *   A database query result resource, or FALSE if the query was not executed
- *   correctly.
- */
-function db_query_temporary($query) {
-  $args = func_get_args();
-  $tablename = array_pop($args);
-  array_shift($args);
-
-  $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE '. $tablename .' SELECT', db_prefix_tables($query));
-  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
-    $args = $args[0];
-  }
-  _db_query_callback($args, TRUE);
-  $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query);
-  return _db_query($query);
-}
-
-/**
- * Returns a properly formatted Binary Large Object value.
- *
- * @param $data
- *   Data to encode.
- * @return
- *  Encoded data.
- */
-function db_encode_blob($data) {
-  global $active_db;
-  return "'" . mysqli_real_escape_string($active_db, $data) . "'";
-}
-
-/**
- * Returns text from a Binary Large OBject value.
- *
- * @param $data
- *   Data to decode.
- * @return
- *  Decoded data.
- */
-function db_decode_blob($data) {
-  return $data;
-}
-
-/**
- * Prepare user input for use in a database query, preventing SQL injection attacks.
- */
-function db_escape_string($text) {
-  global $active_db;
-  return mysqli_real_escape_string($active_db, $text);
-}
-
-/**
- * Lock a table.
- */
-function db_lock_table($table) {
-  db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE');
-}
-
-/**
- * Unlock all locked tables.
- */
-function db_unlock_tables() {
-  db_query('UNLOCK TABLES');
-}
-
-/**
- * @} End of "ingroup database".
- */
-
diff --git a/includes/database.pgsql.inc b/includes/database.pgsql.inc
deleted file mode 100644 (file)
index 7b992cb..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-<?php
-// $Id: database.pgsql.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Database interface code for PostgreSQL database servers.
- */
-
-/**
- * @ingroup database
- * @{
- */
-
-/**
- * Initialize a database connection.
- *
- * Note that you can change the pg_connect() call to pg_pconnect() if you
- * want to use persistent connections. This is not recommended on shared hosts,
- * and might require additional database/webserver tuning. It can increase
- * performance, however, when the overhead to connect to your database is high
- * (e.g. your database and web server live on different machines).
- */
-function db_connect($url) {
-   // Check if MySQL support is present in PHP
-  if (!function_exists('pg_connect')) {
-    drupal_maintenance_theme();
-    drupal_set_title('PHP PostgreSQL support not enabled');
-    print theme('maintenance_page', '<p>We were unable to use the PostgreSQL database because the PostgreSQL extension for PHP is not installed. Check your <code>PHP.ini</code> to see how you can enable it.</p>
-<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
-    exit;
-  }
-
-  // Cannot parse passwords with @ in them
-  $url = db_parse_url($url);
-
-  // Decode url-encoded information in the db connection string
-  $url['user'] = urldecode($url['user']);
-  $url['pass'] = urldecode($url['pass']);
-  $url['host'] = urldecode($url['host']);
-  $url['path'] = urldecode($url['path']);
-
-  $conn_string = ' user='. $url['user'] .' dbname='. substr($url['path'], 1) .' password='. $url['pass'] . ' host=' . $url['host'];
-  $conn_string .= isset($url['port']) ? ' port=' . $url['port'] : '';
-
-  // pg_last_error() does not return a useful error message for database
-  // connection errors. We must turn on error tracking to get at a good error
-  // message, which will be stored in $php_errormsg.
-  $track_errors_previous = ini_get('track_errors');
-  ini_set('track_errors', 1);
-
-  $connection = @pg_connect($conn_string);
-  if (!$connection) {
-    drupal_maintenance_theme();
-    drupal_set_title('Unable to connect to database');
-    print theme('maintenance_page', '<p>This either means that the database information in your <code>settings.php</code> file is incorrect or we can\'t contact the PostgreSQL database server. This could mean your hosting provider\'s database server is down.</p>
-<p>The PostgreSQL error was: '. theme('placeholder', decode_entities($php_errormsg)) .'</p>
-<p>Currently, the database is '. theme('placeholder', substr($url['path'], 1)) .', the username is '. theme('placeholder', $url['user']) .', and the database server is '. theme('placeholder', $url['host']) .'.</p>
-<ul>
-  <li>Are you sure you have the correct username and password?</li>
-  <li>Are you sure that you have typed the correct hostname?</li>
-  <li>Are you sure you have the correct database name?</li>
-  <li>Are you sure that the database server is running?</li>
-</ul>
-<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
-    exit;
-  }
-
-  // Restore error tracking setting
-  ini_set('track_errors', $track_errors_previous);
-
-  return $connection;
-}
-
-/**
- * Helper function for db_query().
- */
-function _db_query($query, $debug = 0) {
-  global $active_db, $last_result, $queries;
-
-  if (variable_get('dev_query', 0)) {
-    list($usec, $sec) = explode(' ', microtime());
-    $timer = (float)$usec + (float)$sec;
-  }
-
-  $last_result = pg_query($active_db, $query);
-
-  if (variable_get('dev_query', 0)) {
-    $bt = debug_backtrace();
-    $query = $bt[2]['function'] . "\n" . $query;
-    list($usec, $sec) = explode(' ', microtime());
-    $stop = (float)$usec + (float)$sec;
-    $diff = $stop - $timer;
-    $queries[] = array($query, $diff);
-  }
-
-  if ($debug) {
-    print '<p>query: '. $query .'<br />error:'. pg_last_error($active_db) .'</p>';
-  }
-
-  if ($last_result !== FALSE) {
-    return $last_result;
-  }
-  else {
-    trigger_error(check_plain(pg_last_error($active_db) ."\nquery: ". $query), E_USER_WARNING);
-    return FALSE;
-  }
-}
-
-/**
- * Fetch one result row from the previous query as an object.
- *
- * @param $result
- *   A database query result resource, as returned from db_query().
- * @return
- *   An object representing the next row of the result. The attributes of this
- *   object are the table fields selected by the query.
- */
-function db_fetch_object($result) {
-  if ($result) {
-    return pg_fetch_object($result);
-  }
-}
-
-/**
- * Fetch one result row from the previous query as an array.
- *
- * @param $result
- *   A database query result resource, as returned from db_query().
- * @return
- *   An associative array representing the next row of the result. The keys of
- *   this object are the names of the table fields selected by the query, and
- *   the values are the field values for this result row.
- */
-function db_fetch_array($result) {
-  if ($result) {
-    return pg_fetch_assoc($result);
-  }
-}
-
-/**
- * Determine how many result rows were found by the preceding query.
- *
- * @param $result
- *   A database query result resource, as returned from db_query().
- * @return
- *   The number of result rows.
- */
-function db_num_rows($result) {
-  if ($result) {
-    return pg_num_rows($result);
-  }
-}
-
-/**
- * Return an individual result field from the previous query.
- *
- * Only use this function if exactly one field is being selected; otherwise,
- * use db_fetch_object() or db_fetch_array().
- *
- * @param $result
- *   A database query result resource, as returned from db_query().
- * @param $row
- *   The index of the row whose result is needed.
- * @return
- *   The resulting field.
- */
-function db_result($result, $row = 0) {
-  if ($result && pg_num_rows($result) > $row) {
-    $res = pg_fetch_row($result, $row);
-
-    return $res[0];
-  }
-}
-
-/**
- * Determine whether the previous query caused an error.
- */
-function db_error() {
-  global $active_db;
-  return pg_last_error($active_db);
-}
-
-/**
- * Return a new unique ID in the given sequence.
- *
- * For compatibility reasons, Drupal does not use auto-numbered fields in its
- * database tables. Instead, this function is used to return a new unique ID
- * of the type requested. If necessary, a new sequence with the given name
- * will be created.
- */
-function db_next_id($name) {
-  $id = db_result(db_query("SELECT nextval('%s_seq')", db_prefix_tables($name)));
-  return $id;
-}
-
-/**
- * Determine the number of rows changed by the preceding query.
- */
-function db_affected_rows() {
-  global $last_result;
-  return pg_affected_rows($last_result);
-}
-
-/**
- * Runs a limited-range query in the active database.
- *
- * Use this as a substitute for db_query() when a subset of the query
- * is to be returned.
- * User-supplied arguments to the query should be passed in as separate
- * parameters so that they can be properly escaped to avoid SQL injection
- * attacks.
- *
- * @param $query
- *   A string containing an SQL query.
- * @param ...
- *   A variable number of arguments which are substituted into the query
- *   using printf() syntax. Instead of a variable number of query arguments,
- *   you may also pass a single array containing the query arguments.
- *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
- *
- *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
- *   and TRUE values to decimal 1.
- *
- * @param $from
- *   The first result row to return.
- * @param $count
- *   The maximum number of result rows to return.
- * @return
- *   A database query result resource, or FALSE if the query was not executed
- *   correctly.
- */
-function db_query_range($query) {
-  $args = func_get_args();
-  $count = array_pop($args);
-  $from = array_pop($args);
-  array_shift($args);
-
-  $query = db_prefix_tables($query);
-  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
-    $args = $args[0];
-  }
-  _db_query_callback($args, TRUE);
-  $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query);
-  $query .= ' LIMIT '. (int)$count .' OFFSET '. (int)$from;
-  return _db_query($query);
-}
-
-/**
- * Runs a SELECT query and stores its results in a temporary table.
- *
- * Use this as a substitute for db_query() when the results need to stored
- * in a temporary table. Temporary tables exist for the duration of the page
- * request.
- * User-supplied arguments to the query should be passed in as separate parameters
- * so that they can be properly escaped to avoid SQL injection attacks.
- *
- * Note that if you need to know how many results were returned, you should do
- * a SELECT COUNT(*) on the temporary table afterwards. db_num_rows() and
- * db_affected_rows() do not give consistent result across different database
- * types in this case.
- *
- * @param $query
- *   A string containing a normal SELECT SQL query.
- * @param ...
- *   A variable number of arguments which are substituted into the query
- *   using printf() syntax. The query arguments can be enclosed in one
- *   array instead.
- *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
- *
- *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
- *   and TRUE values to decimal 1.
- *
- * @param $table
- *   The name of the temporary table to select into. This name will not be
- *   prefixed as there is no risk of collision.
- * @return
- *   A database query result resource, or FALSE if the query was not executed
- *   correctly.
- */
-function db_query_temporary($query) {
-  $args = func_get_args();
-  $tablename = array_pop($args);
-  array_shift($args);
-
-  $query = preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE '. $tablename .' AS SELECT', db_prefix_tables($query));
-  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
-    $args = $args[0];
-  }
-  _db_query_callback($args, TRUE);
-  $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query);
-  return _db_query($query);
-}
-
-/**
- * Returns a properly formatted Binary Large OBject value.
- * In case of PostgreSQL encodes data for insert into bytea field.
- *
- * @param $data
- *   Data to encode.
- * @return
- *  Encoded data.
- */
-function db_encode_blob($data) {
-  return "'". pg_escape_bytea($data) ."'";
-}
-
-/**
- * Returns text from a Binary Large OBject value.
- * In case of PostgreSQL decodes data after select from bytea field.
- *
- * @param $data
- *   Data to decode.
- * @return
- *  Decoded data.
- */
-function db_decode_blob($data) {
-  return pg_unescape_bytea($data);
-}
-
-/**
- * Prepare user input for use in a database query, preventing SQL injection attacks.
- * Note: This function requires PostgreSQL 7.2 or later.
- */
-function db_escape_string($text) {
-  return pg_escape_string($text);
-}
-
-/**
- * Lock a table.
- * This function automatically starts a transaction.
- */
-function db_lock_table($table) {
-  db_query('BEGIN; LOCK TABLE {'. db_escape_table($table) .'} IN EXCLUSIVE MODE');
-}
-
-/**
- * Unlock all locked tables.
- * This function automatically commits a transaction.
- */
-function db_unlock_tables() {
-  db_query('COMMIT');
-}
-
-/**
- * Verify if the database is set up correctly.
- */
-function db_check_setup() {
-  $encoding = db_result(db_query('SHOW server_encoding'));
-  if (!in_array(strtolower($encoding), array('unicode', 'utf8'))) {
-    drupal_set_message(t('Your PostgreSQL database is set up with the wrong character encoding (%encoding). It is possible it will not work as expected. It is advised to recreate it with UTF-8/Unicode encoding. More information can be found in the <a href="%url">PostgreSQL documentation</a>.', array('%encoding' => $encoding, '%url' => 'http://www.postgresql.org/docs/7.4/interactive/multibyte.html')), 'status');
-  }
-}
-
-/**
- * @} End of "ingroup database".
- */
-
-
diff --git a/includes/file.inc b/includes/file.inc
deleted file mode 100644 (file)
index 166483b..0000000
+++ /dev/null
@@ -1,715 +0,0 @@
-<?php
-// $Id: file.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * API for handling file uploads and server file management.
- */
-
-/**
- * @defgroup file File interface
- * @{
- * Common file handling functions.
- */
-
-define('FILE_DOWNLOADS_PUBLIC', 1);
-define('FILE_DOWNLOADS_PRIVATE', 2);
-define('FILE_CREATE_DIRECTORY', 1);
-define('FILE_MODIFY_PERMISSIONS', 2);
-define('FILE_EXISTS_RENAME', 0);
-define('FILE_EXISTS_REPLACE', 1);
-define('FILE_EXISTS_ERROR', 2);
-
-/**
- * Create the download path to a file.
- *
- * @param $path A string containing the path of the file to generate URL for.
- * @return A string containing a URL that can be used to download the file.
- */
-function file_create_url($path) {
-  // Strip file_directory_path from $path. We only include relative paths in urls.
-  if (strpos($path, file_directory_path() . '/') === 0) {
-    $path = trim(substr($path, strlen(file_directory_path())), '\\/');
-  }
-  switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
-    case FILE_DOWNLOADS_PUBLIC:
-      return $GLOBALS['base_url'] .'/'. file_directory_path() .'/'. str_replace('\\', '/', $path);
-    case FILE_DOWNLOADS_PRIVATE:
-      return url('system/files/'. $path, NULL, NULL, TRUE);
-  }
-}
-
-/**
- * Make sure the destination is a complete path and resides in the file system
- * directory, if it is not prepend the file system directory.
- *
- * @param $dest A string containing the path to verify. If this value is
- *   omitted, Drupal's 'files' directory will be used.
- * @return A string containing the path to file, with file system directory
- *   appended if necessary, or FALSE if the path is invalid (i.e. outside the
- *   configured 'files' or temp directories).
- */
-function file_create_path($dest = 0) {
-  $file_path = file_directory_path();
-  if (!$dest) {
-    return $file_path;
-  }
-  // file_check_location() checks whether the destination is inside the Drupal files directory.
-  if (file_check_location($dest, $file_path)) {
-    return $dest;
-  }
-  // check if the destination is instead inside the Drupal temporary files directory.
-  else if (file_check_location($dest, file_directory_temp())) {
-    return $dest;
-  }
-  // Not found, try again with prefixed directory path.
-  else if (file_check_location($file_path . '/' . $dest, $file_path)) {
-    return $file_path . '/' . $dest;
-  }
-  // File not found.
-  return FALSE;
-}
-
-/**
- * Check that the directory exists and is writable. Directories need to
- * have execute permissions to be considered a directory by FTP servers, etc.
- *
- * @param $directory A string containing the name of a directory path.
- * @param $mode A Boolean value to indicate if the directory should be created
- *   if it does not exist or made writable if it is read-only.
- * @param $form_item An optional string containing the name of a form item that
- *   any errors will be attached to. This is useful for settings forms that
- *   require the user to specify a writable directory. If it can't be made to
- *   work, a form error will be set preventing them from saving the settings.
- * @return False when directory not found, or true when directory exists.
- */
-function file_check_directory(&$directory, $mode = 0, $form_item = NULL) {
-  $directory = rtrim($directory, '/\\');
-
-  // Check if directory exists.
-  if (!is_dir($directory)) {
-    if (($mode & FILE_CREATE_DIRECTORY) && @mkdir($directory)) {
-      drupal_set_message(t('The directory %directory has been created.', array('%directory' => theme('placeholder', $directory))));
-      @chmod($directory, 0775); // Necessary for non-webserver users.
-    }
-    else {
-      if ($form_item) {
-        form_set_error($form_item, t('The directory %directory does not exist.', array('%directory' => theme('placeholder', $directory))));
-      }
-      return false;
-    }
-  }
-
-  // Check to see if the directory is writable.
-  if (!is_writable($directory)) {
-    if (($mode & FILE_MODIFY_PERMISSIONS) && @chmod($directory, 0775)) {
-      drupal_set_message(t('The permissions of directory %directory have been changed to make it writable.', array('%directory' => theme('placeholder', $directory))));
-    }
-    else {
-      form_set_error($form_item, t('The directory %directory is not writable', array('%directory' => theme('placeholder', $directory))));
-      watchdog('file system', t('The directory %directory is not writable, because it does not have the correct permissions set.', array('%directory' => theme('placeholder', $directory))), WATCHDOG_ERROR);
-      return false;
-    }
-  }
-
-  if ((file_directory_path() == $directory || file_directory_temp() == $directory) && !is_file("$directory/.htaccess")) {
-    $htaccess_lines = "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nOptions None\n<IfModule mod_rewrite.c>\n  RewriteEngine off\n</IfModule>";
-    if (($fp = fopen("$directory/.htaccess", 'w')) && fputs($fp, $htaccess_lines)) {
-      fclose($fp);
-    }
-    else {
-      $message = t("Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines: <code>%htaccess</code>", array('%directory' => theme('placeholder', $directory), '%htaccess' => '<br />'. str_replace("\n", '<br />', check_plain($htaccess_lines))));
-      form_set_error($form_item, $message);
-      watchdog('security', $message, WATCHDOG_ERROR);
-    }
-  }
-
-  return true;
-}
-
-/**
- * Checks path to see if it is a directory, or a dir/file.
- *
- * @param $path A string containing a file path. This will be set to the
- *   directory's path.
- * @return If the directory is not in a Drupal writable directory, FALSE is
- *   returned. Otherwise, the base name of the path is returned.
- */
-function file_check_path(&$path) {
-  // Check if path is a directory.
-  if (file_check_directory($path)) {
-    return '';
-  }
-
-  // Check if path is a possible dir/file.
-  $filename = basename($path);
-  $path = dirname($path);
-  if (file_check_directory($path)) {
-    return $filename;
-  }
-
-  return false;
-}
-
-
-/**
- * Check if $source is a valid file upload. If so, move the file to Drupal's tmp dir
- * and return it as an object.
- *
- * The use of SESSION['file_uploads'] should probably be externalized to upload.module
- *
- * @todo Rename file_check_upload to file_prepare upload.
- * @todo Refactor or merge file_save_upload.
- * @todo Extenalize SESSION['file_uploads'] to modules.
- *
- * @param $source An upload source (the name of the upload form item), or a file
- * @return false for an invalid file or upload. A file object for valid uploads/files.
- *
- */
-
-function file_check_upload($source = 'upload') {
-  // Cache for uploaded files. Since the data in _FILES is modified
-  // by this function, we cache the result.
-  static $upload_cache;
-
-  // Test source to see if it is an object.
-  if (is_object($source)) {
-
-    // Validate the file path if an object was passed in instead of
-    // an upload key.
-    if (is_file($source->filepath)) {
-      return $source;
-    }
-    else {
-      return false;
-    }
-  }
-
-  // Return cached objects without processing since the file will have
-  // already been processed and the paths in _FILES will be invalid.
-  if (isset($upload_cache[$source])) {
-    return $upload_cache[$source];
-  }
-
-  // If a file was uploaded, process it.
-  if ($_FILES["edit"]["name"][$source] && is_uploaded_file($_FILES["edit"]["tmp_name"][$source])) {
-
-    // Check for file upload errors and return false if a
-    // lower level system error occurred.
-    switch ($_FILES["edit"]["error"][$source]) {
-
-      // @see http://php.net/manual/en/features.file-upload.errors.php
-      case UPLOAD_ERR_OK:
-        break;
-
-      case UPLOAD_ERR_INI_SIZE:
-      case UPLOAD_ERR_FORM_SIZE:
-        drupal_set_message(t('The file %file could not be saved, because it exceeds the maximum allowed size for uploads.', array('%file' => theme('placeholder', $source))), 'error');
-        return 0;
-
-      case UPLOAD_ERR_PARTIAL:
-      case UPLOAD_ERR_NO_FILE:
-        drupal_set_message(t('The file %file could not be saved, because the upload did not complete.', array('%file' => theme('placeholder', $source))), 'error');
-        return 0;
-
-      // Unknown error
-      default:
-        drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.', array('%file' => theme('placeholder', $source))),'error');
-        return 0;
-    }
-
-    // Begin building file object.
-    $file = new StdClass();
-    $file->filename = trim(basename($_FILES["edit"]["name"][$source]), '.');
-
-    // Create temporary name/path for newly uploaded files.
-    $file->filepath = tempnam(file_directory_temp(), 'tmp_');
-
-    $file->filemime = $_FILES["edit"]["type"][$source];
-
-    // Rename potentially executable files, to help prevent exploits.
-    if (((substr($file->filemime, 0, 5) == 'text/' || strpos($file->filemime, 'javascript')) && (substr($file->filename, -4) != '.txt')) || preg_match('/\.(php|pl|py|cgi|asp)$/i', $file->filename)) {
-      $file->filemime = 'text/plain';
-      $file->filepath .= '.txt';
-      $file->filename .= '.txt';
-    }
-
-    // Move uploaded files from php's upload_tmp_dir to Drupal's file temp.
-    // This overcomes open_basedir restrictions for future file operations.
-    if (!move_uploaded_file($_FILES["edit"]["tmp_name"][$source], $file->filepath)) {
-      drupal_set_message(t('File upload error. Could not move uploaded file.'));
-      watchdog('file', t('Upload Error. Could not move uploaded file(%file) to destination(%destination).', array('%file' => theme('placeholder', $_FILES["edit"]["tmp_name"][$source]), '%destination' => theme('placeholder', $file->filepath))));
-      return false;
-    }
-
-    $file->filesize = $_FILES["edit"]["size"][$source];
-    $file->source = $source;
-
-    // Add processed file to the cache.
-    $upload_cache[$source] = $file;
-    return $file;
-  }
-
-  else {
-    // In case of previews return previous file object.
-    if (file_exists($_SESSION['file_uploads'][$source]->filepath)) {
-      return $_SESSION['file_uploads'][$source];
-    }
-  }
-  // If nothing was done, return false.
-  return false;
-}
-
-/**
- * Check if a file is really located inside $directory. Should be used to make
- * sure a file specified is really located within the directory to prevent
- * exploits.
- *
- * @code
- *   // Returns false:
- *   file_check_location('/www/example.com/files/../../../etc/passwd', '/www/example.com/files');
- * @endcode
- *
- * @param $source A string set to the file to check.
- * @param $directory A string where the file should be located.
- * @return 0 for invalid path or the real path of the source.
- */
-function file_check_location($source, $directory = '') {
-  $check = realpath($source);
-  if ($check) {
-    $source = $check;
-  }
-  else {
-    // This file does not yet exist
-    $source = realpath(dirname($source)) .'/'. basename($source);
-  }
-  $directory = realpath($directory);
-  if ($directory && strpos($source, $directory) !== 0) {
-    return 0;
-  }
-  return $source;
-}
-
-/**
- * Copies a file to a new location. This is a powerful function that in many ways
- * performs like an advanced version of copy().
- * - Checks if $source and $dest are valid and readable/writable.
- * - Performs a file copy if $source is not equal to $dest.
- * - If file already exists in $dest either the call will error out, replace the
- *   file or rename the file based on the $replace parameter.
- *
- * @param $source A string specifying the file location of the original file.
- *   This parameter will contain the resulting destination filename in case of
- *   success.
- * @param $dest A string containing the directory $source should be copied to.
- *   If this value is omitted, Drupal's 'files' directory will be used.
- * @param $replace Replace behavior when the destination file already exists.
- *   - FILE_EXISTS_REPLACE - Replace the existing file
- *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is unique
- *   - FILE_EXISTS_ERROR - Do nothing and return false.
- * @return True for success, false for failure.
- */
-function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
-  $dest = file_create_path($dest);
-
-  $directory = $dest;
-  $basename = file_check_path($directory);
-
-  // Make sure we at least have a valid directory.
-  if ($basename === false) {
-    $source = is_object($source) ? $source->filepath : $source;
-    drupal_set_message(t('The selected file %file could not be uploaded, because the destination %directory is not properly configured.', array('%file' => theme('placeholder', $source), '%directory' => theme('placeholder', $dest))), 'error');
-    watchdog('file system', t('The selected file %file could not not be uploaded, because the destination %directory could not be found, or because its permissions do not allow the file to be written.', array('%file' => theme('placeholder', $source), '%directory' => theme('placeholder', $dest))), WATCHDOG_ERROR);
-    return 0;
-  }
-
-  // Process a file upload object.
-  if (is_object($source)) {
-    $file = $source;
-    $source = $file->filepath;
-    if (!$basename) {
-      $basename = $file->filename;
-    }
-  }
-
-  $source = realpath($source);
-  if (!file_exists($source)) {
-    drupal_set_message(t('The selected file %file could not be copied, because no file by that name exists.  Please check that you supplied the correct filename.', array('%file' => theme('placeholder', $source))), 'error');
-    return 0;
-  }
-
-  // If the destination file is not specified then use the filename of the source file.
-  $basename = $basename ? $basename : basename($source);
-  $dest = $directory .'/'. $basename;
-
-  // Make sure source and destination filenames are not the same, makes no sense
-  // to copy it if they are. In fact copying the file will most likely result in
-  // a 0 byte file. Which is bad. Real bad.
-  if ($source != realpath($dest)) {
-    if (file_exists($dest)) {
-      switch ($replace) {
-        case FILE_EXISTS_RENAME:
-          // Destination file already exists and we can't replace is so we try and
-          // and find a new filename.
-          if ($pos = strrpos($basename, '.')) {
-            $name = substr($basename, 0, $pos);
-            $ext = substr($basename, $pos);
-          }
-          else {
-            $name = $basename;
-          }
-
-          $counter = 0;
-          do {
-            $dest = $directory .'/'. $name .'_'. $counter++ . $ext;
-          } while (file_exists($dest));
-          break;
-
-        case FILE_EXISTS_ERROR:
-          drupal_set_message(t('The selected file %file could not be copied, because a file by that name already exists in the destination.', array('%file' => theme('placeholder', $source))), 'error');
-          return 0;
-      }
-    }
-
-    if (!@copy($source, $dest)) {
-      drupal_set_message(t('The selected file %file could not be copied.', array('%file' => theme('placeholder', $source))), 'error');
-      return 0;
-    }
-
-    // Give everyone read access so that FTP'd users or
-    // non-webserver users can see/read these files.
-    @chmod($dest, 0664);
-  }
-
-  if (is_object($file)) {
-    $file->filename = $basename;
-    $file->filepath = $dest;
-    $source = $file;
-  }
-  else {
-    $source = $dest;
-  }
-
-  return 1; // Everything went ok.
-}
-
-/**
- * Moves a file to a new location.
- * - Checks if $source and $dest are valid and readable/writable.
- * - Performs a file move if $source is not equal to $dest.
- * - If file already exists in $dest either the call will error out, replace the
- *   file or rename the file based on the $replace parameter.
- *
- * @param $source A string specifying the file location of the original file.
- *   This parameter will contain the resulting destination filename in case of
- *   success.
- * @param $dest A string containing the directory $source should be copied to.
- *   If this value is omitted, Drupal's 'files' directory will be used.
- * @param $replace Replace behavior when the destination file already exists.
- *   - FILE_EXISTS_REPLACE - Replace the existing file
- *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is unique
- *   - FILE_EXISTS_ERROR - Do nothing and return false.
- * @return True for success, false for failure.
- */
-function file_move(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
-
-  $path_original = is_object($source) ? $source->filepath : $source;
-
-  if (file_copy($source, $dest, $replace)) {
-    $path_current = is_object($source) ? $source->filepath : $source;
-
-    if ($path_original == $path_current || file_delete($path_original)) {
-      return 1;
-    }
-    drupal_set_message(t('The removal of the original file %file has failed.', array('%file' => theme('placeholder', $path_original))), 'error');
-  }
-  return 0;
-}
-
-/**
- * Create a full file path from a directory and filename. If a file with the
- * specified name already exists, an alternative will be used.
- *
- * @param $basename string filename
- * @param $directory string directory
- * @return
- */
-function file_create_filename($basename, $directory) {
-  $dest = $directory .'/'. $basename;
-
-  if (file_exists($dest)) {
-    // Destination file already exists, generate an alternative.
-    if ($pos = strrpos($basename, '.')) {
-      $name = substr($basename, 0, $pos);
-      $ext = substr($basename, $pos);
-    }
-    else {
-      $name = $basename;
-    }
-
-    $counter = 0;
-    do {
-      $dest = $directory .'/'. $name .'_'. $counter++ . $ext;
-    } while (file_exists($dest));
-  }
-
-  return $dest;
-}
-
-/**
- * Delete a file.
- *
- * @param $path A string containing a file path.
- * @return True for success, false for failure.
- */
-function file_delete($path) {
-  if (is_file($path)) {
-    return unlink($path);
-  }
-}
-
-/**
- * Saves a file upload to a new location. The source file is validated as a
- * proper upload and handled as such.
- *
- * @param $source A string specifying the name of the upload field to save.
- *   This parameter will contain the resulting destination filename in case of
- *   success.
- * @param $dest A string containing the directory $source should be copied to,
- *   will use the temporary directory in case no other value is set.
- * @param $replace A boolean, set to true if the destination should be replaced
- *   when in use, but when false append a _X to the filename.
- * @return An object containing file info or 0 in case of error.
- */
-function file_save_upload($source, $dest = false, $replace = FILE_EXISTS_RENAME) {
-  // Make sure $source exists && is valid.
-  if ($file = file_check_upload($source)) {
-
-    // This should be refactored, file_check_upload has already
-    // moved the file to the temporary folder.
-    if (!$dest) {
-      $dest = file_directory_temp();
-      $temporary = 1;
-      if (is_file($file->filepath)) {
-        // If this file was uploaded by this user before replace the temporary copy.
-        $replace = FILE_EXISTS_REPLACE;
-      }
-    }
-
-    unset($_SESSION['file_uploads'][is_object($source) ? $source->source : $source]);
-    if (file_move($file, $dest, $replace)) {
-      if ($temporary) {
-        $_SESSION['file_uploads'][is_object($source) ? $source->source : $source] = $file;
-      }
-      return $file;
-    }
-    return 0;
-  }
-  return 0;
-}
-
-/**
- * Save a string to the specified destination.
- *
- * @param $data A string containing the contents of the file.
- * @param $dest A string containing the destination location.
- * @param $replace Replace behavior when the destination file already exists.
- *   - FILE_EXISTS_REPLACE - Replace the existing file
- *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is unique
- *   - FILE_EXISTS_ERROR - Do nothing and return false.
- *
- * @return A string containing the resulting filename or 0 on error
- */
-function file_save_data($data, $dest, $replace = FILE_EXISTS_RENAME) {
-  $temp = file_directory_temp();
-  $file = tempnam($temp, 'file');
-  if (!$fp = fopen($file, 'wb')) {
-    drupal_set_message(t('The file could not be created.'), 'error');
-    return 0;
-  }
-  fwrite($fp, $data);
-  fclose($fp);
-
-  if (!file_move($file, $dest, $replace)) {
-    return 0;
-  }
-
-  return $file;
-}
-
-/**
- * Transfer file using http to client. Pipes a file through Drupal to the
- * client.
- *
- * @param $source File to transfer.
- * @param $headers An array of http headers to send along with file.
- */
-function file_transfer($source, $headers) {
-  ob_end_clean();
-
-  foreach ($headers as $header) {
-    // To prevent HTTP header injection, we delete new lines that are
-    // not followed by a space or a tab.
-    // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
-    $header = preg_replace('/\r?\n(?!\t| )/', '', $header);
-    header($header);
-  }
-
-  $source = file_create_path($source);
-
-  // Transfer file in 1024 byte chunks to save memory usage.
-  if ($fd = fopen($source, 'rb')) {
-    while (!feof($fd)) {
-      print fread($fd, 1024);
-    }
-    fclose($fd);
-  }
-  else {
-    drupal_not_found();
-  }
-  exit();
-}
-
-/**
- * Call modules that implement hook_file_download() to find out if a file is
- * accessible and what headers it should be transferred with. If a module
- * returns -1 drupal_access_denied() will be returned. If one or more modules
- * returned headers the download will start with the returned headers. If no
- * modules respond drupal_not_found() will be returned.
- */
-
-function file_download() {
-  // Merge remainder of arguments from GET['q'], into relative file path.
-  $args = func_get_args();
-  $filepath = implode('/', $args);
-
-  // Maintain compatibility with old ?file=paths saved in node bodies.
-  if (isset($_GET['file'])) {
-    $filepath =  $_GET['file'];
-  }
-
-  if (file_exists(file_create_path($filepath))) {
-    $headers = module_invoke_all('file_download', $filepath);
-    if (in_array(-1, $headers)) {
-        return drupal_access_denied();
-    }
-    if (count($headers)) {
-        file_transfer($filepath, $headers);
-    }
-  }
-  return drupal_not_found();
-}
-
-
-/**
- * Finds all files that match a given mask in a given
- * directory.
- *
- * @param $dir
- *   The base directory for the scan.
- * @param $mask
- *   The regular expression of the files to find.
- * @param $nomask
- *   An array of files/directories to ignore.
- * @param $callback
- *   The callback function to call for each match.
- * @param $recurse
- *   When TRUE, the directory scan will recurse the entire tree
- *   starting at the provided directory.
- * @param $key
- *   The key to be used for the returned array of files.  Possible
- *   values are "filename", for the path starting with $dir,
- *   "basename", for the basename of the file, and "name" for the name
- *   of the file without an extension.
- * @param $min_depth
- *   Minimum depth of directories to return files from.
- * @param $depth
- *   Current depth of recursion. This parameter is only used internally and should not be passed.
- *
- * @return
- *   An associative array (keyed on the provided key) of objects with
- *   "path", "basename", and "name" members corresponding to the
- *   matching files.
- */
-function file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $callback = 0, $recurse = TRUE, $key = 'filename', $min_depth = 0, $depth = 0) {
-  $key = (in_array($key, array('filename', 'basename', 'name')) ? $key : 'filename');
-  $files = array();
-
-  if (is_dir($dir) && $handle = opendir($dir)) {
-    while ($file = readdir($handle)) {
-      if (!in_array($file, $nomask)) {
-        if (is_dir("$dir/$file") && $recurse) {
-          $files = array_merge($files, file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1));
-        }
-        elseif ($depth >= $min_depth && ereg($mask, $file)) {
-          $filename = "$dir/$file";
-          $basename = basename($file);
-          $name = substr($basename, 0, strrpos($basename, '.'));
-          $files[$$key] = new stdClass();
-          $files[$$key]->filename = $filename;
-          $files[$$key]->basename = $basename;
-          $files[$$key]->name = $name;
-          if ($callback) {
-            $callback($filename);
-          }
-        }
-      }
-    }
-
-    closedir($handle);
-  }
-
-  return $files;
-}
-
-/**
- * Determine the default temporary directory.
- *
- * @return A string containing a temp directory.
- */
-function file_directory_temp() {
-  $temporary_directory = variable_get('file_directory_temp', NULL);
-
-  if (is_null($temporary_directory)) {
-    $directories = array();
-
-    // Has PHP been set with an upload_tmp_dir?
-    if (ini_get('upload_tmp_dir')) {
-      $directories[] = ini_get('upload_tmp_dir');
-    }
-
-    // Operating system specific dirs.
-    if (substr(PHP_OS, 0, 3) == 'WIN') {
-      $directories[] = 'c:\\windows\\temp';
-      $directories[] = 'c:\\winnt\\temp';
-      $path_delimiter = '\\';
-    }
-    else {
-      $directories[] = '/tmp';
-      $path_delimiter = '/';
-    }
-
-    foreach ($directories as $directory) {
-      if (!$temporary_directory && is_dir($directory)) {
-        $temporary_directory = $directory;
-      }
-    }
-
-    // if a directory has been found, use it, otherwise default to 'files/tmp' or 'files\\tmp';
-    $temporary_directory = $temporary_directory ? $temporary_directory : file_directory_path() . $path_delimiter . 'tmp';
-    variable_set('file_directory_temp', $temporary_directory);
-  }
-
-  return $temporary_directory;
-}
-
-/**
- * Determine the default 'files' directory.
- *
- * @return A string containing the path to Drupal's 'files' directory.
- */
-function file_directory_path() {
-  return variable_get('file_directory_path', 'files');
-}
-
-
diff --git a/includes/form.inc b/includes/form.inc
deleted file mode 100644 (file)
index c638b04..0000000
+++ /dev/null
@@ -1,1178 +0,0 @@
-<?php
-// $Id: form.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @defgroup form Form generation
- * @{
- * Functions to enable output of HTML forms and form elements.
- *
- * Drupal uses these functions to achieve consistency in its form presentation,
- * while at the same time simplifying code and reducing the amount of HTML that
- * must be explicitly generated by modules. See the reference at
- * http://api.drupal.org/api/HEAD/file/developer/topics/forms_api_reference.html
- * and the quickstart guide at
- * http://api.drupal.org/api/HEAD/file/developer/topics/forms_api.html
- */
-
-/**
- * Check if the key is a property.
- */
-function element_property($key) {
-  return $key[0] == '#';
-}
-
-/**
- * Get properties of a form tree element. Properties begin with '#'.
- */
-function element_properties($element) {
-  return array_filter(array_keys((array) $element), 'element_property');
-}
-
-/**
- * Check if the key is a child.
- */
-function element_child($key) {
-  return $key[0] != '#';
-}
-
-/**
- * Get keys of a form tree element that are not properties (i.e., do not begin with '#').
- */
-function element_children($element) {
-  return array_filter(array_keys((array) $element), 'element_child');
-}
-
-/**
- * Processes a form array and produces the HTML output of a form.
- * If there is input in the $_POST['edit'] variable, this function
- * will attempt to validate it, using drupal_validate_form(),
- * and then submit the form using drupal_submit_form().
- *
- * @param $form_id
- *   A unique string identifying the form. Allows each form to be
- *   themed.  Pass NULL to suppress the form_id parameter (produces
- *   a shorter URL with method=get)
- * @param $form
- *   An associative array containing the structure of the form.
- * @param $callback
- *   An optional callback that will be used in addition to the form_id.
- *
- */
-function drupal_get_form($form_id, &$form, $callback = NULL) {
-  global $form_values, $form_submitted, $user, $form_button_counter;
-  static $saved_globals = array();
-
-  // Save globals in case of indirect recursive call
-  array_push($saved_globals, array($form_values, $form_submitted, $form_button_counter));
-
-  $form_values = array();
-  $form_submitted = FALSE;
-  $form_button_counter = array(0, 0);
-
-  $form['#type'] = 'form';
-  if (isset($form['#token'])) {
-    if (variable_get('cache', 0) && !$user->uid && $_SERVER['REQUEST_METHOD'] == 'GET') {
-      unset($form['#token']);
-    }
-    else {
-      // Make sure that a private key is set:
-      if (!variable_get('drupal_private_key', '')) {
-        variable_set('drupal_private_key', mt_rand());
-      }
-
-      $form['form_token'] = array('#type' => 'hidden', '#default_value' => md5(session_id() . $form['#token'] . variable_get('drupal_private_key', '')));
-    }
-  }
-  if (isset($form_id)) {
-    $form['form_id'] = array('#type' => 'hidden', '#value' => $form_id, '#id' => str_replace('_', '-', "edit-$form_id"));
-  }
-  if (!isset($form['#id'])) {
-    $form['#id'] = $form_id;
-  }
-
-  $form += _element_info('form');
-
-  if (!isset($form['#validate'])) {
-    if (function_exists($form_id .'_validate')) {
-      $form['#validate'] = array($form_id .'_validate' => array());
-    }
-    elseif (function_exists($callback .'_validate')) {
-      $form['#validate'] = array($callback .'_validate' => array());
-    }
-  }
-
-  if (!isset($form['#submit'])) {
-    if (function_exists($form_id .'_submit')) {
-      // we set submit here so that it can be altered but use reference for
-      // $form_values because it will change later
-      $form['#submit'] = array($form_id .'_submit' => array());
-    }
-    elseif (function_exists($callback .'_submit')) {
-      $form['#submit'] = array($callback .'_submit' => array());
-    }
-  }
-
-  foreach (module_implements('form_alter') as $module) {
-    $function = $module .'_form_alter';
-    $function($form_id, $form);
-  }
-
-  $form = form_builder($form_id, $form);
-  if (!empty($_POST['edit']) && (($_POST['edit']['form_id'] == $form_id) || ($_POST['edit']['form_id'] == $callback))) {
-    drupal_validate_form($form_id, $form, $callback);
-    // IE does not send a button value when there is only one submit button (and no non-submit buttons)
-    // and you submit by pressing enter.
-    // In that case we accept a submission without button values.
-    if (($form_submitted || (!$form_button_counter[0] && $form_button_counter[1])) && !form_get_errors()) {
-      $redirect = drupal_submit_form($form_id, $form, $callback);
-      if (isset($redirect)) {
-        $goto = $redirect;
-      }
-      if (isset($form['#redirect'])) {
-        $goto = $form['#redirect'];
-      }
-      if ($goto !== FALSE) {
-        if (is_array($goto)) {
-          call_user_func_array('drupal_goto', $goto);
-        }
-        elseif (!isset($goto)) {
-          drupal_goto($_GET['q']);
-        }
-        else {
-          drupal_goto($goto);
-        }
-      }
-    }
-  }
-
-  // Don't override #theme if someone already set it.
-  if (!isset($form['#theme'])) {
-    if (theme_get_function($form_id)) {
-      $form['#theme'] = $form_id;
-    }
-    elseif (theme_get_function($callback)) {
-      $form['#theme'] = $callback;
-    }
-  }
-
-  if (isset($form['#pre_render'])) {
-    foreach ($form['#pre_render'] as $function) {
-      if (function_exists($function)) {
-        $function($form_id, $form);
-      }
-    }
-  }
-
-  $output = form_render($form);
-  // Restore globals
-  list($form_values, $form_submitted, $form_button_counter) = array_pop($saved_globals);
-  return $output;
-}
-
-function drupal_validate_form($form_id, $form, $callback = NULL) {
-  global $form_values;
-  static $validated_forms = array();
-
-  if (isset($validated_forms[$form_id])) {
-    return;
-  }
-
-  if (isset($form['#token'])) {
-    if ($form_values['form_token'] != md5(session_id() . $form['#token'] . variable_get('drupal_private_key', ''))) {
-      // setting this error will cause the form to fail validation
-      form_set_error('form_token', t('Validation error, please try again.  If this error persists, please contact the site administrator.'));
-    }
-  }
-
-  _form_validate($form, $form_id);
-  $validated_forms[$form_id] = TRUE;
-}
-
-function drupal_submit_form($form_id, $form, $callback = NULL) {
-  global $form_values;
-  $default_args = array($form_id, &$form_values);
-
-  if (isset($form['#submit'])) {
-    foreach ($form['#submit'] as $function => $args) {
-      if (function_exists($function)) {
-        $args = array_merge($default_args, (array) $args);
-        // Since we can only redirect to one page, only the last redirect will work
-        $redirect = call_user_func_array($function, $args);
-        if (isset($redirect)) {
-          $goto = $redirect;
-        }
-      }
-    }
-  }
-  return $goto;
-}
-
-function _form_validate($elements, $form_id = NULL) {
-  // Recurse through all children.
-  foreach (element_children($elements) as $key) {
-    if (isset($elements[$key]) && $elements[$key]) {
-      _form_validate($elements[$key]);
-    }
-  }
-  /* Validate the current input */
-  if (!$elements['#validated']) {
-    if (isset($elements['#needs_validation'])) {
-      // An empty textfield returns '' so we use empty(). An empty checkbox
-      // and a textfield could return '0' and empty('0') returns TRUE so we
-      // need a special check for the '0' string.
-      if ($elements['#required'] && empty($elements['#value']) && $elements['#value'] !== '0') {
-        form_error($elements, t('%name field is required.', array('%name' => $elements['#title'])));
-      }
-
-      // Add legal choice check if element has #options. Can be skipped, but then you must validate your own element.
-      if (isset($elements['#options']) && isset($elements['#value']) && !isset($elements['#DANGEROUS_SKIP_CHECK'])) {
-        if ($elements['#type'] == 'select') {
-          $options = form_options_flatten($elements['#options']);
-        }
-        else {
-          $options = $elements['#options'];
-        }
-        if (is_array($elements['#value'])) {
-          $value = $elements['#type'] == 'checkboxes' ? array_keys(array_filter($elements['#value'])) : $elements['#value'];
-          foreach ($value as $v) {
-            if (!isset($options[$v])) {
-              form_error($elements, t('An illegal choice has been detected. Please contact the site administrator.'));
-              watchdog('form', t('Illegal choice %choice in %name element.', array('%choice' => theme('placeholder', check_plain($v)), '%name' => theme_placeholder(empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']))), WATCHDOG_ERROR);
-            }
-          }
-        }
-        elseif (!isset($options[$elements['#value']])) {
-          form_error($elements, t('An illegal choice has been detected. Please contact the site administrator.'));
-          watchdog('form', t('Illegal choice %choice in %name element.', array('%choice' => theme_placeholder(check_plain($v)), '%name' => theme('placeholder', empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']))), WATCHDOG_ERROR);
-        }
-      }
-    }
-
-    // User-applied checks.
-    if (isset($elements['#validate'])) {
-      foreach ($elements['#validate'] as $function => $args) {
-        $args = array_merge(array($elements), $args);
-        // for the full form we hand over a copy of $form_values
-        if (isset($form_id)) {
-          $args = array_merge(array($form_id, $GLOBALS['form_values']), $args);
-        }
-        if (function_exists($function))  {
-          call_user_func_array($function, $args);
-        }
-      }
-    }
-    $elements['#validated'] = TRUE;
-  }
-}
-
-/**
- * File an error against a form element. If the name of the element is
- * edit[foo][bar] then you may pass either foo or foo][bar as $name
- * foo will set an error for all its children.
- */
-function form_set_error($name = NULL, $message = '') {
-  static $form = array();
-  if (isset($name) && !isset($form[$name])) {
-    $form[$name] = $message;
-    if ($message) {
-      drupal_set_message($message, 'error');
-    }
-  }
-  return $form;
-}
-
-/**
- * Return an associative array of all errors.
- */
-function form_get_errors() {
-  $form = form_set_error();
-  if (!empty($form)) {
-    return $form;
-  }
-}
-
-/**
- * Return the error message filed against the form with the specified name.
- */
-function form_get_error($element) {
-  $form = form_set_error();
-  $key = $element['#parents'][0];
-  if (isset($form[$key])) {
-    return $form[$key];
-  }
-  $key = implode('][', $element['#parents']);
-  if (isset($form[$key])) {
-    return $form[$key];
-  }
-}
-
-/**
- * Flag an element as having an error.
- */
-function form_error(&$element, $message = '') {
-  $element['#error'] = TRUE;
-  form_set_error(implode('][', $element['#parents']), $message);
-}
-
-/**
- * Adds some required properties to each form element, which are used
- * internally in the form api. This function also automatically assigns
- * the value property from the $edit array, provided the element doesn't
- * already have an assigned value.
- *
- * @param $form_id
- *   A unique string identifying the form. Allows each form to be themed.
- * @param $form
- *   An associative array containing the structure of the form.
- */
-function form_builder($form_id, $form) {
-  global $form_values, $form_submitted, $form_button_counter;
-
-  // Initialize as unprocessed.
-  $form['#processed'] = FALSE;
-
-  /* Use element defaults */
-  if ((!empty($form['#type'])) && ($info = _element_info($form['#type']))) {
-    // overlay $info onto $form, retaining preexisting keys in $form
-    $form += $info;
-  }
-
-  if (isset($form['#input']) && $form['#input']) {
-    if (!isset($form['#name'])) {
-      $form['#name'] = 'edit[' . implode('][', $form['#parents']) . ']';
-    }
-    if (!isset($form['#id'])) {
-      $form['#id'] =  'edit-' . implode('-', $form['#parents']);
-    }
-
-    $posted = (isset($_POST['edit']) && ($_POST['edit']['form_id'] == $form_id));
-    $edit = $posted ? $_POST['edit'] : array();
-    foreach ($form['#parents'] as $parent) {
-      $edit = isset($edit[$parent]) ? $edit[$parent] : NULL;
-    }
-    if (!isset($form['#value']) && !array_key_exists('#value', $form)) {
-      if ($posted) {
-        switch ($form['#type']) {
-          case 'checkbox':
-            $form['#value'] = !empty($edit) ? $form['#return_value'] : 0;
-            break;
-          case 'select':
-            if (isset($form['#multiple']) && $form['#multiple']) {
-              if (isset($edit) && is_array($edit)) {
-                $form['#value'] = drupal_map_assoc($edit);
-              }
-              else {
-                $form['#value'] = array();
-              }
-            }
-            elseif (isset($edit)) {
-              $form['#value'] = $edit;
-            }
-            break;
-          case 'textfield':
-            if (isset($edit)) {
-              // Equate $edit to the form value to ensure it's marked for validation
-              $edit = str_replace(array("\r", "\n"), '', $edit);
-              $form['#value'] = $edit;
-            }
-            break;
-          default:
-            if (isset($edit)) {
-              $form['#value'] = $edit;
-            }
-        }
-        // Mark all posted values for validation
-        if ((isset($form['#value']) && $form['#value'] === $edit) || (isset($form['#required']) && $form['#required'])) {
-          $form['#needs_validation'] = TRUE;
-        }
-      }
-      if (!isset($form['#value'])) {
-        $function = $form['#type'] . '_value';
-        if (function_exists($function)) {
-          $function($form);
-        }
-        else {
-          $form['#value'] = $form['#default_value'];
-        }
-      }
-    }
-    if (isset($form['#executes_submit_callback'])) {
-      // Count submit and non-submit buttons
-      $form_button_counter[$form['#executes_submit_callback']]++;
-      // See if a submit button was pressed
-      if (isset($_POST[$form['#name']]) && $_POST[$form['#name']] == $form['#value']) {
-        $form_submitted = $form_submitted || $form['#executes_submit_callback'];
-      }
-    }
-  }
-
-  // Allow for elements to expand to multiple elements, e.g. radios, checkboxes and files.
-  if (isset($form['#process']) && !$form['#processed']) {
-    foreach ($form['#process'] as $process => $args) {
-      if (function_exists($process)) {
-        $args = array_merge(array($form), $args);
-        $form = call_user_func_array($process, $args);
-      }
-    }
-    $form['#processed'] = TRUE;
-  }
-
-  // Set the $form_values key that gets passed to validate and submit.
-  // We call this after #process gets called so that #process has a
-  // chance to update #value if desired.
-  if (isset($form['#input']) && $form['#input']) {
-    form_set_value($form, $form['#value']);
-  }
-
-  // Recurse through all child elements.
-  $count  = 0;
-  foreach (element_children($form) as $key) {
-    // don't squash an existing tree value
-    if (!isset($form[$key]['#tree'])) {
-      $form[$key]['#tree'] = $form['#tree'];
-    }
-
-    // don't squash existing parents value
-    if (!isset($form[$key]['#parents'])) {
-      // Check to see if a tree of child elements is present. If so, continue down the tree if required.
-      $form[$key]['#parents'] = $form[$key]['#tree'] && $form['#tree'] ? array_merge($form['#parents'], array($key)) : array($key);
-    }
-
-    # Assign a decimal placeholder weight to preserve original array order
-    if (!isset($form[$key]['#weight'])) {
-      $form[$key]['#weight'] = $count/1000;
-    }
-    $form[$key] = form_builder($form_id, $form[$key]);
-    $count++;
-  }
-
-  if (isset($form['#after_build']) && !isset($form['#after_build_done'])) {
-    foreach ($form['#after_build'] as $function) {
-      if (function_exists($function)) {
-        $form = $function($form, $form_values);
-      }
-    }
-    $form['#after_build_done'] = TRUE;
-  }
-
-  return $form;
-}
-
-/**
- * Use this function to make changes to form values in the form validate
- * phase, so they will be available in the submit phase in $form_values.
- *
- * Specifically, if $form['#parents'] is array('foo', 'bar')
- * and $value is 'baz' then this function will make
- * $form_values['foo']['bar'] to be 'baz'.
- *
- * @param $form
- *   The form item. Keys used: #parents, #value
- * @param $value
- *   The value for the form item.
- */
-function form_set_value($form, $value) {
-  global $form_values;
-  _form_set_value($form_values, $form, $form['#parents'], $value);
-}
-
-/**
- * Helper function for form_set_value().
- *
- * We iterate of $parents and create nested arrays for them
- * in $form_values if needed. Then we insert the value in
- * the right array.
- */
-function _form_set_value(&$form_values, $form, $parents, $value) {
-  $parent = array_shift($parents);
-  if (empty($parents)) {
-    $form_values[$parent] = $value;
-  }
-  else {
-    if (!isset($form_values[$parent])) {
-      $form_values[$parent] = array();
-    }
-    _form_set_value($form_values[$parent], $form, $parents, $value);
-  }
-  return $form;
-}
-
-/**
- * Renders a HTML form given a form tree. Recursively iterates over each of
- * the form elements, generating HTML code. This function is usually
- * called from within a theme.  To render a form from within a module, use
- * drupal_get_form().
- *
- * @param $elements
- *   The form tree describing the form.
- * @return
- *   The rendered HTML form.
- */
-function form_render(&$elements) {
-  if (!isset($elements)) {
-    return NULL;
-  }
-  $content = '';
-  uasort($elements, "_form_sort");
-  if (!isset($elements['#children'])) {
-    $children = element_children($elements);
-    /* Render all the children that use a theme function */
-    if (isset($elements['#theme']) && !$elements['#theme_used']) {
-      $elements['#theme_used'] = TRUE;
-
-      $previous_value = $elements['#value'];
-      $previous_type = $elements['#type'];
-      // If we rendered a single element, then we will skip the renderer.
-      if (empty($children)) {
-        $elements['#printed'] = TRUE;
-      }
-      else {
-        $elements['#value'] = '';
-      }
-      $elements['#type'] = 'markup';
-
-      $content = theme($elements['#theme'], $elements);
-
-      $elements['#value'] = $previous_value;
-      $elements['#type'] = $previous_type;
-      unset($elements['#prefix'], $elements['#suffix']);
-    }
-    /* render each of the children using form_render and concatenate them */
-    if (!isset($content) || $content === '') {
-      foreach ($children as $key) {
-        $content .= form_render($elements[$key]);
-      }
-    }
-  }
-  if (isset($content) && $content !== '') {
-    $elements['#children'] = $content;
-  }
-
-  // Until now, we rendered the children, here we render the element itself
-  if (!isset($elements['#printed'])) {
-    $content = theme(($elements['#type']) ? $elements['#type']: 'markup', $elements);
-    $elements['#printed'] = TRUE;
-  }
-
-  if (isset($content) && $content !== '') {
-    $prefix = isset($elements['#prefix']) ? $elements['#prefix'] : '';
-    $suffix = isset($elements['#suffix']) ? $elements['#suffix'] : '';
-    return $prefix . $content . $suffix;
-  }
-}
-
-/**
- * Function used by uasort in form_render() to sort form by weight.
- */
-function _form_sort($a, $b) {
-  $a_weight = (is_array($a) && isset($a['#weight'])) ? $a['#weight'] : 0;
-  $b_weight = (is_array($b) && isset($b['#weight'])) ? $b['#weight'] : 0;
-  if ($a_weight == $b_weight) {
-    return 0;
-  }
-  return ($a_weight < $b_weight) ? -1 : 1;
-}
-
-/**
- * Retrieve the default properties for the defined element type.
- */
-function _element_info($type, $refresh = null) {
-  static $cache;
-
-  $basic_defaults = array(
-    '#description' => NULL,
-    '#attributes' => array(),
-    '#required' => FALSE,
-    '#tree' => FALSE,
-    '#parents' => array()
-  );
-  if (!isset($cache) || $refresh) {
-    $cache = array();
-    foreach (module_implements('elements') as $module) {
-      $elements = module_invoke($module, 'elements');
-      if (isset($elements) && is_array($elements)) {
-        $cache = array_merge_recursive($cache, $elements);
-      }
-    }
-    if (sizeof($cache)) {
-      foreach ($cache as $element_type => $info) {
-        $cache[$element_type] = array_merge_recursive($basic_defaults, $info);
-      }
-    }
-  }
-
-  return $cache[$type];
-}
-
-function form_options_flatten($array, $reset = TRUE) {
-  static $return;
-
-  if ($reset) {
-    $return = array();
-  }
-
-  foreach ($array as $key => $value) {
-    if (is_array($value)) {
-      form_options_flatten($value, FALSE);
-    }
-    else {
-      $return[$key] = 1;
-    }
-  }
-
-  return $return;
-}
-
-/**
- * Format a dropdown menu or scrolling selection box.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used: title, value, options, description, extra, multiple, required
- * @return
- *   A themed HTML string representing the form element.
- *
- * It is possible to group options together; to do this, change the format of
- * $options to an associative array in which the keys are group labels, and the
- * values are associative arrays in the normal $options format.
- */
-function theme_select($element) {
-  $select = '';
-  $size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
-  _form_set_class($element, array('form-select'));
-  return theme('form_element', $element['#title'], '<select name="'. $element['#name'] .''. ($element['#multiple'] ? '[]' : '') .'"'. ($element['#multiple'] ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="' . $element['#id'] .'" '. $size .'>'. form_select_options($element) .'</select>', $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
-}
-
-function form_select_options($element, $choices = NULL) {
-  if (!isset($choices)) {
-    $choices = $element['#options'];
-  }
-  // array_key_exists() accommodates the rare event where $element['#value'] is NULL.
-  // isset() fails in this situation.
-  $value_valid = isset($element['#value']) || array_key_exists('#value', $element);
-  $value_is_array = is_array($element['#value']);
-  $options = '';
-  foreach ($choices as $key => $choice) {
-    if (is_array($choice)) {
-      $options .= '<optgroup label="'. $key .'">';
-      $options .= form_select_options($element, $choice);
-      $options .= '</optgroup>';
-    }
-    else {
-      $key = (string)$key;
-      if ($value_valid && ($element['#value'] == $key || ($value_is_array && in_array($key, $element['#value'])))) {
-        $selected = ' selected="selected"';
-      }
-      else {
-        $selected = '';
-      }
-      $options .= '<option value="'. $key .'"'. $selected .'>'. check_plain($choice) .'</option>';
-    }
-  }
-  return $options;
-}
-
-/**
- * Format a group of form items.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used: attributes, title, value, description, children, collapsible, collapsed
- * @return
- *   A themed HTML string representing the form item group.
- */
-function theme_fieldset($element) {
-  if ($element['#collapsible']) {
-    drupal_add_js('misc/collapse.js');
-
-    $element['#attributes']['class'] .= ' collapsible';
-    if ($element['#collapsed']) {
-     $element['#attributes']['class'] .= ' collapsed';
-    }
-  }
-
-  return '<fieldset' . drupal_attributes($element['#attributes']) .'>' . ($element['#title'] ? '<legend>'. $element['#title'] .'</legend>' : '') . ($element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : '') . $element['#children'] . $element['#value'] . "</fieldset>\n";
-
-}
-
-/**
- * Format a radio button.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used: required, return_value, value, attributes, title, description
- * @return
- *   A themed HTML string representing the form item group.
- */
-function theme_radio($element) {
-  _form_set_class($element, array('form-radio'));
-  $output = '<input type="radio" ';
-  $output .= 'name="' . $element['#name'] .'" ';
-  $output .= 'value="'. $element['#return_value'] .'" ';
-  $output .= ($element['#value'] == $element['#return_value']) ? ' checked="checked" ' : ' ';
-  $output .= drupal_attributes($element['#attributes']) .' />';
-  if (!is_null($element['#title'])) {
-    $output = '<label class="option">'. $output .' '. $element['#title'] .'</label>';
-  }
-  return theme('form_element', NULL, $output, $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
-}
-
-/**
- * Format a set of radio buttons.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used: title, value, options, description, required and attributes.
- * @return
- *   A themed HTML string representing the radio button set.
- */
-function theme_radios($element) {
-  if ($element['#title'] || $element['#description']) {
-    return theme('form_element', $element['#title'], $element['#children'], $element['#description'], NULL, $element['#required'], form_get_error($element));
-  }
-  else {
-    return $element['#children'];
-  }
-}
-
-/**
- * Format a password_confirm item.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used: title, value, id, required, error.
- * @return
- *   A themed HTML string representing the form item.
- */
-function theme_password_confirm($element) {
-  return theme('form_element', $element['#title'], '<div class="container-inline">'. $element['#children']. '</div>', $element['#description'],  $element['#id'], $element['#required'], form_get_error($element));
-}
-
-/*
- * Expand a password_confirm field into two text boxes.
- */
-function expand_password_confirm($element) {
-  $element['pass1'] =  array('#type' => 'password', '#size' => 12, '#value' => $element['#value']['pass1']);
-  $element['pass2'] =  array('#type' => 'password', '#size' => 12, '#value' => $element['#value']['pass2']);
-  $element['#validate'] = array('password_confirm_validate' => array());
-  $element['#tree'] = TRUE;
-
-  return $element;
-}
-
-/**
- * Validate password_confirm element.
- */
-function password_confirm_validate($form) {
-  $pass1 = trim($form['pass1']['#value']);
-  if (!empty($pass1)) {
-    $pass2 = trim($form['pass2']['#value']);
-    if ($pass1 != $pass2) {
-      form_error($form, t('The specified passwords do not match.'));
-    }
-  }
-  elseif ($form['#required'] && !empty($_POST['edit'])) {
-    form_error($form, t('Password field is required.'));
-  }
-
-  // Password field must be converted from a two-element array into a single
-  // string regardless of validation results.
-  form_set_value($form['pass1'], NULL);
-  form_set_value($form['pass2'], NULL);
-  form_set_value($form, $pass1);
-
-  return $form;
-}
-
-/**
- * Format a date selection element.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used: title, value, options, description, required and attributes.
- * @return
- *   A themed HTML string representing the date selection boxes.
- */
-function theme_date($element) {
-  $output = '<div class="container-inline">' . $element['#children'] . '</div>';
-  return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
-}
-
-/**
- * Roll out a single date element.
- */
-function expand_date($element) {
-  // Default to current date
-  if (!isset($element['#value'])) {
-    $element['#value'] = array('day' => format_date(time(), 'custom', 'j'),
-                            'month' => format_date(time(), 'custom', 'n'),
-                            'year' => format_date(time(), 'custom', 'Y'));
-  }
-
-  $element['#tree'] = TRUE;
-
-  // Determine the order of day, month, year in the site's chosen date format.
-  $format = variable_get('date_format_short', 'm/d/Y');
-  $sort = array();
-  $sort['day'] = max(strpos($format, 'd'), strpos($format, 'j'));
-  $sort['month'] = max(strpos($format, 'm'), strpos($format, 'M'));
-  $sort['year'] = strpos($format, 'Y');
-  asort($sort);
-  $order = array_keys($sort);
-
-  // Output multi-selector for date
-  foreach ($order as $type) {
-    switch ($type) {
-      case 'day':
-        $options = drupal_map_assoc(range(1, 31));
-        break;
-      case 'month':
-        $options = drupal_map_assoc(range(1, 12), 'map_month');
-        break;
-      case 'year':
-        $options = drupal_map_assoc(range(1900, 2050));
-        break;
-    }
-    $parents = $element['#parents'];
-    $parents[] = $type;
-    $element[$type] = array(
-      '#type' => 'select',
-      '#value' => $element['#value'][$type],
-      '#attributes' => $element['#attributes'],
-      '#options' => $options,
-    );
-  }
-
-  return $element;
-}
-
-/**
- * Validates the FAPI date type to stop dates like 30/Feb/2006
- */
-function date_validate($form) {
-  if (!checkdate($form['#value']['month'], $form['#value']['day'], $form['#value']['year'])) {
-    form_error($form, t('The specified date is invalid.'));
-  }
-}
-
-/**
- * Helper function for usage with drupal_map_assoc to display month names.
- */
-function map_month($month) {
-  return format_date(gmmktime(0, 0, 0, $month, 2, 1970), 'custom', 'M', 0);
-}
-
-/**
- * Helper function to load value from default value for checkboxes
- */
-function checkboxes_value(&$form) {
-  $value = array();
-  foreach ((array)$form['#default_value'] as $key) {
-    $value[$key] = 1;
-  }
-  $form['#value'] = $value;
-}
-
-/**
- * If no default value is set for weight select boxes, use 0.
- */
-function weight_value(&$form) {
-  if (isset($form['#default_value'])) {
-    $form['#value'] = $form['#default_value'];
-  }
-  else {
-    $form['#value'] = 0;
-  }
-}
-
-/**
- * Roll out a single radios element to a list of radios,
- * using the options array as index.
- */
-function expand_radios($element) {
-  if (count($element['#options']) > 0) {
-    foreach ($element['#options'] as $key => $choice) {
-      if (!isset($element[$key])) {
-        $element[$key] = array('#type' => 'radio', '#title' => $choice, '#return_value' => $key, '#default_value' => $element['#default_value'], '#attributes' => $element['#attributes'], '#parents' => $element['#parents'], '#spawned' => TRUE);
-      }
-    }
-  }
-  return $element;
-}
-
-/**
- * Format a form item.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used:  title, value, description, required, error
- * @return
- *   A themed HTML string representing the form item.
- */
-function theme_item($element) {
-  return theme('form_element', $element['#title'], $element['#value'] . $element['#children'], $element['#description'], $element['#id'], $element['#required'], $element['#error']);
-}
-
-/**
- * Format a checkbox.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used:  title, value, return_value, description, required
- * @return
- *   A themed HTML string representing the checkbox.
- */
-function theme_checkbox($element) {
-  _form_set_class($element, array('form-checkbox'));
-  $checkbox = '<input ';
-  $checkbox .= 'type="checkbox" ';
-  $checkbox .= 'name="'. $element['#name'] .'" ';
-  $checkbox .= 'id="'. $element['#id'].'" ' ;
-  $checkbox .= 'value="'. $element['#return_value'] .'" ';
-  $checkbox .= $element['#value'] ? ' checked="checked" ' : ' ';
-  $checkbox .= drupal_attributes($element['#attributes']) . ' />';
-
-  if (!is_null($element['#title'])) {
-    $checkbox = '<label class="option">'. $checkbox .' '. $element['#title'] .'</label>';
-  }
-
-  return theme('form_element', NULL, $checkbox, $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
-}
-
-/**
- * Format a set of checkboxes.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- * @return
- *   A themed HTML string representing the checkbox set.
- */
-function theme_checkboxes($element) {
-  if ($element['#title'] || $element['#description']) {
-    return theme('form_element', $element['#title'], $element['#children'], $element['#description'], NULL, $element['#required'], form_get_error($element));
-  }
-  else {
-    return $element['#children'];
-  }
-}
-
-function expand_checkboxes($element) {
-  $value = is_array($element['#value']) ? $element['#value'] : array();
-  $element['#tree'] = TRUE;
-  if (count($element['#options']) > 0) {
-    if (!isset($element['#default_value']) || $element['#default_value'] == 0) {
-      $element['#default_value'] = array();
-    }
-    foreach ($element['#options'] as $key => $choice) {
-      if (!isset($element[$key])) {
-        $element[$key] = array('#type' => 'checkbox', '#processed' => TRUE, '#title' => $choice, '#return_value' => $key, '#default_value' => isset($value[$key]), '#attributes' => $element['#attributes']);
-      }
-    }
-  }
-  return $element;
-}
-
-function theme_submit($element) {
-  return theme('button', $element);
-}
-
-function theme_button($element) {
-  //Make sure not to overwrite classes
-  if (isset($element['#attributes']['class'])) {
-    $element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class'];
-  }
-  else {
-    $element['#attributes']['class'] = 'form-'. $element['#button_type'];
-  }
-
-  return '<input type="submit" '. (empty($element['#name']) ? '' : 'name="'. $element['#name'] .'" ') .'value="'. check_plain($element['#value']) .'" '. drupal_attributes($element['#attributes']) ." />\n";
-}
-
-/**
- * Format a hidden form field.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used:  value, edit
- * @return
- *   A themed HTML string representing the hidden form field.
- */
-function theme_hidden($element) {
-  return '<input type="hidden" name="'. $element['#name'] . '" id="'. $element['#id'] . '" value="'. check_plain($element['#value']) ."\" " . drupal_attributes($element['#attributes']) ." />\n";
-}
-
-/**
- * Format a textfield.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used:  title, value, description, size, maxlength, required, attributes autocomplete_path
- * @return
- *   A themed HTML string representing the textfield.
- */
-function theme_textfield($element) {
-  $size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
-  $class = array('form-text');
-  $extra = '';
-  if ($element['#autocomplete_path']) {
-    drupal_add_js('misc/autocomplete.js');
-    $class[] = 'form-autocomplete';
-    $extra =  '<input class="autocomplete" type="hidden" id="'. $element['#id'] .'-autocomplete" value="'. check_url(url($element['#autocomplete_path'], NULL, NULL, TRUE)) .'" disabled="disabled" />';
-  }
-  _form_set_class($element, $class);
-  $output = '<input type="text" maxlength="'. $element['#maxlength'] .'" name="'. $element['#name'] .'" id="'. $element['#id'] .'" '. $size .' value="'. check_plain($element['#value']) .'"'. drupal_attributes($element['#attributes']) .' />';
-  return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], form_get_error($element)). $extra;
-}
-
-/**
- * Format a form.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used: action, method, attributes, children
- * @return
- *   A themed HTML string representing the form.
- */
-function theme_form($element) {
-  // Anonymous div to satisfy XHTML compliance.
-  $action = $element['#action'] ? 'action="' . check_url($element['#action']) . '" ' : '';
-  return '<form '. $action . ' method="'. $element['#method'] .'" '. 'id="'. $element['#id'] .'"'.  drupal_attributes($element['#attributes']) .">\n<div>". $element['#children'] ."\n</div></form>\n";
-}
-
-/**
- * Format a textarea.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used: title, value, description, rows, cols, required, attributes
- * @return
- *   A themed HTML string representing the textarea.
- */
-function theme_textarea($element) {
-  $class = array('form-textarea');
-  if ($element['#resizable'] !== false) {
-    drupal_add_js('misc/textarea.js');
-    $class[] = 'resizable';
-  }
-
-  $cols = $element['#cols'] ? ' cols="'. $element['#cols'] .'"' : '';
-  _form_set_class($element, $class);
-  return theme('form_element', $element['#title'], '<textarea'. $cols .' rows="'. $element['#rows'] .'" name="'. $element['#name'] .'" id="' . $element['#id'] .'" '. drupal_attributes($element['#attributes']) .'>'. check_plain($element['#value']) .'</textarea>', $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
-}
-
-/**
- * Format HTML markup for use in forms.
- *
- * This is used in more advanced forms, such as theme selection and filter format.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used: prefix, value, children and suffix.
- * @return
- *   A themed HTML string representing the HTML markup.
- */
-
-function theme_markup($element) {
-  return $element['#value'] . $element['#children'];
-}
-
-/**
-* Format a password field.
-*
-* @param $element
-*   An associative array containing the properties of the element.
-*   Properties used:  title, value, description, size, maxlength, required, attributes
-* @return
-*   A themed HTML string representing the form.
-*/
-function theme_password($element) {
-  $size = $element['#size'] ? ' size="'. $element['#size'] .'" ' : '';
-
-  _form_set_class($element, array('form-text'));
-  $output = '<input type="password" maxlength="'. $element['#maxlength'] .'" name="'. $element['#name'] .'" id="'. $element['#id'] .'" '. $size . drupal_attributes($element['#attributes']) .' />';
-
-  return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
-}
-
-/**
- * Format a weight selection menu.
- *
- * @param $element
- *   An associative array containing the properties of the element.
- *   Properties used:  title, delta, description
- * @return
- *   A themed HTML string representing the form.
- */
-function theme_weight($element) {
-  for ($n = (-1 * $element['#delta']); $n <= $element['#delta']; $n++) {
-    $weights[$n] = $n;
-  }
-  $element['#options'] = $weights;
-  $element['#type'] = 'select';
-
-  return form_render($element);
-}
-
-/**
- * Format a file upload field.
- *
- * @param $title
- *   The label for the file upload field.
- * @param $name
- *   The internal name used to refer to the field.
- * @param $size
- *   A measure of the visible size of the field (passed directly to HTML).
- * @param $description
- *   Explanatory text to display after the form item.
- * @param $required
- *   Whether the user must upload a file to the field.
- * @return
- *   A themed HTML string representing the field.
- *
- * For assistance with handling the uploaded file correctly, see the API
- * provided by file.inc.
- */
-function theme_file($element) {
-  _form_set_class($element, array('form-file'));
-  return theme('form_element', $element['#title'], '<input type="file" name="'. $element['#name'] .'"'. ($element['#attributes'] ? ' '. drupal_attributes($element['#attributes']) : '') .' id="'. form_clean_id($element['#id']) .'" size="'. $element['#size'] ."\" />\n", $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
-}
-
-/**
- * Sets a form element's class attribute.
- *
- * Adds 'required' and 'error' classes as needed.
- *
- * @param &$element
- *   The form element
- * @param $name
- *   Array of new class names to be added
- */
-function _form_set_class(&$element, $class = array()) {
-  if ($element['#required']) {
-    $class[] = 'required';
-  }
-  if (form_get_error($element)){
-    $class[] = 'error';
-  }
-  if (isset($element['#attributes']['class'])) {
-    $class[] = $element['#attributes']['class'];
-  }
-  $element['#attributes']['class'] = implode(' ', $class);
-}
-
-/**
- * Remove invalid characters from an HTML ID attribute string.
- *
- * @param $id
- *   The ID to clean
- * @return
- *   The cleaned ID
- */
-function form_clean_id($id = NULL) {
-  $id = str_replace('][', '-', $id);
-  return $id;
-}
-
-/**
- * @} End of "defgroup form".
- */
diff --git a/includes/image.inc b/includes/image.inc
deleted file mode 100644 (file)
index cebb648..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-<?php
-// $Id: image.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * Return a list of available toolkits.
- *
- * @return An array of toolkit name => descriptive title.
- */
-function image_get_available_toolkits() {
-  $toolkits = file_scan_directory('includes', 'image\..*\.inc$');
-
-  $output = array();
-  foreach ($toolkits as $file => $toolkit) {
-    include_once "./$file";
-    $function = str_replace('.', '_', $toolkit->name) .'_info';
-    if (function_exists($function)) {
-      $info = $function();
-      $output[$info['name']] = $info['title'];
-    }
-  }
-  $output['gd'] = t('Built-in GD2 toolkit');
-  return $output;
-}
-
-/**
- * Retrieve the name of the currently used toolkit.
- *
- * @return String containing the name of the toolkit.
- */
-function image_get_toolkit() {
-  static $toolkit;
-  if (!$toolkit) {
-    $toolkit = variable_get('image_toolkit', 'gd');
-   $toolkit_file = './includes/image.'.$toolkit.'.inc';
-    if ($toolkit != 'gd' && file_exists($toolkit_file)) {
-      include_once $toolkit_file;
-    }
-    elseif (!image_gd_check_settings()) {
-      $toolkit = false;
-    }
-  }
-
-  return $toolkit;
-}
-
-/**
- * Invokes the given method using the currently selected toolkit.
- *
- * @param $method A string containing the method to invoke.
- * @param $params An optional array of parameters to pass to the toolkit method.
- *
- * @return Mixed values (typically Boolean for successful operation).
- */
-function image_toolkit_invoke($method, $params = array()) {
-  if ($toolkit = image_get_toolkit()) {
-    $function = 'image_'. $toolkit .'_'. $method;
-    if (function_exists($function)) {
-      return call_user_func_array($function, $params);
-    }
-    else {
-      watchdog('php', t("The selected image handling toolkit '%toolkit' can not correctly process '%function'.", array('%toolkit' => "<em>$toolkit</em>", '%function' => "<em>$function</em>")), WATCHDOG_ERROR);
-      return false;
-    }
-  }
-  else {
-    if ($method == 'settings') {
-      return image_gd_settings();
-    }
-  }
-}
-
-
-/**
- * Get details about an image.
- *
- * @return array containing information about the image
- *      'width': image's width in pixels
- *      'height': image's height in pixels
- *      'extension': commonly used extension for the image
- *      'mime_type': image's MIME type ('image/jpeg', 'image/gif', etc.)
- *      'file_size': image's physical size (in bytes)
- */
-function image_get_info($file) {
-  if (!is_file($file)) {
-    return false;
-  }
-
-  $details = false;
-  $data = @getimagesize($file);
-  $file_size = @filesize($file);
-
-  if (isset($data) && is_array($data)) {
-    $extensions = array('1' => 'gif', '2' => 'jpg', '3' => 'png');
-    $extension = array_key_exists($data[2], $extensions) ?  $extensions[$data[2]] : '';
-    $details = array('width'     => $data[0],
-                     'height'    => $data[1],
-                     'extension' => $extension,
-                     'file_size' => $file_size,
-                     'mime_type' => $data['mime']);
-  }
-
-  return $details;
-}
-
-/**
- * Scales an image to the given width and height while maintaining aspect
- * ratio.
- *
- * @param $source         The filepath of the source image
- * @param $destination    The file path of the destination image
- * @param $width          The target width
- * @param $height         The target height
- *
- * @return True or false, based on success
- */
-function image_scale($source, $destination, $width, $height) {
-  $info = image_get_info($source);
-
-  // don't scale up
-  if ($width > $info['width'] && $height > $info['height']) {
-    return false;
-  }
-
-  $aspect = $info['height'] / $info['width'];
-  if ($aspect < $height / $width) {
-    $width = (int)min($width, $info['width']);
-    $height = (int)round($width * $aspect);
-  }
-  else {
-    $height = (int)min($height, $info['height']);
-    $width = (int)round($height / $aspect);
-  }
-
-  return image_toolkit_invoke('resize', array($source, $destination, $width, $height));
-}
-
-/**
- * Resize an image to the given dimensions (ignoring aspect ratio).
- *
- * @param $source        The filepath of the source image.
- * @param $destination   The file path of the destination image.
- * @param $width         The target width.
- * @param $height        The target height.
- */
-function image_resize($source, $destination, $width, $height) {
-  return image_toolkit_invoke('resize', array($source, $destination, $width, $height));
-}
-
-/**
- * Rotate an image by the given number of degrees.
- *
- * @param $source  The filepath of the source image
- * @param $destination    The file path of the destination image
- * @param $degrees The number of (clockwise) degrees to rotate the image
- */
-function image_rotate($source, $destination, $degrees) {
-  return image_toolkit_invoke('rotate', array($source, $destination, $degrees));
-}
-
-/**
- * Crop an image to the rectangle specified by the given rectangle.
- *
- * @param $source        The filepath of the source image
- * @param $destination   The file path of the destination image
- * @param $x             The top left co-ordinate of the crop area (x axis value)
- * @param $y             The top left co-ordinate of the crop area (y axis value)
- * @param $width         The target width
- * @param $height        The target height
- */
-function image_crop($source, $destination, $x, $y, $width, $height) {
-  return image_toolkit_invoke('crop', array($source, $destination, $x, $y, $width, $height));
-}
-
-/**
- * GD2 toolkit functions
- * With the minimal requirements of PHP 4.3 for Drupal, we use the built-in version of GD.
- */
-
-/**
- * Retrieve settings for the GD2 toolkit (not used).
- */
-function image_gd_settings() {
-  if (image_gd_check_settings()) {
-    return t('The built-in GD2 toolkit is installed and working properly.');
-  }
-  else {
-    form_set_error('image_toolkit', t("The built-in GD image toolkit requires that the GD module for PHP be installed and configured properly. For more information see %url.", array('%url' => '<a href="http://php.net/image">http://php.net/image</a>')));
-    return false;
-  }
-}
-
-/**
- * Verify GD2 settings (that the right version is actually installed).
- *
- * @return boolean
- */
-function image_gd_check_settings() {
-  if ($check = get_extension_funcs('gd')) {
-    if (in_array('imagegd2', $check)) {
-      // GD2 support is available.
-      return true;
-    }
-  }
-  return false;
-}
-
-/**
- * Scale an image to the specified size using GD.
- */
-function image_gd_resize($source, $destination, $width, $height) {
-  if (!file_exists($source)) {
-    return false;
-  }
-
-  $info = image_get_info($source);
-  if (!$info) {
-    return false;
-  }
-
-  $im = image_gd_open($source, $info['extension']);
-  if (!$im) {
-    return false;
-  }
-
-  $res = imageCreateTrueColor($width, $height);
-  imageCopyResampled($res, $im, 0, 0, 0, 0, $width, $height, $info['width'], $info['height']);
-  $result = image_gd_close($res, $destination, $info['extension']);
-
-  imageDestroy($res);
-  imageDestroy($im);
-
-  return $result;
-}
-
-/**
- * Rotate an image the given number of degrees.
- */
-function image_gd_rotate($source, $destination, $degrees, $bg_color = 0) {
-  if (!function_exists('imageRotate')) {
-    return false;
-  }
-
-  $info = image_get_info($source);
-  if (!$info) {
-    return false;
-  }
-
-  $im = image_gd_open($source, $info['extension']);
-  if (!$im) {
-    return false;
-  }
-
-  $res = imageRotate($im, $degrees, $bg_color);
-  $result = image_gd_close($res, $destination, $info['extension']);
-
-  return $result;
-}
-
-/**
- * Crop an image using the GD toolkit.
- */
-function image_gd_crop($source, $destination, $x, $y, $width, $height) {
-  $info = image_get_info($source);
-  if (!$info) {
-    return false;
-  }
-
-  $im = image_gd_open($source, $info['extension']);
-  $res = imageCreateTrueColor($width, $height);
-  imageCopy($res, $im, 0, 0, $x, $y, $width, $height);
-  $result = image_gd_close($res, $destination, $info['extension']);
-
-  imageDestroy($res);
-  imageDestroy($im);
-
-  return $result;
-}
-
-/**
- * GD helper function to create an image resource from a file.
- */
-function image_gd_open($file, $extension) {
-  $extension = str_replace('jpg', 'jpeg', $extension);
-  $open_func = 'imageCreateFrom'. $extension;
-  if (!function_exists($open_func)) {
-    return false;
-  }
-  return $open_func($file);
-}
-
-/**
- * GD helper to write an image resource to a destination file.
- */
-function image_gd_close($res, $destination, $extension) {
-  $extension = str_replace('jpg', 'jpeg', $extension);
-  $close_func = 'image'. $extension;
-  if (!function_exists($close_func)) {
-    return false;
-  }
-  return $close_func($res, $destination);
-}
-
-
diff --git a/includes/install.inc b/includes/install.inc
deleted file mode 100644 (file)
index 7a12c31..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-// $Id: install.inc 144 2007-03-28 07:52:20Z thierry $
-
-define('SCHEMA_UNINSTALLED', -1);
-define('SCHEMA_INSTALLED', 0);
-
-
-// The system module (Drupal core) is currently a special case
-include_once './database/updates.inc';
-
-// Include install files for each module
-foreach (module_list() as $module) {
-  $install_file = './'. drupal_get_path('module', $module) .'/'. $module .'.install';
-  if (is_file($install_file)) {
-    include_once $install_file;
-  }
-}
-
-
-/**
- * Returns an array of available schema versions for a module.
- *
- * @param $module
- *   A module name.
- * @return
- *   If the module has updates, an array of available updates. Otherwise,
- *   FALSE.
- */
-function drupal_get_schema_versions($module) {
-  $functions = get_defined_functions();
-  foreach ($functions['user'] as $function) {
-    if (strpos($function, $module .'_update_') === 0) {
-      $version = substr($function, strlen($module .'_update_'));
-      if (is_numeric($version)) {
-        $updates[] = $version;
-      }
-    }
-  }
-  if (count($updates) == 0) {
-    return FALSE;
-  }
-  return $updates;
-}
-
-/**
- * Returns the currently installed schema version for a module.
- *
- * @param $module
- *   A module name.
- * @return
- *   The currently installed schema version.
- */
-function drupal_get_installed_schema_version($module, $reset = FALSE) {
-  static $versions;
-
-  if ($reset) {
-    unset($versions);
-  }
-
-  if (!$versions) {
-    $versions = array();
-    $result = db_query("SELECT name, schema_version FROM {system} WHERE type = 'module'");
-    while ($row = db_fetch_object($result)) {
-      $versions[$row->name] = $row->schema_version;
-    }
-  }
-
-  return $versions[$module];
-}
-
-/**
- * Update the installed version information for a module.
- *
- * @param $module
- *   A module name.
- * @param $version
- *   The new schema version.
- */
-function drupal_set_installed_schema_version($module, $version) {
-  db_query("UPDATE {system} SET schema_version = %d WHERE name = '%s'", $version, $module);
-}
diff --git a/includes/locale.inc b/includes/locale.inc
deleted file mode 100644 (file)
index 5c6d83e..0000000
+++ /dev/null
@@ -1,1548 +0,0 @@
-<?php
-// $Id: locale.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Admin-related functions for locale.module.
- */
-
-// ---------------------------------------------------------------------------------
-// Language addition functionality (administration only)
-
-/**
- * Helper function to add a language
- */
-function _locale_add_language($code, $name, $onlylanguage = TRUE) {
-  db_query("INSERT INTO {locales_meta} (locale, name) VALUES ('%s','%s')", $code, $name);
-  $result = db_query("SELECT lid FROM {locales_source}");
-  while ($string = db_fetch_object($result)) {
-    db_query("INSERT INTO {locales_target} (lid, locale, translation) VALUES (%d,'%s', '')", $string->lid, $code);
-  }
-
-  // If only the language was added, and not a PO file import triggered
-  // the language addition, we need to inform the user on how to start
-  // a translation
-  if ($onlylanguage) {
-    drupal_set_message(t('The language %locale has been created, and can now be used to import a translation. More information is available in the <a href="%locale-help">help screen</a>.', array('%locale' => theme('placeholder', t($name)), '%locale-help' => url('admin/help/locale'))));
-  }
-  else {
-    drupal_set_message(t('The language %locale has been created.', array('%locale' => theme('placeholder', t($name)))));
-  }
-
-  watchdog('locale', t('The %language language (%locale) has been created.', array('%language' => theme('placeholder', $name), '%locale' => theme('placeholder', $code))));
-}
-
-/**
- * User interface for the language management screen.
- */
-function _locale_admin_manage_screen() {
-  $languages = locale_supported_languages(TRUE, TRUE);
-
-  $options = array();
-  $form['name'] = array('#tree' => TRUE);
-  foreach ($languages['name'] as $key => $lang) {
-    $options[$key] = '';
-    $status = db_fetch_object(db_query("SELECT isdefault, enabled FROM {locales_meta} WHERE locale = '%s'", $key));
-    if ($status->enabled) {
-      $enabled[] = $key;
-    }
-    if ($status->isdefault) {
-      $isdefault = $key;
-    }
-    if ($key == 'en') {
-      $form['name']['en'] = array('#value' => check_plain($lang));
-    }
-    else {
-      $original = db_fetch_object(db_query("SELECT COUNT(*) AS strings FROM {locales_source}"));
-      $translation = db_fetch_object(db_query("SELECT COUNT(*) AS translation FROM {locales_target} WHERE locale = '%s' AND translation != ''", $key));
-
-      $ratio = ($original->strings > 0 && $translation->translation > 0) ? round(($translation->translation/$original->strings)*100., 2) : 0;
-
-      $form['name'][$key] = array('#type' => 'textfield',
-        '#default_value' => $lang,
-        '#size' => 15,
-        '#maxlength' => 64,
-      );
-      $form['translation'][$key] = array('#value' => "$translation->translation/$original->strings ($ratio%)");
-    }
-  }
-  $form['enabled'] = array('#type' => 'checkboxes',
-    '#options' => $options,
-    '#default_value' => $enabled,
-  );
-  $form['site_default'] = array('#type' => 'radios',
-    '#options' => $options,
-    '#default_value' => $isdefault,
-  );
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
-
-  return drupal_get_form('_locale_admin_manage_screen', $form, 'locale_admin_manage_screen');
-}
-
-/**
- * Theme the locale admin manager form.
- */
-function theme_locale_admin_manage_screen($form) {
-  foreach ($form['name'] as $key => $element) {
-    // Do not take form control structures.
-    if (is_array($element) && element_child($key)) {
-      $rows[] = array(check_plain($key), form_render($form['name'][$key]), form_render($form['enabled'][$key]), form_render($form['site_default'][$key]), ($key != 'en' ? form_render($form['translation'][$key]) : message_na()), ($key != 'en' ? l(t('delete'), 'admin/locale/language/delete/'. $key) : ''));
-    }
-  }
-  $header = array(array('data' => t('Code')), array('data' => t('English name')), array('data' => t('Enabled')), array('data' => t('Default')), array('data' => t('Translated')), array('data' => t('Operations')));
-  $output = theme('table', $header, $rows);
-  $output .= form_render($form);
-
-  return $output;
-}
-
-/**
- * Process locale admin manager form submissions.
- */
-function _locale_admin_manage_screen_submit($form_id, $form_values) {
-  // Save changes to existing languages.
-  $languages = locale_supported_languages(FALSE, TRUE);
-  foreach($languages['name'] as $key => $value) {
-    if ($form_values['site_default'] == $key) {
-      $form_values['enabled'][$key] = 1; // autoenable the default language
-    }
-    $enabled = $form_values['enabled'][$key] ? 1 : 0;
-    if ($key == 'en') {
-      // Disallow name change for English locale.
-      db_query("UPDATE {locales_meta} SET isdefault = %d, enabled = %d WHERE locale = 'en'", ($form_values['site_default'] == $key), $enabled);
-    }
-    else {
-      db_query("UPDATE {locales_meta} SET name = '%s', isdefault = %d, enabled = %d WHERE locale = '%s'", $form_values['name'][$key], ($form_values['site_default'] == $key), $enabled, $key);
-    }
-  }
-  drupal_set_message(t('Configuration saved.'));
-
-  // Changing the locale settings impacts the interface:
-  cache_clear_all();
-
-  return 'admin/locale/language/overview';
-}
-
-/**
- * User interface for the language addition screen.
- */
-function _locale_admin_manage_add_screen() {
-  $isocodes = _locale_prepare_iso_list();
-
-  $form = array();
-  $form['language list'] = array('#type' => 'fieldset',
-    '#title' => t('Language list'),
-    '#collapsible' => TRUE,
-  );
-  $form['language list']['langcode'] = array('#type' => 'select',
-    '#title' => t('Language name'),
-    '#default_value' => key($isocodes),
-    '#options' => $isocodes,
-    '#description' => t('Select your language here, or add it below, if you are unable to find it.'),
-  );
-  $form['language list']['submit'] = array('#type' => 'submit', '#value' => t('Add language'));
-
-  $output = drupal_get_form('locale_add_language_form', $form);
-
-  $form = array();
-  $form['custom language'] = array('#type' => 'fieldset',
-    '#title' => t('Custom language'),
-    '#collapsible' => TRUE,
-  );
-  $form['custom language']['langcode'] = array('#type' => 'textfield',
-    '#title' => t('Language code'),
-    '#size' => 12,
-    '#maxlength' => 60,
-    '#required' => TRUE,
-    '#description' => t("Commonly this is an <a href=\"%iso-codes\">ISO 639 language code</a> with an optional country code for regional variants. Examples include 'en', 'en-US' and 'zh-cn'.", array('%iso-codes' => 'http://www.w3.org/WAI/ER/IG/ert/iso639.htm')),
-  );
-  $form['custom language']['langname'] = array('#type' => 'textfield',
-    '#title' => t('Language name in English'),
-    '#maxlength' => 64,
-    '#required' => TRUE,
-    '#description' => t('Name of the language. Will be available for translation in all languages.'),
-  );
-  $form['custom language']['submit'] = array('#type' => 'submit', '#value' => t('Add custom language'));
-
-  // Use the validation and submit functions of the add language form.
-  $output .= drupal_get_form('locale_custom_language_form', $form, 'locale_add_language_form');
-
-  return $output;
-}
-
-/**
- * Validate the language addition form.
- */
-function locale_add_language_form_validate($form_id, $form_values) {
-  if ($duplicate = db_num_rows(db_query("SELECT locale FROM {locales_meta} WHERE locale = '%s'", $form_values['langcode'])) != 0) {
-    form_set_error(t('The language %language (%code) already exists.', array('%language' => theme('placeholder', check_plain($form_values['langname'])), '%code' => theme('placeholder', $form_values['langcode']))));
-  }
-
-  if (!isset($form_values['langname'])) {
-    $isocodes = _locale_get_iso639_list();
-    if (!isset($isocodes[$form_values['langcode']])) {
-      form_set_error('langcode', t('Invalid language code.'));
-    }
-  }
-}
-
-/**
- * Process the language addition form submission.
- */
-function locale_add_language_form_submit($form_id, $form_values) {
-  if (isset($form_values['langname'])) {
-    // Custom language form.
-    _locale_add_language($form_values['langcode'], $form_values['langname']);
-  }
-  else {
-    $isocodes = _locale_get_iso639_list();
-    _locale_add_language($form_values['langcode'], $isocodes[$form_values['langcode']][0]);
-  }
-
-  return 'admin/locale';
-}
-
-/**
- * User interface for the translation import screen.
- */
-function _locale_admin_import_screen() {
-  $languages = locale_supported_languages(FALSE, TRUE);
-  $languages = array_map('t', $languages['name']);
-  unset($languages['en']);
-
-  if (!count($languages)) {
-    $languages = _locale_prepare_iso_list();
-  }
-  else {
-    $languages = array(
-      t('Already added languages') => $languages,
-      t('Languages not yet added') => _locale_prepare_iso_list()
-    );
-  }
-
-  $form = array();
-  $form['import'] = array('#type' => 'fieldset',
-    '#title' => t('Import translation'),
-  );
-  $form['import']['file'] = array('#type' => 'file',
-    '#title' => t('Language file'),
-    '#size' => 50,
-    '#description' => t('A gettext Portable Object (.po) file.'),
-  );
-  $form['import']['langcode'] = array('#type' => 'select',
-    '#title' => t('Import into'),
-    '#options' => $languages,
-    '#description' => t('Choose the language you want to add strings into. If you choose a language which is not yet set up, then it will be added.'),
-  );
-  $form['import']['mode'] = array('#type' => 'radios',
-    '#title' => t('Mode'),
-    '#default_value' => 'overwrite',
-    '#options' => array('overwrite' => t('Strings in the uploaded file replace existing ones, new ones are added'), 'keep' => t('Existing strings are kept, only new strings are added')),
-  );
-  $form['import']['submit'] = array('#type' => 'submit', '#value' => t('Import'));
-  $form['#attributes']['enctype'] = 'multipart/form-data';
-
-  return drupal_get_form('_locale_admin_import', $form);
-}
-
-/**
- * Process the locale import form submission.
- */
-function _locale_admin_import_submit($form_id, $form_values) {
-  // Add language, if not yet supported
-  $languages = locale_supported_languages(TRUE, TRUE);
-  if (!isset($languages['name'][$form_values['langcode']])) {
-    $isocodes = _locale_get_iso639_list();
-    _locale_add_language($form_values['langcode'], $isocodes[$form_values['langcode']][0], FALSE);
-  }
-
-  // Now import strings into the language
-  $file = file_check_upload('file');
-  if ($ret = _locale_import_po($file, $form_values['langcode'], $form_values['mode']) == FALSE) {
-    $message = t('The translation import of %filename failed.', array('%filename' => theme('placeholder', $file->filename)));
-    drupal_set_message($message, 'error');
-    watchdog('locale', $message, WATCHDOG_ERROR);
-  }
-
-  return 'admin/locale';
-}
-
-/**
- * User interface for the translation export screen
- */
-function _locale_admin_export_screen() {
-  $languages = locale_supported_languages(FALSE, TRUE);
-  $languages = array_map('t', $languages['name']);
-  unset($languages['en']);
-
-  // Offer language specific export if any language is set up
-  if (count($languages)) {
-    $form = array();
-    $form['export'] = array('#type' => 'fieldset',
-      '#title' => t('Export translation'),
-      '#collapsible' => TRUE,
-    );
-    $form['export']['langcode'] = array('#type' => 'select',
-      '#title' => t('Language name'),
-      '#options' => $languages,
-      '#description' => t('Select the language you would like to export in gettext Portable Object (.po) format.'),
-    );
-    $form['export']['submit'] = array('#type' => 'submit', '#value' => t('Export'));
-    $output = drupal_get_form('_locale_export_po', $form);
-  }
-
-  // Complete template export of the strings
-  $form = array();
-  $form['export'] = array('#type' => 'fieldset',
-    '#title' => t('Export template'),
-    '#collapsible' => TRUE,
-    '#description' => t('Generate a gettext Portable Object Template (.pot) file with all the interface strings from the Drupal locale database.'),
-  );
-  $form['export']['submit'] = array('#type' => 'submit', '#value' => t('Export'));
-  $output .= drupal_get_form('_locale_export_pot', $form, '_locale_export_po');
-
-  return $output;
-}
-
-/**
- * Process a locale export form submissions.
- */
-function _locale_export_po_submit($form_id, $form_values) {
-  _locale_export_po($form_values['langcode']);
-}
-
-/**
- * User interface for the string search screen
- */
-function _locale_string_seek_form() {
-  // Get *all* languages set up
-  $languages = locale_supported_languages(FALSE, TRUE);
-  asort($languages['name']); unset($languages['name']['en']);
-  $languages['name'] = array_map('check_plain', $languages['name']);
-
-  // Present edit form preserving previous user settings
-  $query = _locale_string_seek_query();
-  $form = array();
-  $form['search'] = array('#type' => 'fieldset',
-    '#title' => t('Search'),
-  );
-  $form['search']['string'] = array('#type' => 'textfield',
-    '#title' => t('Strings to search for'),
-    '#default_value' => $query->string,
-    '#size' => 30,
-    '#maxlength' => 30,
-    '#description' => t('Leave blank to show all strings. The search is case sensitive.'),
-  );
-  $form['search']['language'] = array('#type' => 'radios',
-    '#title' => t('Language'),
-    '#default_value' => ($query->language ? $query->language : 'all'),
-    '#options' => array_merge(array('all' => t('All languages'), 'en' => t('English (provided by Drupal)')), $languages['name']),
-  );
-  $form['search']['searchin'] = array('#type' => 'radios',
-    '#title' => t('Search in'),
-    '#default_value' => ($query->searchin ? $query->searchin : 'all'),
-    '#options' => array('all' => t('All strings in that language'), 'translated' => t('Only translated strings'), 'untranslated' => t('Only untranslated strings')),
-  );
-  $form['search']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
-  $form['#redirect'] = FALSE;
-
-  return drupal_get_form('_locale_string_seek', $form);
-}
-
-/**
- * User interface for string editing.
- */
-function _locale_string_edit($lid) {
-  $languages = locale_supported_languages(FALSE, TRUE);
-  unset($languages['name']['en']);
-
-  $result = db_query('SELECT DISTINCT s.source, t.translation, t.locale FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid WHERE s.lid = %d', $lid);
-  $form = array();
-  $form['translations'] = array('#tree' => TRUE);
-  while ($translation = db_fetch_object($result)) {
-    $orig = $translation->source;
-
-    // Approximate the number of rows in a textfield with a maximum of 10.
-    $rows = min(ceil(str_word_count($orig) / 12), 10);
-
-    $form['translations'][$translation->locale] = array(
-      '#type' => 'textarea',
-      '#title' => $languages['name'][$translation->locale],
-      '#default_value' => $translation->translation,
-      '#rows' => $rows,
-    );
-    unset($languages['name'][$translation->locale]);
-  }
-
-  // Handle erroneous lid.
-  if (!isset($orig)){
-    drupal_set_message(t('String not found.'));
-    drupal_goto('admin/locale/string/search');
-  }
-
-  // Add original text. Assign negative weight so that it floats to the top.
-  $form['item'] = array('#type' => 'item',
-    '#title' => t('Original text'),
-    '#value' => check_plain(wordwrap($orig, 0)),
-    '#weight' => -1,
-  );
-
-  foreach ($languages['name'] as $key => $lang) {
-    $form['translations'][$key] = array(
-      '#type' => 'textarea',
-      '#title' => $lang,
-      '#rows' => $rows,
-    );
-  }
-
-  $form['lid'] = array('#type' => 'value', '#value' => $lid);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save translations'));
-
-  return drupal_get_form('_locale_string_edit', $form);
-}
-
-/**
- * Process string editing form submissions.
- * Saves all translations of one string submitted from a form.
- */
-function _locale_string_edit_submit($form_id, $form_values) {
-  $lid = $form_values['lid'];
-  foreach ($form_values['translations'] as $key => $value) {
-    $value = filter_xss_admin($value);
-    $trans = db_fetch_object(db_query("SELECT translation FROM {locales_target} WHERE lid = %d AND locale = '%s'", $lid, $key));
-    if (isset($trans->translation)) {
-      db_query("UPDATE {locales_target} SET translation = '%s' WHERE lid = %d AND locale = '%s'", $value, $lid, $key);
-    }
-    else {
-      db_query("INSERT INTO {locales_target} (lid, translation, locale) VALUES (%d, '%s', '%s')", $lid, $value, $key);
-    }
-  }
-  drupal_set_message(t('The string has been saved.'));
-
-  // Refresh the locale cache.
-  locale_refresh_cache();
-  // Rebuild the menu, strings may have changed.
-  menu_rebuild();
-
-  return 'admin/locale/string/search';
-}
-
-/**
- * Delete a language string.
- */
-function _locale_string_delete($lid) {
-  db_query('DELETE FROM {locales_source} WHERE lid = %d', $lid);
-  db_query('DELETE FROM {locales_target} WHERE lid = %d', $lid);
-  locale_refresh_cache();
-  drupal_set_message(t('The string has been removed.'));
-
-  drupal_goto('admin/locale/string/search');
-}
-
-/**
- * Parses Gettext Portable Object file information and inserts into database
- *
- * @param $file Object contains properties of local file to be imported
- * @param $lang Language code
- * @param $mode should existing translations be replaced?
- */
-function _locale_import_po($file, $lang, $mode) {
-  // If not in 'safe mode', increase the maximum execution time:
-  if (!ini_get('safe_mode')) {
-    set_time_limit(240);
-  }
-
-  // Check if we have the language already in the database
-  if (!db_fetch_object(db_query("SELECT locale FROM {locales_meta} WHERE locale = '%s'", $lang))) {
-    drupal_set_message(t('The language selected for import is not supported.'), 'error');
-    return FALSE;
-  }
-
-  // Get strings from file (returns on failure after a partial import, or on success)
-  $status = _locale_import_read_po($file, $mode, $lang);
-  if ($status === FALSE) {
-    // error messages are set in _locale_import_read_po
-    return FALSE;
-  }
-
-  // Get status information on import process
-  list($headerdone, $additions, $updates) = _locale_import_one_string('report', $mode);
-
-  if (!$headerdone) {
-    drupal_set_message(t('The translation file %filename appears to have a missing or malformed header.', array('%filename' => theme('placeholder', $file->filename))), 'error');
-  }
-
-  // rebuild locale cache
-  cache_clear_all("locale:$lang");
-
-  // rebuild the menu, strings may have changed
-  menu_rebuild();
-
-  drupal_set_message(t('The translation was successfully imported. There are %number newly created translated strings and %update strings were updated.', array('%number' => $additions, '%update' => $updates)));
-  watchdog('locale', t('Imported %file into %locale: %number new strings added and %update updated.', array('%file' => theme('placeholder', $file->filename), '%locale' => theme('placeholder', $lang), '%number' => $additions, '%update' => $updates)));
-  return TRUE;
-}
-
-/**
- * Parses Gettext Portable Object file into an array
- *
- * @param $file Object with properties of local file to parse
- * @author Jacobo Tarrio
- */
-function _locale_import_read_po($file, $mode, $lang) {
-
-  $message = theme('placeholder', $file->filename);
-  $fd = fopen($file->filepath, "rb"); // File will get closed by PHP on return
-  if (!$fd) {
-    drupal_set_message(t('The translation import failed, because the file %filename could not be read.', array('%filename' => $message)), 'error');
-    return FALSE;
-  }
-
-  $context = "COMMENT"; // Parser context: COMMENT, MSGID, MSGID_PLURAL, MSGSTR and MSGSTR_ARR
-  $current = array();   // Current entry being read
-  $plural = 0;          // Current plural form
-  $lineno = 0;          // Current line
-
-  while (!feof($fd)) {
-    $line = fgets($fd, 10*1024); // A line should not be this long
-    $lineno++;
-    $line = trim(strtr($line, array("\\\n" => "")));
-
-    if (!strncmp("#", $line, 1)) { // A comment
-      if ($context == "COMMENT") { // Already in comment context: add
-        $current["#"][] = substr($line, 1);
-      }
-      elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
-        _locale_import_one_string($current, $mode, $lang);
-        $current = array();
-        $current["#"][] = substr($line, 1);
-        $context = "COMMENT";
-      }
-      else { // Parse error
-        drupal_set_message(t('The translation file %filename contains an error: "msgstr" was expected but not found on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-    }
-    elseif (!strncmp("msgid_plural", $line, 12)) {
-      if ($context != "MSGID") { // Must be plural form for current entry
-        drupal_set_message(t('The translation file %filename contains an error: "msgid_plural" was expected but not found on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-      $line = trim(substr($line, 12));
-      $quoted = _locale_import_parse_quoted($line);
-      if ($quoted === false) {
-        drupal_set_message(t('The translation file %filename contains a syntax error on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-      $current["msgid"] = $current["msgid"] ."\0". $quoted;
-      $context = "MSGID_PLURAL";
-    }
-    elseif (!strncmp("msgid", $line, 5)) {
-      if ($context == "MSGSTR") {   // End current entry, start a new one
-        _locale_import_one_string($current, $mode, $lang);
-        $current = array();
-      }
-      elseif ($context == "MSGID") { // Already in this context? Parse error
-        drupal_set_message(t('The translation file %filename contains an error: "msgid" is unexpected on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-      $line = trim(substr($line, 5));
-      $quoted = _locale_import_parse_quoted($line);
-      if ($quoted === false) {
-        drupal_set_message(t('The translation file %filename contains a syntax error on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-      $current["msgid"] = $quoted;
-      $context = "MSGID";
-    }
-    elseif (!strncmp("msgstr[", $line, 7)) {
-      if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[]
-        drupal_set_message(t('The translation file %filename contains an error: "msgstr[]" is unexpected on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-      if (strpos($line, "]") === false) {
-        drupal_set_message(t('The translation file %filename contains a syntax error on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-      $frombracket = strstr($line, "[");
-      $plural = substr($frombracket, 1, strpos($frombracket, "]") - 1);
-      $line = trim(strstr($line, " "));
-      $quoted = _locale_import_parse_quoted($line);
-      if ($quoted === false) {
-        drupal_set_message(t('The translation file %filename contains a syntax error on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-      $current["msgstr"][$plural] = $quoted;
-      $context = "MSGSTR_ARR";
-    }
-    elseif (!strncmp("msgstr", $line, 6)) {
-      if ($context != "MSGID") {   // Should come just after a msgid block
-        drupal_set_message(t('The translation file %filename contains an error: "msgstr" is unexpected on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-      $line = trim(substr($line, 6));
-      $quoted = _locale_import_parse_quoted($line);
-      if ($quoted === false) {
-        drupal_set_message(t('The translation file %filename contains a syntax error on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-      $current["msgstr"] = $quoted;
-      $context = "MSGSTR";
-    }
-    elseif ($line != "") {
-      $quoted = _locale_import_parse_quoted($line);
-      if ($quoted === false) {
-        drupal_set_message(t('The translation file %filename contains a syntax error on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-      if (($context == "MSGID") || ($context == "MSGID_PLURAL")) {
-        $current["msgid"] .= $quoted;
-      }
-      elseif ($context == "MSGSTR") {
-        $current["msgstr"] .= $quoted;
-      }
-      elseif ($context == "MSGSTR_ARR") {
-        $current["msgstr"][$plural] .= $quoted;
-      }
-      else {
-        drupal_set_message(t('The translation file %filename contains an error: there is an unexpected string on line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-        return FALSE;
-      }
-    }
-  }
-
-  // End of PO file, flush last entry
-  if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) {
-    _locale_import_one_string($current, $mode, $lang);
-  }
-  elseif ($context != "COMMENT") {
-    drupal_set_message(t('The translation file %filename ended unexpectedly at line %line.', array('%filename' => $message, '%line' => $lineno)), 'error');
-    return FALSE;
-  }
-
-}
-
-/**
- * Imports a string into the database
- *
- * @param $value Information about the string
- * @author Jacobo Tarrio
- */
-function _locale_import_one_string($value, $mode, $lang = NULL) {
-  static $additions = 0;
-  static $updates = 0;
-  static $headerdone = FALSE;
-
-  // Report the changes made (called at end of import)
-  if ($value == 'report') {
-    return array($headerdone, $additions, $updates);
-  }
-  // Current string is the header information
-  elseif ($value['msgid'] == '') {
-    $hdr = _locale_import_parse_header($value['msgstr']);
-
-    // Get the plural formula
-    if ($hdr["Plural-Forms"] && $p = _locale_import_parse_plural_forms($hdr["Plural-Forms"], $file->filename)) {
-      list($nplurals, $plural) = $p;
-      db_query("UPDATE {locales_meta} SET plurals = %d, formula = '%s' WHERE locale = '%s'", $nplurals, $plural, $lang);
-    }
-    else {
-      db_query("UPDATE {locales_meta} SET plurals = %d, formula = '%s' WHERE locale = '%s'", 0, '', $lang);
-    }
-    $headerdone = TRUE;
-  }
-  // Some real string to import
-  else {
-    $comments = filter_xss_admin(_locale_import_shorten_comments($value['#']));
-
-    // Handle a translation for some plural string
-    if (strpos($value['msgid'], "\0")) {
-      $english = explode("\0", $value['msgid'], 2);
-      $entries = array_keys($value['msgstr']);
-      for ($i = 3; $i <= count($entries); $i++) {
-        $english[] = $english[1];
-      }
-      $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries);
-      $english = array_map('_locale_import_append_plural', $english, $entries);
-      foreach ($translation as $key => $trans) {
-        if ($key == 0) {
-          $plid = 0;
-        }
-        $loc = db_fetch_object(db_query("SELECT lid FROM {locales_source} WHERE source = '%s'", $english[$key]));
-        if ($loc->lid) { // a string exists
-          $lid = $loc->lid;
-          // update location field
-          db_query("UPDATE {locales_source} SET location = '%s' WHERE lid = %d", $comments, $lid);
-          $trans2 = db_fetch_object(db_query("SELECT lid, translation, plid, plural FROM {locales_target} WHERE lid = %d AND locale = '%s'", $lid, $lang));
-          if (!$trans2->lid) { // no translation in current language
-            db_query("INSERT INTO {locales_target} (lid, locale, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $lang, filter_xss_admin($trans), $plid, $key);
-            $additions++;
-          } // translation exists
-          else if ($mode == 'overwrite' || $trans2->translation == '') {
-            db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE locale = '%s' AND lid = %d", filter_xss_admin($trans), $plid, $key, $lang, $lid);
-            if ($trans2->translation == '') {
-              $additions++;
-            }
-            else {
-              $updates++;
-            }
-          }
-        }
-        else { // no string
-          db_query("INSERT INTO {locales_source} (location, source) VALUES ('%s', '%s')", $comments, filter_xss_admin($english[$key]));
-          $loc = db_fetch_object(db_query("SELECT lid FROM {locales_source} WHERE source = '%s'", $english[$key]));
-          $lid = $loc->lid;
-          db_query("INSERT INTO {locales_target} (lid, locale, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $lang, filter_xss_admin($trans), $plid, $key);
-          if ($trans != '') {
-            $additions++;
-          }
-        }
-        $plid = $lid;
-      }
-    }
-
-    // A simple translation
-    else {
-      $english = $value['msgid'];
-      $translation = $value['msgstr'];
-      $loc = db_fetch_object(db_query("SELECT lid FROM {locales_source} WHERE source = '%s'", $english));
-      if ($loc->lid) { // a string exists
-        $lid = $loc->lid;
-        // update location field
-        db_query("UPDATE {locales_source} SET location = '%s' WHERE source = '%s'", $comments, $english);
-        $trans = db_fetch_object(db_query("SELECT lid, translation FROM {locales_target} WHERE lid = %d AND locale = '%s'", $lid, $lang));
-        if (!$trans->lid) { // no translation in current language
-          db_query("INSERT INTO {locales_target} (lid, locale, translation) VALUES (%d, '%s', '%s')", $lid, $lang, filter_xss_admin($translation));
-          $additions++;
-        } // translation exists
-        else if ($mode == 'overwrite') { //overwrite in any case
-          db_query("UPDATE {locales_target} SET translation = '%s' WHERE locale = '%s' AND lid = %d", filter_xss_admin($translation), $lang, $lid);
-          if ($trans->translation == '') {
-            $additions++;
-          }
-          else {
-            $updates++;
-          }
-        } // overwrite if empty string
-        else if ($trans->translation == '') {
-          db_query("UPDATE {locales_target} SET translation = '%s' WHERE locale = '%s' AND lid = %d", $translation, $lang, $lid);
-          $additions++;
-        }
-      }
-      else { // no string
-        db_query("INSERT INTO {locales_source} (location, source) VALUES ('%s', '%s')", $comments, $english);
-        $loc = db_fetch_object(db_query("SELECT lid FROM {locales_source} WHERE source = '%s'", $english));
-        $lid = $loc->lid;
-        db_query("INSERT INTO {locales_target} (lid, locale, translation) VALUES (%d, '%s', '%s')", $lid, $lang, filter_xss_admin($translation));
-        if ($translation != '') {
-          $additions++;
-        }
-      }
-    }
-  }
-}
-
-/**
- * Parses a Gettext Portable Object file header
- *
- * @param $header A string containing the complete header
- * @return An associative array of key-value pairs
- * @author Jacobo Tarrio
- */
-function _locale_import_parse_header($header) {
-  $hdr = array();
-
-  $lines = explode("\n", $header);
-  foreach ($lines as $line) {
-    $line = trim($line);
-    if ($line) {
-      list($tag, $contents) = explode(":", $line, 2);
-      $hdr[trim($tag)] = trim($contents);
-    }
-  }
-
-  return $hdr;
-}
-
-/**
- * Parses a Plural-Forms entry from a Gettext Portable Object file header
- *
- * @param $pluralforms A string containing the Plural-Forms entry
- * @param $filename A string containing the filename
- * @return An array containing the number of plurals and a
- *         formula in PHP for computing the plural form
- * @author Jacobo Tarrio
- */
-function _locale_import_parse_plural_forms($pluralforms, $filename) {
-  // First, delete all whitespace
-  $pluralforms = strtr($pluralforms, array(" " => "", "\t" => ""));
-
-  // Select the parts that define nplurals and plural
-  $nplurals = strstr($pluralforms, "nplurals=");
-  if (strpos($nplurals, ";")) {
-    $nplurals = substr($nplurals, 9, strpos($nplurals, ";") - 9);
-  }
-  else {
-    return FALSE;
-  }
-  $plural = strstr($pluralforms, "plural=");
-  if (strpos($plural, ";")) {
-    $plural = substr($plural, 7, strpos($plural, ";") - 7);
-  }
-  else {
-    return FALSE;
-  }
-
-  // Get PHP version of the plural formula
-  $plural = _locale_import_parse_arithmetic($plural);
-
-  if ($plural !== FALSE) {
-    return array($nplurals, $plural);
-  }
-  else {
-    drupal_set_message(t('The translation file %filename contains an error: the plural formula could not be parsed.', array('%filename' => theme('placeholder', $filename))), 'error');
-    return FALSE;
-  }
-}
-
-/**
- * Parses and sanitizes an arithmetic formula into a PHP expression
- *
- * While parsing, we ensure, that the operators have the right
- * precedence and associativity.
- *
- * @param $string A string containing the arithmetic formula
- * @return The PHP version of the formula
- * @author Jacobo Tarrio
- */
-function _locale_import_parse_arithmetic($string) {
-  // Operator precedence table
-  $prec = array("(" => -1, ")" => -1, "?" => 1, ":" => 1, "||" => 3, "&&" => 4, "==" => 5, "!=" => 5, "<" => 6, ">" => 6, "<=" => 6, ">=" => 6, "+" => 7, "-" => 7, "*" => 8, "/" => 8, "%" => 8);
-  // Right associativity
-  $rasc = array("?" => 1, ":" => 1);
-
-  $tokens = _locale_import_tokenize_formula($string);
-
-  // Parse by converting into infix notation then back into postfix
-  $opstk = array();
-  $elstk = array();
-
-  foreach ($tokens as $token) {
-    $ctok = $token;
-
-    // Numbers and the $n variable are simply pushed into $elarr
-    if (is_numeric($token)) {
-      $elstk[] = $ctok;
-    }
-    elseif ($ctok == "n") {
-      $elstk[] = '$n';
-    }
-    elseif ($ctok == "(") {
-      $opstk[] = $ctok;
-    }
-    elseif ($ctok == ")") {
-      $topop = array_pop($opstk);
-      while (($topop != NULL) && ($topop != "(")) {
-        $elstk[] = $topop;
-        $topop = array_pop($opstk);
-      }
-    }
-    elseif ($prec[$ctok]) {
-      // If it's an operator, then pop from $oparr into $elarr until the
-      // precedence in $oparr is less than current, then push into $oparr
-      $topop = array_pop($opstk);
-      while (($topop != NULL) && ($prec[$topop] >= $prec[$ctok]) && !(($prec[$topop] == $prec[$ctok]) && $rasc[$topop] && $rasc[$ctok])) {
-        $elstk[] = $topop;
-        $topop = array_pop($opstk);
-      }
-      if ($topop) {
-        $opstk[] = $topop;   // Return element to top
-      }
-      $opstk[] = $ctok;      // Parentheses are not needed
-    }
-    else {
-      return false;
-    }
-  }
-
-  // Flush operator stack
-  $topop = array_pop($opstk);
-  while ($topop != NULL) {
-    $elstk[] = $topop;
-    $topop = array_pop($opstk);
-  }
-
-  // Now extract formula from stack
-  $prevsize = count($elstk) + 1;
-  while (count($elstk) < $prevsize) {
-    $prevsize = count($elstk);
-    for ($i = 2; $i < count($elstk); $i++) {
-      $op = $elstk[$i];
-      if ($prec[$op]) {
-        $f = "";
-        if ($op == ":") {
-          $f = $elstk[$i - 2] ."):". $elstk[$i - 1] .")";
-        }
-        elseif ($op == "?") {
-          $f = "(". $elstk[$i - 2] ."?(". $elstk[$i - 1];
-        }
-        else {
-          $f = "(". $elstk[$i - 2] . $op . $elstk[$i - 1] .")";
-        }
-        array_splice($elstk, $i - 2, 3, $f);
-        break;
-      }
-    }
-  }
-
-  // If only one element is left, the number of operators is appropriate
-  if (count($elstk) == 1) {
-    return $elstk[0];
-  }
-  else {
-    return FALSE;
-  }
-}
-
-/**
- * Backward compatible implementation of token_get_all() for formula parsing
- *
- * @param $string A string containing the arithmetic formula
- * @return The PHP version of the formula
- * @author Gerhard Killesreiter
- */
-function _locale_import_tokenize_formula($formula) {
-  $formula = str_replace(" ", "", $formula);
-  $tokens = array();
-  for ($i = 0; $i < strlen($formula); $i++) {
-    if (is_numeric($formula[$i])) {
-      $num = $formula[$i];
-      $j = $i + 1;
-      while($j < strlen($formula) && is_numeric($formula[$j])) {
-        $num .= $formula[$j];
-        $j++;
-      }
-      $i = $j - 1;
-      $tokens[] = $num;
-    }
-    elseif ($pos = strpos(" =<>!&|", $formula[$i])) { // We won't have a space
-      $next = $formula[$i + 1];
-      switch ($pos) {
-        case 1:
-        case 2:
-        case 3:
-        case 4:
-          if ($next == '=') {
-            $tokens[] = $formula[$i] .'=';
-            $i++;
-          }
-          else {
-            $tokens[] = $formula[$i];
-          }
-          break;
-        case 5:
-          if ($next == '&') {
-            $tokens[] = '&&';
-            $i++;
-          }
-          else {
-            $tokens[] = $formula[$i];
-          }
-          break;
-        case 6:
-          if ($next == '|') {
-            $tokens[] = '||';
-            $i++;
-          }
-          else {
-            $tokens[] = $formula[$i];
-          }
-          break;
-      }
-    }
-    else {
-      $tokens[] = $formula[$i];
-    }
-  }
-  return $tokens;
-}
-
-/**
- * Modify a string to contain proper count indices
- *
- * This is a callback function used via array_map()
- *
- * @param $entry An array element
- * @param $key Index of the array element
- */
-function _locale_import_append_plural($entry, $key) {
-  // No modifications for 0, 1
-  if ($key == 0 || $key == 1) {
-    return $entry;
-  }
-
-  // First remove any possibly false indices, then add new ones
-  $entry = preg_replace('/(%count)\[[0-9]\]/', '\\1', $entry);
-  return preg_replace('/(%count)/', "\\1[$key]", $entry);
-}
-
-/**
- * Generate a short, one string version of the passed comment array
- *
- * @param $comment An array of strings containing a comment
- * @return Short one string version of the comment
- */
-function _locale_import_shorten_comments($comment) {
-  $comm = '';
-  while (count($comment)) {
-    $test = $comm . substr(array_shift($comment), 1) .', ';
-    if (strlen($comm) < 130) {
-      $comm = $test;
-    }
-    else {
-      break;
-    }
-  }
-  return substr($comm, 0, -2);
-}
-
-/**
- * Parses a string in quotes
- *
- * @param $string A string specified with enclosing quotes
- * @return The string parsed from inside the quotes
- */
-function _locale_import_parse_quoted($string) {
-  if (substr($string, 0, 1) != substr($string, -1, 1)) {
-    return FALSE;   // Start and end quotes must be the same
-  }
-  $quote = substr($string, 0, 1);
-  $string = substr($string, 1, -1);
-  if ($quote == '"') {        // Double quotes: strip slashes
-    return stripcslashes($string);
-  }
-  elseif ($quote == "'") {  // Simple quote: return as-is
-    return $string;
-  }
-  else {
-    return FALSE;             // Unrecognized quote
-  }
-}
-
-/**
- * Exports a Portable Object (Template) file for a language
- *
- * @param $language Selects a language to generate the output for
- */
-function _locale_export_po($language) {
-  global $user;
-
-  // Get language specific strings, or all strings
-  if ($language) {
-    $meta = db_fetch_object(db_query("SELECT * FROM {locales_meta} WHERE locale = '%s'", $language));
-    $result = db_query("SELECT s.lid, s.source, s.location, t.translation, t.plid, t.plural FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid WHERE t.locale = '%s' ORDER BY t.plid, t.plural", $language);
-  }
-  else {
-    $result = db_query("SELECT s.lid, s.source, s.location, t.plid, t.plural FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid ORDER BY t.plid, t.plural");
-  }
-
-  // Build array out of the database results
-  $parent = array();
-  while ($child = db_fetch_object($result)) {
-    if ($child->source != '') {
-      $parent[$child->lid]['comment'] = $child->location;
-      $parent[$child->lid]['msgid'] = $child->source;
-      if ($child->plid) {
-        $parent[$child->lid][$child->plid]['plural'] = $child->lid;
-        $parent[$child->lid][$child->plid]['translation'] = $child->translation;
-        $parent[$child->lid][$child->plid]['msgid'] = $child->source;
-      }
-      else {
-        $parent[$child->lid]['translation'] = $child->translation;
-      }
-    }
-  }
-
-  // Generating Portable Object file for a language
-  if ($language) {
-    $filename = $language .'.po';
-    $header .= "# $meta->name translation of ". variable_get('site_name', 'Drupal') ."\n";
-    $header .= '# Copyright (c) '. date('Y') .' '. $user->name .' <'. $user->mail .">\n";
-    $header .= "#\n";
-    $header .= "msgid \"\"\n";
-    $header .= "msgstr \"\"\n";
-    $header .= "\"Project-Id-Version: PROJECT VERSION\\n\"\n";
-    $header .= "\"POT-Creation-Date: ". date("Y-m-d H:iO") ."\\n\"\n";
-    $header .= "\"PO-Revision-Date: ". date("Y-m-d H:iO") ."\\n\"\n";
-    $header .= "\"Last-Translator: ". $user->name .' <'. $user->mail .">\\n\"\n";
-    $header .= "\"Language-Team: ". $meta->name .' <'. $user->mail .">\\n\"\n";
-    $header .= "\"MIME-Version: 1.0\\n\"\n";
-    $header .= "\"Content-Type: text/plain; charset=utf-8\\n\"\n";
-    $header .= "\"Content-Transfer-Encoding: 8bit\\n\"\n";
-    if ($meta->formula && $meta->plurals) {
-      $header .= "\"Plural-Forms: nplurals=". $meta->plurals ."; plural=". strtr($meta->formula, '$', '') .";\\n\"\n";
-    }
-    $header .= "\n";
-    watchdog('locale', t('Exported %locale translation file: %filename.', array('%locale' => theme('placeholder', $meta->name), '%filename' => theme('placeholder', $filename))));
-  }
-
-  // Generating Portable Object Template
-  else {
-    $filename = 'drupal.pot';
-    $header .= "# LANGUAGE translation of PROJECT\n";
-    $header .= "# Copyright (c) YEAR NAME <EMAIL@ADDRESS>\n";
-    $header .= "#\n";
-    $header .= "msgid \"\"\n";
-    $header .= "msgstr \"\"\n";
-    $header .= "\"Project-Id-Version: PROJECT VERSION\\n\"\n";
-    $header .= "\"POT-Creation-Date: ". date("Y-m-d H:iO") ."\\n\"\n";
-    $header .= "\"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\\n\"\n";
-    $header .= "\"Last-Translator: NAME <EMAIL@ADDRESS>\\n\"\n";
-    $header .= "\"Language-Team: LANGUAGE <EMAIL@ADDRESS>\\n\"\n";
-    $header .= "\"MIME-Version: 1.0\\n\"\n";
-    $header .= "\"Content-Type: text/plain; charset=utf-8\\n\"\n";
-    $header .= "\"Content-Transfer-Encoding: 8bit\\n\"\n";
-    $header .= "\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n\"\n";
-    $header .= "\n";
-    watchdog('locale', t('Exported translation file: %filename.', array('%filename' => theme('placeholder', $filename))));
-  }
-
-  // Start download process
-  header("Content-Disposition: attachment; filename=$filename");
-  header("Content-Type: text/plain; charset=utf-8");
-
-  print $header;
-
-  foreach ($parent as $lid => $message) {
-    if (!isset($done[$lid])) {
-      if ($message['comment']) {
-        print '#: '. $message['comment'] ."\n";
-      }
-      print 'msgid '. _locale_export_print($message['msgid']);
-      if (isset($message[1]['plural'])) {
-        print 'msgid_plural '. _locale_export_print($message[1]['msgid']);
-        if ($language) {
-          for ($i = 0; $i < $meta->plurals; $i++) {
-            print 'msgstr['. $i .'] '. _locale_export_print(_locale_export_remove_plural($message[${i}]['translation']));
-            $done[$message[${i}]['plural']] = 1;
-          }
-        }
-        else {
-          print 'msgstr[0] ""'. "\n";
-          print 'msgstr[1] ""'. "\n";
-          $done[$message[0]['plural']] = 1;
-          $done[$message[1]['plural']] = 1;
-        }
-      }
-      else {
-        if ($language) {
-          print 'msgstr '. _locale_export_print($message['translation']);
-        }
-        else {
-          print 'msgstr ""'. "\n";
-        }
-      }
-      print "\n";
-    }
-  }
-  die();
-}
-
-/**
- * Print out a string on multiple lines
- */
-function _locale_export_print($str) {
-  $stri = addcslashes($str, "\0..\37\\\"");
-  $parts = array();
-
-  // Cut text into several lines
-  while ($stri != "") {
-    $i = strpos($stri, "\\n");
-    if ($i === FALSE) {
-      $curstr = $stri;
-      $stri = "";
-    }
-    else {
-      $curstr = substr($stri, 0, $i + 2);
-      $stri = substr($stri, $i + 2);
-    }
-    $curparts = explode("\n", _locale_export_wrap($curstr, 70));
-    $parts = array_merge($parts, $curparts);
-  }
-
-  if (count($parts) > 1) {
-    return "\"\"\n\"". implode("\"\n\"", $parts) ."\"\n";
-  }
-  else {
-    return "\"$parts[0]\"\n";
-  }
-}
-
-/**
- * Custom word wrapping for Portable Object (Template) files.
- *
- * @author Jacobo Tarrio
- */
-function _locale_export_wrap($str, $len) {
-  $words = explode(' ', $str);
-  $ret = array();
-
-  $cur = "";
-  $nstr = 1;
-  while (count($words)) {
-    $word = array_shift($words);
-    if ($nstr) {
-      $cur = $word;
-      $nstr = 0;
-    }
-    elseif (strlen("$cur $word") > $len) {
-      $ret[] = $cur . " ";
-      $cur = $word;
-    }
-    else {
-      $cur = "$cur $word";
-    }
-  }
-  $ret[] = $cur;
-
-  return implode("\n", $ret);
-}
-
-/**
- * Removes plural index information from a string
- */
-function _locale_export_remove_plural($entry) {
-  return preg_replace('/(%count)\[[0-9]\]/', '\\1', $entry);
-}
-
-/**
- * List languages in search result table
- */
-function _locale_string_language_list($translation) {
-  $languages = locale_supported_languages(FALSE, TRUE);
-  unset($languages['name']['en']);
-  $output = '';
-  foreach ($languages['name'] as $key => $value) {
-    if (isset($translation[$key])) {
-      $output .= ($translation[$key] != '') ? $key .' ' : "<em class=\"locale-untranslated\">$key</em> ";
-    }
-  }
-
-  return $output;
-}
-
-/**
- * Build object out of search criteria specified in request variables
- */
-function _locale_string_seek_query() {
-  static $query = NULL;
-
-  if (is_null($query)) {
-    $fields = array('string', 'language', 'searchin');
-    $query = new StdClass;
-    if (is_array($_REQUEST['edit'])) {
-      foreach ($_REQUEST['edit'] as $key => $value) {
-        if (!empty($value) && in_array($key, $fields)) {
-          $query->$key = $value;
-        }
-      }
-    }
-    else {
-      foreach ($_REQUEST as $key => $value) {
-        if (!empty($value) && in_array($key, $fields)) {
-          $query->$key = strpos(',', $value) ? explode(',', $value) : $value;
-        }
-      }
-    }
-  }
-  return $query;
-}
-
-/**
- * Perform a string search and display results in a table
- */
-function _locale_string_seek() {
-  // We have at least one criterion to match
-  if ($query = _locale_string_seek_query()) {
-    $join = "SELECT s.source, s.location, s.lid, t.translation, t.locale FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid ";
-
-    $arguments = array();
-    // Compute LIKE section
-    switch ($query->searchin) {
-      case 'translated':
-        $where = "WHERE (t.translation LIKE '%%%s%%' AND t.translation != '')";
-        $orderby = "ORDER BY t.translation";
-        $arguments[] = $query->string;
-        break;
-      case 'untranslated':
-        $where = "WHERE (s.source LIKE '%%%s%%' AND t.translation = '')";
-        $orderby = "ORDER BY s.source";
-        $arguments[] = $query->string;
-        break;
-      case 'all' :
-      default:
-        $where = "WHERE (s.source LIKE '%%%s%%' OR t.translation LIKE '%%%s%%')";
-        $orderby = '';
-        $arguments[] = $query->string;
-        $arguments[] = $query->string;
-        break;
-    }
-
-    switch ($query->language) {
-      // Force search in source strings
-      case "en":
-        $sql = $join ." WHERE s.source LIKE '%%%s%%' ORDER BY s.source";
-        $arguments = array($query->string); // $where is not used, discard its arguments
-        break;
-      // Search in all languages
-      case "all":
-        $sql = "$join $where $orderby";
-        break;
-      // Some different language
-      default:
-        $sql = "$join $where AND t.locale = '%s' $orderby";
-        $arguments[] = $query->language;
-    }
-
-    $result = pager_query($sql, 50, 0, NULL, $arguments);
-
-    $header = array(t('String'), t('Locales'), array('data' => t('Operations'), 'colspan' => '2'));
-    $arr = array();
-    while ($locale = db_fetch_object($result)) {
-      $arr[$locale->lid]['locales'][$locale->locale] = $locale->translation;
-      $arr[$locale->lid]['location'] = $locale->location;
-      $arr[$locale->lid]['source'] = $locale->source;
-    }
-    foreach ($arr as $lid => $value) {
-      $rows[] = array(array('data' => check_plain(truncate_utf8($value['source'], 150, FALSE, TRUE)) .'<br /><small>'. $value['location'] .'</small>'), array('data' => _locale_string_language_list($value['locales']), 'align' => 'center'), array('data' => l(t('edit'), "admin/locale/string/edit/$lid"), 'class' => 'nowrap'), array('data' => l(t('delete'), "admin/locale/string/delete/$lid"), 'class' => 'nowrap'));
-    }
-
-    $request = array();
-    if (count($query)) {
-      foreach ($query as $key => $value) {
-        $request[$key] = (is_array($value)) ? implode(',', $value) : $value;
-      }
-    }
-
-    if (count($rows)) {
-      $output .= theme('table', $header, $rows);
-    }
-    if ($pager = theme('pager', NULL, 50, 0, $request)) {
-      $output .= $pager;
-    }
-  }
-
-  return $output;
-}
-
-// ---------------------------------------------------------------------------------
-// List of some of the most common languages (administration only)
-
-/**
- * Prepares the language code list for a select form item with only the unsupported ones
- */
-function _locale_prepare_iso_list() {
-  $languages = locale_supported_languages(FALSE, TRUE);
-  $isocodes = _locale_get_iso639_list();
-  foreach ($isocodes as $key => $value) {
-    if (isset($languages['name'][$key])) {
-      unset($isocodes[$key]);
-      continue;
-    }
-    if (count($value) == 2) {
-      $tname = t($value[0]);
-      $isocodes[$key] = ($tname == $value[1]) ? $tname : "$tname ($value[1])";
-    }
-    else {
-      $isocodes[$key] = t($value[0]);
-    }
-  }
-  asort($isocodes);
-  return $isocodes;
-}
-
-/**
- * Some of the common languages with their English and native names
- *
- * Based on ISO 639 and http://people.w3.org/rishida/names/languages.html
- */
-function _locale_get_iso639_list() {
-  return array(
-    "aa" => array("Afar"),
-    "ab" => array("Abkhazian", "аҧсуа бызшәа"),
-    "ae" => array("Avestan"),
-    "af" => array("Afrikaans"),
-    "ak" => array("Akan"),
-    "am" => array("Amharic", "አማርኛ"),
-    "ar" => array("Arabic", "العربية"),
-    "as" => array("Assamese"),
-    "av" => array("Avar"),
-    "ay" => array("Aymara"),
-    "az" => array("Azerbaijani", "azərbaycan"),
-    "ba" => array("Bashkir"),
-    "be" => array("Belarusian", "Беларуская"),
-    "bg" => array("Bulgarian", "Български"),
-    "bh" => array("Bihari"),
-    "bi" => array("Bislama"),
-    "bm" => array("Bambara", "Bamanankan"),
-    "bn" => array("Bengali"),
-    "bo" => array("Tibetan"),
-    "br" => array("Breton"),
-    "bs" => array("Bosnian", "Bosanski"),
-    "ca" => array("Catalan", "Català"),
-    "ce" => array("Chechen"),
-    "ch" => array("Chamorro"),
-    "co" => array("Corsican"),
-    "cr" => array("Cree"),
-    "cs" => array("Czech", "Čeština"),
-    "cu" => array("Old Slavonic"),
-    "cv" => array("Welsh", "Cymraeg"),
-    "cy" => array("Welch"),
-    "da" => array("Danish", "Dansk"),
-    "de" => array("German", "Deutsch"),
-    "dv" => array("Maldivian"),
-    "dz" => array("Bhutani"),
-    "ee" => array("Ewe", "Ɛʋɛ"),
-    "el" => array("Greek", "Ελληνικά"),
-    "en" => array("English"),
-    "eo" => array("Esperanto"),
-    "es" => array("Spanish", "Español"),
-    "et" => array("Estonian", "Eesti"),
-    "eu" => array("Basque", "Euskera"),
-    "fa" => array("Persian", "فارسی"),
-    "ff" => array("Fulah", "Fulfulde"),
-    "fi" => array("Finnish", "Suomi"),
-    "fj" => array("Fiji"),
-    "fo" => array("Faeroese"),
-    "fr" => array("French", "Français"),
-    "fy" => array("Frisian", "Frysk"),
-    "ga" => array("Irish", "Gaeilge"),
-    "gd" => array("Scots Gaelic"),
-    "gl" => array("Galician", "Galego"),
-    "gn" => array("Guarani"),
-    "gu" => array("Gujarati"),
-    "gv" => array("Manx"),
-    "ha" => array("Hausa"),
-    "he" => array("Hebrew", "עברית"),
-    "hi" => array("Hindi", "हिन्दी"),
-    "ho" => array("Hiri Motu"),
-    "hr" => array("Croatian", "Hrvatski"),
-    "hu" => array("Hungarian", "Magyar"),
-    "hy" => array("Armenian", "Հայերեն"),
-    "hz" => array("Herero"),
-    "ia" => array("Interlingua"),
-    "id" => array("Indonesian", "Bahasa Indonesia"),
-    "ie" => array("Interlingue"),
-    "ig" => array("Igbo"),
-    "ik" => array("Inupiak"),
-    "is" => array("Icelandic", "Íslenska"),
-    "it" => array("Italian", "Italiano"),
-    "iu" => array("Inuktitut"),
-    "ja" => array("Japanese", "日本語"),
-    "jv" => array("Javanese"),
-    "ka" => array("Georgian"),
-    "kg" => array("Kongo"),
-    "ki" => array("Kikuyu"),
-    "kj" => array("Kwanyama"),
-    "kk" => array("Kazakh", "Қазақ"),
-    "kl" => array("Greenlandic"),
-    "km" => array("Cambodian"),
-    "kn" => array("Kannada", "ಕನ್ನಡ"),
-    "ko" => array("Korean", "한국어"),
-    "kr" => array("Kanuri"),
-    "ks" => array("Kashmiri"),
-    "ku" => array("Kurdish", "Kurdî"),
-    "kv" => array("Komi"),
-    "kw" => array("Cornish"),
-    "ky" => array("Kirghiz", "Кыргыз"),
-    "la" => array("Latin", "Latina"),
-    "lb" => array("Luxembourgish"),
-    "lg" => array("Luganda"),
-    "ln" => array("Lingala"),
-    "lo" => array("Laothian"),
-    "lt" => array("Lithuanian", "Lietuviškai"),
-    "lv" => array("Latvian", "Latviešu"),
-    "mg" => array("Malagasy"),
-    "mh" => array("Marshallese"),
-    "mi" => array("Maori"),
-    "mk" => array("Macedonian", "Македонски"),
-    "ml" => array("Malayalam", "മലയാളം"),
-    "mn" => array("Mongolian"),
-    "mo" => array("Moldavian"),
-    "mr" => array("Marathi"),
-    "ms" => array("Malay", "Bahasa Melayu"),
-    "mt" => array("Maltese", "Malti"),
-    "my" => array("Burmese"),
-    "na" => array("Nauru"),
-    "nd" => array("North Ndebele"),
-    "ne" => array("Nepali"),
-    "ng" => array("Ndonga"),
-    "nl" => array("Dutch", "Nederlands"),
-    "no" => array("Norwegian", "Norsk"),
-    "nr" => array("South Ndebele"),
-    "nv" => array("Navajo"),
-    "ny" => array("Chichewa"),
-    "oc" => array("Occitan"),
-    "om" => array("Oromo"),
-    "or" => array("Oriya"),
-    "os" => array("Ossetian"),
-    "pa" => array("Punjabi"),
-    "pi" => array("Pali"),
-    "pl" => array("Polish", "Polski"),
-    "ps" => array("Pashto", "پښتو"),
-    "pt" => array("Portuguese", "Português"),
-    "qu" => array("Quechua"),
-    "rm" => array("Rhaeto-Romance"),
-    "rn" => array("Kirundi"),
-    "ro" => array("Romanian", "Română"),
-    "ru" => array("Russian", "Русский"),
-    "rw" => array("Kinyarwanda"),
-    "sa" => array("Sanskrit"),
-    "sc" => array("Sardinian"),
-    "sd" => array("Sindhi"),
-    "se" => array("Northern Sami"),
-    "sg" => array("Sango"),
-    "sh" => array("Serbo-Croatian"),
-    "si" => array("Singhalese"),
-    "sk" => array("Slovak", "Slovenčina"),
-    "sl" => array("Slovenian", "Slovenščina"),
-    "sm" => array("Samoan"),
-    "sn" => array("Shona"),
-    "so" => array("Somali"),
-    "sq" => array("Albanian", "Shqip"),
-    "sr" => array("Serbian", "Српски"),
-    "ss" => array("Siswati"),
-    "st" => array("Sesotho"),
-    "su" => array("Sudanese"),
-    "sv" => array("Swedish", "Svenska"),
-    "sw" => array("Swahili", "Kiswahili"),
-    "ta" => array("Tamil", "தமிழ்"),
-    "te" => array("Telugu", "తెలుగు"),
-    "tg" => array("Tajik"),
-    "th" => array("Thai", "ภาษาไทย"),
-    "ti" => array("Tigrinya"),
-    "tk" => array("Turkmen"),
-    "tl" => array("Tagalog"),
-    "tn" => array("Setswana"),
-    "to" => array("Tonga"),
-    "tr" => array("Turkish", "Türkçe"),
-    "ts" => array("Tsonga"),
-    "tt" => array("Tatar", "Tatarça"),
-    "tw" => array("Twi"),
-    "ty" => array("Tahitian"),
-    "ug" => array("Uighur"),
-    "uk" => array("Ukrainian", "Українська"),
-    "ur" => array("Urdu", "اردو"),
-    "uz" => array("Uzbek", "o'zbek"),
-    "ve" => array("Venda"),
-    "vi" => array("Vietnamese", "Tiếng Việt"),
-    "wo" => array("Wolof"),
-    "xh" => array("Xhosa", "isiXhosa"),
-    "yi" => array("Yiddish"),
-    "yo" => array("Yoruba", "Yorùbá"),
-    "za" => array("Zhuang"),
-    "zh-hans" => array("Chinese, Simplified", "简体中文"),
-    "zh-hant" => array("Chinese, Traditional", "繁體中文"),
-    "zu" => array("Zulu", "isiZulu"),
-  );
-}
diff --git a/includes/menu.inc b/includes/menu.inc
deleted file mode 100644 (file)
index c5fdd45..0000000
+++ /dev/null
@@ -1,1362 +0,0 @@
-<?php
-// $Id: menu.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * API for the Drupal menu system.
- */
-
-/**
- * @defgroup menu Menu system
- * @{
- * Define the navigation menus, and route page requests to code based on URLs.
- *
- * The Drupal menu system drives both the navigation system from a user
- * perspective and the callback system that Drupal uses to respond to URLs
- * passed from the browser. For this reason, a good understanding of the
- * menu system is fundamental to the creation of complex modules.
- *
- * Drupal's menu system follows a simple hierarchy defined by paths.
- * Implementations of hook_menu() define menu items and assign them to
- * paths (which should be unique). The menu system aggregates these items
- * and determines the menu hierarchy from the paths. For example, if the
- * paths defined were a, a/b, e, a/b/c/d, f/g, and a/b/h, the menu system
- * would form the structure:
- * - a
- *   - a/b
- *     - a/b/c/d
- *     - a/b/h
- * - e
- * - f/g
- * Note that the number of elements in the path does not necessarily
- * determine the depth of the menu item in the tree.
- *
- * When responding to a page request, the menu system looks to see if the
- * path requested by the browser is registered as a menu item with a
- * callback. If not, the system searches up the menu tree for the most
- * complete match with a callback it can find. If the path a/b/i is
- * requested in the tree above, the callback for a/b would be used.
- *
- * The found callback function is called with any arguments specified
- * in the "callback arguments" attribute of its menu item. The
- * attribute must be an array. After these arguments, any remaining
- * components of the path are appended as further arguments. In this
- * way, the callback for a/b above could respond to a request for
- * a/b/i differently than a request for a/b/j.
- *
- * For an illustration of this process, see page_example.module.
- *
- * Access to the callback functions is also protected by the menu system.
- * The "access" attribute of each menu item is checked as the search for a
- * callback proceeds. If this attribute is TRUE, then access is granted; if
- * FALSE, then access is denied. The first found "access" attribute
- * determines the accessibility of the target. Menu items may omit this
- * attribute to use the value provided by an ancestor item.
- *
- * In the default Drupal interface, you will notice many links rendered as
- * tabs. These are known in the menu system as "local tasks", and they are
- * rendered as tabs by default, though other presentations are possible.
- * Local tasks function just as other menu items in most respects. It is
- * convention that the names of these tasks should be short verbs if
- * possible. In addition, a "default" local task should be provided for
- * each set. When visiting a local task's parent menu item, the default
- * local task will be rendered as if it is selected; this provides for a
- * normal tab user experience. This default task is special in that it
- * links not to its provided path, but to its parent item's path instead.
- * The default task's path is only used to place it appropriately in the
- * menu hierarchy.
- */
-
-/**
- * @name Menu flags
- * @{
- * Flags for use in the "type" attribute of menu items.
- */
-
-define('MENU_IS_ROOT', 0x0001);
-define('MENU_VISIBLE_IN_TREE', 0x0002);
-define('MENU_VISIBLE_IN_BREADCRUMB', 0x0004);
-define('MENU_VISIBLE_IF_HAS_CHILDREN', 0x0008);
-define('MENU_MODIFIABLE_BY_ADMIN', 0x0010);
-define('MENU_MODIFIED_BY_ADMIN', 0x0020);
-define('MENU_CREATED_BY_ADMIN', 0x0040);
-define('MENU_IS_LOCAL_TASK', 0x0080);
-define('MENU_EXPANDED', 0x0100);
-define('MENU_LINKS_TO_PARENT', 0x0200);
-
-/**
- * @} End of "Menu flags".
- */
-
-/**
- * @name Menu item types
- * @{
- * Menu item definitions provide one of these constants, which are shortcuts for
- * combinations of the above flags.
- */
-
-/**
- * Normal menu items show up in the menu tree and can be moved/hidden by
- * the administrator. Use this for most menu items. It is the default value if
- * no menu item type is specified.
- */
-define('MENU_NORMAL_ITEM', MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IN_BREADCRUMB | MENU_MODIFIABLE_BY_ADMIN);
-
-/**
- * Item groupings are used for pages like "node/add" that simply list
- * subpages to visit. They are distinguished from other pages in that they will
- * disappear from the menu if no subpages exist.
- */
-define('MENU_ITEM_GROUPING', MENU_VISIBLE_IF_HAS_CHILDREN | MENU_VISIBLE_IN_BREADCRUMB | MENU_MODIFIABLE_BY_ADMIN);
-
-/**
- * Callbacks simply register a path so that the correct function is fired
- * when the URL is accessed. They are not shown in the menu.
- */
-define('MENU_CALLBACK', MENU_VISIBLE_IN_BREADCRUMB);
-
-/**
- * Dynamic menu items change frequently, and so should not be stored in the
- * database for administrative customization.
- */
-define('MENU_DYNAMIC_ITEM', MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IN_BREADCRUMB);
-
-/**
- * Modules may "suggest" menu items that the administrator may enable. They act
- * just as callbacks do until enabled, at which time they act like normal items.
- */
-define('MENU_SUGGESTED_ITEM', MENU_MODIFIABLE_BY_ADMIN | MENU_VISIBLE_IN_BREADCRUMB);
-
-/**
- * Local tasks are rendered as tabs by default. Use this for menu items that
- * describe actions to be performed on their parent item. An example is the path
- * "node/52/edit", which performs the "edit" task on "node/52".
- */
-define('MENU_LOCAL_TASK', MENU_IS_LOCAL_TASK);
-
-/**
- * Every set of local tasks should provide one "default" task, that links to the
- * same path as its parent when clicked.
- */
-define('MENU_DEFAULT_LOCAL_TASK', MENU_IS_LOCAL_TASK | MENU_LINKS_TO_PARENT);
-
-/**
- * Custom items are those defined by the administrator. Reserved for internal
- * use; do not return from hook_menu() implementations.
- */
-define('MENU_CUSTOM_ITEM', MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IN_BREADCRUMB | MENU_CREATED_BY_ADMIN | MENU_MODIFIABLE_BY_ADMIN);
-
-/**
- * Custom menus are those defined by the administrator. Reserved for internal
- * use; do not return from hook_menu() implementations.
- */
-define('MENU_CUSTOM_MENU', MENU_IS_ROOT | MENU_VISIBLE_IN_TREE | MENU_CREATED_BY_ADMIN | MENU_MODIFIABLE_BY_ADMIN);
-
-/**
- * @} End of "Menu item types".
- */
-
-/**
- * @name Menu status codes
- * @{
- * Status codes for menu callbacks.
- */
-
-define('MENU_FOUND', 1);
-define('MENU_NOT_FOUND', 2);
-define('MENU_ACCESS_DENIED', 3);
-define('MENU_SITE_OFFLINE', 4);
-
-/**
- * @} End of "Menu status codes".
- */
-
-/**
- * Return the menu data structure.
- *
- * The returned structure contains much information that is useful only
- * internally in the menu system. External modules are likely to need only
- * the ['visible'] element of the returned array. All menu items that are
- * accessible to the current user and not hidden will be present here, so
- * modules and themes can use this structure to build their own representations
- * of the menu.
- *
- * $menu['visible'] will contain an associative array, the keys of which
- * are menu IDs. The values of this array are themselves associative arrays,
- * with the following key-value pairs defined:
- * - 'title' - The displayed title of the menu or menu item. It will already
- *   have been translated by the locale system.
- * - 'description' - The description (link title attribute) of the menu item.
- *   It will already have been translated by the locale system.
- * - 'path' - The Drupal path to the menu item. A link to a particular item
- *   can thus be constructed with
- *   l($item['title'], $item['path'], array('title' => $item['description'])).
- * - 'children' - A linear list of the menu ID's of this item's children.
- *
- * Menu ID 0 is the "root" of the menu. The children of this item are the
- * menus themselves (they will have no associated path). Menu ID 1 will
- * always be one of these children; it is the default "Navigation" menu.
- */
-function menu_get_menu() {
-  global $_menu;
-  global $user;
-  global $locale;
-
-  if (!isset($_menu['items'])) {
-    // _menu_build() may indirectly call this function, so prevent infinite loops.
-    $_menu['items'] = array();
-
-    $cid = "menu:$user->uid:$locale";
-    if ($cached = cache_get($cid)) {
-      $_menu = unserialize($cached->data);
-    }
-    else {
-      _menu_build();
-      // Cache the menu structure for this user, to expire after one day.
-      cache_set($cid, serialize($_menu), time() + (60 * 60 * 24));
-    }
-
-    // Make sure items that cannot be cached are added.
-    _menu_append_contextual_items();
-
-    // Reset the cached $menu in menu_get_item().
-    menu_get_item(NULL, NULL, TRUE);
-  }
-
-  return $_menu;
-}
-
-/**
- * Return the local task tree.
- *
- * Unlike the rest of the menu structure, the local task tree cannot be cached
- * nor determined too early in the page request, because the user's current
- * location may be changed by a menu_set_location() call, and the tasks shown
- * (just as the breadcrumb trail) need to reflect the changed location.
- */
-function menu_get_local_tasks() {
-  global $_menu;
-
-  // Don't cache the local task tree, as it varies by location and tasks are
-  // allowed to be dynamically determined.
-  if (!isset($_menu['local tasks'])) {
-    // _menu_build_local_tasks() may indirectly call this function, so prevent
-    // infinite loops.
-    $_menu['local tasks'] = array();
-    $pid = menu_get_active_nontask_item();
-    if (!_menu_build_local_tasks($pid)) {
-      // If the build returned FALSE, the tasks need not be displayed.
-      $_menu['local tasks'][$pid]['children'] = array();
-    }
-  }
-
-  return $_menu['local tasks'];
-}
-
-/**
- * Retrieves the menu item specified by $mid, or by $path if $mid is not given.
- *
- * @param $mid
- *   The menu ID of the menu item to retrieve.
- * @param $path
- *   The internal path of the menu item to retrieve. Defaults to NULL. Only
- *   used if $mid is not set.
- * @param $reset
- *   Optional flag that resets the static variable cache of the menu tree, if
- *   set to TRUE. Default is FALSE.
- *
- * @return
- *   The menu item found in the site menu, or an empty array if none could be
- *   found.
- */
-function menu_get_item($mid, $path = NULL, $reset = FALSE) {
-  static $menu;
-
-  if (!isset($menu) || $reset) {
-    $menu = menu_get_menu();
-  }
-
-  if (isset($mid)) {
-    return $menu['items'][$mid];
-  }
-
-  if (isset($path)) {
-    return $menu['items'][$menu['path index'][$path]];
-  }
-
-  return array();
-}
-
-/**
- * Retrieves the menu ID and title of all root menus.
- *
- * @return
- *   Array containing all menus (but not menu items), in the form mid => title.
- */
-function menu_get_root_menus() {
-  $menu = menu_get_menu();
-  $root_menus = array();
-
-  foreach ($menu['items'][0]['children'] as $mid) {
-    $root_menus[$mid] = $menu['items'][$mid]['title'];
-  }
-
-  return $root_menus;
-}
-
-/**
- * Change the current menu location of the user.
- *
- * Frequently, modules may want to make a page or node act as if it were
- * in the menu tree somewhere, even though it was not registered in a
- * hook_menu() implementation. If the administrator has rearranged the menu,
- * the newly set location should respect this in the breadcrumb trail and
- * expanded/collapsed status of menu items in the tree. This function
- * allows this behavior.
- *
- * @param $location
- *   An array specifying a complete or partial breadcrumb trail for the
- *   new location, in the same format as the return value of hook_menu().
- *   The last element of this array should be the new location itself.
- *
- * This function will set the new breadcrumb trail to the passed-in value,
- * but if any elements of this trail are visible in the site tree, the
- * trail will be "spliced in" to the existing site navigation at that point.
- */
-function menu_set_location($location) {
-  global $_menu;
-  $temp_id = min(array_keys($_menu['items'])) - 1;
-  $prev_id = 0;
-
-  // Don't allow this function to change the actual current path, just the
-  // position in the menu tree.
-  $location[count($location) - 1]['path'] = $_GET['q'];
-
-  foreach (array_reverse($location) as $item) {
-    if (isset($_menu['path index'][$item['path']])) {
-      $mid = $_menu['path index'][$item['path']];
-      if (isset($_menu['visible'][$mid])) {
-        // Splice in the breadcrumb at this location.
-        if ($prev_id) {
-          $_menu['items'][$prev_id]['pid'] = $mid;
-        }
-        $prev_id = 0;
-        break;
-      }
-      else {
-        // A hidden item; show it, but only temporarily.
-        $_menu['items'][$mid]['type'] |= MENU_VISIBLE_IN_BREADCRUMB;
-        if ($prev_id) {
-          $_menu['items'][$prev_id]['pid'] = $mid;
-        }
-        $prev_id = $mid;
-      }
-    }
-    else {
-      $item['type'] |= MENU_VISIBLE_IN_BREADCRUMB;
-      if ($prev_id) {
-        $_menu['items'][$prev_id]['pid'] = $temp_id;
-      }
-      $_menu['items'][$temp_id] = $item;
-      $_menu['path index'][$item['path']] = $temp_id;
-
-      $prev_id = $temp_id;
-      $temp_id--;
-    }
-  }
-
-  if ($prev_id) {
-    // Didn't find a home, so attach this to the main navigation menu.
-    $_menu['items'][$prev_id]['pid'] = 1;
-  }
-
-  $final_item = array_pop($location);
-  menu_set_active_item($final_item['path']);
-}
-
-/**
- * Execute the handler associated with the active menu item.
- *
- * This is called early in the page request. The active menu item is at
- * this point determined exclusively by the URL. The handler that is called
- * here may, as a side effect, change the active menu item so that later
- * menu functions (that display the menus and breadcrumbs, for example)
- * act as if the user were in a different location on the site.
- */
-function menu_execute_active_handler() {
-  if (_menu_site_is_offline()) {
-    return MENU_SITE_OFFLINE;
-  }
-
-  $menu = menu_get_menu();
-
-  // Determine the menu item containing the callback.
-  $path = $_GET['q'];
-  while ($path && !isset($menu['callbacks'][$path])) {
-    $path = substr($path, 0, strrpos($path, '/'));
-  }
-
-  if (!isset($menu['callbacks'][$path])) {
-    return MENU_NOT_FOUND;
-  }
-
-  if (!function_exists($menu['callbacks'][$path]['callback'])) {
-    return MENU_NOT_FOUND;
-  }
-
-  if (!_menu_item_is_accessible(menu_get_active_item())) {
-    return MENU_ACCESS_DENIED;
-  }
-
-  // We found one, and are allowed to execute it.
-  $arguments = isset($menu['callbacks'][$path]['callback arguments']) ? $menu['callbacks'][$path]['callback arguments'] : array();
-  $arg = substr($_GET['q'], strlen($path) + 1);
-  if (strlen($arg)) {
-    $arguments = array_merge($arguments, explode('/', $arg));
-  }
-
-  return call_user_func_array($menu['callbacks'][$path]['callback'], $arguments);
-}
-
-/**
- * Returns the ID of the active menu item.
- */
-function menu_get_active_item() {
-  return menu_set_active_item();
-}
-
-/**
- * Sets the path of the active menu item.
- */
-function menu_set_active_item($path = NULL) {
-  static $stored_mid;
-
-  if (!isset($stored_mid) || isset($path)) {
-    $menu = menu_get_menu();
-    if (!isset($path)) {
-      $path = $_GET['q'];
-    }
-    else {
-      $_GET['q'] = $path;
-    }
-
-    while ($path && !isset($menu['path index'][$path])) {
-      $path = substr($path, 0, strrpos($path, '/'));
-    }
-    $stored_mid = isset($menu['path index'][$path]) ? $menu['path index'][$path] : 0;
-
-    // Search for default local tasks to activate instead of this item.
-    $continue = TRUE;
-    while ($continue) {
-      $continue = FALSE;
-      if (isset($menu['items'][$stored_mid]['children'])) {
-        foreach ($menu['items'][$stored_mid]['children'] as $cid) {
-          if ($menu['items'][$cid]['type'] & MENU_LINKS_TO_PARENT) {
-            $stored_mid = $cid;
-            $continue = TRUE;
-          }
-        }
-      }
-    }
-
-    // Reset the cached $menu in menu_get_item().
-    menu_get_item(NULL, NULL, TRUE);
-  }
-
-  return $stored_mid;
-}
-
-/**
- * Returns the ID of the current menu item or, if the current item is a
- * local task, the menu item to which this task is attached.
- */
-function menu_get_active_nontask_item() {
-  $mid = menu_get_active_item();
-
-  // Find the first non-task item:
-  while ($mid) {
-    $item = menu_get_item($mid);
-
-    if (!($item['type'] & MENU_IS_LOCAL_TASK)) {
-      return $mid;
-    }
-
-    $mid = $item['pid'];
-  }
-}
-
-/**
- * Returns the title of the active menu item.
- */
-function menu_get_active_title() {
-  if ($mid = menu_get_active_nontask_item()) {
-    $item = menu_get_item($mid);
-    return $item['title'];
-  }
-}
-
-/**
- * Returns the help associated with the active menu item.
- */
-function menu_get_active_help() {
-  $path = $_GET['q'];
-  $output = '';
-
-  if (!_menu_item_is_accessible(menu_get_active_item())) {
-    // Don't return help text for areas the user cannot access.
-    return;
-  }
-
-  foreach (module_list() as $name) {
-    if (module_hook($name, 'help')) {
-      if ($temp = module_invoke($name, 'help', $path)) {
-        $output .= $temp . "\n";
-      }
-      if (module_hook('help', 'page')) {
-        if (substr($path, 0, 6) == "admin/") {
-          if (module_invoke($name, 'help', 'admin/help#' . substr($path, 6))) {
-            $output .= theme("more_help_link", url('admin/help/' . substr($path, 6)));
-          }
-        }
-      }
-    }
-  }
-  return $output;
-}
-
-/**
- * Returns an array of rendered menu items in the active breadcrumb trail.
- */
-function menu_get_active_breadcrumb() {
-
-  // No breadcrumb for the front page.
-  if (drupal_is_front_page()) {
-    return array();
-  }
-
-  $links[] = l(t('Home'), variable_get('site_frontpage', 'node'));
-
-  $trail = _menu_get_active_trail();
-  foreach ($trail as $mid) {
-    $item = menu_get_item($mid);
-    if ($item['type'] & MENU_VISIBLE_IN_BREADCRUMB) {
-      $links[] = menu_item_link($mid);
-    }
-  }
-
-  // The last item in the trail is the page title; don't display it here.
-  array_pop($links);
-
-  return $links;
-}
-
-/**
- * Returns true when the menu item is in the active trail.
- */
-function menu_in_active_trail($mid) {
-  $trail = _menu_get_active_trail();
-
-  return in_array($mid, $trail);
-}
-
-/**
- * Returns true when the menu item is in the active trail within a
- * specific subsection of the menu tree.
- *
- * @param $mid
- *   The menu item being considered.
- * @param $pid
- *   The root of the subsection of the menu tree in which to look.
- */
-function menu_in_active_trail_in_submenu($mid, $pid) {
-  $trail = _menu_get_active_trail_in_submenu($pid);
-
-  if (!$trail) {
-    return FALSE;
-  }
-
-  return in_array($mid, $trail);
-}
-
-/**
- * Populate the database representation of the menu.
- *
- * This need only be called at the start of pages that modify the menu.
- */
-function menu_rebuild() {
-  // Clear the page cache, so that changed menus are reflected for anonymous users.
-  cache_clear_all();
-  // Also clear the menu cache.
-  cache_clear_all('menu:', TRUE);
-
-  _menu_build();
-
-  if (module_exist('menu')) {
-    $menu = menu_get_menu();
-
-    // Fill a queue of new menu items which are modifiable.
-    $new_items = array();
-    foreach ($menu['items'] as $mid => $item) {
-      if ($mid < 0 && ($item['type'] & MENU_MODIFIABLE_BY_ADMIN)) {
-        $new_items[$mid] = $item;
-      }
-    }
-
-    $old_count = -1;
-    // Save the new items updating the pids in each iteration
-    while (($c = count($new_items)) && ($c != $old_count)) {
-      $old_count = count($new_items);
-      foreach($new_items as $mid => $item) {
-        // If the item has a valid parent, save it
-        if ($item['pid'] >= 0) {
-          // The new menu ID gets passed back by reference as $item['mid']
-          menu_save_item($item);
-          // Fix parent IDs for the children of the menu item just saved
-          if ($item['children']) {
-            foreach ($item['children'] as $child) {
-              if (isset($new_items[$child])) {
-                $new_items[$child]['pid'] = $item['mid'];
-              }
-            }
-          }
-          // remove the item
-          unset($new_items[$mid]);
-        }
-      }
-    }
-    // Rebuild the menu to account for the changes.
-    _menu_build();
-  }
-
-  // Reset the cached $menu in menu_get_item().
-  menu_get_item(NULL, NULL, TRUE);
-
-}
-
-/**
- * Generate the HTML for a menu tree.
- *
- * @param $pid
- *   The parent id of the menu.
- *
- * @ingroup themeable
- */
-function theme_menu_tree($pid = 1) {
-  if ($tree = menu_tree($pid)) {
-    return "\n<ul class=\"menu\">\n". $tree ."\n</ul>\n";
-  }
-}
-
-/**
- * Returns a rendered menu tree.
- *
- * @param $pid
- *   The parent id of the menu.
- */
-function menu_tree($pid = 1) {
-  $menu = menu_get_menu();
-  $output = '';
-
-  if (isset($menu['visible'][$pid]) && $menu['visible'][$pid]['children']) {
-    foreach ($menu['visible'][$pid]['children'] as $mid) {
-      $type = isset($menu['visible'][$mid]['type']) ? $menu['visible'][$mid]['type'] : NULL;
-      $children = isset($menu['visible'][$mid]['children']) ? $menu['visible'][$mid]['children'] : NULL;
-      $output .= theme('menu_item', $mid, menu_in_active_trail($mid) || ($type & MENU_EXPANDED) ? theme('menu_tree', $mid) : '', count($children) == 0);
-    }
-  }
-
-  return $output;
-}
-
-/**
- * Generate the HTML output for a single menu item.
- *
- * @param $mid
- *   The menu id of the item.
- * @param $children
- *   A string containing any rendered child items of this menu.
- * @param $leaf
- *   A boolean indicating whether this menu item is a leaf.
- *
- * @ingroup themeable
- */
-function theme_menu_item($mid, $children = '', $leaf = TRUE) {
-  return '<li class="'. ($leaf ? 'leaf' : ($children ? 'expanded' : 'collapsed')) .'">'. menu_item_link($mid) . $children ."</li>\n";
-}
-
-/**
- * Generate the HTML representing a given menu item ID.
- *
- * @param $item
- *   The menu item to render.
- * @param $link_item
- *   The menu item which should be used to find the correct path.
- *
- * @ingroup themeable
- */
-function theme_menu_item_link($item, $link_item) {
-  return l($item['title'], $link_item['path'], isset($item['description']) ? array('title' => $item['description']) : array());
-}
-
-/**
- * Returns the rendered link to a menu item.
- *
- * @param $mid
- *   The menu item id to render.
- */
-function menu_item_link($mid) {
-  $item = menu_get_item($mid);
-  $link_item = $item;
-
-  while ($link_item['type'] & MENU_LINKS_TO_PARENT) {
-    $link_item = menu_get_item($link_item['pid']);
-  }
-
-  return theme('menu_item_link', $item, $link_item);
-}
-
-/**
- * Returns the rendered local tasks. The default implementation renders
- * them as tabs.
- *
- * @ingroup themeable
- */
-function theme_menu_local_tasks() {
-  $output = '';
-
-  if ($primary = menu_primary_local_tasks()) {
-    $output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
-  }
-  if ($secondary = menu_secondary_local_tasks()) {
-    $output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
-  }
-
-  return $output;
-}
-
-/**
- * Returns the rendered HTML of the primary local tasks.
- */
-function menu_primary_local_tasks() {
-  $local_tasks = menu_get_local_tasks();
-  $pid = menu_get_active_nontask_item();
-  $output = '';
-
-  if (count($local_tasks[$pid]['children'])) {
-    foreach ($local_tasks[$pid]['children'] as $mid) {
-      $output .= theme('menu_local_task', $mid, menu_in_active_trail($mid), TRUE);
-    }
-  }
-
-  return $output;
-}
-
-/**
- * Returns the rendered HTML of the secondary local tasks.
- */
-function menu_secondary_local_tasks() {
-  $local_tasks = menu_get_local_tasks();
-  $pid = menu_get_active_nontask_item();
-  $output = '';
-
-  if (count($local_tasks[$pid]['children'])) {
-    foreach ($local_tasks[$pid]['children'] as $mid) {
-      if (menu_in_active_trail($mid) && count($local_tasks[$mid]['children']) > 1) {
-        foreach ($local_tasks[$mid]['children'] as $cid) {
-          $output .= theme('menu_local_task', $cid, menu_in_active_trail($cid), FALSE);
-        }
-      }
-    }
-  }
-
-  return $output;
-}
-
-/**
- * Generate the HTML representing a given menu item ID as a tab.
- *
- * @param $mid
- *   The menu ID to render.
- * @param $active
- *   Whether this tab or a subtab is the active menu item.
- * @param $primary
- *   Whether this tab is a primary tab or a subtab.
- *
- * @ingroup themeable
- */
-function theme_menu_local_task($mid, $active, $primary) {
-  if ($active) {
-    return '<li class="active">'. menu_item_link($mid) ."</li>\n";
-  }
-  else {
-    return '<li>'. menu_item_link($mid) ."</li>\n";
-  }
-}
-
-/**
- * Returns an array containing the primary links.
- * Can optionally descend from the root of the Primary links menu towards the
- * current node for a specified number of levels and return that submenu.
- * Used to generate a primary/secondary menu from different levels of one menu.
- *
- * @param $start_level
- *   This optional parameter can be used to retrieve a context-sensitive array
- *   of links at $start_level levels deep into the Primary links menu.
- *   The default is to return the top-level links.
- * @param $pid
- *   The parent menu ID from which to search for children. Defaults to the
- *   menu_primary_menu setting.
- * @return An array containing the themed links as the values. The keys of
- *   the array contain some extra encoded information about the results.
- *   The format of the key is {level}-{num}{-active}.
- *   level is the depth within the menu tree of this list.
- *   num is the number within this array, used only to make the key unique.
- *   -active is appended if this element is in the active trail.
- */
-function menu_primary_links($start_level = 1, $pid = 0) {
-  if (!module_exist('menu')) {
-    return NULL;
-  }
-  if (!$pid) {
-    $pid = variable_get('menu_primary_menu', 0);
-  }
-  if (!$pid) {
-    return NULL;
-  }
-
-  if ($start_level < 1) {
-    $start_level = 1;
-  }
-
-  if ($start_level > 1) {
-    $trail = _menu_get_active_trail_in_submenu($pid);
-    if (!$trail) {
-      return NULL;
-    }
-    else {
-      $pid = $trail[$start_level - 1];
-    }
-  }
-
-  $menu = menu_get_menu();
-  $links = array();
-  if ($pid && is_array($menu['visible'][$pid]) && isset($menu['visible'][$pid]['children'])) {
-    $count = 1;
-    foreach ($menu['visible'][$pid]['children'] as $cid) {
-      $index = "menu-$start_level-$count";
-      if (menu_in_active_trail_in_submenu($cid, $pid)) {
-        $index .= "-active";
-      }
-      $links[$index] = menu_item_link($cid);
-      $count++;
-    }
-  }
-
-  // Special case - provide link to admin/menu if primary links is empty.
-  if (empty($links) && $start_level == 1 && $pid == variable_get('menu_primary_menu', 0)) {
-    $links['1-1'] = l(t('edit primary links'),'admin/menu');
-  }
-
-  return $links;
-}
-
-/**
- * Returns an array containing the secondary links.
- * Secondary links can be either a second level of the Primary links
- * menu or generated from their own menu.
- */
-function menu_secondary_links() {
-  $msm = variable_get('menu_secondary_menu', 0);
-  if ($msm == 0) {
-    return NULL;
-  }
-
-  if ($msm == variable_get('menu_primary_menu', 0)) {
-    return menu_primary_links(2, $msm);
-  }
-
-  return menu_primary_links(1, $msm);
-}
-
-/**
- * Returns the themed HTML for primary and secondary links.
- * Note that this function is overridden by most core themes because
- * those themes display links in "link | link" format, not from a list.
- * Also note that by default links rendered with this function are
- * displayed with the same CSS as is used for the local tasks.
- * If a theme wishes to render links from a ul it is expected that
- * the theme will provide suitable CSS.
- *
- * @param $links
- *   An array containing links to render.
- * @return
- *   A string containing the themed links.
- *
- * @ingroup themeable
- */
-function theme_menu_links($links) {
-  if (!count($links)) {
-    return '';
-  }
-  $level_tmp = explode('-', key($links));
-  $level = $level_tmp[0];
-  $output = "<ul class=\"links-$level\">\n";
-  foreach ($links as $index => $link) {
-    $output .= '<li';
-    if (stristr($index, 'active')) {
-      $output .= ' class="active"';
-    }
-    $output .= ">$link</li>\n";
-  }
-  $output .= '</ul>';
-
-  return $output;
-}
-
-/**
- * @} End of "defgroup menu".
- */
-
-/**
- * Returns an array with the menu items that lead to the current menu item.
- */
-function _menu_get_active_trail() {
-  static $trail;
-
-  if (!isset($trail)) {
-    $trail = array();
-
-    $mid = menu_get_active_item();
-
-    // Follow the parents up the chain to get the trail.
-    while ($mid && ($item = menu_get_item($mid))) {
-      array_unshift($trail, $mid);
-      $mid = $item['pid'];
-    }
-  }
-  return $trail;
-}
-
-/**
- * Find the active trail through a specific subsection of the menu tree.
- *
- * @param $pid
- *   The root item from which the active trail must descend.
- */
-function _menu_get_active_trail_in_submenu($pid) {
-  static $trails;
-
-  if (!isset($trails)) {
-    // Find all menu items which point to the current node and for each
-    // follow the parents up the chain to build an active trail.
-    $trails = array();
-    $menu = menu_get_menu();
-    $path = $_GET['q'];
-    $count = 0;
-    while ($path && !$count) {
-      foreach ($menu['items'] as $key => $item) {
-        if (isset($item['path']) && $item['path'] == $path) {
-          $trails[$count] = array();
-          $mid = $key;
-          while ($mid && $menu['items'][$mid]) {
-            array_unshift($trails[$count], $mid);
-            $mid = $menu['items'][$mid]['pid'];
-          }
-          $count ++;
-        }
-      }
-      $path = substr($path, 0, strrpos($path, '/'));
-    }
-  }
-
-  if ($trails) {
-    foreach ($trails as $trail) {
-      $count_trail = count($trail);
-      for ($i = 0; $i < $count_trail; $i++) {
-        if ($trail[$i] == $pid) {
-          // Return a trail from $pid down to the current page inclusive.
-          for ( ; $i < $count_trail; $i++) {
-            $subtrail[] = $trail[$i];
-          }
-          return $subtrail;
-        }
-      }
-    }
-  }
-
-  return NULL;
-}
-
-/**
- * Comparator routine for use in sorting menu items.
- */
-function _menu_sort($a, $b) {
-  $menu = menu_get_menu();
-
-  $a = &$menu['items'][$a];
-  $b = &$menu['items'][$b];
-
-  if ($a['weight'] < $b['weight']) {
-    return -1;
-  }
-  elseif ($a['weight'] > $b['weight']) {
-    return 1;
-  }
-  elseif (isset($a['title']) && isset($b['title'])) {
-    return strnatcasecmp($a['title'], $b['title']);
-  }
-  else {
-    return 1;
-  }
-}
-
-/**
- * Build the menu by querying both modules and the database.
- */
-function _menu_build() {
-  global $_menu;
-  global $user;
-
-  // Start from a clean slate.
-  $_menu = array();
-
-  $_menu['path index'] = array();
-  // Set up items array, including default "Navigation" menu.
-  $_menu['items'] = array(
-    0 => array('path' => '', 'title' => '', 'type' => MENU_IS_ROOT),
-    1 => array('pid' => 0, 'path' => '', 'title' => t('Navigation'), 'weight' => -50, 'access' => TRUE, 'type' => MENU_IS_ROOT | MENU_VISIBLE_IN_TREE)
-    );
-  $_menu['callbacks'] = array();
-
-  // Build a sequential list of all menu items.
-  $menu_item_list = module_invoke_all('menu', TRUE);
-
-  // Menu items not in the DB get temporary negative IDs.
-  $temp_mid = -1;
-
-  foreach ($menu_item_list as $item) {
-    if (!isset($item['path'])) {
-      $item['path'] = '';
-    }
-    if (!isset($item['type'])) {
-      $item['type'] = MENU_NORMAL_ITEM;
-    }
-    if (!isset($item['weight'])) {
-      $item['weight'] = 0;
-    }
-    $mid = $temp_mid;
-    if (isset($_menu['path index'][$item['path']])) {
-      // Newer menu items overwrite older ones.
-      unset($_menu['items'][$_menu['path index'][$item['path']]]);
-    }
-    if (isset($item['callback'])) {
-      $_menu['callbacks'][$item['path']] = array('callback' => $item['callback']);
-      if (isset($item['callback arguments'])) {
-        $_menu['callbacks'][$item['path']]['callback arguments'] = $item['callback arguments'];
-      }
-    }
-    unset($item['callback']);
-    unset($item['callback arguments']);
-    $_menu['items'][$mid] = $item;
-    $_menu['path index'][$item['path']] = $mid;
-
-    $temp_mid--;
-  }
-
-  // Now fetch items from the DB, reassigning menu IDs as needed.
-  if (module_exist('menu')) {
-    $result = db_query(db_rewrite_sql('SELECT m.mid, m.* FROM {menu} m ORDER BY m.mid ASC', 'm', 'mid'));
-    while ($item = db_fetch_object($result)) {
-      // Handle URL aliases if entered in menu administration.
-      if (!isset($_menu['path index'][$item->path])) {
-        $item->path = drupal_get_normal_path($item->path);
-      }
-      if (isset($_menu['path index'][$item->path])) {
-        // The path is already declared.
-        $old_mid = $_menu['path index'][$item->path];
-        if ($old_mid < 0) {
-          // It had a temporary ID, so use a permanent one.
-          $_menu['items'][$item->mid] = $_menu['items'][$old_mid];
-          unset($_menu['items'][$old_mid]);
-          $_menu['path index'][$item->path] = $item->mid;
-        }
-        else {
-          // It has a permanent ID. Only replace with non-custom menu items.
-          if ($item->type & MENU_CREATED_BY_ADMIN) {
-            $_menu['items'][$item->mid] = array('path' => $item->path);
-          }
-          else {
-            // Leave the old item around as a shortcut to this one.
-            $_menu['items'][$item->mid] = $_menu['items'][$old_mid];
-            $_menu['path index'][$item->path] = $item->mid;
-          }
-        }
-      }
-      else {
-        // The path was not declared, so this is a custom item or an orphaned one.
-        if ($item->type & MENU_CREATED_BY_ADMIN) {
-          $_menu['items'][$item->mid] = array('path' => $item->path);
-          if (!empty($item->path)) {
-            $_menu['path index'][$item->path] = $item->mid;
-          }
-        }
-      }
-
-      // If the administrator has changed the item, reflect the change.
-      if ($item->type & MENU_MODIFIED_BY_ADMIN) {
-        $_menu['items'][$item->mid]['title'] = $item->title;
-        $_menu['items'][$item->mid]['description'] = $item->description;
-        $_menu['items'][$item->mid]['pid'] = $item->pid;
-        $_menu['items'][$item->mid]['weight'] = $item->weight;
-        $_menu['items'][$item->mid]['type'] = $item->type;
-      }
-    }
-  }
-
-  // Associate parent and child menu items.
-  _menu_find_parents($_menu['items']);
-
-  // Prepare to display trees to the user as required.
-  _menu_build_visible_tree();
-}
-
-/**
- * Determine whether the given menu item is accessible to the current user.
- *
- * Use this instead of just checking the "access" property of a menu item
- * to properly handle items with fall-through semantics.
- */
-function _menu_item_is_accessible($mid) {
-  $menu = menu_get_menu();
-
-  // Follow the path up to find the first "access" attribute.
-  $path = isset($menu['items'][$mid]['path']) ? $menu['items'][$mid]['path'] : NULL;
-  while ($path && (!isset($menu['path index'][$path]) || !isset($menu['items'][$menu['path index'][$path]]['access']))) {
-    $path = substr($path, 0, strrpos($path, '/'));
-  }
-  if (empty($path)) {
-    // Items without any access attribute up the chain are denied, unless they
-    // were created by the admin. They most likely point to non-Drupal directories
-    // or to an external URL and should be allowed.
-    return $menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN;
-  }
-  return $menu['items'][$menu['path index'][$path]]['access'];
-}
-
-/**
- * Find all visible items in the menu tree, for ease in displaying to user.
- *
- * Since this is only for display, we only need title, path, and children
- * for each item.
- */
-function _menu_build_visible_tree($pid = 0) {
-  global $_menu;
-
-  if (isset($_menu['items'][$pid])) {
-    $parent = $_menu['items'][$pid];
-
-    $children = array();
-    if (isset($parent['children'])) {
-      usort($parent['children'], '_menu_sort');
-      foreach ($parent['children'] as $mid) {
-        $children = array_merge($children, _menu_build_visible_tree($mid));
-      }
-    }
-    $visible = ($parent['type'] & MENU_VISIBLE_IN_TREE) ||
-      ($parent['type'] & MENU_VISIBLE_IF_HAS_CHILDREN && count($children) > 0);
-    $allowed = _menu_item_is_accessible($pid);
-
-    if (($parent['type'] & MENU_IS_ROOT) || ($visible && $allowed)) {
-      $_menu['visible'][$pid] = array('title' => $parent['title'], 'path' => $parent['path'], 'children' => $children, 'type' => $parent['type']);
-      foreach ($children as $mid) {
-        $_menu['visible'][$mid]['pid'] = $pid;
-      }
-      return array($pid);
-    }
-    else {
-      return $children;
-    }
-  }
-
-  return array();
-}
-
-/**
- * Account for menu items that are only defined at certain paths, so will not
- * be cached.
- *
- * We don't support the full range of menu item options for these menu items. We
- * don't support MENU_VISIBLE_IF_HAS_CHILDREN, and we require parent items to be
- * declared before their children.
- */
-function _menu_append_contextual_items() {
-  global $_menu;
-
-  // Build a sequential list of all menu items.
-  $menu_item_list = module_invoke_all('menu', FALSE);
-
-  // Menu items not in the DB get temporary negative IDs.
-  $temp_mid = min(array_keys($_menu['items'])) - 1;
-  $new_items = array();
-
-  foreach ($menu_item_list as $item) {
-    if (isset($item['callback'])) {
-      $_menu['callbacks'][$item['path']] = array('callback' => $item['callback']);
-      if (isset($item['callback arguments'])) {
-        $_menu['callbacks'][$item['path']]['callback arguments'] = $item['callback arguments'];
-      }
-    }
-    unset($item['callback']);
-    unset($item['callback arguments']);
-    if (!isset($_menu['path index'][$item['path']])) {
-      if (!isset($item['path'])) {
-        $item['path'] = '';
-      }
-      if (!isset($item['type'])) {
-        $item['type'] = MENU_NORMAL_ITEM;
-      }
-      if (!isset($item['weight'])) {
-        $item['weight'] = 0;
-      }
-      $_menu['items'][$temp_mid] = $item;
-      $_menu['path index'][$item['path']] = $temp_mid;
-      $new_items[$temp_mid] = $item;
-      $temp_mid--;
-    }
-    else {
-      $mid = $_menu['path index'][$item['path']];
-      if ($_menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN) {
-        $_menu['items'][$mid]['access'] = $item['access'];
-        if (isset($_menu['items'][$mid]['callback'])) {
-          $_menu['items'][$mid]['callback'] = $item['callback'];
-        }
-        if (isset($_menu['items'][$mid]['callback arguments'])) {
-          $_menu['items'][$mid]['callback arguments'] = $item['callback arguments'];
-        }
-      }
-    }
-  }
-
-  // Establish parent-child relationships.
-  _menu_find_parents($new_items);
-
-  // Add new items to the visible tree if necessary.
-  foreach ($new_items as $mid => $item) {
-    $item = $_menu['items'][$mid];
-    if (($item['type'] & MENU_VISIBLE_IN_TREE) && _menu_item_is_accessible($mid)) {
-      $pid = $item['pid'];
-      while ($pid && !isset($_menu['visible'][$pid])) {
-        $pid = $_menu['items'][$pid]['pid'];
-      }
-      $_menu['visible'][$mid] = array('title' => $item['title'], 'path' => $item['path'], 'pid' => $pid);
-      $_menu['visible'][$pid]['children'][] = $mid;
-      usort($_menu['visible'][$pid]['children'], '_menu_sort');
-    }
-  }
-}
-
-/**
- * Establish parent-child relationships.
- */
-function _menu_find_parents(&$items) {
-  global $_menu;
-
-  foreach ($items as $mid => $item) {
-    if (!isset($item['pid'])) {
-      // Parent's location has not been customized, so figure it out using the path.
-      $parent = $item['path'];
-      if ($parent) {
-        do {
-          $parent = substr($parent, 0, strrpos($parent, '/'));
-        }
-        while ($parent && !isset($_menu['path index'][$parent]));
-      }
-
-      $pid = $parent ? $_menu['path index'][$parent] : 1;
-      $_menu['items'][$mid]['pid'] = $pid;
-    }
-    else {
-      $pid = $item['pid'];
-    }
-
-    // Don't make root a child of itself.
-    if ($mid) {
-      if (isset ($_menu['items'][$pid])) {
-        $_menu['items'][$pid]['children'][] = $mid;
-      }
-      else {
-        // If parent is missing, it is a menu item that used to be defined
-        // but is no longer. Default to a root-level "Navigation" menu item.
-        $_menu['items'][1]['children'][] = $mid;
-      }
-    }
-  }
-}
-
-/**
- * Find all the items in the current local task tree.
- *
- * Since this is only for display, we only need title, path, and children
- * for each item.
- *
- * At the close of this function, $_menu['local tasks'] is populated with the
- * menu items in the local task tree.
- *
- * @return
- *   TRUE if the local task tree is forked. It does not need to be displayed
- *   otherwise.
- */
-function _menu_build_local_tasks($pid) {
-  global $_menu;
-
-  $forked = FALSE;
-
-  if (isset($_menu['items'][$pid])) {
-    $parent = $_menu['items'][$pid];
-
-    $children = array();
-    if (isset($parent['children'])) {
-      foreach ($parent['children'] as $mid) {
-        if (($_menu['items'][$mid]['type'] & MENU_IS_LOCAL_TASK) && _menu_item_is_accessible($mid)) {
-          $children[] = $mid;
-          // Beware short-circuiting || operator!
-          $forked = _menu_build_local_tasks($mid) || $forked;
-        }
-      }
-    }
-    usort($children, '_menu_sort');
-    $forked = $forked || count($children) > 1;
-
-    $_menu['local tasks'][$pid] = array('title' => $parent['title'], 'path' => $parent['path'], 'children' => $children);
-    foreach ($children as $mid) {
-      $_menu['local tasks'][$mid]['pid'] = $pid;
-    }
-  }
-
-  return $forked;
-}
-
-/**
- * Returns TRUE if the site is off-line for maintenance.
- */
-function _menu_site_is_offline() {
-  // Check if site is set to off-line mode
-  if (variable_get('site_offline', 0)) {
-    // Check if the user has administration privileges
-    if (!user_access('administer site configuration')) {
-      // Check if this is an attempt to login
-      if (drupal_get_normal_path($_GET['q']) != 'user') {
-        return TRUE;
-      }
-    }
-    else {
-      $offline_message = t('Operating in off-line mode.');
-      $messages = drupal_set_message();
-      // Ensure that the off-line message is displayed only once [allowing for page redirects].
-      if (!isset($messages) || !isset($messages['status']) || !in_array($offline_message, $messages['status'])) {
-        drupal_set_message($offline_message);
-      }
-    }
-  }
-  return FALSE;
-}
\ No newline at end of file
diff --git a/includes/module.inc b/includes/module.inc
deleted file mode 100644 (file)
index 7bdec0f..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-<?php
-// $Id: module.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * API for loading and interacting with Drupal modules.
- */
-
-/**
- * Load all the modules that have been enabled in the system table.
- */
-function module_load_all() {
-  foreach (module_list(TRUE, FALSE) as $module) {
-    drupal_load('module', $module);
-  }
-}
-
-/**
- * Call a function repeatedly with each module in turn as an argument.
- */
-function module_iterate($function, $argument = '') {
-  foreach (module_list() as $name) {
-    $function($name, $argument);
-  }
-}
-
-/**
- * Collect a list of all loaded modules. During the bootstrap, return only
- * vital modules. See bootstrap.inc
- *
- * @param $refresh
- *   Whether to force the module list to be regenerated (such as after the
- *   administrator has changed the system settings).
- * @param $bootstrap
- *   Whether to return the reduced set of modules loaded in "bootstrap mode"
- *   for cached pages. See bootstrap.inc.
- * @param $sort
- *   By default, modules are ordered by weight and filename, settings this option
- *   to TRUE, module list will be ordered by module name.
- * @return
- *   An associative array whose keys and values are the names of all loaded
- *   modules.
- */
-function module_list($refresh = FALSE, $bootstrap = TRUE, $sort = FALSE) {
-  static $list, $sorted_list;
-
-  if ($refresh) {
-    $list = array();
-    $sorted_list = NULL;
-  }
-
-  if (!$list) {
-    $list = array('filter' => 'filter', 'node' => 'node', 'system' => 'system', 'user' => 'user', 'watchdog' => 'watchdog');
-    if ($bootstrap) {
-      $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1 AND bootstrap = 1 ORDER BY weight ASC, filename ASC");
-    }
-    else {
-      $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC");
-    }
-    while ($module = db_fetch_object($result)) {
-      if (file_exists($module->filename)) {
-        // Determine the current throttle status and see if the module should be
-        // loaded based on server load. We have to directly access the throttle
-        // variables, since throttle.module may not be loaded yet.
-        $throttle = ($module->throttle && variable_get('throttle_level', 0) > 0);
-        if (!$throttle) {
-          drupal_get_filename('module', $module->name, $module->filename);
-          $list[$module->name] = $module->name;
-        }
-      }
-    }
-  }
-  if ($sort) {
-    if (!isset($sorted_list)) {
-      $sorted_list = $list;
-      ksort($sorted_list);
-    }
-    return $sorted_list;
-  }
-  return $list;
-}
-
-/**
- * Determine whether a given module exists.
- *
- * @param $module
- *   The name of the module (without the .module extension).
- * @return
- *   TRUE if the module is both installed and enabled.
- */
-function module_exist($module) {
-  $list = module_list();
-  return array_key_exists($module, $list);
-}
-
-/**
- * @defgroup hooks Hooks
- * @{
- * Allow modules to interact with the Drupal core.
- *
- * Drupal's module system is based on the concept of "hooks". A hook is a PHP
- * function that is named foo_bar(), where "foo" is the name of the module (whose
- * filename is thus foo.module) and "bar" is the name of the hook. Each hook has
- * a defined set of parameters and a specified result type.
- *
- * To extend Drupal, a module need simply implement a hook. When Drupal wishes to
- * allow intervention from modules, it determines which modules implement a hook
- * and call that hook in all enabled modules that implement it.
- *
- * The available hooks to implement are explained here in the Hooks section of
- * the developer documentation. The string "hook" is used as a placeholder for
- * the module name is the hook definitions. For example, if the module file is
- * called example.module, then hook_help() as implemented by that module would be
- * defined as example_help().
- */
-
-/**
- * Determine whether a module implements a hook.
- *
- * @param $module
- *   The name of the module (without the .module extension).
- * @param $hook
- *   The name of the hook (e.g. "help" or "menu").
- * @return
- *   TRUE if the module is both installed and enabled, and the hook is
- *   implemented in that module.
- */
-function module_hook($module, $hook) {
-  return function_exists($module .'_'. $hook);
-}
-
-/**
- * Determine which modules are implementing a hook.
- *
- * @param $hook
- *   The name of the hook (e.g. "help" or "menu").
- * @param $sort
- *   By default, modules are ordered by weight and filename, settings this option
- *   to TRUE, module list will be ordered by module name.
- * @return
- *   An array with the names of the modules which are implementing this hook.
- */
-function module_implements($hook, $sort = FALSE) {
-  static $implementations;
-
-  if (!isset($implementations[$hook])) {
-    $implementations[$hook] = array();
-    $list = module_list(FALSE, TRUE, $sort);
-    foreach ($list as $module) {
-      if (module_hook($module, $hook)) {
-        $implementations[$hook][] = $module;
-      }
-    }
-  }
-
-  // The explicit cast forces a copy to be made.  This is needed because
-  // $implementations[$hook] is only a reference to an element of
-  // $implementations and if there are nested foreaches (due to nested node
-  // API calls, for example), they would both manipulate the same array's
-  // references, which causes some modules' hooks not to be called.
-  // See also http://www.zend.com/zend/art/ref-count.php.
-  return (array)$implementations[$hook];
-}
-
-/**
- * Invoke a hook in a particular module.
- *
- * @param $module
- *   The name of the module (without the .module extension).
- * @param $hook
- *   The name of the hook to invoke.
- * @param ...
- *   Arguments to pass to the hook implementation.
- * @return
- *   The return value of the hook implementation.
- */
-function module_invoke() {
-  $args = func_get_args();
-  $module = array_shift($args);
-  $hook = array_shift($args);
-  $function = $module .'_'. $hook;
-  if (module_hook($module, $hook)) {
-    return call_user_func_array($function, $args);
-  }
-}
-/**
- * Invoke a hook in all enabled modules that implement it.
- *
- * @param $hook
- *   The name of the hook to invoke.
- * @param ...
- *   Arguments to pass to the hook.
- * @return
- *   An array of return values of the hook implementations. If modules return
- *   arrays from their implementations, those are merged into one array.
- */
-function module_invoke_all() {
-  $args = func_get_args();
-  $hook = array_shift($args);
-  $return = array();
-  foreach (module_implements($hook) as $module) {
-    $function = $module .'_'. $hook;
-    $result = call_user_func_array($function, $args);
-    if (isset($result) && is_array($result)) {
-      $return = array_merge($return, $result);
-    }
-    else if (isset($result)) {
-      $return[] = $result;
-    }
-  }
-
-  return $return;
-}
-
-/**
- * @} End of "defgroup hooks".
- */
-
-
diff --git a/includes/pager.inc b/includes/pager.inc
deleted file mode 100644 (file)
index cff8da8..0000000
+++ /dev/null
@@ -1,430 +0,0 @@
-<?php
-// $Id: pager.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Functions to aid in presenting database results as a set of pages.
- */
-
-/**
- * Perform a paged database query.
- *
- * Use this function when doing select queries you wish to be able to page. The
- * pager uses LIMIT-based queries to fetch only the records required to render a
- * certain page. However, it has to learn the total number of records returned
- * by the query to compute the number of pages (the number of records / records
- * per page). This is done by inserting "COUNT(*)" in the original query. For
- * example, the query "SELECT nid, type FROM node WHERE status = '1' ORDER BY
- * sticky DESC, created DESC" would be rewritten to read "SELECT COUNT(*) FROM
- * node WHERE status = '1' ORDER BY sticky DESC, created DESC". Rewriting the
- * query is accomplished using a regular expression.
- *
- * Unfortunately, the rewrite rule does not always work as intended for queries
- * that already have a "COUNT(*)" or a "GROUP BY" clause, and possibly for
- * other complex queries. In those cases, you can optionally pass a query that
- * will be used to count the records.
- *
- * For example, if you want to page the query "SELECT COUNT(*), TYPE FROM node
- * GROUP BY TYPE", pager_query() would invoke the incorrect query "SELECT
- * COUNT(*) FROM node GROUP BY TYPE". So instead, you should pass "SELECT
- * COUNT(DISTINCT(TYPE)) FROM node" as the optional $count_query parameter.
- *
- * @param $query
- *   The SQL query that needs paging.
- * @param $limit
- *   The number of query results to display per page.
- * @param $element
- *   An optional integer to distinguish between multiple pagers on one page.
- * @param $count_query
- *   An SQL query used to count matching records.
- * @param ...
- *   A variable number of arguments which are substituted into the query (and
- *   the count query) using printf() syntax. Instead of a variable number of
- *   query arguments, you may also pass a single array containing the query
- *   arguments.
- * @return
- *   A database query result resource, or FALSE if the query was not executed
- *   correctly.
- *
- * @ingroup database
- */
-function pager_query($query, $limit = 10, $element = 0, $count_query = NULL) {
-  global $pager_page_array, $pager_total, $pager_total_items;
-  $page = isset($_GET['page']) ? $_GET['page'] : '';
-
-  // Substitute in query arguments.
-  $args = func_get_args();
-  $args = array_slice($args, 4);
-  // Alternative syntax for '...'
-  if (isset($args[0]) && is_array($args[0])) {
-    $args = $args[0];
-  }
-
-  // Construct a count query if none was given.
-  if (!isset($count_query)) {
-    $count_query = preg_replace(array('/SELECT.*?FROM/As', '/ORDER BY .*/'), array('SELECT COUNT(*) FROM', ''), $query);
-  }
-
-  // Convert comma-separated $page to an array, used by other functions.
-  $pager_page_array = explode(',', $page);
-
-  // We calculate the total of pages as ceil(items / limit).
-  if (count($args)) {
-    $pager_total_items[$element] = db_result(db_query($count_query, $args));
-    $pager_total[$element] = ceil($pager_total_items[$element] / $limit);
-    $pager_page_array[$element] = max(0, min((int)$pager_page_array[$element], ((int)$pager_total[$element]) - 1));
-    return db_query_range($query, $args, $pager_page_array[$element] * $limit, $limit);
-  }
-  else {
-    $pager_total_items[$element] = db_result(db_query($count_query));
-    $pager_total[$element] = ceil($pager_total_items[$element] / $limit);
-    $pager_page_array[$element] = max(0, min((int)$pager_page_array[$element], ((int)$pager_total[$element]) - 1));
-    return db_query_range($query, $pager_page_array[$element] * $limit, $limit);
-  }
-}
-
-/**
- * Compose a query string to append to pager requests.
- *
- * @return
- *   A query string that consists of all components of the current page request
- *   except for those pertaining to paging.
- */
-function pager_get_querystring() {
-  static $string = NULL;
-  if (!isset($string)) {
-    $string = drupal_query_string_encode($_REQUEST, array_merge(array('q', 'page'), array_keys($_COOKIE)));
-  }
-  return $string;
-}
-
-/**
- * Format a query pager.
- *
- * Menu callbacks that display paged query results should call theme('pager') to
- * retrieve a pager control so that users can view other results.
- *
- * @param $tags
- *   An array of labels for the controls in the pager.
- * @param $limit
- *   The number of query results to display per page.
- * @param $element
- *   An optional integer to distinguish between multiple pagers on one page.
- * @param $parameters
- *   An associative array of query string parameters to append to the pager links.
- * @return
- *   An HTML string that generates the query pager.
- *
- * @ingroup themeable
- */
-function theme_pager($tags = array(), $limit = 10, $element = 0, $parameters = array()) {
-  global $pager_total;
-  $output = '';
-
-  if ($pager_total[$element] > 1) {
-    $output .= '<div id="pager">';
-    $output .= theme('pager_first', ($tags[0] ? $tags[0] : t('« first')), $limit, $element, $parameters);
-    $output .= theme('pager_previous', ($tags[1] ? $tags[1] : t('‹ previous')), $limit, $element, 1, $parameters);
-    $output .= theme('pager_list', $limit, $element, ($tags[2] ? $tags[2] : 9 ), '', $parameters);
-    $output .= theme('pager_next', ($tags[3] ? $tags[3] : t('next ›')), $limit, $element, 1, $parameters);
-    $output .= theme('pager_last', ($tags[4] ? $tags[4] : t('last »')), $limit, $element, $parameters);
-    $output .= '</div>';
-
-    return $output;
-  }
-}
-
-/**
- * @name Pager pieces
- * @{
- * Use these pieces to construct your own custom pagers in your theme. Note that
- * you should NOT modify this file to customize your pager.
- */
-
-/**
- * Format a "first page" link.
- *
- * @param $text
- *   The name (or image) of the link.
- * @param $limit
- *   The number of query results to display per page.
- * @param $element
- *   An optional integer to distinguish between multiple pagers on one page.
- * @param $parameters
- *   An associative array of query string parameters to append to the pager links.
- * @return
- *   An HTML string that generates this piece of the query pager.
- *
- * @ingroup themeable
- */
-function theme_pager_first($text, $limit, $element = 0, $parameters = array()) {
-  global $pager_page_array;
-  $output = '';
-
-  // If we are anywhere but the first page
-  if ($pager_page_array[$element] > 0) {
-    $output = theme('pager_link', $text, pager_load_array(0, $element, $pager_page_array), $element, $parameters, array('class' => 'pager-first'));
-  }
-
-  return $output;
-}
-
-/**
- * Format a "previous page" link.
- *
- * @param $text
- *   The name (or image) of the link.
- * @param $limit
- *   The number of query results to display per page.
- * @param $element
- *   An optional integer to distinguish between multiple pagers on one page.
- * @param $interval
- *   The number of pages to move backward when the link is clicked.
- * @param $parameters
- *   An associative array of query string parameters to append to the pager links.
- * @return
- *   An HTML string that generates this piece of the query pager.
- *
- * @ingroup themeable
- */
-function theme_pager_previous($text, $limit, $element = 0, $interval = 1, $parameters = array()) {
-  global $pager_page_array;
-  $output = '';
-
-  // If we are anywhere but the first page
-  if ($pager_page_array[$element] > 0) {
-    $page_new = pager_load_array($pager_page_array[$element] - $interval, $element, $pager_page_array);
-
-    // If the previous page is the first page, mark the link as such.
-    if ($page_new[$element] == 0) {
-      $output = theme('pager_first', $text, $limit, $element, $parameters);
-    }
-    // The previous page is not the first page.
-    else {
-      $output = theme('pager_link', $text, $page_new, $element, $parameters, array('class' => 'pager-previous'));
-    }
-  }
-
-  return $output;
-}
-
-/**
- * Format a "next page" link.
- *
- * @param $text
- *   The name (or image) of the link.
- * @param $limit
- *   The number of query results to display per page.
- * @param $element
- *   An optional integer to distinguish between multiple pagers on one page.
- * @param $interval
- *   The number of pages to move forward when the link is clicked.
- * @param $parameters
- *   An associative array of query string parameters to append to the pager links.
- * @return
- *   An HTML string that generates this piece of the query pager.
- *
- * @ingroup themeable
- */
-function theme_pager_next($text, $limit, $element = 0, $interval = 1, $parameters = array()) {
-  global $pager_page_array, $pager_total;
-  $output = '';
-
-  // If we are anywhere but the last page
-  if ($pager_page_array[$element] < ($pager_total[$element] - 1)) {
-    $page_new = pager_load_array($pager_page_array[$element] + $interval, $element, $pager_page_array);
-    // If the next page is the last page, mark the link as such.
-    if ($page_new[$element] == ($pager_total[$element] - 1)) {
-      $output = theme('pager_last', $text, $limit, $element, $parameters);
-    }
-    // The next page is not the last page.
-    else {
-      $output = theme('pager_link', $text, $page_new, $element, $parameters, array('class' => 'pager-next'));
-    }
-  }
-
-  return $output;
-}
-
-/**
- * Format a "last page" link.
- *
- * @param $text
- *   The name (or image) of the link.
- * @param $limit
- *   The number of query results to display per page.
- * @param $element
- *   An optional integer to distinguish between multiple pagers on one page.
- * @param $parameters
- *   An associative array of query string parameters to append to the pager links.
- * @return
- *   An HTML string that generates this piece of the query pager.
- *
- * @ingroup themeable
- */
-function theme_pager_last($text, $limit, $element = 0, $parameters = array()) {
-  global $pager_page_array, $pager_total;
-  $output = '';
-
-  // If we are anywhere but the last page
-  if ($pager_page_array[$element] < ($pager_total[$element] - 1)) {
-    $output = theme('pager_link', $text, pager_load_array($pager_total[$element] - 1, $element, $pager_page_array), $element, $parameters, array('class' => 'pager-last'));
-  }
-
-  return $output;
-}
-
-/**
- * Format a list of nearby pages with additional query results.
- *
- * @param $limit
- *   The number of query results to display per page.
- * @param $element
- *   An optional integer to distinguish between multiple pagers on one page.
- * @param $quantity
- *   The number of pages in the list.
- * @param $text
- *   A string of text to display before the page list.
- * @param $parameters
- *   An associative array of query string parameters to append to the pager links.
- * @return
- *   An HTML string that generates this piece of the query pager.
- *
- * @ingroup themeable
- */
-function theme_pager_list($limit, $element = 0, $quantity = 5, $text = '', $parameters = array()) {
-  global $pager_page_array, $pager_total;
-
-  $output = '<span class="pager-list">';
-  // Calculate various markers within this pager piece:
-  // Middle is used to "center" pages around the current page.
-  $pager_middle = ceil($quantity / 2);
-  // current is the page we are currently paged to
-  $pager_current = $pager_page_array[$element] + 1;
-  // first is the first page listed by this pager piece (re quantity)
-  $pager_first = $pager_current - $pager_middle + 1;
-  // last is the last page listed by this pager piece (re quantity)
-  $pager_last = $pager_current + $quantity - $pager_middle;
-  // max is the maximum page number
-  $pager_max = $pager_total[$element];
-  // End of marker calculations.
-
-  // Prepare for generation loop.
-  $i = $pager_first;
-  if ($pager_last > $pager_max) {
-    // Adjust "center" if at end of query.
-    $i = $i + ($pager_max - $pager_last);
-    $pager_last = $pager_max;
-  }
-  if ($i <= 0) {
-    // Adjust "center" if at start of query.
-    $pager_last = $pager_last + (1 - $i);
-    $i = 1;
-  }
-  // End of generation loop preparation.
-
-  // When there is more than one page, create the pager list.
-  if ($i != $pager_max) {
-    $output .= $text;
-    if ($i > 1) {
-      $output .= '<span class="pager-ellipsis">…</span>';
-    }
-
-    // Now generate the actual pager piece.
-    for (; $i <= $pager_last && $i <= $pager_max; $i++) {
-      if ($i < $pager_current) {
-        $output .= theme('pager_previous', $i, $limit, $element, ($pager_current - $i), $parameters);
-      }
-      if ($i == $pager_current) {
-        $output .= '<strong class="pager-current">'. $i .'</strong>';
-      }
-      if ($i > $pager_current) {
-        $output .= theme('pager_next', $i, $limit, $element, ($i - $pager_current), $parameters);
-      }
-    }
-
-    if ($i < $pager_max) {
-      $output .= '<span class="pager-ellipsis">…</span>';
-    }
-  }
-  $output .= '</span>';
-
-  return $output;
-}
-
-/**
- * Format a link to a specific query result page.
- *
- * @param $page_new
- *   The first result to display on the linked page.
- * @param $element
- *   An optional integer to distinguish between multiple pagers on one page.
- * @param $parameters
- *   An associative array of query string parameters to append to the pager link.
- * @param $attributes
- *   An associative array of HTML attributes to apply to a pager anchor tag.
- * @return
- *   An HTML string that generates the link.
- */
-function theme_pager_link($text, $page_new, $element, $parameters = array(), $attributes = array()) {
-  $page = isset($_GET['page']) ? $_GET['page'] : '';
-  if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
-    $parameters['page'] = $new_page;
-  }
-
-  $query = array();
-  if (count($parameters)) {
-    $query[] = drupal_query_string_encode($parameters, array());
-  }
-  $querystring = pager_get_querystring();
-  if ($querystring != '') {
-    $query[] = $querystring;
-  }
-
-  // Set each pager link title
-  if (!isset($attributes['title'])) {
-    static $titles = null;
-    if (!isset($titles)) {
-      $titles = array(
-        t('« first') => t('Go to first page'),
-        t('‹ previous') => t('Go to previous page'),
-        t('next ›') => t('Go to next page'),
-        t('last »') => t('Go to last page'),
-      );
-    }
-    if (isset($titles[$text])) {
-      $attributes['title'] = $titles[$text];
-    }
-    else if (is_numeric($text)) {
-      $attributes['title'] = t('Go to page %number', array('%number' => $text));
-    }
-  }
-
-  return l($text, $_GET['q'], $attributes, count($query) ? implode('&', $query) : NULL);
-}
-
-/**
- * @} End of "Pager pieces".
- */
-
-/**
- * Helper function
- *
- * Copies $old_array to $new_array and sets $new_array[$element] = $value
- * Fills in $new_array[0 .. $element - 1] = 0
- */
-function pager_load_array($value, $element, $old_array) {
-  $new_array = $old_array;
-  // Look for empty elements.
-  for ($i = 0; $i < $element; $i++) {
-    if (!$new_array[$i]) {
-      // Load found empty element with 0.
-      $new_array[$i] = 0;
-    }
-  }
-  // Update the changed element.
-  $new_array[$element] = (int)$value;
-  return $new_array;
-}
-
-
diff --git a/includes/path.inc b/includes/path.inc
deleted file mode 100644 (file)
index e5476a2..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-<?php
-// $Id: path.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Functions to handle paths in Drupal, including path aliasing.
- *
- * These functions are not loaded for cached pages, but modules that need
- * to use them in hook_init() or hook exit() can make them available, by
- * executing "drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);".
- */
-
-/**
- * Initialize the $_GET['q'] variable to the proper normal path.
- */
-function drupal_init_path() {
-  if (!empty($_GET['q'])) {
-    $_GET['q'] = drupal_get_normal_path(trim($_GET['q'], '/'));
-  }
-  else {
-    $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage', 'node'));
-  }
-}
-
-/**
- * Given an alias, return its Drupal system URL if one exists. Given a Drupal
- * system URL return its alias if one exists.
- *
- * @param $action
- *   One of the following values:
- *   - wipe: delete the alias cache.
- *   - alias: return an alias for a given Drupal system path (if one exists).
- *   - source: return the Drupal system URL for a path alias (if one exists).
- * @param $path
- *   The path to investigate for corresponding aliases or system URLs.
- *
- * @return
- *   Either a Drupal system path, an aliased path, or FALSE if no path was
- *   found.
- */
-function drupal_lookup_path($action, $path = '') {
-  static $map = array();
-  static $count = NULL;
-
-  if ($count === NULL) {
-    $count = db_result(db_query('SELECT COUNT(pid) FROM {url_alias}'));
-  }
-
-  if ($action == 'wipe') {
-    $map = array();
-  }
-  elseif ($count > 0 && $path != '') {
-    if ($action == 'alias') {
-      if (isset($map[$path])) {
-        return $map[$path];
-      }
-      if ($alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $path))) {
-        $map[$path] = $alias;
-        return $alias;
-      }
-      else {
-        $map[$path] = $path;
-      }
-    }
-    elseif ($action == 'source') {
-      if ($alias = array_search($path, $map)) {
-        return $alias;
-      }
-      if (!isset($map[$path])) {
-        if ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s'", $path))) {
-          $map[$src] = $path;
-          return $src;
-        }
-      }
-    }
-  }
-
-  return FALSE;
-}
-
-/**
- * Given an internal Drupal path, return the alias set by the administrator.
- *
- * @param $path
- *   An internal Drupal path.
- *
- * @return
- *   An aliased path if one was found, or the original path if no alias was
- *   found.
- */
-function drupal_get_path_alias($path) {
-  $result = $path;
-  if ($alias = drupal_lookup_path('alias', $path)) {
-    $result = $alias;
-  }
-  if (function_exists('custom_url_rewrite')) {
-    $result = custom_url_rewrite('alias', $result, $path);
-  }
-  return $result;
-}
-
-/**
- * Given a path alias, return the internal path it represents.
- *
- * @param $path
- *   A Drupal path alias.
- *
- * @return
- *   The internal path represented by the alias, or the original alias if no
- *   internal path was found.
- */
-function drupal_get_normal_path($path) {
-  $result = $path;
-  if ($src = drupal_lookup_path('source', $path)) {
-    $result = $src;
-  }
-  if (function_exists('custom_url_rewrite')) {
-    $result = custom_url_rewrite('source', $result, $path);
-  }
-  return $result;
-}
-
-/**
- * Return a component of the current Drupal path.
- *
- * When viewing a page at the path "admin/node/configure", for example, arg(0)
- * would return "admin", arg(1) would return "node", and arg(2) would return
- * "configure".
- *
- * Avoid use of this function where possible, as resulting code is hard to read.
- * Instead, attempt to use named arguments in menu callback functions. See the
- * explanation in menu.inc for how to construct callbacks that take arguments.
- *
- * @param $index
- *   The index of the component, where each component is separated by a '/'
- *   (forward-slash), and where the first component has an index of 0 (zero).
- *
- * @return
- *   The component specified by $index, or FALSE if the specified component was
- *   not found.
- */
-function arg($index) {
-  static $arguments, $q;
-
-  if (empty($arguments) || $q != $_GET['q']) {
-    $arguments = explode('/', $_GET['q']);
-    $q = $_GET['q'];
-  }
-
-  if (isset($arguments[$index])) {
-    return $arguments[$index];
-  }
-}
-
-/**
- * Get the title of the current page, for display on the page and in the title bar.
- *
- * @return
- *   The current page's title.
- */
-function drupal_get_title() {
-  $title = drupal_set_title();
-
-  // during a bootstrap, menu.inc is not included and thus we cannot provide a title
-  if (!isset($title) && function_exists('menu_get_active_title')) {
-    $title = check_plain(menu_get_active_title());
-  }
-
-  return $title;
-}
-
-/**
- * Set the title of the current page, for display on the page and in the title bar.
- *
- * @param $title
- *   Optional string value to assign to the page title; or if set to NULL
- *   (default), leaves the current title unchanged.
- *
- * @return
- *   The updated title of the current page.
- */
-function drupal_set_title($title = NULL) {
-  static $stored_title;
-
-  if (isset($title)) {
-    $stored_title = $title;
-  }
-  return $stored_title;
-}
-
-/**
- * Check if the current page is the front page.
- *
- * @return
- *   Boolean value: TRUE if the current page is the front page; FALSE if otherwise.
- */
-function drupal_is_front_page() {
-  // As drupal_init_path updates $_GET['q'] with the 'site_frontpage' path,
-  // we can check it against the 'site_frontpage' variable.
-  return $_GET['q'] == variable_get('site_frontpage', 'node');
-}
diff --git a/includes/session.inc b/includes/session.inc
deleted file mode 100644 (file)
index e251d5b..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-// $Id: session.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * User session handling functions.
- */
-
-function sess_open($save_path, $session_name) {
-  return TRUE;
-}
-
-function sess_close() {
-  return TRUE;
-}
-
-function sess_read($key) {
-  global $user;
-
-  // retrieve data for a $user object
-  $result = db_query("SELECT sid FROM {sessions} WHERE sid = '%s'", $key);
-  if (!db_num_rows($result)) {
-    $result = db_query("SELECT u.* FROM {users} u WHERE u.uid = 0");
-  }
-  else {
-    $result = db_query("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = '%s'", $key);
-  }
-
-  // Build $user object:
-  $user = db_fetch_object($result);
-  $user = drupal_unpack($user);
-
-  // Add roles element to $user:
-  $user->roles = array();
-  if ($user->uid) {
-    $user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user';
-
-    $result = db_query("SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d", $user->uid);
-    while ($role = db_fetch_object($result)) {
-      $user->roles[$role->rid] = $role->name;
-    }
-  }
-  else {
-    $user->roles[DRUPAL_ANONYMOUS_RID] = 'anonymous user';
-  }
-
-  return !empty($user->session) ? $user->session : '';
-}
-
-function sess_write($key, $value) {
-  global $user;
-
-  $result = db_query("SELECT sid FROM {sessions} WHERE sid = '%s'", $key);
-
-  if (!db_num_rows($result)) {
-    // Only save session data when when the browser sends a cookie.  This keeps
-    // crawlers out of session table. This improves speed up queries, reduces
-    // memory, and gives more useful statistics. We can't eliminate anonymous
-    // session table rows without breaking throttle module and "Who's Online"
-    // block.
-    if ($user->uid || $value || count($_COOKIE)) {
-      db_query("INSERT INTO {sessions} (sid, uid, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $user->uid, $user->cache, $_SERVER["REMOTE_ADDR"], $value, time());
-    }
-  }
-  else {
-    db_query("UPDATE {sessions} SET uid = %d, cache = %d, hostname = '%s', session = '%s', timestamp = %d WHERE sid = '%s'", $user->uid, $user->cache, $_SERVER["REMOTE_ADDR"], $value, time(), $key);
-
-    // TODO: this can be an expensive query. Perhaps only execute it every x minutes. Requires investigation into cache expiration.
-    if ($user->uid) {
-      db_query("UPDATE {users} SET access = %d WHERE uid = %d", time(), $user->uid);
-    }
-  }
-
-  return TRUE;
-}
-
-function sess_destroy($key) {
-  db_query("DELETE FROM {sessions} WHERE sid = '%s'", $key);
-}
-
-function sess_gc($lifetime) {
-  // Be sure to adjust 'php_value session.gc_maxlifetime' to a large enough
-  // value.  For example, if you want user sessions to stay in your database
-  // for three weeks before deleting them, you need to set gc_maxlifetime
-  // to '1814400'.  At that value, only after a user doesn't log in after
-  // three weeks (1814400 seconds) will his/her session be removed.
-  db_query("DELETE FROM {sessions} WHERE timestamp < %d", time() - $lifetime);
-
-  return TRUE;
-}
-
diff --git a/includes/tablesort.inc b/includes/tablesort.inc
deleted file mode 100644 (file)
index 2e0c010..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-// $Id: tablesort.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Functions to aid in the creation of sortable tables.
- *
- * All tables created with a call to theme('table') have the option of having
- * column headers that the user can click on to sort the table by that column.
- */
-
-/**
- * Initialize the table sort context.
- */
-function tablesort_init($header) {
-  $ts = tablesort_get_order($header);
-  $ts['sort'] = tablesort_get_sort($header);
-  $ts['query_string'] = tablesort_get_querystring();
-  return $ts;
-}
-
-/**
- * Create an SQL sort clause.
- *
- * This function produces the ORDER BY clause to insert in your SQL queries,
- * assuring that the returned database table rows match the sort order chosen
- * by the user.
- *
- * @param $header
- *   An array of column headers in the format described in theme_table().
- * @param $before
- *   An SQL string to insert after ORDER BY and before the table sorting code.
- *   Useful for sorting by important attributes like "sticky" first.
- * @return
- *   An SQL string to append to the end of a query.
- *
- * @ingroup database
- */
-function tablesort_sql($header, $before = '') {
-  $ts = tablesort_init($header);
-  if ($ts['sql']) {
-    $sql = db_escape_string($ts['sql']);
-    $sort = drupal_strtoupper(db_escape_string($ts['sort']));
-    return " ORDER BY $before $sql $sort";
-  }
-}
-
-/**
- * Format a column header.
- *
- * If the cell in question is the column header for the current sort criterion,
- * it gets special formatting. All possible sort criteria become links.
- *
- * @param $cell
- *   The cell to format.
- * @param $header
- *   An array of column headers in the format described in theme_table().
- * @param $ts
- *   The current table sort context as returned from tablesort_init().
- * @return
- *   A properly formatted cell, ready for _theme_table_cell().
- */
-function tablesort_header($cell, $header, $ts) {
-  // Special formatting for the currently sorted column header.
-  if (is_array($cell) && isset($cell['field'])) {
-    $title = t('sort by %s', array('%s' => $cell['data']));
-    if ($cell['data'] == $ts['name']) {
-      $ts['sort'] = (($ts['sort'] == 'asc') ? 'desc' : 'asc');
-      $cell['class'] = 'active';
-      $image = theme('tablesort_indicator', $ts['sort']);
-    }
-    else {
-      // If the user clicks a different header, we want to sort ascending initially.
-      $ts['sort'] = 'asc';
-      $image = '';
-    }
-
-    if (!empty($ts['query_string'])) {
-      $ts['query_string'] = '&'. $ts['query_string'];
-    }
-    $cell['data'] = l($cell['data'] . $image, $_GET['q'], array('title' => $title), 'sort='. $ts['sort'] .'&order='. urlencode($cell['data']) . $ts['query_string'], NULL, FALSE, TRUE);
-
-    unset($cell['field'], $cell['sort']);
-  }
-  return $cell;
-}
-
-/**
- * Format a table cell.
- *
- * Adds a class attribute to all cells in the currently active column.
- *
- * @param $cell
- *   The cell to format.
- * @param $header
- *   An array of column headers in the format described in theme_table().
- * @param $ts
- *   The current table sort context as returned from tablesort_init().
- * @param $i
- *   The index of the cell's table column.
- * @return
- *   A properly formatted cell, ready for _theme_table_cell().
- */
-function tablesort_cell($cell, $header, $ts, $i) {
-  if (isset($header[$i]) && $header[$i]['data'] == $ts['name'] && $header[$i]['field']) {
-    if (is_array($cell)) {
-      if (isset($cell['class'])) {
-        $cell['class'] .= ' active';
-      }
-      else {
-        $cell['class'] = 'active';
-      }
-    }
-    else {
-      $cell = array('data' => $cell, 'class' => 'active');
-    }
-  }
-  return $cell;
-}
-
-/**
- * Compose a query string to append to table sorting requests.
- *
- * @return
- *   A query string that consists of all components of the current page request
- *   except for those pertaining to table sorting.
- */
-function tablesort_get_querystring() {
-  return drupal_query_string_encode($_REQUEST, array_merge(array('q', 'sort', 'order'), array_keys($_COOKIE)));
-}
-
-/**
- * Determine the current sort criterion.
- *
- * @param $headers
- *   An array of column headers in the format described in theme_table().
- * @return
- *   An associative array describing the criterion, containing the keys:
- *   - "name": The localized title of the table column.
- *   - "sql": The name of the database field to sort on.
- */
-function tablesort_get_order($headers) {
-  $order = isset($_GET['order']) ? $_GET['order'] : '';
-  foreach ($headers as $header) {
-    if (isset($header['data']) && $order == $header['data']) {
-      return array('name' => $header['data'], 'sql' => $header['field']);
-    }
-
-    if (isset($header['sort']) && ($header['sort'] == 'asc' || $header['sort'] == 'desc')) {
-      $default = array('name' => $header['data'], 'sql' => $header['field']);
-    }
-  }
-
-  if (isset($default)) {
-    return $default;
-  }
-  else {
-    // The first column specified is initial 'order by' field unless otherwise specified
-    if (is_array($headers[0])) {
-      return array('name' => $headers[0]['data'], 'sql' => $headers[0]['field']);
-    }
-    else {
-      return array('name' => $headers[0]);
-    }
-  }
-}
-
-/**
- * Determine the current sort direction.
- *
- * @param $headers
- *   An array of column headers in the format described in theme_table().
- * @return
- *   The current sort direction ("asc" or "desc").
- */
-function tablesort_get_sort($headers) {
-  if (isset($_GET['sort'])) {
-    return ($_GET['sort'] == 'desc') ? 'desc' : 'asc';
-  }
-  // User has not specified a sort. Use default if specified; otherwise use "asc".
-  else {
-    foreach ($headers as $header) {
-      if (is_array($header) && array_key_exists('sort', $header)) {
-        return $header['sort'];
-      }
-    }
-  }
-  return 'asc';
-}
diff --git a/includes/theme.inc b/includes/theme.inc
deleted file mode 100644 (file)
index b71d040..0000000
+++ /dev/null
@@ -1,1034 +0,0 @@
-<?php
-// $Id: theme.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * The theme system, which controls the output of Drupal.
- *
- * The theme system allows for nearly all output of the Drupal system to be
- * customized by user themes.
- *
- * @see <a href="http://drupal.org/node/253">Theme system</a>
- * @see themeable
- */
-
- /**
- * @name Content markers
- * @{
- * Markers used by theme_mark() and node_mark() to designate content.
- * @see theme_mark(), node_mark()
- */
-define('MARK_READ',    0);
-define('MARK_NEW',     1);
-define('MARK_UPDATED', 2);
-/**
- * @} End of "Content markers".
- */
-
-/**
- * Initialize the theme system by loading the theme.
- *
- */
-function init_theme() {
-  global $theme, $user, $custom_theme, $theme_engine, $theme_key;
-
-  // If $theme is already set, assume the others are set, too, and do nothing
-  if (isset($theme)) {
-    return;
-  }
-
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
-  $themes = list_themes();
-
-  // Only select the user selected theme if it is available in the
-  // list of enabled themes.
-  $theme = $user->theme && $themes[$user->theme]->status ? $user->theme : variable_get('theme_default', 'bluemarine');
-
-  // Allow modules to override the present theme... only select custom theme
-  // if it is available in the list of installed themes.
-  $theme = $custom_theme && $themes[$custom_theme] ? $custom_theme : $theme;
-
-  // Store the identifier for retrieving theme settings with.
-  $theme_key = $theme;
-
-  // If we're using a style, load its appropriate theme,
-  // which is stored in the style's description field.
-  // Also load the stylesheet using theme_add_style().
-  // Otherwise, load the theme.
-  if (strpos($themes[$theme]->filename, '.css')) {
-    // File is a style; loads its CSS.
-    // Set theme to its template/theme
-    theme_add_style($themes[$theme]->filename);
-    $theme = basename(dirname($themes[$theme]->description));
-  }
-  else {
-    // File is a template/theme
-    // Load its CSS, if it exists
-    if (file_exists($stylesheet = dirname($themes[$theme]->filename) .'/style.css')) {
-      theme_add_style($stylesheet);
-    }
-  }
-
-  if (strpos($themes[$theme]->filename, '.theme')) {
-   // file is a theme; include it
-   include_once './' . $themes[$theme]->filename;
-  }
-  elseif (strpos($themes[$theme]->description, '.engine')) {
-    // file is a template; include its engine
-    include_once './' . $themes[$theme]->description;
-    $theme_engine = basename($themes[$theme]->description, '.engine');
-    if (function_exists($theme_engine .'_init')) {
-      call_user_func($theme_engine .'_init', $themes[$theme]);
-    }
-  }
-}
-
-/**
- * Provides a list of currently available themes.
- *
- * @param $refresh
- *   Whether to reload the list of themes from the database.
- * @return
- *   An array of the currently available themes.
- */
-function list_themes($refresh = FALSE) {
-  static $list;
-
-  if ($refresh) {
-    unset($list);
-  }
-
-  if (!$list) {
-    $list = array();
-    $result = db_query("SELECT * FROM {system} WHERE type = 'theme'");
-    while ($theme = db_fetch_object($result)) {
-      if (file_exists($theme->filename)) {
-        $list[$theme->name] = $theme;
-      }
-    }
-  }
-
-  return $list;
-}
-
-/**
- * Provides a list of currently available theme engines
- *
- * @param $refresh
- *   Whether to reload the list of themes from the database.
- * @return
- *   An array of the currently available theme engines.
- */
-function list_theme_engines($refresh = FALSE) {
-  static $list;
-
-  if ($refresh) {
-    unset($list);
-  }
-
-  if (!$list) {
-    $list = array();
-    $result = db_query("SELECT * FROM {system} WHERE type = 'theme_engine' AND status = '1' ORDER BY name");
-    while ($engine = db_fetch_object($result)) {
-      if (file_exists($engine->filename)) {
-        $list[$engine->name] = $engine;
-      }
-    }
-  }
-
-  return $list;
-}
-
-/**
- * Generate the themed representation of a Drupal object.
- *
- * All requests for themed functions must go through this function. It examines
- * the request and routes it to the appropriate theme function. If the current
- * theme does not implement the requested function, then the current theme
- * engine is checked. If neither the engine nor theme implement the requested
- * function, then the base theme function is called.
- *
- * For example, to retrieve the HTML that is output by theme_page($output), a
- * module should call theme('page', $output).
- *
- * @param $function
- *   The name of the theme function to call.
- * @param ...
- *   Additional arguments to pass along to the theme function.
- * @return
- *   An HTML string that generates the themed output.
- */
-function theme() {
-  $args = func_get_args();
-  $function = array_shift($args);
-
-  if ($func = theme_get_function($function)) {
-    return call_user_func_array($func, $args);
-  }
-}
-
-/**
- * Determine if a theme function exists, and if so return which one was found.
- *
- * @param $function
- *   The name of the theme function to test.
- * @return
- *   The name of the theme function that should be used, or false if no function exists.
- */
-function theme_get_function($function) {
-  global $theme, $theme_engine;
-
-  // Because theme() is called a lot, calling init_theme() only to have it
-  // smartly return is a noticeable performance hit.   Don't do it.
-  if (!isset($theme)) {
-    init_theme();
-  }
-
-  if (($theme != '') && function_exists($theme .'_'. $function)) {
-    // call theme function
-    return $theme .'_'. $function;
-  }
-  elseif (($theme != '') && isset($theme_engine) && function_exists($theme_engine .'_'. $function)) {
-    // call engine function
-    return $theme_engine .'_'. $function;
-  }
-  elseif (function_exists('theme_'. $function)){
-    // call Drupal function
-    return 'theme_'. $function;
-  }
-  return false;
-}
-
-/**
- * Return the path to the currently selected theme.
- */
-function path_to_theme() {
-  global $theme;
-
-  $themes = list_themes();
-
-  return dirname($themes[$theme]->filename);
-}
-
-/**
- * Retrieve an associative array containing the settings for a theme.
- *
- * The final settings are arrived at by merging the default settings,
- * the site-wide settings, and the settings defined for the specific theme.
- * If no $key was specified, only the site-wide theme defaults are retrieved.
- *
- * The default values for each of settings are also defined in this function.
- * To add new settings, add their default values here, and then add form elements
- * to system_theme_settings() in system.module.
- *
- * @param $key
- *  The template/style value for a given theme.
- *
- * @return
- *   An associative array containing theme settings.
- */
-function theme_get_settings($key = NULL) {
-  $defaults = array(
-    'mission'                       =>  '',
-    'default_logo'                  =>  1,
-    'logo_path'                     =>  '',
-    'default_favicon'               =>  1,
-    'favicon_path'                  =>  '',
-    'toggle_logo'                   =>  1,
-    'toggle_favicon'                =>  1,
-    'toggle_name'                   =>  1,
-    'toggle_search'                 =>  1,
-    'toggle_slogan'                 =>  0,
-    'toggle_mission'                =>  1,
-    'toggle_node_user_picture'      =>  0,
-    'toggle_comment_user_picture'   =>  0,
-  );
-
-  if (module_exist('node')) {
-    foreach (node_get_types() as $type => $name) {
-      $defaults['toggle_node_info_' . $type] = 1;
-    }
-  }
-  $settings = array_merge($defaults, variable_get('theme_settings', array()));
-
-  if ($key) {
-    $settings = array_merge($settings, variable_get(str_replace('/', '_', 'theme_'. $key .'_settings'), array()));
-  }
-
-  // Only offer search box if search.module is enabled.
-  if (!module_exist('search') || !user_access('search content')) {
-    $settings['toggle_search'] = 0;
-  }
-
-  return $settings;
-}
-
-/**
- * Retrieve a setting for the current theme.
- * This function is designed for use from within themes & engines
- * to determine theme settings made in the admin interface.
- *
- * Caches values for speed (use $refresh = TRUE to refresh cache)
- *
- * @param $setting_name
- *  The name of the setting to be retrieved.
- *
- * @param $refresh
- *  Whether to reload the cache of settings.
- *
- * @return
- *   The value of the requested setting, NULL if the setting does not exist.
- */
-function theme_get_setting($setting_name, $refresh = FALSE) {
-  global $theme_key;
-  static $settings;
-
-  if (empty($settings) || $refresh) {
-    $settings = theme_get_settings($theme_key);
-
-    $themes = list_themes();
-    $theme_object = $themes[$theme_key];
-
-    if ($settings['mission'] == '') {
-      $settings['mission'] = variable_get('site_mission', '');
-    }
-
-    if (!$settings['toggle_mission']) {
-      $settings['mission'] = '';
-    }
-
-    if ($settings['toggle_logo']) {
-      if ($settings['default_logo']) {
-        $settings['logo'] = base_path() . dirname($theme_object->filename) .'/logo.png';
-      }
-      elseif ($settings['logo_path']) {
-        $settings['logo'] = base_path() . $settings['logo_path'];
-      }
-    }
-
-    if ($settings['toggle_favicon']) {
-      if ($settings['default_favicon']) {
-        if (file_exists($favicon = dirname($theme_object->filename) .'/favicon.ico')) {
-          $settings['favicon'] = base_path() . $favicon;
-        }
-        else {
-          $settings['favicon'] = base_path() . 'misc/favicon.ico';
-        }
-      }
-      elseif ($settings['favicon_path']) {
-        $settings['favicon'] = base_path() . $settings['favicon_path'];
-      }
-    }
-  }
-
-  return isset($settings[$setting_name]) ? $settings[$setting_name] : NULL;
-}
-
-/**
- * Add a theme stylesheet to be included later. This is handled separately from
- * drupal_set_html_head() to enforce the correct CSS cascading order.
- */
-function theme_add_style($path = '', $media = 'all') {
-  static $styles = array();
-
-  if ($path && !isset($styles["$media:$path"])) {
-    $style = new stdClass();
-    $style->path = base_path() . $path;
-    $style->media = $media;
-    $styles["$media:$path"] = $style;
-  }
-  return $styles;
-}
-
-/**
- * Return the HTML for a theme's stylesheets.
- */
-function theme_get_styles() {
-  $output = '';
-  foreach (theme_add_style() as $style) {
-    $output .= theme('stylesheet_import', $style->path, $style->media);
-  }
-  return $output;
-}
-
-/**
- * @defgroup themeable Themeable functions
- * @{
- * Functions that display HTML, and which can be customized by themes.
- *
- * All functions that produce HTML for display should be themeable. This means
- * that they should be named with the theme_ prefix, and invoked using theme()
- * rather than being called directly. This allows themes to override the display
- * of any Drupal object.
- *
- * The theme system is described and defined in theme.inc.
- */
-
-/**
- * Format a dynamic text string for emphasized display in a placeholder.
- *
- * E.g. t('Added term %term', array('%term' => theme('placeholder', $term)))
- *
- * @param $text
- *   The text to format (plain-text).
- * @return
- *   The formatted text (html).
- */
-function theme_placeholder($text) {
-  return '<em>'. check_plain($text) .'</em>';
-}
-
-/**
- * Return an entire Drupal page displaying the supplied content.
- *
- * @param $content
- *   A string to display in the main content area of the page.
- * @return
- *   A string containing the entire HTML page.
- */
-function theme_page($content) {
-  $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() ? strip_tags(drupal_get_title()) : variable_get('site_name', 'drupal')) .'</title>';
-  $output .= drupal_get_html_head();
-  $output .= theme_get_styles();
-
-  $output .= ' </head>';
-  $output .= ' <body style="background-color: #fff; color: #000;">';
-  $output .= '<table border="0" cellspacing="4" cellpadding="4"><tr><td style="vertical-align: top; width: 170px;">';
-
-  $output .= theme('blocks', 'all');
-  $output .= '</td><td style="vertical-align: top;">';
-
-  $output .= theme('breadcrumb', drupal_get_breadcrumb());
-  $output .= '<h1>' . drupal_get_title() . '</h1>';
-
-  if ($tabs = theme('menu_local_tasks')) {
-   $output .= $tabs;
-  }
-
-  $output .= theme('help');
-
-  $output .= theme('status_messages');
-
-  $output .= "\n<!-- begin content -->\n";
-  $output .= $content;
-  $output .= "\n<!-- end content -->\n";
-
-  $output .= '</td></tr></table>';
-  $output .= theme_closure();
-  $output .= '</body></html>';
-
-  return $output;
-}
-
-function theme_maintenance_page($content, $messages = TRUE, $partial = FALSE) {
-  drupal_set_header('Content-Type: text/html; charset=utf-8');
-  theme('add_style', 'misc/maintenance.css');
-  drupal_set_html_head('<link rel="shortcut icon" href="'. base_path() .'misc/favicon.ico" type="image/x-icon" />');
-
-  $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() .'</title>';
-  $output .= drupal_get_html_head();
-  $output .= theme_get_styles();
-  $output .= '</head>';
-  $output .= '<body>';
-  $output .= '<h1>' . drupal_get_title() . '</h1>';
-
-  if ($messages) {
-    $output .= theme('status_messages');
-  }
-
-  $output .= "\n<!-- begin content -->\n";
-  $output .= $content;
-  $output .= "\n<!-- end content -->\n";
-
-  if (!$partial) {
-    $output .= '</body></html>';
-  }
-
-  return $output;
-}
-
-/**
- * Returns themed set of status and/or error messages.  The messages are grouped
- * by type.
- *
- * @return
- *   A string containing the messages.
- */
-function theme_status_messages() {
-  if ($data = drupal_get_messages()) {
-    $output = '';
-    foreach ($data as $type => $messages) {
-      $output .= "<div class=\"messages $type\">\n";
-      if (count($messages) > 1) {
-        $output .= " <ul>\n";
-        foreach($messages as $message) {
-          $output .= '  <li>'. $message ."</li>\n";
-        }
-        $output .= " </ul>\n";
-      }
-      else {
-        $output .= $messages[0];
-      }
-      $output .= "</div>\n";
-    }
-
-    return $output;
-  }
-}
-
-/**
- * Return a themed set of links.
- *
- * @param $links
- *   An array of links to be themed.
- * @param $delimiter
- *   A string used to separate the links.
- * @return
- *   A string containing the themed links.
- */
-function theme_links($links, $delimiter = ' | ') {
-  if (!is_array($links)) {
-    return '';
-  }
-  return implode($delimiter, $links);
-}
-
-/**
- * Return a themed image.
- *
- * @param $path
- *   The path of the image file.
- * @param $alt
- *   The alternative text for text-based browsers.
- * @param $title
- *   The title text is displayed when the image is hovered in some popular browsers.
- * @param $attributes
- *   Associative array of attributes to be placed in the img tag.
- * @param $getsize
- *   If set to true, the image's dimension are fetched and added as width/height attributes.
- * @return
- *   A string containing the image tag.
- */
-function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
-  if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) {
-    $attributes = drupal_attributes($attributes);
-    return '<img src="'. check_url(base_path() . $path) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .' />';
-  }
-}
-
-/**
- * Return a themed breadcrumb trail.
- *
- * @param $breadcrumb
- *   An array containing the breadcrumb links.
- * @return a string containing the breadcrumb output.
- */
-function theme_breadcrumb($breadcrumb) {
-  if (!empty($breadcrumb)) {
-    return '<div class="breadcrumb">'. implode(' » ', $breadcrumb) .'</div>';
-  }
-}
-
-/**
- * Return a themed help message.
- *
- * @return a string containing the helptext for the current page.
- */
-function theme_help() {
-  if ($help = menu_get_active_help()) {
-    return '<div class="help">'. $help .'</div>';
-  }
-}
-
-/**
- * Return a themed node.
- *
- * @param $node
- *   An object providing all relevant information for displaying a node:
- *   - $node->nid: The ID of the node.
- *   - $node->type: The content type (story, blog, forum...).
- *   - $node->title: The title of the node.
- *   - $node->created: The creation date, as a UNIX timestamp.
- *   - $node->teaser: A shortened version of the node body.
- *   - $node->body: The entire node contents.
- *   - $node->changed: The last modification date, as a UNIX timestamp.
- *   - $node->uid: The ID of the author.
- *   - $node->username: The username of the author.
- * @param $teaser
- *   Whether to display the teaser only, as on the main page.
- * @param $page
- *   Whether to display the node as a standalone page. If TRUE, do not display
- *   the title because it will be provided by the menu system.
- * @return
- *   A string containing the node output.
- */
-function theme_node($node, $teaser = FALSE, $page = FALSE) {
-  if (!$node->status) {
-    $output  = '<div class="node-unpublished">';
-  }
-
-  if (module_exist('taxonomy')) {
-    $terms = taxonomy_link('taxonomy terms', $node);
-  }
-
-  if ($page == 0) {
-    $output .= t('%title by %name', array('%title' => '<h2 class="title">'. check_plain($node->title) .'</h2>', '%name' => theme('username', $node)));
-  }
-  else {
-    $output .= t('by %name', array('%name' => theme('username', $node)));
-  }
-
-  if (count($terms)) {
-    $output .= ' <small>('. theme('links', $terms) .')</small><br />';
-  }
-
-  if ($teaser && $node->teaser) {
-    $output .= $node->teaser;
-  }
-  else {
-    $output .= $node->body;
-  }
-
-  if ($node->links) {
-    $output .= '<div class="links">'. theme('links', $node->links) .'</div>';
-  }
-
-  if (!$node->status) {
-    $output .= '</div>';
-  }
-
-  return $output;
-}
-
-/**
- * Return a themed form element.
- *
- * @param $title the form element's title
- * @param $value the form element's data
- * @param $description the form element's description or explanation
- * @param $id the form element's ID used by the &lt;label&gt; tag
- * @param $required a boolean to indicate whether this is a required field or not
- * @param $error a string with an error message filed against this form element
- *
- * @return a string representing the form element
- */
-function theme_form_element($title, $value, $description = NULL, $id = NULL, $required = FALSE, $error = FALSE) {
-
-  $output  = '<div class="form-item">'."\n";
-  $required = $required ? '<span class="form-required" title="'. t('This field is required.') .'">*</span>' : '';
-
-  if ($title) {
-    if ($id) {
-      $output .= ' <label for="'. form_clean_id($id) .'">'. t('%title: %required', array('%title' => $title, '%required' => $required)) . "</label>\n";
-    }
-    else {
-      $output .= ' <label>'. t('%title: %required', array('%title' => $title, '%required' => $required)) . "</label>\n";
-    }
-  }
-
-  $output .= " $value\n";
-
-  if ($description) {
-    $output .= ' <div class="description">'. $description ."</div>\n";
-  }
-
-  $output .= "</div>\n";
-
-  return $output;
-}
-
-/**
- * Return a themed submenu, typically displayed under the tabs.
- *
- * @param $links
- *   An array of links.
- */
-function theme_submenu($links) {
-  return '<div class="submenu">'. implode(' | ', $links) .'</div>';
-}
-
-/**
- * Return a themed table.
- *
- * @param $header
- *   An array containing the table headers. Each element of the array can be
- *   either a localized string or an associative array with the following keys:
- *   - "data": The localized title of the table column.
- *   - "field": The database field represented in the table column (required if
- *     user is to be able to sort on this column).
- *   - "sort": A default sort order for this column ("asc" or "desc").
- *   - Any HTML attributes, such as "colspan", to apply to the column header cell.
- * @param $rows
- *   An array of table rows. Every row is an array of cells, or an associative
- *   array with the following keys:
- *   - "data": an array of cells
- *   - Any HTML attributes, such as "class", to apply to the table row.
- *
- *   Each cell can be either a string or an associative array with the following keys:
- *   - "data": The string to display in the table cell.
- *   - Any HTML attributes, such as "colspan", to apply to the table cell.
- *
- *   Here's an example for $rows:
- *   @verbatim
- *   $rows = array(
- *     // Simple row
- *     array(
- *       'Cell 1', 'Cell 2', 'Cell 3'
- *     ),
- *     // Row with attributes on the row and some of its cells.
- *     array(
- *       'data' => array('Cell 1', array('data' => 'Cell 2', 'colspan' => 2)), 'class' => 'funky'
- *     )
- *   );
- *   @endverbatim
- *
- * @param $attributes
- *   An array of HTML attributes to apply to the table tag.
- * @param $caption
- *   A localized string to use for the <caption> tag.
- * @return
- *   An HTML string representing the table.
- */
-function theme_table($header, $rows, $attributes = array(), $caption = NULL) {
-  $output = '<table'. drupal_attributes($attributes) .">\n";
-
-  if (isset($caption)) {
-    $output .= '<caption>'. $caption ."</caption>\n";
-  }
-
-  // Format the table header:
-  if (count($header)) {
-    $ts = tablesort_init($header);
-    $output .= ' <thead><tr>';
-    foreach ($header as $cell) {
-      $cell = tablesort_header($cell, $header, $ts);
-      $output .= _theme_table_cell($cell, 1);
-    }
-    $output .= " </tr></thead>\n";
-  }
-
-  // Format the table rows:
-  $output .= "<tbody>\n";
-  if (count($rows)) {
-    foreach ($rows as $number => $row) {
-      $attributes = array();
-
-      // Check if we're dealing with a simple or complex row
-      if (isset($row['data'])) {
-        foreach ($row as $key => $value) {
-          if ($key == 'data') {
-            $cells = $value;
-          }
-          else {
-            $attributes[$key] = $value;
-          }
-        }
-      }
-      else {
-        $cells = $row;
-      }
-
-      // Add odd/even class
-      $class = ($number % 2 == 1) ? 'even': 'odd';
-      if (isset($attributes['class'])) {
-        $attributes['class'] .= ' '. $class;
-      }
-      else {
-        $attributes['class'] = $class;
-      }
-
-      // Build row
-      $output .= ' <tr'. drupal_attributes($attributes) .'>';
-      $i = 0;
-      foreach ($cells as $cell) {
-        $cell = tablesort_cell($cell, $header, $ts, $i++);
-        $output .= _theme_table_cell($cell, 0);
-      }
-      $output .= " </tr>\n";
-    }
-  }
-
-  $output .= "</tbody></table>\n";
-  return $output;
-}
-
-/**
- * Return a themed sort icon.
- *
- * @param $style
- *   Set to either asc or desc.  This sets which icon to show.
- * @return
- *   A themed sort icon.
- */
-function theme_tablesort_indicator($style) {
-  if ($style == "asc"){
-    return theme('image', 'misc/arrow-asc.png', t('sort icon'), t('sort ascending'));
-  }
-  else {
-    return theme('image', 'misc/arrow-desc.png', t('sort icon'), t('sort descending'));
-  }
-}
-
-/**
- * Return a themed box.
- *
- * @param $title
- *   The subject of the box.
- * @param $content
- *   The content of the box.
- * @param $region
- *   The region in which the box is displayed.
- * @return
- *   A string containing the box output.
- */
-function theme_box($title, $content, $region = 'main') {
-  $output = '<h2 class="title">'. $title .'</h2><div>'. $content .'</div>';
-  return $output;
-}
-
-/**
- * Return a themed block.
- *
- * You can style your blocks by defining .block (all blocks),
- * .block-<i>module</i> (all blocks of module <i>module</i>), and
- * \#block-<i>module</i>-<i>delta</i> (specific block of module <i>module</i>
- * with delta <i>delta</i>) in your theme's CSS.
- *
- * @param $block
- *   An object populated with fields from the "blocks" database table
- *   ($block->module, $block->delta ...) and fields returned by
- *   <i>module</i>_block('view') ($block->subject, $block->content, ...).
- * @return
- *   A string containing the block output.
- */
-function theme_block($block) {
-  $output  = "<div class=\"block block-$block->module\" id=\"block-$block->module-$block->delta\">\n";
-  $output .= " <h2 class=\"title\">$block->subject</h2>\n";
-  $output .= " <div class=\"content\">$block->content</div>\n";
-  $output .= "</div>\n";
-  return $output;
-}
-
-/**
- * Return a themed marker, useful for marking new or updated
- * content.
- *
- * @param $type
- *   Number representing the marker type to display
- * @see MARK_NEW, MARK_UPDATED, MARK_READ
- * @return
- *   A string containing the marker.
- */
-function theme_mark($type = MARK_NEW) {
-  global $user;
-  if ($user->uid) {
-    if ($type == MARK_NEW) {
-      return ' <span class="marker">'. t('new') .'</span>';
-    }
-    else if ($type == MARK_UPDATED) {
-      return ' <span class="marker">'. t('updated') .'</span>';
-    }
-  }
-}
-
-/**
- * Import a stylesheet using @import.
- *
- * @param $path
- *  The path to the stylesheet.
- *
- * @param $media
- *  The media type to specify for the stylesheet
- *
- * @return
- *  A string containing the HTML for the stylesheet import.
- */
-function theme_stylesheet_import($path, $media = 'all') {
-  return '<style type="text/css" media="'. $media .'">@import "'. $path .'";</style>';
-}
-
-/**
- * Return a themed list of items.
- *
- * @param $items
- *   An array of items to be displayed in the list.
- * @param $title
- *   The title of the list.
- * @param $type
- *   The type of list to return (e.g. "ul", "ol")
- * @return
- *   A string containing the list output.
- */
-function theme_item_list($items = array(), $title = NULL, $type = 'ul') {
-  $output = '<div class="item-list">';
-  if (isset($title)) {
-    $output .= '<h3>'. $title .'</h3>';
-  }
-
-  if (!empty($items)) {
-    $output .= "<$type>";
-    foreach ($items as $item) {
-      $output .= '<li>'. $item .'</li>';
-    }
-    $output .= "</$type>";
-  }
-  $output .= '</div>';
-  return $output;
-}
-
-/**
- * Returns code that emits the 'more help'-link.
- */
-function theme_more_help_link($url) {
-  return '<div class="more-help-link">' . t('[<a href="%link">more help...</a>]', array('%link' => check_url($url))) . '</div>';
-}
-
-/**
- * Return code that emits an XML icon.
- */
-function theme_xml_icon($url) {
-  if ($image = theme('image', 'misc/xml.png', t('XML feed'), t('XML feed'))) {
-    return '<a href="'. check_url($url) .'" class="xml-icon">'. $image. '</a>';
-  }
-}
-
-/**
- * Return code that emits an feed icon.
- */
-function theme_feed_icon($url) {
-  if ($image = theme('image', 'misc/feed.png', t('Syndicate content'), t('Syndicate content'))) {
-    return '<a href="'. check_url($url) .'" class="feed-icon">'. $image. '</a>';
-  }
-}
-
-/**
- * Execute hook_footer() which is run at the end of the page right before the
- * close of the body tag.
- *
- * @param $main (optional)
- *
- * @return
- *   A string containing the results of the hook_footer() calls.
- */
-function theme_closure($main = 0) {
-  $footer = module_invoke_all('footer', $main);
-  return implode("\n", $footer);
-}
-
-/**
- * Return a set of blocks available for the current user.
- *
- * @param $region
- *   Which set of blocks to retrieve.
- * @return
- *   A string containing the themed blocks for this region.
- */
-function theme_blocks($region) {
-  $output = '';
-
-  if ($list = block_list($region)) {
-    foreach ($list as $key => $block) {
-      // $key == <i>module</i>_<i>delta</i>
-      $output .= theme('block', $block);
-    }
-  }
-
-  // Add any content assigned to this region through drupal_set_content() calls.
-  $output .= drupal_get_content($region);
-
-  return $output;
-}
-
-/**
- * Format a username.
- *
- * @param $object
- *   The user object to format, usually returned from user_load().
- * @return
- *   A string containing an HTML link to the user's page if the passed object
- *   suggests that this is a site user. Otherwise, only the username is returned.
- */
-function theme_username($object) {
-
-  if ($object->uid && $object->name) {
-    // Shorten the name when it is too long or it will break many tables.
-    if (drupal_strlen($object->name) > 20) {
-      $name = drupal_substr($object->name, 0, 15) .'...';
-    }
-    else {
-      $name = $object->name;
-    }
-
-    if (user_access('access user profiles')) {
-      $output = l($name, 'user/'. $object->uid, array('title' => t('View user profile.')));
-    }
-    else {
-      $output = check_plain($name);
-    }
-  }
-  else if ($object->name) {
-    // Sometimes modules display content composed by people who are
-    // not registered members of the site (e.g. mailing list or news
-    // aggregator modules). This clause enables modules to display
-    // the true author of the content.
-    if ($object->homepage) {
-      $output = l($object->name, $object->homepage);
-    }
-    else {
-      $output = check_plain($object->name);
-    }
-
-    $output .= ' ('. t('not verified') .')';
-  }
-  else {
-    $output = variable_get('anonymous', 'Anonymous');
-  }
-
-  return $output;
-}
-
-function theme_progress_bar($percent, $message) {
-  $output = '<div id="progress" class="progress">';
-  $output .= '<div class="percentage">'. $percent .'%</div>';
-  $output .= '<div class="status">'. $message .'</div>';
-  $output .= '<div class="bar"><div class="filled" style="width: '. $percent .'%"></div></div>';
-  $output .= '</div>';
-
-  return $output;
-}
-
-/**
- * @} End of "defgroup themeable".
- */
-
-function _theme_table_cell($cell, $header = 0) {
-  $attributes = '';
-
-  if (is_array($cell)) {
-    $data = $cell['data'];
-    foreach ($cell as $key => $value) {
-      if ($key != 'data')  {
-        $attributes .= " $key=\"$value\"";
-      }
-    }
-  }
-  else {
-    $data = $cell;
-  }
-
-  if ($header) {
-    $output = "<th$attributes>$data</th>";
-  }
-  else {
-    $output = "<td$attributes>$data</td>";
-  }
-
-  return $output;
-}
-
diff --git a/includes/unicode.inc b/includes/unicode.inc
deleted file mode 100644 (file)
index d520cc6..0000000
+++ /dev/null
@@ -1,487 +0,0 @@
-<?php
-// $Id: unicode.inc 144 2007-03-28 07:52:20Z thierry $
-
-define('UNICODE_ERROR', -1);
-define('UNICODE_SINGLEBYTE', 0);
-define('UNICODE_MULTIBYTE', 1);
-
-/**
- * Wrapper around _unicode_check().
- */
-function unicode_check() {
-  $GLOBALS['multibyte'] = _unicode_check();
-}
-
-/**
- * Perform checks about Unicode support in PHP, and set the right settings if
- * needed.
- *
- * Because Drupal needs to be able to handle text in various encodings, we do
- * not support mbstring function overloading. HTTP input/output conversion must
- * be disabled for similar reasons.
- *
- * @param $errors
- *   Whether to report any fatal errors with form_set_error().
- */
-function _unicode_check($errors = false) {
-  // Set the standard C locale to ensure consistent, ASCII-only string handling.
-  setlocale(LC_CTYPE, 'C');
-
-  // Check for outdated PCRE library
-  // Note: we check if U+E2 is in the range U+E0 - U+E1. This test returns TRUE on old PCRE versions.
-  if (preg_match('/[à-á]/u', 'â')) {
-    if ($errors) {
-      form_set_error('unicode', t('The PCRE library in your PHP installation is outdated. This will cause problems when handling Unicode text. If you are running PHP 4.3.3 or higher, make sure you are using the PCRE library supplied by PHP. Please refer to the <a href="%url">PHP PCRE documentation</a> for more information.', array('%url' => 'http://www.php.net/pcre')));
-    }
-    return UNICODE_ERROR;
-  }
-
-  // Check for mbstring extension
-  if (!function_exists('mb_strlen')) {
-    return UNICODE_SINGLEBYTE;
-  }
-
-  // Check mbstring configuration
-  if (ini_get('mbstring.func_overload') != 0) {
-    if ($errors) {
-      form_set_error('unicode', t('Multibyte string function overloading in PHP is active and must be disabled. Check the php.ini <em>mbstring.func_overload</em> setting. Please refer to the <a href="%url">PHP mbstring documentation</a> for more information.', array('%url' => 'http://www.php.net/mbstring')));
-    }
-    return UNICODE_ERROR;
-  }
-  if (ini_get('mbstring.encoding_translation') != 0) {
-    if ($errors) {
-      form_set_error('unicode', t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.encoding_translation</em> setting. Please refer to the <a href="%url">PHP mbstring documentation</a> for more information.', array('%url' => 'http://www.php.net/mbstring')));
-    }
-    return UNICODE_ERROR;
-  }
-  if (ini_get('mbstring.http_input') != 'pass') {
-    if ($errors) {
-      form_set_error('unicode', t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.http_input</em> setting. Please refer to the <a href="%url">PHP mbstring documentation</a> for more information.', array('%url' => 'http://www.php.net/mbstring')));
-    }
-    return UNICODE_ERROR;
-  }
-  if (ini_get('mbstring.http_output') != 'pass') {
-    if ($errors) {
-      form_set_error('unicode', t('Multibyte string output conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.http_output</em> setting. Please refer to the <a href="%url">PHP mbstring documentation</a> for more information.', array('%url' => 'http://www.php.net/mbstring')));
-    }
-    return UNICODE_ERROR;
-  }
-
-  // Set appropriate configuration
-  mb_internal_encoding('utf-8');
-  mb_language('uni');
-  return UNICODE_MULTIBYTE;
-}
-
-/**
- * Return the required Unicode status and errors for admin/settings.
- */
-function unicode_settings() {
-  $status = _unicode_check(true);
-  $options = array(UNICODE_SINGLEBYTE => t('Standard PHP: operations on Unicode strings are emulated on a best-effort basis. Install the <a href="%url">PHP mbstring extension</a> for improved Unicode support.', array('%url' => 'http://www.php.net/mbstring')),
-                   UNICODE_MULTIBYTE => t('Multi-byte: operations on Unicode strings are supported through the <a href="%url">PHP mbstring extension</a>.', array('%url' => 'http://www.php.net/mbstring')),
-                   UNICODE_ERROR => t('Invalid: the current configuration is incompatible with Drupal.'));
-  $form['settings'] = array('#type' => 'item', '#title' => t('String handling method'), '#value' => $options[$status]);
-  return $form;
-}
-
-/**
- * Prepare a new XML parser.
- *
- * This is a 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 used instead of xml_parser_create(), because PHP 4's XML parser doesn't
- * check the input encoding itself. "Starting from PHP 5, the input encoding is
- * automatically detected, so that the encoding parameter specifies only the
- * output encoding."
- *
- * This is also where unsupported encodings will be converted. Callers should
- * take this into account: $data might have been changed after the call.
- *
- * @param &$data
- *   The XML data which will be parsed later.
- * @return
- *   An XML parser object.
- */
-function drupal_xml_parser_create(&$data) {
-  // Default XML encoding is UTF-8
-  $encoding = 'utf-8';
-  $bom = false;
-
-  // Check for UTF-8 byte order mark (PHP5's XML parser doesn't handle it).
-  if (!strncmp($data, "\xEF\xBB\xBF", 3)) {
-    $bom = true;
-    $data = substr($data, 3);
-  }
-
-  // Check for an encoding declaration in the XML prolog if no BOM was found.
-  if (!$bom && ereg('^<\?xml[^>]+encoding="([^"]+)"', $data, $match)) {
-    $encoding = $match[1];
-  }
-
-  // Unsupported encodings are converted here into UTF-8.
-  $php_supported = array('utf-8', 'iso-8859-1', 'us-ascii');
-  if (!in_array(strtolower($encoding), $php_supported)) {
-    $out = drupal_convert_to_utf8($data, $encoding);
-    if ($out !== false) {
-      $encoding = 'utf-8';
-      $data = ereg_replace('^(<\?xml[^>]+encoding)="([^"]+)"', '\\1="utf-8"', $out);
-    }
-    else {
-      watchdog('php', t("Could not convert XML encoding '%s' to UTF-8.", array('%s' => $encoding)), WATCHDOG_WARNING);
-      return 0;
-    }
-  }
-
-  $xml_parser = xml_parser_create($encoding);
-  xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, 'utf-8');
-  return $xml_parser;
-}
-
-/**
- * Convert data to UTF-8
- *
- * Requires the iconv, GNU recode or mbstring PHP extension.
- *
- * @param $data
- *   The data to be converted.
- * @param $encoding
- *   The encoding that the data is in
- * @return
- *   Converted data or FALSE.
- */
-function drupal_convert_to_utf8($data, $encoding) {
-  if (function_exists('iconv')) {
-    $out = @iconv($encoding, 'utf-8', $data);
-  }
-  else if (function_exists('mb_convert_encoding')) {
-    $out = @mb_convert_encoding($data, 'utf-8', $encoding);
-  }
-  else if (function_exists('recode_string')) {
-    $out = @recode_string($encoding .'..utf-8', $data);
-  }
-  else {
-    watchdog('php', t("Unsupported encoding '%s'. Please install iconv, GNU recode or mbstring for PHP.", array('%s' => $encoding)), WATCHDOG_ERROR);
-    return FALSE;
-  }
-
-  return $out;
-}
-
-/**
- * Truncate a UTF-8-encoded string safely to a number of bytes.
- *
- * 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.
- * @param $wordsafe
- *   Flag to truncate at nearest space. Defaults to FALSE.
- * @return
- *   The truncated string.
- */
-function truncate_utf8($string, $len, $wordsafe = FALSE, $dots = FALSE) {
-  $slen = strlen($string);
-  if ($slen <= $len) {
-    return $string;
-  }
-  if ($wordsafe) {
-    $end = $len;
-    while (($string[--$len] != ' ') && ($len > 0)) {};
-    if ($len == 0) {
-      $len = $end;
-    }
-  }
-  if ((ord($string[$len]) < 0x80) || (ord($string[$len]) >= 0xC0)) {
-    return substr($string, 0, $len) . ($dots ? ' ...' : '');
-  }
-  while (--$len >= 0 && ord($string[$len]) >= 0x80 && ord($string[$len]) < 0xC0) {};
-  return substr($string, 0, $len) . ($dots ? ' ...' : '');
-}
-
-/**
- * Encodes MIME/HTTP header values that contain non-ASCII, UTF-8 encoded
- * characters.
- *
- * For example, mime_header_encode('tést.txt') returns "=?UTF-8?B?dMOpc3QudHh0?=".
- *
- * See http://www.rfc-editor.org/rfc/rfc2047.txt for more information.
- *
- * Notes:
- * - Only encode strings that contain non-ASCII characters.
- * - We progressively cut-off a chunk with truncate_utf8(). This is to ensure
- *   each chunk starts and ends on a character boundary.
- * - Using \n as the chunk separator may cause problems on some systems and may
- *   have to be changed to \r\n or \r.
- */
-function mime_header_encode($string) {
-  if (preg_match('/[^\x20-\x7E]/', $string)) {
-    $chunk_size = 47; // floor((75 - strlen("=?UTF-8?B??=")) * 0.75);
-    $len = strlen($string);
-    $output = '';
-    while ($len > 0) {
-      $chunk = truncate_utf8($string, $chunk_size);
-      $output .= ' =?UTF-8?B?'. base64_encode($chunk) ."?=\n";
-      $c = strlen($chunk);
-      $string = substr($string, $c);
-      $len -= $c;
-    }
-    return trim($output);
-  }
-  return $string;
-}
-
-/**
- * Complement to mime_header_encode
- */
-function mime_header_decode($header) {
-  // First step: encoded chunks followed by other encoded chunks (need to collapse whitespace)
-  $header = preg_replace_callback('/=\?([^?]+)\?(Q|B)\?([^?]+|\?(?!=))\?=\s+(?==\?)/', '_mime_header_decode', $header);
-  // Second step: remaining chunks (do not collapse whitespace)
-  return preg_replace_callback('/=\?([^?]+)\?(Q|B)\?([^?]+|\?(?!=))\?=/', '_mime_header_decode', $header);
-}
-
-/**
- * Helper function to mime_header_decode
- */
-function _mime_header_decode($matches) {
-  // Regexp groups:
-  // 1: Character set name
-  // 2: Escaping method (Q or B)
-  // 3: Encoded data
-  $data = ($matches[2] == 'B') ? base64_decode($matches[3]) : str_replace('_', ' ', quoted_printable_decode($matches[3]));
-  if (strtolower($matches[1]) != 'utf-8') {
-    $data = drupal_convert_to_utf8($data, $matches[1]);
-  }
-  return $data;
-}
-
-/**
- * Decode all HTML entities (including numerical ones) to regular UTF-8 bytes.
- * Double-escaped entities will only be decoded once ("&amp;lt;" becomes "&lt;", not "<").
- *
- * @param $text
- *   The text to decode entities in.
- * @param $exclude
- *   An array of characters which should not be decoded. For example,
- *   array('<', '&', '"'). This affects both named and numerical entities.
- */
-function decode_entities($text, $exclude = array()) {
-  static $table;
-  // We store named entities in a table for quick processing.
-  if (!isset($table)) {
-    // Get all named HTML entities.
-    $table = array_flip(get_html_translation_table(HTML_ENTITIES));
-    // PHP gives us ISO-8859-1 data, we need UTF-8.
-    $table = array_map('utf8_encode', $table);
-    // Add apostrophe (XML)
-    $table['&apos;'] = "'";
-  }
-  $newtable = array_diff($table, $exclude);
-
-  // Use a regexp to select all entities in one pass, to avoid decoding double-escaped entities twice.
-  return preg_replace('/&(#x?)?([A-Za-z0-9]+);/e', '_decode_entities("$1", "$2", "$0", $newtable, $exclude)', $text);
-}
-
-/**
- * Helper function for decode_entities
- */
-function _decode_entities($prefix, $codepoint, $original, &$table, &$exclude) {
-  // Named entity
-  if (!$prefix) {
-    if (isset($table[$original])) {
-      return $table[$original];
-    }
-    else {
-      return $original;
-    }
-  }
-  // Hexadecimal numerical entity
-  if ($prefix == '#x') {
-    $codepoint = base_convert($codepoint, 16, 10);
-  }
-  // Decimal numerical entity (strip leading zeros to avoid PHP octal notation)
-  else {
-    $codepoint = preg_replace('/^0+/', '', $codepoint);
-  }
-  // Encode codepoint as UTF-8 bytes
-  if ($codepoint < 0x80) {
-    $str = chr($codepoint);
-  }
-  else if ($codepoint < 0x800) {
-    $str = chr(0xC0 | ($codepoint >> 6))
-         . chr(0x80 | ($codepoint & 0x3F));
-  }
-  else if ($codepoint < 0x10000) {
-    $str = chr(0xE0 | ( $codepoint >> 12))
-         . chr(0x80 | (($codepoint >> 6) & 0x3F))
-         . chr(0x80 | ( $codepoint       & 0x3F));
-  }
-  else if ($codepoint < 0x200000) {
-    $str = chr(0xF0 | ( $codepoint >> 18))
-         . chr(0x80 | (($codepoint >> 12) & 0x3F))
-         . chr(0x80 | (($codepoint >> 6)  & 0x3F))
-         . chr(0x80 | ( $codepoint        & 0x3F));
-  }
-  // Check for excluded characters
-  if (in_array($str, $exclude)) {
-    return $original;
-  }
-  else {
-    return $str;
-  }
-}
-
-/**
- * Count the amount of characters in a UTF-8 string. This is less than or
- * equal to the byte count.
- */
-function drupal_strlen($text) {
-  global $multibyte;
-  if ($multibyte == UNICODE_MULTIBYTE) {
-    return mb_strlen($text);
-  }
-  else {
-    // Do not count UTF-8 continuation bytes.
-    return strlen(preg_replace("/[\x80-\xBF]/", '', $text));
-  }
-}
-
-/**
- * Uppercase a UTF-8 string.
- */
-function drupal_strtoupper($text) {
-  global $multibyte;
-  if ($multibyte == UNICODE_MULTIBYTE) {
-    return mb_strtoupper($text);
-  }
-  else {
-    // Use C-locale for ASCII-only uppercase
-    $text = strtoupper($text);
-    // Case flip Latin-1 accented letters
-    $text = preg_replace_callback('/\xC3[\xA0-\xB6\xB8-\xBE]/', '_unicode_caseflip', $text);
-    return $text;
-  }
-}
-
-/**
- * Lowercase a UTF-8 string.
- */
-function drupal_strtolower($text) {
-  global $multibyte;
-  if ($multibyte == UNICODE_MULTIBYTE) {
-    return mb_strtolower($text);
-  }
-  else {
-    // Use C-locale for ASCII-only lowercase
-    $text = strtolower($text);
-    // Case flip Latin-1 accented letters
-    $text = preg_replace_callback('/\xC3[\x80-\x96\x98-\x9E]/', '_unicode_caseflip', $text);
-    return $text;
-  }
-}
-
-/**
- * Helper function for case conversion of Latin-1.
- * Used for flipping U+C0-U+DE to U+E0-U+FD and back.
- */
-function _unicode_caseflip($matches) {
-  return $matches[0][0] . chr(ord($matches[0][1]) ^ 32);
-}
-
-/**
- * Capitalize the first letter of a UTF-8 string.
- */
-function drupal_ucfirst($text) {
-  // Note: no mbstring equivalent!
-  return drupal_strtoupper(drupal_substr($text, 0, 1)) . drupal_substr($text, 1);
-}
-
-/**
- * Cut off a piece of a string based on character indices and counts. Follows
- * the same behaviour as PHP's own substr() function.
- *
- * Note that for cutting off a string at a known character/substring
- * location, the usage of PHP's normal strpos/substr is safe and
- * much faster.
- */
-function drupal_substr($text, $start, $length = NULL) {
-  global $multibyte;
-  if ($multibyte == UNICODE_MULTIBYTE) {
-    return $length === NULL ? mb_substr($text, $start) : mb_substr($text, $start, $length);
-  }
-  else {
-    $strlen = strlen($text);
-    // Find the starting byte offset
-    if ($start > 0) {
-      // Count all the continuation bytes from the start until we have found
-      // $start characters
-      $bytes = -1; $chars = -1;
-      while ($bytes < $strlen && $chars < $start) {
-        $bytes++;
-        $c = ord($text[$bytes]);
-        if ($c < 0x80 || $c >= 0xC0) {
-          $chars++;
-        }
-      }
-    }
-    else if ($start < 0) {
-      // Count all the continuation bytes from the end until we have found
-      // abs($start) characters
-      $start = abs($start);
-      $bytes = $strlen; $chars = 0;
-      while ($bytes > 0 && $chars < $start) {
-        $bytes--;
-        $c = ord($text[$bytes]);
-        if ($c < 0x80 || $c >= 0xC0) {
-          $chars++;
-        }
-      }
-    }
-    $istart = $bytes;
-
-    // Find the ending byte offset
-    if ($length === NULL) {
-      $bytes = $strlen - 1;
-    }
-    else if ($length > 0) {
-      // Count all the continuation bytes from the starting index until we have
-      // found $length + 1 characters. Then backtrack one byte.
-      $bytes = $istart; $chars = 0;
-      while ($bytes < $strlen && $chars < $length) {
-        $bytes++;
-        $c = ord($text[$bytes]);
-        if ($c < 0x80 || $c >= 0xC0) {
-          $chars++;
-        }
-      }
-      $bytes--;
-    }
-    else if ($length < 0) {
-      // Count all the continuation bytes from the end until we have found
-      // abs($length) characters
-      $length = abs($length);
-      $bytes = $strlen - 1; $chars = 0;
-      while ($bytes >= 0 && $chars < $length) {
-        $c = ord($text[$bytes]);
-        if ($c < 0x80 || $c >= 0xC0) {
-          $chars++;
-        }
-        $bytes--;
-      }
-    }
-    $iend = $bytes;
-
-    return substr($text, $istart, max(0, $iend - $istart + 1));
-  }
-}
-
-
diff --git a/includes/xmlrpc.inc b/includes/xmlrpc.inc
deleted file mode 100644 (file)
index 129dc5c..0000000
+++ /dev/null
@@ -1,476 +0,0 @@
-<?php
-// $Id: xmlrpc.inc 144 2007-03-28 07:52:20Z thierry $
-
-/*
-  Drupal XML-RPC library. Based on the IXR - The Incutio XML-RPC Library - (c) Incutio Ltd 2002-2005
-   Version 1.7 (beta) - Simon Willison, 23rd May 2005
-   Site:   http://scripts.incutio.com/xmlrpc/
-   Manual: http://scripts.incutio.com/xmlrpc/manual.php
-   This version is made available under the GNU GPL License
-*/
-
-/**
- * Recursively turn a data structure into objects with 'data' and 'type' attributes.
- *
- * @param $data
- *   The data structure.
- * @param  $type
- *   Optional type assign to $data.
- * @return
- *   Object.
- */
-function xmlrpc_value($data, $type = FALSE) {
-  $xmlrpc_value = new stdClass();
-  $xmlrpc_value->data = $data;
-  if (!$type) {
-    $type = xmlrpc_value_calculate_type($xmlrpc_value);
-  }
-  $xmlrpc_value->type = $type;
-  if ($type == 'struct') {
-    // Turn all the values in the array into new xmlrpc_values
-    foreach ($xmlrpc_value->data as $key => $value) {
-      $xmlrpc_value->data[$key] = xmlrpc_value($value);
-    }
-  }
-  if ($type == 'array') {
-    for ($i = 0, $j = count($xmlrpc_value->data); $i < $j; $i++) {
-      $xmlrpc_value->data[$i] = xmlrpc_value($xmlrpc_value->data[$i]);
-    }
-  }
-  return $xmlrpc_value;
-}
-
-/**
- * Map PHP type to XML-RPC type.
- *
- * @param $xmlrpc_value
- *   Variable whose type should be mapped.
- * @return
- *   XML-RPC type as string.
- * @see
- *   http://www.xmlrpc.com/spec#scalars
- */
-function xmlrpc_value_calculate_type(&$xmlrpc_value) {
-  // http://www.php.net/gettype: Never use gettype() to test for a certain type [...] Instead, use the is_* functions.
-  if (is_bool($xmlrpc_value->data)) {
-    return 'boolean';
-  }
-  if (is_double($xmlrpc_value->data)) {
-    return 'double';
-  }
-  if (is_int($xmlrpc_value->data)) {
-      return 'int';
-  }
-  if (is_array($xmlrpc_value->data)) {
-    // empty or integer-indexed arrays are 'array', string-indexed arrays 'struct'
-    return empty($xmlrpc_value->data) || range(0, count($xmlrpc_value->data) - 1) === array_keys($xmlrpc_value->data) ? 'array' : 'struct';
-  }
-  if (is_object($xmlrpc_value->data)) {
-    if ($xmlrpc_value->data->is_date) {
-      return 'date';
-    }
-    if ($xmlrpc_value->data->is_base64) {
-      return 'base64';
-    }
-    $xmlrpc_value->data = get_object_vars($xmlrpc_value->data);
-    return 'struct';
-  }
-  // default
-  return 'string';
-}
-
-/**
- * Generate XML representing the given value.
- *
- * @param $xmlrpc_value
- * @return
- *   XML representation of value.
- */
-function xmlrpc_value_get_xml($xmlrpc_value) {
-  switch ($xmlrpc_value->type) {
-    case 'boolean':
-      return '<boolean>'. (($xmlrpc_value->data) ? '1' : '0') .'</boolean>';
-      break;
-    case 'int':
-      return '<int>'. $xmlrpc_value->data .'</int>';
-      break;
-    case 'double':
-      return '<double>'. $xmlrpc_value->data .'</double>';
-      break;
-    case 'string':
-      // Note: we don't escape apostrophes because of the many blogging clients
-      // that don't support numerical entities (and XML in general) properly.
-      return '<string>'. htmlspecialchars($xmlrpc_value->data) .'</string>';
-      break;
-    case 'array':
-      $return = '<array><data>'."\n";
-      foreach ($xmlrpc_value->data as $item) {
-        $return .= '  <value>'. xmlrpc_value_get_xml($item) ."</value>\n";
-      }
-      $return .= '</data></array>';
-      return $return;
-      break;
-    case 'struct':
-      $return = '<struct>'."\n";
-      foreach ($xmlrpc_value->data as $name => $value) {
-        $return .= "  <member><name>". check_plain($name) ."</name><value>";
-        $return .= xmlrpc_value_get_xml($value)."</value></member>\n";
-      }
-      $return .= '</struct>';
-      return $return;
-      break;
-    case 'date':
-      return xmlrpc_date_get_xml($xmlrpc_value->data);
-      break;
-    case 'base64':
-      return xmlrpc_base64_get_xml($xmlrpc_value->data);
-      break;
-  }
-  return FALSE;
-}
-
-/**
- * Construct an object representing an XML-RPC message.
- *
- * @param $message
- *   String containing XML as defined at http://www.xmlrpc.com/spec
- * @return
- *   Object
- */
-function xmlrpc_message($message) {
-  $xmlrpc_message = new stdClass();
-  $xmlrpc_message->array_structs = array();   // The stack used to keep track of the current array/struct
-  $xmlrpc_message->array_structs_types = array(); // The stack used to keep track of if things are structs or array
-  $xmlrpc_message->current_struct_name = array();  // A stack as well
-  $xmlrpc_message->message = $message;
-  return $xmlrpc_message;
-}
-
-/**
- * Parse an XML-RPC message. If parsing fails, the faultCode and faultString
- * will be added to the message object.
- *
- * @param $xmlrpc_message
- *   Object generated by xmlrpc_message()
- * @return
- *   TRUE if parsing succeeded; FALSE otherwise
- */
-function xmlrpc_message_parse(&$xmlrpc_message) {
-  // First remove the XML declaration
-  $xmlrpc_message->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $xmlrpc_message->message);
-  if (trim($xmlrpc_message->message) == '') {
-    return FALSE;
-  }
-  $xmlrpc_message->_parser = xml_parser_create();
-  // Set XML parser to take the case of tags into account
-  xml_parser_set_option($xmlrpc_message->_parser, XML_OPTION_CASE_FOLDING, FALSE);
-  // Set XML parser callback functions
-  /* Do not set object. $xmlrpc_message does not have member functions any more
-  xml_set_object($xmlrpc_message->_parser, $xmlrpc_message); */
-  xml_set_element_handler($xmlrpc_message->_parser, 'xmlrpc_message_tag_open', 'xmlrpc_message_tag_close');
-  xml_set_character_data_handler($xmlrpc_message->_parser, 'xmlrpc_message_cdata');
-  xmlrpc_message_set($xmlrpc_message);
-  if (!xml_parse($xmlrpc_message->_parser, $xmlrpc_message->message)) {
-    return FALSE;
-  }
-  xml_parser_free($xmlrpc_message->_parser);
-  // Grab the error messages, if any
-  $xmlrpc_message = xmlrpc_message_get();
-  if ($xmlrpc_message->messagetype == 'fault') {
-    $xmlrpc_message->fault_code = $xmlrpc_message->params[0]['faultCode'];
-    $xmlrpc_message->fault_string = $xmlrpc_message->params[0]['faultString'];
-  }
-  return TRUE;
-}
-
-/**
- * Store a copy of the $xmlrpc_message object temporarily.
- *
- * @param $value
- *   Object
- * @return
- *   The most recently stored $xmlrpc_message
- */
-function xmlrpc_message_set($value = NULL) {
-  static $xmlrpc_message;
-  if ($value) {
-    $xmlrpc_message = $value;
-  }
-  return $xmlrpc_message;
-}
-
-function xmlrpc_message_get() {
-  return xmlrpc_message_set();
-}
-
-function xmlrpc_message_tag_open($parser, $tag, $attr) {
-  $xmlrpc_message = xmlrpc_message_get();
-  $xmlrpc_message->current_tag_contents = '';
-  $xmlrpc_message->last_open = $tag;
-  switch($tag) {
-    case 'methodCall':
-    case 'methodResponse':
-    case 'fault':
-      $xmlrpc_message->messagetype = $tag;
-      break;
-    // Deal with stacks of arrays and structs
-    case 'data':
-      $xmlrpc_message->array_structs_types[] = 'array';
-      $xmlrpc_message->array_structs[] = array();
-      break;
-    case 'struct':
-      $xmlrpc_message->array_structs_types[] = 'struct';
-      $xmlrpc_message->array_structs[] = array();
-      break;
-  }
-  xmlrpc_message_set($xmlrpc_message);
-}
-
-function xmlrpc_message_cdata($parser, $cdata) {
-  $xmlrpc_message = xmlrpc_message_get();
-  $xmlrpc_message->current_tag_contents .= $cdata;
-  xmlrpc_message_set($xmlrpc_message);
-}
-
-function xmlrpc_message_tag_close($parser, $tag) {
-  $xmlrpc_message = xmlrpc_message_get();
-  $value_flag = FALSE;
-  switch($tag) {
-    case 'int':
-    case 'i4':
-      $value = (int)trim($xmlrpc_message->current_tag_contents);
-      $value_flag = TRUE;
-      break;
-    case 'double':
-      $value = (double)trim($xmlrpc_message->current_tag_contents);
-      $value_flag = TRUE;
-      break;
-    case 'string':
-      $value = $xmlrpc_message->current_tag_contents;
-      $value_flag = TRUE;
-      break;
-    case 'dateTime.iso8601':
-      $value = xmlrpc_date(trim($xmlrpc_message->current_tag_contents));
-      // $value = $iso->getTimestamp();
-      $value_flag = TRUE;
-      break;
-    case 'value':
-      // If no type is indicated, the type is string
-      // We take special care for empty values
-      if (trim($xmlrpc_message->current_tag_contents) != '' || $xmlrpc_message->last_open == 'value') {
-        $value = (string)$xmlrpc_message->current_tag_contents;
-        $value_flag = TRUE;
-      }
-      unset($xmlrpc_message->last_open);
-      break;
-    case 'boolean':
-      $value = (boolean)trim($xmlrpc_message->current_tag_contents);
-      $value_flag = TRUE;
-      break;
-    case 'base64':
-      $value = base64_decode(trim($xmlrpc_message->current_tag_contents));
-      $value_flag = TRUE;
-      break;
-    // Deal with stacks of arrays and structs
-    case 'data':
-    case 'struct':
-      $value = array_pop($xmlrpc_message->array_structs );
-      array_pop($xmlrpc_message->array_structs_types);
-      $value_flag = TRUE;
-      break;
-    case 'member':
-      array_pop($xmlrpc_message->current_struct_name);
-      break;
-    case 'name':
-      $xmlrpc_message->current_struct_name[] = trim($xmlrpc_message->current_tag_contents);
-      break;
-    case 'methodName':
-      $xmlrpc_message->methodname = trim($xmlrpc_message->current_tag_contents);
-      break;
-  }
-  if ($value_flag) {
-    if (count($xmlrpc_message->array_structs ) > 0) {
-      // Add value to struct or array
-      if ($xmlrpc_message->array_structs_types[count($xmlrpc_message->array_structs_types)-1] == 'struct') {
-        // Add to struct
-        $xmlrpc_message->array_structs [count($xmlrpc_message->array_structs )-1][$xmlrpc_message->current_struct_name[count($xmlrpc_message->current_struct_name)-1]] = $value;
-      }
-      else {
-        // Add to array
-        $xmlrpc_message->array_structs [count($xmlrpc_message->array_structs )-1][] = $value;
-      }
-    }
-    else {
-      // Just add as a parameter
-      $xmlrpc_message->params[] = $value;
-    }
-  }
-  if (!in_array($tag, array("data", "struct", "member"))) {
-    $xmlrpc_message->current_tag_contents = '';
-  }
-  xmlrpc_message_set($xmlrpc_message);
-}
-
-/**
- * Construct an object representing an XML-RPC request
- *
- * @param $method
- *   The name of the method to be called
- * @param $args
- *   An array of parameters to send with the method.
- * @return
- *   Object
- */
-function xmlrpc_request($method, $args) {
-  $xmlrpc_request = new stdClass();
-  $xmlrpc_request->method = $method;
-  $xmlrpc_request->args = $args;
-  $xmlrpc_request->xml = <<<EOD
-<?xml version="1.0"?>
-<methodCall>
-<methodName>{$xmlrpc_request->method}</methodName>
-<params>
-
-EOD;
-  foreach ($xmlrpc_request->args as $arg) {
-    $xmlrpc_request->xml .= '<param><value>';
-    $v = xmlrpc_value($arg);
-    $xmlrpc_request->xml .= xmlrpc_value_get_xml($v);
-    $xmlrpc_request->xml .= "</value></param>\n";
-  }
-  $xmlrpc_request->xml .= '</params></methodCall>';
-  return $xmlrpc_request;
-}
-
-
-function xmlrpc_error($code = NULL, $message = NULL) {
-  static $xmlrpc_error;
-  if (isset($code)) {
-    $xmlrpc_error = new stdClass();
-    $xmlrpc_error->is_error = TRUE;
-    $xmlrpc_error->code = $code;
-    $xmlrpc_error->message = $message;
-  }
-  return $xmlrpc_error;
-}
-
-function xmlrpc_error_get_xml($xmlrpc_error) {
-    return <<<EOD
-<methodResponse>
-  <fault>
-  <value>
-    <struct>
-    <member>
-      <name>faultCode</name>
-      <value><int>{$xmlrpc_error->code}</int></value>
-    </member>
-    <member>
-      <name>faultString</name>
-      <value><string>{$xmlrpc_error->message}</string></value>
-    </member>
-    </struct>
-  </value>
-  </fault>
-</methodResponse>
-
-EOD;
-}
-
-function xmlrpc_date($time) {
-  $xmlrpc_date = new stdClass();
-  $xmlrpc_date->is_date = TRUE;
-  // $time can be a PHP timestamp or an ISO one
-  if (is_numeric($time)) {
-    $xmlrpc_date->year = date('Y', $time);
-    $xmlrpc_date->month = date('m', $time);
-    $xmlrpc_date->day = date('d', $time);
-    $xmlrpc_date->hour = date('H', $time);
-    $xmlrpc_date->minute = date('i', $time);
-    $xmlrpc_date->second = date('s', $time);
-    $xmlrpc_date->iso8601 = date('Ymd\TH:i:s');
-  }
-  else {
-    $xmlrpc_date->year = substr($time, 0, 4);
-    $xmlrpc_date->month = substr($time, 4, 2);
-    $xmlrpc_date->day = substr($time, 6, 2);
-    $xmlrpc_date->hour = substr($time, 9, 2);
-    $xmlrpc_date->minute = substr($time, 12, 2);
-    $xmlrpc_date->second = substr($time, 15, 2);
-    $xmlrpc_date->iso8601 = $time;
-  }
-  return $xmlrpc_date;
-}
-
-function xmlrpc_date_get_xml($xmlrpc_date) {
-  return '<dateTime.iso8601>'. $xmlrpc_date->year . $xmlrpc_date->month . $xmlrpc_date->day .'T'. $xmlrpc_date->hour .':'. $xmlrpc_date->minute .':'. $xmlrpc_date->second .'</dateTime.iso8601>';
-}
-
-function xmlrpc_base64($data) {
-  $xmlrpc_base64 = new stdClass();
-  $xmlrpc_base64->is_base64 = TRUE;
-  $xmlrpc_base64->data = $data;
-  return $xmlrpc_base64;
-}
-
-function xmlrpc_base64_get_xml($xmlrpc_base64) {
-  return '<base64>'. base64_encode($xmlrpc_base64->data) .'</base64>';
-}
-
-/**
- * Execute an XML remote procedural call. This is private function; call xmlrpc()
- * in common.inc instead of this functino.
- *
- * @return
- *   A $xmlrpc_message object if the call succeeded; FALSE if the call failed
- */
-function _xmlrpc() {
-  $args = func_get_args();
-  $url = array_shift($args);
-  if (is_array($args[0])) {
-    $method = 'system.multicall';
-    $multicall_args = array();
-    foreach ($args[0] as $call) {
-      $multicall_args[] = array('methodName' => array_shift($call),'params' => $call);
-    }
-    $args = array($multicall_args);
-  }
-  else {
-    $method = array_shift($args);
-  }
-  $xmlrpc_request = xmlrpc_request($method, $args);
-  $result = drupal_http_request($url, array("Content-Type" => "text/xml"), 'POST', $xmlrpc_request->xml);
-  if ($result->code != 200) {
-    xmlrpc_error(-$result->code, $result->error);
-    return FALSE;
-  }
-  $message = xmlrpc_message($result->data);
-  // Now parse what we've got back
-  if (!xmlrpc_message_parse($message)) {
-    // XML error
-    xmlrpc_error(-32700, t('Parse error. Not well formed'));
-    return FALSE;
-  }
-  // Is the message a fault?
-  if ($message->messagetype == 'fault') {
-    xmlrpc_error($message->fault_code, $message->fault_string);
-    return FALSE;
-  }
-  // Message must be OK
-  return $message->params[0];
-}
-
-/**
- * Returns the last XML-RPC client error number
- */
-function xmlrpc_errno() {
-  $error = xmlrpc_error();
-  return $error->code;
-}
-
-/**
- * Returns the last XML-RPC client error message
- */
-function xmlrpc_error_msg() {
-  $error = xmlrpc_error();
-  return $error->message;
-}
diff --git a/includes/xmlrpcs.inc b/includes/xmlrpcs.inc
deleted file mode 100644 (file)
index 3b90f5f..0000000
+++ /dev/null
@@ -1,318 +0,0 @@
-<?php
-// $Id: xmlrpcs.inc 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * The main entry point for XML-RPC requests.
- *
- * @param $callbacks
- *   Array of external XML-RPC method names with the callbacks they map to.
- */
-function xmlrpc_server($callbacks) {
-  $xmlrpc_server = new stdClass();
-  // Define built-in XML-RPC method names
-  $defaults = array(
-      'system.multicall' => 'xmlrpc_server_multicall',
-    array(
-      'system.methodSignature',
-      'xmlrpc_server_method_signature',
-      array('array', 'string'),
-      'Returns an array describing the return type and required parameters of a method.'
-    ),
-    array(
-      'system.getCapabilities',
-      'xmlrpc_server_get_capabilities',
-      array('struct'),
-      'Returns a struct describing the XML-RPC specifications supported by this server.'
-    ),
-    array(
-      'system.listMethods',
-      'xmlrpc_server_list_methods',
-      array('array'),
-      'Returns an array of available methods on this server.'),
-    array(
-      'system.methodHelp',
-      'xmlrpc_server_method_help',
-      array('string', 'string'),
-      'Returns a documentation string for the specified method.')
-  );
-  // We build an array of all method names by combining the built-ins
-  // with those defined by modules implementing the _xmlrpc hook.
-  // Built-in methods are overridable.
-  foreach (array_merge($defaults, (array)$callbacks) as $key => $callback) {
-    // we could check for is_array($callback)
-    if (is_int($key)) {
-      $method = $callback[0];
-      $xmlrpc_server->callbacks[$method] = $callback[1];
-      $xmlrpc_server->signatures[$method] = $callback[2];
-      $xmlrpc_server->help[$method] = $callback[3];
-    }
-    else {
-      $xmlrpc_server->callbacks[$key] = $callback;
-      $xmlrpc_server->signatures[$key] = '';
-      $xmlrpc_server->help[$key] = '';
-    }
-  }
-
-  $data = file_get_contents('php://input');
-  if (!$data) {
-     die('XML-RPC server accepts POST requests only.');
-  }
-  $xmlrpc_server->message = xmlrpc_message($data);
-  if (!xmlrpc_message_parse($xmlrpc_server->message)) {
-    xmlrpc_server_error(-32700, t('Parse error. Request not well formed.'));
-  }
-  if ($xmlrpc_server->message->messagetype != 'methodCall') {
-    xmlrpc_server_error(-32600, t('Server error. Invalid XML-RPC. Request must be a methodCall.'));
-  }
-  xmlrpc_server_set($xmlrpc_server);
-  $result = xmlrpc_server_call($xmlrpc_server, $xmlrpc_server->message->methodname, $xmlrpc_server->message->params);
-
-  if ($result->is_error) {
-    xmlrpc_server_error($result);
-  }
-  // Encode the result
-  $r = xmlrpc_value($result);
-  // Create the XML
-  $xml = '
-<methodResponse>
-  <params>
-  <param>
-    <value>'.
-    xmlrpc_value_get_xml($r)
-    .'</value>
-  </param>
-  </params>
-</methodResponse>
-
-';
-  // Send it
-  xmlrpc_server_output($xml);
-}
-
-/**
- * Throw an XML-RPC error.
- *
- * @param $error
- *   an error object OR integer error code
- * @param $message
- *   description of error, used only if integer error code was passed
- */
-function xmlrpc_server_error($error, $message = false) {
-  if ($message && !is_object($error)) {
-    $error = xmlrpc_error($error, $message);
-  }
-  xmlrpc_server_output(xmlrpc_error_get_xml($error));
-}
-
-function xmlrpc_server_output($xml) {
-  $xml = '<?xml version="1.0"?>'."\n". $xml;
-  header('Connection: close');
-  header('Content-Length: '. strlen($xml));
-  header('Content-Type: text/xml');
-  header('Date: '.date('r'));
-  echo $xml;
-  exit;
-}
-
-/**
- * Store a copy of the request temporarily.
- *
- * @param $xmlrpc_server
- *   Request object created by xmlrpc_server().
- */
-function xmlrpc_server_set($xmlrpc_server = NULL) {
-  static $server;
-  if (!isset($server)) {
-    $server = $xmlrpc_server;
-  }
-  return $server;
-}
-
-// Retrieve the stored request.
-function xmlrpc_server_get() {
-  return xmlrpc_server_set();
-}
-
-/**
- * Dispatch the request and any parameters to the appropriate handler.
- *
- * @param $xmlrpc_server
- * @param $methodname
- *   The external XML-RPC method name, e.g. 'system.methodHelp'
- * @param $args
- *   Array containing any parameters that were sent along with the request.
- */
-function xmlrpc_server_call($xmlrpc_server, $methodname, $args) {
-  // Make sure parameters are in an array
-  if ($args && !is_array($args)) {
-    $args = array($args);
-  }
-  // Has this method been mapped to a Drupal function by us or by modules?
-  if (!isset($xmlrpc_server->callbacks[$methodname])) {
-    return xmlrpc_error(-32601, t('Server error. Requested method %methodname not specified.', array("%methodname" => $xmlrpc_server->message->methodname)));
-  }
-  $method = $xmlrpc_server->callbacks[$methodname];
-  $signature = $xmlrpc_server->signatures[$methodname];
-
-  // If the method has a signature, validate the request against the signature
-  if (is_array($signature)) {
-    $ok = true;
-    $return_type = array_shift($signature);
-    // Check the number of arguments
-    if (count($args) != count($signature)) {
-      return xmlrpc_error(-32602, t('Server error. Wrong number of method parameters.'));
-    }
-    // Check the argument types
-    foreach ($signature as $key => $type) {
-      $arg = $args[$key];
-      switch ($type) {
-        case 'int':
-        case 'i4':
-          if (is_array($arg) || !is_int($arg)) {
-            $ok = false;
-          }
-          break;
-        case 'base64':
-        case 'string':
-          if (!is_string($arg)) {
-            $ok = false;
-          }
-          break;
-        case 'boolean':
-          if ($arg !== false && $arg !== true) {
-            $ok = false;
-          }
-          break;
-        case 'float':
-        case 'double':
-          if (!is_float($arg)) {
-            $ok = false;
-          }
-          break;
-        case 'date':
-        case 'dateTime.iso8601':
-          if (!$arg->is_date) {
-            $ok = false;
-          }
-          break;
-      }
-      if (!$ok) {
-        return xmlrpc_error(-32602, t('Server error. Invalid method parameters.'));
-      }
-    }
-  }
-  /*
-  if (count($args) == 1) {
-    // If only one parameter just send that instead of the whole array
-    $args = $args[0];
-  }
-  */
-  if (!function_exists($method)) {
-    return xmlrpc_error(-32601, t('Server error. Requested function %method does not exist.', array("%method" => $method)));
-  }
-  // Call the mapped function
-  return call_user_func_array($method, $args);
-}
-
-function xmlrpc_server_multicall($methodcalls) {
-  // See http://www.xmlrpc.com/discuss/msgReader$1208
-  $return = array();
-  $xmlrpc_server = xmlrpc_server_get();
-  foreach ($methodcalls as $call) {
-    $ok = true;
-    if (!isset($call['methodName']) || !isset($call['params'])) {
-      $result = xmlrpc_error(3, t('Invalid syntax for system.multicall.'));
-      $ok = false;
-    }
-    $method = $call['methodName'];
-    $params = $call['params'];
-    if ($method == 'system.multicall') {
-      $result = xmlrpc_error(-32600, t('Recursive calls to system.multicall are forbidden.'));
-    }
-    elseif ($ok) {
-      $result = xmlrpc_server_call($xmlrpc_server, $method, $params);
-    }
-    if ($result->is_error) {
-      $return[] = array(
-        'faultCode' => $result->code,
-        'faultString' => $result->message
-      );
-    }
-    else {
-      $return[] = $result;
-    }
-  }
-  return $return;
-}
-
-
-/**
- * XML-RPC method system.listMethods maps to this function.
- */
-function xmlrpc_server_list_methods() {
-  $xmlrpc_server = xmlrpc_server_get();
-  return array_keys($xmlrpc_server->callbacks);
-}
-
-/**
- * XML-RPC method system.getCapabilities maps to this function.
- * See http://groups.yahoo.com/group/xml-rpc/message/2897
- */
-function xmlrpc_server_get_capabilities() {
-  return array(
-    'xmlrpc' => array(
-      'specUrl' => 'http://www.xmlrpc.com/spec',
-      'specVersion' => 1
-    ),
-    'faults_interop' => array(
-      'specUrl' => 'http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php',
-      'specVersion' => 20010516
-    ),
-    'system.multicall' => array(
-      'specUrl' => 'http://www.xmlrpc.com/discuss/msgReader$1208',
-      'specVersion' => 1
-    ),
-    'introspection' => array(
-    'specUrl' => 'http://scripts.incutio.com/xmlrpc/introspection.html',
-    'specVersion' => 1
-    )
-  );
-}
-
-/**
- * XML-RPC method system.methodSignature maps to this function.
- *
- * @param $methodname
- *   Name of method for which we return a method signature.
- * @return array
- *   An array of types representing the method signature of the
- *   function that the methodname maps to. The methodSignature of
- *   this function is 'array', 'string' because it takes an array
- *   and returns a string.
- */
-function xmlrpc_server_method_signature($methodname) {
-  $xmlrpc_server = xmlrpc_server_get();
-  if (!isset($xmlrpc_server->callbacks[$methodname])) {
-    return xmlrpc_error(-32601, t('Server error. Requested method %methodname not specified.', array("%methodname" => $methodname)));
-  }
-  if (!is_array($xmlrpc_server->signatures[$methodname])) {
-    return xmlrpc_error(-32601, t('Server error. Requested method %methodname signature not specified.', array("%methodname" => $methodname)));
-  }
-  // We array of types
-  $return = array();
-  foreach ($xmlrpc_server->signatures[$methodname] as $type) {
-    $return[] = $type;
-  }
-  return $return;
-}
-
-/**
- * XML-RPC method system.methodHelp maps to this function.
- *
- * @param $method
- *   Name of method for which we return a help string.
- */
-function xmlrpc_server_method_help($method) {
-  $xmlrpc_server = xmlrpc_server_get();
-  return $xmlrpc_server->help[$method];
-}
\ No newline at end of file
diff --git a/index.php b/index.php
deleted file mode 100644 (file)
index 9f750d7..0000000
--- a/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-// $Id: index.php 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * The PHP page that serves all page requests on a Drupal installation.
- *
- * The routines here dispatch control to the appropriate handler, which then
- * prints the appropriate page.
- */
-
-require_once './includes/bootstrap.inc';
-drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-
-$return = menu_execute_active_handler();
-switch ($return) {
-  case MENU_NOT_FOUND:
-    drupal_not_found();
-    break;
-  case MENU_ACCESS_DENIED:
-    drupal_access_denied();
-    break;
-  case MENU_SITE_OFFLINE:
-    drupal_site_offline();
-    break;
-  default:
-    // Print any value (including an empty string) except NULL or undefined:
-    if (isset($return)) {
-      print theme('page', $return);
-    }
-    break;
-}
-
-drupal_page_footer();
-
diff --git a/modules/aggregator.module b/modules/aggregator.module
deleted file mode 100644 (file)
index bb466b2..0000000
+++ /dev/null
@@ -1,1371 +0,0 @@
-<?php
-// $Id: aggregator.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Used to aggregate syndicated content (RSS, RDF, and Atom).
- */
-
-/**
- * Implementation of hook_help().
- */
-function aggregator_help($section) {
-  switch ($section) {
-    case 'admin/help#aggregator':
-      $output = '<p>'. t('The news aggregator is a powerful on-site RSS syndicator/news reader that can gather fresh content from news sites and weblogs around the web.') .'</p>';
-      $output .= '<p>'. t('Users can view the latest news chronologically in the <a href="%aggregator">main news aggregator display</a> or by <a href="%aggregator-sources">source</a>. Administrators can add, edit and delete feeds and choose how often to check for newly updated news for each individual feed. Administrators can also tag individual feeds with categories, offering selective grouping of some feeds into separate displays. Listings of the latest news for individual sources or categorized sources can be enabled as blocks for display in the sidebar through the <a href="%admin-block">block administration page</a>. The news aggregator requires cron to check for the latest news from the sites to which you have subscribed. Drupal also provides a <a href="%aggregator-opml">machine-readable OPML file</a> of all of your subscribed feeds.', array('%aggregator' => url('aggregator'), '%aggregator-sources' => url('aggregator/sources'), '%admin-block' => url('admin/block'), '%aggregator-opml' => url('aggregator/opml'))) .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>administer your list of news feeds <a href="%admin-aggregator">administer &gt;&gt;  aggregator</a>.</li>
-<li>add a new feed <a href="%admin-aggregator-add-feed">administer &gt;&gt; aggregator &gt;&gt; add feed</a>.</li>
-<li>add a new category <a href="%admin-aggregator-add-category">administer &gt;&gt; aggregator &gt;&gt; add category</a>.</li>
-<li>configure global settings for the news aggregator <a href="%admin-settings-aggregator">administer &gt;&gt; settings &gt;&gt; aggregator</a>.</li>
-<li>control access to the aggregator module through access permissions <a href="%admin-access">administer &gt;&gt; access control &gt;&gt; permissions</a>.</li>
-<li>set permissions to access new feeds for user roles such as anonymous users at <a href="%admin-access">administer &gt;&gt; access control</a>.</li>
-<li>view the <a href="%aggregator">aggregator page</a>.</li>
-</ul>
-', array('%admin-aggregator' => url('admin/aggregator'), '%admin-aggregator-add-feed' => url('admin/aggregator/add/feed'), '%admin-aggregator-add-category' => url('admin/aggregator/add/category'), '%admin-settings-aggregator' => url('admin/settings/aggregator'), '%admin-access' => url('admin/access'), '%aggregator' => url('aggregator')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%aggregator">Aggregator page</a>.', array('%aggregator' => 'http://drupal.org/handbook/modules/aggregator/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Aggregates syndicated content (RSS, RDF, and Atom feeds).');
-    case 'admin/aggregator':
-      return t('<p>Thousands of sites (particularly news sites and weblogs) publish their latest headlines and/or stories in a machine-readable format so that other sites can easily link to them. This content is usually in the form of an <a href="http://blogs.law.harvard.edu/tech/rss">RSS</a> feed (which is an XML-based syndication standard). To display the feed or category in a block you must decide how many items to show by editing the feed or block and turning on the <a href="%block">feed\'s block</a>.</p>', array('%block' => url('admin/block')));
-    case 'admin/aggregator/add/feed':
-      return t('<p>Add a site that has an RSS/RDF/Atom feed. The URL is the full path to the feed file. For the feed to update automatically you must run "cron.php" on a regular basis. If you already have a feed with the URL you are planning to use, the system will not accept another feed with the same URL.</p>');
-    case 'admin/aggregator/add/category':
-      return t('<p>Categories provide a way to group items from different news feeds together. Each news category has its own feed page and block. For example, you could tag various sport-related feeds as belonging to a category called <em>Sports</em>. News items can be added to a category automatically by setting a feed to automatically place its item into that category, or by using the categorize items link in any listing of news items.</p>');
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function aggregator_menu($may_cache) {
-  $items = array();
-  $edit = user_access('administer news feeds');
-  $view = user_access('access news feeds');
-
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/aggregator',
-      'title' => t('aggregator'),
-      'callback' => 'aggregator_admin_overview',
-      'access' => $edit);
-    $items[] = array('path' => 'admin/aggregator/add/feed',
-      'title' => t('add feed'),
-      'callback' => 'aggregator_form_feed',
-      'access' => $edit,
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/aggregator/add/category',
-      'title' => t('add category'),
-      'callback' => 'aggregator_form_category',
-      'access' => $edit,
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/aggregator/remove',
-      'title' => t('remove items'),
-      'callback' => 'aggregator_admin_remove_feed',
-      'access' => $edit,
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/aggregator/update',
-      'title' => t('update items'),
-      'callback' => 'aggregator_admin_refresh_feed',
-      'access' => $edit,
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/aggregator/list',
-      'title' => t('list'),
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-      'weight' => -10);
-
-    $items[] = array('path' => 'aggregator',
-      'title' => t('news aggregator'),
-      'callback' => 'aggregator_page_last',
-      'access' => $view,
-      'weight' => 5);
-    $items[] = array('path' => 'aggregator/sources',
-      'title' => t('sources'),
-      'callback' => 'aggregator_page_sources',
-      'access' => $view);
-    $items[] = array('path' => 'aggregator/categories',
-      'title' => t('categories'),
-      'callback' => 'aggregator_page_categories',
-      'access' => $view,
-      'type' => MENU_ITEM_GROUPING);
-    $items[] = array('path' => 'aggregator/rss',
-      'title' => t('RSS feed'),
-      'callback' => 'aggregator_page_rss',
-      'access' => $view,
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'aggregator/opml',
-      'title' => t('OPML feed'),
-      'callback' => 'aggregator_page_opml',
-      'access' => $view,
-      'type' => MENU_CALLBACK);
-
-    $result = db_query('SELECT title, cid FROM {aggregator_category} ORDER BY title');
-    while ($category = db_fetch_array($result)) {
-      $items[] = array('path' => 'aggregator/categories/'. $category['cid'],
-        'title' => $category['title'],
-        'callback' => 'aggregator_page_category',
-        'access' => $view);
-    }
-  }
-  else {
-    if (arg(0) == 'aggregator' && is_numeric(arg(2))) {
-      if (arg(1) == 'sources') {
-        $feed = aggregator_get_feed(arg(2));
-        if ($feed) {
-          $items[] = array('path' => 'aggregator/sources/'. $feed['fid'],
-            'title' => $feed['title'],
-            'callback' => 'aggregator_page_source',
-            'access' => $view,
-            'type' => MENU_CALLBACK);
-          $items[] = array('path' => 'aggregator/sources/'. $feed['fid'] .'/view',
-            'title' => t('view'),
-            'type' => MENU_DEFAULT_LOCAL_TASK,
-            'weight' => -10);
-          $items[] = array('path' => 'aggregator/sources/'. $feed['fid'] .'/categorize',
-            'title' => t('categorize'),
-            'callback' => 'aggregator_page_source',
-            'access' => $edit,
-            'type' => MENU_LOCAL_TASK);
-          $items[] = array('path' => 'aggregator/sources/'. $feed['fid'] .'/configure',
-            'title' => t('configure'),
-            'callback' => 'aggregator_form_feed',
-            'callback arguments' => array($feed),
-            'access' => $edit,
-            'type' => MENU_LOCAL_TASK,
-            'weight' => 1);
-        }
-      }
-      else if (arg(1) == 'categories') {
-        $category = aggregator_get_category(arg(2));
-        if ($category) {
-          $items[] = array('path' => 'aggregator/categories/'. $category['cid'] .'/view',
-            'title' => t('view'),
-            'type' => MENU_DEFAULT_LOCAL_TASK,
-            'weight' => -10);
-          $items[] = array('path' => 'aggregator/categories/'. $category['cid'] .'/categorize',
-            'title' => t('categorize'),
-            'callback' => 'aggregator_page_category',
-            'access' => $edit,
-            'type' => MENU_LOCAL_TASK);
-          $items[] = array('path' => 'aggregator/categories/'. $category['cid'] .'/configure',
-            'title' => t('configure'),
-            'callback' => 'aggregator_form_category',
-            'callback arguments' => array($category),
-            'access' => $edit,
-            'type' => MENU_LOCAL_TASK,
-            'weight' => 1);
-        }
-      }
-    }
-    else if (arg(1) == 'aggregator' && is_numeric(arg(4))) {
-      if (arg(3) == 'feed') {
-        $feed = aggregator_get_feed(arg(4));
-        if ($feed) {
-          $items[] = array('path' => 'admin/aggregator/edit/feed/'. $feed['fid'],
-            'title' => t('edit feed'),
-            'callback' => 'aggregator_form_feed',
-            'callback arguments' => array($feed),
-            'access' => $edit,
-            'type' => MENU_CALLBACK);
-        }
-      }
-      else {
-        $category = aggregator_get_category(arg(4));
-        if ($category) {
-          $items[] = array('path' => 'admin/aggregator/edit/category/'. $category['cid'],
-            'title' => t('edit category'),
-            'callback' => 'aggregator_form_category',
-            'callback arguments' => array($category),
-            'access' => $edit,
-            'type' => MENU_CALLBACK);
-        }
-      }
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_settings().
- */
-function aggregator_settings() {
-  $items = array(0 => t('none')) + drupal_map_assoc(array(3, 5, 10, 15, 20, 25), '_aggregator_items');
-  $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
-
-  $form['aggregator_allowed_html_tags'] = array(
-    '#type' => 'textfield', '#title' => t('Allowed HTML tags'), '#size' => 80, '#maxlength' => 255,
-    '#default_value' => variable_get('aggregator_allowed_html_tags', '<a> <b> <br> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>'),
-    '#description' => t('The list of tags which are allowed in feeds, i.e., which will not be removed by Drupal.')
-  );
-
-  $form['aggregator_summary_items'] = array(
-    '#type' => 'select', '#title' => t('Items shown in sources and categories pages') ,
-    '#default_value' => variable_get('aggregator_summary_items', 3), '#options' => $items,
-    '#description' =>  t('The number of items which will be shown with each feed or category in the feed and category summary pages.')
-  );
-
-  $form['aggregator_clear'] = array(
-    '#type' => 'select', '#title' => t('Discard news items older than'),
-    '#default_value' => variable_get('aggregator_clear', 9676800), '#options' => $period,
-    '#description' => t('Older news items will be automatically discarded.  Requires crontab.')
-  );
-
-  $form['aggregator_category_selector'] = array(
-    '#type' => 'radios', '#title' => t('Category selection type'), '#default_value' => variable_get('aggregator_category_selector', 'check'),
-    '#options' => array('checkboxes' => t('checkboxes'), 'select' => t('multiple selector')),
-    '#description' => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.')
-  );
-  return $form;
-}
-
-/**
- * Implementation of hook_perm().
- */
-function aggregator_perm() {
-  return array('administer news feeds', 'access news feeds');
-}
-
-/**
- * Implementation of hook_cron().
- *
- * Checks news feeds for updates once their refresh interval has elapsed.
- */
-function aggregator_cron() {
-  $result = db_query('SELECT * FROM {aggregator_feed} WHERE checked + refresh < %d', time());
-  while ($feed = db_fetch_array($result)) {
-    aggregator_refresh($feed);
-  }
-}
-
-/**
- * Implementation of hook_block().
- *
- * Generates blocks for the latest news items in each category and feed.
- */
-function aggregator_block($op, $delta = 0, $edit = array()) {
-  if (user_access('access news feeds')) {
-    if ($op == 'list') {
-      $result = db_query('SELECT cid, title FROM {aggregator_category} ORDER BY title');
-      while ($category = db_fetch_object($result)) {
-        $block['category-'. $category->cid]['info'] = t('%title category latest items', array('%title' => theme('placeholder', $category->title)));
-      }
-      $result = db_query('SELECT fid, title FROM {aggregator_feed} ORDER BY fid');
-      while ($feed = db_fetch_object($result)) {
-        $block['feed-'. $feed->fid]['info'] = t('%title feed latest items', array('%title' => theme('placeholder', $feed->title)));
-      }
-    }
-    else if ($op == 'configure') {
-      list($type, $id) = explode('-', $delta);
-      if ($type == 'category') {
-        $value = db_result(db_query('SELECT block FROM {aggregator_category} WHERE cid = %d', $id));
-      }
-      else {
-        $value = db_result(db_query('SELECT block FROM {aggregator_feed} WHERE fid = %d', $id));
-      }
-      $form['block'] = array('#type' => 'select', '#title' => t('Number of news items in block'), '#default_value' => $value, '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
-      return $form;
-    }
-    else if ($op == 'save') {
-      list($type, $id) = explode('-', $delta);
-      if ($type == 'category') {
-        $value = db_query('UPDATE {aggregator_category} SET block = %d WHERE cid = %d', $edit['block'], $id);
-      }
-      else {
-        $value = db_query('UPDATE {aggregator_feed} SET block = %d WHERE fid = %d', $edit['block'], $id);
-      }
-    }
-    else if ($op == 'view') {
-      list($type, $id) = explode('-', $delta);
-      switch ($type) {
-        case 'feed':
-          if ($feed = db_fetch_object(db_query('SELECT fid, title, block FROM {aggregator_feed} WHERE fid = %d', $id))) {
-            $block['subject'] = check_plain($feed->title);
-            $result = db_query_range('SELECT * FROM {aggregator_item} WHERE fid = %d ORDER BY timestamp DESC, iid DESC', $feed->fid, 0, $feed->block);
-            $block['content'] = '<div class="more-link">'. l(t('more'), 'aggregator/sources/'. $feed->fid, array('title' => t('View this feed\'s recent news.'))) .'</div>';
-          }
-          break;
-
-        case 'category':
-          if ($category = db_fetch_object(db_query('SELECT cid, title, block FROM {aggregator_category} WHERE cid = %d', $id))) {
-            $block['subject'] = check_plain($category->title);
-            $result = db_query_range('SELECT i.* FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON ci.iid = i.iid WHERE ci.cid = %d ORDER BY i.timestamp DESC, i.iid DESC', $category->cid, 0, $category->block);
-            $block['content'] = '<div class="more-link">'. l(t('more'), 'aggregator/categories/'. $category->cid, array('title' => t('View this category\'s recent news.'))) .'</div>';
-          }
-          break;
-      }
-      $items = array();
-      while ($item = db_fetch_object($result)) {
-        $items[] = theme('aggregator_block_item', $item);
-      }
-      $block['content'] = theme('item_list', $items) . $block['content'];
-    }
-    return $block;
-  }
-}
-
-/**
- * Generate a form to add/edit/delete aggregator categories.
- */
- function aggregator_form_category($edit = array()) {
-  $form['title'] = array('#type' => 'textfield',
-    '#title' => t('Title'),
-    '#default_value' => $edit['title'],
-    '#maxlength' => 64,
-    '#required' => TRUE,
-  );
-  $form['description'] = array('#type' => 'textarea',
-    '#title' => t('Description'),
-    '#default_value' => $edit['description'],
-  );
-  $form['submit'] = array('#type' => 'submit', '#value' =>t('Submit'));
-
-  if ($edit['cid']) {
-    $form['delete'] = array('#type' => 'submit', '#value' =>t('Delete'));
-    $form['cid'] = array('#type' => 'hidden', '#value' => $edit['cid']);
-  }
-
-  return drupal_get_form('aggregator_form_category', $form);
-}
-
-/**
- * Validate aggregator_form_feed form submissions.
- */
-function aggregator_form_category_validate($form_id, $form_values) {
-  if ($_POST['op'] == t('Submit')) {
-    // Check for duplicate titles
-    if (isset($form_values['cid'])) {
-      $category = db_fetch_object(db_query("SELECT cid FROM {aggregator_category} WHERE title = '%s' AND cid != %d", $form_values['title'], $form_values['cid']));
-    }
-    else {
-      $category = db_fetch_object(db_query("SELECT cid FROM {aggregator_category} WHERE title = '%s'", $form_values['title']));
-    }
-    if ($category) {
-      form_set_error('title', t('A category named %category already exists. Please enter a unique title.', array('%category' => theme('placeholder', $form_values['title']))));
-    }
-  }
-}
-
-/**
- * Process aggregator_form_category form submissions.
- * @todo Add delete confirmation dialog.
- */
-function aggregator_form_category_submit($form_id, $form_values) {
-  if ($_POST['op'] == t('Delete')) {
-    $title = $form_values['title'];
-    // Unset the title:
-    unset($form_values['title']);
-  }
-  aggregator_save_category($form_values);
-  menu_rebuild();
-  if (isset($form_values['cid'])) {
-    if (isset($form_values['title'])) {
-      drupal_set_message(t('The category %category has been updated.', array('%category' => theme('placeholder', $form_values['title']))));
-      if (arg(0) == 'admin') {
-        return 'admin/aggregator/';
-      }
-      else {
-        return 'aggregator/categories/'. $form_values['cid'];
-      }
-    }
-    else {
-      watchdog('aggregator', t('Category %category deleted.', array('%category' => theme('placeholder', $title))));
-      drupal_set_message(t('The category %category has been deleted.', array('%category' => theme('placeholder', $title))));
-      if (arg(0) == 'admin') {
-        return 'admin/aggregator/';
-      }
-      else {
-        return 'aggregator/categories/';
-      }
-    }
-  }
-  else {
-    watchdog('aggregator', t('Category %category added.', array('%category' => theme('placeholder', $form_values['title']))), WATCHDOG_NOTICE, l(t('view'), 'admin/aggregator'));
-    drupal_set_message(t('The category %category has been added.', array('%category' => theme('placeholder', $form_values['title']))));
-  }
-}
-
-/**
- * Add/edit/delete aggregator categories.
- */
-function aggregator_save_category($edit) {
-  if ($edit['cid'] && $edit['title']) {
-    db_query("UPDATE {aggregator_category} SET title = '%s', description = '%s' WHERE cid = %d", $edit['title'], $edit['description'], $edit['cid']);
-  }
-  else if ($edit['cid']) {
-    db_query('DELETE FROM {aggregator_category} WHERE cid = %d', $edit['cid']);
-  }
-  else if ($edit['title']) {
-    // A single unique id for bundles and feeds, to use in blocks
-    $next_id = db_next_id('{aggregator_category}_cid');
-    db_query("INSERT INTO {aggregator_category} (cid, title, description, block) VALUES (%d, '%s', '%s', 5)", $next_id, $edit['title'], $edit['description']);
-  }
-}
-
-/**
- * Generate a form to add/edit feed sources.
- */
-function aggregator_form_feed($edit = array()) {
-  $period = drupal_map_assoc(array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval');
-
-  if ($edit['refresh'] == '') {
-    $edit['refresh'] = 3600;
-  }
-
-  $form['title'] = array('#type' => 'textfield',
-    '#title' => t('Title'),
-    '#default_value' => $edit['title'],
-    '#maxlength' => 64,
-    '#description' => t('The name of the feed; typically the name of the web site you syndicate content from.'),
-    '#required' => TRUE,
-  );
-  $form['url'] = array('#type' => 'textfield',
-    '#title' => t('URL'),
-    '#default_value' => $edit['url'],
-    '#maxlength' => 255,
-    '#description' => t('The fully-qualified URL of the feed.'),
-    '#required' => TRUE,
-  );
-  $form['refresh'] = array('#type' => 'select',
-    '#title' => t('Update interval'),
-    '#default_value' => $edit['refresh'],
-    '#options' => $period,
-    '#description' => t('The refresh interval indicating how often you want to update this feed. Requires crontab.'),
-  );
-
-  // Handling of categories:
-  $options = array();
-  $values = array();
-  $categories = db_query('SELECT c.cid, c.title, f.fid FROM {aggregator_category} c LEFT JOIN {aggregator_category_feed} f ON c.cid = f.cid AND f.fid = %d ORDER BY title', $edit['fid']);
-  while ($category = db_fetch_object($categories)) {
-    $options[$category->cid] = $category->title;
-    if ($category->fid) $values[] = check_plain($category->cid);
-  }
-  if ($options) {
-    $form['category'] = array('#type' => 'checkboxes',
-      '#title' => t('Categorize news items'),
-      '#default_value' => $values,
-      '#options' => $options,
-      '#description' => t('New items in this feed will be automatically filed in the checked categories as they are received.'),
-    );
-  }
-  $form['submit'] = array('#type' => 'submit', '#value' =>t('Submit'));
-
-  if ($edit['fid']) {
-    $form['delete'] = array('#type' => 'submit', '#value' =>t('Delete'));
-    $form['fid'] = array('#type' => 'hidden', '#value' => $edit['fid']);
-  }
-
-  return drupal_get_form('aggregator_form_feed', $form);
-}
-
-/**
- * Validate aggregator_form_feed form submissions.
- */
-function aggregator_form_feed_validate($form_id, $form_values) {
-  if ($_POST['op'] == t('Submit')) {
-    // Check for duplicate titles
-    if (isset($form_values['fid'])) {
-      $result = db_query("SELECT title, url FROM {aggregator_feed} WHERE (title = '%s' OR url='%s') AND fid != %d", $form_values['title'], $form_values['url'], $form_values['fid']);
-    }
-    else {
-      $result = db_query("SELECT title, url FROM {aggregator_feed} WHERE title = '%s' OR url='%s'", $form_values['title'], $form_values['url']);
-    }
-    while ($feed = db_fetch_object($result)) {
-      if (strcasecmp($feed->title, $form_values['title']) == 0) {
-        form_set_error('title', t('A feed named %feed already exists. Please enter a unique title.', array('%feed' => theme('placeholder', $form_values['title']))));
-      }
-    }
-  }
-}
-
-/**
- * Process aggregator_form_feed form submissions.
- * @todo Add delete confirmation dialog.
- */
-function aggregator_form_feed_submit($form_id, $form_values) {
-  if ($_POST['op'] == t('Delete')) {
-    $title = $form_values['title'];
-    // Unset the title:
-    unset($form_values['title']);
-  }
-  aggregator_save_feed($form_values);
-  menu_rebuild();
-  if (isset($form_values['fid'])) {
-    if (isset($form_values['title'])) {
-      drupal_set_message(t('The feed %feed has been updated.', array('%feed' => theme('placeholder', $form_values['title']))));
-      if (arg(0) == 'admin') {
-        return 'admin/aggregator/';
-      }
-      else {
-        return 'aggregator/sources/'. $form_values['fid'];
-      }
-    }
-    else {
-      watchdog('aggregator', t('Feed %feed deleted.', array('%feed' => theme('placeholder', $title))));
-      drupal_set_message(t('The feed %feed has been deleted.', array('%feed' => theme('placeholder', $title))));
-      if (arg(0) == 'admin') {
-        return 'admin/aggregator/';
-      }
-      else {
-        return 'aggregator/sources/';
-      }
-    }
-  }
-  else {
-    watchdog('aggregator', t('Feed %feed added.', array('%feed' => theme('placeholder', $form_values['title']))), WATCHDOG_NOTICE, l(t('view'), 'admin/aggregator'));
-    drupal_set_message(t('The feed %feed has been added.', array('%feed' => theme('placeholder', $form_values['title']))));
-  }
-}
-
-/**
- * Add/edit/delete an aggregator feed.
- */
-function aggregator_save_feed($edit) {
-  if ($edit['fid']) {
-    // An existing feed is being modified, delete the category listings.
-    db_query('DELETE FROM {aggregator_category_feed} WHERE fid = %d', $edit['fid']);
-  }
-  if ($edit['fid'] && $edit['title']) {
-    db_query("UPDATE {aggregator_feed} SET title = '%s', url = '%s', refresh = %d WHERE fid = %d", $edit['title'], $edit['url'], $edit['refresh'], $edit['fid']);
-  }
-  else if ($edit['fid']) {
-    $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d', $edit['fid']);
-    while ($item = db_fetch_object($result)) {
-      $items[] = "iid = $item->iid";
-    }
-    if ($items) {
-      db_query('DELETE FROM {aggregator_category_item} WHERE '. implode(' OR ', $items));
-    }
-    db_query('DELETE FROM {aggregator_feed} WHERE fid = %d', $edit['fid']);
-    db_query('DELETE FROM {aggregator_item} WHERE fid = %d', $edit['fid']);
-  }
-  else if ($edit['title']) {
-    // A single unique id for bundles and feeds, to use in blocks.
-    $edit['fid'] = db_next_id('{aggregator_feed}_fid');
-    db_query("INSERT INTO {aggregator_feed} (fid, title, url, refresh, block) VALUES (%d, '%s', '%s', %d, 5)", $edit['fid'], $edit['title'], $edit['url'], $edit['refresh']);
-  }
-  if ($edit['title']) {
-    // The feed is being saved, save the categories as well.
-    if ($edit['category']) {
-      foreach ($edit['category'] as $cid => $value) {
-        if ($value) {
-          db_query('INSERT INTO {aggregator_category_feed} (fid, cid) VALUES (%d, %d)', $edit['fid'], $cid);
-        }
-      }
-    }
-  }
-}
-
-function aggregator_remove($feed) {
-  $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d', $feed['fid']);
-  while ($item = db_fetch_object($result)) {
-    $items[] = "iid = $item->iid";
-  }
-  if ($items) {
-    db_query('DELETE FROM {aggregator_category_item} WHERE '. implode(' OR ', $items));
-  }
-  db_query('DELETE FROM {aggregator_item} WHERE fid = %d', $feed['fid']);
-  db_query("UPDATE {aggregator_feed} SET checked = 0, etag = '', modified = 0 WHERE fid = %d", $feed['fid']);
-  drupal_set_message(t('The news items from %site have been removed.', array('%site' => theme('placeholder', $feed['title']))));
-}
-
-/**
- * Call-back function used by the XML parser.
- */
-function aggregator_element_start($parser, $name, $attributes) {
-  global $item, $element, $tag, $items, $channel;
-
-  switch ($name) {
-    case 'IMAGE':
-    case 'TEXTINPUT':
-    case 'CONTENT':
-    case 'SUMMARY':
-    case 'TAGLINE':
-    case 'SUBTITLE':
-    case 'LOGO':
-    case 'INFO':
-      $element = $name;
-      break;
-    case 'ID':
-      if ($element != 'ITEM') {
-        $element = $name;
-      }
-    case 'LINK':
-      if ($attributes['REL'] == 'alternate') {
-        if ($element == 'ITEM') {
-          $items[$item]['LINK'] = $attributes['HREF'];
-        }
-        else {
-          $channel['LINK'] = $attributes['HREF'];
-        }
-      }
-      break;
-    case 'ITEM':
-      $element = $name;
-      $item += 1;
-      break;
-    case 'ENTRY':
-      $element = 'ITEM';
-      $item += 1;
-      break;
-  }
-
-  $tag = $name;
-}
-
-/**
- * Call-back function used by the XML parser.
- */
-function aggregator_element_end($parser, $name) {
-  global $element;
-
-  switch ($name) {
-    case 'IMAGE':
-    case 'TEXTINPUT':
-    case 'ITEM':
-    case 'ENTRY':
-    case 'CONTENT':
-    case 'INFO':
-      $element = '';
-      break;
-    case 'ID':
-      if ($element == 'ID') {
-        $element = '';
-      }
-  }
-}
-
-/**
- * Call-back function used by the XML parser.
- */
-function aggregator_element_data($parser, $data) {
-  global $channel, $element, $items, $item, $image, $tag;
-
-  switch ($element) {
-    case 'ITEM':
-      $items[$item][$tag] .= $data;
-      break;
-    case 'IMAGE':
-    case 'LOGO':
-      $image[$tag] .= $data;
-      break;
-    case 'LINK':
-      if ($data) {
-        $items[$item][$tag] .= $data;
-      }
-      break;
-    case 'CONTENT':
-      $items[$item]['CONTENT'] .= $data;
-      break;
-    case 'SUMMARY':
-      $items[$item]['SUMMARY'] .= $data;
-      break;
-    case 'TAGLINE':
-    case 'SUBTITLE':
-      $channel['DESCRIPTION'] .= $data;
-      break;
-    case 'INFO':
-    case 'ID':
-    case 'TEXTINPUT':
-      // The sub-element is not supported. However, we must recognize
-      // it or its contents will end up in the item array.
-      break;
-    default:
-      $channel[$tag] .= $data;
-  }
-}
-
-/**
- * Checks a news feed for new items.
- */
-function aggregator_refresh($feed) {
-  global $channel, $image;
-
-  // Generate conditional GET headers.
-  $headers = array();
-  if ($feed['etag']) {
-    $headers['If-None-Match'] = $feed['etag'];
-  }
-  if ($feed['modified']) {
-    $headers['If-Modified-Since'] = gmdate('D, d M Y H:i:s', $feed['modified']) .' GMT';
-  }
-
-  // Request feed.
-  $result = drupal_http_request($feed['url'], $headers);
-
-  // Process HTTP response code.
-  switch ($result->code) {
-    case 304:
-      db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', time(), $feed['fid']);
-      drupal_set_message(t('There is no new syndicated content from %site.', array('%site' => theme('placeholder', $feed['title']))));
-      break;
-    case 301:
-      $feed['url'] = $result->redirect_url;
-      watchdog('aggregator', t('Updated URL for feed %title to %url.', array('%title' => theme('placeholder', $feed['title']), '%url' => theme('placeholder', $feed['url']))));
-
-    case 200:
-    case 302:
-    case 307:
-      // Filter the input data:
-     if (aggregator_parse_feed($result->data, $feed)) {
-
-        if ($result->headers['Last-Modified']) {
-          $modified = strtotime($result->headers['Last-Modified']);
-        }
-
-        /*
-        ** Prepare the channel data:
-        */
-
-        foreach ($channel as $key => $value) {
-          $channel[$key] = trim($value);
-        }
-
-        /*
-        ** Prepare the image data (if any):
-        */
-
-        foreach ($image as $key => $value) {
-          $image[$key] = trim($value);
-        }
-
-        if ($image['LINK'] && $image['URL'] && $image['TITLE']) {
-          // Note, we should really use theme_image() here but that only works with local images it won't work with images fetched with a URL unless PHP version > 5
-          $image = '<a href="'. check_url($image['LINK']) .'" class="feed-image"><img src="'. check_url($image['URL']) .'" alt="'. check_plain($image['TITLE']) .'" /></a>';
-        }
-        else {
-          $image = NULL;
-        }
-
-        /*
-        ** Update the feed data:
-        */
-
-        db_query("UPDATE {aggregator_feed} SET url = '%s', checked = %d, link = '%s', description = '%s', image = '%s', etag = '%s', modified = %d WHERE fid = %d", $feed['url'], time(), $channel['LINK'], $channel['DESCRIPTION'], $image, $result->headers['ETag'], $modified, $feed['fid']);
-
-        /*
-        ** Clear the cache:
-        */
-
-        cache_clear_all();
-
-        watchdog('aggregator', t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed['title']))));
-        drupal_set_message(t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed['title']))));
-      }
-      break;
-    default:
-      watchdog('aggregator', t('The RSS-feed from %site seems to be broken, due to "%error".', array('%site' => theme('placeholder', $feed['title']), '%error' => theme('placeholder', $result->code .' '. $result->error))), WATCHDOG_WARNING);
-      drupal_set_message(t('The RSS-feed from %site seems to be broken, because of error "%error".', array('%site' => theme('placeholder', $feed['title']), '%error' => theme('placeholder', $result->code .' '. $result->error))));
-  }
-}
-
-/**
- * Parse the W3C date/time format, a subset of ISO 8601. PHP date parsing
- * functions do not handle this format.
- * See http://www.w3.org/TR/NOTE-datetime for more information.
- * Originally from MagpieRSS (http://magpierss.sourceforge.net/).
- *
- * @param $date_str A string with a potentially W3C DTF date.
- * @return A timestamp if parsed successfully or -1 if not.
- */
-function aggregator_parse_w3cdtf($date_str) {
-  if (preg_match('/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/', $date_str, $match)) {
-    list($year, $month, $day, $hours, $minutes, $seconds) = array($match[1], $match[2], $match[3], $match[4], $match[5], $match[6]);
-    // calc epoch for current date assuming GMT
-    $epoch = gmmktime($hours, $minutes, $seconds, $month, $day, $year);
-    if ($match[10] != 'Z') { // Z is zulu time, aka GMT
-      list($tz_mod, $tz_hour, $tz_min) = array($match[8], $match[9], $match[10]);
-      // zero out the variables
-      if (!$tz_hour) {
-        $tz_hour = 0;
-      }
-      if (!$tz_min) {
-        $tz_min = 0;
-      }
-      $offset_secs = (($tz_hour * 60) + $tz_min) * 60;
-      // is timezone ahead of GMT?  then subtract offset
-      if ($tz_mod == '+') {
-        $offset_secs *= -1;
-      }
-      $epoch += $offset_secs;
-    }
-    return $epoch;
-  }
-  else {
-    return FALSE;
-  }
-}
-
-function aggregator_parse_feed(&$data, $feed) {
-  global $items, $image, $channel;
-
-  // Unset the global variables before we use them:
-  unset($GLOBALS['element'], $GLOBALS['item'], $GLOBALS['tag']);
-  $items = array();
-  $image = array();
-  $channel = array();
-
-  // parse the data:
-  $xml_parser = drupal_xml_parser_create($data);
-  xml_set_element_handler($xml_parser, 'aggregator_element_start', 'aggregator_element_end');
-  xml_set_character_data_handler($xml_parser, 'aggregator_element_data');
-
-  if (!xml_parse($xml_parser, $data, 1)) {
-    watchdog('aggregator', t('The RSS-feed from %site seems to be broken, due to an error "%error" on line %line.', array('%site' => theme('placeholder', $feed['title']), '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))), WATCHDOG_WARNING);
-    drupal_set_message(t('The RSS-feed from %site seems to be broken, because of error "%error" on line %line.', array('%site' => theme('placeholder', $feed['title']), '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))), 'error');
-    return 0;
-  }
-  xml_parser_free($xml_parser);
-
-  /*
-  ** We reverse the array such that we store the first item last,
-  ** and the last item first.  In the database, the newest item
-  ** should be at the top.
-  */
-
-  $items = array_reverse($items);
-
-  foreach ($items as $item) {
-    unset($title, $link, $author, $description);
-
-    // Prepare the item:
-    foreach ($item as $key => $value) {
-      $item[$key] = trim($value);
-    }
-
-    /*
-    ** Resolve the item's title.  If no title is found, we use
-    ** up to 40 characters of the description ending at a word
-    ** boundary but not splitting potential entities.
-    */
-
-    if ($item['TITLE']) {
-      $title = $item['TITLE'];
-    }
-    else {
-      $title = preg_replace('/^(.*)[^\w;&].*?$/', "\\1", truncate_utf8($item['DESCRIPTION'], 40));
-    }
-
-    /*
-    ** Resolve the items link.
-    */
-
-    if ($item['LINK']) {
-      $link = $item['LINK'];
-    }
-    elseif ($item['GUID'] && (strncmp($item['GUID'], 'http://', 7) == 0)) {
-      $link = $item['GUID'];
-    }
-    else {
-      $link = $feed['link'];
-    }
-
-    /**
-     * Atom feeds have a CONTENT and/or SUMMARY tag instead of a DESCRIPTION tag
-     */
-    if ($item['CONTENT:ENCODED']) {
-      $item['DESCRIPTION'] = $item['CONTENT:ENCODED'];
-    }
-    else if ($item['SUMMARY']) {
-      $item['DESCRIPTION'] = $item['SUMMARY'];
-    }
-
-    /*
-    ** Try to resolve and parse the item's publication date.  If no
-    ** date is found, we use the current date instead.
-    */
-
-    if ($item['PUBDATE']) $date = $item['PUBDATE'];                        // RSS 2.0
-    else if ($item['DC:DATE']) $date = $item['DC:DATE'];                   // Dublin core
-    else if ($item['DCTERMS:ISSUED']) $date = $item['DCTERMS:ISSUED'];     // Dublin core
-    else if ($item['DCTERMS:CREATED']) $date = $item['DCTERMS:CREATED'];   // Dublin core
-    else if ($item['DCTERMS:MODIFIED']) $date = $item['DCTERMS:MODIFIED']; // Dublin core
-    else if ($item['ISSUED']) $date = $item['ISSUED'];                     // Atom XML
-    else if ($item['CREATED']) $date = $item['CREATED'];                   // Atom XML
-    else if ($item['MODIFIED']) $date = $item['MODIFIED'];                 // Atom XML
-    else $date = 'now';
-
-    $timestamp = strtotime($date); // As of PHP 5.1.0, strtotime returns FALSE on failure instead of -1.
-    if ($timestamp <= 0) {
-      $timestamp = aggregator_parse_w3cdtf($date); // Returns FALSE on failure
-      if (!$timestamp) {
-        $timestamp = time(); // better than nothing
-      }
-    }
-
-    /*
-    ** Save this item.  Try to avoid duplicate entries as much as
-    ** possible.  If we find a duplicate entry, we resolve it and
-    ** pass along it's ID such that we can update it if needed.
-    */
-
-    if ($link && $link != $feed['link'] && $link != $feed['url']) {
-      $entry = db_fetch_object(db_query("SELECT iid FROM {aggregator_item} WHERE fid = %d AND link = '%s'", $feed['fid'], $link));
-    }
-    else {
-      $entry = db_fetch_object(db_query("SELECT iid FROM {aggregator_item} WHERE fid = %d AND title = '%s'", $feed['fid'], $title));
-    }
-
-    aggregator_save_item(array('iid' => $entry->iid, 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => $item['AUTHOR'], 'description' => $item['DESCRIPTION']));
-  }
-
-  /*
-  ** Remove all items that are older than flush item timer:
-  */
-
-  $age = time() - variable_get('aggregator_clear', 9676800);
-  $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d AND timestamp < %d', $feed['fid'], $age);
-
-  if (db_num_rows($result)) {
-    $items = array();
-    while ($item = db_fetch_object($result)) {
-      $items[] = $item->iid;
-    }
-    db_query('DELETE FROM {aggregator_category_item} WHERE iid IN ('. implode(', ', $items) .')');
-    db_query('DELETE FROM {aggregator_item} WHERE fid = %d AND timestamp < %d', $feed['fid'], $age);
-  }
-
-  return 1;
-}
-
-function aggregator_save_item($edit) {
-  if ($edit['iid'] && $edit['title']) {
-    db_query("UPDATE {aggregator_item} SET title = '%s', link = '%s', author = '%s', description = '%s' WHERE iid = %d", $edit['title'], $edit['link'], $edit['author'], $edit['description'], $edit['iid']);
-  }
-  else if ($edit['iid']) {
-    db_query('DELETE FROM {aggregator_item} WHERE iid = %d', $edit['iid']);
-    db_query('DELETE FROM {aggregator_category_item} WHERE iid = %d', $edit['iid']);
-  }
-  else if ($edit['title'] && $edit['link']) {
-    $edit['iid'] = db_next_id('{aggregator_item}_iid');
-    db_query("INSERT INTO {aggregator_item} (iid, fid, title, link, author, description, timestamp) VALUES (%d, %d, '%s', '%s', '%s', '%s', %d)", $edit['iid'], $edit['fid'], $edit['title'], $edit['link'], $edit['author'], $edit['description'], $edit['timestamp']);
-    // file the items in the categories indicated by the feed
-    $categories = db_query('SELECT cid FROM {aggregator_category_feed} WHERE fid = %d', $edit['fid']);
-    while ($category = db_fetch_object($categories)) {
-      db_query('INSERT INTO {aggregator_category_item} (cid, iid) VALUES (%d, %d)', $category->cid, $edit['iid']);
-    }
-  }
-}
-
-function aggregator_get_feed($fid) {
-  return db_fetch_array(db_query('SELECT * FROM {aggregator_feed} WHERE fid = %d', $fid));
-}
-
-function aggregator_get_category($cid) {
-  return db_fetch_array(db_query('SELECT * FROM {aggregator_category} WHERE cid = %d', $cid));
-}
-
-function aggregator_view() {
-  $result = db_query('SELECT f.*, COUNT(i.iid) AS items FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.etag, f.modified, f.image, f.block ORDER BY f.title');
-
-  $output .= '<h3>'. t('Feed overview') .'</h3>';
-
-  $header = array(t('Title'), t('Items'), t('Last update'), t('Next update'), array('data' => t('Operations'), 'colspan' => '3'));
-  $rows = array();
-  while ($feed = db_fetch_object($result)) {
-    $rows[] = array(l($feed->title, "aggregator/sources/$feed->fid"), format_plural($feed->items, '1 item', '%count items'), ($feed->checked ? t('%time ago', array('%time' => format_interval(time() - $feed->checked))) : t('never')), ($feed->checked ? t('%time left', array('%time' => format_interval($feed->checked + $feed->refresh - time()))) : t('never')), l(t('edit'), "admin/aggregator/edit/feed/$feed->fid"), l(t('remove items'), "admin/aggregator/remove/$feed->fid"), l(t('update items'), "admin/aggregator/update/$feed->fid"));
-  }
-  $output .= theme('table', $header, $rows);
-
-  $result = db_query('SELECT c.cid, c.title, count(ci.iid) as items FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid GROUP BY c.cid, c.title ORDER BY title');
-
-  $output .= '<h3>'. t('Category overview') .'</h3>';
-
-  $header = array(t('Title'), t('Items'), t('Operations'));
-  $rows = array();
-  while ($category = db_fetch_object($result)) {
-    $rows[] = array(l($category->title, "aggregator/categories/$category->cid"), format_plural($category->items, '1 item', '%count items'), l(t('edit'), "admin/aggregator/edit/category/$category->cid"));
-  }
-  $output .= theme('table', $header, $rows);
-
-  return $output;
-}
-
-/**
- * Menu callback; removes all items from a feed, then redirects to the overview page.
- */
-function aggregator_admin_remove_feed($feed) {
-  aggregator_remove(aggregator_get_feed($feed));
-  drupal_goto('admin/aggregator');
-}
-
-/**
- * Menu callback; refreshes a feed, then redirects to the overview page.
- */
-function aggregator_admin_refresh_feed($feed) {
-  aggregator_refresh(aggregator_get_feed($feed));
-  drupal_goto('admin/aggregator');
-}
-
-/**
- * Menu callback; displays the aggregator administration page.
- */
-function aggregator_admin_overview() {
-  return aggregator_view();
-}
-
-/**
- * Menu callback; displays the most recent items gathered from any feed.
- */
-function aggregator_page_last() {
-  return _aggregator_page_list('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC', arg(1));
-}
-
-/**
- * Menu callback; displays all the items captured from a particular feed.
- */
-function aggregator_page_source() {
-  $feed = db_fetch_object(db_query('SELECT * FROM {aggregator_feed} WHERE fid = %d', arg(2)));
-  $info = theme('aggregator_feed', $feed);
-
-  return _aggregator_page_list('SELECT * FROM {aggregator_item} WHERE fid = '. $feed->fid .' ORDER BY timestamp DESC, iid DESC', arg(3), $info);
-}
-
-/**
- * Menu callback; displays all the items aggregated in a particular category.
- */
-function aggregator_page_category() {
-  $category = db_fetch_object(db_query('SELECT cid, title FROM {aggregator_category} WHERE cid = %d', arg(2)));
-
-  return _aggregator_page_list('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = '. $category->cid .' ORDER BY timestamp DESC, iid DESC', arg(3));
-}
-
-/**
- * Prints an aggregator page listing a number of feed items. Various
- * menu callbacks use this function to print their feeds.
- */
-function _aggregator_page_list($sql, $op, $header = '') {
-  $categorize = (user_access('administer news feeds') && ($op == 'categorize'));
-
-  $output = '<div id="aggregator">';
-
-  $form['header'] = array('#value' => $header);
-  $output .= $form['header']['#value'];
-
-  $result = pager_query($sql, 20);
-  $categories = array();
-  while ($item = db_fetch_object($result)) {
-    $form['items'][$item->iid] = array('#value' => theme('aggregator_page_item', $item));
-    $output .= $form['items'][$item->iid]['#value'];
-    $form['categories'][$item->iid] = array();
-
-    if ($categorize) {
-
-      $categories_result = db_query('SELECT c.cid, c.title, ci.iid FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid AND ci.iid = %d', $item->iid);
-      $selected = array();
-      while ($category = db_fetch_object($categories_result)) {
-        if (!$done) {
-          $categories[$category->cid] = check_plain($category->title);
-        }
-        if ($category->iid) {
-          $selected[] = $category->cid;
-        }
-      }
-      $done = true;
-      $form['categories'][$item->iid] = array(
-        '#type' => variable_get('aggregator_category_selector', 'checkboxes'),
-        '#default_value' => $selected, '#options' => $categories,
-        '#size' => 10, '#multiple' => true
-      );
-    }
-  }
-  $output .= '</div>';
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save categories'));
-  $form['pager'] = array('#value' => theme('pager', NULL, 20, 0));
-  $output .= $form['pager']['#value'];
-
-  // arg(1) is undefined if we are at the top aggregator URL
-  // is there a better way to do this?
-  if (!arg(1)) {
-    $form['feed_icon'] = array('#value' => theme('feed_icon', url('aggregator/rss')));
-  }
-  elseif (arg(1) == 'categories' && arg(2) && !arg(3)) {
-    $form['feed_icon'] = array('#value' => theme('feed_icon', url('aggregator/rss/' . arg(2))));
-  }
-  $output .= $form['feed_icon']['#value'];
-
-  return ($categorize) ? drupal_get_form('aggregator_page_list', $form) : $output;
-}
-
-function theme_aggregator_page_list($form) {
-  $output = '<div id="aggregator">';
-  $output .= form_render($form['header']);
-  $rows = array();
-  if ($form['items']) {
-    foreach (element_children($form['items']) as $key) {
-      if (is_array($form['items'][$key])) {
-        $rows[] = array(form_render($form['items'][$key]), array('data' => form_render($form['categories'][$key]), 'class' => 'categorize-item'));
-      }
-    }
-  }
-  $output .= theme('table', array('', t('Categorize')), $rows);
-  $output .= form_render($form['submit']);
-  $output .= '</div>';
-  $output .= form_render($form);
-  return $output;
-}
-
-function aggregator_page_list_validate($form_id, &$form) {
-  if (!user_access('administer news feeds')) {
-    form_error($form, t('You are not allowed to categorize this feed item.'));
-  }
-}
-
-function aggregator_page_list_submit($form_id, $form_values) {
-  foreach ($form_values as $iid => $selection) {
-    db_query('DELETE FROM {aggregator_category_item} WHERE iid = %d', $iid);
-    foreach ($selection as $cid) {
-      if ($cid) {
-        db_query('INSERT INTO {aggregator_category_item} (cid, iid) VALUES (%d, %d)', $cid, $iid);
-      }
-    }
-  }
-  drupal_set_message(t('The categories have been saved.'));
-}
-
-/**
- * Menu callback; displays all the feeds used by the aggregator.
- */
-function aggregator_page_sources() {
-  $result = db_query('SELECT f.fid, f.title, f.description, f.image, MAX(i.timestamp) AS last FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.description, f.image ORDER BY last DESC, f.title');
-  $output = "<div id=\"aggregator\">\n";
-  while ($feed = db_fetch_object($result)) {
-    $output .= '<h2>'. check_plain($feed->title) ."</h2>\n";
-
-    // Most recent items:
-    $list = array();
-    if (variable_get('aggregator_summary_items', 3)) {
-      $items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {aggregator_item} i WHERE i.fid = %d ORDER BY i.timestamp DESC', $feed->fid, 0, variable_get('aggregator_summary_items', 3));
-      while ($item = db_fetch_object($items)) {
-        $list[] = theme('aggregator_summary_item', $item);
-      }
-    }
-    $output .= theme('item_list', $list);
-    $output .= '<div class="links">'. theme('links', array(l(t('more'), 'aggregator/sources/'. $feed->fid))) ."</div>\n";
-  }
-  $output .= theme('xml_icon', url('aggregator/opml'));
-  $output .= '</div>';
-  return $output;
-}
-
-/**
- * Menu callback; generate an RSS 0.92 feed of aggregator items or categories.
- */
-function aggregator_page_rss() {
-  // arg(2) is the passed cid, only select for that category
-  $result = NULL;
-  if (arg(2)) {
-    $category = db_fetch_object(db_query('SELECT cid, title FROM {aggregator_category} WHERE cid = %d', arg(2)));
-    $url = '/categories/' . $category->cid;
-    $title = ' ' . t('in category') . ' ' . $category->title;
-    $sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = %d ORDER BY timestamp DESC, iid DESC';
-    $result = db_query_range($sql, $category->cid, 0, variable_get('feed_default_items', 10));
-  }
-  // or, get the default aggregator items
-  else {
-    $sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC';
-    $result = db_query_range($sql, 0, variable_get('feed_default_items', 10));
-  }
-
-  while ($item = db_fetch_object($result)) {
-    switch (variable_get('feed_item_length', 'teaser')) {
-      case 'teaser':
-        $teaser = node_teaser($item->description);
-        if ($teaser != $item->description) {
-          $teaser .= '<p><a href="'. check_url($item->link) .'">'. t('read more') ."</a></p>\n";
-        }
-        $item->description = $teaser;
-        break;
-      case 'title':
-        $item->description = '';
-        break;
-    }
-    $items .= format_rss_item($item->ftitle . ': ' . $item->title, $item->link, $item->description, array('pubDate' => date('r', $item->timestamp)));
-  }
-
-  $output .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
-  $output .= "<rss version=\"2.0\">\n";
-  $output .= format_rss_channel(variable_get('site_name', t('Drupal')) . ' ' . t('aggregator'), url('aggregator' . $url, NULL, NULL, TRUE), variable_get('site_name', t('Drupal')) . ' - ' . t('aggregated feeds') . $title, $items, 'en');
-  $output .= "</rss>\n";
-
-  drupal_set_header('Content-Type: application/rss+xml; charset=utf-8');
-  print $output;
-}
-
-/**
- * Menu callback; generates an OPML representation of all feeds.
- */
-function aggregator_page_opml($cid = NULL) {
-  if ($cid) {
-    $result = db_query('SELECT f.title, f.url FROM {aggregator_feed} f LEFT JOIN {aggregator_category_feed} c on f.fid = c.fid WHERE c.cid = %d ORDER BY title', $cid);
-  }
-  else {
-    $result = db_query('SELECT * FROM {aggregator_feed} ORDER BY title');
-  }
-
-  $output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
-  $output .= "<opml version=\"1.1\">\n";
-  $output .= "<head>\n";
-  $output .= '<title>'. check_plain(variable_get('site_name', 'Drupal')) ."</title>\n";
-  $output .= '<dateModified>'. gmdate('r') ."</dateModified>\n";
-  $output .= "</head>\n";
-  $output .= "<body>\n";
-
-  while ($feed = db_fetch_object($result)) {
-    $output .= '<outline text="'. check_plain($feed->title) .'" xmlUrl="'. check_url($feed->url) ."\" />\n";
-  }
-
-  $output .= "</body>\n";
-  $output .= "</opml>\n";
-
-  drupal_set_header('Content-Type: text/xml; charset=utf-8');
-  print $output;
-}
-
-/**
- * Menu callback; displays all the categories used by the aggregator.
- */
-function aggregator_page_categories() {
-  $result = db_query('SELECT c.cid, c.title, c.description FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid LEFT JOIN {aggregator_item} i ON ci.iid = i.iid GROUP BY c.cid, c.title, c.description');
-  $output = "<div id=\"aggregator\">\n";
-
-  while ($category = db_fetch_object($result)) {
-    $output .= '<h2>'. check_plain($category->title) ."</h2>\n";
-    if (variable_get('aggregator_summary_items', 3)) {
-      $list = array();
-      $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = %d ORDER BY i.timestamp DESC', $category->cid, 0, variable_get('aggregator_summary_items', 3));
-      while ($item = db_fetch_object($items)) {
-        $list[] = theme('aggregator_summary_item', $item);
-      }
-      $output .= theme('item_list', $list);
-    }
-    $output .= '<div class="links">'. theme('links', array(l(t('more'), 'aggregator/categories/'. $category->cid))) ."</div>\n";
-  }
-  $output .= '</div>';
-
-  return $output;
-}
-
-/**
- * Format a news feed.
- *
- * @ingroup themeable
- */
-function theme_aggregator_feed($feed) {
-  $output  = '<div class="feed-source">';
-  $output .= theme('feed_icon', $feed->url) ."\n";
-  $output .= $feed->image;
-  $output .= '<div class="feed-description">'. aggregator_filter_xss($feed->description) ."</div>\n";
-  $output .= '<div class="feed-url"><em>'. t('URL:') .'</em> '. l($feed->link, $feed->link, array(), NULL, NULL, TRUE) ."</div>\n";
-
-  if ($feed->checked) {
-    $updated = t('%time ago', array('%time' => format_interval(time() - $feed->checked)));
-  }
-  else {
-    $updated = t('never');
-  }
-
-  if (user_access('administer news feeds')) {
-    $updated = l($updated, 'admin/aggregator');
-  }
-
-  $output .= '<div class="feed-updated"><em>'. t('Updated:') . "</em> $updated</div>";
-  $output .= "</div>\n";
-
-  return $output;
-}
-
-/**
- * Format an individual feed item for display in the block.
- *
- * @ingroup themeable
- */
-function theme_aggregator_block_item($item, $feed = 0) {
-  global $user;
-
-  if ($user->uid && module_exist('blog') && user_access('edit own blog')) {
-    if ($image = theme('image', 'misc/blog.png', t('blog it'), t('blog it'))) {
-      $output .= '<div class="icon">'. l($image, 'node/add/blog', array('title' => t('Comment on this news item in your personal blog.'), 'class' => 'blog-it'), "iid=$item->iid", NULL, FALSE, TRUE) .'</div>';
-    }
-  }
-
-  // Display the external link to the item.
-  $output .= '<a href="'. check_url($item->link) .'">'. check_plain($item->title) ."</a>\n";
-
-  return $output;
-}
-
-/**
- * Return a themed item heading for summary pages located at "aggregator/sources"
- * and "aggregator/categories".
- *
- * @param $item The item object from the aggregator module.
- * @return A string containing the output.
- *
- * @ingroup themeable
- */
-function theme_aggregator_summary_item($item) {
-  $output = '<a href="'. check_url($item->link) .'">'. check_plain($item->title) .'</a> <span class="age">'. t('%age old', array('%age' => format_interval(time() - $item->timestamp))) .'</span>';
-  if ($item->feed_link) {
-    $output .= ', <span class="source"><a href="'. check_url($item->feed_link) .'">'. check_plain($item->feed_title) .'</a></span>';
-  }
-  return $output ."\n";
-}
-
-/**
- * Format an individual feed item for display on the aggregator page.
- *
- * @ingroup themeable
- */
-function theme_aggregator_page_item($item) {
-
-  $source = '';
-  if ($item->ftitle && $item->fid) {
-    $source = l($item->ftitle, "aggregator/sources/$item->fid", array('class' => 'feed-item-source')) . ' -';
-  }
-
-  if (date('Ymd', $item->timestamp) == date('Ymd')) {
-    $source_date = t('%ago ago', array('%ago' => format_interval(time() - $item->timestamp)));
-  }
-  else {
-    $source_date = format_date($item->timestamp, 'custom', variable_get('date_format_medium', 'D, Y-m-d H:i'));
-  }
-
-  $output .= "<div class=\"feed-item\">\n";
-  $output .= '<h3 class="feed-item-title"><a href="'. check_url($item->link) .'">'. check_plain($item->title) ."</a></h3>\n";
-  $output .= "<div class=\"feed-item-meta\">$source <span class=\"feed-item-date\">$source_date</span></div>\n";
-
-  if ($item->description) {
-    $output .= '<div class="feed-item-body">'. aggregator_filter_xss($item->description) ."</div>\n";
-  }
-
-  $result = db_query('SELECT c.title, c.cid FROM {aggregator_category_item} ci LEFT JOIN {aggregator_category} c ON ci.cid = c.cid WHERE ci.iid = %d ORDER BY c.title', $item->iid);
-  $categories = array();
-  while ($category = db_fetch_object($result)) {
-    $categories[] = l($category->title, 'aggregator/categories/'. $category->cid);
-  }
-  if ($categories) {
-    $output .= '<div class="feed-item-categories">'. t('Categories') .': '. implode(', ', $categories) ."</div>\n";
-  }
-
-  $output .= "</div>\n";
-
-  return $output;
-}
-
-/**
- * Safely render HTML content, as allowed.
- */
-function aggregator_filter_xss($value) {
-  return filter_xss($value, preg_split('/\s+|<|>/', variable_get("aggregator_allowed_html_tags", '<a> <b> <br> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>'), -1, PREG_SPLIT_NO_EMPTY));
-}
-
-/**
- * Helper function for drupal_map_assoc.
- */
-function _aggregator_items($count) {
-  return format_plural($count, '1 item', '%count items');
-}
diff --git a/modules/archive.module b/modules/archive.module
deleted file mode 100644 (file)
index d015cb5..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-<?php
-// $Id: archive.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Displays a calendar to navigate old content.
- */
-
-/**
- * Implementation of hook_help().
- */
-function archive_help($section) {
-  switch ($section) {
-    case 'admin/help#archive':
-      $output = '<p>'. t('The archive page allows content to be viewed by date.  It also provides a monthly calendar view that users can use to navigate through content.') .'</p>';
-      $output .= '<p>'. t('To view the archive by date, select the date in the calendar.  Administrators can enable the <em>browse archives</em> block in block administration to allow users to browse by calendar.  Clicking on a date in the monthly calendar view shows the content for that date.  Users can navigate to different months using arrows beside the month\'s name in the calendar display.   The current date will be highlighted in the calendar.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>view your <a href="%archive">archive by day</a>.</li>
-<li>enable the <em>browse archives</em> block at <a href="%admin-block">administer &gt;&gt; block</a>.</li>
-</ul>
-', array('%archive' => url('archive'), '%admin-block' => url('admin/block')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%archive">Archive page</a>.', array('%archive' => 'http://drupal.org/handbook/modules/archive/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Displays a calendar for navigating older content.');
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function archive_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'archive',
-      'title' => t('archives'),
-      'access' => user_access('access content'),
-      'callback' => 'archive_page',
-      'type' => MENU_SUGGESTED_ITEM);
-  }
-  return $items;
-}
-
-/**
- * Implementation of hook_block().
- *
- * Generates a calendar for the current month, with links to the archives
- * for each day.
- */
-function archive_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $blocks[0]['info'] = t('Calendar to browse archives');
-    return $blocks;
-  }
-  else if ($op == 'view' && user_access('access content')) {
-    $block['subject'] = t('Browse archives');
-    $block['content'] = archive_calendar();
-    return $block;
-  }
-}
-
-/**
- * Generates a monthly calendar, for display in the archive block.
- */
-function archive_calendar() {
-  global $user;
-
-  // Extract today's date:
-  $start_of_today = mktime(0, 0, 0, date('n', time()), date('d', time()), date('Y', time())) + $user->timezone;
-  $end_of_today = mktime(23, 59, 59, date('n', time()), date('d', time()), date('Y', time())) + $user->timezone;
-
-  // Extract the requested date:
-  if (arg(0) == 'archive' && arg(3)) {
-    $year = arg(1);
-    $month = arg(2);
-    $day = arg(3);
-
-    $requested = mktime(0, 0, 0, $month, $day, $year) + $user->timezone;
-  }
-  else {
-    $year = date('Y', time());
-    $month  = date('n', time());
-    $day = date('d', time());
-
-    $requested = $end_of_today + $user->timezone;
-  }
-
-  $start_of_month = mktime(0, 0, 0, $month, 1, $year);
-
-  // Extract first day of the month:
-  $first = date('w', $start_of_month);
-
-  // Extract last day of the month:
-  $last = date('t', $start_of_month);
-
-  $end_of_month = mktime(23, 59, 59, $month, $last, $year);
-
-  $cache = cache_get("archive:calendar:$day-$month-$year");
-
-  if (!empty($cache)) {
-    return $cache->data;
-  }
-
-  // Calculate previous and next months dates and check for shorter months (28/30 days)
-  $prevmonth = mktime(23, 59, 59, $month - 1, 1, $year);
-  $prev = mktime(23, 59, 59, $month - 1, min(date('t', $prevmonth), $day), $year);
-  $nextmonth = mktime(23, 59, 59, $month + 1, 1, $year);
-  $next = mktime(23, 59, 59, $month + 1, min(date('t', $nextmonth), $day), $year);
-
-  $sql = 'SELECT n.nid, n.created FROM {node} n WHERE n.status = 1 AND n.created > %d AND n.created < %d ORDER BY n.created';
-  $sql = db_rewrite_sql($sql);
-  $result = db_query($sql, $start_of_month, $end_of_month);
-
-  $days_with_posts = array();
-  while ($day_with_post = db_fetch_object($result)) {
-    $daynum = date('j', $day_with_post->created + $user->timezone);
-    if (isset($days_with_posts[$daynum])) {
-      $days_with_posts[$daynum]++;
-    }
-    else {
-      $days_with_posts[$daynum] = 1;
-    }
-  }
-
-  // Generate calendar header:
-  $output .= "\n<!-- calendar -->\n";
-  $output .= '<div class="calendar">';
-  $output .= '<table summary="'. t('A calendar to browse the archives') .".\">\n";
-  $output .= ' <caption>'. l('«', 'archive/'. date('Y/m/d', $prev), array('title' => t('Previous month'))) .' '. format_date($requested, 'custom', 'F') . date(' Y', $requested) .' '. ($nextmonth <= time() ? l('»', 'archive/'. date('Y/m/d', $next), array('title' => t('Next month'))) : ' ') ."</caption>\n";
-
-  // First day of week (0 => Sunday, 1 => Monday, ...)
-  $weekstart = variable_get('date_first_day', 0);
-
-  // Last day of week
-  ($weekstart - 1 == -1) ? $lastday = 6 : $lastday = $weekstart - 1;
-
-  // Generate the days of the week:
-  $firstcolumn = mktime(0, 0, 0, 3, 20 + $weekstart, 1994);
-
-  $output .= " <tr class=\"header-week\">\n";
-  $days = array(t('Sunday') => t('Su'), t('Monday') => t('Mo'), t('Tuesday') => t('Tu'), t('Wednesday') => t('We'), t('Thursday') => t('Th'), t('Friday') => t('Fr'), t('Saturday') => t('Sa'));
-  if ($weekstart) {
-    $days = array_merge(array_slice($days, $weekstart), array_slice($days, 0, $weekstart));
-  }
-
-  foreach ($days as $fullname => $name) {
-    $output .= ' <th abbr="'. $fullname .'">'. $name . "</th>\n";
-  }
-  $output .= "</tr>\n";
-
-  // Initialize temporary variables:
-  $nday = 1;
-  $sday = $first;
-
-  // Loop through all the days of the month:
-  while ($nday <= $last) {
-    // Set up blank days for first week of the month (allowing individual blank day styling):
-    if ($first != $weekstart) {
-      $blankdays = ($first - $weekstart + 7) % 7;
-      $output .= " <tr class=\"row-week\">" . str_repeat("<td class=\"day-blank\">&nbsp;</td>\n", $blankdays);
-      $first = $weekstart;
-    }
-    // Start every week on a new line:
-    if ($sday == $weekstart) {
-      $output .= " <tr class=\"row-week\">\n";
-    }
-
-    // Print one cell:
-    $date = mktime(0, 0, 0, $month, $nday, $year) + $user->timezone;
-    if (isset($days_with_posts[$nday])) {
-      $daytext = l($nday, "archive/$year/$month/$nday", array("title" => format_plural($days_with_posts[$nday], "1 post", "%count posts")));
-      $dayclass = 'day-link';
-    }
-    else {
-      $daytext = $nday;
-      $dayclass = 'day-normal';
-    }
-    if ($date == $requested) {
-      $output .= "  <td class=\"day-selected\">$daytext</td>\n";
-    }
-    else if ($date == $start_of_today) {
-      $output .= "  <td class=\"day-today\">$daytext</td>\n";
-    }
-    else if ($date > $end_of_today) {
-      $output .= "  <td class=\"day-future\">$daytext</td>\n";
-    }
-    else {
-      $output .= "  <td class=\"$dayclass\">$daytext</td>\n";
-    }
-
-    // Start every week on a new line:
-    if ($sday == $lastday) {
-      $output .=  " </tr>\n";
-    }
-
-    // Update temporary variables:
-    $sday++;
-    $sday = $sday % 7;
-    $nday++;
-  }
-
-  // Complete the calendar (allowing individual blank day styling):
-  if ($sday != $weekstart) {
-    $end = (7 - $sday + $weekstart) % 7;
-    $output .= str_repeat("<td class=\"day-blank\">&nbsp;</td>\n", $end) . "</tr>\n";
-  }
-
-  $output .= "</table></div>\n\n";
-
-  cache_set("archive:calendar:$day-$month-$year", $output, CACHE_TEMPORARY);
-
-  return $output;
-}
-
-/**
- * Menu callback; lists all nodes posted on a given date.
- */
-function archive_page($year = 0, $month = 0, $day = 0) {
-  global $user;
-
-  $date = mktime(0, 0, 0, $month, $day, $year) - $user->timezone;
-  $date_end = mktime(0, 0, 0, $month, $day + 1, $year) - $user->timezone;
-
-  // Display form.
-  $output = archive_browse_form($year, $month, $day);
-
-  if ($year && $month && $day) {
-    // Fetch nodes for the selected date, if one was specified.
-    $sql = 'SELECT n.nid, n.created FROM {node} n WHERE n.status = 1 AND n.created > %d AND n.created < %d ORDER BY n.created';
-    $sql = db_rewrite_sql($sql);
-    $result = db_query_range($sql, $date, $date_end, 0, 20);
-    if (db_num_rows($result) > 0) {
-      while ($nid = db_fetch_object($result)) {
-        $output .= node_view(node_load($nid->nid), 1);
-      }
-    }
-    else {
-      $output .= theme('box', t('No posts found.'), '');
-    }
-  }
-  else {
-    $output .= theme('box', t('No posts found.'), '');
-  }
-
-  return $output;
-}
-
-/**
- * Generate a form that retrieves archives for a certain date.
- */
-function archive_browse_form($year, $month, $day) {
-  // Prepare the values of the form fields.
-  $years = drupal_map_assoc(range(2000, date('Y')));
-  $months = array(1 => t('January'), 2 => t('February'), 3 => t('March'), 4 => t('April'), 5 => t('May'), 6 => t('June'), 7 => t('July'), 8 => t('August'), 9 => t('September'), 10 => t('October'), 11 => t('November'), 12 => t('December'));
-  $days = drupal_map_assoc(range(1, 31));
-
-  $form['year']  = array('#type' => 'select',
-    '#default_value' => ($year ? $year : date('Y')),
-    '#options' => $years,
-  );
-  $form['month'] = array('#type' => 'select',
-    '#default_value' => ($month ? $month : date('m')),
-    '#options' => $months,
-  );
-  $form['day']   = array('#type' => 'select',
-    '#default_value' => ($day ? $day : date('d')),
-    '#options' => $days,
-  );
-  $form['show']  = array('#type' => 'submit',
-    '#value' => t('Show'),
-  );
-
-  return drupal_get_form('archive_browse_form', $form);
-}
-
-/**
- * Process archive browse form submission.
- */
-function archive_browse_form_submit($form_id, $form_values) {
-  return('archive/'. $form_values['year'] .'/'. $form_values['month'] .'/'. $form_values['day']);
-}
-
-/**
- * Form theme function; displays the archive date navigation form inline.
- */
-function theme_archive_browse_form($form) {
-  $output = '<div class="container-inline archive">' . form_render($form) . '</div>';
-  return $output;
-}
diff --git a/modules/block.module b/modules/block.module
deleted file mode 100644 (file)
index c4ea29d..0000000
+++ /dev/null
@@ -1,660 +0,0 @@
-<?php
-// $Id: block.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Controls the boxes that are displayed around the main content.
- */
-
-/**
- * Implementation of hook_help().
- */
-function block_help($section) {
-  switch ($section) {
-    case 'admin/help#block':
-      $output = '<p>'. t('Blocks are boxes of content that may be rendered into certain regions of your web pages, for example, into sidebars. Blocks are usually generated automatically by modules (e.g., Recent Forum Topics), but administrators can also define custom blocks.') .'</p>';
-      $output .= '<p>'. t('The region each block appears in depends on both which theme you are using (some themes allow greater control over block placement than others), and on the settings in the block administration section.') .'</p>';
-      $output .= '<p>'. t('The block administration screen lets you specify the vertical placement of the blocks within a region. You do this by assigning a weight to each block. Lighter blocks (those having a smaller weight) "float up" towards the top of the region; heavier ones "sink".') .'</p>';
-      $output .= t('<p>A block\'s visibility depends on:</p>
-<ul>
-<li>Its enabled checkbox. Disabled blocks are never shown.</li>
-<li>Its throttle checkbox. Throttled blocks are hidden during high server loads.</li>
-<li>Its page visibility settings. Blocks can be configured to be visible/hidden on certain pages.</li>
-<li>Its custom visibility settings. Blocks can be configured to be visible only when specific conditions are true.</li>
-<li>Its user visibility settings. Administrators can choose to let users decide whether to show/hide certain blocks.</li>
-<li>Its function. Some dynamic blocks, such as those generated by modules, will be displayed only on certain pages.</li>
-</ul>
-');
-      $output .= '<h3>'. t('Module blocks') .'</h3>';
-      $output .= '<p>'. t('Some modules generate blocks that become available when the modules are enabled. These blocks can be administered via the <a href="%admin-block">blocks administration page</a>.</p>', array('%admin-block' => url('admin/block'))) .'</p>';
-      $output .= '<h3>'. t('Administrator defined blocks') .'</h3>';
-      $output .= '<p>'. t('Administrators can also define custom blocks. These blocks consist of a title, a description, and a body which can be as long as you wish. Block content can be in any of the input formats supported for other content.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>enable, throttle and configure blocks at <a href="%admin-block">administer &gt;&gt; blocks</a>.</li>
-<li>add an administrator-defined block at <a href="%admin-block-add">administer &gt;&gt; blocks &gt;&gt; add block</a>.</li>
-</ul>
-', array('%admin-block' => url('admin/block'), '%admin-block-add' => url('admin/block/add')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%block">Block page</a>.', array('%block' => 'http://drupal.org/handbook/modules/block/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Controls the boxes that are displayed around the main content.');
-    case 'admin/block':
-      return t("
-<p>Blocks are boxes of content that may be rendered into certain regions of your web pages, for example, into sidebars. They are usually generated automatically by modules, but administrators can create blocks manually.</p>
-<p>Only enabled blocks are shown. You can position blocks by specifying which area of the page they should appear in (e.g., a sidebar).  Highlighted labels on this page show the regions into which blocks can be rendered. You can specify where within a region a block will appear by adjusting its weight.</p>
-<p>If you want certain blocks to disable themselves temporarily during high server loads, check the 'Throttle' box. You can configure the auto-throttle on the <a href=\"%throttle\">throttle configuration page</a> after having enabled the throttle module.</p>
-<p>You can configure the behaviour of each block (for example, specifying on which pages and for what users it will appear) by clicking the 'configure' link for each block.</p>
-", array('%throttle' => url('admin/settings/throttle')));
-    case 'admin/block/add':
-      return t('<p>Here you can create a new block. Once you have created this block you must make it active and give it a place on the page using <a href="%overview">blocks</a>. The title is used when displaying the block. The description is used in the "block" column on the <a href="%overview">blocks</a> page.</p>', array('%overview' => url('admin/block')));
-  }
-}
-
-/**
- * Implementation of hook_perm().
- */
-function block_perm() {
-  return array('administer blocks', 'use PHP for block visibility');
-}
-
-/**
- * Implementation of hook_menu().
- */
-function block_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/block', 'title' => t('blocks'),
-      'access' => user_access('administer blocks'),
-      'callback' => 'block_admin_display');
-    $items[] = array('path' => 'admin/block/list', 'title' => t('list'),
-      'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-    $items[] = array('path' => 'admin/block/configure', 'title' => t('configure block'),
-      'access' => user_access('administer blocks'),
-      'callback' => 'block_admin_configure',
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/block/delete', 'title' => t('delete block'),
-      'access' => user_access('administer blocks'),
-      'callback' => 'block_box_delete',
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/block/add', 'title' => t('add block'),
-      'access' => user_access('administer blocks'),
-      'callback' => 'block_box_add',
-      'type' => MENU_LOCAL_TASK);
-    foreach (list_themes() as $key => $theme) {
-      if ($theme->status) {
-        if ($key == variable_get('theme_default', 'bluemarine')) {
-          $items[] = array('path' => 'admin/block/list/' . $key, 'title' => t('%key settings', array('%key' => $key)),
-            'access' => user_access('administer blocks'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-        }
-        else {
-          $items[] = array('path' => 'admin/block/list/' . $key, 'title' => t('%key settings', array('%key' => $key)),
-            'access' => user_access('administer blocks'), 'type' => MENU_LOCAL_TASK);
-        }
-      }
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_block().
- *
- * Generates the administrator-defined blocks for display.
- */
-function block_block($op = 'list', $delta = 0, $edit = array()) {
-  switch ($op) {
-    case 'list':
-      $blocks = array();
-
-      $result = db_query('SELECT bid, title, info FROM {boxes} ORDER BY title');
-      while ($block = db_fetch_object($result)) {
-        $blocks[$block->bid]['info'] = $block->info ? check_plain($block->info) : check_plain($block->title);
-      }
-      return $blocks;
-
-    case 'configure':
-      $box = block_box_get($delta);
-      if (filter_access($box['format'])) {
-        return block_box_form($box);
-      }
-      break;
-
-    case 'save':
-      block_box_save($edit, $delta);
-      break;
-
-    case 'view':
-      $block = db_fetch_object(db_query('SELECT * FROM {boxes} WHERE bid = %d', $delta));
-      $data['subject'] = check_plain($block->title);
-      $data['content'] = check_markup($block->body, $block->format, FALSE);
-      return $data;
-  }
-}
-
-/**
- * Update the 'blocks' DB table with the blocks currently exported by modules.
- *
- * @return
- *   Blocks currently exported by modules.
- */
-function _block_rehash() {
-  global $theme_key;
-
-  init_theme();
-
-  $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s'", $theme_key);
-  while ($old_block = db_fetch_object($result)) {
-    $old_blocks[$old_block->module][$old_block->delta] = $old_block;
-  }
-
-  db_query("DELETE FROM {blocks} WHERE theme = '%s'", $theme_key);
-
-  foreach (module_list() as $module) {
-    $module_blocks = module_invoke($module, 'block', 'list');
-    if ($module_blocks) {
-      foreach ($module_blocks as $delta => $block) {
-        $block['module'] = $module;
-        $block['delta']  = $delta;
-        // If previously written to database, load values.
-        if ($old_blocks[$module][$delta]) {
-          $block['status'] = $old_blocks[$module][$delta]->status;
-          $block['weight'] = $old_blocks[$module][$delta]->weight;
-          $block['region'] = $old_blocks[$module][$delta]->region;
-          $block['visibility'] = $old_blocks[$module][$delta]->visibility;
-          $block['pages'] = $old_blocks[$module][$delta]->pages;
-          $block['custom'] = $old_blocks[$module][$delta]->custom;
-          $block['throttle'] = $old_blocks[$module][$delta]->throttle;
-        }
-        // Otherwise, use any set values, or else substitute defaults.
-        else {
-          $properties = array('status' => 0, 'weight' => 0, 'region' => 'left', 'pages' => '', 'custom' => 0);
-          foreach ($properties as $property => $default) {
-            if (!isset($block[$property])) {
-              $block[$property] = $default;
-            }
-          }
-        }
-
-        // Reinsert blocks into table
-        db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, visibility, pages, custom, throttle) VALUES ('%s', '%s', '%s', %d, %d, '%s', %d, '%s', %d, %d)",
-          $block['module'], $block['delta'], $theme_key, $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle']);
-        $blocks[] = $block;
-      }
-    }
-  }
-
-  return $blocks;
-}
-
-/**
- * Generate main block administration form.
- */
-function block_admin_display() {
-  global $theme_key, $custom_theme;
-
-  // If non-default theme configuration has been selected, set the custom theme.
-  if (arg(3)) {
-    $custom_theme = arg(3);
-  }
-  else {
-    $custom_theme = variable_get('theme_default', 'bluemarine');
-  }
-  init_theme();
-
-  // Fetch and sort blocks
-  $blocks = _block_rehash();
-  usort($blocks, '_block_compare');
-
-  $throttle = module_exist('throttle');
-  $block_regions = system_region_list($theme_key);
-
-  // Build form tree
-  $form['#action'] = arg(3) ? url('admin/block/list/' . $theme_key) : url('admin/block');
-  $form['#tree'] = TRUE;
-  foreach ($blocks as $i => $block) {
-    $form[$i]['module'] = array('#type' => 'value', '#value' => $block['module']);
-    $form[$i]['delta'] = array('#type' => 'value', '#value' => $block['delta']);
-    $form[$i]['info'] = array('#value' => $block['info']);
-    $form[$i]['status'] = array('#type' => 'checkbox', '#default_value' => $block['status']);
-    $form[$i]['theme'] = array('#type' => 'hidden', '#value' => $theme_key);
-    $form[$i]['weight'] = array('#type' => 'weight', '#default_value' => $block['weight']);
-    $form[$i]['region'] = array('#type' => 'select',
-      '#default_value' => isset($block['region']) ? $block['region'] : system_default_region($theme_key),
-      '#options' => $block_regions,
-    );
-
-    if ($throttle) {
-      $form[$i]['throttle'] = array('#type' => 'checkbox', '#default_value' => $block['throttle']);
-    }
-    $form[$i]['configure'] = array('#value' => l(t('configure'), 'admin/block/configure/'. $block['module'] .'/'. $block['delta']));
-    if ($block['module'] == 'block') {
-      $form[$i]['delete'] = array('#value' => l(t('delete'), 'admin/block/delete/'. $block['delta']));
-    }
-  }
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save blocks'));
-
-  return drupal_get_form('block_admin_display', $form);
-}
-
-/**
- * Helper function for sorting blocks on admin/block.
- *
- * Active blocks are sorted by region, then by weight.
- * Disabled blocks are sorted by name.
- */
-function _block_compare($a, $b) {
-  $status = $b['status'] - $a['status'];
-  // Separate enabled from disabled.
-  if ($status) {
-    return $status;
-  }
-  // Enabled blocks
-  if ($a['status']) {
-    $place = strcmp($a['region'], $b['region']);
-    return $place ? $place : ($a['weight'] - $b['weight']);
-  }
-  // Disabled blocks
-  else {
-    return strcmp($a['info'], $b['info']);
-  }
-}
-
-/**
- * Process main block administration form submission.
- */
-function block_admin_display_submit($form_id, $form_values) {
-  foreach ($form_values as $block) {
-    db_query("UPDATE {blocks} SET status = %d, weight = %d, region = '%s', throttle = %d WHERE module = '%s' AND delta = '%s' AND theme = '%s'", $block['status'], $block['weight'], $block['region'], $block['throttle'], $block['module'], $block['delta'], $block['theme']);
-  }
-  drupal_set_message(t('The block settings have been updated.'));
-  cache_clear_all();
-}
-
-/**
- * Theme main block administration form submission.
- *
- * Note: the blocks are already sorted in the right order,
- * grouped by status, region and weight.
- */
-function theme_block_admin_display($form) {
-  global $theme_key;
-
-  $throttle = module_exist('throttle');
-  $block_regions = system_region_list($theme_key);
-
-  // Highlight regions on page to provide visual reference.
-  foreach ($block_regions as $key => $value) {
-    drupal_set_content($key, '<div class="block-region">' . $value . '</div>');
-  }
-
-  // Build rows
-  $rows = array();
-  $last_region = '';
-  $last_status = 1;
-  foreach (element_children($form) as $i) {
-    $block = $form[$i];
-    // Only take form elements that are blocks.
-    if (is_array($block['info'])) {
-      // Fetch values
-      $region = $block['region']['#default_value'];
-      $status = $block['status']['#default_value'];
-
-      // Output region header
-      if ($status && $region != $last_region) {
-        $region_title = t('%region', array('%region' => drupal_ucfirst($block_regions[$region])));
-        $rows[] = array(array('data' => $region_title, 'class' => 'region', 'colspan' => ($throttle ? 7 : 6)));
-        $last_region = $region;
-      }
-      // Output disabled header
-      elseif ($status != $last_status) {
-        $rows[] = array(array('data' => t('Disabled'), 'class' => 'region', 'colspan' => ($throttle ? 7 : 6)));
-        $last_status = $status;
-      }
-
-      // Generate block row
-      $row = array(
-        array('data' => form_render($block['info']), 'class' => 'block'),
-        form_render($block['status']) . form_render($block['theme']),
-        form_render($block['weight']),
-        form_render($block['region'])
-      );
-      if ($throttle) {
-        $row[] = form_render($block['throttle']);
-      }
-      $row[] = form_render($block['configure']);
-      $row[] = $block['delete'] ? form_render($block['delete']) : '';
-      $rows[] = $row;
-    }
-  }
-
-  // Finish table
-  $header = array(t('Block'), t('Enabled'), t('Weight'), t('Placement'));
-  if ($throttle) {
-    $header[] = t('Throttle');
-  }
-  $header[] = array('data' => t('Operations'), 'colspan' => 2);
-
-  $output = theme('table', $header, $rows, array('id' => 'blocks'));
-  $output .= form_render($form['submit']);
-  // Also render the form_id as there is no form_render($form) call (as form_render does not appear to handle the
-  // multi-dimensional block form array very well).
-  $output .= form_render($form['form_id']);
-
-  return $output;
-}
-
-function block_box_get($bid) {
-  return db_fetch_array(db_query('SELECT * FROM {boxes} WHERE bid = %d', $bid));
-}
-
-/**
- * Menu callback; displays the block configuration form.
- */
-function block_admin_configure($module = NULL, $delta = 0) {
-
-  $form['module'] = array('#type' => 'value', '#value' => $module);
-  $form['delta'] = array('#type' => 'value', '#value' => $delta);
-
-  $edit = db_fetch_array(db_query("SELECT pages, visibility, custom FROM {blocks} WHERE module = '%s' AND delta = '%s'", $module, $delta));
-
-  // Module-specific block configurations.
-  if ($settings = module_invoke($module, 'block', 'configure', $delta)) {
-    $form['block_settings'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Block specific settings'),
-      '#collapsible' => true,
-    );
-
-    foreach ($settings as $k => $v) {
-      $form['block_settings'][$k] = $v;
-    }
-  }
-
-  // Get the block subject for the page title.
-  $info = module_invoke($module, 'block', 'list');
-  drupal_set_title(t("'%name' block", array('%name' => $info[$delta]['info'])));
-
-  // Standard block configurations.
-
-  $form['user_vis_settings'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('User specific visibility settings'),
-    '#collapsible' => true,
-  );
-  $form['user_vis_settings']['custom'] = array(
-    '#type' => 'radios',
-    '#title' => t('Custom visibility settings'),
-    '#options' => array(t('Users cannot control whether or not they see this block.'), t('Show this block by default, but let individual users hide it.'), t('Hide this block by default but let individual users show it.')),
-    '#description' =>  t('Allow individual users to customize the visibility of this block in their account settings.'),
-    '#default_value' => $edit['custom'],
-  );
-  $form['page_vis_settings'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Page specific visibility settings'),
-    '#collapsible' => true,
-  );
-  $access = user_access('use PHP for block visibility');
-
-  if ($edit['visibility'] == 2 && !$access) {
-    $form['page_vis_settings'] = array();
-    $form['page_vis_settings']['visibility'] = array('#type' => 'value', '#value' => 2);
-    $form['page_vis_settings']['pages'] = array('#type' => 'value', '#value' => $edit['pages']);
-  }
-  else {
-    $options = array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.'));
-    $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '%blog' for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => theme('placeholder', 'blog'), '%blog-wildcard' =>  theme('placeholder', 'blog/*'), '%front' => theme('placeholder', '<front>')));
-
-    if ($access) {
-      $options[] = t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
-      $description .= t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => theme('placeholder', '<?php ?>')));
-    }
-    $form['page_vis_settings']['visibility'] = array(
-      '#type' => 'radios',
-      '#title' => t('Show block on specific pages'),
-      '#options' => $options,
-      '#default_value' => $edit['visibility'],
-    );
-    $form['page_vis_settings']['pages'] = array(
-      '#type' => 'textarea',
-      '#title' => t('Pages'),
-      '#default_value' => $edit['pages'],
-      '#description' => $description,
-    );
-  }
-
-  $form['submit'] = array(
-    '#type' => 'submit',
-    '#value' => t('Save block'),
-  );
-
-  return drupal_get_form('block_admin_configure', $form);
-}
-
-function block_admin_configure_validate($form_id, $form_values) {
-  if ($form_values['module'] == 'block') {
-    if (empty($form_values['info']) || db_num_rows(db_query("SELECT bid FROM {boxes} WHERE bid != %d AND info = '%s'", $form_values['delta'], $form_values['info']))) {
-      form_set_error('info', t('Please ensure that each block description is unique.'));
-    }
-  }
-}
-
-function block_admin_configure_submit($form_id, $form_values) {
-  if (!form_get_errors()) {
-    db_query("UPDATE {blocks} SET visibility = %d, pages = '%s', custom = %d WHERE module = '%s' AND delta = '%s'", $form_values['visibility'], $form_values['pages'], $form_values['custom'], $form_values['module'], $form_values['delta']);
-    module_invoke($form_values['module'], 'block', 'save', $form_values['delta'], $form_values);
-    drupal_set_message(t('The block configuration has been saved.'));
-    cache_clear_all();
-    return 'admin/block';
-  }
-}
-
-/**
- * Menu callback; displays the block creation form.
- */
-function block_box_add() {
-  $form = block_box_form();
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save block'));
-
-  return drupal_get_form('block_box_add', $form);
-}
-
-function block_box_add_validate($form_id, $form_values) {
-  if (empty($form_values['info']) || db_num_rows(db_query("SELECT info FROM {boxes} WHERE info = '%s'", $form_values['info']))) {
-    form_set_error('info', t('Please ensure that each block description is unique.'));
-  }
-}
-
-function block_box_add_submit($form_id, $form_values) {
-  if (!form_get_errors()) {
-    if (block_box_save($form_values)) {
-      drupal_set_message(t('The block has been created.'));
-      return 'admin/block';
-    }
-  }
-}
-
-/**
- * Menu callback; confirm deletion of custom blocks.
- */
-function block_box_delete($bid = 0) {
-  $box = block_box_get($bid);
-  $form['info'] = array('#type' => 'hidden', '#value' => $box['info'] ? $box['info'] : $box['title']);
-  $form['bid'] = array('#type' => 'hidden', '#value' => $bid);
-
-  return confirm_form('block_box_delete_confirm', $form, t('Are you sure you want to delete the block %name?', array('%name' => theme('placeholder', $box['info']))), 'admin/block', '', t('Delete'), t('Cancel'));
-}
-
-/**
- * Deletion of custom blocks.
- */
-function block_box_delete_confirm_submit($form_id, $form_values) {
-  db_query('DELETE FROM {boxes} WHERE bid = %d', $form_values['bid']);
-  drupal_set_message(t('The block %name has been removed.', array('%name' => theme('placeholder', $form_values['info']))));
-  cache_clear_all();
-  return 'admin/block';
-};
-
-function block_box_form($edit = array()) {
-  $form['info'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Block description'),
-    '#default_value' => $edit['info'],
-    '#maxlength' => 64,
-    '#description' => t('A brief description of your block. Used on the <a href="%overview">block overview page</a>.', array('%overview' => url('admin/block'))),
-    '#required' => TRUE,
-    '#weight' => -19,
-  );
-  $form['title'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Block title'),
-    '#default_value' => $edit['title'],
-    '#maxlength' => 64,
-    '#description' => t('The title of the block as shown to the user.'),
-    '#weight' => -18,
-  );
-  $form['body_filter']['#weight'] = -17;
-  $form['body_filter']['body'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Block body'),
-    '#default_value' => $edit['body'],
-    '#rows' => 15,
-    '#description' => t('The content of the block as shown to the user.'),
-    '#weight' => -17,
-  );
-  $form['body_filter']['format'] = filter_form($edit['format'], -16);
-
-  return $form;
-}
-
-function block_box_save($edit, $delta = NULL) {
-  if (!filter_access($edit['format'])) {
-    $edit['format'] = FILTER_FORMAT_DEFAULT;
-  }
-
-  if (isset($delta)) {
-    db_query("UPDATE {boxes} SET title = '%s', body = '%s', info = '%s', format = %d WHERE bid = %d", $edit['title'], $edit['body'], $edit['info'], $edit['format'], $delta);
-  }
-  else {
-    db_query("INSERT INTO {boxes} (title, body, info, format) VALUES  ('%s', '%s', '%s', %d)", $edit['title'], $edit['body'], $edit['info'], $edit['format']);
-  }
-  return true;
-}
-
-/**
- * Implementation of hook_user().
- *
- * Allow users to decide which custom blocks to display when they visit
- * the site.
- */
-function block_user($type, $edit, &$user, $category = NULL) {
-  switch ($type) {
-    case 'form':
-      if ($category == 'account') {
-        $result = db_query('SELECT * FROM {blocks} WHERE status = 1 AND custom != 0 ORDER BY weight, module, delta');
-        $form['block'] = array('#type' => 'fieldset', '#title' => t('Block configuration'), '#weight' => 3, '#collapsible' => TRUE, '#tree' => TRUE);
-        while ($block = db_fetch_object($result)) {
-          $data = module_invoke($block->module, 'block', 'list');
-          if ($data[$block->delta]['info']) {
-            $return = TRUE;
-            $form['block'][$block->module][$block->delta] = array('#type' => 'checkbox', '#title' => $data[$block->delta]['info'], '#default_value' => isset($user->block[$block->module][$block->delta]) ? $user->block[$block->module][$block->delta] : ($block->custom == 1));
-          }
-        }
-
-        if ($return) {
-          return $form;
-        }
-      }
-
-      break;
-    case 'validate':
-      if (!$edit['block']) {
-        $edit['block'] = array();
-      }
-      return $edit;
-  }
-}
-
-/**
- * Return all blocks in the specified region for the current user.
- *
- * @param $region
- *   The name of a region.
- *
- * @return
- *   An array of block objects, indexed with <i>module</i>_<i>delta</i>.
- *   If you are displaying your blocks in one or two sidebars, you may check
- *   whether this array is empty to see how many columns are going to be
- *   displayed.
- *
- * @todo
- *   Add a proper primary key (bid) to the blocks table so we don't have
- *   to mess around with this <i>module</i>_<i>delta</i> construct.
- *   Currently, the blocks table has no primary key defined!
- */
-function block_list($region) {
-  global $user, $theme_key;
-
-  static $blocks = array();
-
-  if (!count($blocks)) {
-    $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s' AND status = 1 ORDER BY region, weight, module", $theme_key);
-    while ($block = db_fetch_object($result)) {
-      if (!isset($blocks[$block->region])) {
-        $blocks[$block->region] = array();
-      }
-      // Use the user's block visibility setting, if necessary
-      if ($block->custom != 0) {
-        if ($user->uid && isset($user->block[$block->module][$block->delta])) {
-          $enabled = $user->block[$block->module][$block->delta];
-        }
-        else {
-          $enabled = ($block->custom == 1);
-        }
-      }
-      else {
-        $enabled = TRUE;
-      }
-
-      // Match path if necessary
-      if ($block->pages) {
-        if ($block->visibility < 2) {
-          $path = drupal_get_path_alias($_GET['q']);
-          $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($block->pages, '/')) .')$/';
-          $page_match = !($block->visibility xor preg_match($regexp, $path));
-        }
-        else {
-          $page_match = drupal_eval($block->pages);
-        }
-      }
-      else {
-        $page_match = TRUE;
-      }
-
-      if ($enabled && $page_match) {
-        // Check the current throttle status and see if block should be displayed
-        // based on server load.
-        if (!($block->throttle && (module_invoke('throttle', 'status') > 0))) {
-          $array = module_invoke($block->module, 'block', 'view', $block->delta);
-          if (isset($array) && is_array($array)) {
-            foreach ($array as $k => $v) {
-              $block->$k = $v;
-            }
-          }
-        }
-        if (isset($block->content) && $block->content) {
-          $blocks[$block->region]["{$block->module}_{$block->delta}"] = $block;
-        }
-      }
-    }
-  }
-  // Create an empty array if there were no entries
-  if (!isset($blocks[$region])) {
-    $blocks[$region] = array();
-  }
-  return $blocks[$region];
-}
-
-
diff --git a/modules/blog.module b/modules/blog.module
deleted file mode 100644 (file)
index d0e35a8..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-<?php
-// $Id: blog.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables keeping an easily and regularly updated web page or a blog.
- */
-
-/**
- * Implementation of hook_node_info().
- */
-function blog_node_info() {
-  return array('blog' => array('name' => t('blog entry'), 'base' => 'blog'));
-}
-
-/**
- * Implementation of hook_perm().
- */
-function blog_perm() {
-  return array('edit own blog');
-}
-
-/**
- * Implementation of hook_access().
- */
-function blog_access($op, $node) {
-  global $user;
-
-  if ($op == 'create') {
-    return user_access('edit own blog') && $user->uid;
-  }
-
-  if ($op == 'update' || $op == 'delete') {
-    if (user_access('edit own blog') && ($user->uid == $node->uid)) {
-      return TRUE;
-    }
-  }
-}
-
-/**
- * Implementation of hook_user().
- */
-function blog_user($type, &$edit, &$user) {
-  if ($type == 'view' && user_access('edit own blog', $user)) {
-    $items[] = array('title' => t('Blog'),
-      'value' => l(t('view recent blog entries'), "blog/$user->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $user->name)))),
-      'class' => 'blog',
-    );
-    return array(t('History') => $items);
-  }
-}
-
-/**
- * Implementation of hook_help().
- */
-function blog_help($section) {
-  switch ($section) {
-    case 'admin/help#blog':
-      $output = '<p>'. t('The blog module allows registered users to maintain an online weblog (commonly known as a blog), often referred to as an online journal or diary.  Blogs are made up of individual posts that are time stamped and are typically viewed by date as you would a diary. Blogs often contain links to webpages users have read and/or agree/disagree with.') .'</p>';
-      $output .= '<p>'. t('The blog module adds a <em>user blogs</em> navigation link to the site, which takes any visitor to a page that displays the most recent blog entries from all the users on the site. The navigation menu has a <em>create a blog entry</em> link (which takes you to a submission form) and a <em>view personal blog</em> link (which displays your blog entries as other people will see them).  The blog module also creates a <em>recent blog posts</em> block that can be enabled.') .'</p>';
-      $output .= '<p>'. t('If a user has the ability to post blogs, then the import module (news aggregator) will display a blog-it link next to each news item in its lists. Clicking on this takes the user to the blog submission form, with the title, a link to the item, and a link to the source into the body text already in the text box, ready for the user to add a comment or explanation. This actively encourages people to add blog entries about things they see and hear elsewhere in the website and from your syndicated partner sites.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>read your blog via your user profile at <a href="%user">my account</a>.</li>
-<li>post a blog at <a href="%node-add-blog">create content &gt;&gt; personal blog entry</a>.</li>
-<li>administer blog at <a href="%admin-node-configure-types-blog">administer &gt;&gt; settings &gt;&gt; content types &gt;&gt; configure blog entry</a>.</li>
-<li>administer blog api at <a href="%admin-settings-blogapi">administer &gt;&gt; settings &gt;&gt; blogapi</a>.</li>
-<li>enable the "recent blog posts" block at <a href="%admin-block">administer &gt;&gt; blocks</a> to show the 10 most recent blog posts.</li>
-</ul>
-', array('%user' => url('user'), '%node-add-blog' => url('node/add/blog'), '%admin-node-configure-types-blog' => url('admin/settings/content-types/blog'), '%admin-settings-blogapi' => url('admin/settings/blogapi'), '%admin-block' => url('admin/block')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%blog">Blog page</a>.', array('%blog' => 'http://drupal.org/handbook/modules/blog/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Enables keeping an easily and regularly updated web page or a blog.');
-    case 'node/add#blog':
-      return t("A blog is a regularly updated journal or diary made up of individual posts shown in reversed chronological order.  A blog is tightly coupled to the author so each user will have his 'own' blog.");
-  }
-}
-
-/**
- * Displays an RSS feed containing recent blog entries of a given user.
- */
-function blog_feed_user($uid = 0) {
-  global $user;
-
-  if ($uid) {
-    $account = user_load(array('uid' => $uid, 'status' => 1));
-  }
-  else {
-    $account = $user;
-  }
-
-  $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, r.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $uid, 0, variable_get('feed_default_items', 10));
-  $channel['title'] = $account->name ."'s blog";
-  $channel['link'] = url("blog/$uid", NULL, NULL, TRUE);
-  $channel['description'] = $term->description;
-  node_feed($result, $channel);
-}
-
-/**
- * Displays an RSS feed containing recent blog entries of all users.
- */
-function blog_feed_last() {
-  $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, r.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get('feed_default_items', 10));
-  $channel['title'] = variable_get('site_name', 'drupal') .' blogs';
-  $channel['link'] = url('blog', NULL, NULL, TRUE);
-  $channel['description'] = $term->description;
-  node_feed($result, $channel);
-}
-
-/**
- * Menu callback; displays a Drupal page containing recent blog entries.
- */
-function blog_page($a = NULL, $b = NULL) {
-
-  if (is_numeric($a)) { // $a is a user ID
-    if ($b == 'feed') {
-      return blog_feed_user($a);
-    }
-    else {
-      return blog_page_user($a);
-    }
-  }
-  else if ($a == 'feed') {
-    return blog_feed_last();
-  }
-  else {
-    return blog_page_last();
-  }
-}
-
-/**
- * Displays a Drupal page containing recent blog entries of a given user.
- */
-function blog_page_user($uid) {
-  global $user;
-
-  $account = user_load(array((is_numeric($uid) ? 'uid' : 'name') => $uid, 'status' => 1));
-
-  if ($account->uid) {
-    drupal_set_title($title = t("%name's blog", array('%name' => $account->name)));
-
-    if (($account->uid == $user->uid) && user_access('edit own blog')) {
-      $output = '<li>'. l(t('Post new blog entry.'), "node/add/blog") .'</li>';
-    }
-    else if ($account->uid == $user->uid) {
-      $output = '<li>'. t('You are not allowed to post a new blog entry.') .'</li>';
-    }
-
-    if ($output) {
-      $output = '<ul>'. $output .'</ul>';
-    }
-    else {
-      $output = '';
-    }
-
-    $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid);
-    while ($node = db_fetch_object($result)) {
-      $output .= node_view(node_load($node->nid), 1);
-    }
-    $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
-    $output .= theme('feed_icon', url("blog/$account->uid/feed"));
-
-    drupal_add_link(array('rel' => 'alternate',
-                          'type' => 'application/rss+xml',
-                          'title' => t('RSS - %title', array('%title' => $title)),
-                          'href' => url("blog/$account->uid/feed")));
-    return $output;
-  }
-  else {
-    drupal_not_found();
-  }
-}
-
-/**
- * Displays a Drupal page containing recent blog entries of all users.
- */
-function blog_page_last() {
-  global $user;
-
-  $output = '';
-
-  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), variable_get('default_nodes_main', 10));
-
-  while ($node = db_fetch_object($result)) {
-    $output .= node_view(node_load($node->nid), 1);
-  }
-  $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
-  $output .= theme('feed_icon', url('blog/feed'));
-
-  drupal_add_link(array('rel' => 'alternate',
-                        'type' => 'application/rss+xml',
-                        'title' => t('RSS - blogs'),
-                        'href' => url("blog/feed")));
-  return $output;
-}
-
-/**
- * Implementation of hook_form().
- */
-function blog_form(&$node) {
-  global $nid;
-  $iid = $_GET['iid'];
-
-
-  if (empty($node->body)) {
-    /*
-    ** If the user clicked a "blog it" link, we load the data from the
-    ** database and quote it in the blog:
-    */
-
-    if ($nid && $blog = node_load($nid)) {
-      $node->body = '<em>'. $blog->body .'</em> ['. l($blog->name, "node/$nid") .']';
-    }
-
-    if ($iid && $item = db_fetch_object(db_query('SELECT i.*, f.title as ftitle, f.link as flink FROM {aggregator_item} i, {aggregator_feed} f WHERE i.iid = %d AND i.fid = f.fid', $iid))) {
-      $node->title = $item->title;
-      // Note: $item->description has been validated on aggregation.
-      $node->body = '<a href="'. check_url($item->link) .'">'. check_plain($item->title) .'</a> - <em>'. $item->description .'</em> [<a href="'. check_url($item->flink) .'">'. check_plain($item->ftitle) ."</a>]\n";
-    }
-
-  }
-
-  $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -5);
-  $form['body_filter']['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE);
-  $form['body_filter']['filter'] = filter_form($node->format);
-  return $form;
-}
-
-/**
- * Implementation of hook_view().
- */
-function blog_view(&$node, $teaser = FALSE, $page = FALSE) {
-  if ($page) {
-    // Breadcrumb navigation
-    $breadcrumb[] = array('path' => 'blog', 'title' => t('blogs'));
-    $breadcrumb[] = array('path' => 'blog/'. $node->uid, 'title' => t("%name's blog", array('%name' => $node->name)));
-    $breadcrumb[] = array('path' => 'node/'. $node->nid);
-    menu_set_location($breadcrumb);
-  }
-  $node = node_prepare($node, $teaser);
-}
-
-/**
- * Implementation of hook_link().
- */
-function blog_link($type, $node = 0, $main = 0) {
-  $links = array();
-
-  if ($type == 'node' && $node->type == 'blog') {
-    if (arg(0) != 'blog' || arg(1) != $node->uid) {
-      $links[] = l(t("%username's blog", array('%username' => $node->name)), "blog/$node->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $node->name))));
-    }
-  }
-
-  return $links;
-}
-
-/**
- * Implementation of hook_menu().
- */
-function blog_menu($may_cache) {
-  global $user;
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'node/add/blog', 'title' => t('blog entry'),
-      'access' => user_access('edit own blog'));
-    $items[] = array('path' => 'blog', 'title' => t('blogs'),
-      'callback' => 'blog_page',
-      'access' => user_access('access content'),
-      'type' => MENU_SUGGESTED_ITEM);
-    $items[] = array('path' => 'blog/'. $user->uid, 'title' => t('my blog'),
-      'access' => user_access('edit own blog'),
-      'type' => MENU_DYNAMIC_ITEM);
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_block().
- *
- * Displays the most recent 10 blog titles.
- */
-function blog_block($op = 'list', $delta = 0) {
-  global $user;
-  if ($op == 'list') {
-    $block[0]['info'] = t('Recent blog posts');
-    return $block;
-  }
-  else if ($op == 'view') {
-    if (user_access('access content')) {
-      $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10);
-      if (db_num_rows($result)) {
-        $block['content'] = node_title_list($result);
-        $block['content'] .= '<div class="more-link">'. l(t('more'), 'blog', array('title' => t('Read the latest blog entries.'))) .'</div>';
-        $block['subject'] = t('Recent blog posts');
-        return $block;
-      }
-    }
-  }
-}
-
-
diff --git a/modules/blogapi.module b/modules/blogapi.module
deleted file mode 100644 (file)
index 59d641d..0000000
+++ /dev/null
@@ -1,737 +0,0 @@
-<?php
-// $Id: blogapi.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enable users to post using applications that support XML-RPC blog APIs.
- */
-
-/**
- * Implementation of hook_help().
- */
-function blogapi_help($section) {
-  switch ($section) {
-    case 'admin/help#blogapi':
-      $output = '<p>'. t('The blog API module enables a post to be posted to a site via external GUI applications.  Many users prefer to use external tools to improve their ability to read and post responses in a customized way.   The blog api provides users the freedom to use the blogging tools they want but still have the blogging server of choice.') .'</p>';
-      $output .= '<p>'. t('When this module is enabled and configured you can use programs like <a href="%external-http-ecto-kung-foo-tv">Ecto</a> to create and publish posts from your desktop. Blog API module supports several XML-RPC based blogging APIs such as the <a href="%-">Blogger API</a>, <a href="%external-http-www-xmlrpc-com-metaWeblogApi">MetaWeblog API</a>, and most of the <a href="%external-http-www-movabletype-org-docs-mtmanual_programmatic-html">Movable Type API</a>. Any desktop blogging tools or other services (e.g. <a href="%external-http-www-flickr-com">Flickr\'s</a> "post to blog") that support these APIs should work with this site.', array('%external-http-ecto-kung-foo-tv' => 'http://ecto.kung-foo.tv/', '%-' => url('http://www.blogger.com/developers/api/1_docs/'), '%external-http-www-xmlrpc-com-metaWeblogApi' => 'http://www.xmlrpc.com/metaWeblogApi', '%external-http-www-movabletype-org-docs-mtmanual_programmatic-html' => 'http://www.movabletype.org/docs/mtmanual_programmatic.html', '%external-http-www-flickr-com' => 'http://www.flickr.com')) .'</p>';
-      $output .= '<p>'. t('This module also allows site administrators to configure which content types can be posted via the external applications. So, for instance, users can post forum topics as well as blog posts. Where supported, the external applications will display each content type as a separate "blog".<!--break-->') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>view the XML-RPC page on your site at &gt;&gt; <a href="%file-xmlrpc">xmlrpc.php</a>.</li>
-<li><a href="%admin-settings-blogapi">administer &gt;&gt; settings &gt;&gt; blog api</a>.</li>
-</ul>
-', array('%file-xmlrpc' => 'xmlrpc.php', '%admin-settings-blogapi' => url('admin/settings/blogapi')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%blogapi">BlogApi page</a>.', array('%blogapi' => 'http://drupal.org/handbook/modules/blogapi/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Allows users to post content using applications that support XML-RPC blog APIs.');
-  }
-}
-
-/**
- * Implementation of hook_xmlrpc().
- */
-function blogapi_xmlrpc() {
-  return array(
-    array(
-      'blogger.getUsersBlogs',
-      'blogapi_blogger_get_users_blogs',
-      array('array', 'string', 'string', 'string'),
-      t('Returns a list of weblogs to which an author has posting privileges.')),
-    array(
-      'blogger.getUserInfo',
-      'blogapi_blogger_get_user_info',
-      array('struct', 'string', 'string', 'string'),
-      t('Returns information about an author in the system.')),
-    array(
-      'blogger.newPost',
-      'blogapi_blogger_new_post',
-      array('string', 'string', 'string', 'string', 'string', 'string', 'boolean'),
-      t('Creates a new post, and optionally publishes it.')),
-    array(
-      'blogger.editPost',
-      'blogapi_blogger_edit_post',
-      array('boolean', 'string', 'string', 'string', 'string', 'string', 'boolean'),
-      t('Updates the information about an existing post.')),
-    array(
-      'blogger.getPost',
-      'blogapi_blogger_get_post',
-      array('struct', 'string', 'string', 'string', 'string'),
-      t('Returns information about a specific post.')),
-    array(
-      'blogger.deletePost',
-      'blogapi_blogger_delete_post',
-      array('boolean', 'string', 'string', 'string', 'string', 'boolean'),
-      t('Deletes a post.')),
-    array(
-      'blogger.getRecentPosts',
-      'blogapi_blogger_get_recent_posts',
-      array('array', 'string', 'string', 'string', 'string', 'int'),
-      t('Returns a list of the most recent posts in the system.')),
-    array(
-      'metaWeblog.newPost',
-      'blogapi_metaweblog_new_post',
-      array('string', 'string', 'string', 'string', 'struct', 'boolean'),
-      t('Creates a new post, and optionally publishes it.')),
-    array(
-      'metaWeblog.editPost',
-      'blogapi_metaweblog_edit_post',
-      array('boolean', 'string', 'string', 'string', 'struct', 'boolean'),
-      t('Updates information about an existing post.')),
-    array(
-      'metaWeblog.getPost',
-      'blogapi_metaweblog_get_post',
-      array('struct', 'string', 'string', 'string'),
-      t('Returns information about a specific post.')),
-    array(
-      'metaWeblog.newMediaObject',
-      'blogapi_metaweblog_new_media_object',
-      array('string', 'string', 'string', 'string', 'struct'),
-      t('Uploads a file to your webserver.')),
-    array(
-      'metaWeblog.getCategories',
-      'blogapi_metaweblog_get_category_list',
-      array('struct', 'string', 'string', 'string'),
-      t('Returns a list of all categories to which the post is assigned.')),
-    array(
-      'metaWeblog.getRecentPosts',
-      'blogapi_metaweblog_get_recent_posts',
-      array('array', 'string', 'string', 'string', 'int'),
-      t('Returns a list of the most recent posts in the system.')),
-    array(
-      'mt.getRecentPostTitles',
-      'blogapi_mt_get_recent_post_titles',
-      array('array', 'string', 'string', 'string', 'int'),
-      t('Returns a bandwidth-friendly list of the most recent posts in the system.')),
-    array(
-      'mt.getCategoryList',
-      'blogapi_mt_get_category_list',
-      array('array', 'string', 'string', 'string'),
-      t('Returns a list of all categories defined in the weblog.')),
-    array(
-      'mt.getPostCategories',
-      'blogapi_mt_get_post_categories',
-      array('array', 'string', 'string', 'string'),
-      t('Returns a list of all categories to which the post is assigned.')),
-    array(
-      'mt.setPostCategories',
-      'blogapi_mt_set_post_categories',
-      array('boolean', 'string', 'string', 'string', 'array'),
-      t('Sets the categories for a post.')),
-    array(
-      'mt.supportedMethods',
-      'xmlrpc_server_list_methods',
-      array('array'),
-      t('Retrieve information about the XML-RPC methods supported by the server.')),
-    array(
-      'mt.supportedTextFilters',
-      'blogapi_mt_supported_text_filters',
-      array('array'),
-      t('Retrieve information about the text formatting plugins supported by the server.')),
-    array(
-      'mt.getTrackbackPings',
-      'blogapi_mt_get_trackback_pings',
-      array('array', 'string'),
-      t('Retrieve the list of TrackBack pings posted to a particular entry. This could be used to programmatically retrieve the list of pings for a particular entry, then iterate through each of those pings doing the same, until one has built up a graph of the web of entries referencing one another on a particular topic.')),
-    array(
-      'mt.publishPost',
-      'blogap_mti_publish_post',
-      array('boolean', 'string', 'string', 'string'),
-      t('Publish (rebuild) all of the static files related to an entry from your weblog. Equivalent to saving an entry in the system (but without the ping).')));
-}
-
-/**
- * Blogging API callback. Finds the URL of a user's blog.
- */
-
-function blogapi_blogger_get_users_blogs($appid, $username, $password) {
-
-  $user = blogapi_validate_user($username, $password);
-  if ($user->uid) {
-    $types = _blogapi_get_node_types();
-    $structs = array();
-    foreach ($types as $type) {
-      $structs[] = array('url' => url('blog/' . $user->uid, NULL, NULL, true), 'blogid' => $type, 'blogName' => $user->name . ": " . $type);
-    }
-    return $structs;
-  }
-  else {
-    return blogapi_error($user);
-  }
-}
-
-/**
- * Blogging API callback. Returns profile information about a user.
- */
-function blogapi_blogger_get_user_info($appkey, $username, $password) {
-  $user = blogapi_validate_user($username, $password);
-
-  if ($user->uid) {
-    $name = explode(' ', $user->realname ? $user->realname : $user->name, 2);
-    return array(
-      'userid' => $user->uid,
-      'lastname' => $name[1],
-      'firstname' => $name[0],
-      'nickname' => $user->name,
-      'email' => $user->mail,
-      'url' => url('blog/' . $user->uid, NULL, NULL, true));
-  }
-  else {
-    return blogapi_error($user);
-  }
-}
-
-/**
- * Blogging API callback. Inserts a new blog post as a node.
- */
-function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $content, $publish) {
-  $user = blogapi_validate_user($username, $password);
-  if (!$user->uid) {
-    return blogapi_error($user);
-  }
-
-  $edit = array();
-  $edit['type'] = _blogapi_blogid($blogid);
-  // get the node type defaults
-  $node_type_default = variable_get('node_options_'. $edit['type'], array('status', 'promote'));
-  $edit['uid'] = $user->uid;
-  $edit['name'] = $user->name;
-  $edit['promote'] = in_array('promote', $node_type_default);
-  $edit['comment'] = variable_get('comment_'. $edit['type'], 2);
-  $edit['moderate'] = in_array('moderate', $node_type_default);
-  $edit['revision'] = in_array('revision', $node_type_default);
-  $edit['format'] = FILTER_FORMAT_DEFAULT;
-  $edit['status'] = $publish;
-
-  // check for bloggerAPI vs. metaWeblogAPI
-  if (is_array($content)) {
-    $edit['title'] = $content['title'];
-    $edit['body'] = $content['description'];
-    _blogapi_mt_extra($edit, $content);
-  }
-  else {
-    $edit['title'] = blogapi_blogger_title($content);
-    $edit['body'] = $content;
-  }
-
-  if (!node_access('create', $edit['type'])) {
-    return blogapi_error(t('You do not have permission to create the type of post you wanted to create.'));
-  }
-
-  if (user_access('administer nodes') && !isset($edit['date'])) {
-    $edit['date'] = format_date(time(), 'custom', 'Y-m-d H:i:s O');
-  }
-
-  node_validate($edit);
-  if ($errors = form_get_errors()) {
-    return blogapi_error(implode("\n", $errors));
-  }
-
-  $node = node_submit($edit);
-  node_save($node);
-  if ($node->nid) {
-    watchdog('content', t('%type: added %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
-    // blogger.newPost returns a string so we cast the nid to a string by putting it in double quotes:
-    return "$node->nid";
-  }
-
-  return blogapi_error(t('Error storing post.'));
-}
-
-/**
- * Blogging API callback. Modifies the specified blog node.
- */
-function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $content, $publish) {
-
-  $user = blogapi_validate_user($username, $password);
-
-  if (!$user->uid) {
-    return blogapi_error($user);
-  }
-
-  $node = node_load($postid);
-  if (!$node) {
-    return blogapi_error(message_na());
-  }
-  // Let the teaser be re-generated.
-  unset($node->teaser);
-
-  if (!node_access('update', $node)) {
-    return blogapi_error(t('You do not have permission to update this post.'));
-  }
-
-  $node->status = $publish;
-
-  // check for bloggerAPI vs. metaWeblogAPI
-  if (is_array($content)) {
-    $node->title = $content['title'];
-    $node->body = $content['description'];
-    _blogapi_mt_extra($node, $content);
-  }
-  else {
-    $node->title = blogapi_blogger_title($content);
-    $node->body = $content;
-  }
-
-  node_validate($node);
-  if ($errors = form_get_errors()) {
-    return blogapi_error(implode("\n", $errors));
-  }
-
-  if (user_access('administer nodes') && !isset($edit['date'])) {
-    $node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O');
-  }
-  $node = node_submit($node);
-  node_save($node);
-  if ($node->nid) {
-    watchdog('content', t('%type: updated %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
-    return true;
-  }
-
-  return blogapi_error(t('Error storing post.'));
-}
-
-/**
- * Blogging API callback. Returns a specified blog node.
- */
-function blogapi_blogger_get_post($appkey, $postid, $username, $password) {
-  $user = blogapi_validate_user($username, $password);
-  if (!$user->uid) {
-    return blogapi_error($user);
-  }
-
-  $node = node_load($postid);
-
-  return _blogapi_get_post($node, true);
-}
-
-/**
- * Blogging API callback. Removes the specified blog node.
- */
-function blogapi_blogger_delete_post($appkey, $postid, $username, $password, $publish) {
-  $user = blogapi_validate_user($username, $password);
-  if (!$user->uid) {
-    return blogapi_error($user);
-  }
-
-  node_delete($postid);
-  return true;
-}
-
-/**
- * Blogging API callback. Returns the latest few postings in a user's blog. $bodies TRUE
- * <a href="http://movabletype.org/docs/mtmanual_programmatic.html#item_mt%2EgetRecentPostTitles">
- * returns a bandwidth-friendly list</a>.
- */
-function blogapi_blogger_get_recent_posts($appkey, $blogid, $username, $password, $number_of_posts, $bodies = TRUE) {
-  // Remove unused appkey (from bloggerAPI).
-  $user = blogapi_validate_user($username, $password);
-  if (!$user->uid) {
-    return blogapi_error($user);
-  }
-
-  $type = _blogapi_blogid($blogid);
-  if ($bodies) {
-    $result = db_query_range("SELECT n.nid, n.title, r.body, n.created, u.name FROM {node} n, {node_revisions} r, {users} u WHERE n.uid = u.uid AND n.vid = r.vid AND n.type = '%s' AND n.uid = %d ORDER BY n.created DESC",  $type, $user->uid, 0, $number_of_posts);
-  }
-  else {
-    $result = db_query_range("SELECT n.nid, n.title, n.created, u.name FROM {node} n, {users} u WHERE n.uid = u.uid AND n.type = '%s' AND n.uid = %d ORDER BY n.created DESC", $type, $user->uid, 0, $number_of_posts);
-  }
-  $blogs = array ();
-  while ($blog = db_fetch_object($result)) {
-    $blogs[] = _blogapi_get_post($blog, $bodies);
-  }
-  return $blogs;
-}
-
-function blogapi_metaweblog_new_post($blogid, $username, $password, $content, $publish) {
-  return blogapi_blogger_new_post('0123456789ABCDEF', $blogid, $username, $password, $content, $publish);
-}
-
-function blogapi_metaweblog_edit_post($postid, $username, $password, $content, $publish) {
-  return blogapi_blogger_edit_post('0123456789ABCDEF', $postid, $username, $password, $content, $publish);
-}
-
-function blogapi_metaweblog_get_post($postid, $username, $password) {
-  return blogapi_blogger_get_post('01234567890ABCDEF', $postid, $username, $password);
-}
-
-/**
- * Blogging API callback. Inserts a file into Drupal.
- */
-function blogapi_metaweblog_new_media_object($blogid, $username, $password, $file) {
-  $user = blogapi_validate_user($username, $password);
-  if (!$user->uid) {
-    return blogapi_error($user);
-  }
-
-  $name = basename($file['name']);
-  $data = $file['bits'];
-
-  if (!$data) {
-    return blogapi_error(t('No file sent.'));
-  }
-
-  if (!$file = file_save_data($data, $name)) {
-    return blogapi_error(t('Error storing file.'));
-  }
-
-  // Return the successful result.
-  return array('url' => file_create_url($file), 'struct');
-}
-/**
- * Blogging API callback. Returns a list of the taxonomy terms that can be
- * associated with a blog node.
- */
-function blogapi_metaweblog_get_category_list($blogid, $username, $password) {
-  $type = _blogapi_blogid($blogid);
-  $vocabularies = module_invoke('taxonomy', 'get_vocabularies', $type, 'vid');
-  $categories = array();
-  if ($vocabularies) {
-    foreach ($vocabularies as $vocabulary) {
-      $terms = module_invoke('taxonomy', 'get_tree', $vocabulary->vid, 0, -1);
-      foreach ($terms as $term) {
-        $term_name = $term->name;
-        foreach (module_invoke('taxonomy', 'get_parents', $term->tid, 'tid') as $parent) {
-          $term_name = $parent->name . '/' . $term_name;
-        }
-        $categories[] = array('categoryName' => $term_name, 'categoryId' => $term->tid);
-      }
-    }
-  }
-  return $categories;
-}
-
-function blogapi_metaweblog_get_recent_posts($blogid, $username, $password, $number_of_posts) {
-  return blogapi_blogger_get_recent_posts('0123456789ABCDEF', $blogid, $username, $password, $number_of_posts, TRUE);
-}
-
-// see above
-function blogapi_mt_get_recent_post_titles($blogid, $username, $password, $number_of_posts) {
-  return blogapi_blogger_get_recent_posts('0123456789ABCDEF', $blogid, $username, $password, $number_of_posts, FALSE);
-}
-
-/* **** */
-function blogapi_mt_get_category_list($blogid, $username, $password) {
-  return blogapi_metaweblog_get_category_list($blogid, $username, $password);
-}
-
-/**
- * Blogging API callback. Returns a list of the taxonomy terms that are
- * assigned to a particular node.
- */
-function blogapi_mt_get_post_categories($postid, $username, $password) {
-  $user = blogapi_validate_user($username, $password);
-  if (!$user->uid) {
-    return blogapi_error($user);
-  }
-
-  $terms = module_invoke('taxonomy', 'node_get_terms', $postid, 'tid');
-  $categories = array();
-  foreach ($terms as $term) {
-    $term_name = $term->name;
-    foreach (module_invoke('taxonomy', 'get_parents', $term->tid, 'tid') as $parent) {
-      $term_name = $parent->name . '/' . $term_name;
-    }
-    $categories[] = array('categoryName' => $term_name, 'categoryId' => $term->tid, 'isPrimary' => true);
-  }
-  return $categories;
-}
-
-/**
- * Blogging API callback. Assigns taxonomy terms to a particular node.
- */
-function blogapi_mt_set_post_categories($postid, $username, $password, $categories) {
-  $user = blogapi_validate_user($username, $password);
-  if (!$user->uid) {
-    return blogapi_error($user);
-  }
-
-  $node = node_load($postid);
-  $node->taxonomy = array();
-  foreach ($categories as $category) {
-    $node->taxonomy[] = $category['categoryId'];
-  }
-  node_save($node);
-  return TRUE;
-}
-
-/**
- * Blogging API callback. Sends a list of available input formats.
- */
-function blogapi_mt_supported_text_filters() {
-  // NOTE: we're only using anonymous' formats because the MT spec
-  // does not allow for per-user formats.
-  $formats = filter_formats();
-
-  $filters = array();
-  foreach ($formats as $format) {
-    $filter['key'] = $format->format;
-    $filter['label'] = $format->name;
-    $filters[] = $filter;
-  }
-
-  return $filters;
-}
-
-/**
- * Blogging API callback. Can not be implemented without support from
- * trackback module.
- */
-function blogapi_mt_get_trackback_pings() {
-  return blogapi_error(t('Not implemented.'));
-}
-
-/**
- * Blogging API callback. Publishes the given node
- */
-function blogap_mti_publish_post($postid, $username, $password) {
-  $user = blogapi_validate_user($username, $password);
-  if (!$user->uid) {
-    return blogapi_error($user);
-  }
-  $node = node_load($postid);
-  if (!$node) {
-    return blogapi_error(t('Invalid post.'));
-  }
-
-  $node->status = 1;
-  if (!node_access('update', $node)) {
-    return blogapi_error(t('You do not have permission to update this post.'));
-  }
-
-  node_save($node);
-
-  return true;
-}
-
-/**
- * Prepare an error message for returning to the XMLRPC caller.
- */
-function blogapi_error($message) {
-  static $xmlrpcusererr;
-  if (!is_array($message)) {
-    $message = array($message);
-  }
-
-  $message = implode(' ', $message);
-
-  return xmlrpc_error($xmlrpcusererr + 1, strip_tags($message));
-}
-
-/**
- * Ensure that the given user has permission to edit a blog.
- */
-function blogapi_validate_user($username, $password) {
-  global $user;
-
-  $user = user_authenticate($username, $password);
-
-  if ($user->uid) {
-    if (user_access('edit own blog', $user)) {
-      return $user;
-    }
-    else {
-      return t("You either tried to edit somebody else's blog or you don't have permission to edit your own blog.");
-    }
-  }
-  else {
-    return t('Wrong username or password.');
-  }
-}
-
-/**
- * For the blogger API, extract the node title from the contents field.
- */
-function blogapi_blogger_title(&$contents) {
-  if (eregi('<title>([^<]*)</title>', $contents, $title)) {
-    $title = strip_tags($title[0]);
-    $contents = ereg_replace('<title>[^<]*</title>', '', $contents);
-  }
-  else {
-    list($title, $contents) = explode("\n", $contents, 2);
-  }
-  return $title;
-}
-
-function blogapi_settings() {
-  $form['blogapi_engine'] = array(
-    '#type' => 'select', '#title' => t('XML-RPC Engine'), '#default_value' => variable_get('blogapi_engine', 0),
-    '#options' => array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'),
-    '#description' => t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.')
-  );
-
-  $node_types = node_get_types();
-  $defaults = isset($node_types['blog']) ? array('blog' => 1) : array();
-  $form['blogapi_node_types'] = array(
-    '#type' => 'checkboxes', '#title' => t('Blog types'), '#required' => TRUE,
-    '#default_value' => variable_get('blogapi_node_types', $defaults), '#options' => $node_types,
-    '#description' => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).')
-  );
-
-  return $form;
-}
-
-function blogapi_menu($may_cache) {
-  $items = array();
-
-  if (drupal_is_front_page()) {
-    drupal_add_link(array('rel' => 'EditURI',
-                          'type' => 'application/rsd+xml',
-                          'title' => t('RSD'),
-                          'href' => url('blogapi/rsd', NULL, NULL, TRUE)));
-  }
-
-  if ($may_cache) {
-    $items[] = array('path' => 'blogapi', 'title' => t('RSD'), 'callback' => 'blogapi_blogapi', 'access' => user_access('access content'), 'type' => MENU_CALLBACK);
-  }
-
-  return $items;
-}
-
-function blogapi_blogapi() {
-  switch (arg(1)) {
-    case 'rsd':
-      blogapi_rsd();
-      break;
-    default:
-      drupal_not_found();
-      break;
-  }
-}
-
-function blogapi_rsd() {
-  global $base_url;
-
-  $xmlrpc = $base_url .'/'. 'xmlrpc.php';
-  $base = url('', NULL, NULL, TRUE);
-  $blogid = 1; # until we figure out how to handle multiple bloggers
-
-  drupal_set_header('Content-Type: application/rsd+xml; charset=utf-8');
-  print <<<__RSD__
-<?xml version="1.0"?>
-<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
-  <service>
-    <engineName>Drupal</engineName>
-    <engineLink>http://drupal.org/</engineLink>
-    <homePageLink>$base</homePageLink>
-    <apis>
-      <api name="MetaWeblog" preferred="false" apiLink="$xmlrpc" blogID="$blogid" />
-      <api name="Blogger" preferred="true" apiLink="$xmlrpc" blogID="$blogid" />
-      <api name="MovableType" preferred="false" apiLink="$xmlrpc" blogID="$blogid" />
-    </apis>
-  </service>
-</rsd>
-__RSD__;
-}
-
-/**
- * Handles extra information sent by clients according to MovableType's spec.
- */
-function _blogapi_mt_extra(&$node, $struct) {
-  if (is_array($node)) {
-    $was_array = true;
-    $node = (object)$node;
-  }
-
-  // mt_allow_comments
-  if (array_key_exists('mt_allow_comments', $struct)) {
-    switch ($struct['mt_allow_comments']) {
-      case 0:
-        $node->comment = COMMENT_NODE_DISABLED;
-        break;
-      case 1:
-        $node->comment = COMMENT_NODE_READ_WRITE;
-        break;
-      case 2:
-        $node->comment = COMMENT_NODE_READ_ONLY;
-        break;
-    }
-  }
-
-  // merge the 3 body sections (description, mt_excerpt, mt_text_more) into
-  // one body
-  if ($struct['mt_excerpt']) {
-    $node->body = $struct['mt_excerpt'] .'<!--break-->'.$node->body;
-  }
-  if ($struct['mt_text_more']) {
-    $node->body = $node->body . '<!--extended-->' . $struct['mt_text_more'];
-  }
-
-  // mt_tb_ping_urls
-  if (function_exists('trackback_send')) {
-    if (is_array($struct['mt_tb_ping_urls'])) {
-      foreach ($struct['mt_tb_ping_urls'] as $tb_ping_url) {
-        $node->tb_url = $tb_ping_url->getVal();
-        trackback_send($node);
-        unset($node->tb_url); // make sure we don't ping twice
-      }
-    }
-    else {
-      $node->tb_url = $struct['mt_tb_ping_urls'];
-    }
-  }
-
-  // mt_convert_breaks
-  if ($struct['mt_convert_breaks']) {
-    $node->format = $struct['mt_convert_breaks'];
-  }
-
-  // dateCreated
-  if ($struct['dateCreated']) {
-    $node->date = format_date(mktime($struct['dateCreated']->hour, $struct['dateCreated']->minute, $struct['dateCreated']->second, $struct['dateCreated']->month, $struct['dateCreated']->day, $struct['dateCreated']->year), 'custom', 'Y-m-d H:i:s O');
-  }
-
-  if ($was_array) {
-    $node = (array)$node;
-  }
-}
-
-function _blogapi_get_post($node, $bodies = true) {
-  $xmlrpcval = array (
-    'userid' => $node->name,
-    'dateCreated' => xmlrpc_date($node->created),
-    'title' => $node->title,
-    'postid' => $node->nid,
-    'link' => url('node/'.$node->nid, NULL, NULL, true),
-    'permaLink' => url('node/'.$node->nid, NULL, NULL, true),
-  );
-  if ($bodies) {
-    if ($node->comment = 1) {
-      $comment = 2;
-    }
-    if ($node->comment = 2) {
-      $comment = 1;
-    }
-
-    $xmlrpcval['content'] = "<title>$node->title</title>$node->body";
-    $xmlrpcval['description'] = $node->body;
-    // Add MT specific fields
-    $xmlrpcval['mt_allow_comments'] = $comment;
-    $xmlrpcval['mt_convert_breaks'] = $node->format;
-  }
-
-  return $xmlrpcval;
-}
-
-function _blogapi_blogid($id) {
-  if (is_numeric($id)) {
-    return 'blog';
-  }
-  else {
-    return $id;
-  }
-}
-
-function _blogapi_get_node_types() {
-  $available_types = array_keys(array_filter(variable_get('blogapi_node_types', array('blog' => 1))));
-  $types = array();
-  foreach (node_get_types() as $type => $name) {
-    if (node_access('create', $type) && in_array($type, $available_types)) {
-      $types[] = $type;
-    }
-  }
-
-  return $types;
-}
-
diff --git a/modules/book.module b/modules/book.module
deleted file mode 100644 (file)
index 1667b92..0000000
+++ /dev/null
@@ -1,1026 +0,0 @@
-<?php
-// $Id: book.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Allows users to collaboratively author a book.
- */
-
-/**
- * Implementation of hook_node_info().
- */
-function book_node_info() {
-  return array('book' => array('name' => t('book page'), 'base' => 'book'));
-}
-
-/**
- * Implementation of hook_perm().
- */
-function book_perm() {
-    return array('outline posts in books', 'create book pages', 'create new books', 'edit book pages', 'edit own book pages', 'see printer-friendly version');
-}
-
-/**
- * Implementation of hook_access().
- */
-function book_access($op, $node) {
-  global $user;
-
-  if ($op == 'create') {
-    // Only registered users can create book pages.  Given the nature
-    // of the book module this is considered to be a good/safe idea.
-    return user_access('create book pages');
-  }
-
-  if ($op == 'update') {
-    // Only registered users can update book pages.  Given the nature
-    // of the book module this is considered to be a good/safe idea.
-    // One can only update a book page if there are no suggested updates
-    // of that page waiting for approval.  That is, only updates that
-    // don't overwrite the current or pending information are allowed.
-
-    if ((user_access('edit book pages') && !$node->moderate) || ($node->uid == $user->uid && user_access('edit own book pages'))) {
-      return TRUE;
-    }
-    else {
-       // do nothing. node-access() will determine further access
-    }
-  }
-}
-
-/**
- * Implementation of hook_link().
- */
-function book_link($type, $node = 0, $main = 0) {
-
-  $links = array();
-
-  if ($type == 'node' && isset($node->parent)) {
-    if (!$main) {
-      if (book_access('create', $node)) {
-        $links[] = l(t('add child page'), "node/add/book/parent/$node->nid");
-      }
-      if (user_access('see printer-friendly version')) {
-        $links[] = l(t('printer-friendly version'),
-                     'book/export/html/'. $node->nid,
-                     array('title' => t('Show a printer-friendly version of this book page and its sub-pages.')));
-      }
-    }
-  }
-
-  return $links;
-}
-
-/**
- * Implementation of hook_menu().
- */
-function book_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'node/add/book',
-      'title' => t('book page'),
-      'access' => user_access('create book pages'));
-    $items[] = array(
-      'path' => 'admin/node/book',
-      'title' => t('books'),
-      'callback' => 'book_admin',
-      'access' => user_access('administer nodes'),
-      'type' => MENU_LOCAL_TASK,
-      'weight' => -1);
-    $items[] = array(
-      'path' => 'admin/node/book/list',
-      'title' => t('list'),
-      'type' => MENU_DEFAULT_LOCAL_TASK);
-    $items[] = array(
-      'path' => 'admin/node/book/orphan',
-      'title' => t('orphan pages'),
-      'callback' => 'book_admin_orphan',
-      'type' => MENU_LOCAL_TASK,
-      'weight' => 8);
-    $items[] = array(
-      'path' => 'book',
-      'title' => t('books'),
-      'callback' => 'book_render',
-      'access' => user_access('access content'),
-      'type' => MENU_SUGGESTED_ITEM);
-    $items[] = array(
-      'path' => 'book/export',
-      'callback' => 'book_export',
-      'access' => user_access('access content'),
-      'type' => MENU_CALLBACK);
-  }
-  else {
-    // To avoid SQL overhead, check whether we are on a node page and whether the
-    // user is allowed to outline posts in books.
-    if (arg(0) == 'node' && is_numeric(arg(1)) && user_access('outline posts in books')) {
-      // Only add the outline-tab for non-book pages:
-      $result = db_query(db_rewrite_sql("SELECT n.nid FROM {node} n WHERE n.nid = %d AND n.type != 'book'"), arg(1));
-      if (db_num_rows($result) > 0) {
-        $items[] = array(
-          'path' => 'node/'. arg(1) .'/outline',
-          'title' => t('outline'),
-          'callback' => 'book_outline',
-          'callback arguments' => array(arg(1)),
-          'access' => user_access('outline posts in books'),
-          'type' => MENU_LOCAL_TASK,
-          'weight' => 2);
-      }
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_block().
- *
- * Displays the book table of contents in a block when the current page is a
- * single-node view of a book node.
- */
-function book_block($op = 'list', $delta = 0) {
-  $block = array();
-  if ($op == 'list') {
-    $block[0]['info'] = t('Book navigation');
-    return $block;
-  }
-  else if ($op == 'view') {
-    // Only display this block when the user is browsing a book:
-    if (arg(0) == 'node' && is_numeric(arg(1))) {
-      $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.nid = %d'), arg(1));
-      if (db_num_rows($result) > 0) {
-        $node = db_fetch_object($result);
-
-        $path = book_location($node);
-        $path[] = $node;
-
-        $expand = array();
-        foreach ($path as $key => $node) {
-          $expand[] = $node->nid;
-        }
-
-        $block['subject'] = check_plain($path[0]->title);
-        $block['content'] = book_tree($expand[0], 5, $expand);
-      }
-    }
-
-    return $block;
-  }
-}
-
-/**
- * Implementation of hook_load().
- */
-function book_load($node) {
-  $book = db_fetch_object(db_query('SELECT * FROM {book} WHERE vid = %d', $node->vid));
-  return $book;
-}
-
-/**
- * Implementation of hook_insert().
- */
-function book_insert($node) {
-  db_query("INSERT INTO {book} (nid, vid, parent, weight) VALUES (%d, %d, %d, %d)", $node->nid, $node->vid, $node->parent, $node->weight);
-}
-
-/**
- * Implementation of hook_update().
- */
-function book_update($node) {
-  if ($node->revision) {
-    db_query("INSERT INTO {book} (nid, vid, parent, weight) VALUES (%d, %d, %d, %d)", $node->nid, $node->vid, $node->parent, $node->weight);
-  }
-  else {
-    db_query("UPDATE {book} SET parent = %d, weight = %d WHERE vid = %d", $node->parent, $node->weight, $node->vid);
-  }
-}
-
-/**
- * Implementation of hook_delete().
- */
-function book_delete(&$node) {
-  db_query('DELETE FROM {book} WHERE nid = %d', $node->nid);
-}
-
-/**
- * Implementation of hook_submit().
- */
-function book_submit(&$node) {
-  global $user;
-  // Set default values for non-administrators.
-  if (!user_access('administer nodes')) {
-    $node->weight = 0;
-    $node->revision = 1;
-    $book->uid = $user->uid;
-    $book->name = $user->uid ? $user->name : '';
-  }
-}
-
-/**
- * Implementation of hook_form().
- */
-function book_form(&$node) {
-  if ($node->nid && !$node->parent && !user_access('create new books')) {
-    $form['parent'] = array('#type' => 'value', '#value' => $node->parent);
-  }
-  else {
-    $form['parent'] = array('#type' => 'select',
-      '#title' => t('Parent'),
-      '#default_value' => ($node->parent ? $node->parent : arg(4)),
-      '#options' => book_toc($node->nid),
-      '#weight' => -4,
-      '#description' => user_access('create new books') ? t('The parent section in which to place this page.  Note that each page whose parent is &lt;top-level&gt; is an independent, top-level book.') : t('The parent that this page belongs in.'),
-    );
-  }
-
-  $form['title'] = array('#type' => 'textfield',
-    '#title' => t('Title'),
-    '#required' => TRUE,
-    '#default_value' => $node->title,
-    '#weight' => -5,
-  );
-  $form['body_filter']['body'] = array('#type' => 'textarea',
-    '#title' => t('Body'),
-    '#default_value' => $node->body,
-    '#rows' => 20,
-    '#required' => TRUE,
-  );
-  $form['body_filter']['format'] = filter_form($node->format);
-
-  $form['log'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Log message'),
-    '#default_value' => $node->log,
-    '#weight' => 5,
-    '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.'),
-  );
-
-  if (user_access('administer nodes')) {
-    $form['weight'] = array('#type' => 'weight',
-      '#title' => t('Weight'),
-      '#default_value' => $node->weight,
-      '#delta' => 15,
-      '#weight' => 5,
-      '#description' => t('Pages at a given level are ordered first by weight and then by title.'),
-    );
-  }
-  else {
-    // If a regular user updates a book page, we create a new revision
-    // authored by that user:
-    $form['revision'] = array('#type' => 'hidden', '#value' => 1);
-  }
-
-  return $form;
-}
-
-/**
- * Implementation of function book_outline()
- * Handles all book outline operations.
- */
-function book_outline($nid) {
-  $node = node_load($nid);
-  $page = book_load($node);
-
-  $form['parent'] = array('#type' => 'select',
-    '#title' => t('Parent'),
-    '#default_value' => $page->parent,
-    '#options' => book_toc($node->nid),
-    '#description' => t('The parent page in the book.'),
-  );
-  $form['weight'] = array('#type' => 'weight',
-    '#title' => t('Weight'),
-    '#default_value' => $page->weight,
-    '#delta' => 15,
-    '#description' => t('Pages at a given level are ordered first by weight and then by title.'),
-  );
-  $form['log'] = array('#type' => 'textarea',
-    '#title' => t('Log message'),
-    '#default_value' => $node->log,
-    '#description' => t('An explanation to help other authors understand your motivations to put this post into the book.'),
-  );
-
-  $form['nid'] = array('#type' => 'value', '#value' => $nid);
-  if ($page->nid) {
-    $form['update'] = array('#type' => 'submit',
-      '#value' => t('Update book outline'),
-    );
-    $form['remove'] = array('#type' => 'submit',
-      '#value' => t('Remove from book outline'),
-    );
-  }
-  else {
-    $form['add'] = array('#type' => 'submit', '#value' => t('Add to book outline'));
-  }
-
-  drupal_set_title(check_plain($node->title));
-  return drupal_get_form('book_outline', $form);
-}
-
-/**
- * Handles book outline form submissions.
- */
-function book_outline_submit($form_id, $form_values) {
-  $op = $_POST['op'];
-  $node = node_load($form_values['nid']);
-
-  switch ($op) {
-    case t('Add to book outline'):
-      db_query('INSERT INTO {book} (nid, vid, parent, weight) VALUES (%d, %d, %d, %d)', $node->nid, $node->vid, $form_values['parent'], $form_values['weight']);
-      db_query("UPDATE {node_revisions} SET log = '%s' WHERE vid = %d", $form_values['log'], $node->vid);
-      drupal_set_message(t('The post has been added to the book.'));
-      break;
-    case t('Update book outline'):
-      db_query('UPDATE {book} SET parent = %d, weight = %d WHERE vid = %d', $form_values['parent'], $form_values['weight'], $node->vid);
-      db_query("UPDATE {node_revisions} SET log = '%s' WHERE vid = %d", $form_values['log'], $node->vid);
-      drupal_set_message(t('The book outline has been updated.'));
-      break;
-    case t('Remove from book outline'):
-      db_query('DELETE FROM {book} WHERE nid = %d', $node->nid);
-      drupal_set_message(t('The post has been removed from the book.'));
-      break;
-  }
-  return "node/$node->nid";
-}
-
-/**
- * Given a node, this function returns an array of 'book node' objects
- * representing the path in the book tree from the root to the
- * parent of the given node.
- *
- * @param node - a book node object for which to compute the path
- *
- * @return - an array of book node objects representing the path of
- * nodes root to parent of the given node. Returns an empty array if
- * the node does not exist or is not part of a book hierarchy.
- *
- */
-function book_location($node, $nodes = array()) {
-  $parent = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.nid = %d'), $node->parent));
-  if (isset($parent->title)) {
-    $nodes = book_location($parent, $nodes);
-    $nodes[] = $parent;
-  }
-  return $nodes;
-}
-
-/**
- * Accumulates the nodes up to the root of the book from the given node in the $nodes array.
- */
-function book_location_down($node, $nodes = array()) {
-  $last_direct_child = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.status = 1 AND b.parent = %d ORDER BY b.weight DESC, n.title DESC'), $node->nid));
-  if ($last_direct_child) {
-    $nodes[] = $last_direct_child;
-    $nodes = book_location_down($last_direct_child, $nodes);
-  }
-  return $nodes;
-}
-
-/**
- * Fetches the node object of the previous page of the book.
- */
-function book_prev($node) {
-  // If the parent is zero, we are at the start of a book so there is no previous.
-  if ($node->parent == 0) {
-    return NULL;
-  }
-
-  // Previous on the same level:
-  $direct_above = db_fetch_object(db_query(db_rewrite_sql("SELECT n.nid, n.title, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE b.parent = %d AND n.status = 1 AND n.moderate = 0 AND (b.weight < %d OR (b.weight = %d AND n.title < '%s')) ORDER BY b.weight DESC, n.title DESC"), $node->parent, $node->weight, $node->weight, $node->title));
-  if ($direct_above) {
-    // Get last leaf of $above.
-    $path = book_location_down($direct_above);
-
-    return $path ? (count($path) > 0 ? array_pop($path) : NULL) : $direct_above;
-  }
-  else {
-    // Direct parent:
-    $prev = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.title FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.nid = %d AND n.status = 1 AND n.moderate = 0'), $node->parent));
-    return $prev;
-  }
-}
-
-/**
- * Fetches the node object of the next page of the book.
- */
-function book_next($node) {
-  // get first direct child
-  $child = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.title, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE b.parent = %d AND n.status = 1 AND n.moderate = 0 ORDER BY b.weight ASC, n.title ASC'), $node->nid));
-  if ($child) {
-    return $child;
-  }
-
-  // No direct child: get next for this level or any parent in this book.
-  $path = book_location($node); // Path to top-level node including this one.
-  $path[] = $node;
-
-  while (($leaf = array_pop($path)) && count($path)) {
-    $next = db_fetch_object(db_query(db_rewrite_sql("SELECT n.nid, n.title, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE b.parent = %d AND n.status = 1 AND n.moderate = 0 AND (b.weight > %d OR (b.weight = %d AND n.title > '%s')) ORDER BY b.weight ASC, n.title ASC"), $leaf->parent, $leaf->weight, $leaf->weight, $leaf->title));
-    if ($next) {
-      return $next;
-    }
-  }
-}
-
-/**
- * Returns the content of a given node.  If $teaser if true, returns
- * the teaser rather than full content.  Displays the most recently
- * approved revision of a node (if any) unless we have to display this
- * page in the context of the moderation queue.
- */
-function book_content($node, $teaser = FALSE) {
-  // Return the page body.
-  return node_prepare($node, $teaser);
-}
-
-/**
- * Implementation of hook_view().
- *
- * If not displayed on the main page, we render the node as a page in the
- * book with extra links to the previous and next pages.
- */
-function book_view(&$node, $teaser = FALSE, $page = FALSE) {
-  $node = node_prepare($node, $teaser);
-}
-
-/**
- * Implementation of hook_nodeapi().
- *
- * Appends book navigation to all nodes in the book.
- */
-function book_nodeapi(&$node, $op, $teaser, $page) {
-  switch ($op) {
-    case 'view':
-      if (!$teaser) {
-        $book = db_fetch_array(db_query('SELECT * FROM {book} WHERE vid = %d', $node->vid));
-        if ($book) {
-          if ($node->moderate && user_access('administer nodes')) {
-            drupal_set_message(t("The post has been submitted for moderation and won't be accessible until it has been approved."));
-          }
-
-          foreach ($book as $key => $value) {
-            $node->$key = $value;
-          }
-
-          $path = book_location($node);
-          // Construct the breadcrumb:
-          $node->breadcrumb = array(); // Overwrite the trail with a book trail.
-          foreach ($path as $level) {
-            $node->breadcrumb[] = array('path' => 'node/'. $level->nid, 'title' =>  $level->title);
-          }
-          $node->breadcrumb[] = array('path' => 'node/'. $node->nid);
-
-          $node->body .= theme('book_navigation', $node);
-
-          if ($page) {
-            menu_set_location($node->breadcrumb);
-          }
-        }
-      }
-      break;
-    case 'delete revision':
-      db_query('DELETE FROM {book} WHERE vid = %d', $node->vid);
-      break;
-    case 'delete':
-      db_query('DELETE FROM {book} WHERE nid = %d', $node->nid);
-      break;
-  }
-}
-
-/**
- * Prepares the links to children (TOC) and forward/backward
- * navigation for a node presented as a book page.
- *
- * @ingroup themeable
- */
-function theme_book_navigation($node) {
-  $output = '';
-  $links = '';
-
-  if ($node->nid) {
-    $tree = book_tree($node->nid);
-
-    if ($prev = book_prev($node)) {
-      drupal_add_link(array('rel' => 'prev', 'href' => url('node/'. $prev->nid)));
-      $links .= l(t('‹ ') . $prev->title, 'node/'. $prev->nid, array('class' => 'page-previous', 'title' => t('Go to previous page')));
-    }
-    if ($node->parent) {
-      drupal_add_link(array('rel' => 'up', 'href' => url('node/'. $node->parent)));
-      $links .= l(t('up'), 'node/'. $node->parent, array('class' => 'page-up', 'title' => t('Go to parent page')));
-    }
-    if ($next = book_next($node)) {
-      drupal_add_link(array('rel' => 'next', 'href' => url('node/'. $next->nid)));
-      $links .= l($next->title . t(' ›'), 'node/'. $next->nid, array('class' => 'page-next', 'title' => t('Go to next page')));
-    }
-
-    if (isset($tree) || isset($links)) {
-      $output = '<div class="book-navigation">';
-      if (isset($tree)) {
-        $output .= $tree;
-      }
-      if (isset($links)) {
-        $output .= '<div class="page-links">'. $links .'</div>';
-      }
-      $output .= '</div>';
-    }
-  }
-
-  return $output;
-}
-
-/**
- * This is a helper function for book_toc().
- */
-function book_toc_recurse($nid, $indent, $toc, $children, $exclude) {
-  if ($children[$nid]) {
-    foreach ($children[$nid] as $foo => $node) {
-      if (!$exclude || $exclude != $node->nid) {
-        $toc[$node->nid] = $indent .' '. $node->title;
-        $toc = book_toc_recurse($node->nid, $indent .'--', $toc, $children, $exclude);
-      }
-    }
-  }
-
-  return $toc;
-}
-
-/**
- * Returns an array of titles and nid entries of book pages in table of contents order.
- */
-function book_toc($exclude = 0) {
-  $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.status = 1 ORDER BY b.weight, n.title'));
-
-  while ($node = db_fetch_object($result)) {
-    if (!$children[$node->parent]) {
-      $children[$node->parent] = array();
-    }
-    $children[$node->parent][] = $node;
-  }
-
-  $toc = array();
-  // If the user has permission to create new books, add the top-level book page to the menu;
-  if (user_access('create new books')) {
-    $toc[0] = '<'. t('top-level') .'>';
-  }
-
-  $toc = book_toc_recurse(0, '', $toc, $children, $exclude);
-
-  return $toc;
-}
-
-/**
- * This is a helper function for book_tree()
- */
-function book_tree_recurse($nid, $depth, $children, $unfold = array()) {
-  $output = '';
-  if ($depth > 0) {
-    if (isset($children[$nid])) {
-      foreach ($children[$nid] as $foo => $node) {
-        if (in_array($node->nid, $unfold)) {
-          if ($tree = book_tree_recurse($node->nid, $depth - 1, $children, $unfold)) {
-            $output .= '<li class="expanded">';
-            $output .= l($node->title, 'node/'. $node->nid);
-            $output .= '<ul class="menu">'. $tree .'</ul>';
-            $output .= '</li>';
-          }
-          else {
-            $output .= '<li class="leaf">'. l($node->title, 'node/'. $node->nid) .'</li>';
-          }
-        }
-        else {
-          if ($tree = book_tree_recurse($node->nid, 1, $children)) {
-            $output .= '<li class="collapsed">'. l($node->title, 'node/'. $node->nid) .'</li>';
-          }
-          else {
-            $output .= '<li class="leaf">'. l($node->title, 'node/'. $node->nid) .'</li>';
-          }
-        }
-      }
-    }
-  }
-
-  return $output;
-}
-
-/**
- * Returns an HTML nested list (wrapped in a menu-class div) representing the book nodes
- * as a tree.
- */
-function book_tree($parent = 0, $depth = 3, $unfold = array()) {
-  $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.status = 1 AND n.moderate = 0 ORDER BY b.weight, n.title'));
-
-  while ($node = db_fetch_object($result)) {
-    $list = isset($children[$node->parent]) ? $children[$node->parent] : array();
-    $list[] = $node;
-    $children[$node->parent] = $list;
-  }
-
-  if ($tree = book_tree_recurse($parent, $depth, $children, $unfold)) {
-    return '<ul class="menu">'. $tree .'</ul>';
-  }
-}
-
-/**
- * Menu callback; prints a listing of all books.
- */
-function book_render() {
-  $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE b.parent = 0 AND n.status = 1 AND n.moderate = 0 ORDER BY b.weight, n.title'));
-
-  $books = array();
-  while ($node = db_fetch_object($result)) {
-    $books[] = l($node->title, 'node/'. $node->nid);
-  }
-
-  return theme('item_list', $books);
-}
-
-/**
- * Menu callback; Generates various representation of a book page with
- * all descendants and prints the requested representation to output.
- *
- * The function delegates the generation of output to helper functions.
- * The function name is derived by prepending 'book_export_' to the
- * given output type.  So, e.g., a type of 'html' results in a call to
- * the function book_export_html().
- *
- * @param type
- *   - a string encoding the type of output requested.
- *       The following types are currently supported in book module
- *          html: HTML (printer friendly output)
- *       Other types are supported in contributed modules.
- * @param nid
- *   - an integer representing the node id (nid) of the node to export
- *
- */
-function book_export($type = 'html', $nid = 0) {
-  $type = drupal_strtolower($type);
-  $node_result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.nid = %d'), $nid);
-  if (db_num_rows($node_result) > 0) {
-      $node = db_fetch_object($node_result);
-  }
-  $depth = count(book_location($node)) + 1;
-  $export_function = 'book_export_' . $type;
-
-  if (function_exists($export_function)) {
-    print call_user_func($export_function, $nid, $depth);
-  }
-  else {
-    drupal_set_message(t('Unknown export format.'));
-    drupal_not_found();
-  }
-}
-
-/**
- * This function is called by book_export() to generate HTML for export.
- *
- * The given node is /embedded to its absolute depth in a top level
- * section/.  For example, a child node with depth 2 in the hierarchy
- * is contained in (otherwise empty) &lt;div&gt; elements
- * corresponding to depth 0 and depth 1.  This is intended to support
- * WYSIWYG output - e.g., level 3 sections always look like level 3
- * sections, no matter their depth relative to the node selected to be
- * exported as printer-friendly HTML.
- *
- * @param nid
- *   - an integer representing the node id (nid) of the node to export
- * @param depth
- *   - an integer giving the depth in the book hierarchy of the node
- *     which is to be exported
- *
- * @return
- *   - string containing HTML representing the node and its children in
- *     the book hierarchy
-*/
-function book_export_html($nid, $depth) {
-  if (user_access('see printer-friendly version')) {
-    $node = node_load($nid);
-    for ($i = 1; $i < $depth; $i++) {
-      $content .= "<div class=\"section-$i\">\n";
-    }
-    $content .= book_recurse($nid, $depth, 'book_node_visitor_html_pre', 'book_node_visitor_html_post');
-    for ($i = 1; $i < $depth; $i++) {
-      $content .= "</div>\n";
-    }
-    return theme('book_export_html', check_plain($node->title), $content);
-  }
-  else {
-    drupal_access_denied();
-  }
-}
-
-/**
- * How the book's HTML export should be themed
- *
- * @ingroup themeable
- */
-function theme_book_export_html($title, $content) {
-  global $base_url;
-  $html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
-  $html .= '<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">';
-  $html .= "<head>\n<title>". $title ."</title>\n";
-  $html .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
-  $html .= '<base href="'. $base_url .'/" />' . "\n";
-  $html .= "<style type=\"text/css\">\n@import url(misc/print.css);\n</style>\n";
-  $html .= "</head>\n<body>\n". $content . "\n</body>\n</html>\n";
-  return $html;
-}
-
-/**
- * Traverses the book tree.  Applies the $visit_pre() callback to each
- * node, is called recursively for each child of the node (in weight,
- * title order).  Finally appends the output of the $visit_post()
- * callback to the output before returning the generated output.
- *
- * @param nid
- *  - the node id (nid) of the root node of the book hierarchy.
- * @param depth
- *  - the depth of the given node in the book hierarchy.
- * @param visit_pre
- *  - a function callback to be called upon visiting a node in the tree
- * @param visit_post
- *  - a function callback to be called after visiting a node in the tree,
- *    but before recursively visiting children.
- * @return
- *  - the output generated in visiting each node
- */
-function book_recurse($nid = 0, $depth = 1, $visit_pre, $visit_post) {
-  $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.status = 1 AND n.nid = %d AND n.moderate = 0 ORDER BY b.weight, n.title'), $nid);
-  while ($page = db_fetch_object($result)) {
-    // Load the node:
-    $node = node_load($page->nid);
-
-    if ($node) {
-      if (function_exists($visit_pre)) {
-        $output .= call_user_func($visit_pre, $node, $depth, $nid);
-      }
-      else {
-        $output .= book_node_visitor_html_pre($node, $depth, $nid);
-      }
-
-      $children = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.status = 1 AND b.parent = %d AND n.moderate = 0 ORDER BY b.weight, n.title'), $node->nid);
-      while ($childpage = db_fetch_object($children)) {
-          $childnode = node_load($childpage->nid);
-          if ($childnode->nid != $node->nid) {
-              $output .= book_recurse($childnode->nid, $depth + 1, $visit_pre, $visit_post);
-          }
-      }
-      if (function_exists($visit_post)) {
-        $output .= call_user_func($visit_post, $node, $depth);
-      }
-      else {
-        # default
-        $output .= book_node_visitor_html_post($node, $depth);
-      }
-    }
-  }
-
-  return $output;
-}
-
-/**
- * Generates printer-friendly HTML for a node.  This function
- * is a 'pre-node' visitor function for book_recurse().
- *
- * @param $node
- *   - the node to generate output for.
- * @param $depth
- *   - the depth of the given node in the hierarchy. This
- *   is used only for generating output.
- * @param $nid
- *   - the node id (nid) of the given node. This
- *   is used only for generating output.
- * @return
- *   - the HTML generated for the given node.
- */
-function book_node_visitor_html_pre($node, $depth, $nid) {
-  // Output the content:
-  if (node_hook($node, 'content')) {
-    $node = node_invoke($node, 'content');
-  }
-  // Allow modules to change $node->body before viewing.
-  node_invoke_nodeapi($node, 'print', $node->body, false);
-
-  $output .= "<div id=\"node-". $node->nid ."\" class=\"section-$depth\">\n";
-  $output .= "<h1 class=\"book-heading\">". check_plain($node->title) ."</h1>\n";
-
-  if ($node->body) {
-    $output .= $node->body;
-  }
-  return $output;
-}
-
-/**
- * Finishes up generation of printer-friendly HTML after visiting a
- * node. This function is a 'post-node' visitor function for
- * book_recurse().
- */
-function book_node_visitor_html_post($node, $depth) {
-  return "</div>\n";
-}
-
-function _book_admin_table($nodes = array()) {
-  $form = array(
-    '#theme' => 'book_admin_table',
-    '#tree' => TRUE,
-  );
-
-  foreach ($nodes as $node) {
-    $form = array_merge($form, _book_admin_table_tree($node, 0));
-  }
-
-  return $form;
-}
-
-function _book_admin_table_tree($node, $depth) {
-  $form = array();
-
-  $form[] = array(
-    'nid' => array('#type' => 'value', '#value' => $node->nid),
-    'depth' => array('#type' => 'value', '#value' => $depth),
-    'title' => array(
-      '#type' => 'textfield',
-      '#default_value' => $node->title,
-      '#maxlength' => 255,
-    ),
-    'weight' => array(
-      '#type' => 'weight',
-      '#default_value' => $node->weight,
-      '#delta' => 15,
-    ),
-  );
-
-  $children = db_query(db_rewrite_sql('SELECT n.nid, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE b.parent = %d ORDER BY b.weight, n.title'), $node->nid);
-  while ($child = db_fetch_object($children)) {
-    $form = array_merge($form, _book_admin_table_tree(node_load($child->nid), $depth + 1));
-  }
-
-  return $form;
-}
-
-function theme_book_admin_table($form) {
-  $header = array(t('Title'), t('Weight'), array('data' => t('Operations'), 'colspan' => '3'));
-
-  $rows = array();
-  foreach (element_children($form) as $key) {
-    $nid = $form[$key]['nid']['#value'];
-    $pid = $form[0]['nid']['#value'];
-    if ($pid == $nid) {
-      // Don't return to the parent book page if it is deleted.
-      $pid = '';
-    }
-    $rows[] = array(
-      '<div style="padding-left: '. (25 * $form[$key]['depth']['#value']) .'px;">'. form_render($form[$key]['title']) .'</div>',
-      form_render($form[$key]['weight']),
-      l(t('view'), 'node/'. $nid),
-      l(t('edit'), 'node/'. $nid .'/edit'),
-      l(t('delete'), 'node/'. $nid .'/delete', NULL, 'destination=admin/node/book/'. (arg(3) == 'orphan' ? 'orphan' : $pid)),
-    );
-  }
-
-  return theme('table', $header, $rows);
-}
-
-/**
- * Display an administrative view of the hierarchy of a book.
- */
-function book_admin_edit($nid) {
-  $node = node_load($nid);
-  if ($node->nid) {
-    drupal_set_title(check_plain($node->title));
-    $form = array();
-
-    $form['table'] = _book_admin_table(array($node));
-    $form['save'] = array(
-      '#type' => 'submit',
-      '#value' => t('Save book pages'),
-    );
-
-    return drupal_get_form('book_admin_edit', $form);
-  }
-  else {
-    drupal_not_found();
-  }
-}
-
-/**
- * Menu callback; displays a listing of all orphaned book pages.
- */
-function book_admin_orphan() {
-  $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, n.status, b.parent FROM {node} n INNER JOIN {book} b ON n.vid = b.vid'));
-
-  $pages = array();
-  while ($page = db_fetch_object($result)) {
-    $pages[$page->nid] = $page;
-  }
-
-  $orphans = array();
-  if (count($pages)) {
-    foreach ($pages as $page) {
-      if ($page->parent && empty($pages[$page->parent])) {
-        $orphans[] = node_load($page->nid);
-      }
-    }
-  }
-
-  if (count($orphans)) {
-    $form = array();
-
-    $form['table'] = _book_admin_table($orphans);
-    $form['save'] = array(
-      '#type' => 'submit',
-      '#value' => t('Save book pages'),
-    );
-
-    return drupal_get_form('book_admin_edit', $form);
-  }
-  else {
-    return '<p>'. t('There are no orphan pages.') .'</p>';
-  }
-}
-
-function book_admin_edit_submit($form_id, $form_values) {
-  foreach ($form_values['table'] as $row) {
-    $node = node_load($row['nid']);
-
-    if ($row['title'] != $node->title || $row['weight'] != $node->weight) {
-      $node->title = $row['title'];
-      $node->weight = $row['weight'];
-
-      node_save($node);
-      watchdog('content', t('%type: updated %title.', array('%type' => theme('placeholder', t('book')), '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
-    }
-  }
-
-  if (is_numeric(arg(3))) {
-    // Updating pages in a single book.
-    $book = node_load(arg(3));
-    drupal_set_message(t('Updated book %title.', array('%title' => theme('placeholder', $book->title))));
-  }
-  else {
-    // Updating the orphan pages.
-    drupal_set_message(t('Updated orphan book pages.'));
-  }
-}
-
-/**
- * Menu callback; displays the book administration page.
- */
-function book_admin($nid = 0) {
-  if ($nid) {
-    return book_admin_edit($nid);
-  }
-  else {
-    return book_admin_overview();
-  }
-}
-
-/**
- * Returns an administrative overview of all books.
- */
-function book_admin_overview() {
-  $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE b.parent = 0 ORDER BY b.weight, n.title'));
-  while ($book = db_fetch_object($result)) {
-    $rows[] = array(l($book->title, "node/$book->nid"), l(t('outline'), "admin/node/book/$book->nid"));
-  }
-  $headers = array(t('Book'), t('Operations'));
-
-  return theme('table', $headers, $rows);
-}
-
-/**
- * Implementation of hook_help().
- */
-function book_help($section) {
-  switch ($section) {
-    case 'admin/help#book':
-      $output = '<p>'. t('The <em>book</em> content type is suited for creating structured, multi-page hypertexts such as site resource guides, manuals, and Frequently Asked Questions (FAQs).  It permits a document to have chapters, sections, subsections, etc.  Authors with suitable permissions can add pages to a collaborative book,  placing them into the existing document by adding them to a table of contents menu. ') .'</p>';
-      $output .= '<p>'. t('Books have additional <em>previous</em>, <em>up</em>, and <em>next</em> navigation elements at the bottom of each page for moving through the text.  Additional navigation may be provided by enabling the <em>book navigation block</em> on the <a href="%admin-block">block administration page</a>.', array('%admin-block' => url('admin/block'))) .'</p>';
-      $output .= '<p>'. t('Users can select the <em>printer-friendly version</em> link visible at the bottom of a book page to generate a printer-friendly display of the page and all of its subsections. ') .'</p>';
-      $output .= '<p>'. t('Administrators can view a book outline, from which is it possible to change the titles of sections, and their <i>weight</i> (thus reordering sections).   From this outline, it is also possible to edit and/or delete book pages.   Many content types besides pages (for example, blog entries, stories, and polls) can be added to a collaborative book by choosing the <em>outline</em> tab when viewing the post.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>create new book pages: <a href="%node-add-book">create content &gt;&gt; book page</a>.</li>
-<li>administer individual books (choose a book from list): <a href="%admin-node-book">administer &gt;&gt; content &gt;&gt; books</a>.</li>
-<li>set workflow and other global book settings on the book configuration page: <a href="%admin-settings-content-types-book-page" title="book page content type">administer &gt;&gt; settings &gt;&gt; content types &gt;&gt; configure book page</a>.</li>
-<li>enable the book navigation block: <a href="%admin-block">administer &gt;&gt; blocks</a>.</li>
-<li>control who can create, edit, and outline posts in books by setting access permissions: <a href="%admin-access">administer &gt;&gt; access control</a>.</li>
-</ul>
-', array('%node-add-book' => url('node/add/book'), '%admin-node-book' => url('admin/node/book'), '%admin-settings-content-types-book-page' => url('admin/settings/content-types/book'), '%admin-block' => url('admin/block'), '%admin-access' => url('admin/access')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%book">Book page</a>.', array('%book' => 'http://drupal.org/handbook/modules/book/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Allows users to collaboratively author a book.');
-    case 'admin/node/book':
-      return t('<p>The book module offers a means to organize content, authored by many users, in an online manual, outline or FAQ.</p>');
-    case 'admin/node/book/orphan':
-      return t('<p>Pages in a book are like a tree. As pages are edited, reorganized and removed, child pages might be left with no link to the rest of the book.  Such pages are referred to as "orphan pages".  On this page, administrators can review their books for orphans and reattach those pages as desired.</p>');
-    case 'node/add#book':
-      return t("A book is a collaborative writing effort: users can collaborate writing the pages of the book, positioning the pages in the right order, and reviewing or modifying pages previously written.  So when you have some information to share or when you read a page of the book and you didn't like it, or if you think a certain page could have been written better, you can do something about it.");
-  }
-
-  if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'outline') {
-    return t('The outline feature allows you to include posts in the <a href="%book">book hierarchy</a>.', array('%book' => url('book')));
-  }
-}
-
-
diff --git a/modules/comment.module b/modules/comment.module
deleted file mode 100644 (file)
index d6df750..0000000
+++ /dev/null
@@ -1,1787 +0,0 @@
-<?php
-// $Id: comment.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables users to comment on published content.
- *
- * When enabled, the Drupal comment module creates a discussion
- * board for each Drupal node. Users can post comments to discuss
- * a forum topic, weblog post, story, collaborative book page, etc.
- */
-
-/*
- * Constants to define a comment's published state
- */
-define('COMMENT_PUBLISHED', 0);
-define('COMMENT_NOT_PUBLISHED', 1);
-
-/**
- * Constants to define the viewing modes for comment listings
- */
-define('COMMENT_MODE_FLAT_COLLAPSED', 1);
-define('COMMENT_MODE_FLAT_EXPANDED', 2);
-define('COMMENT_MODE_THREADED_COLLAPSED', 3);
-define('COMMENT_MODE_THREADED_EXPANDED', 4);
-
-/**
- * Constants to define the viewing orders for comment listings
- */
-define('COMMENT_ORDER_NEWEST_FIRST', 1);
-define('COMMENT_ORDER_OLDEST_FIRST', 2);
-
-/**
- * Constants to define the position of the comment controls
- */
-define('COMMENT_CONTROLS_ABOVE', 0);
-define('COMMENT_CONTROLS_BELOW', 1);
-define('COMMENT_CONTROLS_ABOVE_BELOW', 2);
-define('COMMENT_CONTROLS_HIDDEN', 3);
-
-/**
- * Constants to define the anonymous poster contact handling
- */
-define('COMMENT_ANONYMOUS_MAYNOT_CONTACT', 0);
-define('COMMENT_ANONYMOUS_MAY_CONTACT', 1);
-define('COMMENT_ANONYMOUS_MUST_CONTACT', 2);
-
-/**
- * Constants to define the comment form location
- */
-define('COMMENT_FORM_SEPARATE_PAGE', 0);
-define('COMMENT_FORM_BELOW', 1);
-
-/**
- * Constants to define a node's comment state
- */
-define('COMMENT_NODE_DISABLED', 0);
-define('COMMENT_NODE_READ_ONLY', 1);
-define('COMMENT_NODE_READ_WRITE', 2);
-
-/**
- * Constants to define if comment preview is optional or required
- */
-define('COMMENT_PREVIEW_OPTIONAL', 0);
-define('COMMENT_PREVIEW_REQUIRED', 1);
-
-/**
- * Implementation of hook_help().
- */
-function comment_help($section) {
-  switch ($section) {
-    case 'admin/help#comment':
-      $output = '<p>'. t('The comment module creates a discussion board for each post. Users can post comments to discuss a forum topic, weblog post, story, collaborative book page, etc. The ability to comment is an important part of involving members in a community dialogue.') .'</p>';
-      $output .= '<p>'. t('An administrator can give comment permissions to user groups, and users can (optionally) edit their last comment, assuming no others have been posted since.  Attached to each comment board is a control panel for customizing the way that comments are displayed. Users can control the chronological ordering of posts (newest or oldest first) and the number of posts to display on each page.  Comments behave like other user submissions. Filters, smileys and HTML that work in nodes will also work with comments. The comment module provides specific features to inform site members when new comments have been posted.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>control access for various comment module functions through access permissions <a href="%admin-access">administer &gt;&gt; access control</a>.</li>
-<li>administer comments <a href="%admin-comment-configure"> administer &gt;&gt; comments &gt;&gt; configure</a>.</li>
-</ul>
-', array('%admin-access' => url('admin/access'), '%admin-comment-configure' => url('admin/comment/configure')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%comment">Comment page</a>.', array('%comment' => 'http://drupal.org/handbook/modules/comment/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Allows users to comment on and discuss published content.');
-    case 'admin/comment':
-    case 'admin/comment/new':
-      return t("<p>Below is a list of the latest comments posted to your site. Click on a subject to see the comment, the author's name to edit the author's user information , \"edit\" to modify the text, and \"delete\" to remove their submission.</p>");
-    case 'admin/comment/approval':
-      return t("<p>Below is a list of the comments posted to your site that need approval. To approve a comment, click on \"edit\" and then change its \"moderation status\" to Approved. Click on a subject to see the comment, the author's name to edit the author's user information, \"edit\" to modify the text, and \"delete\" to remove their submission.</p>");
-    case 'admin/comment/configure':
-    case 'admin/comment/configure/settings':
-      return t("<p>Comments can be attached to any node, and their settings are below. The display comes in two types: a \"flat list\" where everything is flush to the left side, and comments come in chronological order, and a \"threaded list\" where replies to other comments are placed immediately below and slightly indented, forming an outline. They also come in two styles: \"expanded\", where you see both the title and the contents, and \"collapsed\" where you only see the title. Preview comment forces a user to look at their comment by clicking on a \"Preview\" button before they can actually add the comment.</p>");
-   }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function comment_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $access = user_access('administer comments');
-    $items[] = array('path' => 'admin/comment', 'title' => t('comments'),
-      'callback' => 'comment_admin_overview', 'access' => $access);
-
-    // Tabs:
-    $items[] = array('path' => 'admin/comment/list', 'title' => t('list'),
-      'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-    $items[] = array('path' => 'admin/comment/configure', 'title' => t('configure'),
-      'callback' => 'comment_configure', 'access' => $access, 'type' => MENU_LOCAL_TASK);
-
-    // Subtabs:
-    $items[] = array('path' => 'admin/comment/list/new', 'title' => t('published comments'),
-      'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-    $items[] = array('path' => 'admin/comment/list/approval', 'title' => t('approval queue'),
-      'callback' => 'comment_admin_overview', 'access' => $access,
-      'callback arguments' => array('approval'),
-      'type' => MENU_LOCAL_TASK);
-
-    $items[] = array('path' => 'admin/comment/configure/settings', 'title' => t('settings'),
-      'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-
-    $items[] = array('path' => 'comment/delete', 'title' => t('delete comment'),
-      'callback' => 'comment_delete', 'access' => $access, 'type' => MENU_CALLBACK);
-
-    $access = user_access('post comments');
-    $items[] = array('path' => 'comment/edit', 'title' => t('edit comment'),
-      'callback' => 'comment_edit', 'access' => $access, 'type' => MENU_CALLBACK);
-  }
-  else {
-    if (arg(0) == 'comment' && arg(1) == 'reply' && is_numeric(arg(2))) {
-      $node = node_load(arg(2));
-      if ($node->nid) {
-        $items[] = array('path' => 'comment/reply', 'title' => t('reply to comment'),
-          'callback' => 'comment_reply', 'access' => node_access('view', $node), 'type' => MENU_CALLBACK);
-      }
-    }
-    if ((arg(0) == 'node') && is_numeric(arg(1)) && is_numeric(arg(2))) {
-      $items[] = array('path' => ('node/'. arg(1) .'/'. arg(2)), 'title' => t('view'),
-        'callback' => 'node_page',
-        'type' => MENU_CALLBACK);
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_perm().
- */
-function comment_perm() {
-  return array('access comments', 'post comments', 'administer comments', 'post comments without approval');
-}
-
-/**
- * Implementation of hook_block().
- *
- * Generates a block with the most recent comments.
- */
-function comment_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $blocks[0]['info'] = t('Recent comments');
-    return $blocks;
-  }
-  else if ($op == 'view' && user_access('access comments')) {
-    $block['subject'] = t('Recent comments');
-    $block['content'] = theme('comment_block');
-    return $block;
-  }
-}
-
-function theme_comment_block() {
-  $result = db_query_range(db_rewrite_sql('SELECT c.nid, c.subject, c.cid, c.timestamp FROM {comments} c INNER JOIN {node} n ON n.nid = c.nid WHERE n.status = 1 AND c.status = %d ORDER BY c.timestamp DESC', 'c'), COMMENT_PUBLISHED, 0, 10);
-  $items = array();
-  while ($comment = db_fetch_object($result)) {
-    $items[] = l($comment->subject, 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid) .'<br />'. t('%time ago', array('%time' => format_interval(time() - $comment->timestamp)));
-  }
-  return theme('item_list', $items);
-}
-
-/**
- * Implementation of hook_link().
- */
-function comment_link($type, $node = 0, $main = 0) {
-  $links = array();
-
-  if ($type == 'node' && $node->comment) {
-
-    if ($main) {
-      // Main page: display the number of comments that have been posted.
-
-      if (user_access('access comments')) {
-        $all = comment_num_all($node->nid);
-        $new = comment_num_new($node->nid);
-
-        if ($all) {
-          $links[] = l(format_plural($all, '1 comment', '%count comments'), "node/$node->nid", array('title' => t('Jump to the first comment of this posting.')), NULL, 'comment');
-
-          if ($new) {
-            $links[] = l(format_plural($new, '1 new comment', '%count new comments'), "node/$node->nid", array('title' => t('Jump to the first new comment of this posting.')), NULL, 'new');
-          }
-        }
-        else {
-          if ($node->comment == COMMENT_NODE_READ_WRITE) {
-            if (user_access('post comments')) {
-              $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Add a new comment to this page.')), NULL, 'comment_form');
-            }
-            else {
-              $links[] = theme('comment_post_forbidden', $node->nid);
-            }
-          }
-        }
-      }
-    }
-    else {
-      // Node page: add a "post comment" link if the user is allowed to
-      // post comments, if this node is not read-only, and if the comment form isn't already shown
-
-      if ($node->comment == COMMENT_NODE_READ_WRITE) {
-        if (user_access('post comments')) {
-          if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
-            $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Share your thoughts and opinions related to this posting.')), NULL, 'comment_form');
-          }
-        }
-        else {
-          $links[] = theme('comment_post_forbidden', $node->nid);
-        }
-      }
-    }
-  }
-
-  if ($type == 'comment') {
-    $links = comment_links($node, $main);
-  }
-
-  return $links;
-}
-
-function comment_form_alter($form_id, &$form) {
-  if (isset($form['type'])) {
-    if ($form['type']['#value'] .'_node_settings' == $form_id) {
-      $form['workflow']['comment_'. $form['type']['#value']] = array('#type' => 'radios', '#title' => t('Default comment setting'), '#default_value' => variable_get('comment_'. $form['type']['#value'], COMMENT_NODE_READ_WRITE), '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')), '#description' => t('Users with the <em>administer comments</em> permission will be able to override this setting.'));
-    }
-    if ($form['type']['#value'] .'_node_form' == $form_id) {
-      $node = $form['#node'];
-      if (user_access('administer comments')) {
-        $form['comment_settings'] = array(
-          '#type' => 'fieldset',
-          '#title' => t('Comment settings'),
-          '#collapsible' => TRUE,
-          '#collapsed' => TRUE,
-          '#weight' => 30,
-        );
-        $form['comment_settings']['comment'] = array(
-          '#type' => 'radios',
-          '#parents' => array('comment'),
-          '#default_value' => $node->comment,
-          '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')),
-        );
-      }
-      else {
-        $form['comment_settings']['comment'] = array(
-          '#type' => 'value',
-          '#value' => $node->comment,
-        );
-      }
-    }
-  }
-}
-
-/**
- * Implementation of hook_nodeapi().
- *
- */
-function comment_nodeapi(&$node, $op, $arg = 0) {
-  switch ($op) {
-    case 'load':
-      return db_fetch_array(db_query("SELECT last_comment_timestamp, last_comment_name, comment_count FROM {node_comment_statistics} WHERE nid = %d", $node->nid));
-      break;
-
-    case 'prepare':
-      if (!isset($node->comment)) {
-        $node->comment = variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE);
-      }
-      break;
-
-    case 'insert':
-      db_query('INSERT INTO {node_comment_statistics} (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (%d, %d, NULL, %d, 0)', $node->nid, $node->created, $node->uid);
-      break;
-
-    case 'delete':
-      db_query('DELETE FROM {comments} WHERE nid = %d', $node->nid);
-      db_query('DELETE FROM {node_comment_statistics} WHERE nid = %d', $node->nid);
-      break;
-
-    case 'update index':
-      $text = '';
-      $comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = %d', $node->nid, COMMENT_PUBLISHED);
-      while ($comment = db_fetch_object($comments)) {
-        $text .= '<h2>'. check_plain($comment->subject) .'</h2>'. check_markup($comment->comment, $comment->format, FALSE);
-      }
-      return $text;
-
-    case 'search result':
-      $comments = db_result(db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = %d', $node->nid));
-      return format_plural($comments, '1 comment', '%count comments');
-
-    case 'rss item':
-      return array(array('key' => 'comments', 'value' => url('node/'. $node->nid, NULL, 'comment', TRUE)));
-  }
-}
-
-/**
- * Implementation of hook_user().
- *
- * Provides signature customization for the user's comments.
- */
-function comment_user($type, $edit, &$user, $category = NULL) {
-  if ($type == 'form' && $category == 'account') {
-    // when user tries to edit his own data
-    $form['comment_settings'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Comment settings'),
-      '#collapsible' => TRUE,
-      '#weight' => 4);
-    $form['comment_settings']['signature'] = array(
-      '#type' => 'textarea',
-      '#title' => t('Signature'),
-      '#default_value' => $edit['signature'],
-      '#description' => t('Your signature will be publicly displayed at the end of your comments.'));
-
-    return $form;
-  }
-  elseif ($type == 'delete') {
-    db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $user->uid);
-    db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $user->uid);
-  }
-}
-
-/**
- * Menu callback; presents the comment settings page.
- */
-function comment_configure() {
-  $form['viewing_options'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Viewing options'),
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-  );
-
-  $form['viewing_options']['comment_default_mode'] = array(
-    '#type' => 'radios',
-    '#title' => t('Default display mode'),
-    '#default_value' => variable_get('comment_default_mode', COMMENT_MODE_THREADED_EXPANDED),
-    '#options' => _comment_get_modes(),
-    '#description' => t('The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.'),
-  );
-
-  $form['viewing_options']['comment_default_order'] = array(
-    '#type' => 'radios',
-    '#title' => t('Default display order'),
-    '#default_value' => variable_get('comment_default_order', COMMENT_ORDER_NEWEST_FIRST),
-    '#options' => _comment_get_orders(),
-    '#description' => t('The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.'),
-  );
-
-  $form['viewing_options']['comment_default_per_page'] = array(
-    '#type' => 'select',
-    '#title' => t('Default comments per page'),
-    '#default_value' => variable_get('comment_default_per_page', 50),
-    '#options' => _comment_per_page(),
-    '#description' => t('Default number of comments for each page: more comments are distributed in several pages.'),
-  );
-
-  $form['viewing_options']['comment_controls'] = array(
-    '#type' => 'radios',
-    '#title' => t('Comment controls'),
-    '#default_value' => variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN),
-    '#options' => array(
-      t('Display above the comments'),
-      t('Display below the comments'),
-      t('Display above and below the comments'),
-      t('Do not display')),
-    '#description' => t('Position of the comment controls box.  The comment controls let the user change the default display mode and display order of comments.'),
-  );
-
-  $form['posting_settings'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Posting settings'),
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-  );
-
-  $form['posting_settings']['comment_anonymous'] = array(
-    '#type' => 'radios',
-    '#title' => t('Anonymous commenting'),
-    '#default_value' => variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT),
-    '#options' => array(
-      COMMENT_ANONYMOUS_MAYNOT_CONTACT => t('Anonymous posters may not enter their contact information'),
-      COMMENT_ANONYMOUS_MAY_CONTACT => t('Anonymous posters may leave their contact information'),
-      COMMENT_ANONYMOUS_MUST_CONTACT => t('Anonymous posters must leave their contact information')),
-    '#description' => t('This option is enabled when anonymous users have permission to post comments on the <a href="%url">permissions page</a>.', array('%url' => url('admin/access'))),
-  );
-  if (!user_access('post comments', user_load(array('uid' => 0)))) {
-    $form['posting_settings']['comment_anonymous']['#attributes'] = array('disabled' => 'disabled');
-  }
-
-  $form['posting_settings']['comment_subject_field'] = array(
-    '#type' => 'radios',
-    '#title' => t('Comment subject field'),
-    '#default_value' => variable_get('comment_subject_field', 1),
-    '#options' => array(t('Disabled'), t('Enabled')),
-    '#description' => t('Can users provide a unique subject for their comments?'),
-  );
-
-  $form['posting_settings']['comment_preview'] = array(
-    '#type' => 'radios',
-    '#title' => t('Preview comment'),
-    '#default_value' => variable_get('comment_preview', COMMENT_PREVIEW_REQUIRED),
-    '#options' => array(t('Optional'), t('Required')),
-  );
-
-  $form['posting_settings']['comment_form_location'] = array(
-    '#type' => 'radios',
-    '#title' => t('Location of comment submission form'),
-    '#default_value' => variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE),
-    '#options' => array(t('Display on separate page'), t('Display below post or comments')),
-  );
-
-  return system_settings_form('comment_settings_form', $form);
-}
-
-/**
- * This is *not* a hook_access() implementation. This function is called
- * to determine whether the current user has access to a particular comment.
- *
- * Authenticated users can edit their comments as long they have not been
- * replied to. This prevents people from changing or revising their
- * statements based on the replies to their posts.
- */
-function comment_access($op, $comment) {
-  global $user;
-
-  if ($op == 'edit') {
-    return ($user->uid && $user->uid == $comment->uid && comment_num_replies($comment->cid) == 0) || user_access('administer comments');
-  }
-}
-
-function comment_node_url() {
-  return arg(0) .'/'. arg(1);
-}
-
-function comment_edit($cid) {
-  global $user;
-
-  $comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d', $cid));
-  $comment = drupal_unpack($comment);
-  $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-  if (comment_access('edit', $comment)) {
-    return comment_form((array)$comment);
-  }
-  else {
-    drupal_access_denied();
-  }
-}
-
-function comment_reply($nid, $pid = NULL) {
-  // set the breadcrumb trail
-  $node = node_load($nid);
-  menu_set_location(array(array('path' => "node/$nid", 'title' => $node->title), array('path' => "comment/reply/$nid")));
-
-  $op = isset($_POST['op']) ? $_POST['op'] : '';
-
-  $output = '';
-
-  // or are we merely showing the form?
-  if (user_access('access comments')) {
-
-    if ($op == t('Preview comment')) {
-      if (user_access('post comments')) {
-        $output .= comment_form(array('pid' => $pid, 'nid' => $nid), NULL);
-      }
-      else {
-        drupal_set_message(t('You are not authorized to post comments.'), 'error');
-        drupal_goto("node/$nid");
-      }
-    }
-    else {
-      // if this is a reply to another comment, show that comment first
-      // else, we'll just show the user the node they're commenting on.
-      if ($pid) {
-        if ($comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = %d', $pid, COMMENT_PUBLISHED))) {
-          if ($comment->nid != $nid) {
-            // Attempting to reply to a comment not belonging to the current nid.
-            drupal_set_message(t('The comment you are replying to does not exist.'), 'error');
-            drupal_goto("node/$nid");
-          }
-          $comment = drupal_unpack($comment);
-          $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-          $output .= theme('comment_view', $comment);
-        }
-        else {
-          drupal_set_message(t('The comment you are replying to does not exist.'), 'error');
-          drupal_goto("node/$nid");
-        }
-      }
-      else if (user_access('access content')) {
-        $output .= node_view($node);
-      }
-
-      // should we show the reply box?
-      if (node_comment_mode($nid) != COMMENT_NODE_READ_WRITE) {
-        drupal_set_message(t("This discussion is closed: you can't post new comments."), 'error');
-        drupal_goto("node/$nid");
-      }
-      else if (user_access('post comments')) {
-        $output .= comment_form(array('pid' => $pid, 'nid' => $nid), t('Reply'));
-      }
-      else {
-        drupal_set_message(t('You are not authorized to post comments.'), 'error');
-        drupal_goto("node/$nid");
-      }
-    }
-  }
-  else {
-    drupal_set_message(t('You are not authorized to view comments.'), 'error');
-    drupal_goto("node/$nid");
-  }
-
-  return $output;
-}
-
-/**
- * Accepts a submission of new or changed comment content.
- *
- * @param $edit
- *   A comment array.
- *
- * @return
- *   If the comment is successfully saved the comment ID is returned.  If the comment
- *   is not saved, FALSE is returned.
- */
-function comment_save($edit) {
-  global $user;
-  if (user_access('post comments') && (user_access('administer comments') || node_comment_mode($edit['nid']) == COMMENT_NODE_READ_WRITE)) {
-    if (!form_get_errors()) {
-      // Check for duplicate comments.  Note that we have to use the
-      // validated/filtered data to perform such check.
-      $duplicate = db_result(db_query("SELECT COUNT(cid) FROM {comments} WHERE pid = %d AND nid = %d AND subject = '%s' AND comment = '%s'", $edit['pid'], $edit['nid'], $edit['subject'], $edit['comment']), 0);
-      if ($duplicate != 0) {
-        watchdog('content', t('Comment: duplicate %subject.', array('%subject' => theme('placeholder', $edit['subject']))), WATCHDOG_WARNING);
-      }
-
-      if ($edit['cid']) {
-        // Update the comment in the database.
-        db_query("UPDATE {comments} SET status = %d, timestamp = %d, subject = '%s', comment = '%s', format = %d, uid = %d, name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d", $edit['status'], $edit['timestamp'], $edit['subject'], $edit['comment'], $edit['format'], $edit['uid'], $edit['name'], $edit['mail'], $edit['homepage'], $edit['cid']);
-
-        _comment_update_node_statistics($edit['nid']);
-
-        // Allow modules to respond to the updating of a comment.
-        comment_invoke_comment($edit, 'update');
-
-
-        // Add an entry to the watchdog log.
-        watchdog('content', t('Comment: updated %subject.', array('%subject' => theme('placeholder', $edit['subject']))), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
-      }
-      else {
-        // Add the comment to database.
-        $status = user_access('post comments without approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED;
-        $roles = variable_get('comment_roles', array());
-        $score = 0;
-
-        foreach (array_intersect(array_keys($roles), array_keys($user->roles)) as $rid) {
-          $score = max($roles[$rid], $score);
-        }
-
-        $users = serialize(array(0 => $score));
-
-        // Here we are building the thread field.  See the comment
-        // in comment_render().
-        if ($edit['pid'] == 0) {
-          // This is a comment with no parent comment (depth 0): we start
-          // by retrieving the maximum thread level.
-          $max = db_result(db_query('SELECT MAX(thread) FROM {comments} WHERE nid = %d', $edit['nid']));
-
-          // Strip the "/" from the end of the thread.
-          $max = rtrim($max, '/');
-
-          // Finally, build the thread field for this new comment.
-          $thread = int2vancode(vancode2int($max) + 1) .'/';
-        }
-        else {
-          // This is comment with a parent comment: we increase
-          // the part of the thread value at the proper depth.
-
-          // Get the parent comment:
-          $parent = _comment_load($edit['pid']);
-
-          // Strip the "/" from the end of the parent thread.
-          $parent->thread = (string) rtrim((string) $parent->thread, '/');
-
-          // Get the max value in _this_ thread.
-          $max = db_result(db_query("SELECT MAX(thread) FROM {comments} WHERE thread LIKE '%s.%%' AND nid = %d", $parent->thread, $edit['nid']));
-
-          if ($max == '') {
-            // First child of this parent.
-            $thread = $parent->thread .'.'. int2vancode(0) .'/';
-          }
-          else {
-            // Strip the "/" at the end of the thread.
-            $max = rtrim($max, '/');
-
-            // We need to get the value at the correct depth.
-            $parts = explode('.', $max);
-            $parent_depth = count(explode('.', $parent->thread));
-            $last = $parts[$parent_depth];
-
-            // Finally, build the thread field for this new comment.
-            $thread = $parent->thread .'.'. int2vancode(vancode2int($last) + 1) .'/';
-          }
-        }
-
-        $edit['cid'] = db_next_id('{comments}_cid');
-        $edit['timestamp'] = time();
-
-        if ($edit['uid'] == $user->uid) {
-          $edit['name'] = $user->name;
-        }
-
-        db_query("INSERT INTO {comments} (cid, nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage) VALUES (%d, %d, %d, %d, '%s', '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s')", $edit['cid'], $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], $_SERVER['REMOTE_ADDR'], $edit['timestamp'], $status, $score, $users, $thread, $edit['name'], $edit['mail'], $edit['homepage']);
-
-        _comment_update_node_statistics($edit['nid']);
-
-        // Tell the other modules a new comment has been submitted.
-        comment_invoke_comment($edit, 'insert');
-
-        // Add an entry to the watchdog log.
-        watchdog('content', t('Comment: added %subject.', array('%subject' => theme('placeholder', $edit['subject']))), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
-      }
-
-      // Clear the cache so an anonymous user can see his comment being added.
-      cache_clear_all();
-
-      // Explain the approval queue if necessary, and then
-      // redirect the user to the node he's commenting on.
-      if ($status == COMMENT_NOT_PUBLISHED) {
-        drupal_set_message(t('Your comment has been queued for moderation by site administrators and will be published after approval.'));
-      }
-      return $edit['cid'];
-    }
-    else {
-      return FALSE;
-    }
-  }
-  else {
-    $txt = t('Comment: unauthorized comment submitted or comment submitted to a closed node %subject.', array('%subject' => theme('placeholder', $edit['subject'])));
-    watchdog('content', $txt, WATCHDOG_WARNING);
-    drupal_set_message($txt, 'error');
-    return FALSE;
-  }
-}
-
-function comment_links($comment, $return = 1) {
-  global $user;
-
-  $links = array();
-
-  // If we are viewing just this comment, we link back to the node.
-  if ($return) {
-    $links[] = l(t('parent'), comment_node_url(), NULL, NULL, "comment-$comment->cid");
-  }
-
-  if (node_comment_mode($comment->nid) == COMMENT_NODE_READ_WRITE) {
-    if (user_access('administer comments') && user_access('post comments')) {
-      $links[] = l(t('delete'), "comment/delete/$comment->cid");
-      $links[] = l(t('edit'), "comment/edit/$comment->cid");
-      $links[] = l(t('reply'), "comment/reply/$comment->nid/$comment->cid");
-    }
-    else if (user_access('post comments')) {
-      if (comment_access('edit', $comment)) {
-        $links[] = l(t('edit'), "comment/edit/$comment->cid");
-      }
-      $links[] = l(t('reply'), "comment/reply/$comment->nid/$comment->cid");
-    }
-    else {
-      $links[] = theme('comment_post_forbidden', $comment->nid);
-    }
-  }
-
-  return $links;
-}
-
-function comment_render($node, $cid = 0) {
-  global $user;
-
-  $output = '';
-
-  if (user_access('access comments')) {
-    // Pre-process variables.
-    $nid = $node->nid;
-    if (empty($nid)) {
-      $nid = 0;
-    }
-
-    $mode = _comment_get_display_setting('mode');
-    $order = _comment_get_display_setting('sort');
-    $comments_per_page = _comment_get_display_setting('comments_per_page');
-
-    $output .= "<a id=\"comment\"></a>\n";
-
-    if ($cid) {
-      // Single comment view.
-      $query = 'SELECT c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.picture, u.data, c.score, c.users, c.status FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d';
-      $query_args = array($cid);
-      if (!user_access('administer comments')) {
-        $query .= ' AND c.status = %d';
-        $query_args[] = COMMENT_PUBLISHED;
-      }
-      $query .= ' GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.status';
-      $result = db_query($query, $query_args);
-
-      if ($comment = db_fetch_object($result)) {
-        $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-        $output .= theme('comment_view', $comment, module_invoke_all('link', 'comment', $comment, 1));
-      }
-    }
-    else {
-      // Multiple comment view
-      $query_count = 'SELECT COUNT(*) FROM {comments} WHERE nid = %d';
-      $query = 'SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.picture, u.data, c.score, c.users, c.thread, c.status FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d';
-
-      $query_args = array($nid);
-      if (!user_access('administer comments')) {
-        $query .= ' AND c.status = %d';
-        $query_count .= ' AND status = %d';
-        $query_args[] = COMMENT_PUBLISHED;
-      }
-
-      $query .= ' GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.thread, c.status';
-
-      /*
-      ** We want to use the standard pager, but threads would need every
-      ** comment to build the thread structure, so we need to store some
-      ** extra info.
-      **
-      ** We use a "thread" field to store this extra info. The basic idea
-      ** is to store a value and to order by that value. The "thread" field
-      ** keeps this data in a way which is easy to update and convenient
-      ** to use.
-      **
-      ** A "thread" value starts at "1". If we add a child (A) to this
-      ** comment, we assign it a "thread" = "1.1". A child of (A) will have
-      ** "1.1.1". Next brother of (A) will get "1.2". Next brother of the
-      ** parent of (A) will get "2" and so on.
-      **
-      ** First of all note that the thread field stores the depth of the
-      ** comment: depth 0 will be "X", depth 1 "X.X", depth 2 "X.X.X", etc.
-      **
-      ** Now to get the ordering right, consider this example:
-      **
-      ** 1
-      ** 1.1
-      ** 1.1.1
-      ** 1.2
-      ** 2
-      **
-      ** If we "ORDER BY thread ASC" we get the above result, and this is
-      ** the natural order sorted by time.  However, if we "ORDER BY thread
-      ** DESC" we get:
-      **
-      ** 2
-      ** 1.2
-      ** 1.1.1
-      ** 1.1
-      ** 1
-      **
-      ** Clearly, this is not a natural way to see a thread, and users
-      ** will get confused. The natural order to show a thread by time
-      ** desc would be:
-      **
-      ** 2
-      ** 1
-      ** 1.2
-      ** 1.1
-      ** 1.1.1
-      **
-      ** which is what we already did before the standard pager patch. To
-      ** achieve this we simply add a "/" at the end of each "thread" value.
-      ** This way out thread fields will look like depicted below:
-      **
-      ** 1/
-      ** 1.1/
-      ** 1.1.1/
-      ** 1.2/
-      ** 2/
-      **
-      ** we add "/" since this char is, in ASCII, higher than every number,
-      ** so if now we "ORDER BY thread DESC" we get the correct order.  Try
-      ** it, it works ;).  However this would spoil the "ORDER BY thread ASC"
-      ** Here, we do not need to consider the trailing "/" so we use a
-      ** substring only.
-      */
-
-      if ($order == COMMENT_ORDER_NEWEST_FIRST) {
-        if ($mode == COMMENT_MODE_FLAT_COLLAPSED || $mode == COMMENT_MODE_FLAT_EXPANDED) {
-          $query .= ' ORDER BY c.timestamp DESC';
-        }
-        else {
-          $query .= ' ORDER BY c.thread DESC';
-        }
-      }
-      else if ($order == COMMENT_ORDER_OLDEST_FIRST) {
-        if ($mode == COMMENT_MODE_FLAT_COLLAPSED || $mode == COMMENT_MODE_FLAT_EXPANDED) {
-          $query .= ' ORDER BY c.timestamp';
-        }
-        else {
-
-          /*
-          ** See comment above.  Analysis learns that this doesn't cost
-          ** too much.  It scales much much better than having the whole
-          ** comment structure.
-          */
-
-          $query .= ' ORDER BY SUBSTRING(c.thread, 1, (LENGTH(c.thread) - 1))';
-        }
-      }
-
-      // Start a form, for use with comment control.
-      $result = pager_query($query, $comments_per_page, 0, $query_count, $query_args);
-      if (db_num_rows($result) && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) {
-        $output .= comment_controls($mode, $order, $comments_per_page);
-      }
-
-      while ($comment = db_fetch_object($result)) {
-        $comment = drupal_unpack($comment);
-        $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-        $comment->depth = count(explode('.', $comment->thread)) - 1;
-
-        if ($mode == COMMENT_MODE_FLAT_COLLAPSED) {
-          $output .= theme('comment_flat_collapsed', $comment);
-        }
-        else if ($mode == COMMENT_MODE_FLAT_EXPANDED) {
-          $output .= theme('comment_flat_expanded', $comment);
-        }
-        else if ($mode == COMMENT_MODE_THREADED_COLLAPSED) {
-          $output .= theme('comment_thread_collapsed', $comment);
-        }
-        else if ($mode == COMMENT_MODE_THREADED_EXPANDED) {
-          $output .= theme('comment_thread_expanded', $comment);
-        }
-      }
-
-      $output .= theme('pager', NULL, $comments_per_page, 0);
-
-      if (db_num_rows($result) && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_BELOW || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) {
-        $output .= comment_controls($mode, $order, $comments_per_page);
-      }
-    }
-
-    // If enabled, show new comment form.
-    if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW)) {
-      $output .= comment_form(array('nid' => $nid), t('Post new comment'));
-    }
-  }
-  return $output;
-}
-
-
-/**
- * Menu callback; delete a comment.
- */
-function comment_delete($cid) {
-  $comment = db_fetch_object(db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.cid = %d', $cid));
-  $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-
-  $output = '';
-
-  // We'll only delete if the user has confirmed the
-  // deletion using the form in our else clause below.
-  if (is_object($comment) && is_numeric($comment->cid) && $_POST['edit']['confirm']) {
-    drupal_set_message(t('The comment and all its replies have been deleted.'));
-
-    // Delete comment and its replies.
-    _comment_delete_thread($comment);
-
-    _comment_update_node_statistics($comment->nid);
-
-    // Clear the cache so an anonymous user sees that his comment was deleted.
-    cache_clear_all();
-
-    drupal_goto("node/$comment->nid");
-  }
-  else if (is_object($comment) && is_numeric($comment->cid)) {
-    $output = confirm_form('comment_confirm_delete',
-                    array(),
-                    t('Are you sure you want to delete the comment %title?', array('%title' => theme('placeholder', $comment->subject))),
-                    'node/'. $comment->nid,
-                    t('Any replies to this comment will be lost. This action cannot be undone.'),
-                    t('Delete'),
-                    t('Cancel'));
-  }
-  else {
-    drupal_set_message(t('The comment no longer exists.'));
-  }
-
-  return $output;
-}
-
-/**
- * Comment operations.  We offer different update operations depending on
- * which comment administration page we're on.
- */
-function comment_operations($action = NULL) {
-  if ($action == 'publish') {
-    $operations = array(
-      'publish' => array(t('Publish the selected comments'), 'UPDATE {comments} SET status = '. COMMENT_PUBLISHED .' WHERE cid = %d'),
-      'delete' => array(t('Delete the selected comments'), '')
-    );
-  }
-  else if ($action == 'unpublish') {
-    $operations = array(
-      'unpublish' => array(t('Unpublish the selected comments'), 'UPDATE {comments} SET status = '. COMMENT_NOT_PUBLISHED .' WHERE cid = %d'),
-      'delete' => array(t('Delete the selected comments'), '')
-    );
-  }
-  else {
-    $operations = array(
-      'publish' => array(t('Publish the selected comments'), 'UPDATE {comments} SET status = '. COMMENT_PUBLISHED .' WHERE cid = %d'),
-      'unpublish' => array(t('Unpublish the selected comments'), 'UPDATE {comments} SET status = '. COMMENT_NOT_PUBLISHED .' WHERE cid = %d'),
-      'delete' => array(t('Delete the selected comments'), '')
-    );
-  }
-  return $operations;
-}
-
-/**
- * Menu callback; present an administrative comment listing.
- */
-function comment_admin_overview($type = 'new') {
-  $edit = $_POST['edit'];
-
-  if ($edit['operation'] == 'delete') {
-    return comment_multiple_delete_confirm();
-  }
-
-  // build an 'Update options' form
-  $form['options'] = array(
-    '#type' => 'fieldset', '#title' => t('Update options'),
-    '#prefix' => '<div class="container-inline">', '#suffix' => '</div>'
-  );
-  $options = array();
-  foreach (comment_operations(arg(3) == 'approval' ? 'publish' : 'unpublish') as $key => $value) {
-    $options[$key] = $value[0];
-  }
-  $form['options']['operation'] = array('#type' => 'select', '#options' => $options, '#default_value' => 'publish');
-  $form['options']['submit'] = array('#type' => 'submit', '#value' => t('Update'));
-
-  // load the comments that we want to display
-  $status = ($type == 'approval') ? COMMENT_NOT_PUBLISHED : COMMENT_PUBLISHED;
-  $form['header'] = array('#type' => 'value', '#value' => array(
-    NULL,
-    array('data' => t('Subject'), 'field' => 'subject'),
-    array('data' => t('Author'), 'field' => 'name'),
-    array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc'),
-    array('data' => t('Operations'))
-  ));
-  $result = pager_query('SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.status = %d'. tablesort_sql($form['header']['#value']), 50, 0, NULL, $status);
-
-  // build a table listing the appropriate comments
-  $destination = drupal_get_destination();
-  while ($comment = db_fetch_object($result)) {
-    $comments[$comment->cid] = '';
-    $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-    $form['subject'][$comment->cid] = array('#value' => l($comment->subject, 'node/'. $comment->nid, array('title' => truncate_utf8($comment->comment, 128)), NULL, 'comment-'. $comment->cid));
-    $form['username'][$comment->cid] = array('#value' => theme('username', $comment));
-    $form['timestamp'][$comment->cid] = array('#value' => format_date($comment->timestamp, 'small'));
-    $form['operations'][$comment->cid] = array('#value' => l(t('edit'), 'comment/edit/'. $comment->cid, array(), $destination));
-  }
-  $form['comments'] = array('#type' => 'checkboxes', '#options' => $comments);
-  $form['pager'] = array('#value' => theme('pager', NULL, 50, 0));
-  return drupal_get_form('comment_admin_overview', $form);
-}
-
-/**
- * We can't execute any 'Update options' if no comments were selected.
- */
-function comment_admin_overview_validate($form_id, $edit) {
-  $edit['comments'] = array_diff($edit['comments'], array(0));
-  if (count($edit['comments']) == 0) {
-    form_set_error('', t('Please select one or more comments to perform the update on.'));
-    drupal_goto('admin/comment');
-  }
-}
-
-/**
- * Execute the chosen 'Update option' on the selected comments, such as
- * publishing, unpublishing or deleting.
- */
-function comment_admin_overview_submit($form_id, $edit) {
-  $operations = comment_operations();
-  if ($operations[$edit['operation']][1]) {
-    // extract the appropriate database query operation
-    $query = $operations[$edit['operation']][1];
-    foreach ($edit['comments'] as $cid => $value) {
-      if ($value) {
-        // perform the update action, then refresh node statistics
-        db_query($query, $cid);
-        $comment = _comment_load($cid);
-        _comment_update_node_statistics($comment->nid);
-        // Allow modules to respond to the updating of a comment.
-        comment_invoke_comment($comment, $edit['operation']);
-        // Add an entry to the watchdog log.
-        watchdog('content', t('Comment: updated %subject.', array('%subject' => theme('placeholder', $comment->subject))), WATCHDOG_NOTICE, l(t('view'), 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid));
-      }
-    }
-    cache_clear_all();
-    drupal_set_message(t('The update has been performed.'));
-    drupal_goto('admin/comment');
-  }
-}
-
-function theme_comment_admin_overview($form) {
-  $output = form_render($form['options']);
-  if (isset($form['subject']) && is_array($form['subject'])) {
-    foreach (element_children($form['subject']) as $key) {
-      $row = array();
-      $row[] = form_render($form['comments'][$key]);
-      $row[] = form_render($form['subject'][$key]);
-      $row[] = form_render($form['username'][$key]);
-      $row[] = form_render($form['timestamp'][$key]);
-      $row[] = form_render($form['operations'][$key]);
-      $rows[] = $row;
-    }
-  }
-  else {
-    $rows[] = array(array('data' => t('No comments available.'), 'colspan' => '6'));
-  }
-
-  $output .= theme('table', $form['header']['#value'], $rows);
-  if ($form['pager']['#value']) {
-    $output .= form_render($form['pager']);
-  }
-
-  $output .= form_render($form);
-
-  return $output;
-}
-
-/**
- * List the selected comments and verify that the admin really wants to delete
- * them.
- */
-function comment_multiple_delete_confirm() {
-  $edit = $_POST['edit'];
-
-  $form['comments'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
-  // array_filter() returns only elements with actual values
-  $comment_counter = 0;
-  foreach (array_filter($edit['comments']) as $cid => $value) {
-    $comment = _comment_load($cid);
-    if (is_object($comment) && is_numeric($comment->cid)) {
-      $subject = db_result(db_query('SELECT subject FROM {comments} WHERE cid = %d', $cid));
-      $form['comments'][$cid] = array('#type' => 'hidden', '#value' => $cid, '#prefix' => '<li>', '#suffix' => check_plain($subject) .'</li>');
-      $comment_counter++;
-    }
-  }
-  $form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
-
-  if (!$comment_counter) {
-    drupal_set_message(t('There do not appear to be any comments to delete or your selected comment was deleted by another administrator.'));
-    drupal_goto('admin/comment');
-  }
-  else {
-    return confirm_form('comment_multiple_delete_confirm', $form,
-                        t('Are you sure you want to delete these comments and all their children?'),
-                        'admin/comment', t('This action cannot be undone.'),
-                        t('Delete comments'), t('Cancel'));
-  }
-}
-
-/**
- * Perform the actual comment deletion.
- */
-function comment_multiple_delete_confirm_submit($form_id, $edit) {
-  if ($edit['confirm']) {
-    foreach ($edit['comments'] as $cid => $value) {
-      $comment = _comment_load($cid);
-      _comment_delete_thread($comment);
-      _comment_update_node_statistics($comment->nid);
-      cache_clear_all();
-    }
-    drupal_set_message(t('The comments have been deleted.'));
-  }
-  drupal_goto('admin/comment');
-}
-
-/**
-*** misc functions: helpers, privates, history
-**/
-
-/**
- * Load the entire comment by cid.
- */
-function _comment_load($cid) {
-  return db_fetch_object(db_query('SELECT * FROM {comments} WHERE cid = %d', $cid));
-}
-
-function comment_num_all($nid) {
-  static $cache;
-
-  if (!isset($cache[$nid])) {
-    $cache[$nid] = db_result(db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = %d', $nid));
-  }
-  return $cache[$nid];
-}
-
-function comment_num_replies($pid) {
-  static $cache;
-
-  if (!isset($cache[$pid])) {
-    $cache[$pid] = db_result(db_query('SELECT COUNT(cid) FROM {comments} WHERE pid = %d AND status = %d', $pid, COMMENT_PUBLISHED));
-  }
-
-  return $cache[$pid];
-}
-
-/**
- * get number of new comments for current user and specified node
- *
- * @param $nid node-id to count comments for
- * @param $timestamp time to count from (defaults to time of last user access
- *   to node)
- */
-function comment_num_new($nid, $timestamp = 0) {
-  global $user;
-
-  if ($user->uid) {
-    // Retrieve the timestamp at which the current user last viewed the
-    // specified node.
-    if (!$timestamp) {
-      $timestamp = node_last_viewed($nid);
-    }
-    $timestamp = ($timestamp > NODE_NEW_LIMIT ? $timestamp : NODE_NEW_LIMIT);
-
-    // Use the timestamp to retrieve the number of new comments.
-    $result = db_result(db_query('SELECT COUNT(c.cid) FROM {node} n INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = %d AND timestamp > %d AND c.status = %d', $nid, $timestamp, COMMENT_PUBLISHED));
-
-    return $result;
-  }
-  else {
-    return 0;
-  }
-
-}
-
-function comment_validate($edit) {
-  global $user;
-
-  // Invoke other validation handlers
-  comment_invoke_comment($edit, 'validate');
-
-  if (isset($edit['date'])) {
-    // As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1.
-    if (strtotime($edit['date']) <= 0) {
-      form_set_error('date', t('You have to specify a valid date.'));
-    }
-  }
-  if (isset($edit['author']) && !$account = user_load(array('name' => $edit['author']))) {
-    form_set_error('author', t('You have to specify a valid author.'));
-  }
-
-  // Check validity of name, mail and homepage (if given)
-  if (!$user->uid || isset($edit['is_anonymous'])) {
-    if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) > COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
-      if ($edit['name']) {
-        $taken = db_result(db_query("SELECT COUNT(uid) FROM {users} WHERE LOWER(name) = '%s'", $edit['name']), 0);
-
-        if ($taken != 0) {
-          form_set_error('name', t('The name you used belongs to a registered user.'));
-        }
-
-      }
-      else if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
-        form_set_error('name', t('You have to leave your name.'));
-      }
-
-      if ($edit['mail']) {
-        if (!valid_email_address($edit['mail'])) {
-          form_set_error('mail', t('The e-mail address you specified is not valid.'));
-        }
-      }
-      else if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
-        form_set_error('mail', t('You have to leave an e-mail address.'));
-      }
-
-      if ($edit['homepage']) {
-        if (!valid_url($edit['homepage'], TRUE)) {
-          form_set_error('homepage', t('The URL of your homepage is not valid.  Remember that it must be fully qualified, i.e. of the form <code>http://example.com/directory</code>.'));
-        }
-      }
-    }
-  }
-
-  return $edit;
-}
-
-/*
-** Generate the basic commenting form, for appending to a node or display on a separate page.
-** This is rendered by theme_comment_form.
-*/
-
-function comment_form($edit, $title = NULL) {
-  global $user;
-
-  $op = isset($_POST['op']) ? $_POST['op'] : '';
-
-  if ($user->uid) {
-    if ($edit['cid'] && user_access('administer comments')) {
-      if ($edit['author']) {
-        $author = $edit['author'];
-      }
-      elseif ($edit['name']) {
-        $author = $edit['name'];
-      }
-      else {
-        $author = $edit['registered_name'];
-      }
-
-      if ($edit['status']) {
-        $status = $edit['status'];
-      }
-      else {
-        $status = 0;
-      }
-
-      if ($edit['date']) {
-        $date = $edit['date'];
-      }
-      else {
-        $date = format_date($edit['timestamp'], 'custom', 'Y-m-d H:i O');
-      }
-
-      $form['admin'] = array(
-        '#type' => 'fieldset',
-        '#title' => t('Administration'),
-        '#collapsible' => TRUE,
-        '#collapsed' => TRUE,
-        '#weight' => -2,
-      );
-
-      if ($edit['registered_name'] != '') {
-        // The comment is by a registered user
-        $form['admin']['author'] = array(
-          '#type' => 'textfield',
-          '#title' => t('Authored by'),
-          '#size' => 30,
-          '#maxlength' => 60,
-          '#autocomplete_path' => 'user/autocomplete',
-          '#default_value' => $author,
-          '#weight' => -1,
-        );
-      }
-      else {
-        // The comment is by an anonymous user
-        $form['is_anonymous'] = array(
-          '#type' => 'value',
-          '#value' => TRUE,
-        );
-        $form['admin']['name'] = array(
-          '#type' => 'textfield',
-          '#title' => t('Authored by'),
-          '#size' => 30,
-          '#maxlength' => 60,
-          '#default_value' => $author,
-          '#weight' => -1,
-        );
-        $form['admin']['mail'] = array(
-          '#type' => 'textfield',
-          '#title' => t('E-mail'),
-          '#maxlength' => 64,
-          '#size' => 30,
-          '#default_value' => $edit['mail'],
-          '#description' => t('The content of this field is kept private and will not be shown publicly.'),
-        );
-
-        $form['admin']['homepage'] = array(
-          '#type' => 'textfield',
-          '#title' => t('Homepage'),
-          '#maxlength' => 255,
-          '#size' => 30,
-          '#default_value' => $edit['homepage'],
-        );
-      }
-
-      $form['admin']['date'] = array('#type' => 'textfield', '#parents' => array('date'), '#title' => t('Authored on'), '#size' => 20, '#maxlength' => 25, '#default_value' => $date, '#weight' => -1);
-
-      $form['admin']['status'] = array('#type' => 'radios', '#parents' => array('status'), '#title' => t('Status'), '#default_value' =>  $status, '#options' => array(t('Published'), t('Not published')), '#weight' => -1);
-
-    }
-    else {
-      $form['_author'] = array('#type' => 'item', '#title' => t('Your name'), '#value' => theme('username', $user)
-      );
-      $form['author'] = array('#type' => 'value', '#value' => $user->name);
-    }
-  }
-  else if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MAY_CONTACT) {
-    $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous')
-    );
-
-    $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail'), '#maxlength' => 64, '#size' => 30, '#default_value' => $edit['mail'], '#description' => t('The content of this field is kept private and will not be shown publicly.')
-    );
-
-    $form['homepage'] = array('#type' => 'textfield', '#title' => t('Homepage'), '#maxlength' => 255, '#size' => 30, '#default_value' => $edit['homepage']);
-  }
-  else if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
-    $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous'), '#required' => TRUE);
-
-    $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail'), '#maxlength' => 64, '#size' => 30, '#default_value' => $edit['mail'],'#description' => t('The content of this field is kept private and will not be shown publicly.'), '#required' => TRUE);
-
-    $form['homepage'] = array('#type' => 'textfield', '#title' => t('Homepage'), '#maxlength' => 255, '#size' => 30, '#default_value' => $edit['homepage']);
-  }
-
-  if (variable_get('comment_subject_field', 1) == 1) {
-    $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#maxlength' => 64, '#default_value' => $edit['subject']);
-  }
-
-  $form['comment_filter']['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => $edit['comment'] ? $edit['comment'] : $user->signature, '#required' => TRUE);
-  $form['comment_filter']['format'] = filter_form($edit['format']);
-
-  $form['cid'] = array('#type' => 'value', '#value' => $edit['cid']);
-  $form['pid'] = array('#type' => 'value', '#value' => $edit['pid']);
-  $form['nid'] = array('#type' => 'value', '#value' => $edit['nid']);
-  $form['uid'] = array('#type' => 'value', '#value' => $edit['uid']);
-
-  $form['preview'] = array('#type' => 'button', '#value' => t('Preview comment'), '#weight' => 19);
-  $form['#token'] = 'comment' . $edit['nid'] . $edit['pid'];
-
-  // Only show post button if preview is optional or if we are in preview mode.
-  // We show the post button in preview mode even if there are form errors so that
-  // optional form elements (e.g., captcha) can be updated in preview mode.
-  if (!form_get_errors() && ((variable_get('comment_preview', COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview comment')) || ($op == t('Post comment')))) {
-    $form['submit'] = array('#type' => 'submit', '#value' => t('Post comment'), '#weight' => 20);
-  }
-
-  if ($op == t('Preview comment')) {
-    $form['#after_build'] = array('comment_form_add_preview');
-  }
-
-  if ($_REQUEST['destination']) {
-    $form['#attributes']['destination'] = $_REQUEST['destination'];
-  }
-
-  if (empty($edit['cid']) && empty($edit['pid'])) {
-    $form['#action'] = url('comment/reply/'. $edit['nid']);
-  }
-
-  // Graft in extra form additions
-  $form = array_merge($form, comment_invoke_comment($form, 'form'));
-
-  return theme('box', $title, drupal_get_form('comment_form', $form));
-}
-
-function comment_form_add_preview($form, $edit) {
-  global $user;
-
-  drupal_set_title(t('Preview comment'));
-
-  $output = '';
-
-  comment_validate($edit);
-  $comment = (object)_comment_form_submit($edit);
-
-  // Attach the user and time information.
-  if ($edit['author']) {
-    $account = user_load(array('name' => $edit['author']));
-  }
-  elseif ($user->uid && !isset($edit['is_anonymous'])) {
-    $account = $user;
-  }
-  if ($account) {
-    $comment->uid = $account->uid;
-    $comment->name = check_plain($account->name);
-  }
-  $comment->timestamp = $edit['timestamp'] ? $edit['timestamp'] : time();
-
-  // Preview the comment with security check.
-  if (!form_get_errors()) {
-    $output .= theme('comment_view', $comment);
-  }
-  $form['comment_preview'] = array(
-    '#value' => $output,
-    '#weight' => -100,
-    '#prefix' => '<div class="preview">',
-    '#suffix' => '</div>',
-  );
-
-  $output = '';
-
-  if ($edit['pid']) {
-    $comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = %d', $edit['pid'], COMMENT_PUBLISHED));
-    $comment = drupal_unpack($comment);
-    $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-    $output .= theme('comment_view', $comment);
-  }
-  else {
-    $form['#suffix'] = node_view(node_load($edit['nid']));
-    $edit['pid'] = 0;
-  }
-
-  $form['comment_preview_below'] = array('#value' => $output, '#weight' => 100);
-
-  return $form;
-}
-
-function comment_form_validate($form_id, $form_values) {
-  comment_validate($form_values);
-}
-
-function _comment_form_submit($form_values) {
-  if (!isset($form_values['date'])) {
-    $form_values['date'] = 'now';
-  }
-  $form_values['timestamp'] = strtotime($form_values['date']);
-  if (isset($form_values['author'])) {
-    $account = user_load(array('name' => $form_values['author']));
-    $form_values['uid'] = $account->uid;
-    $form_values['name'] = $form_values['author'];
-  }
-  // Validate the comment's subject.  If not specified, extract
-  // one from the comment's body.
-  if (trim($form_values['subject']) == '') {
-    // The body may be in any format, so we:
-    // 1) Filter it into HTML
-    // 2) Strip out all HTML tags
-    // 3) Convert entities back to plain-text.
-  // Note: format is checked by check_markup().
-    $form_values['subject'] = truncate_utf8(decode_entities(strip_tags(check_markup($form_values['comment'], $form_values['format']))), 29, TRUE);
-  }
-  return $form_values;
-}
-
-function comment_form_submit($form_id, $form_values) {
-  $form_values = _comment_form_submit($form_values);
-  if ($cid = comment_save($form_values)) {
-    return array('node/'. $form_values['nid'], NULL, "comment-$cid");
-  }
-}
-
-/*
-** Renderer or visualization functions this can be optionally
-** overridden by themes.
-*/
-
-function theme_comment_preview($comment, $links = array(), $visible = 1) {
-  $output = '<div class="preview">';
-  $output .= theme('comment_view', $comment, $links, $visible);
-  $output .= '</div>';
-  return $output;
-};
-
-function theme_comment_view($comment, $links = array(), $visible = 1) {
-
-  // Emit selectors:
-  $output = '';
-  if (($comment->new = node_mark($comment->nid, $comment->timestamp)) != MARK_READ) {
-    $output .= "<a id=\"new\"></a>\n";
-  }
-
-  $output .= "<a id=\"comment-$comment->cid\"></a>\n";
-
-  // Switch to folded/unfolded view of the comment
-  if ($visible) {
-    $comment->comment = check_markup($comment->comment, $comment->format, FALSE);
-
-    // Comment API hook
-    comment_invoke_comment($comment, 'view');
-
-    $output .= theme('comment', $comment, $links);
-  }
-  else {
-    $output .= theme('comment_folded', $comment);
-  }
-
-  return $output;
-}
-
-function comment_controls($mode = COMMENT_MODE_THREADED_EXPANDED, $order = COMMENT_ORDER_NEWEST_FIRST, $comments_per_page = 50) {
-  $form['mode'] = array('#type' => 'select',
-    '#default_value' => $mode,
-    '#options' => _comment_get_modes(),
-    '#weight' => 1,
-  );
-  $form['order'] = array(
-    '#type' => 'select',
-    '#default_value' => $order,
-    '#options' => _comment_get_orders(),
-    '#weight' => 2,
-  );
-  foreach (_comment_per_page() as $i) {
-    $options[$i] = t('%a comments per page', array('%a' => $i));
-  }
-  $form['comments_per_page'] = array('#type' => 'select',
-    '#default_value' => $comments_per_page,
-    '#options' => $options,
-    '#weight' => 3,
-  );
-
-  $form['submit'] = array('#type' => 'submit',
-    '#value' => t('Save settings'),
-    '#weight' => 20,
-  );
-
-  return drupal_get_form('comment_controls', $form);
-}
-
-function theme_comment_controls($form) {
-  $output .= '<div class="container-inline">';
-  $output .=  form_render($form);
-  $output .= '</div>';
-  $output .= '<div class="description">'. t('Select your preferred way to display the comments and click "Save settings" to activate your changes.') .'</div>';
-  return theme('box', t('Comment viewing options'), $output);
-}
-
-function comment_controls_submit($form_id, $form_values) {
-  global $user;
-
-  $mode = $form_values['mode'];
-  $order = $form_values['order'];
-  $comments_per_page = $form_values['comments_per_page'];
-
-  if ($user->uid) {
-    $user = user_save($user, array('mode' => $mode, 'sort' => $order, 'comments_per_page' => $comments_per_page));
-  }
-  else {
-    $_SESSION['comment_mode'] = $mode;
-    $_SESSION['comment_sort'] = $order;
-    $_SESSION['comment_comments_per_page'] = $comments_per_page;
-  }
-}
-
-function theme_comment($comment, $links = array()) {
-  $output  = '<div class="comment'. ($comment->status == COMMENT_NOT_PUBLISHED ? ' comment-unpublished' : '') .'">';
-  $output .= '<div class="subject">'. l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid") . ' ' . theme('mark', $comment->new) ."</div>\n";
-  $output .= '<div class="credit">'. t('by %a on %b', array('%a' => theme('username', $comment), '%b' => format_date($comment->timestamp))) ."</div>\n";
-  $output .= '<div class="body">'. $comment->comment .'</div>';
-  $output .= '<div class="links">'. theme('links', $links) .'</div>';
-  $output .= '</div>';
-  return $output;
-}
-
-function theme_comment_folded($comment) {
-  $output  = "<div class=\"comment-folded\">\n";
-  $output .= ' <span class="subject">'. l($comment->subject, comment_node_url() .'/'. $comment->cid, NULL, NULL, "comment-$comment->cid") . ' '. theme('mark', $comment->new) .'</span> ';
-  $output .= '<span class="credit">'. t('by') .' '. theme('username', $comment) ."</span>\n";
-  $output .= "</div>\n";
-  return $output;
-}
-
-function theme_comment_flat_collapsed($comment) {
-  return theme('comment_view', $comment, '', 0);
-  return '';
-}
-
-function theme_comment_flat_expanded($comment) {
-  return theme('comment_view', $comment, module_invoke_all('link', 'comment', $comment, 0));
-}
-
-function theme_comment_thread_collapsed($comment) {
-  $output  = '<div style="margin-left:'. ($comment->depth * 25) ."px;\">\n";
-  $output .= theme('comment_view', $comment, '', 0);
-  $output .= "</div>\n";
-  return $output;
-}
-
-function theme_comment_thread_expanded($comment) {
-  $output = '';
-  if ($comment->depth) {
-    $output .= '<div style="margin-left:'. ($comment->depth * 25) ."px;\">\n";
-  }
-
-  $output .= theme('comment_view', $comment, module_invoke_all('link', 'comment', $comment, 0));
-
-  if ($comment->depth) {
-    $output .= "</div>\n";
-  }
-  return $output;
-}
-
-function theme_comment_post_forbidden($nid) {
-  global $user;
-  if ($user->uid) {
-    return t("you can't post comments");
-  }
-  else {
-    // we cannot use drupal_get_destination() because these links sometimes appear on /node and taxo listing pages
-    if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
-      $destination = "destination=". drupal_urlencode("comment/reply/$nid#comment_form");
-    }
-    else {
-      $destination = "destination=". drupal_urlencode("node/$nid#comment_form");
-    }
-
-    if (variable_get('user_register', 1)) {
-      return t('<a href="%login">login</a> or <a href="%register">register</a> to post comments', array('%login' => url('user/login', $destination), '%register' => check_url(url('user/register', $destination))));
-    }
-    else {
-      return t('<a href="%login">login</a> to post comments', array('%login' => check_url(url('user/login', $destination))));
-    }
-  }
-}
-
-function _comment_delete_thread($comment) {
-  if (!is_object($comment) || !is_numeric($comment->cid)) {
-    watchdog('content', t('Can not delete non-existent comment.'), WATCHDOG_WARNING);
-    return;
-  }
-
-  // Delete the comment:
-  db_query('DELETE FROM {comments} WHERE cid = %d', $comment->cid);
-  watchdog('content', t('Comment: deleted %subject.', array('%subject' => theme('placeholder', $comment->subject))));
-
-  comment_invoke_comment($comment, 'delete');
-
-  // Delete the comment's replies
-  $result = db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE pid = %d', $comment->cid);
-  while ($comment = db_fetch_object($result)) {
-    $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-    _comment_delete_thread($comment);
-  }
-}
-
-/**
- * Return an array of viewing modes for comment listings.
- *
- * We can't use a global variable array because the locale system
- * is not initialized yet when the comment module is loaded.
- */
-function _comment_get_modes() {
-  return array(
-    COMMENT_MODE_FLAT_COLLAPSED => t('Flat list - collapsed'),
-    COMMENT_MODE_FLAT_EXPANDED => t('Flat list - expanded'),
-    COMMENT_MODE_THREADED_COLLAPSED => t('Threaded list - collapsed'),
-    COMMENT_MODE_THREADED_EXPANDED => t('Threaded list - expanded')
-  );
-}
-
-/**
- * Return an array of viewing orders for comment listings.
- *
- * We can't use a global variable array because the locale system
- * is not initialized yet when the comment module is loaded.
- */
-function _comment_get_orders() {
-  return array(
-    COMMENT_ORDER_NEWEST_FIRST => t('Date - newest first'),
-    COMMENT_ORDER_OLDEST_FIRST => t('Date - oldest first')
-  );
-}
-
-/**
- * Return an array of "comments per page" settings from which the user
- * can choose.
- */
-function _comment_per_page() {
-  return drupal_map_assoc(array(10, 30, 50, 70, 90, 150, 200, 250, 300));
-}
-
-/**
- * Return a current comment display setting
- *
- * $setting can be one of these: 'mode', 'sort', 'comments_per_page'
- */
-function _comment_get_display_setting($setting) {
-  global $user;
-
-  if ($_GET[$setting]) {
-    $value = $_GET[$setting];
-  }
-  else {
-    // get the setting's site default
-    switch ($setting) {
-      case 'mode':
-        $default = variable_get('comment_default_mode', COMMENT_MODE_THREADED_EXPANDED);
-        break;
-      case 'sort':
-        $default = variable_get('comment_default_order', COMMENT_ORDER_NEWEST_FIRST);
-        break;
-      case 'comments_per_page':
-        $default = variable_get('comment_default_per_page', '50');
-    }
-    if (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_HIDDEN) {
-      // if comment controls are disabled use site default
-      $value = $default;
-    }
-    else {
-      // otherwise use the user's setting if set
-      if ($user->$setting) {
-        $value = $user->$setting;
-      }
-      else if ($_SESSION['comment_'. $setting]) {
-        $value = $_SESSION['comment_'. $setting];
-      }
-      else {
-        $value = $default;
-      }
-    }
-  }
-  return $value;
-}
-
-/**
- * Updates the comment statistics for a given node.  This should be called any
- * time a comment is added, deleted, or updated.
- *
- * The following fields are contained in the node_comment_statistics table.
- * - last_comment_timestamp: the timestamp of the last comment for this node or the node create stamp if no comments exist for the node.
- * - last_comment_name: the name of the anonymous poster for the last comment
- * - last_comment_uid: the uid of the poster for the last comment for this node or the node authors uid if no comments exists for the node.
- * - comment_count: the total number of approved/published comments on this node.
- */
-function _comment_update_node_statistics($nid) {
-  $count = db_result(db_query('SELECT COUNT(cid) FROM {comments} WHERE nid = %d AND status = %d', $nid, COMMENT_PUBLISHED));
-
-  // comments exist
-  if ($count > 0) {
-    $last_reply = db_fetch_object(db_query_range('SELECT cid, name, timestamp, uid FROM {comments} WHERE nid = %d AND status = %d ORDER BY cid DESC', $nid, COMMENT_PUBLISHED, 0, 1));
-    db_query("UPDATE {node_comment_statistics} SET comment_count = %d, last_comment_timestamp = %d, last_comment_name = '%s', last_comment_uid = %d WHERE nid = %d", $count, $last_reply->timestamp, $last_reply->uid ? '' : $last_reply->name, $last_reply->uid, $nid);
-  }
-
-  // no comments
-  else {
-    $node = db_fetch_object(db_query("SELECT uid, created FROM {node} WHERE nid = %d", $nid));
-    db_query("UPDATE {node_comment_statistics} SET comment_count = 0, last_comment_timestamp = %d, last_comment_name = '', last_comment_uid = %d WHERE nid = %d", $node->created, $node->uid, $nid);
-  }
-}
-
-/**
- * Invoke a hook_comment() operation in all modules.
- *
- * @param &$comment
- *   A comment object.
- * @param $op
- *   A string containing the name of the comment operation.
- * @return
- *   The returned value of the invoked hooks.
- */
-function comment_invoke_comment(&$comment, $op) {
-  $return = array();
-  foreach (module_implements('comment') as $name) {
-    $function = $name .'_comment';
-    $result = $function($comment, $op);
-    if (isset($result) && is_array($result)) {
-      $return = array_merge($return, $result);
-    }
-    else if (isset($result)) {
-      $return[] = $result;
-    }
-  }
-  return $return;
-}
-
-/**
- * Generate vancode.
- *
- * Consists of a leading character indicating length, followed by N digits
- * with a numerical value in base 36. Vancodes can be sorted as strings
- * without messing up numerical order.
- *
- * It goes:
- * 00, 01, 02, ..., 0y, 0z,
- * 110, 111, ... , 1zy, 1zz,
- * 2100, 2101, ..., 2zzy, 2zzz,
- * 31000, 31001, ...
- */
-function int2vancode($i = 0) {
-  $num = base_convert((int)$i, 10, 36);
-  $length = strlen($num);
-  return chr($length + ord('0') - 1) . $num;
-}
-
-/**
- * Decode vancode back to an integer.
- */
-function vancode2int($c = '00') {
-  return base_convert(substr($c, 1), 36, 10);
-}
diff --git a/modules/contact.module b/modules/contact.module
deleted file mode 100644 (file)
index 82114bf..0000000
+++ /dev/null
@@ -1,549 +0,0 @@
-<?php
-// $Id: contact.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables the use of personal and site-wide contact forms.
- */
-
-/**
- * Implementation of hook_help().
- */
-function contact_help($section) {
-  switch ($section) {
-    case 'admin/help#contact':
-      $output = '<p>'. t('The contact module enables the use of both personal and site-wide contact forms, thereby facilitating easy communication within the community. While personal contact forms allow users to contact each other by e-mail, site-wide forms allow community members to contact the site administration from a central location. Users can specify a subject and message in the contact form, and also request that a copy of the e-mail be sent to their own address.') .'</p>';
-      $output .= '<p>'. t("Users can activate/deactivate their personal contact forms in their account settings. Upon activation, a contact tab will appear in their user profiles. Privileged users such as site administrators are able to contact users even if they have chosen not to enable this feature.") .'</p>';
-      $output .= '<p>'. t('If the menu module is enabled, a menu item linking to the site-wide contact page is added to the navigation block. It is disabled by default, but can be enabled via the <a href="%menu-module">menu management</a> page. Links to the contact page may also be added to the primary and secondary links using the same page.', array('%menu-module' => url('admin/menu'))) .'</p>';
-      $output .= t('Contact module links:') .'<ul>';
-      $output .= '<li>'. t('Default site-wide <a href="%contact-page">contact page</a>.', array('%contact-page' => url('contact'))) .'</li>';
-      $output .= '<li>'. t('Site-wide contact form <a href="%configuration-page">category configuration</a>.', array('%configuration-page' => url('admin/contact'))) .'</li>';
-      $output .= '<li>'. t('Site-wide contact form <a href="%additional-settings">general settings</a>.', array('%additional-settings' => url('admin/contact/settings'))) .'</li>';
-      $output .= '<li>'. t('Site-wide contact form <a href="%menu-configuration">menu configuration</a>.', array('%menu-configuration' => url('admin/menu'))) .'</li></ul>';
-      $output .= t('For more information, please read the configuration and customization handbook page for the <a href="%contact">contact module</a>.', array('%contact' => url('http://drupal.org/handbook/modules/contact/', NULL, NULL, TRUE)));
-      return $output;
-    case 'admin/modules#description':
-      return t('Enables the use of both personal and site-wide contact forms.');
-    case 'admin/contact':
-      $output = t('This page lets you setup <a href="%form">your site-wide contact form</a>. To do so, add one or more categories. You can associate different recipients with each category to route e-mails to different people. For example, you can route website feedback to the webmaster and direct product information requests to the sales department. On the <a href="%settings">settings page</a>, you can customize the information shown above the contact form. This can be useful to provide additional contact information such as your postal address and telephone number.', array('%settings' => url('admin/contact/settings'), '%form' => url('contact')));
-      if (!module_exist('menu')) {
-        $menu_note = t('The menu item can be customized and configured only once the menu module has been <a href="%modules-page">enabled</a>.', array('%modules-page' => url('admin/modules')));
-      }
-      else {
-        $menu_note = '';
-      }
-      $output .= '<p>'. t('The contact module also adds a <a href="%menu-settings">menu item</a> (disabled by default) to the navigation block.', array('%menu-settings' => url('admin/menu'))) .' '. $menu_note .'</p>';
-      return($output);
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function contact_menu($may_cache) {
-  $items = array();
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/contact',
-      'title' => t('contact form'),
-      'callback' => 'contact_admin_categories',
-      'access' => user_access('administer site configuration'),
-    );
-    $items[] = array('path' => 'admin/contact/category',
-      'title' => t('categories'),
-      'callback' => 'contact_admin_categories',
-      'access' => user_access('administer site configuration'),
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-    );
-    $items[] = array('path' => 'admin/contact/category/list',
-      'title' => t('list'),
-      'callback' => 'contact_admin_categories',
-      'access' => user_access('administer site configuration'),
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-    );
-    $items[] = array('path' => 'admin/contact/category/add',
-      'title' => t('add category'),
-      'callback' => 'contact_admin_edit',
-      'access' => user_access('administer site configuration'),
-      'type' => MENU_LOCAL_TASK,
-      'weight' => 1,
-    );
-    $items[] = array('path' => 'admin/contact/category/edit',
-      'title' => t('edit contact category'),
-      'callback' => 'contact_admin_edit',
-      'access' => user_access('administer site configuration'),
-      'type' => MENU_CALLBACK,
-    );
-    $items[] = array('path' => 'admin/contact/category/delete',
-      'title' => t('delete contact'),
-      'callback' => 'contact_admin_delete',
-      'access' => user_access('administer site configuration'),
-      'type' => MENU_CALLBACK,
-    );
-    $items[] = array('path' => 'admin/contact/settings',
-      'title' => t('settings'),
-      'callback' => 'contact_admin_settings',
-      'access' => user_access('administer site configuration'),
-      'type' => MENU_LOCAL_TASK,
-      'weight' => 1,
-    );
-    $items[] = array('path' => 'contact',
-      'title' => t('contact'),
-      'callback' => 'contact_mail_page',
-      'access' => user_access('access content'),
-      'type' => MENU_SUGGESTED_ITEM,
-    );
-  }
-  else {
-    if (arg(0) == 'user' && is_numeric(arg(1))) {
-      $items[] = array('path' => "user/". arg(1) ."/contact",
-        'title' => t('contact'),
-        'callback' => 'contact_mail_user',
-        'type' => MENU_LOCAL_TASK,
-        'weight' => 2,
-      );
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_user().
- *
- * Allows the user the option of enabling/disabling his personal contact form.
- */
-function contact_user($type, $edit, &$user, $category = NULL) {
-  if ($type == 'form' && $category == 'account') {
-    $form['contact'] = array('#type' => 'fieldset',
-      '#title' => t('Contact settings'),
-      '#weight' => 5,
-      '#collapsible' => TRUE,
-    );
-    $form['contact']['contact'] = array('#type' => 'checkbox',
-      '#title' => t('Personal contact form'),
-      '#default_value' => $edit['contact'],
-      '#description' => t('Allow other users to contact you by e-mail via <a href="%url">your personal contact form</a>. Note that while your e-mail address is not made public to other members of the community, privileged users such as site administrators are able to contact you even if you choose not to enable this feature.', array('%url' => url("user/$user->uid/contact"))),
-    );
-    return $form;
-  }
-  if ($type == 'validate') {
-    return array('contact' => $edit['contact']);
-  }
-}
-
-/**
- * Categories/list tab.
- */
-function contact_admin_categories() {
-  $result = db_query('SELECT cid, category, recipients, selected FROM {contact} ORDER BY weight, category');
-  $rows = array();
-  while ($category = db_fetch_object($result)) {
-    $rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('edit'), 'admin/contact/category/edit/'. $category->cid), l(t('delete'), 'admin/contact/category/delete/'. $category->cid));
-  }
-  $header = array(t('Category'), t('Recipients'), t('Selected'), array('data' => t('Operations'), 'colspan' => 2));
-
-  return theme('table', $header, $rows);
-}
-
-/**
- * Category edit page.
- */
-function contact_admin_edit($cid = NULL) {
-  if (arg(3) == "edit" && $cid > 0) {
-    $edit = db_fetch_array(db_query("SELECT * FROM {contact} WHERE cid = %d", $cid));
-  }
-  $form['category'] = array('#type' => 'textfield',
-    '#title' => t('Category'),
-    '#maxlength' => 255,
-    '#default_value' => $edit['category'],
-    '#description' => t("Example: 'website feedback' or 'product information'."),
-    '#required' => TRUE,
-  );
-  $form['recipients'] = array('#type' => 'textarea',
-    '#title' => t('Recipients'),
-    '#default_value' => $edit['recipients'],
-    '#description' => t("Example: 'webmaster@yoursite.com' or 'sales@yoursite.com'. To specify multiple recipients, separate each e-mail address with a comma."),
-    '#required' => TRUE,
-  );
-  $form['reply'] = array('#type' => 'textarea',
-    '#title' => t('Auto-reply'),
-    '#default_value' => $edit['reply'],
-    '#description' => t('Optional auto-reply. Leave empty if you do not want to send the user an auto-reply message.'),
-  );
-  $form['weight'] = array('#type' => 'weight',
-    '#title' => t('Weight'),
-    '#default_value' => $edit['weight'],
-    '#description' => t('When listing categories, those with lighter (smaller) weights get listed before categories with heavier (larger) weights. Categories with equal weights are sorted alphabetically.'),
-  );
-  $form['selected'] = array('#type' => 'select',
-    '#title' => t('Selected'),
-    '#options' => array('0' => t('No'), '1' => t('Yes')),
-    '#default_value' => $edit['selected'],
-    '#description' => t('Set this to <em>Yes</em> if you would like this category to be selected by default.'),
-  );
-  $form['cid'] = array('#type' => 'value',
-    '#value' => $edit['cid'],
-  );
-  $form['submit'] = array('#type' => 'submit',
-    '#value' => t('Submit'),
-  );
-
-  return drupal_get_form('contact_admin_edit', $form);
-}
-
-/**
- * Validate the contact category edit page form submission.
- */
-function contact_admin_edit_validate($form_id, $form_values) {
-  if (empty($form_values['category'])) {
-    form_set_error('category', t('You must enter a category.'));
-  }
-  if (empty($form_values['recipients'])) {
-    form_set_error('recipients', t('You must enter one or more recipients.'));
-  }
-  else {
-    $recipients = explode(',', $form_values['recipients']);
-    foreach($recipients as $recipient) {
-      if (!valid_email_address(trim($recipient))) {
-        form_set_error('recipients', t('%recipient is an invalid e-mail address.', array('%recipient' => theme('placeholder', $recipient))));
-      }
-    }
-  }
-}
-
-/**
- * Process the contact category edit page form submission.
- */
-function contact_admin_edit_submit($form_id, $form_values) {
-  if ($form_values['selected']) {
-    // Unselect all other contact categories.
-    db_query('UPDATE {contact} SET selected = 0');
-  }
-  $recipients = explode(',', $form_values['recipients']);
-  foreach($recipients as $key=>$recipient) {
-    // E-mail address validation has already been done in _validate.
-    $recipients[$key] = trim($recipient);
-  }
-  $form_values['recipients'] = implode(',', $recipients);
-  if (arg(3) == 'add') {
-    db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected']);
-    drupal_set_message(t('Category %category has been added.', array('%category' => theme('placeholder', $form_values['category']))));
-    watchdog('mail', t('Contact form: category %category added.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE, l(t('view'), 'admin/contact'));
-
-  }
-  else {
-    db_query("UPDATE {contact} SET category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d WHERE cid = %d", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected'], $form_values['cid']);
-    drupal_set_message(t('Category %category has been updated.', array('%category' => theme('placeholder', $form_values['category']))));
-    watchdog('mail', t('Contact form: category %category updated.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE, l(t('view'), 'admin/contact'));
-  }
-
-  return 'admin/contact';
-}
-
-/**
- * Category delete page.
- */
-function contact_admin_delete($cid = NULL) {
-  if ($info = db_fetch_object(db_query("SELECT category FROM {contact} WHERE cid = %d", $cid))) {
-    $form['category'] = array('#type' => 'value',
-      '#value' => $info->category,
-    );
-
-    return confirm_form('contact_admin_delete', $form, t('Are you sure you want to delete %category?', array('%category' => theme('placeholder', $info->category))), 'admin/contact', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
-  }
-  else {
-    drupal_set_message(t('Category not found.'), 'error');
-    drupal_goto('admin/contact');
-  }
-}
-
-/**
- * Process category delete form submission.
- */
-function contact_admin_delete_submit($form_id, $form_values) {
-  db_query("DELETE FROM {contact} WHERE cid = %d", arg(4));
-  drupal_set_message(t('Category %category has been deleted.', array('%category' => theme('placeholder', $form_values['category']))));
-  watchdog('mail', t('Contact form: category %category deleted.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE);
-
-  return 'admin/contact';
-}
-
-/**
- * Settings tab. Using a form rather than hook_settings().
- */
-function contact_admin_settings() {
-  $form['contact_form_information'] = array('#type' => 'textarea',
-    '#title' => t('Additional information'),
-    '#default_value' => variable_get('contact_form_information', t('You can leave a message using the contact form below.')),
-    '#description' => t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.', array('%form' => url('contact'))),
-  );
-  $form['contact_hourly_threshold'] = array('#type' => 'select',
-    '#title' => t('Hourly threshold'),
-    '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50)),
-    '#default_value' => variable_get('contact_hourly_threshold', 3),
-    '#description' => t('The maximum number of contact form submissions a user can perform per hour.'),
-  );
-  $form['submit'] = array('#type' => 'submit',
-    '#value' => t('Save configuration'),
-  );
-  $form['reset'] = array('#type' => 'submit',
-    '#value' => t('Reset to defaults'),
-  );
-  // Use system_settings_form for the callback.
-  return drupal_get_form('contact_admin_settings', $form, 'system_settings_form');
-}
-
-/**
- * Personal contact page.
- */
-function contact_mail_user() {
-  global $user;
-
-  if ($account = user_load(array('uid' => arg(1)))) {
-    $admin_access = user_access('administer users');
-    if (!$account->status && !$admin_access) {
-      drupal_access_denied();
-    }
-    else if (!$account->contact && !$admin_access) {
-      $output = t('%name is not accepting e-mails.', array('%name' => $account->name));
-    }
-    else if (!$user->uid) {
-      $output = t('Please <a href="%login">login</a> or <a href="%register">register</a> to send %name a message.', array('%login' => url('user/login'), '%register' => url('user/register'), '%name' => $account->name));
-    }
-    else if (!valid_email_address($user->mail)) {
-      $output = t('You need to provide a valid e-mail address to contact other users. Please update your <a href="%url">user information</a> and try again.', array('%url' => url("user/$user->uid/edit")));
-    }
-    else if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) {
-      $output = t('You cannot contact more than %number users per hour. Please try again later.', array('%number' => variable_get('contact_hourly_threshold', 3)));
-    }
-    else {
-      drupal_set_title($account->name);
-
-      $form['#token'] = $user->name . $user->mail;
-      $form['from'] = array('#type' => 'item',
-        '#title' => t('From'),
-        '#value' => $user->name .' &lt;'. $user->mail .'&gt;',
-      );
-      $form['to'] = array('#type' => 'item',
-        '#title' => t('To'),
-        '#value' => $account->name,
-      );
-      $form['subject'] = array('#type' => 'textfield',
-        '#title' => t('Subject'),
-        '#maxlength' => 50,
-        '#required' => TRUE,
-      );
-      $form['message'] = array('#type' => 'textarea',
-        '#title' => t('Message'),
-        '#rows' => 15,
-        '#required' => TRUE,
-      );
-      $form['copy'] = array('#type' => 'checkbox',
-        '#title' => t('Send me a copy.'),
-      );
-      $form['submit'] = array('#type' => 'submit',
-        '#value' => t('Send e-mail'),
-      );
-      $output = drupal_get_form('contact_mail_user', $form);
-    }
-
-    return $output;
-  }
-  else {
-    drupal_not_found();
-  }
-}
-
-/**
- * Process the personal contact page form submission.
- */
-function contact_mail_user_submit($form_id, $edit) {
-  global $user;
-
-  $account = user_load(array('uid' => arg(1), 'status' => 1));
-  // Compose the body:
-  $message[] = "$account->name,";
-  $message[] = t("%name (%name-url) has sent you a message via your contact form (%form-url) at %site.", array('%name' => $user->name, '%name-url' => url("user/$user->uid", NULL, NULL, TRUE), '%form-url' => url($_GET['q'], NULL, NULL, TRUE), '%site' => variable_get('site_name', 'drupal')));
-  $message[] = t("If you don't want to receive such e-mails, you can change your settings at %url.", array('%url' => url("user/$account->uid", NULL, NULL, TRUE)));
-  $message[] = t('Message:');
-  $message[] = $edit['message'];
-
-  // Tidy up the body:
-  foreach ($message as $key => $value) {
-    $message[$key] = wordwrap($value);
-  }
-
-  // Prepare all fields:
-  $to = $account->mail;
-  $from = $user->mail;
-
-  // Format the subject:
-  $subject = '['. variable_get('site_name', 'drupal') .'] '. $edit['subject'];
-
-  // Prepare the body:
-  $body = implode("\n\n", $message);
-
-  // Send the e-mail:
-  user_mail($to, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
-
-  // Send a copy if requested:
-  if ($edit['copy']) {
-    user_mail($from, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
-  }
-
-  // Log the operation:
-  flood_register_event('contact');
-  watchdog('mail', t('%name-from sent %name-to an e-mail.', array('%name-from' => theme('placeholder', $user->name), '%name-to' => theme('placeholder', $account->name))));
-
-  // Set a status message:
-  drupal_set_message(t('The message has been sent.'));
-
-  // Jump to the user's profile page:
-  return "user/$account->uid";
-}
-
-/**
- * Site-wide contact page
- */
-function contact_mail_page() {
-  global $user;
-
-  if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) {
-    $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3)));
-  }
-  else {
-    if ($user->uid) {
-      $edit['name'] = $user->name;
-      $edit['mail'] = $user->mail;
-    }
-
-    $result = db_query('SELECT cid, category, selected FROM {contact} ORDER BY weight, category');
-    while ($category = db_fetch_object($result)) {
-      $categories[$category->cid] = $category->category;
-      if ($category->selected) {
-        $default_category = $category->cid;
-      }
-    }
-
-    if (count($categories) > 0) {
-      $form['#token'] = $user->name . $user->mail;
-      $form['contact_information'] = array('#value' => filter_xss_admin(variable_get('contact_form_information', t('You can leave us a message using the contact form below.'))));
-      $form['name'] = array('#type' => 'textfield',
-        '#title' => t('Your name'),
-        '#maxlength' => 255,
-        '#default_value' => $edit['name'],
-        '#required' => TRUE,
-      );
-      $form['mail'] = array('#type' => 'textfield',
-        '#title' => t('Your e-mail address'),
-        '#maxlength' => 255,
-        '#default_value' => $edit['mail'],
-        '#required' => TRUE,
-      );
-      $form['subject'] = array('#type' => 'textfield',
-        '#title' => t('Subject'),
-        '#maxlength' => 255,
-        '#required' => TRUE,
-      );
-      if (count($categories) > 1) {
-        // If there is more than one category available and no default category has been selected,
-        // prepend a default placeholder value.
-        if (!isset($default_category)) {
-          $categories = array(t('--')) + $categories;
-        }
-        $form['cid'] = array('#type' => 'select',
-          '#title' => t('Category'),
-          '#default_value' => $default_category,
-          '#options' => $categories,
-          '#required' => TRUE,
-        );
-      }
-      else {
-        // If there is only one category, store its cid.
-        $category_keys = array_keys($categories);
-        $form['cid'] = array('#type' => 'value',
-          '#value' => array_shift($category_keys),
-        );
-      }
-      $form['message'] = array('#type' => 'textarea',
-        '#title' => t('Message'),
-        '#required' => TRUE,
-      );
-      $form['copy'] = array('#type' => 'checkbox',
-        '#title' => t('Send me a copy.'),
-      );
-      $form['submit'] = array('#type' => 'submit',
-        '#value' => t('Send e-mail'),
-      );
-      $output = drupal_get_form('contact_mail_page', $form);
-    }
-    else {
-      $output = t('The contact form has not been configured.');
-    }
-  }
-
-  return $output;
-}
-
-/**
- * Validate the site-wide contact page form submission.
- */
-function contact_mail_page_validate($form_id, $form_values) {
-  if (!$form_values['cid']) {
-    form_set_error('category', t('You must select a valid category.'));
-  }
-  if (!valid_email_address($form_values['mail'])) {
-    form_set_error('mail', t('You must enter a valid e-mail address.'));
-  }
-}
-
-/**
- * Process the site-wide contact page form submission.
- */
-function contact_mail_page_submit($form_id, $edit) {
-
-  // E-mail address of the sender: as the form field is a text field,
-  // all instances of \r and \n have been automatically stripped from it.
-  $from = $edit['mail'];
-
-  // Compose the body:
-  $message[] = t("%name sent a message using the contact form at %form.", array('%name' => $edit['name'], '%form' => url($_GET['q'], NULL, NULL, TRUE)));
-  $message[] = $edit['message'];
-
-  // Tidy up the body:
-  foreach ($message as $key => $value) {
-    $message[$key] = wordwrap($value);
-  }
-
-  // Load the category information:
-  $contact = db_fetch_object(db_query("SELECT * FROM {contact} WHERE cid = %d", $edit['cid']));
-
-  // Format the category:
-  $subject = t('[%category] %subject', array('%category' => $contact->category, '%subject' => $edit['subject']));
-
-  // Prepare the body:
-  $body = implode("\n\n", $message);
-
-  // Send the e-mail to the recipients:
-  user_mail($contact->recipients, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
-
-  // If the user requests it, send a copy.
-  if ($edit['copy']) {
-    user_mail($from, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
-  }
-
-  // Send an auto-reply if necessary:
-  if ($contact->reply) {
-    user_mail($from, $subject, wordwrap($contact->reply), "From: $contact->recipients\nReply-to: $contact->recipients\nX-Mailer: Drupal\nReturn-path: $contact->recipients\nErrors-to: $contact->recipients");
-  }
-
-  // Log the operation:
-  flood_register_event('contact');
-  watchdog('mail', t('%name-from sent an e-mail regarding %category.', array('%name-from' => theme('placeholder', $edit['name'] ." <$from>"), '%category' => theme('placeholder', $contact->category))));
-
-  // Update user:
-  drupal_set_message(t('Your message has been sent.'));
-
-  // Jump to home page rather than back to contact page to avoid contradictory messages if flood control has been activated.
-  return('');
-}
diff --git a/modules/drupal.module b/modules/drupal.module
deleted file mode 100644 (file)
index d47d004..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-<?php
-// $Id: drupal.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Lets users log in using a Drupal ID and can notify a central server about your site.
- */
-
-/**
- * Implementation of hook_help().
- */
-function drupal_help($section) {
-  switch ($section) {
-    case 'admin/help#drupal':
-      $output = '<p>'. t('The Drupal module uses the XML-RPC network communication protocol to connect your site with a central server that maintains a directory of client sites.') .'</p>';
-      $output .= t('<p>Enabling the Drupal module will allow you to:</p>
-<ul>
-  <li>register your site with a server, including (optionally) posting information on your installed modules and themes and summary statistics on your number of posts and users, information that can help rank Drupal modules and themes</li>
-  <li>enable other sites to register with your site</li>
-  <li>allow members on all sites using the Drupal module to log in to your site without registering using their distributed identification</li>
-  <li>allow members to log in to any other site that uses the Drupal module, using a login name that looks much like an e-mail address: <em>username@example.com</em></li>
-</ul>
-');
-      $output .= '<p>'. t('The Drupal module administration page allows you to set the xml-rpc server page and other related options.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-  <li>run your cron job at your site\'s <a href="%file-cron">cron page</a></li>
-  <li>view your <a href="%file-xmlrpc">XML-RPC page</a>.</li>
-  <li>administer Drupal <a href="%admin-settings-drupal">administer &gt;&gt; settings &gt;&gt; drupal</a>.</li>
-</ul>
-', array('%file-cron' => 'cron.php', '%file-xmlrpc' => 'xmlrpc.php', '%admin-settings-drupal' => url('admin/settings/drupal')));
-      $output .= '<p>'. t('If you maintain a directory of sites, you can list them on a page using the <code>drupal_client_page()</code> function. Sample instructions:
-<ul>
-  <li>Enable the page module. Select create content &gt;&gt; page.</li>
-  <li>For input format, select PHP code.</li>
-  <li>Give the page a title. For body, put:
-<pre>
-&lt;?php
-print drupal_client_page();
-?&gt;
-</pre>
-  <li>Save the page.</li>
-</ul>') . '</p>';
-
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%drupal">Drupal page</a>.', array('%drupal' => 'http://drupal.org/handbook/modules/drupal/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Lets you register your site with a central server and improve ranking of Drupal projects by posting information on your installed modules and themes; also enables users to log in using a Drupal ID.');
-    case 'admin/settings/drupal':
-      return t('<p>Using this your site can "call home" to another Drupal server. By calling home to drupal.org and sending a list of your installed modules and themes, you help rank projects on drupal.org and so assist all Drupal administrators to find the best components for meeting their needs. If you want to register with a different server, you can change the Drupal XML-RPC server setting -- but the server has to be able to handle Drupal XML. Some XML-RPC servers may present directories of all registered sites. To get all your site information listed, go to the <a href="%site-settings">settings page</a> and set the site name, the e-mail address, the slogan, and the mission statement.</p>', array('%site-settings' => url('admin/settings')));
-    case 'user/help#drupal':
-      return variable_get('drupal_authentication_service', 0) ? t("<p><a href=\"%Drupal\">Drupal</a> is the name of the software that powers %this-site. There are Drupal web sites all over the world, and many of them share their registration databases so that users may freely log in to any Drupal site using a single <strong>Drupal ID</strong>.</p>
-<p>So please feel free to log in to your account here at %this-site with a username from another Drupal site. The format of a Drupal ID is similar to an e-mail address: <strong>username</strong>@<em>server</em>. An example of a valid Drupal ID is <strong>mwlily</strong>@<em>drupal.org</em>.</p>", array('%Drupal' => 'http://drupal.org', '%this-site' => '<em>'. variable_get('site_name', 'this web site') .'</em>')) : '';
-  }
-}
-
-/**
- * Implementation of hook_settings().
- */
-function drupal_settings() {
-  // Check if all required fields are present
-  if ((variable_get('site_name', 'drupal') == 'drupal') || (variable_get('site_name', 'drupal') == '')) {
-    form_set_error('drupal_directory', t('You must set the name of your site on the <a href="%url">administer &raquo; settings</a> page.', array('%url' => url('admin/settings'))));
-  }
-  else if (variable_get('site_mail', ini_get('sendmail_from')) == '') {
-    form_set_error('drupal_directory', t('You must set an e-mail address for your site on the <a href="%url">administer &raquo; settings</a> page.', array('%url' => url('admin/settings'))));
-  }
-  else if (variable_get('site_slogan', '') == '') {
-    form_set_error('drupal_directory', t('You must set your site slogan on the <a href="%url">administer &raquo; settings</a> page.', array('%url' => url('admin/settings'))));
-  }
-  else if (variable_get('site_mission', '') == '') {
-    form_set_error('drupal_directory', t('You must set your site mission on the <a href="%url">administer &raquo; settings</a> page.' , array('%url' => url('admin/settings'))));
-  }
-  $options = array('1' => t('Enabled'), '0' => t('Disabled'));
-
-  $form['drupal'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Post data to another site'),
-    '#tree' => FALSE
-  );
-
-  $form['drupal']['drupal_register'] = array(
-    '#type' => 'radios',
-    '#title' => t('Register with a Drupal server'),
-    '#default_value' => variable_get('drupal_register', 0),
-    '#options' => $options,
-    '#description' => t("If enabled, your Drupal site will register itself with the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will register itself with drupal.org. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://drupal.org/xmlrpc.php", "%drupal-sites" => "http://drupal.org/drupal-sites/"))
-  );
-
-  $form['drupal']['drupal_server'] =  array(
-    '#type' => 'textfield',
-    '#title' => t('Drupal XML-RPC server'),
-    '#default_value' => variable_get('drupal_server', 'http://drupal.org/xmlrpc.php'),
-    '#description' => t('The URL of the Drupal XML-RPC server you wish to register with.')
-  );
-
-  $form['drupal']['drupal_system'] = array(
-    '#type' => 'radios',
-    '#title' => t('Send system information'),
-    '#default_value' => variable_get('drupal_system', 0),
-    '#options' => $options,
-    '#description' => t("If enabled, your site will send information on its installed components (modules, themes, and theme engines). This information can help in compiling statistics on usage of Drupal projects.")
-  );
-
-  $form['drupal']['drupal_statistics'] = array(
-    '#type' => 'radios',
-    '#title' => t('Send statistics'),
-    '#default_value' => variable_get('drupal_statistics', 0),
-    '#options' => $options,
-    '#description' => t("If enabled, your site will send summary statistics on the number of registered users and the total number of posts. No private information will be sent. These data help to improve the ranking statistics of Drupal projects.")
-  );
-
-  $form['services'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Receive data from other sites'),
-    '#tree' => FALSE
-  );
-
-  $form['services']['drupal_client_service'] = array(
-    '#type' => 'radios',
-    '#title' => t('Allow other Drupal sites to register'),
-    '#default_value' => variable_get('drupal_client_service', 0),
-    '#options' => $options,
-    '#description' => t('If enabled, your Drupal site will allow other sites to register with your site and send information to this site. This functionality can be used to maintain a list of related sites.')
-  );
-
-  $form['services']['drupal_authentication_service'] = array(
-    '#type' => 'radios',
-    '#title' => t('Authentication service'),
-    '#default_value' => variable_get('drupal_authentication_service', 0),
-    '#options' => $options,
-    '#description' => t('If enabled, your Drupal site will accept logins with the user names of other Drupal sites, and likewise provide authentication for users logging into other Drupal sites, based on their user accounts here.')
-  );
-
-  return $form;
-}
-
-/**
- * Implementation of hook_cron(); handles pings to and from the site.
- */
-function drupal_cron() {
-  if (time() - variable_get('cron_last', 0) > 21600) {
-
-    // If this site acts as a Drupal XML-RPC server, delete the sites that
-    // stopped sending "ping" messages.
-    if (variable_get('drupal_client_service', 0)) {
-      $result = db_query("SELECT cid FROM {client} WHERE changed < %d", time() - 259200);
-      while ($client = db_fetch_object($result)) {
-        db_query("DELETE FROM {client_system} WHERE cid = %d", $client->cid);
-        db_query("DELETE FROM {client} WHERE cid = %d", $client->cid);
-      }
-    }
-
-    // If this site acts as a Drupal XML-RPC client, send a message to the
-    // Drupal XML-RPC server.
-    if (variable_get('drupal_register', 0) && variable_get('drupal_server', 0)) {
-      drupal_notify(variable_get('drupal_server', ''));
-    }
-  }
-}
-
-/**
- * Callback function from drupal_xmlrpc() called when another site pings this one.
- */
-function drupal_client_ping($client, $system) {
-  /*
-  ** Parse our parameters:
-  */
-
-  foreach (array('link', 'name', 'mail', 'slogan', 'mission') as $key) {
-    $client[$key] = strip_tags($client[$key]);
-  }
-
-  /*
-  ** Update the data in our database and send back a reply:
-  */
-
-  if ($client['link'] && $client['name'] && $client['mail'] && $client['slogan'] && $client['mission']) {
-    $result = db_query(db_rewrite_sql("SELECT cid FROM {client} WHERE link = '%s'"), $client['link']);
-    if (db_num_rows($result)) {
-      $record = db_fetch_object($result);
-      $client['cid'] = $record->cid;
-      // We have an existing record.
-      db_query("UPDATE {client} SET link = '%s', name = '%s', mail = '%s', slogan = '%s', mission = '%s', users = %d, nodes = %d, version = '%s', changed = '%s' WHERE cid = %d", $client['uid'], $client['link'], $client['name'], $client['mail'], $client['slogan'], $client['mission'], $client['users'], $client['nodes'], $client['version'], time(), $client['cid']);
-    }
-    else {
-      $client['cid'] = db_next_id('{client}_cid');
-      db_query("INSERT INTO {client} (cid, link, name, mail, slogan, mission, users, nodes, version, created, changed) VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $client['cid'], $client['link'], $client['name'], $client['mail'], $client['slogan'], $client['mission'], $client['users'], $client['nodes'], $client['version'], time(), time());
-    }
-    if (is_array($system)) {
-      db_query("DELETE FROM {client_system} WHERE cid = %d", $client['cid']);
-      foreach ($system as $item) {
-        db_query("INSERT INTO {client_system} (cid, name, type) VALUES (%d, '%s', '%s')", $client['cid'], $item['name'], $item['type']);
-      }
-    }
-    watchdog('client ping', t('Ping from %name (%link).', array('%name' => theme('placeholder', $client['name']), '%link' => theme('placeholder', $client['link']))), WATCHDOG_NOTICE, '<a href="'. check_url($client['link']) .'">view</a>');
-
-    return TRUE;
-  }
-  else {
-    return 0;
-  }
-
-}
-
-/**
- * Formats a list of all clients.
- *
- * This function may be called from a custom page on sites that are
- * Drupal directory servers.
- */
-function drupal_client_page($sort = 'name') {
-  $result = db_query('SELECT * FROM {client} ORDER BY %s', $sort);
-
-  $clients = array();
-  while ($client = db_fetch_object($result)) {
-    $clients[] = $client;
-  }
-
-  return theme('client_list', $clients);
-}
-
-/**
- * Theme a client list.
- */
-function theme_client_list($clients) {
-  // Note: All fields except the mission are treated as plain-text.
-  // The mission is stripped of any HTML tags to keep the output simple and consistent.
-  $output = "\n<dl>\n";
-  foreach ($clients as $client) {
-    $output .= '  <dt><a href="' . check_url($client->link) . '">' . check_plain($client->name) . '</a> - ' . check_plain($client->slogan) . "</dt>\n";
-    $output .= '  <dd>' . strip_tags($client->mission) . "</dd>\n";
-  }
-  $output .= "</dl>\n";
-  return $output;
-}
-
-/**
- * Implementation of hook_xmlrpc().
- */
-function drupal_xmlrpc() {
-  $xmlrpc = array();
-  if (variable_get('drupal_client_service', 0)) {
-    $xmlrpc[] = array(
-      'drupal.client.ping',
-      'drupal_client_ping',
-      array('array', 'array', 'array'),
-      t('Handling ping request')
-    );
-  }
-  if (variable_get('drupal_authentication_service', 0)) {
-    $xmlrpc[] = array(
-      'drupal.login',
-      'drupal_login',
-      array('int', 'string', 'string'),
-      t('Logging into a Drupal site')
-    );
-  }
-  return $xmlrpc;
-}
-
-/**
- * Sends a ping to the Drupal directory server.
- */
-function drupal_notify($server) {
-  global $base_url;
-  $client = array(
-    'link' => $base_url,
-    'name' => variable_get('site_name', ''),
-    'mail' => variable_get('site_mail', ''),
-    'slogan' => variable_get('site_slogan', ''),
-    'mission' => variable_get('site_mission', ''),
-    'version' => VERSION
-  );
-  if (variable_get('drupal_system', 0)) {
-    $system = array();
-    $result = db_query("SELECT name, type FROM {system} WHERE status = 1");
-    while ($item = db_fetch_array($result)) {
-      $system[] = $item;
-    }
-  }
-  if (variable_get('drupal_statistics', 0)) {
-    $users = db_fetch_object(db_query("SELECT COUNT(uid) AS count FROM {users}"));
-    $client['users'] = $users->count;
-    $nodes = db_fetch_object(db_query("SELECT COUNT(nid) AS count FROM {node}"));
-    $client['nodes'] = $nodes->count;
-  }
-  $result = xmlrpc($server, 'drupal.client.ping', $client, $system);
-
-  if ($result === FALSE) {
-    watchdog('server ping', t('Failed to notify %server; error code: %errno; error message: %error_msg.', array('%server' => theme('placeholder', $server), '%errno' => theme('placeholder', xmlrpc_errno()), '%error_msg' => theme('placeholder', xmlrpc_error_msg()))), WATCHDOG_WARNING);
-  }
-}
-
-/**
- * Implementation of hook_info().
- */
-function drupal_info($field = 0) {
-  $info['name'] = 'Drupal';
-  $info['protocol'] = 'XML-RPC';
-
-  if ($field) {
-    return $info[$field];
-  }
-  else {
-    return $info;
-  }
-}
-
-/**
- * Implementation of hook_auth().
- */
-function drupal_auth($username, $password, $server) {
-  if (variable_get('drupal_authentication_service', 0)) {
-    $result = xmlrpc("http://$server/xmlrpc.php", 'drupal.login', $username, $password);
-    if ($result === FALSE) {
-      drupal_set_message(t('Error %code : %message', array('%code' => theme('placeholder', xmlrpc_errno()), '%message' =>  theme('placeholder', xmlrpc_error_msg()))), 'error');
-    }
-    else {
-      return $result;
-    }
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function drupal_menu($may_cache) {
-  $items = array();
-  if ($may_cache) {
-    if (variable_get('drupal_authentication_service', 0)) {
-      $items[] = array('path' => 'drupal', 'title' => t('Drupal'),
-        'callback' => 'drupal_page_help', 'access' => TRUE,
-        'type' => MENU_SUGGESTED_ITEM
-      );
-    }
-  }
-  return $items;
-}
-
-/**
- * Menu callback; print Drupal-authentication-specific information from user/help.
- */
-function drupal_page_help() {
-  return drupal_help('user/help#drupal');
-}
-
-/**
- * Callback function from drupal_xmlrpc() for authenticating remote clients.
- *
- * Remote clients are usually other Drupal instances.
- */
-function drupal_login($username, $password) {
-  if (variable_get('drupal_authentication_service', 0)) {
-    if ($user = user_load(array('name' => $username, 'pass' => $password, 'status' => 1))) {
-      return $user->uid;
-    }
-    else {
-      return 0;
-    }
-  }
-}
-
-
diff --git a/modules/filter.module b/modules/filter.module
deleted file mode 100644 (file)
index 2172d37..0000000
+++ /dev/null
@@ -1,1372 +0,0 @@
-<?php
-// $Id: filter.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Framework for handling filtering of content.
- */
-
-// This is a special format ID which means "use the default format". This value
-// can be passed to the filter APIs as a format ID: this is equivalent to not
-// passing an explicit format at all.
-define('FILTER_FORMAT_DEFAULT', 0);
-
-define('FILTER_HTML_STRIP', 1);
-define('FILTER_HTML_ESCAPE', 2);
-
-/**
- * Implementation of hook_help().
- */
-function filter_help($section) {
-  switch ($section) {
-    case 'admin/help#filter':
-      $output = '<p>'. t('The filter module allows administrators to configure  text input formats for the site.  For example, an administrator may want a filter to strip out malicious HTML from user\'s comments.  Administrators may also want to make URLs linkable even if they are only entered in an unlinked format.') .'</p>';
-      $output .= '<p>'. t('Users can choose between the available input formats when creating or editing content.  Administrators can configure which input formats are available to which user roles, as well as choose a default input format.  Administrators can also create new input formats.  Each input format can be configured to use a selection of filters.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>administer input format permissions and settings  at <a href="%admin-filters">administer &gt;&gt; input formats</a>.</li>
-<li>configure the filters for each input format at <a href="%admin-filters">administer &gt;&gt; input formats &gt;&gt; configure</a>.</li>
-</ul>
-', array('%admin-filters' => url('admin/filters')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%filter">Filter page</a>.', array('%filter' => 'http://drupal.org/handbook/modules/filter/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Handles the filtering of content in preparation for display.');
-
-    case 'admin/filters':
-      return t('
-<p><em>Input formats</em> define a way of processing user-supplied text in Drupal. Every input format has its own settings of which <em>filters</em> to apply. Possible filters include stripping out malicious HTML and making URLs clickable.</p>
-<p>Users can choose between the available input formats when submitting content.</p>
-<p>Below you can configure which input formats are available to which roles, as well as choose a default input format (used for imported content, for example).</p>
-<p>Note that (1) the default format is always available to all roles, and (2) all filter formats can always be used by roles with the "administer filters" permission even if they are not explicitly listed in the Roles column of this table.</p>');
-
-    case 'admin/filters/'. arg(2):
-      return t('
-<p>Every <em>filter</em> performs one particular change on the user input, for example stripping out malicious HTML or making URLs clickable. Choose which filters you want to apply to text in this input format.</p>
-<p>If you notice some filters are causing conflicts in the output, you can <a href="%rearrange">rearrange them</a>.</p>', array('%rearrange' => url('admin/filters/'. arg(2) .'/order')));
-
-    case 'admin/filters/'. arg(2) .'/configure':
-      return t('
-<p>If you cannot find the settings for a certain filter, make sure you\'ve enabled it on the <a href="%url">view tab</a> first.</p>', array('%url' => url('admin/filters/'. arg(2))));
-
-    case 'admin/filters/'. arg(2) .'/order':
-      return t('
-<p>Because of the flexible filtering system, you might encounter a situation where one filter prevents another from doing its job. For example: a word in an URL gets converted into a glossary term, before the URL can be converted in a clickable link. When this happens, you will need to rearrange the order in which filters get executed.</p>
-<p>Filters are executed from top-to-bottom. You can use the weight column to rearrange them: heavier filters \'sink\' to the bottom.</p>');
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function filter_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/filters',
-      'title' => t('input formats'),
-      'callback' => 'filter_admin_overview',
-      'access' => user_access('administer filters'),
-    );
-    $items[] = array('path' => 'admin/filters/list',
-      'title' => t('list'),
-      'callback' => 'filter_admin_overview',
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-      'access' => user_access('administer filters'),
-    );
-    $items[] = array('path' => 'admin/filters/add',
-      'title' => t('add input format'),
-      'callback' => 'filter_admin_format_form',
-      'type' => MENU_LOCAL_TASK,
-      'weight' => 1,
-      'access' => user_access('administer filters'),
-    );
-    $items[] = array('path' => 'admin/filters/delete',
-      'title' => t('delete input format'),
-      'callback' => 'filter_admin_delete',
-      'type' => MENU_CALLBACK,
-      'access' => user_access('administer filters'),
-    );
-    $items[] = array('path' => 'filter/tips',
-      'title' => t('compose tips'),
-      'callback' => 'filter_tips_long',
-      'access' => TRUE,
-      'type' => MENU_SUGGESTED_ITEM,
-    );
-  }
-  else {
-    if (arg(0) == 'admin' && arg(1) == 'filters' && is_numeric(arg(2))) {
-      $formats = filter_formats();
-
-      if (isset($formats[arg(2)])) {
-        $items[] = array('path' => 'admin/filters/'. arg(2),
-          'title' => t("'%format' input format", array('%format' => $formats[arg(2)]->name)),
-          'callback' => 'filter_admin_format_form',
-          'callback arguments' => array('format' => $formats[arg(2)]),
-          'type' => MENU_CALLBACK,
-          'access' => user_access('administer filters'),
-        );
-        $items[] = array('path' => 'admin/filters/'. arg(2) .'/list',
-          'title' => t('view'),
-          'callback' => 'filter_admin_format_form',
-          'callback arguments' => array('format' => $formats[arg(2)]),
-          'type' => MENU_DEFAULT_LOCAL_TASK,
-          'weight' => 0,
-          'access' => user_access('administer filters'),
-        );
-        $items[] = array('path' => 'admin/filters/'. arg(2) .'/configure',
-          'title' => t('configure'),
-          'callback' => 'filter_admin_configure',
-          'type' => MENU_LOCAL_TASK,
-          'weight' => 1,
-          'access' => user_access('administer filters'),
-        );
-        $items[] = array('path' => 'admin/filters/'. arg(2) .'/order',
-          'title' => t('rearrange'),
-          'callback' => 'filter_admin_order',
-          'callback arguments' => array('format' => $formats[arg(2)]),
-          'type' => MENU_LOCAL_TASK,
-          'weight' => 2,
-          'access' => user_access('administer filters'),
-        );
-      }
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_perm().
- */
-function filter_perm() {
-  return array('administer filters');
-}
-
-/**
- * Implementation of hook_filter_tips().
- */
-function filter_filter_tips($delta, $format, $long = false) {
-  global $base_url;
-  switch ($delta) {
-    case 0:
-      if (variable_get("filter_html_$format", FILTER_HTML_STRIP) ==  FILTER_HTML_STRIP) {
-        if ($allowed_html = variable_get("allowed_html_$format", '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>')) {
-          switch ($long) {
-            case 0:
-              return t('Allowed HTML tags') .': '. check_plain($allowed_html);
-            case 1:
-              $output = '<p>'. t('Allowed HTML tags') .': '. check_plain($allowed_html) .'</p>';
-              if (!variable_get("filter_html_help_$format", 1)) {
-                return $output;
-              }
-
-              $output .= t('
-<p>This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy. This table provides examples for each tag that is enabled on this site.</p>
-<p>For more information see W3C\'s <a href="http://www.w3.org/TR/html/">HTML Specifications</a> or use your favorite search engine to find other sites that explain HTML.</p>');
-              $tips = array(
-                'a' => array( t('Anchors are used to make links to other pages.'), '<a href="'. $base_url .'">'. variable_get('site_name', 'drupal') .'</a>'),
-                'br' => array( t('By default line break tags are automatically added, so use this tag to add additional ones. Use of this tag is different because it is not used with an open/close pair like all the others. Use the extra " /" inside the tag to maintain XHTML 1.0 compatibility'), t('Text with <br />line break')),
-                'p' => array( t('By default paragraph tags are automatically added, so use this tag to add additional ones.'), '<p>'. t('Paragraph one.') .'</p> <p>'. t('Paragraph two.') .'</p>'),
-                'strong' => array( t('Strong'), '<strong>'. t('Strong'). '</strong>'),
-                'em' => array( t('Emphasized'), '<em>'. t('Emphasized') .'</em>'),
-                'cite' => array( t('Cited'), '<cite>'. t('Cited') .'</cite>'),
-                'code' => array( t('Coded text used to show programming source code'), '<code>'. t('Coded') .'</code>'),
-                'b' => array( t('Bolded'), '<b>'. t('Bolded') .'</b>'),
-                'u' => array( t('Underlined'), '<u>'. t('Underlined') .'</u>'),
-                'i' => array( t('Italicized'), '<i>'. t('Italicized') .'</i>'),
-                'sup' => array( t('Superscripted'), t('<sup>Super</sup>scripted')),
-                'sub' => array( t('Subscripted'), t('<sub>Sub</sub>scripted')),
-                'pre' => array( t('Preformatted'), '<pre>'. t('Preformatted') .'</pre>'),
-                'abbr' => array( t('Abbreviation'), t('<abbr title="Abbreviation">Abbrev.</abbr>')),
-                'acronym' => array( t('Acronym'), t('<acronym title="Three-Letter Acronym">TLA</acronym>')),
-                'blockquote' => array( t('Block quoted'), '<blockquote>'. t('Block quoted') .'</blockquote>'),
-                'q' => array( t('Quoted inline'), '<q>'. t('Quoted inline') .'</q>'),
-                // Assumes and describes tr, td, th.
-                'table' => array( t('Table'), '<table> <tr><th>'. t('Table header') .'</th></tr> <tr><td>'. t('Table cell') .'</td></tr> </table>'),
-                'tr' => NULL, 'td' => NULL, 'th' => NULL,
-                'del' => array( t('Deleted'), '<del>'. t('Deleted') .'</del>'),
-                'ins' => array( t('Inserted'), '<ins>'. t('Inserted') .'</ins>'),
-                 // Assumes and describes li.
-                'ol' => array( t('Ordered list - use the &lt;li&gt; to begin each list item'), '<ol> <li>'. t('First item') .'</li> <li>'. t('Second item') .'</li> </ol>'),
-                'ul' => array( t('Unordered list - use the &lt;li&gt; to begin each list item'), '<ul> <li>'. t('First item') .'</li> <li>'. t('Second item') .'</li> </ul>'),
-                'li' => NULL,
-                // Assumes and describes dt and dd.
-                'dl' => array( t('Definition lists are similar to other HTML lists. &lt;dl&gt; begins the definition list, &lt;dt&gt; begins the definition term and &lt;dd&gt; begins the definition description.'), '<dl> <dt>'. t('First term') .'</dt> <dd>'. t('First definition') .'</dd> <dt>'. t('Second term') .'</dt> <dd>'. t('Second definition') .'</dd> </dl>'),
-                'dt' => NULL, 'dd' => NULL,
-                'h1' => array( t('Header'), '<h1>'. t('Title') .'</h1>'),
-                'h2' => array( t('Header'), '<h2>'. t('Subtitle') .'</h2>'),
-                'h3' => array( t('Header'), '<h3>'. t('Subtitle three') .'</h3>'),
-                'h4' => array( t('Header'), '<h4>'. t('Subtitle four') .'</h4>'),
-                'h5' => array( t('Header'), '<h5>'. t('Subtitle five') .'</h5>'),
-                'h6' => array( t('Header'), '<h6>'. t('Subtitle six') .'</h6>')
-              );
-              $header = array(t('Tag Description'), t('You Type'), t('You Get'));
-              preg_match_all('/<([a-z0-9]+)[^a-z0-9]/i', $allowed_html, $out);
-              foreach ($out[1] as $tag) {
-                if (array_key_exists($tag, $tips)) {
-                  if ($tips[$tag]) {
-                    $rows[] = array(
-                      array('data' => $tips[$tag][0], 'class' => 'description'),
-                      array('data' => '<code>'. check_plain($tips[$tag][1]) .'</code>', 'class' => 'type'),
-                      array('data' => $tips[$tag][1], 'class' => 'get')
-                    );
-                  }
-                }
-                else {
-                  $rows[] = array(
-                    array('data' => t('No help provided for tag %tag.', array('%tag' => check_plain($tag))), 'class' => 'description', 'colspan' => 3),
-                  );
-                }
-              }
-              $output .= theme('table', $header, $rows);
-
-              $output .= t('
-<p>Most unusual characters can be directly entered without any problems.</p>
-<p>If you do encounter problems, try using HTML character entities. A common example looks like &amp;amp; for an ampersand &amp; character. For a full list of entities see HTML\'s <a href="http://www.w3.org/TR/html4/sgml/entities.html">entities</a> page. Some of the available characters include:</p>');
-              $entities = array(
-                array( t('Ampersand'), '&amp;'),
-                array( t('Greater than'), '&gt;'),
-                array( t('Less than'), '&lt;'),
-                array( t('Quotation mark'), '&quot;'),
-              );
-              $header = array(t('Character Description'), t('You Type'), t('You Get'));
-              unset($rows);
-              foreach ($entities as $entity) {
-                $rows[] = array(
-                  array('data' => $entity[0], 'class' => 'description'),
-                  array('data' => '<code>'. check_plain($entity[1]) .'</code>', 'class' => 'type'),
-                  array('data' => $entity[1], 'class' => 'get')
-                );
-              }
-              $output .= theme('table', $header, $rows);
-              return $output;
-          }
-        }
-        else {
-          return t('No HTML tags allowed');
-        }
-      }
-      break;
-
-    case 1:
-      switch ($long) {
-        case 0:
-          return t('You may post PHP code. You should include &lt;?php ?&gt; tags.');
-        case 1:
-          return t('
-<h4>Using custom PHP code</h4>
-<p>If you know how to script in PHP, Drupal gives you the power to embed any script you like. It will be executed when the page is viewed and dynamically embedded into the page. This gives you amazing flexibility and power, but of course with that comes danger and insecurity if you don\'t write good code. If you are not familiar with PHP, SQL or with the site engine, avoid experimenting with PHP because you can corrupt your database or render your site insecure or even unusable! If you don\'t plan to do fancy stuff with your content then you\'re probably better off with straight HTML.</p>
-<p>Remember that the code within each PHP item must be valid PHP code - including things like correctly terminating statements with a semicolon. It is highly recommended that you develop your code separately using a simple test script on top of a test database before migrating to your production environment.</p>
-<p>Notes:</p><ul><li>You can use global variables, such as configuration parameters, within the scope of your PHP code but remember that global variables which have been given values in your code will retain these values in the engine afterwards.</li><li>register_globals is now set to <strong>off</strong> by default. If you need form information you need to get it from the "superglobals" $_POST, $_GET, etc.</li><li>You can either use the <code>print</code> or <code>return</code> statement to output the actual content for your item.</li></ul>
-<p>A basic example:</p>
-<blockquote><p>You want to have a box with the title "Welcome" that you use to greet your visitors. The content for this box could be created by going:</p>
-<pre>
-  print t("Welcome visitor, ... welcome message goes here ...");
-</pre>
-<p>If we are however dealing with a registered user, we can customize the message by using:</p>
-<pre>
-  global $user;
-  if ($user->uid) {
-    print t("Welcome $user->name, ... welcome message goes here ...");
-  }
-  else {
-    print t("Welcome visitor, ... welcome message goes here ...");
-  }
-</pre></blockquote>
-<p>For more in-depth examples, we recommend that you check the existing Drupal code and use it as a starting point, especially for sidebar boxes.</p>');
-      }
-
-    case 2:
-      switch ($long) {
-        case 0:
-          return t('Lines and paragraphs break automatically.');
-        case 1:
-          return t('Lines and paragraphs are automatically recognized. The &lt;br /&gt; line break, &lt;p&gt; paragraph and &lt;/p&gt; close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.');
-      }
-  }
-}
-
-/**
- * Displays a list of all input formats and which one is the default
- */
-function filter_admin_overview() {
-
-  // Overview of all formats.
-  $formats = filter_formats();
-  $error = false;
-
-  $rows = array();
-  foreach ($formats as $id => $format) {
-    $roles = array();
-    foreach (user_roles() as $rid => $name) {
-      // Prepare a roles array with roles that may access the filter
-      if (strstr($format->roles, ",$rid,")) {
-        $roles[] = $name;
-      }
-    }
-    $row = array();
-    $default = ($id == variable_get('filter_default_format', 1));
-    $options[$id] = '';
-    $form[$format->name]['id'] = array('#value' => $id);
-    $form[$format->name]['roles'] = array('#value' => $default ? t('All roles may use default format') : ($roles ? implode(', ',$roles) : t('No roles may use this format')));
-    $form[$format->name]['configure'] = array('#value' => l(t('configure'), 'admin/filters/'. $id));
-    $form[$format->name]['delete'] = array('#value' => $default ? '' : l(t('delete'), 'admin/filters/delete/'. $id));
-  }
-  $form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('filter_default_format', 1));
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Set default format'));
-  return drupal_get_form('filter_admin_overview', $form);
-}
-
-function filter_admin_overview_submit($form_id, $form_values) {
-  // Process form submission to set the default format
-  if (is_numeric($form_values['default'])) {
-    drupal_set_message(t('Default format updated.'));
-    variable_set('filter_default_format', $form_values['default']);
-  }
-}
-
-function theme_filter_admin_overview($form) {
-  foreach ($form as $name => $element) {
-    if (isset($element['roles']) && is_array($element['roles'])) {
-      $rows[] = array(
-        form_render($form['default'][$element['id']['#value']]),
-        check_plain($name),
-        form_render($element['roles']),
-        form_render($element['configure']),
-        form_render($element['delete'])
-      );
-      unset($form[$name]);
-    }
-  }
-  $header = array(t('Default'), t('Name'), t('Roles'), array('data' => t('Operations'), 'colspan' => 2));
-  $output = theme('table', $header, $rows);
-  $output .= form_render($form);
-
-  return $output;
-}
-
-/**
- * Menu callback; confirm deletion of a format.
- */
-function filter_admin_delete() {
-  $format = arg(3);
-  $format = db_fetch_object(db_query('SELECT * FROM {filter_formats} WHERE format = %d', $format));
-
-  if ($format) {
-    if ($format->format != variable_get('filter_default_format', 1)) {
-      $form['format'] = array('#type' => 'hidden', '#value' => $format->format);
-      $form['name'] = array('#type' => 'hidden', '#value' => $format->name);
-
-      return confirm_form('filter_admin_delete', $form, t('Are you sure you want to delete the input format %format?', array('%format' => theme('placeholder', $format->name))), 'admin/filters', t('If you have any content left in this input format, it will be switched to the default input format. This action cannot be undone.'), t('Delete'), t('Cancel'));
-    }
-    else {
-      drupal_set_message(t('The default format cannot be deleted.'));
-      drupal_goto('admin/filters');
-    }
-  }
-  else {
-    drupal_not_found();
-  }
-}
-
-/**
- * Process filter delete form submission.
- */
-function filter_admin_delete_submit($form_id, $form_values) {
-  db_query("DELETE FROM {filter_formats} WHERE format = %d", $form_values['format']);
-  db_query("DELETE FROM {filters} WHERE format = %d", $form_values['format']);
-
-  $default = variable_get('filter_default_format', 1);
-  // Replace existing instances of the deleted format with the default format.
-  db_query("UPDATE {node_revisions} SET format = %d WHERE format = %d", $default, $form_values['format']);
-  db_query("UPDATE {comments} SET format = %d WHERE format = %d", $default, $form_values['format']);
-  db_query("UPDATE {boxes} SET format = %d WHERE format = %d", $default, $form_values['format']);
-
-  cache_clear_all('filter:'. $form_values['format'], true);
-  drupal_set_message(t('Deleted input format %format.', array('%format' => theme('placeholder', $form_values['name']))));
-
-  return 'admin/filters';
-}
-
-/**
- * Generate a filter format form.
- */
-function filter_admin_format_form($format = NULL) {
-  $default = ($format->format == variable_get('filter_default_format', 1));
-  if ($default) {
-    $help = t('All roles for the default format must be enabled and cannot be changed.');
-    $form['default_format'] = array('#type' => 'hidden', '#value' => 1);
-  }
-
-  $form['name'] = array('#type' => 'textfield',
-    '#title' => 'Name',
-    '#default_value' => $format->name,
-    '#description' => t('Specify a unique name for this filter format.'),
-    '#required' => TRUE,
-  );
-
-  // Add a row of checkboxes for form group.
-  $form['roles'] = array('#type' => 'fieldset',
-    '#title' => t('Roles'),
-    '#description' => $default ? $help : t('Choose which roles may use this filter format. Note that roles with the "administer filters" permission can always use all the filter formats.'),
-    '#tree' => TRUE,
-  );
-
-  foreach (user_roles() as $rid => $name) {
-    $checked = strstr($format->roles, ",$rid,");
-    $form['roles'][$rid] = array('#type' => 'checkbox',
-      '#title' => $name,
-      '#default_value' => ($default || $checked),
-    );
-    if ($default) {
-      $form['roles'][$rid]['#attributes'] = array('disabled' => 'disabled');
-    }
-  }
-  // Table with filters
-  $all = filter_list_all();
-  $enabled = filter_list_format($format->format);
-
-  $form['filters'] = array('#type' => 'fieldset',
-    '#title' => t('Filters'),
-    '#description' => t('Choose the filters that will be used in this filter format.'),
-    '#tree' => TRUE,
-  );
-  foreach ($all as $id => $filter) {
-    $form['filters'][$id] = array('#type' => 'checkbox',
-      '#title' => $filter->name,
-      '#default_value' => isset($enabled[$id]),
-      '#description' => module_invoke($filter->module, 'filter', 'description', $filter->delta),
-    );
-  }
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
-
-  if (isset($format)) {
-    $form['format'] = array('#type' => 'hidden', '#value' => $format->format);
-
-    // Composition tips (guidelines)
-    $tips = _filter_tips($format->format, false);
-    $extra = l(t('More information about formatting options'), 'filter/tips');
-    $tiplist = theme('filter_tips', $tips, false, $extra);
-    if (!$tiplist) {
-      $tiplist = t('<p>No guidelines available.</p>');
-    }
-    $group = t('<p>These are the guidelines that users will see for posting in this input format. They are automatically generated from the filter settings.</p>');
-    $group .= $tiplist;
-    $output = '<h2>'. t('Formatting guidelines') .'</h2>'. $group;
-  }
-  $output = drupal_get_form('filter_admin_format_form', $form) . $output;
-
-  return $output;
-}
-
-/**
- * Validate filter format form submissions.
- */
-function filter_admin_format_form_validate($form_id, $form_values) {
-  if (!isset($form_values['format'])) {
-    $name = trim($form_values['name']);
-    $result = db_fetch_object(db_query("SELECT format FROM {filter_formats} WHERE name='%s'", $name));
-    if ($result) {
-      form_set_error('name', t('Filter format names need to be unique. A format named %name already exists.', array('%name' => theme('placeholder', $name))));
-    }
-  }
-}
-
-/**
- * Process filter format form submissions.
- */
-function filter_admin_format_form_submit($form_id, $form_values) {
-  $format = isset($form_values['format']) ? $form_values['format'] : NULL;
-  $current = filter_list_format($format);
-  $name = trim($form_values['name']);
-  $cache = TRUE;
-
-  // Add a new filter format.
-  if (!$format) {
-    $new = TRUE;
-    db_query("INSERT INTO {filter_formats} (name) VALUES ('%s')", $name);
-    $result = db_fetch_object(db_query("SELECT MAX(format) AS format FROM {filter_formats}"));
-    $format = $result->format;
-    drupal_set_message(t('Added input format %format.', array('%format' => theme('placeholder', $name))));
-  }
-  else {
-    drupal_set_message(t('The input format settings have been updated.'));
-  }
-
-  db_query("DELETE FROM {filters} WHERE format = %d", $format);
-  foreach ($form_values['filters'] as $id => $checked) {
-    if ($checked) {
-      list($module, $delta) = explode('/', $id);
-      // Add new filters to the bottom.
-      $weight = isset($current[$id]->weight) ? $current[$id]->weight : 10;
-      db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", $format, $module, $delta, $weight);
-
-      // Check if there are any 'no cache' filters.
-      $cache &= !module_invoke($module, 'filter', 'no cache', $delta);
-    }
-  }
-
-  // We store the roles as a string for ease of use.
-  // We should always set all roles to true when saving a default role.
-  // We use leading and trailing comma's to allow easy substring matching.
-  $roles = array();
-  if (isset($form_values['roles'])) {
-    foreach ($form_values['roles'] as $id => $checked) {
-      if ($checked) {
-        $roles[] = $id;
-      }
-    }
-  }
-  $roles = ','. implode(',', ($form_values['default_format'] ? user_roles() : $roles)) .',';
-
-  db_query("UPDATE {filter_formats} SET cache = %d, name='%s', roles = '%s' WHERE format = %d", $cache, $name, $roles, $format);
-
-  cache_clear_all('filter:'. $format, true);
-
-  // If a new filter was added, return to the main list of filters. Otherwise, stay on edit filter page to show new changes.
-  if ($new) {
-    return 'admin/filters/';
-  }
-  else {
-    return 'admin/filters/'. $format;
-  }
-}
-
-/**
- * Menu callback; display form for ordering filters for a format.
- */
-function filter_admin_order($format = NULL) {
-  // Get list (with forced refresh)
-  $filters = filter_list_format($format->format);
-
-  $form['weights'] = array('#tree' => TRUE);
-  foreach ($filters as $id => $filter) {
-    $form['names'][$id] = array('#value' => $filter->name);
-    $form['weights'][$id] = array('#type' => 'weight', '#default_value' => $filter->weight);
-  }
-  $form['format'] = array('#type' => 'hidden', '#value' => $format->format);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
-
-  return drupal_get_form('filter_admin_order', $form);
-}
-
-/**
- * Theme filter order configuration form.
- */
-function theme_filter_admin_order($form) {
-  $header = array(t('Name'), t('Weight'));
-  $rows = array();
-  foreach (element_children($form['names']) as $id) {
-    // Don't take form control structures
-    if (is_array($form['names'][$id])) {
-      $rows[] = array(form_render($form['names'][$id]), form_render($form['weights'][$id]));
-    }
-  }
-
-  $output = theme('table', $header, $rows);
-  $output .= form_render($form);
-
-  return $output;
-}
-
-/**
- * Process filter order configuration form submission.
- */
-function filter_admin_order_submit($form_id, $form_values) {
-  foreach ($form_values['weights'] as $id => $weight) {
-    list($module, $delta) = explode('/', $id);
-    db_query("UPDATE {filters} SET weight = %d WHERE format = %d AND module = '%s' AND delta = %d", $weight, $form_values['format'], $module, $delta);
-  }
-  drupal_set_message(t('The filter ordering has been saved.'));
-
-  cache_clear_all('filter:'. $form_values['format'], true);
-}
-
-/**
- * Menu callback; display settings defined by filters.
- */
-function filter_admin_configure() {
-  $format = arg(2);
-
-  $list = filter_list_format($format);
-  $form = array();
-  foreach ($list as $filter) {
-    $form_module = module_invoke($filter->module, 'filter', 'settings', $filter->delta, $format);
-    if (isset($form_module) && is_array($form_module)) {
-      $form = array_merge($form, $form_module);
-    }
-  }
-
-  if (!empty($form)) {
-    $output = system_settings_form('filter_admin_configure', $form);
-  }
-  else {
-    $output = t('No settings are available.');
-  }
-
-  return $output;
-}
-
-/**
- * Retrieve a list of input formats.
- */
-function filter_formats() {
-  global $user;
-  static $formats;
-
-  // Administrators can always use all input formats.
-  $all = user_access('administer filters');
-
-  if (!isset($formats)) {
-    $formats = array();
-
-    $query = 'SELECT * FROM {filter_formats}';
-
-    // Build query for selecting the format(s) based on the user's roles.
-    if (!$all) {
-      $where = array();
-      foreach ($user->roles as $rid => $role) {
-        $where[] = "roles LIKE '%%,%d,%%'";
-        $args[] = $rid;
-      }
-      $query .= ' WHERE '. implode(' OR ', $where) . ' OR format = %d';
-      $args[] = variable_get('filter_default_format', 1);
-    }
-
-    $result = db_query($query, $args);
-    while ($format = db_fetch_object($result)) {
-      $formats[$format->format] = $format;
-    }
-  }
-  return $formats;
-}
-
-/**
- * Build a list of all filters.
- */
-function filter_list_all() {
-  $filters = array();
-
-  foreach (module_list() as $module) {
-    $list = module_invoke($module, 'filter', 'list');
-    if (isset($list) && is_array($list)) {
-      foreach ($list as $delta => $name) {
-        $filters[$module .'/'. $delta] = (object)array('module' => $module, 'delta' => $delta, 'name' => $name);
-      }
-    }
-  }
-
-  uasort($filters, '_filter_list_cmp');
-
-  return $filters;
-}
-
-/**
- * Helper function for sorting the filter list by filter name.
- */
-function _filter_list_cmp($a, $b) {
-  return strcmp($a->name, $b->name);
-}
-
-/**
- * Resolve a format id, including the default format.
- */
-function filter_resolve_format($format) {
-  return $format == FILTER_FORMAT_DEFAULT ? variable_get('filter_default_format', 1) : $format;
-}
-/**
- * Check if text in a certain input format is allowed to be cached.
- */
-function filter_format_allowcache($format) {
-  static $cache = array();
-  $format = filter_resolve_format($format);
-  if (!isset($cache[$format])) {
-    $cache[$format] = db_result(db_query('SELECT cache FROM {filter_formats} WHERE format = %d', $format));
-  }
-  return $cache[$format];
-}
-
-/**
- * Retrieve a list of filters for a certain format.
- */
-function filter_list_format($format) {
-  static $filters = array();
-
-  if (!isset($filters[$format])) {
-    $filters[$format] = array();
-    $result = db_query("SELECT * FROM {filters} WHERE format = %d ORDER BY weight ASC", $format);
-    while ($filter = db_fetch_object($result)) {
-      $list = module_invoke($filter->module, 'filter', 'list');
-      if (isset($list) && is_array($list) && isset($list[$filter->delta])) {
-        $filter->name = $list[$filter->delta];
-        $filters[$format][$filter->module .'/'. $filter->delta] = $filter;
-      }
-    }
-  }
-
-  return $filters[$format];
-}
-
-/**
- * @name Filtering functions
- * @{
- * Modules which need to have content filtered can use these functions to
- * interact with the filter system.
- *
- * For more info, see the hook_filter() documentation.
- *
- * Note: because filters can inject JavaScript or execute PHP code, security is
- * vital here. When a user supplies a $format, you should validate it with
- * filter_access($format) before accepting/using it. This is normally done in
- * the validation stage of the node system. You should for example never make a
- * preview of content in a disallowed format.
- */
-
-/**
- * Run all the enabled filters on a piece of text.
- *
- * @param $text
- *    The text to be filtered.
- * @param $format
- *    The format of the text to be filtered. Specify FILTER_FORMAT_DEFAULT for
- *    the default format.
- * @param $check
- *    Whether to check the $format with filter_access() first. Defaults to TRUE.
- *    Note that this will check the permissions of the current user, so you
- *    should specify $check = FALSE when viewing other people's content.  When
- *    showing content that is not (yet) stored in the database (eg. upon preview),
- *    set to TRUE so the user's permissions are checked.
- */
-function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $check = TRUE) {
-  // When $check = true, do an access check on $format.
-  if (isset($text) && (!$check || filter_access($format))) {
-    $format = filter_resolve_format($format);
-
-    // Check for a cached version of this piece of text.
-    $id = 'filter:'. $format .':'. md5($text);
-    if ($cached = cache_get($id)) {
-      return $cached->data;
-    }
-
-    // See if caching is allowed for this format.
-    $cache = filter_format_allowcache($format);
-
-    // Convert all Windows and Mac newlines to a single newline,
-    // so filters only need to deal with one possibility.
-    $text = str_replace(array("\r\n", "\r"), "\n", $text);
-
-    // Get a complete list of filters, ordered properly.
-    $filters = filter_list_format($format);
-
-    // Give filters the chance to escape HTML-like data such as code or formulas.
-    foreach ($filters as $filter) {
-      $text = module_invoke($filter->module, 'filter', 'prepare', $filter->delta, $format, $text);
-    }
-
-    // Perform filtering.
-    foreach ($filters as $filter) {
-      $text = module_invoke($filter->module, 'filter', 'process', $filter->delta, $format, $text);
-    }
-
-    // Store in cache with a minimum expiration time of 1 day.
-    if ($cache) {
-      cache_set($id, $text, time() + (60 * 60 * 24));
-    }
-  }
-  else {
-    $text = message_na();
-  }
-
-  return $text;
-}
-
-/**
- * Generate a selector for choosing a format in a form.
- *
- * @param $value
- *   The ID of the format that is currently selected.
- * @param $weight
- *   The weight of the input format.
- * @param $parents
- *   Required when defining multiple input formats on a single node or having a different parent than 'format'.
- * @return
- *   HTML for the form element.
- */
-function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = NULL, $parents = array('format')) {
-  $value = filter_resolve_format($value);
-  $formats = filter_formats();
-
-  $extra = l(t('More information about formatting options'), 'filter/tips');
-
-  if (count($formats) > 1) {
-    $form = array(
-      '#type' => 'fieldset',
-      '#title' => t('Input format'),
-      '#collapsible' => TRUE,
-      '#collapsed' => TRUE,
-      '#weight' => $weight,
-      '#validate' => array('filter_form_validate' => array()),
-    );
-    // Multiple formats available: display radio buttons with tips.
-    foreach ($formats as $format) {
-      $form[$format->format] = array(
-        '#type' => 'radio',
-        '#title' => $format->name,
-        '#default_value' => $value,
-        '#return_value' => $format->format,
-        '#parents' => $parents,
-        '#description' => theme('filter_tips', _filter_tips($format->format, false)),
-      );
-    }
-  }
-  else {
-    // Only one format available: use a hidden form item and only show tips.
-    $format = array_shift($formats);
-    $form[$format->format] = array('#type' => 'value', '#value' => $format->format, '#parents' => $parents);
-    $tips = _filter_tips(variable_get('filter_default_format', 1), false);
-    $form['format']['guidelines'] = array(
-      '#title' => t('Formatting guidelines'),
-      '#value' => theme('filter_tips', $tips, false, $extra),
-    );
-  }
-  $form[] = array(
-    '#type' => 'markup',
-    '#value' => $extra,
-  );
-  return $form;
-}
-
-function filter_form_validate($form) {
-  foreach (element_children($form) as $key) {
-    if ($form[$key]['#value'] == $form[$key]['#return_value']) {
-      return;
-    }
-  }
-  form_error($form, t('An illegal choice has been detected. Please contact the site administrator.'));
-  watchdog('form', t('Illegal choice %choice in %name element.', array('%choice' => theme('placeholder', check_plain($v)), '%name' => theme('placeholder', empty($form['#title']) ? $form['#parents'][0] : $form['#title']))), WATCHDOG_ERROR);
-}
-
-/**
- * Returns true if the user is allowed to access this format.
- */
-function filter_access($format) {
-  $format = filter_resolve_format($format);
-  if (user_access('administer filters') || ($format == variable_get('filter_default_format', 1))) {
-    return true;
-  }
-  else {
-    $formats = filter_formats();
-    return isset($formats[$format]);
-  }
-}
-/**
- * @} End of "Filtering functions".
- */
-
-/**
- * Menu callback; show a page with long filter tips.
- */
-function filter_tips_long() {
-  $format = arg(2);
-  if ($format) {
-    $output = theme('filter_tips', _filter_tips($format, true), true);
-  }
-  else {
-    $output = theme('filter_tips', _filter_tips(-1, true), true);
-  }
-  return $output;
-}
-
-/**
- * Helper function for fetching filter tips.
- */
-function _filter_tips($format, $long = false) {
-  if ($format == -1) {
-    $formats = filter_formats();
-  }
-  else {
-    $formats = array(db_fetch_object(db_query("SELECT * FROM {filter_formats} WHERE format = %d", $format)));
-  }
-
-  $tips = array();
-
-  foreach ($formats as $format) {
-    $filters = filter_list_format($format->format);
-
-    $tips[$format->name] = array();
-    foreach ($filters as $id => $filter) {
-      if ($tip = module_invoke($filter->module, 'filter_tips', $filter->delta, $format->format, $long)) {
-        $tips[$format->name][] = array('tip' => $tip, 'id' => $id);
-      }
-    }
-  }
-
-  return $tips;
-}
-
-/**
- * Format a set of filter tips.
- *
- * @ingroup themeable
- */
-function theme_filter_tips($tips, $long = false, $extra = '') {
-  $output = '';
-
-  $multiple = count($tips) > 1;
-  if ($multiple) {
-    $output = t('input formats') .':';
-  }
-
-  if (count($tips)) {
-    if ($multiple) {
-      $output .= '<ul>';
-    }
-    foreach ($tips as $name => $tiplist) {
-      if ($multiple) {
-        $output .= '<li>';
-        $output .= '<strong>'. $name .'</strong>:<br />';
-      }
-
-      $tips = '';
-      foreach ($tiplist as $tip) {
-        $tips .= '<li'. ($long ? ' id="filter-'. str_replace("/", "-", $tip['id']) .'">' : '>') . $tip['tip'] . '</li>';
-      }
-
-      if ($tips) {
-        $output .= "<ul class=\"tips\">$tips</ul>";
-      }
-
-      if ($multiple) {
-        $output .= '</li>';
-      }
-    }
-    if ($multiple) {
-      $output .= '</ul>';
-    }
-  }
-
-  return $output;
-}
-
-/**
- * @name Standard filters
- * @{
- * Filters implemented by the filter.module.
- */
-
-/**
- * Implementation of hook_filter(). Contains a basic set of essential filters.
- * - HTML filter:
- *     Validates user-supplied HTML, transforming it as necessary.
- * - PHP evaluator:
- *     Executes PHP code.
- * - Line break converter:
- *     Converts newlines into paragraph and break tags.
- */
-function filter_filter($op, $delta = 0, $format = -1, $text = '') {
-  switch ($op) {
-    case 'list':
-      return array(0 => t('HTML filter'), 1 => t('PHP evaluator'), 2 => t('Line break converter'));
-
-    case 'no cache':
-      return $delta == 1; // No caching for the PHP evaluator.
-
-    case 'description':
-      switch ($delta) {
-        case 0:
-          return t('Allows you to restrict if users can post HTML and which tags to filter out.');
-        case 1:
-          return t('Runs a piece of PHP code. The usage of this filter should be restricted to administrators only!');
-        case 2:
-          return t('Converts line breaks into HTML (i.e. &lt;br&gt; and &lt;p&gt; tags).');
-        default:
-          return;
-      }
-
-    case 'process':
-      switch ($delta) {
-        case 0:
-          return _filter_html($text, $format);
-        case 1:
-          return drupal_eval($text);
-        case 2:
-          return _filter_autop($text);
-        default:
-          return $text;
-      }
-
-    case 'settings':
-      switch ($delta) {
-        case 0:
-          return _filter_html_settings($format);
-        default:
-          return;
-      }
-
-    default:
-      return $text;
-  }
-}
-
-/**
- * Settings for the HTML filter.
- */
-function _filter_html_settings($format) {
-  $form['filter_html'] = array('#type' => 'fieldset', '#title' => t('HTML filter'), '#collapsible' => TRUE, '#collapsed' => TRUE);
-  $form['filter_html']["filter_html_$format"] = array('#type' => 'radios', '#title' => t('Filter HTML tags'), '#default_value' => variable_get("filter_html_$format", FILTER_HTML_STRIP), '#options' => array(FILTER_HTML_STRIP => t('Strip disallowed tags'), FILTER_HTML_ESCAPE => t('Escape all tags')), '#description' => t('How to deal with HTML tags in user-contributed content. If set to "Strip disallowed tags", dangerous tags are removed (see below). If set to "Escape tags", all HTML is escaped and presented as it was typed.'));
-  $form['filter_html']["allowed_html_$format"] = array('#type' => 'textfield', '#title' => t('Allowed HTML tags'), '#default_value' => variable_get("allowed_html_$format", '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>'), '#size' => 64, '#maxlength' => 255, '#description' => t('If "Strip disallowed tags" is selected, optionally specify tags which should not be stripped. JavaScript event attributes are always stripped.'));
-  $form['filter_html']["filter_html_help_$format"] = array('#type' => 'checkbox', '#title' => t('Display HTML help'), '#default_value' => variable_get("filter_html_help_$format", 1), '#description' => t('If enabled, Drupal will display some basic HTML help in the long filter tips.'));
-  $form['filter_html']["filter_html_nofollow_$format"] = array('#type' => 'checkbox', '#title' => t('Spam link deterrent'), '#default_value' => variable_get("filter_html_nofollow_$format", FALSE), '#description' => t('If enabled, Drupal will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.'));
-  return $form;
-}
-
-/**
- * HTML filter. Provides filtering of input into accepted HTML.
- */
-function _filter_html($text, $format) {
-  if (variable_get("filter_html_$format", FILTER_HTML_STRIP) == FILTER_HTML_STRIP) {
-    $allowed_tags = preg_split('/\s+|<|>/', variable_get("allowed_html_$format", '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>'), -1, PREG_SPLIT_NO_EMPTY);
-    $text = filter_xss($text, $allowed_tags);
-  }
-
-  if (variable_get("filter_html_$format", FILTER_HTML_STRIP) == FILTER_HTML_ESCAPE) {
-    // Escape HTML
-    $text = check_plain($text);
-  }
-
-  if (variable_get("filter_html_nofollow_$format", FALSE)) {
-    $text = preg_replace('/<a([^>]+)>/i', '<a\\1 rel="nofollow">', $text);
-  }
-
-  return trim($text);
-}
-
-/**
- * Convert line breaks into <p> and <br> in an intelligent fashion.
- * Based on: http://photomatt.net/scripts/autop
- */
-function _filter_autop($text) {
-  // All block level tags
-  $block = '(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|p|h[1-6])';
-
-  // Split at <pre>, <script>, <style> and </pre>, </script>, </style> tags.
-  // We don't apply any processing to the contents of these tags to avoid messing
-  // up code. We look for matched pairs and allow basic nesting. For example:
-  // "processed <pre> ignored <script> ignored </script> ignored </pre> processed"
-  $chunks = preg_split('@(</?(?:pre|script|style)[^>]*>)@i', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
-  // Note: PHP ensures the array consists of alternating delimiters and literals
-  // and begins and ends with a literal (inserting NULL as required).
-  $ignore = false;
-  $ignoretag = '';
-  $output = '';
-  foreach ($chunks as $i => $chunk) {
-    if ($i % 2) {
-      // Opening or closing tag?
-      $open = ($chunk[1] != '/');
-      list($tag) = split('[ >]', substr($chunk, 2 - $open), 2);
-      if (!$ignore) {
-        if ($open) {
-          $ignore = true;
-          $ignoretag = $tag;
-        }
-      }
-      // Only allow a matching tag to close it.
-      else if (!$open && $ignoretag == $tag) {
-        $ignore = false;
-        $ignoretag = '';
-      }
-    }
-    else if (!$ignore) {
-      $chunk = preg_replace('|\n*$|', '', $chunk) ."\n\n"; // just to make things a little easier, pad the end
-      $chunk = preg_replace('|<br />\s*<br />|', "\n\n", $chunk);
-      $chunk = preg_replace('!(<'. $block .'[^>]*>)!', "\n$1", $chunk); // Space things out a little
-      $chunk = preg_replace('!(</'. $block .'>)!', "$1\n\n", $chunk); // Space things out a little
-      $chunk = preg_replace("/\n\n+/", "\n\n", $chunk); // take care of duplicates
-      $chunk = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $chunk); // make paragraphs, including one at the end
-      $chunk = preg_replace('|<p>\s*?</p>|', '', $chunk); // under certain strange conditions it could create a P of entirely whitespace
-      $chunk = preg_replace("|<p>(<li.+?)</p>|", "$1", $chunk); // problem with nested lists
-      $chunk = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $chunk);
-      $chunk = str_replace('</blockquote></p>', '</p></blockquote>', $chunk);
-      $chunk = preg_replace('!<p>\s*(</?'. $block .'[^>]*>)!', "$1", $chunk);
-      $chunk = preg_replace('!(</?'. $block .'[^>]*>)\s*</p>!', "$1", $chunk);
-      $chunk = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $chunk); // make line breaks
-      $chunk = preg_replace('!(</?'. $block .'[^>]*>)\s*<br />!', "$1", $chunk);
-      $chunk = preg_replace('!<br />(\s*</?(?:p|li|div|th|pre|td|ul|ol)>)!', '$1', $chunk);
-      $chunk = preg_replace('/&([^#])(?![A-Za-z0-9]{1,8};)/', '&amp;$1', $chunk);
-    }
-    $output .= $chunk;
-  }
-  return $output;
-}
-
-/**
- * Very permissive XSS/HTML filter for admin-only use.
- *
- * Use only for fields where it is impractical to use the
- * whole filter system, but where some (mainly inline) mark-up
- * is desired (so check_plain() is not acceptable).
- *
- * Allows all tags that can be used inside an HTML body, save
- * for scripts and styles.
- */
-function filter_xss_admin($string) {
-  return filter_xss($string, array('a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'ins', 'kbd', 'li', 'object', 'ol', 'p', 'param', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'));
-}
-
-/**
- * Filters XSS. Based on kses by Ulf Harnhammar, see
- * http://sourceforge.net/projects/kses
- *
- * For examples of various XSS attacks, see:
- * http://ha.ckers.org/xss.html
- *
- * This code does four things:
- * - Removes characters and constructs that can trick browsers
- * - Makes sure all HTML entities are well-formed
- * - Makes sure all HTML tags and attributes are well-formed
- * - Makes sure no HTML tags contain URLs with a disallowed protocol (e.g. javascript:)
- *
- * @param $string
- *   The string with raw HTML in it. It will be stripped of everything that can cause
- *   an XSS attack.
- * @param $allowed_tags
- *   An array of allowed tags.
- * @param $format
- *   The format to use.
- */
-function filter_xss($string, $allowed_tags = array('a', 'em', 'strong', 'cite', 'code', 'ul', 'ol', 'li', 'dl', 'dt', 'dd')) {
-  // Store the input format
-  _filter_xss_split($allowed_tags, TRUE);
-  // Remove NUL characters (ignored by some browsers)
-  $string = str_replace(chr(0), '', $string);
-  // Remove Netscape 4 JS entities
-  $string = preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);
-
-  // Defuse all HTML entities
-  $string = str_replace('&', '&amp;', $string);
-  // Change back only well-formed entities in our whitelist
-  // Named entities
-  $string = preg_replace('/&amp;([A-Za-z][A-Za-z0-9]*;)/', '&\1', $string);
-  // Decimal numeric entities
-  $string = preg_replace('/&amp;#([0-9]+;)/', '&#\1', $string);
-  // Hexadecimal numeric entities
-  $string = preg_replace('/&amp;#[Xx]0*((?:[0-9A-Fa-f]{2})+;)/', '&#x\1', $string);
-
-  return preg_replace_callback('%
-    (
-    <[^>]*.(>|$)  # a string that starts with a <, up until the > or the end of the string
-    |             # or
-    >             # just a >
-    )%x', '_filter_xss_split', $string);
-}
-
-/**
- * Processes an HTML tag.
- *
- * @param @m
- *   An array with various meaning depending on the value of $store.
- *   If $store is TRUE then the array contains the allowed tags.
- *   If $store is FALSE then the array has one element, the HTML tag to process.
- * @param $store
- *   Whether to store $m.
- * @return
- *   If the element isn't allowed, an empty string. Otherwise, the cleaned up
- *   version of the HTML element.
- */
-function _filter_xss_split($m, $store = FALSE) {
-  static $allowed_html;
-
-  if ($store) {
-    $allowed_html = array_flip($m);
-    return;
-  }
-
-  $string = $m[1];
-
-  if (substr($string, 0, 1) != '<') {
-    // We matched a lone ">" character
-    return '&gt;';
-  }
-
-  if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) {
-    // Seriously malformed
-    return '';
-  }
-
-  $slash = trim($matches[1]);
-  $elem = &$matches[2];
-  $attrlist = &$matches[3];
-
-  if (!isset($allowed_html[strtolower($elem)])) {
-    // Disallowed HTML element
-    return '';
-  }
-
-  if ($slash != '') {
-    return "</$elem>";
-  }
-
-  // Is there a closing XHTML slash at the end of the attributes?
-  // In PHP 5.1.0+ we could count the changes, currently we need a separate match
-  $xhtml_slash = preg_match('%\s?/\s*$%', $attrlist) ? ' /' : '';
-  $attrlist = preg_replace('%(\s?)/\s*$%', '\1', $attrlist);
-
-  // Clean up attributes
-  $attr2 = implode(' ', _filter_xss_attributes($attrlist));
-  $attr2 = preg_replace('/[<>]/', '', $attr2);
-  $attr2 = strlen($attr2) ? ' '. $attr2 : '';
-
-  return "<$elem$attr2$xhtml_slash>";
-}
-
-/**
- * Processes a string of HTML attributes.
- *
- * @return
- *   Cleaned up version of the HTML attributes.
- */
-function _filter_xss_attributes($attr) {
-  $attrarr = array();
-  $mode = 0;
-  $attrname = '';
-
-  while (strlen($attr) != 0) {
-    // Was the last operation successful?
-    $working = 0;
-
-    switch ($mode) {
-      case 0:
-        // Attribute name, href for instance
-        if (preg_match('/^([-a-zA-Z]+)/', $attr, $match)) {
-          $attrname = strtolower($match[1]);
-          $skip = ($attrname == 'style' || substr($attrname, 0, 2) == 'on');
-          $working = $mode = 1;
-          $attr = preg_replace('/^[-a-zA-Z]+/', '', $attr);
-        }
-
-        break;
-
-      case 1:
-        // Equals sign or valueless ("selected")
-        if (preg_match('/^\s*=\s*/', $attr)) {
-          $working = 1; $mode = 2;
-          $attr = preg_replace('/^\s*=\s*/', '', $attr);
-          break;
-        }
-
-        if (preg_match('/^\s+/', $attr)) {
-          $working = 1; $mode = 0;
-          if (!$skip) {
-            $attrarr[] = $attrname;
-          }
-          $attr = preg_replace('/^\s+/', '', $attr);
-        }
-
-        break;
-
-      case 2:
-        // Attribute value, a URL after href= for instance
-        if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match)) {
-          $thisval = filter_xss_bad_protocol($match[1]);
-
-          if (!$skip) {
-            $attrarr[] = "$attrname=\"$thisval\"";
-          }
-          $working = 1;
-          $mode = 0;
-          $attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);
-          break;
-        }
-
-        if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match)) {
-          $thisval = filter_xss_bad_protocol($match[1]);
-
-          if (!$skip) {
-            $attrarr[] = "$attrname='$thisval'";;
-          }
-          $working = 1; $mode = 0;
-          $attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);
-          break;
-        }
-
-        if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match)) {
-          $thisval = filter_xss_bad_protocol($match[1]);
-
-          if (!$skip) {
-            $attrarr[] = "$attrname=\"$thisval\"";
-          }
-          $working = 1; $mode = 0;
-          $attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);
-        }
-
-        break;
-    }
-
-    if ($working == 0) {
-      // not well formed, remove and try again
-      $attr = preg_replace('/
-        ^
-        (
-        "[^"]*("|$)     # - a string that starts with a double quote, up until the next double quote or the end of the string
-        |               # or
-        \'[^\']*(\'|$)| # - a string that starts with a quote, up until the next quote or the end of the string
-        |               # or
-        \S              # - a non-whitespace character
-        )*              # any number of the above three
-        \s*             # any number of whitespaces
-        /x', '', $attr);
-      $mode = 0;
-    }
-  }
-
-  // the attribute list ends with a valueless attribute like "selected"
-  if ($mode == 1) {
-    $attrarr[] = $attrname;
-  }
-  return $attrarr;
-}
-
-/**
- * Processes an HTML attribute value and ensures it does not contain an URL
- * with a disallowed protocol (e.g. javascript:)
- *
- * @param $string
- *   The string with the attribute value.
- * @param $decode
- *   Whether to decode entities in the $string. Set to FALSE if the $string
- *   is in plain text, TRUE otherwise. Defaults to TRUE.
- * @return
- *   Cleaned up and HTML-escaped version of $string.
- */
-function filter_xss_bad_protocol($string, $decode = TRUE) {
-  static $allowed_protocols;
-  if (!isset($allowed_protocols)) {
-    $allowed_protocols = array_flip(variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal')));
-  }
-
-  // Get the plain text representation of the attribute value (i.e. its meaning)
-  if ($decode) {
-    $string = decode_entities($string);
-  }
-  // Remove soft hyphen
-  $string = str_replace(chr(194) . chr(173), '', $string);
-  // Strip protocols
-
-  do {
-    $before = $string;
-    $colonpos = strpos($string, ':');
-    if ($colonpos > 0) {
-      $protocol = substr($string, 0, $colonpos);
-      if (!isset($allowed_protocols[$protocol])) {
-        $string = substr($string, $colonpos + 1);
-      }
-    }
-  } while ($before != $string);
-  return check_plain($string);
-}
-
-/**
- * @} End of "Standard filters".
- */
-
diff --git a/modules/forum.module b/modules/forum.module
deleted file mode 100644 (file)
index 6d5fe65..0000000
+++ /dev/null
@@ -1,1126 +0,0 @@
-<?php
-// $Id: forum.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enable threaded discussions about general topics.
- */
-
-/**
- * Implementation of hook_help().
- */
-function forum_help($section) {
-  switch ($section) {
-    case 'admin/help#forum':
-      $output = '<p>'. t('The forum module lets you create threaded discussion forums for a particular topic on your site. This is similar to a message board system such as phpBB. Forums are very useful because they allow community members to discuss topics with one another, and they are archived for future reference.') .'</p>';
-      $output .= '<p>'. t('Forums can be organized under what are called <em>containers</em>. Containers hold forums and, in turn, forums hold threaded discussions. Both containers and forums can be placed inside other containers and forums. By planning the structure of your containers and forums well, you make it easier for users to find a topic area of interest to them.  Forum topics can be moved by selecting a different forum and can be left in the existing forum by selecting <em>leave a shadow copy</em>.  Forum topics can also have their own URL.') .'</p>';
-      $output .= '<p>'. t('Forums module <strong>requires Taxonomy and Comments module</strong> be enabled.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>administer forums at <a href="%admin-forum">administer &gt;&gt; forums</a>.</li>
-<li>enable the required comment and taxonomy modules at <a href="%admin-modules">administer &gt;&gt; modules</a>.</li>
-<li>read about the comment module at <a href="%admin-help-comment">administer &gt;&gt; help &gt;&gt; comment</a>.</li>
-<li>read about the taxonomy module at <a href="%admin-help-taxonomy">administer &gt;&gt; help &gt;&gt; taxonomy</a>.</li>
-</ul>
-', array('%admin-forum' => url('admin/forum'), '%admin-modules' => url('admin/modules'), '%admin-help-comment' => url('admin/help/comment'), '%admin-help-taxonomy' => url('admin/help/taxonomy')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%forum">Forum page</a>.', array('%forum' => 'http://drupal.org/handbook/modules/forum/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Enables threaded discussions about general topics.');
-    case 'admin/forum':
-      return t('<p>This is a list of existing containers and forums that you can edit. Containers hold forums and, in turn, forums hold threaded discussions. Both containers and forums can be placed inside other containers and forums. By planning the structure of your containers and forums well, you make it easier for users to find a topic area of interest to them.</p>');
-    case 'admin/forum/add/container':
-      return t('<p>Containers help you organize your forums. The job of a container is to hold, or contain, other forums that are related. For example, a container named "Food" might hold two forums named "Fruit" and "Vegetables".</p>');
-    case 'admin/forum/add/forum':
-      return t('<p>A forum holds discussion topics that are related. For example, a forum named "Fruit" might contain topics titled "Apples" and "Bananas".</p>');
-    case 'admin/forum/configure':
-      return t('This is where you can configure system-wide options for how your forums act and display.');
-    case 'node/add#forum':
-      return t('Create a new topic for discussion in the forums.');
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function forum_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'node/add/forum',
-      'title' => t('forum topic'),
-      'access' => user_access('create forum topics'));
-    $items[] = array('path' => 'forum',
-      'title' => t('forums'),
-      'callback' => 'forum_page',
-      'access' => user_access('access content'),
-      'type' => MENU_SUGGESTED_ITEM);
-    $items[] = array('path' => 'admin/forum',
-      'title' => t('forums'),
-      'callback' => 'forum_overview',
-      'access' => user_access('administer forums'),
-      'type' => MENU_NORMAL_ITEM);
-    $items[] = array('path' => 'admin/forum/list',
-      'title' => t('list'),
-      'access' => user_access('administer forums'),
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-      'weight' => -10);
-    $items[] = array('path' => 'admin/forum/add/container',
-      'title' => t('add container'),
-      'callback' => 'forum_form_container',
-      'access' => user_access('administer forums'),
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/forum/add/forum',
-      'title' => t('add forum'),
-      'callback' => 'forum_form_forum',
-      'access' => user_access('administer forums'),
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/forum/configure',
-      'title' => t('configure'),
-      'callback' => 'forum_admin_configure',
-      'access' => user_access('administer forums'),
-      'type' => MENU_LOCAL_TASK);
-  }
-  elseif (is_numeric(arg(4))) {
-    $term = taxonomy_get_term(arg(4));
-    // Check if this is a valid term.
-    if ($term) {
-      $items[] = array('path' => 'admin/forum/edit/container',
-        'title' => t('edit container'),
-        'callback' => 'forum_form_container',
-        'callback arguments' => array((array)$term),
-        'access' => user_access('administer forums'),
-        'type' => MENU_CALLBACK);
-      $items[] = array('path' => 'admin/forum/edit/forum',
-        'title' => t('edit forum'),
-        'callback' => 'forum_form_forum',
-        'callback arguments' => array((array)$term),
-        'access' => user_access('administer forums'),
-        'type' => MENU_CALLBACK);
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_node_info().
- */
-function forum_node_info() {
-  return array('forum' => array('name' => t('forum topic'), 'base' => 'forum'));
-}
-
-/**
- * Implementation of hook_access().
- */
-function forum_access($op, $node) {
-  global $user;
-
-  if ($op == 'create') {
-    return user_access('create forum topics');
-  }
-
-  if ($op == 'update' || $op == 'delete') {
-    if (user_access('edit own forum topics') && ($user->uid == $node->uid)) {
-      return TRUE;
-    }
-  }
-}
-
-/**
- * Implementation of hook_perm().
- */
-function forum_perm() {
-  return array('create forum topics', 'edit own forum topics', 'administer forums');
-}
-
-/**
- * Implementation of hook_nodeapi().
- */
-function forum_nodeapi(&$node, $op, $teaser, $page) {
-  switch ($op) {
-    case 'delete revision':
-      db_query('DELETE FROM {forum} WHERE vid = %d', $node->vid);
-      break;
-  }
-}
-
-/**
- * Implementation of hook_taxonomy().
- */
-function forum_taxonomy($op, $type, $term = NULL) {
-  if ($op == 'delete' && $term['vid'] == _forum_get_vid()) {
-    switch ($type) {
-      case 'term':
-        $results = db_query('SELECT f.nid FROM {forum} f WHERE f.tid = %d', $term['tid']);
-        while ($node = db_fetch_object($results)) {
-          // node_delete will also remove any association with non-forum vocabularies.
-          node_delete($node->nid);
-        }
-
-        // For containers, remove the tid from the forum_containers variable.
-        $containers = variable_get('forum_containers', array());
-        $key = array_search($term['tid'], $containers);
-        if ($key !== FALSE) {
-          unset($containers[$key]);
-        }
-        variable_set('forum_containers', $containers);
-        break;
-      case 'vocabulary':
-        variable_del('forum_nav_vocabulary');
-    }
-  }
-}
-
-/**
- * Implementation of hook_settings
- */
-function forum_admin_configure() {
-
-  $form = array();
-  $number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400, 500));
-  $form['forum_hot_topic'] = array('#type' => 'select',
-    '#title' => t('Hot topic threshold'),
-    '#default_value' => variable_get('forum_hot_topic', 15),
-    '#options' => $number,
-    '#description' => t('The number of posts a topic must have to be considered hot.'),
-  );
-  $number = drupal_map_assoc(array(10, 25, 50, 75, 100));
-  $form['forum_per_page'] = array('#type' => 'select',
-    '#title' => t('Topics per page'),
-    '#default_value' => variable_get('forum_per_page', 25),
-    '#options' => $number,
-    '#description' => t('The default number of topics displayed per page; links to browse older messages are automatically being displayed.'),
-  );
-  $forder = array(1 => t('Date - newest first'), 2 => t('Date - oldest first'), 3 => t('Posts - most active first'), 4=> t('Posts - least active first'));
-  $form['forum_order'] = array('#type' => 'radios',
-    '#title' => t('Default order'),
-    '#default_value' => variable_get('forum_order', '1'),
-    '#options' => $forder,
-    '#description' => t('The default display order for topics.'),
-  );
-
-  return system_settings_form('forum_admin_configure', $form);
-}
-
-/**
- * Implementation of hook_form_alter().
- */
-function forum_form_alter($form_id, &$form) {
-  // hide critical options from forum vocabulary
-  if ($form_id == 'taxonomy_form_vocabulary') {
-    if ($form['vid']['#value'] == _forum_get_vid()) {
-      $form['help_forum_vocab'] = array(
-        '#value' => t('This is the designated forum vocabulary. Some of the normal vocabulary options have been removed.'),
-        '#weight' => -1,
-      );
-      $form['nodes']['forum'] = array('#type' => 'checkbox', '#value' => 1, '#title' => t('forum topic'), '#attributes' => array('disabled' => '' ), '#description' => t('forum topic is affixed to the forum vocabulary.'));
-      $form['hierarchy'] = array('#type' => 'value', '#value' => 1);
-      unset($form['relations']);
-      unset($form['tags']);
-      unset($form['multiple']);
-      $form['required'] = array('#type' => 'value', '#value' => 1);
-    }
-    else {
-      unset($form['nodes']['forum']);
-    }
-  }
-}
-
-/**
- * Implementation of hook_load().
- */
-function forum_load($node) {
-  $forum = db_fetch_object(db_query('SELECT * FROM {forum} WHERE vid = %d', $node->vid));
-
-  return $forum;
-}
-
-/**
- * Implementation of hook_block().
- *
- * Generates a block containing the currently active forum topics and the
- * most recently added forum topics.
- */
-function forum_block($op = 'list', $delta = 0, $edit = array()) {
-  switch ($op) {
-    case 'list':
-      $blocks[0]['info'] = t('Active forum topics');
-      $blocks[1]['info'] = t('New forum topics');
-      return $blocks;
-
-    case 'configure':
-      $form['forum_block_num_'. $delta] = array('#type' => 'select', '#title' => t('Number of topics'), '#default_value' => variable_get('forum_block_num_'. $delta, '5'), '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
-      return $form;
-
-    case 'save':
-      variable_set('forum_block_num_'. $delta, $edit['forum_block_num_'. $delta]);
-      break;
-
-    case 'view':
-      if (user_access('access content')) {
-        switch ($delta) {
-          case 0:
-            $title = t('Active forum topics');
-            $sql = db_rewrite_sql("SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND n.type = 'forum' ORDER BY l.last_comment_timestamp DESC");
-            $result = db_query_range($sql, 0, variable_get('forum_block_num_0', '5'));
-            if (db_num_rows($result)) {
-              $content = node_title_list($result);
-            }
-            break;
-
-          case 1:
-            $title = t('New forum topics');
-            $sql = db_rewrite_sql("SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.type = 'forum' AND n.status = 1 ORDER BY n.nid DESC");
-            $result = db_query_range($sql, 0, variable_get('forum_block_num_1', '5'));
-            if (db_num_rows($result)) {
-              $content = node_title_list($result);
-            }
-            break;
-        }
-
-        if ($content) {
-          $content .= '<div class="more-link">'. l(t('more'), 'forum', array('title' => t('Read the latest forum topics.'))) .'</div>';
-        }
-
-        $block['subject'] = $title;
-        $block['content'] = $content;
-
-        return $block;
-      }
-  }
-}
-
-/**
- * Implementation of hook_view().
- */
-function forum_view(&$node, $teaser = FALSE, $page = FALSE) {
-  if ($page) {
-    $vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', ''));
-    // Breadcrumb navigation
-    $breadcrumb = array();
-    $breadcrumb[] = array('path' => 'forum', 'title' => $vocabulary->name);
-    if ($parents = taxonomy_get_parents_all($node->tid)) {
-      $parents = array_reverse($parents);
-      foreach ($parents as $p) {
-        $breadcrumb[] = array('path' => 'forum/'. $p->tid, 'title' => $p->name);
-      }
-    }
-    $breadcrumb[] = array('path' => 'node/'. $node->nid);
-    menu_set_location($breadcrumb);
-  }
-
-  $node = node_prepare($node, $teaser);
-
-  $node->body .= theme('forum_topic_navigation', $node);
-}
-
-/**
- * Implementation of hook_submit().
- *
- * Check in particular that only a "leaf" term in the associated taxonomy
- * vocabulary is selected, not a "container" term.
- */
-function forum_submit(&$node) {
-  // Make sure all fields are set properly:
-  $node->icon = $node->icon ? $node->icon : '';
-
-  if ($node->taxonomy) {
-    // Extract the node's proper topic ID.
-    $vocabulary = variable_get('forum_nav_vocabulary', '');
-    foreach ($node->taxonomy as $term) {
-      if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
-        $node->tid = $term;
-      }
-    }
-    if ($node->tid && $node->shadow) {
-      // A shadow copy needs to be created. Retain existing term and add new term.
-      $terms = array_keys(taxonomy_node_get_terms($node->nid));
-      if (!in_array($node->tid, $terms)) {
-        $terms[] = $node->tid;
-      }
-      $node->taxonomy = $terms;
-    }
-  }
-}
-
-/**
- * Implementation of hook_validate().
- *
- * Check in particular that only a "leaf" term in the associated taxonomy
- * vocabulary is selected, not a "container" term.
- */
-function forum_validate($node) {
-  if ($node->taxonomy) {
-    // Extract the node's proper topic ID.
-    $vocabulary = variable_get('forum_nav_vocabulary', '');
-    $containers = variable_get('forum_containers', array());
-    foreach ($node->taxonomy as $term) {
-      if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
-        if (in_array($term, $containers)) {
-          $term = taxonomy_get_term($term);
-          form_set_error('taxonomy', t('The item %forum is only a container for forums. Please select one of the forums below it.', array('%forum' => theme('placeholder', $term->name))));
-        }
-      }
-    }
-  }
-}
-
-/**
- * Implementation of hook_update().
- */
-function forum_update($node) {
-  if ($node->revision) {
-    db_query("INSERT INTO {forum} (nid, vid, tid) VALUES (%d, %d, %d)", $node->nid, $node->vid, $node->tid);
-  }
-  else {
-    db_query('UPDATE {forum} SET tid = %d WHERE vid = %d', $node->tid, $node->vid);
-  }
-}
-
-/**
- * Implementation of hook_form().
- */
-function forum_form(&$node) {
-  $form['title'] = array('#type' => 'textfield', '#title' => t('Subject'), '#default_value' => $node->title, '#required' => TRUE, '#weight' => -5);
-
-  if ($node->nid) {
-    $forum_terms = taxonomy_node_get_terms_by_vocabulary(_forum_get_vid(), $node->nid);
-    // if editing, give option to leave shadows
-    $shadow = (count($forum_terms) > 1);
-    $form['shadow'] = array('#type' => 'checkbox', '#title' => t('Leave shadow copy'), '#default_value' => $shadow, '#description' => t('If you move this topic, you can leave a link in the old forum to the new forum.'));
-  }
-
-  $form['body_filter']['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE);
-  $form['body_filter']['format'] = filter_form($node->format);
-
-  return $form;
-}
-
-/**
- * Implementation of hook_prepare; assign forum taxonomy when adding a topic from within a forum.
- */
-function forum_prepare(&$node) {
-  if (!$node->nid) {
-    // new topic
-    $node->taxonomy[arg(3)]->vid = _forum_get_vid();
-    $node->taxonomy[arg(3)]->tid = arg(3);
-  }
-}
-
-/**
- * Implementation of hook_insert().
- */
-function forum_insert($node) {
-  db_query('INSERT INTO {forum} (nid, vid, tid) VALUES (%d, %d, %d)', $node->nid, $node->vid, $node->tid);
-}
-
-/**
- * Implementation of hook_delete().
- */
-function forum_delete(&$node) {
-  db_query('DELETE FROM {forum} WHERE nid = %d', $node->nid);
-}
-
-/**
- * Returns a form for adding a container to the forum vocabulary
- *
- * @param $edit Associative array containing a container term to be added or edited.
- */
-function forum_form_container($edit = array()) {
-  // Handle a delete operation.
-  if ($_POST['op'] == t('Delete') || $_POST['edit']['confirm']) {
-    return _forum_confirm_delete($edit['tid']);
-  }
-
-  $form['name'] = array(
-    '#title' => t('Container name'),
-    '#type' => 'textfield',
-    '#default_value' => $edit['name'],
-    '#maxlength' =>  64,
-    '#description' => t('The container name is used to identify related forums.'),
-    '#required' => TRUE
-  );
-
-  $form['description'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Description'),
-    '#default_value' => $edit['description'],
-    '#description' => t('The container description can give users more information about the forums it contains.')
-  );
-  $form['parent']['#tree'] = TRUE;
-  $form['parent'][0] = _forum_parent_select($edit['tid'], t('Parent'), 'container');
-  $form['weight'] = array('#type' => 'weight',
-    '#title' => t('Weight'),
-    '#default_value' => $edit['weight'],
-    '#description' => t('When listing containers, those with with light (small) weights get listed before containers with heavier (larger) weights. Containers with equal weights are sorted alphabetically.')
-  );
-
-  $form['vid'] = array('#type' => 'hidden',
-    '#value' => _forum_get_vid());
-  $form['submit'] = array(
-    '#type' => 'submit',
-    '#value' => t('Submit')
-  );
-  if ($edit['tid']) {
-    $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
-    $form['tid'] = array('#type' => 'value', '#value' => $edit['tid']);
-  }
-
-  return drupal_get_form('forum_form_container', $form, 'forum_form');
-}
-
-/**
- * Returns a form for adding a forum to the forum vocabulary
- *
- * @param $edit Associative array containing a forum term to be added or edited.
- */
-function forum_form_forum($edit = array()) {
-  // Handle a delete operation.
-  if ($_POST['op'] == t('Delete') || $_POST['edit']['confirm']) {
-    return _forum_confirm_delete($edit['tid']);
-  }
-
-  $form['name'] = array('#type' => 'textfield',
-    '#title' => t('Forum name'),
-    '#default_value' => $edit['name'],
-    '#maxlength' =>  64,
-    '#description' => t('The forum name is used to identify related discussions.'),
-    '#required' => TRUE,
-  );
-  $form['description'] = array('#type' => 'textarea',
-    '#title' => t('Description'),
-    '#default_value' => $edit['description'],
-    '#description' => t('The forum description can give users more information about the discussion topics it contains.'),
-  );
-  $form['parent']['#tree'] = TRUE;
-  $form['parent'][0] = _forum_parent_select($edit['tid'], t('Parent'), 'forum');
-  $form['weight'] = array('#type' => 'weight',
-    '#title' => t('Weight'),
-    '#default_value' => $edit['weight'],
-    '#description' => t('When listing forums, those with lighter (smaller) weights get listed before containers with heavier (larger) weights. Forums with equal weights are sorted alphabetically.'),
-  );
-
-  $form['vid'] = array('#type' => 'hidden', '#value' => _forum_get_vid());
-  $form['submit' ] = array('#type' => 'submit', '#value' => t('Submit'));
-  if ($edit['tid']) {
-    $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
-    $form['tid'] = array('#type' => 'hidden', '#value' => $edit['tid']);
-  }
-
-  return drupal_get_form('forum_form_forum', $form, 'forum_form');
-}
-
-/**
- * Process forum form and container form submissions.
- */
-function forum_form_submit($form_id, $form_values) {
-  if ($form_id == 'forum_form_container') {
-    $container = TRUE;
-    $type = t('forum container');
-  }
-  else {
-    $container = false;
-    $type = t('forum');
-  }
-
-  $status = taxonomy_save_term($form_values);
-  switch ($status) {
-    case SAVED_NEW:
-      if ($container) {
-        $containers = variable_get('forum_containers', array());
-        $containers[] = $form_values['tid'];
-        variable_set('forum_containers', $containers);
-      }
-      drupal_set_message(t('Created new %type %term.', array('%term' => theme('placeholder', $form_values['name']), '%type' => $type)));
-      break;
-    case SAVED_UPDATED:
-      drupal_set_message(t('The %type %term has been updated.', array('%term' => theme('placeholder', $form_values['name']), '%type' => $type)));
-      break;
-  }
-  return 'admin/forum';
-}
-
-/**
- * Returns a confirmation page for deleting a forum taxonomy term.
- *
- * @param $tid ID of the term to be deleted
- */
-function _forum_confirm_delete($tid) {
-  $term = taxonomy_get_term($tid);
-
-  $form['tid'] = array('#type' => 'value', '#value' => $tid);
-  $form['name'] = array('#type' => 'value', '#value' => $term->name);
-
-  return confirm_form('forum_confirm_delete', $form, t('Are you sure you want to delete the forum %name?', array('%name' => theme('placeholder', $term->name))), 'admin/forums', t('Deleting a forum or container will delete all sub-forums and associated posts as well. This action cannot be undone.'), t('Delete'), t('Cancel'));
-}
-
-/**
- * Implementation of forms api _submit call. Deletes a forum after confirmation.
- */
-function forum_confirm_delete_submit($form_id, $form_values) {
-  taxonomy_del_term($form_values['tid']);
-  drupal_set_message(t('The forum %term and all sub-forums and associated posts have been deleted.', array('%term' => theme('placeholder', $form_values['name']))));
-  watchdog('content', t('forum: deleted %term and all its sub-forums and associated posts.', array('%term' => theme('placeholder', $form_values['name']))));
-
-  return 'admin/forum';
-}
-
-/**
- * Returns an overview list of existing forums and containers
- */
-function forum_overview() {
-  $header = array(t('Name'), t('Operations'));
-
-  $tree = taxonomy_get_tree(_forum_get_vid());
-  if ($tree) {
-    foreach ($tree as $term) {
-      if (in_array($term->tid, variable_get('forum_containers', array()))) {
-        $rows[] = array(_taxonomy_depth($term->depth) .' '. check_plain($term->name), l(t('edit container'), "admin/forum/edit/container/$term->tid"));
-      }
-      else {
-        $rows[] = array(_taxonomy_depth($term->depth) .' '. check_plain($term->name), l(t('edit forum'), "admin/forum/edit/forum/$term->tid"));
-       }
-
-    }
-  }
-  else {
-    $rows[] = array(array('data' => '<em>' . t('There are no existing containers or forums. You may add some on the <a href="%container">add container</a> or <a href="%forum">add forum</a> pages.', array('%container' => url('admin/forum/add/container'), '%forum' => url('admin/forum/add/forum'))) . '</em>', 'colspan' => 2));
-  }
-  return theme('table', $header, $rows);
-}
-
-/**
- * Returns a select box for available parent terms
- *
- * @param $tid ID of the term which is being added or edited
- * @param $title Title to display the select box with
- * @param $child_type Whether the child is forum or container
- */
-function _forum_parent_select($tid, $title, $child_type) {
-
-  $parents = taxonomy_get_parents($tid);
-  if ($parents) {
-    $parent = array_shift($parents);
-    $parent = $parent->tid;
-  }
-  else {
-    $parent = 0;
-  }
-
-  $children = taxonomy_get_tree(_forum_get_vid(), $tid);
-
-  // A term can't be the child of itself, nor of its children.
-  foreach ($children as $child) {
-    $exclude[] = $child->tid;
-  }
-  $exclude[] = $tid;
-
-  $tree = taxonomy_get_tree(_forum_get_vid());
-  $options[0] = '<'. t('root') .'>';
-  if ($tree) {
-    foreach ($tree as $term) {
-      if (!in_array($term->tid, $exclude)) {
-        $options[$term->tid] = _taxonomy_depth($term->depth) . $term->name;
-      }
-    }
-  }
-  if ($child_type == 'container') {
-    $description = t('Containers are usually placed at the top (root) level of your forum but you can also place a container inside a parent container or forum.');
-  }
-  else if ($child_type == 'forum') {
-    $description = t('You may place your forum inside a parent container or forum, or at the top (root) level of your forum.');
-  }
-
-  return array('#type' => 'select', '#title' => $title, '#default_value' => $parent, '#options' => $options, '#description' => $description, '#required' => TRUE);
-}
-
-function forum_term_path($term) {
-  return 'forum/'. $term->tid;
-}
-
-/**
- * Returns the vocabulary id for forum navigation.
- */
-function _forum_get_vid() {
-  $vid = variable_get('forum_nav_vocabulary', '');
-  if (empty($vid)) {
-    // Check to see if a forum vocabulary exists
-    $vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module = '%s'", 'forum'));
-    if (!$vid) {
-      $edit = array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum' => 1));
-      taxonomy_save_vocabulary($edit);
-      $vid = $edit['vid'];
-    }
-    variable_set('forum_nav_vocabulary', $vid);
-  }
-
-  return $vid;
-}
-
-/**
- * Formats a topic for display
- *
- * @TODO Give a better description. Not sure where this function is used yet.
- */
-function _forum_format($topic) {
-  if ($topic && $topic->timestamp) {
-    return t('%time ago<br />by %author', array('%time' => format_interval(time() - $topic->timestamp), '%author' => theme('username', $topic)));
-  }
-  else {
-    return message_na();
-  }
-}
-
-/**
- * Returns a list of all forums for a given taxonomy id
- *
- * Forum objects contain the following fields
- * -num_topics Number of topics in the forum
- * -num_posts Total number of posts in all topics
- * -last_post Most recent post for the forum
- *
- * @param $tid
- *   Taxonomy ID of the vocabulary that holds the forum list.
- * @return
- *   Array of object containing the forum information.
- */
-function forum_get_forums($tid = 0) {
-
-  $forums = array();
-  $_forums = taxonomy_get_tree(variable_get('forum_nav_vocabulary', ''), $tid);
-
-  if (count($_forums)) {
-
-    $counts = array();
-
-    $sql = "SELECT r.tid, COUNT(n.nid) AS topic_count, SUM(l.comment_count) AS comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid WHERE n.status = 1 AND n.type = 'forum' GROUP BY r.tid";
-    $sql = db_rewrite_sql($sql);
-    $_counts = db_query($sql, $forum->tid);
-    while ($count = db_fetch_object($_counts)) {
-      $counts[$count->tid] = $count;
-    }
-  }
-
-  foreach ($_forums as $forum) {
-    if (in_array($forum->tid, variable_get('forum_containers', array()))) {
-      $forum->container = 1;
-    }
-
-    if ($counts[$forum->tid]) {
-      $forum->num_topics = $counts[$forum->tid]->topic_count;
-      $forum->num_posts = $counts[$forum->tid]->topic_count + $counts[$forum->tid]->comment_count;
-    }
-    else {
-      $forum->num_topics = 0;
-      $forum->num_posts = 0;
-    }
-
-    // This query does not use full ANSI syntax since MySQL 3.x does not support
-    // table1 INNER JOIN table2 INNER JOIN table3 ON table2_criteria ON table3_criteria
-    // used to join node_comment_statistics to users.
-    $sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {users} u1 ON n.uid = u1.uid INNER JOIN {term_node} tn ON n.nid = tn.nid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {users} u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC";
-    $sql = db_rewrite_sql($sql);
-    $topic = db_fetch_object(db_query_range($sql, $forum->tid, 0, 1));
-
-    $last_post = new StdClass();
-    $last_post->timestamp = $topic->last_comment_timestamp;
-    $last_post->name = $topic->last_comment_name;
-    $last_post->uid = $topic->last_comment_uid;
-    $forum->last_post = $last_post;
-
-    $forums[$forum->tid] = $forum;
-  }
-
-  return $forums;
-}
-
-/**
- * Calculate the number of nodes the user has not yet read and are newer
- * than NODE_NEW_LIMIT.
- */
-function _forum_topics_unread($term, $uid) {
-  $sql = "SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid AND tn.tid = %d LEFT JOIN {history} h ON n.nid = h.nid AND h.uid = %d WHERE n.status = 1 AND n.type = 'forum' AND n.created > %d AND h.nid IS NULL";
-  $sql = db_rewrite_sql($sql);
-  return db_result(db_query($sql, $term, $uid, NODE_NEW_LIMIT));
-}
-
-function forum_get_topics($tid, $sortby, $forum_per_page) {
-  global $user, $forum_topic_list_header;
-
-  $forum_topic_list_header = array(
-    array('data' => '&nbsp;'),
-    array('data' => t('Topic'), 'field' => 'n.title'),
-    array('data' => t('Replies'), 'field' => 'l.comment_count'),
-    array('data' => t('Created'), 'field' => 'n.created'),
-    array('data' => t('Last reply'), 'field' => 'l.last_comment_timestamp'),
-  );
-
-  $order = _forum_get_topic_order($sortby);
-  for ($i = 0; $i < count($forum_topic_list_header); $i++) {
-    if ($forum_topic_list_header[$i]['field'] == $order['field']) {
-      $forum_topic_list_header[$i]['sort'] = $order['sort'];
-    }
-  }
-
-  $term = taxonomy_get_term($tid);
-
-  $sql = db_rewrite_sql("SELECT n.nid, f.tid, n.title, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments FROM {node_comment_statistics} l, {users} cu, {term_node} r, {users} u, {forum} f, {node} n WHERE n.status = 1 AND l.last_comment_uid = cu.uid AND n.nid = l.nid AND n.nid = r.nid AND r.tid = %d AND n.uid = u.uid AND n.vid = f.vid");
-  $sql .= tablesort_sql($forum_topic_list_header, 'n.sticky DESC,');
-  $sql .= ', n.created DESC';  // Always add a secondary sort order so that the news forum topics are on top.
-
-  $sql_count = db_rewrite_sql("SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND n.type = 'forum'");
-
-  $result = pager_query($sql, $forum_per_page, 0, $sql_count, $tid);
-
-  while ($topic = db_fetch_object($result)) {
-    if ($user->uid) {
-      // folder is new if topic is new or there are new comments since last visit
-      if ($topic->tid != $tid) {
-        $topic->new = 0;
-      }
-      else {
-        $history = _forum_user_last_visit($topic->nid);
-        $topic->new_replies = comment_num_new($topic->nid, $history);
-        $topic->new = $topic->new_replies || ($topic->timestamp > $history);
-      }
-    }
-    else {
-      // Do not track "new replies" status for topics if the user is anonymous.
-      $topic->new_replies = 0;
-      $topic->new = 0;
-    }
-
-    if ($topic->num_comments > 0) {
-      $last_reply = new StdClass();
-      $last_reply->timestamp = $topic->last_comment_timestamp;
-      $last_reply->name = $topic->last_comment_name;
-      $last_reply->uid = $topic->last_comment_uid;
-      $topic->last_reply = $last_reply;
-    }
-    $topics[] = $topic;
-  }
-
-  return $topics;
-}
-
-/**
- * Finds the first unread node for a given forum.
- */
-function _forum_new($tid) {
-  global $user;
-
-  $sql = "SELECT n.nid FROM {node} n LEFT JOIN {history} h ON n.nid = h.nid AND h.uid = %d INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND n.type = 'forum' AND h.nid IS NULL AND n.created > %d ORDER BY created";
-  $sql = db_rewrite_sql($sql);
-  $nid = db_result(db_query_range($sql, $user->uid, $tid, NODE_NEW_LIMIT, 0, 1));
-
-  return $nid ? $nid : 0;
-}
-
-/**
- * Menu callback; prints a forum listing.
- */
-function forum_page($tid = 0) {
-  if (module_exist('taxonomy') && module_exist('comment')) {
-    $forum_per_page = variable_get('forum_per_page', 25);
-    $sortby = variable_get('forum_order', 1);
-
-    $forums = forum_get_forums($tid);
-    $parents = taxonomy_get_parents_all($tid);
-    if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
-      $topics = forum_get_topics($tid, $sortby, $forum_per_page);
-    }
-
-    return theme('forum_display', $forums, $topics, $parents, $tid, $sortby, $forum_per_page);
-  }
-  else {
-    drupal_set_message(t('The forum module requires both the taxonomy module and the comment module to be enabled and configured.'), 'error');
-    return ' ';
-  }
-}
-
-/**
- * Format the forum body.
- *
- * @ingroup themeable
- */
-function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page) {
-  global $user;
-  // forum list, topics list, topic browser and 'add new topic' link
-
-  $vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', ''));
-  $title = $vocabulary->name;
-
-  // Breadcrumb navigation:
-  $breadcrumb = array();
-  if ($tid) {
-    $breadcrumb[] = array('path' => 'forum', 'title' => $title);
-  }
-
-  if ($parents) {
-    $parents = array_reverse($parents);
-    foreach ($parents as $p) {
-      if ($p->tid == $tid) {
-        $title = $p->name;
-      }
-      else {
-        $breadcrumb[] = array('path' => 'forum/'. $p->tid, 'title' => $p->name);
-      }
-    }
-  }
-
-  drupal_set_title($title);
-
-  $breadcrumb[] = array('path' => $_GET['q']);
-  menu_set_location($breadcrumb);
-
-  if (count($forums) || count($parents)) {
-    $output  = '<div id="forum">';
-    $output .= '<ul>';
-
-    if (module_exist('tracker')) {
-      if ($user->uid) {
-        $output .= ' <li>'. l(t('My discussions.'), "tracker/$user->uid") .'</li>';
-      }
-
-      $output .= ' <li>'. l(t('Active discussions.'), 'tracker') .'</li>';
-    }
-
-    if (user_access('create forum topics')) {
-      $output .= '<li>'. l(t('Post new forum topic.'), "node/add/forum/$tid") .'</li>';
-    }
-    else if ($user->uid) {
-      $output .= '<li>'. t('You are not allowed to post a new forum topic.') .'</li>';
-    }
-    else {
-      $output .= '<li>'. t('<a href="%login">Login</a> to post a new forum topic.', array('%login' => url('user/login'))) .'</li>';
-    }
-    $output .= '</ul>';
-
-    $output .= theme('forum_list', $forums, $parents, $tid);
-
-    if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
-      drupal_add_link(array('rel' => 'alternate',
-                            'type' => 'application/rss+xml',
-                            'title' => 'RSS - '. $title,
-                            'href' => url('taxonomy/term/'. $tid .'/0/feed')));
-
-      $output .= theme('forum_topic_list', $tid, $topics, $sortby, $forum_per_page);
-      $output .= theme('feed_icon', url("taxonomy/term/$tid/0/feed"));
-    }
-    $output .= '</div>';
-  }
-  else {
-    drupal_set_title(t('No forums defined'));
-    $output = '';
-  }
-
-  return $output;
-}
-
-/**
- * Format the forum listing.
- *
- * @ingroup themeable
- */
-function theme_forum_list($forums, $parents, $tid) {
-  global $user;
-
-  if ($forums) {
-
-    $header = array(t('Forum'), t('Topics'), t('Posts'), t('Last post'));
-
-    foreach ($forums as $forum) {
-      if ($forum->container) {
-        $description  = '<div style="margin-left: '. ($forum->depth * 30) ."px;\">\n";
-        $description .= ' <div class="name">'. l($forum->name, "forum/$forum->tid") ."</div>\n";
-
-        if ($forum->description) {
-          $description .= ' <div class="description">'. filter_xss_admin($forum->description) ."</div>\n";
-        }
-        $description .= "</div>\n";
-
-        $rows[] = array(array('data' => $description, 'class' => 'container', 'colspan' => '4'));
-      }
-      else {
-        $new_topics = _forum_topics_unread($forum->tid, $user->uid);
-        $forum->old_topics = $forum->num_topics - $new_topics;
-        if (!$user->uid) {
-          $new_topics = 0;
-        }
-
-        $description  = '<div style="margin-left: '. ($forum->depth * 30) ."px;\">\n";
-        $description .= ' <div class="name">'. l($forum->name, "forum/$forum->tid") ."</div>\n";
-
-        if ($forum->description) {
-          $description .= ' <div class="description">'. filter_xss_admin($forum->description) ."</div>\n";
-        }
-        $description .= "</div>\n";
-
-        $rows[] = array(
-          array('data' => $description, 'class' => 'forum'),
-          array('data' => $forum->num_topics . ($new_topics ? '<br />'. l(format_plural($new_topics, '1 new', '%count new'), "forum/$forum->tid", NULL, NULL, 'new') : ''), 'class' => 'topics'),
-          array('data' => $forum->num_posts, 'class' => 'posts'),
-          array('data' => _forum_format($forum->last_post), 'class' => 'last-reply'));
-      }
-    }
-
-    return theme('table', $header, $rows);
-
-  }
-
-}
-
-/**
- * Format the topic listing.
- *
- * @ingroup themeable
- */
-function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page) {
-  global $forum_topic_list_header;
-
-  if ($topics) {
-
-    foreach ($topics as $topic) {
-      // folder is new if topic is new or there are new comments since last visit
-      if ($topic->tid != $tid) {
-        $rows[] = array(
-          array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
-          array('data' => check_plain($topic->title), 'class' => 'title'),
-          array('data' => l(t('This topic has been moved'), "forum/$topic->tid"), 'colspan' => '3')
-        );
-      }
-      else {
-        $rows[] = array(
-          array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
-          array('data' => l($topic->title, "node/$topic->nid"), 'class' => 'topic'),
-          array('data' => $topic->num_comments . ($topic->new_replies ? '<br />'. l(format_plural($topic->new_replies, '1 new', '%count new'), "node/$topic->nid", NULL, NULL, 'new') : ''), 'class' => 'replies'),
-          array('data' => _forum_format($topic), 'class' => 'created'),
-          array('data' => _forum_format($topic->last_reply), 'class' => 'last-reply')
-        );
-      }
-    }
-  }
-
-  $output .= theme('table', $forum_topic_list_header, $rows);
-  $output .= theme('pager', NULL, $forum_per_page, 0);
-
-  return $output;
-}
-
-/**
- * Format the icon for each individual topic.
- *
- * @ingroup themeable
- */
-function theme_forum_icon($new_posts, $num_posts = 0, $comment_mode = 0, $sticky = 0) {
-
-  if ($num_posts > variable_get('forum_hot_topic', 15)) {
-    $icon = $new_posts ? 'hot-new' : 'hot';
-  }
-  else {
-    $icon = $new_posts ? 'new' : 'default';
-  }
-
-  if ($comment_mode == COMMENT_NODE_READ_ONLY || $comment_mode == COMMENT_NODE_DISABLED) {
-    $icon = 'closed';
-  }
-
-  if ($sticky == 1) {
-    $icon = 'sticky';
-  }
-
-  $output = theme('image', "misc/forum-$icon.png");
-
-  if ($new_posts) {
-    $output = "<a name=\"new\">$output</a>";
-  }
-
-  return $output;
-}
-
-/**
- * Format the next/previous forum topic navigation links.
- *
- * @ingroup themeable
- */
-function theme_forum_topic_navigation($node) {
-  $output = '';
-
-  // get previous and next topic
-  $sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND n.type = 'forum' ORDER BY n.sticky DESC, ". _forum_get_topic_order_sql(variable_get('forum_order', 1));
-  $result = db_query(db_rewrite_sql($sql), $node->tid);
-
-  while ($topic = db_fetch_object($result)) {
-    if ($stop == 1) {
-      $next = new StdClass();
-      $next->nid = $topic->nid;
-      $next->title = $topic->title;
-      break;
-    }
-    if ($topic->nid == $node->nid) {
-      $stop = 1;
-    }
-    else {
-      $prev = new StdClass();
-      $prev->nid = $topic->nid;
-      $prev->title = $topic->title;
-    }
-  }
-
-  if ($prev || $next) {
-    $output .= '<div class="forum-topic-navigation">';
-
-    if ($prev) {
-      $output .= l(t('‹ ') . $prev->title, 'node/'. $prev->nid, array('class' => 'topic-previous', 'title' => t('Go to previous forum topic')));
-    }
-    if ($prev && $next) {
-      // Word break (a is an inline element)
-      $output .= ' ';
-    }
-    if ($next) {
-      $output .= l($next->title . t(' ›'), 'node/'. $next->nid, array('class' => 'topic-next', 'title' => t('Go to next forum topic')));
-    }
-
-    $output .= '</div>';
-  }
-
-  return $output;
-}
-
-function _forum_user_last_visit($nid) {
-  global $user;
-  static $history = array();
-
-  if (empty($history)) {
-    $result = db_query('SELECT nid, timestamp FROM {history} WHERE uid = %d', $user->uid);
-    while ($t = db_fetch_object($result)) {
-      $history[$t->nid] = $t->timestamp > NODE_NEW_LIMIT ? $t->timestamp : NODE_NEW_LIMIT;
-    }
-  }
-  return $history[$nid] ? $history[$nid] : NODE_NEW_LIMIT;
-}
-
-function _forum_get_topic_order($sortby) {
-  switch ($sortby) {
-    case 1:
-      return array('field' => 'l.last_comment_timestamp', 'sort' => 'desc');
-      break;
-    case 2:
-      return array('field' => 'l.last_comment_timestamp', 'sort' => 'asc');
-      break;
-    case 3:
-      return array('field' => 'l.comment_count', 'sort' => 'desc');
-      break;
-    case 4:
-      return array('field' => 'l.comment_count', 'sort' => 'asc');
-      break;
-  }
-}
-
-function _forum_get_topic_order_sql($sortby) {
-  $order = _forum_get_topic_order($sortby);
-  return $order['field'] .' '. $order['sort'];
-}
-
-
diff --git a/modules/help.module b/modules/help.module
deleted file mode 100644 (file)
index 5a8f789..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-<?php
-// $Id: help.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Manages displaying online help.
- */
-
-/**
- * Implementation of hook_menu().
- */
-function help_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $admin_access = user_access('access administration pages');
-
-    $items[] = array('path' => 'admin/help', 'title' => t('help'),
-      'callback' => 'help_main',
-      'access' => $admin_access,
-      'weight' => 9);
-
-    foreach (module_implements('help', TRUE) as $module) {
-      $items[] = array('path' => 'admin/help/' . $module,
-        'title' => t($module),
-        'callback' => 'help_page',
-        'type' => MENU_CALLBACK,
-        'access' => $admin_access);
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Menu callback; prints a page listing a glossary of Drupal terminology.
- */
-function help_main() {
-  $output = t("
-  <h2>Help topics</h2>
-  <p>Help is available on the following items:</p>
-  %help_pages
-  <h2>Glossary of Drupal terminology</h2>
-  <dl>
-   <dt>Block</dt><dd>A small box containing information or content placed in the left-hand or right-hand sidebar of a web page.</dd>
-   <dt>Comment</dt><dd>A note attached to a node. Usually intended to clarify, explain, criticize, or express an opinion on the original material.</dd>
-   <dt>Moderation</dt>
-   <dd>The activity of making sure a post to a Drupal site fits in with what is expected for that Drupal site.
-    <dl>
-     <dt>Approved</dt><dd>A moderated post which has been accepted by the moderators for publication. (See published).</dd>
-     <dt>Waiting</dt><dd>A moderated post which is still being voted on to be accepted for publication. (See published.)</dd>
-    </dl>
-   </dd>
-   <dt>Node</dt><dd>The basic data unit in Drupal. Everything is a node or an extension of a node.</dd>
-   <dt>Public</dt><dd>See published.</dd>
-   <dt>Published</dt><dd>A node that is viewable by everyone. (See unpublished.)</dd>
-   <dt>Role</dt><dd>A classification users are placed into for the purpose of setting users' permissions.</dd>
-   <dt>Taxonomy</dt><dd>A division of a collection of things into ordered, classified groups. (See <a href=\"%taxonomy\">taxonomy help</a>.)</dd>
-   <dt>Unpublished</dt><dd>A node that is only viewable by administrators and moderators.</dd>
-   <dt>User</dt><dd>A person who has an account at your Drupal site, and is logged in with that account.</dd>
-   <dt>Visitor</dt><dd>A person who does not have an account at your Drupal site or a person who has an account at your Drupal site but is <strong>not</strong> logged in with that account. Also termed \"anonymous user\".</dd>
-  </dl>", array('%help_pages' => help_links_as_list(), '%taxonomy' => url('admin/help/taxonomy')));
-
-  return $output;
-}
-
-function help_links_as_list() {
-  $modules = array();
-  foreach (module_implements('help', TRUE) as $module) {
-    if (module_invoke($module, 'help', "admin/help#$module")) {
-      $modules[] = $module;
-    }
-  }
-  sort($modules);
-
-  // Output pretty four-column list
-  $break = ceil(count($modules) / 4);
-  $output = '<div class="help-items"><ul>';
-  foreach ($modules as $i => $module) {
-    $output .= '<li>'. l(t($module), 'admin/help/'. $module) .'</li>';
-    if (($i + 1) % $break == 0) {
-      $output .= '</ul></div><div class="help-items'. ($i + 1 == $break * 3 ? ' help-items-last' : '') .'"><ul>';
-    }
-  }
-  $output .= '</ul></div><br class="clear" />';
-
-  return $output;
-}
-
-/**
- * Implementation of hook_help().
- */
-function help_help($section) {
-  switch ($section) {
-    case 'admin/help':
-      $output = t('<p>This guide explains what the various modules in <a href="%Drupal">Drupal</a> do and how to configure them.</p>
-<p>It is not a substitute for the <a href="%handbook">Drupal handbook</a> available online and should be used in conjunction with it. The online reference handbook might be more up-to-date and has helpful user-contributed comments. It is your definitive reference point for all Drupal documentation.</p>
-', array('%Drupal' => 'http://drupal.org', '%handbook' => 'http://drupal.org/handbook'));
-      return $output;
-    case 'admin/help#help':
-      $output = '<p>'. t('The help module displays context sensitive help information. Users can learn how to use modules and accomplish tasks quicker with less errors by clicking on links in provided by the help module.') .'</p>';
-      $output .= t('<p>Modules can make documentation available to other modules with this module. All user help should be presented using this module.  Some examples of help: </p>
-<ul>
-<li>The name of a module (unused, but there).</li>
-<li>The description found on the admin/system/modules page.</li>
-<li>The module\'s help text, displayed on the admin/help page and through the module\'s individual help link.</li>
-<li>The help for a distributed authorization module (if applicable).</li>
-<li>The description of a post type (if applicable).</li>
-</ul>
-');
-      $output .= '<p>'. t('You can not administer the help system.') .'</p>';
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%help">Help page</a>.', array('%help' => 'http://drupal.org/handbook/modules/help/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Manages the display of online help.');
-  }
-}
-
-/**
- * Menu callback; prints a page listing general help for all modules.
- */
-function help_page() {
-  $name = arg(2);
-  $output = '';
-  if (module_hook($name, 'help')) {
-    $temp = module_invoke($name, 'help', "admin/help#$name");
-    if (empty($temp)) {
-      $output .= t("No help is available for module %module.", array('%module' => $name));
-    }
-    else {
-      $output .= $temp;
-    }
-  }
-  return $output;
-}
diff --git a/modules/legacy.module b/modules/legacy.module
deleted file mode 100644 (file)
index 91a51db..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-// $Id: legacy.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Provides legacy handlers for upgrades from older Drupal installations.
- */
-
-/**
- * Implementation of hook_help().
- */
-function legacy_help($section) {
-  switch ($section) {
-    case 'admin/help#legacy':
-      $output = '<p>'. t('The legacy module provides legacy handlers for upgrades from older installations.  These handlers help automatically redirect references to pages from old installations and prevent <em>page not found</em> errors for your site.') .'</p>';
-      $output .= '<p>'. t('The legacy module handles legacy style taxonomy page, taxonomy feed, and blog feed paths.  It also handles URL upgrades from Drupal 4.1.   It rewrites old-style URLs to new-style URLs (clean URLs). ') .'</p>';
-      $output .= t('<p>Example Mappings:</p>
-<ul>
-<li><em>taxonomy/page/or/52,97</em> to <em>taxonomy/term/52+97</em>.</li>
-<li><em>taxonomy/feed/or/52,97</em> to <em>taxonomy/term/52+97/0/feed</em>.</li>
-<li><em>blog/feed/52</em> to <em>blog/52/feed</em>.</li>
-<li><em>node/view/52</em> to <em>node/52</em>.</li>
-<li><em>book/view/52</em> to <em>node/52</em>.</li>
-<li><em>user/view/52</em> to <em>user/52</em>.</li>
-</ul>
-');
-      $output .= '<p>'. t('Legacy module has no configurable options.') .'</p>';
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%legacy">Legacy page</a>.', array('%legacy' => 'http://drupal.org/handbook/modules/legacy/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Provides legacy handlers for upgrades from older Drupal installations.');
-  }
-}
-
-/**
- * Implementation of hook_menu().
- *
- * Registers menu paths used in earlier Drupal versions.
- */
-function legacy_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    // Map "taxonomy/page/or/52,97" to "taxonomy/term/52+97".
-    $items[] = array('path' => 'taxonomy/page', 'title' => t('taxonomy'),
-      'callback' => 'legacy_taxonomy_page',
-      'access' => TRUE, 'type' => MENU_CALLBACK);
-
-    // Map "taxonomy/feed/or/52,97" to "taxonomy/term/52+97/0/feed".
-    $items[] = array('path' => 'taxonomy/feed', 'title' => t('taxonomy'),
-      'callback' => 'legacy_taxonomy_feed',
-      'access' => TRUE, 'type' => MENU_CALLBACK);
-
-    // Map "blog/feed/52" to "blog/52/feed".
-    $items[] = array('path' => 'blog/feed', 'title' => t('blog'),
-      'callback' => 'legacy_blog_feed',
-      'access' => TRUE, 'type' => MENU_CALLBACK);
-  }
-  else {
-    // Map "node/view/52" to "node/52".
-    $items[] = array('path' => 'node/view', 'title' => t('view'),
-      'callback' => 'drupal_goto',
-      'callback arguments' => array('node/'. arg(2), NULL, NULL),
-      'access' => TRUE, 'type' => MENU_CALLBACK);
-
-    // Map "book/view/52" to "node/52".
-    $items[] = array('path' => 'book/view', 'title' => t('view'),
-      'callback' => 'drupal_goto',
-      'callback arguments' => array('node/'. arg(2), NULL, NULL),
-      'access' => TRUE, 'type' => MENU_CALLBACK);
-
-    // Map "user/view/52" to "user/52".
-    $items[] = array('path' => 'user/view', 'title' => t('view'),
-      'callback' => 'drupal_goto',
-      'callback arguments' => array('user/'. arg(2), NULL, NULL),
-      'access' => TRUE, 'type' => MENU_CALLBACK);
-  }
-
-  return $items;
-}
-
-/**
- * Menu callback; redirects users to new taxonomy page paths.
- */
-function legacy_taxonomy_page($operation = 'or', $str_tids = '') {
-  if ($operation == 'or') {
-    $str_tids = str_replace(',', '+', $str_tids);
-  }
-  drupal_goto('taxonomy/term/'. $str_tids);
-}
-
-/**
- * Menu callback; redirects users to new taxonomy feed paths.
- */
-function legacy_taxonomy_feed($operation = 'or', $str_tids = '') {
-  if ($operation == 'or') {
-    $str_tids = str_replace(',', '+', $str_tids);
-  }
-  drupal_goto('taxonomy/term/'. $str_tids .'/0/feed');
-}
-
-/**
- * Menu callback; redirects users to new blog feed paths.
- */
-function legacy_blog_feed($str_uid = '') {
-  // if URL is of form blog/feed/52 redirect
-  // if URL is of form blog/feed we have to call blog_feed_last().
-  if (is_numeric($str_uid)) {
-    drupal_goto('blog/'. $str_uid .'/feed');
-  }
-  else {
-    module_invoke('blog', 'feed_last');
-  }
-}
-
-/**
- * Implementation of hook_filter(). Handles URL upgrades from Drupal 4.1.
- */
-function legacy_filter($op, $delta = 0, $format = -1, $text = '') {
-  switch ($op) {
-    case 'list':
-      return array(t('Legacy filter'));
-
-    case 'description':
-      return t('Replaces URLs from Drupal 4.1 (and lower) with updated equivalents.');
-
-    case 'process':
-      return _legacy_filter_old_urls($text);
-
-    case 'settings':
-      return;
-
-    default:
-      return $text;
-  }
-}
-
-/**
- * Rewrite legacy URLs.
- *
- * This is a *temporary* filter to rewrite old-style URLs to new-style
- * URLs (clean URLs).  Currently, URLs are being rewritten dynamically
- * (ie. "on output"), however when these rewrite rules have been tested
- * enough, we will use them to permanently rewrite the links in node
- * and comment bodies.
- */
-function _legacy_filter_old_urls($text) {
-  if (!variable_get('rewrite_old_urls', 0)) {
-    return $text;
-  }
-
-  global $base_url;
-
-  $end = substr($base_url, 12);
-
-  if (variable_get('clean_url', '0') == '0') {
-    // Relative URLs:
-
-    // rewrite 'node.php?id=<number>[&cid=<number>]' style URLs:
-    $text = eregi_replace("\"(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "\"?q=\\1/view/\\2/\\4", $text);
-
-    // rewrite 'module.php?mod=<name>{&<op>=<value>}' style URLs:
-    $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\"?q=\\2/\\4/\\6" , $text);
-    $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\"?q=\\2/\\4", $text);
-    $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "\"?q=\\2", $text);
-
-    // Absolute URLs:
-
-    // rewrite 'node.php?id=<number>[&cid=<number>]' style URLs:
-    $text = eregi_replace("$end/(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "$end/?q=\\1/view/\\2/\\4", $text);
-
-    // rewrite 'module.php?mod=<name>{&<op>=<value>}' style URLs:
-    $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "$end/?q=\\2/\\4/\\6" , $text);
-    $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "$end/?q=\\2/\\4", $text);
-    $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "\"$end/?q=\\2", $text);
-  }
-  else {
-    // Relative URLs:
-
-    // Rewrite 'node.php?id=<number>[&cid=<number>]' style URLs:
-    $text = eregi_replace("\"(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "\"\\1/view/\\2/\\4", $text);
-
-    // Rewrite 'module.php?mod=<name>{&<op>=<value>}' style URLs:
-    $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\"\\2/\\4/\\6", $text);
-    $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\"\\2/\\4", $text);
-    $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "\"\\2", $text);
-
-    // Absolute URLs:
-
-    // Rewrite 'node.php?id=<number>[&cid=<number>]' style URLs:
-    $text = eregi_replace("$end/(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "$end/\\1/view/\\2/\\4", $text);
-
-    // Rewrite 'module.php?mod=<name>{&<op>=<value>}' style URLs:
-    $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "$end/\\2/\\4/\\6", $text);
-    $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "$end/\\2/\\4", $text);
-    $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "$end/\\2", $text);
-  }
-
-  return $text;
-}
-
-
diff --git a/modules/locale.module b/modules/locale.module
deleted file mode 100644 (file)
index 87f7aaf..0000000
+++ /dev/null
@@ -1,417 +0,0 @@
-<?php
-// $Id: locale.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables administrators to manage the site interface languages.
- *
- * When enabled, the site interface can be displayed in different
- * languages. The setup of languages and translations is completely
- * web based. Gettext portable object files are supported.
- */
-
-// ---------------------------------------------------------------------------------
-// Hook implementations (needed on all page loads)
-
-/**
- * Implementation of hook_help().
- */
-function locale_help($section) {
-  switch ($section) {
-    case 'admin/help#locale':
-      $output = '<p>'. t('The locale module allows you to present your Drupal site in a language other than the default English. You can use it to set up a multi-lingual web site or replace given <em>built-in</em> text with text which has been customized for your site. Whenever the locale module encounters text which needs to be displayed, it tries to translate it into the currently selected language. If a translation is not available, then the string is remembered, so you can look up untranslated strings easily.') .'</p>';
-      $output .= '<p>'. t('The locale module provides two options for providing translations. The first is the integrated web interface, via which you can search for untranslated strings, and specify their translations. An easier and less time-consuming method is to import existing translations for your language.  These translations are available as <em>GNU gettext Portable Object files</em> (<em>.po</em> files for short).  Translations for many languages are available for download from the translation page.') .'</p>';
-      $output .= '<p>'. t('If an existing translation does not meet your needs, the <em>.po</em> files are easily edited with special editing tools. The locale module\'s import feature allows you to add strings from such files into your site\'s database. The export functionality enables you to share your translations with others, generating Portable Object files from your site strings.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>administer localization at <a href="%admin-locale">administer &gt;&gt; localization</a>.</li>
-<li>manage strings for the localization: <a href="%admin-locale-string-search">administer &gt;&gt; localization &gt;&gt; manage strings</a>.</li>
-<li>add a locale language: <a href="%admin-locale-language-add">administer &gt;&gt; localization &gt;&gt; add language</a>.</li>
-<li>download translation files from the <a href="%external-http-drupal-org-project-Translations">Drupal translations page</a>.
-</li>
-</ul>
-', array('%admin-locale' => url('admin/locale'), '%admin-locale-string-search' => url('admin/locale/string/search'), '%admin-locale-language-add' => url('admin/locale/language/add'), '%external-http-drupal-org-project-Translations' => 'http://drupal.org/project/Translations'));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%locale">Locale page</a>.', array('%locale' => 'http://drupal.org/handbook/modules/locale/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Enables the translation of the user interface to languages other than English.');
-    case 'admin/locale':
-    case 'admin/locale/language/overview':
-      return t("<p>Drupal provides support for the translation of its interface text into different languages.  This page provides an overview of the installed languages. You can add a language on the <a href=\"%add-language\">add language page</a>, or directly by <a href=\"%import\">importing a translation</a>. If multiple languages are enabled, registered users will be able to set their preferred language.  The site default will be used for anonymous visitors and for users without their own settings.</p><p>Drupal interface translations may be added or extended by several courses: by <a href=\"%import\">importing</a> an existing translation, by <a href=\"%search\">translating everything</a> from scratch, or by a combination of these approaches.</p>", array("%search" => url("admin/locale/string/search"), "%import" => url("admin/locale/language/import"), "%add-language" => url("admin/locale/language/add")));
-    case 'admin/locale/language/add':
-      return t("<p>You need to add all languages in which you would like to display the site interface. If you can't find the desired language in the quick-add dropdown, then you will need to provide the proper language code yourself. The language code may be used to negotiate with browsers and to present flags, etc., so it is important to pick a code that is standardised for the desired language. You can also add a language by <a href=\"%import\">importing a translation</a>.</p>", array("%import" => url("admin/locale/language/import")));
-    case 'admin/locale/language/import':
-      return t("<p>This page allows you to import a translation provided in the gettext Portable Object (.po) format.  The easiest way to get your site translated is to obtain an existing Drupal translation and to import it.  You can find existing translations on the <a href=\"%url\">Drupal translation page</a>. Note that importing a translation file might take a while.</p>", array('%url' => 'http://drupal.org/project/translations'));
-    case 'admin/locale/language/export':
-      return t("<p>This page allows you to export Drupal strings. The first option is to export a translation so it can be shared.  The second option generates a translation template, which contains all Drupal strings, but without their translations. You can use this template to start a new translation using various software packages designed for this task.</p>");
-    case 'admin/locale/string/search':
-      return t("<p>It is often convenient to get the strings from your setup on the <a href=\"%export\">export page</a>, and use a desktop Gettext translation editor to edit the translations.  On this page you can search in the translated and untranslated strings, and the default English texts provided by Drupal.</p>", array("%export" => url("admin/locale/language/export")));
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function locale_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $access = user_access('administer locales');
-
-    // Main admin menu item
-    $items[] = array('path' => 'admin/locale',
-      'title' => t('localization'),
-      'callback' => 'locale_admin_manage',
-      'access' => $access);
-
-    // Top level tabs
-    $items[] = array('path' => 'admin/locale/language',
-      'title' => t('manage languages'),
-      'access' => $access,
-      'weight' => -10,
-      'type' => MENU_DEFAULT_LOCAL_TASK);
-    $items[] = array('path' => 'admin/locale/string/search',
-      'title' => t('manage strings'),
-      'callback' => 'locale_string_search',
-      'access' => $access,
-      'weight' => 10,
-      'type' => MENU_LOCAL_TASK);
-
-    // Manage languages subtabs
-    $items[] = array('path' => 'admin/locale/language/overview',
-      'title' => t('list'),
-      'callback' => 'locale_admin_manage',
-      'access' => $access,
-      'weight' => 0,
-      'type' => MENU_DEFAULT_LOCAL_TASK);
-    $items[] = array('path' => 'admin/locale/language/add',
-      'title' => t('add language'),
-      'callback' => 'locale_admin_manage_add',
-      'access' => $access,
-      'weight' => 5,
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/locale/language/import',
-      'title' => t('import'),
-      'callback' => 'locale_admin_import',
-      'access' => $access,
-      'weight' => 10,
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/locale/language/export',
-      'title' => t('export'),
-      'callback' => 'locale_admin_export',
-      'access' => $access,
-      'weight' => 20,
-      'type' => MENU_LOCAL_TASK);
-
-    // Language related callbacks
-    $items[] = array('path' => 'admin/locale/language/delete',
-      'title' => t('confirm'),
-      'callback' => 'locale_admin_manage_delete_form',
-      'access' => $access,
-      'type' => MENU_CALLBACK);
-  }
-  else {
-    if (is_numeric(arg(4))) {
-      // String related callbacks
-      $items[] = array('path' => 'admin/locale/string/edit/'. arg(4),
-        'title' => t('edit string'),
-        'callback' => 'locale_admin_string_edit',
-        'callback arguments' => arg(4),
-        'access' => $access,
-        'type' => MENU_CALLBACK);
-      $items[] = array('path' => 'admin/locale/string/delete/'. arg(4),
-        'title' => t('delete string'),
-        'callback' => 'locale_admin_string_delete',
-        'callback arguments' => arg(4),
-        'access' => $access,
-        'type' => MENU_CALLBACK);
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_perm().
- */
-function locale_perm() {
-  return array('administer locales');
-}
-
-/**
- * Implementation of hook_user().
- */
-function locale_user($type, $edit, &$user, $category = NULL) {
-  $languages = locale_supported_languages();
-  if ($type == 'form' && $category == 'account' && count($languages['name']) > 1) {
-    if ($user->language == '') {
-      $user->language = key($languages['name']);
-    }
-    $languages['name'] = array_map('check_plain', $languages['name']);
-    $form['locale'] = array('#type' => 'fieldset',
-      '#title' => t('Interface language settings'),
-      '#weight' => 1,
-    );
-    $form['locale']['language'] = array('#type' => 'radios',
-      '#title' => t('Language'),
-      '#default_value' => $user->language,
-      '#options' => $languages['name'],
-      '#description' => t('Selecting a different locale will change the interface language of the site.'),
-    );
-    return $form;
-  }
-}
-
-// ---------------------------------------------------------------------------------
-// Locale core functionality (needed on all page loads)
-
-/**
- * Provides interface translation services.
- *
- * This function is called from t() to translate a string if needed.
- */
-function locale($string) {
-  global $locale;
-  static $locale_t;
-
-  // Store database cached translations in a static var.
-  if (!isset($locale_t)) {
-    $cache = cache_get("locale:$locale");
-
-    if ($cache == 0) {
-      locale_refresh_cache();
-      $cache = cache_get("locale:$locale");
-    }
-    $locale_t = unserialize($cache->data);
-  }
-
-  // We have the translation cached (if it is TRUE, then there is no
-  // translation, so there is no point in checking the database)
-  if (isset($locale_t[$string])) {
-    $string = ($locale_t[$string] === TRUE ? $string : $locale_t[$string]);
-  }
-
-  // We do not have this translation cached, so get it from the DB.
-  else {
-    $result = db_query("SELECT s.lid, t.translation FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid WHERE s.source = '%s' AND t.locale = '%s'", $string, $locale);
-    // Translation found
-    if ($trans = db_fetch_object($result)) {
-      if (!empty($trans->translation)) {
-        $locale_t[$string] = $trans->translation;
-        $string = $trans->translation;
-      }
-    }
-
-    // Either we have no such source string, or no translation
-    else {
-      $result = db_query("SELECT lid, source FROM {locales_source} WHERE source = '%s'", $string);
-      // We have no such translation
-      if ($obj = db_fetch_object($result)) {
-        if ($locale) {
-          db_query("INSERT INTO {locales_target} (lid, locale, translation) VALUES (%d, '%s', '')", $obj->lid, $locale);
-        }
-      }
-      // We have no such source string
-      else {
-        db_query("INSERT INTO {locales_source} (location, source) VALUES ('%s', '%s')", request_uri(), $string);
-        if ($locale) {
-          $lid = db_fetch_object(db_query("SELECT lid FROM {locales_source} WHERE source = '%s'", $string));
-          db_query("INSERT INTO {locales_target} (lid, locale, translation) VALUES (%d, '%s', '')", $lid->lid, $locale);
-        }
-      }
-      // Clear locale cache in DB
-      cache_clear_all("locale:$locale");
-    }
-  }
-
-  return $string;
-}
-
-/**
- * Refreshes database stored cache of translations.
- *
- * We only store short strings to improve performance and consume less memory.
- */
-function locale_refresh_cache() {
-  $languages = locale_supported_languages();
-
-  foreach (array_keys($languages['name']) as $locale) {
-    $result = db_query("SELECT s.source, t.translation, t.locale FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid WHERE t.locale = '%s' AND LENGTH(s.source) < 75", $locale);
-    $t = array();
-    while ($data = db_fetch_object($result)) {
-      $t[$data->source] = (empty($data->translation) ? TRUE : $data->translation);
-    }
-    cache_set("locale:$locale", serialize($t));
-  }
-}
-
-/**
- * Returns list of languages supported on this site.
- *
- * @param $reset Refresh cached language list.
- * @param $getall Return all languages (even disabled ones)
- */
-function locale_supported_languages($reset = FALSE, $getall = FALSE) {
-  static $enabled = NULL;
-  static $all = NULL;
-
-  if ($reset) {
-    unset($enabled); unset($all);
-  }
-
-  if (is_null($enabled)) {
-    $enabled = $all = array();
-    $all['name'] = $all['formula'] = $enabled['name'] = $enabled['formula'] = array();
-    $result = db_query('SELECT locale, name, formula, enabled FROM {locales_meta} ORDER BY isdefault DESC, enabled DESC, name ASC');
-    while ($row = db_fetch_object($result)) {
-      $all['name'][$row->locale] = $row->name;
-      $all['formula'][$row->locale] = $row->formula;
-      if ($row->enabled) {
-        $enabled['name'][$row->locale] = $row->name;
-        $enabled['formula'][$row->locale] = $row->formula;
-      }
-    }
-  }
-  return $getall ? $all : $enabled;
-}
-
-/**
- * Returns plural form index for a specific number.
- *
- * The index is computed from the formula of this language.
- */
-function locale_get_plural($count) {
-  global $locale;
-  static $locale_formula, $plurals = array();
-
-  if (!isset($plurals[$count])) {
-    if (!isset($locale_formula)) {
-      $languages = locale_supported_languages();
-      $locale_formula = $languages['formula'][$locale];
-    }
-    if ($locale_formula) {
-      $n = $count;
-      $plurals[$count] = @eval("return intval($locale_formula);");
-      return $plurals[$count];
-    }
-    else {
-      $plurals[$count] = -1;
-      return -1;
-    }
-  }
-  return $plurals[$count];
-}
-
-// ---------------------------------------------------------------------------------
-// Language management functionality (administration only)
-
-/**
- * Page handler for the language management screen.
- */
-function locale_admin_manage() {
-  include_once './includes/locale.inc';
-  return _locale_admin_manage_screen();
-}
-
-/**
- * User interface for the language deletion confirmation screen.
- */
-function locale_admin_manage_delete_form() {
-  include_once './includes/locale.inc';
-  $langcode = arg(4);
-
-  // Do not allow deletion of English locale.
-  if ($langcode == 'en') {
-    drupal_set_message(t('The English locale cannot be deleted.'));
-    drupal_goto('admin/locale/language/overview');
-  }
-
-  // For other locales, warn user that data loss is ahead.
-  $languages = locale_supported_languages(FALSE, TRUE);
-
-  if (!isset($languages['name'][$langcode])) {
-    drupal_not_found();
-  }
-  else {
-    $form['langcode'] = array('#type' => 'value', '#value' => $langcode);
-    return confirm_form('locale_admin_manage_delete_form', $form, t('Are you sure you want to delete the language %name?', array('%name' => theme('placeholder', t($languages['name'][$langcode])))), 'admin/locale/language/overview', t('Deleting a language will remove all data associated with it. This action cannot be undone.'), t('Delete'), t('Cancel'));
-  }
-}
-
-/**
- * Process language deletion submissions.
- */
-function locale_admin_manage_delete_form_submit($form_id, $form_values) {
-  $languages = locale_supported_languages(FALSE, TRUE);
-  if (isset($languages['name'][$form_values['langcode']])) {
-    db_query("DELETE FROM {locales_meta} WHERE locale = '%s'", $form_values['langcode']);
-    db_query("DELETE FROM {locales_target} WHERE locale = '%s'", $form_values['langcode']);
-    $message = t('The language %locale has been removed.', array('%locale' => theme('placeholder', t($languages['name'][$form_values['langcode']]))));
-    drupal_set_message($message);
-    watchdog('locale', $message);
-  }
-
-  // Changing the locale settings impacts the interface:
-  cache_clear_all();
-
-  return 'admin/locale/language/overview';
-}
-
-/**
- * Page handler for the language addition screen
- */
-function locale_admin_manage_add() {
-  include_once './includes/locale.inc';
-  return _locale_admin_manage_add_screen();
-}
-
-// ---------------------------------------------------------------------------------
-// Gettext Portable Object import functionality (administration only)
-
-/**
- * Page handler for the translation import screen
- */
-function locale_admin_import() {
-  include_once './includes/locale.inc';
-  return _locale_admin_import_screen();
-}
-
-// ---------------------------------------------------------------------------------
-// Gettext Portable Object export functionality (administration only)
-
-/**
- * Page handler for the translation export screen
- */
-function locale_admin_export() {
-  include_once './includes/locale.inc';
-  return _locale_admin_export_screen();
-}
-
-// ---------------------------------------------------------------------------------
-// String search and editing functionality (administration only)
-
-/**
- * Page handler for the string search.
- */
-function locale_string_search() {
-  include_once './includes/locale.inc';
-  $output = _locale_string_seek();
-  $output .= _locale_string_seek_form();
-  return $output;
-}
-
-/**
- * Display the string edit form.
- */
-function locale_admin_string_edit($lid) {
-  include_once './includes/locale.inc';
-  return _locale_string_edit($lid);
-}
-
-/**
- * Delete a string.
- */
-function locale_admin_string_delete($lid) {
-  include_once './includes/locale.inc';
-  _locale_string_delete($lid);
-}
diff --git a/modules/menu.module b/modules/menu.module
deleted file mode 100644 (file)
index e950144..0000000
+++ /dev/null
@@ -1,764 +0,0 @@
-<?php
-// $Id: menu.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Allows administrators to customize the site navigation menu.
- */
-
-/**
- * Implementation of hook_help().
- */
-function menu_help($section) {
-  switch ($section) {
-    case 'admin/help#menu':
-      $output = t('<p>Menus are a collection of links (menu items) used to navigate a website. The menu module provides an interface to control and customize the powerful menu system that comes with Drupal.  Menus are primarily displayed as a hierarchical list of links using Drupal\'s highly flexible <a href="%admin-block">blocks</a> feature. Each menu automatically creates a block of the same name. By default, new menu items are placed inside a built-in menu labelled %navigation, but administrators can also create custom menus.</p>
-<p>Drupal themes generally provide out-of-the-box support for two menus commonly labelled %primary-links and %secondary-links. These are sets of links which are usually displayed in the header or footer of each page (depending on the currently active theme). Any menu can be designated as the primary or secondary links menu via the <a href="%menu-settings">menu settings page</a>.</p>
-Menu administration tabs:
-<ul>
-  <li>On the administer menu page, administrators can "edit" to change the title, description, parent or weight of a menu item. Under the "operations" column, click on "enable/disable" to toggle a menu item on or off. Only menu items which are enabled are displayed in the corresponding menu block. Note that the default menu items generated by the menu module cannot be deleted, only disabled.</li>
-  <li>Use the "add menu" tab to submit a title for a new custom menu. Once submitted, the menu will appear in a list toward the bottom of the administer menu page underneath the main navigation menu. Under the menu name there will be links to edit or delete the menu, and a link to add new items to the menu.</li>
-  <li>Use the "add menu item" tab to create new links in either the navigation or a custom menu (such as a primary/secondary links menu). Select the parent item to place the new link within an existing menu structure. For top level menu items, choose the name of the menu in which the link is to be added.</li>
-</ul>', array('%navigation' => theme('placeholder', 'Navigation'), '%primary-links' => theme('placeholder', 'primary links'), '%secondary-links' => theme('placeholder', 'secondary links'), '%admin-block' => url('admin/block'), '%menu-settings' => url('admin/settings/menu')));
-      $output .= t('<p>You can</p>
-<ul>
-  <li>administer menus at <a href="%admin-menu">administer &gt;&gt; menus</a>.</li>
-  <li>add a menu at <a href="%admin-menu-menu-add">administer &gt;&gt; menus &gt;&gt; add menu</a>.</li>
-  <li>add a menu item at <a href="%admin-menu-item-add">administer &gt;&gt; menus &gt;&gt; add menu item</a>.</li>
-  <li>modify menu settings (in particular, to specify a menu to use for primary or secondary links) at <a href="%admin-settings-menus">administer &gt;&gt; settings &gt;&gt; menus</a>.</li>
-  <li>manage menu blocks at <a href="%admin-block">administer &gt;&gt; blocks</a>.</li>
-</ul>
-', array('%admin-menu' => url('admin/menu'), '%admin-block' => url('admin/block'), '%admin-menu-menu-add' => url('admin/menu/menu/add'), '%admin-menu-item-add' => url('admin/menu/item/add'), '%admin-settings-menus' => url('admin/settings/menu')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%menu">Menu page</a>.', array('%menu' => 'http://drupal.org/handbook/modules/menu/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Allows administrators to customize the site navigation menu.');
-    case 'admin/menu':
-      return '<p>'. t('Menus are a collection of links (menu items) used to navigate a website. The list(s) below display the currently available menus along with their menu items. Select an operation from the list to manage each menu or menu item.', array('%admin-settings-menus' => url('admin/settings/menu'), '%admin-block'=>url('admin/block'))) .'</p>';
-    case 'admin/menu/menu/add':
-      return '<p>'. t('Enter the name for your new menu. Remember to enable the newly created block in the <a href="%blocks">blocks administration page</a>.', array('%blocks' => url('admin/block'))) .'</p>';
-    case 'admin/menu/item/add':
-      return '<p>'. t('Enter the title, path, position and the weight for your new menu item.') .'</p>';
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function menu_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/menu',
-      'title' => t('menus'),
-      'callback' => 'menu_overview',
-      'access' => user_access('administer menu'));
-    $items[] = array('path' => 'admin/menu/list',
-      'title' => t('list'),
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-      'weight' => -10);
-
-    $items[] = array('path' => 'admin/menu/item/add',
-      'title' => t('add menu item'),
-      'callback' => 'menu_edit_item_form',
-      'access' => user_access('administer menu'),
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/menu/item/edit',
-      'title' => t('edit menu item'),
-      'callback' => 'menu_edit_item_form',
-      'access' => user_access('administer menu'),
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/menu/item/reset',
-      'title' => t('reset menu item'),
-      'callback' => 'menu_reset_item',
-      'access' => user_access('administer menu'),
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/menu/item/disable',
-      'title' => t('disable menu item'),
-      'callback' => 'menu_disable_item',
-      'access' => user_access('administer menu'),
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/menu/item/delete',
-      'title' => t('delete menu item'),
-      'callback' => 'menu_item_delete_form',
-      'access' => user_access('administer menu'),
-      'type' => MENU_CALLBACK);
-
-    $items[] = array('path' => 'admin/menu/menu/add',
-      'title' => t('add menu'),
-      'callback' => 'menu_edit_menu_form',
-      'access' => user_access('administer menu'),
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/menu/menu/edit',
-      'title' => t('edit menu'),
-      'callback' => 'menu_edit_menu_form',
-      'access' => user_access('administer menu'),
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/menu/menu/delete',
-      'title' => t('delete menu'),
-      'callback' => 'menu_item_delete_form',
-      'access' => user_access('administer menu'),
-      'type' => MENU_CALLBACK);
-
-    $items[] = array('path' => 'admin/settings/menu',
-      'title' => t('menus'),
-      'callback' => 'menu_configure');
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_block().
- */
-function menu_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $blocks = array();
-    $root_menus = menu_get_root_menus();
-    foreach ($root_menus as $mid => $title) {
-      // Default "Navigation" block is handled by user.module.
-      if ($mid != 1) {
-        $blocks[$mid]['info'] = check_plain($title);
-      }
-    }
-    return $blocks;
-  }
-  else if ($op == 'view') {
-    $item = menu_get_item($delta);
-    $data['subject'] = check_plain($item['title']);
-    $data['content'] = theme('menu_tree', $delta);
-    return $data;
-  }
-}
-
-/**
- * Implementation of hook_nodeapi().
- */
-function menu_nodeapi(&$node, $op) {
-
-  if (user_access('administer menu')) {
-    switch ($op) {
-      case 'insert':
-      case 'update':
-        if ($node->menu['delete']) {
-          menu_node_form_delete($node);
-          menu_rebuild();
-        }
-        elseif ($node->menu['title']) {
-          $node->menu['path'] = ($node->menu['path']) ? $node->menu['path'] : "node/$node->nid";
-          menu_edit_item_save($node->menu);
-          menu_rebuild();
-        }
-        break;
-
-      case 'delete':
-        menu_node_form_delete($node);
-        menu_rebuild();
-        break;
-    }
-  }
-}
-
-/**
- * Implementation of hook_perm().
- */
-function menu_perm() {
-  return array('administer menu');
-}
-
-/**
- * Implementation of hook_form_alter().
- * Add menu item fields to the node form.
- */
-function menu_form_alter($form_id, &$form) {
-  if (user_access('administer menu') && isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
-    $edit = isset($_POST['edit']) ? $_POST['edit'] : '';
-    $edit['nid'] = $form['nid']['#value'];
-
-    $item = array();
-    if ($edit['nid'] > 0) {
-      $item = db_fetch_array(db_query("SELECT * FROM {menu} WHERE path = 'node/%d'", $edit['nid']));
-      if (is_array($edit['menu'])) {
-        $item = !is_array($item) ? $edit['menu'] : (($_POST['op'] == t('Preview')) ? array_merge($item, $edit['menu']) : array_merge($edit['menu'], $item));
-      }
-    }
-
-    $form['menu'] = array('#type' => 'fieldset',
-      '#title' => t('Menu settings'),
-      '#collapsible' => TRUE,
-      '#collapsed' => empty($item['title']),
-      '#tree' => TRUE,
-      '#weight' => 30,
-    );
-
-    $form['menu']['title'] = array('#type' => 'textfield',
-      '#title' => t('Title'),
-      '#default_value' => $item['title'],
-      '#description' => t('The name to display for this link.'),
-    );
-
-    $form['menu']['description'] = array('#type' => 'textfield',
-      '#title' => t('Description'),
-      '#default_value' => $item['description'],
-      '#description' => t('The description displayed when hovering over a menu item.'),
-    );
-
-    // Generate a list of possible parents.
-    $options = menu_parent_options($item['mid'], variable_get('menu_parent_items', 0));
-
-    $form['menu']['pid'] = array('#type' => 'select',
-      '#title' => t('Parent item'),
-      '#default_value' => $item['pid'],
-      '#options' => $options,
-    );
-
-    $form['menu']['path'] = array('#type' => 'hidden',
-      '#value' => $item['path'],
-    );
-
-    $form['menu']['weight'] = array('#type' => 'weight',
-      '#title' => t('Weight'),
-      '#default_value' => $item['weight'],
-      '#delta' => 10,
-      '#description' => t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
-    );
-
-    $form['menu']['mid'] = array('#type' => 'hidden',
-      '#value' => $item['mid'] ? $item['mid'] : 0,
-    );
-
-    $form['menu']['type'] = array('#type' => 'hidden',
-      '#value' => $item['type'] ? $item['type'] : MENU_CUSTOM_ITEM,
-    );
-
-    if ($item['mid'] > 0) {
-      $form['menu']['delete'] = array('#type' => 'checkbox',
-        '#title' => t('Check to delete this menu item.'),
-        '#default_value' => $item['delete'],
-      );
-
-      $form['menu']['advanced'] = array('#type' => 'item',
-        '#value' => t('You may also <a href="%edit">edit the advanced settings</a> for this menu item.', array('%edit' => url("admin/menu/item/edit/{$item['mid']}"))),
-      );
-    }
-  }
-}
-
-/**
- * Menu callback; presents menu configuration options.
- */
-function menu_configure() {
-  $menu = menu_get_menu();
-  $root_menus = menu_get_root_menus();
-
-  $primary_options = $root_menus;
-  $primary_options[0] = t('No primary links');
-
-  $form['settings_links'] = array('#type' => 'fieldset',
-    '#title' => t('Primary and secondary links settings'),
-  );
-
-  $form['settings_links']['intro'] = array('#type' => 'item',
-    '#value' => t('Primary and secondary links provide a navigational menu system which usually (depending on your theme) appears at the top-right of the browser window. The links displayed can be generated either from a custom list created via the <a href="%menu">menu administration</a> page or from a built-in list of menu items such as the navigation menu links.', array('%menu' => url('admin/menu'))),
-  );
-
-  $form['settings_links']['menu_primary_menu'] = array('#type' => 'select',
-    '#title' => t('Menu containing primary links'),
-    '#default_value' => variable_get('menu_primary_menu', 0),
-    '#options' => $primary_options,
-  );
-
-  $secondary_options = $root_menus;
-  $secondary_options[0] = t('No secondary links');
-
-  $form['settings_links']['menu_secondary_menu'] = array('#type' => 'select',
-    '#title' => t('Menu containing secondary links'),
-    '#default_value' => variable_get('menu_secondary_menu', 0),
-    '#options' => $secondary_options,
-    '#description' => t('If you select the same menu as primary links then secondary links will display the appropriate second level of your navigation hierarchy.'),
-  );
-
-  $form['settings_authoring'] = array('#type' => 'fieldset',
-    '#title' => t('Post authoring form settings'),
-  );
-
-  $form['settings_authoring']['intro'] = array('#type' => 'item',
-    '#value' => t('The menu module allows on-the-fly creation of menu links in the post authoring forms. The following option limits the menus in which a new link may be added. For e.g. this can be used to force new menu items to be created in the primary links menu or to hide admin menu items.'),
-  );
-
-  $authoring_options = $root_menus;
-  $authoring_options[0] = t('Show all menus');
-
-  $form['settings_authoring']['menu_parent_items'] = array('#type' => 'select',
-    '#title' => t('Restrict parent items to'),
-    '#default_value' => variable_get('menu_parent_items', 0),
-    '#options' => $authoring_options,
-    '#description' => t('Choose the menu to be made available in the post authoring form. Only this menu item and its children will be shown.'),
-   );
-
-  return system_settings_form('menu_configure', $form);
-}
-
-/**
- * Menu callback; handle the adding/editing of a new menu.
- */
-function menu_edit_menu_form($mid = 0) {
-  if (arg(3) == 'edit') {
-    if (!($item = db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d', $mid)))) {
-      drupal_not_found();
-      return;
-    }
-  }
-  else {
-    $item = array('mid' => 0, 'pid' => 0, 'path' => '', 'weight' => 0, 'type' => MENU_CUSTOM_MENU);
-  }
-  $form['title'] = array('#type' => 'textfield',
-    '#title' => t('Title'),
-    '#default_value' => $item['title'],
-    '#description' => t('The name of the menu.'),
-    '#required' => TRUE,
-  );
-  $form['mid'] = array('#type' => 'value', '#value' => $item['mid']);
-  $form['pid'] = array('#type' => 'value', '#value' => $item['pid']);
-  $form['path'] = array('#type' => 'value', '#value' => $item['path']);
-  $form['weight'] = array('#type' => 'value', '#value' => $item['weight']);
-  $form['type'] = array('#type' => 'value', '#value' => $item['type']);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
-
-  // Reuse the submit function of menu_edit_item_form.
-  return drupal_get_form('menu_edit_menu_form', $form, 'menu_edit_item_form');
-}
-
-/**
- * Present the menu item editing form.
- */
-function menu_edit_item_form($mid = 0) {
-  if (arg(3) == 'edit') {
-    if (!($item = db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d', $mid)))) {
-      drupal_not_found();
-      return;
-    }
-  }
-  else {
-    // This is an add form.
-    // The mid argument (if set) will be the default pid to use.
-    // Otherwise, we default to the "Navigation" menu (pid #1).
-    $default_pid = $mid ? $mid : 1;
-    $item = array('mid' => 0, 'pid' => $default_pid, 'weight' => 0, 'type' => MENU_CUSTOM_ITEM);
-  }
-
-  $form['title'] = array('#type' => 'textfield',
-    '#title' => t('Title'),
-    '#default_value' => $item['title'],
-    '#description' => t('The name of the menu item.'),
-    '#required' => TRUE,
-  );
-  $form['description'] = array('#type' => 'textfield',
-    '#title' => t('Description'),
-    '#default_value' => $item['description'],
-    '#description' => t('The description displayed when hovering over a menu item.'),
-  );
-
-  if ($item['type'] & MENU_CREATED_BY_ADMIN) {
-    $form['path'] = array('#type' => 'textfield',
-      '#title' => t('Path'),
-      '#default_value' => $item['path'],
-      '#description' => t('The path this menu item links to. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.', array('%front' => theme('placeholder', '<front>'), '%add-node' => theme('placeholder', 'node/add'), '%drupal' => theme('placeholder', 'http://drupal.org'))),
-      '#required' => TRUE,
-    );
-  }
-  else {
-    $form['_path'] = array('#type' => 'item',
-      '#title' => t('Path'),
-      '#description' => l($item['path'], $item['path']),
-    );
-    $form['path'] = array('#type' => 'value', '#value' => $item['path']);
-  }
-
-  $expanded = $item['type'] & MENU_EXPANDED ? 1 : 0;
-  $form['expanded'] = array('#type' => 'checkbox',
-    '#title' => t('Expanded'),
-    '#default_value' => $expanded,
-    '#description' => t('If selected and this menu item has children, the menu will always appear expanded.'),
-  );
-
-  // Generate a list of possible parents (not including this item or descendants).
-  $options = menu_parent_options($item['mid']);
-  $form['pid'] = array('#type' => 'select',
-    '#title' => t('Parent item'),
-    '#default_value' => $item['pid'],
-    '#options' => $options,
-  );
-  $form['weight'] = array('#type' => 'weight',
-    '#title' => t('Weight'),
-    '#default_value' => $item['weight'],
-    '#description' => t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
-  );
-
-  // Always enable menu items (but not menus) when editing them.
-  if (!($item['type'] & MENU_IS_ROOT)) {
-    $item['type'] |= MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IN_BREADCRUMB;
-  }
-
-  $form['type'] = array('#type' => 'value', '#value' => $item['type']);
-  $form['mid'] = array('#type' => 'value', '#value' => $item['mid']);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
-
-  return drupal_get_form('menu_edit_item_form', $form);
-}
-
-/**
- * Process menu and menu item add/edit form submissions.
- */
-function menu_edit_item_form_submit($form_id, $form_values) {
-  menu_edit_item_save($form_values);
-  return 'admin/menu';
-}
-
-/**
- * Menu callback; delete a single custom item.
- */
-function menu_item_delete_form($mid) {
-  if (!($menu = db_fetch_object(db_query('SELECT type, title FROM {menu} WHERE mid = %d', $mid)))) {
-    drupal_not_found();
-    return;
-  }
-
-  $form['mid'] = array('#type' => 'value', '#value' => $mid);
-  $form['type'] = array('#type' => 'value', '#value' => $menu->type);
-  $form['title'] = array('#type' => 'value', '#value' => $menu->title);
-
-  if ($menu->type & MENU_IS_ROOT) {
-    $message = t('Are you sure you want to delete the menu %item?', array('%item' => theme('placeholder', $menu->title)));
-  }
-  else {
-    $message = t('Are you sure you want to delete the custom menu item %item?', array('%item' => theme('placeholder', $menu->title)));
-  }
-
-  return confirm_form('menu_confirm_delete_form', $form, $message, 'admin/menu', t('This action cannot be undone.'), t('Delete'));
-}
-
-/**
- * Process menu delete form submissions.
- */
-function menu_confirm_delete_form_submit($form_id, $form_values) {
-  menu_delete_item($form_values['mid']);
-
-  $t_args = array('%title' => theme('placeholder', $form_values['title']));
-  if ($form_values['type'] & MENU_IS_ROOT) {
-    drupal_set_message(t('The menu %title has been deleted.', $t_args));
-    watchdog('menu', t('Deleted menu %title.', $t_args), WATCHDOG_NOTICE);
-  }
-  else {
-    drupal_set_message(t('The menu item %title has been deleted.', $t_args));
-    watchdog('menu', t('Deleted menu item %title.', $t_args), WATCHDOG_NOTICE);
-  }
-
-  return 'admin/menu';
-}
-
-/**
- * Menu callback; reset a single modified item.
- */
-function menu_reset_item($mid) {
-  if (isset($mid) && $title = db_result(db_query('SELECT title FROM {menu} WHERE mid = %d', $mid))) {
-    $form['mid'] = array('#type' => 'value', '#value' => $mid);
-    return confirm_form('menu_reset_item_form', $form, t('Are you sure you want to reset the item %item to its default values?', array('%item' => theme('placeholder', $title))), 'admin/menu', t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
-  }
-  else {
-    drupal_not_found();
-  }
-}
-
-/**
- * Process menu reset item form submissions.
- */
-function menu_reset_item_form_submit($form_id, $form_values) {
-  menu_delete_item($form_values['mid']);
-  drupal_set_message(t('The menu item was reset to its default settings.'));
-
-  return 'admin/menu';
-}
-
-/**
- * Menu callback; hide a menu item.
- */
-function menu_disable_item($mid) {
-  $item = menu_get_item($mid);
-  $type = $item['type'];
-  $type &= ~MENU_VISIBLE_IN_TREE;
-  $type &= ~MENU_VISIBLE_IN_BREADCRUMB;
-  $type |= MENU_MODIFIED_BY_ADMIN;
-  db_query('UPDATE {menu} SET type = %d WHERE mid = %d', $type, $mid);
-  drupal_set_message(t('The menu item has been disabled.'));
-  drupal_goto('admin/menu');
-}
-
-/**
- * Menu callback; present the main menu management page.
- */
-function menu_overview() {
-  menu_rebuild();
-
-  return menu_overview_tree();
-}
-
-/**
- * Save changes to a menu item into the database.
- *
- * @return mid
- */
-function menu_edit_item_save($edit) {
-  if ($edit['expanded']) {
-    $edit['type'] |= MENU_EXPANDED;
-  }
-  else {
-    $edit['type'] &= ~MENU_EXPANDED;
-  }
-
-  $edit['type'] = $edit['type'] | MENU_MODIFIED_BY_ADMIN;
-
-  $status = menu_save_item($edit);
-
-  $t_args = array('%title' => theme('placeholder', $edit['title']));
-  if ($status == SAVED_UPDATED) {
-    drupal_set_message(t('The menu item %title has been updated.', $t_args));
-  }
-  elseif ($status == SAVED_NEW) {
-    drupal_set_message(t('The menu item %title has been added.', $t_args));
-    watchdog('menu', t('Added menu item %title.', $t_args), WATCHDOG_NOTICE, l(t('view'), 'admin/menu'));
-  }
-  return $edit['mid'];
-}
-
-/**
- * Save a menu item to the database.
- *
- * @param $item
- *   The menu item to be saved. This is passed by reference, so that the newly
- *   generated $item['mid'] can be accessed after an insert takes place.
- *
- * @return $status
- *   The operation that was performed in saving. Either SAVED_NEW (if a new
- *   menu item was created), or SAVED_UPDATED (if an existing menu item was
- *   updated).
- */
-function menu_save_item(&$item) {
-  $existing_item = NULL;
-
-  // Check that the item already exists in the menu tree, if $item['mid'] is
-  // specified.
-  if (isset($item['mid'])) {
-    $existing_item = menu_get_item($item['mid']);
-  }
-
-  if ($item['mid'] && !empty($existing_item)) {
-    db_query("UPDATE {menu} SET pid = %d, path = '%s', title = '%s', description = '%s', weight = %d, type = %d WHERE mid = %d", $item['pid'], $item['path'], $item['title'], $item['description'], $item['weight'], $item['type'], $item['mid']);
-    return SAVED_UPDATED;
-  }
-  else {
-    $item['mid'] = db_next_id('{menu}_mid');
-    // Check explicitly for mid <= 2. If the database was improperly prefixed,
-    // this would cause a nasty infinite loop or duplicate mid errors.
-    // TODO: have automatic prefixing through an installer to prevent this.
-    while ($item['mid'] <= 2) {
-      $item['mid'] = db_next_id('{menu}_mid');
-    }
-    db_query("INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (%d, %d, '%s', '%s', '%s', %d, %d)", $item['mid'], $item['pid'], $item['path'], $item['title'], $item['description'], $item['weight'], $item['type']);
-    return SAVED_NEW;
-  }
-}
-
-/**
- * Delete a menu item from the database. If $item['mid'] is specified, then
- * this is used to find the existing item; otherwise, $item['path'] is used.
- *
- * @param $item
- *   The menu item to be deleted.
- */
-function menu_delete_item($item) {
-  if (!is_array($item)) {
-    $item = array('mid' => $item);
-  }
-
-  if ($item['mid']) {
-    db_query('DELETE FROM {menu} WHERE mid = %d', $item['mid']);
-  }
-  elseif ($item['path']) {
-    db_query("DELETE FROM {menu} WHERE path = '%s'", $item['path']);
-  }
-}
-
-/**
- * Present the menu tree, rendered along with links to edit menu items.
- */
-function menu_overview_tree() {
-  $menu = menu_get_menu();
-  $root_menus = menu_get_root_menus();
-  $header = array(t('Menu item'), t('Expanded'), array('data' => t('Operations'), 'colspan' => '3'));
-  $output = '';
-
-  foreach ($root_menus as $mid => $title) {
-    $operations = array();
-    if ($menu['items'][$mid]['type'] & MENU_MODIFIABLE_BY_ADMIN) {
-      $operations[] = l(t('edit'), 'admin/menu/menu/edit/'. $mid);
-    }
-    if ($menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN) {
-      $operations[] = l(t('delete'), 'admin/menu/menu/delete/'. $mid);
-    }
-    $operations[] = l(t('add item'), 'admin/menu/item/add/'. $mid);
-    $table = theme('item_list', $operations);
-    $table .= theme('table', $header, menu_overview_tree_rows($mid));
-    $output .= theme('box', check_plain($title), $table);
-  }
-  return $output;
-}
-
-function menu_overview_tree_rows($pid = 0, $depth = 0) {
-  $parent_item = menu_get_item($pid);
-  $rows = array();
-
-  if (isset($parent_item) && isset($parent_item['children'])) {
-    usort($parent_item['children'], '_menu_sort');
-    foreach ($parent_item['children'] as $mid) {
-      $item = menu_get_item($mid);
-      // Populate the title field.
-      $title = '';
-      if ($pid == 0) {
-        // Top-level items are menu names, and don't have an associated path.
-        $title .= check_plain($item['title']);
-      }
-      else {
-        $title .= l($item['title'], $item['path']);
-      }
-      if ($depth > 0) {
-        $title = '-&nbsp;'. $title;
-      }
-      for ($i = 1; $i < $depth; $i++) {
-        $title = '&nbsp;&nbsp;'. $title;
-      }
-
-      // Populate the operations field.
-      $operations = array();
-      if (!($item['type'] & MENU_MODIFIABLE_BY_ADMIN)) {
-        $operations[] = array('data' => t('locked'), 'colspan' => '3', 'align' => 'center');
-      }
-      else {
-        // Set the edit column.
-        if ($item['type'] & (MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IF_HAS_CHILDREN)) {
-          $operations[] = array('data' => l(t('edit'), 'admin/menu/item/edit/'. $mid));
-        }
-        else {
-          $operations[] = array('data' => '');
-        }
-
-        // Set the disable column.
-        if ($item['type'] & (MENU_IS_ROOT | MENU_VISIBLE_IF_HAS_CHILDREN)) {
-          // Disabling entire menus is done from block admin page.
-          // MENU_VISIBLE_IF_HAS_CHILDREN menus are always enabled so hide this operation.
-          $operations[] = array('data' => '');
-        }
-        else if ($item['type'] & MENU_VISIBLE_IN_TREE) {
-          $operations[] = array('data' => l(t('disable'), 'admin/menu/item/disable/'. $mid));
-        }
-        else {
-          $operations[] = array('data' => l(t('enable'), 'admin/menu/item/edit/'. $mid));
-        }
-
-        // Set the reset column.
-        if ($item['type'] & MENU_CREATED_BY_ADMIN) {
-          $operations[] = array('data' => l(t('delete'), 'admin/menu/item/delete/'. $mid));
-        }
-        else if ($item['type'] & MENU_MODIFIED_BY_ADMIN) {
-          $operations[] = array('data' => l(t('reset'), 'admin/menu/item/reset/'. $mid));
-        }
-        else {
-          $operations[] = array('data' => '');
-        }
-      }
-
-      // Call out disabled items.
-      if ($item['type'] & (MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IF_HAS_CHILDREN)) {
-        $class = 'menu-enabled';
-      }
-      else {
-        $title .= ' ('. t('disabled') .')';
-        $class = 'menu-disabled';
-      }
-
-      if ($item['type'] & (MENU_MODIFIABLE_BY_ADMIN | MENU_VISIBLE_IN_TREE)) {
-        $row = array(array('data' => $title, 'class' => $class), array('data' => ($item['children'] ? (($item['type'] & MENU_EXPANDED) ? t('Yes') : t('No')) : ''), 'class' => $class));
-        foreach ($operations as $operation) {
-          $operation['class'] = $class;
-          $row[] = $operation;
-        }
-        $rows[] = $row;
-        $rows = array_merge($rows, menu_overview_tree_rows($mid, $depth + 1));
-      }
-      else {
-        // Skip items that are hidden and locked; admins will never care about them.
-        $rows = array_merge($rows, menu_overview_tree_rows($mid, $depth));
-      }
-    }
-  }
-
-  return $rows;
-}
-
-/**
- * Return a list of menu items that are valid possible parents for the
- * given menu item. The list excludes the given item and its children.
- *
- * @param $mid
- *   The menu item id for which to generate a list of parents.
- *   If $mid == 0 then the complete tree is returned.
- * @param $pid
- *   The menu item id of the menu item at which to start the tree.
- *   If $pid > 0 then this item will be included in the tree.
- * @param $depth
- *   The current depth in the tree - used when recursing to indent the tree.
- * @return
- *   An array of menu titles keyed on the mid.
- */
-function menu_parent_options($mid, $pid = 0, $depth = 0) {
-  $options = array();
-
-  if (!($parent_item = menu_get_item($pid))) {
-    return $options;
-  }
-
-  // Exclude $mid and its children from the list unless $mid is 0.
-  if ($mid && $mid == $pid) {
-    return $options;
-  }
-
-  // Add the current $pid to the list.
-  if ($pid > 0 && ($parent_item['type'] & (MENU_MODIFIABLE_BY_ADMIN | MENU_IS_ROOT))) {
-    $title = ' '. $parent_item['title'];
-    for ($i = 0; $i < $depth; $i++) {
-      $title = '--'. $title;
-    }
-    if (!($parent_item['type'] & MENU_VISIBLE_IN_TREE)) {
-      $title .= ' ('. t('disabled') .')';
-    }
-    $options[$pid] = $title;
-    $depth ++;
-  }
-
-  // Add children of $pid to the list recursively.
-  if ($parent_item['children']) {
-    usort($parent_item['children'], '_menu_sort');
-    foreach ($parent_item['children'] as $child) {
-      $options += menu_parent_options($mid, $child, $depth);
-    }
-  }
-
-  return $options;
-}
-
-/**
- * Remove the menu item.
- */
-function menu_node_form_delete($node) {
-  menu_delete_item(array('path' => 'node/'. $node->nid));
-}
diff --git a/modules/node.module b/modules/node.module
deleted file mode 100644 (file)
index 7ebfb11..0000000
+++ /dev/null
@@ -1,2481 +0,0 @@
-<?php
-// $Id: node.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * The core that allows content to be submitted to the site.
- */
-
-// PlanetLab variable definitions
-include_once 'plc_config.php';
-
-define('NODE_NEW_LIMIT', time() - 30 * 24 * 60 * 60);
-
-/**
- * Implementation of hook_help().
- */
-function node_help($section) {
-  switch ($section) {
-    case 'admin/help#node':
-      $output = '<p>'. t('All content in a website is stored and treated as <b>nodes</b>. Therefore nodes are any postings such as blogs, stories, polls and forums. The node module manages these content types and is one of the strengths of Drupal over other content management systems.') .'</p>';
-      $output .= '<p>'. t('Treating all content as nodes allows the flexibility of creating new types of content. It also allows you to painlessly apply new features or changes to all content. Comments are not stored as nodes but are always associated with a node.') .'</p>';
-      $output .= t('<p>Node module features</p>
-<ul>
-<li>The list tab provides an interface to search and sort all content on your site.</li>
-<li>The configure settings tab has basic settings for content on your site.</li>
-<li>The configure content types tab lists all content types for your site and lets you configure their default workflow.</li>
-<li>The search tab lets you search all content on your site</li>
-</ul>
-');
-      $output .= t('<p>You can</p>
-<ul>
-<li>search for content at <a href="%search">search</a>.</li>
-<li>administer nodes at <a href="%admin-settings-content-types">administer &gt;&gt; settings &gt;&gt; content types</a>.</li>
-</ul>
-', array('%search' => url('search'), '%admin-settings-content-types' => url('admin/settings/content-types')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%node">Node page</a>.', array('%node' => 'http://drupal.org/handbook/modules/node/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Allows content to be submitted to the site and displayed on pages.');
-    case 'admin/node/configure':
-    case 'admin/node/configure/settings':
-      return t('<p>Settings for the core of Drupal. Almost everything is a node so these settings will affect most of the site.</p>');
-    case 'admin/node':
-      return t('<p>Below is a list of all of the posts on your site. Other forms of content are listed elsewhere (e.g. <a href="%comments">comments</a>).</p><p>Clicking a title views the post, while clicking an author\'s name views their user information.</p>', array('%comments' => url('admin/comment')));
-    case 'admin/node/search':
-      return t('<p>Enter a simple pattern to search for a post. This can include the wildcard character *.<br />For example, a search for "br*" might return "bread bakers", "our daily bread" and "brenda".</p>');
-  }
-
-  if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'revisions') {
-    return t('The revisions let you track differences between multiple versions of a post.');
-  }
-
-  if (arg(0) == 'node' && arg(1) == 'add' && $type = arg(2)) {
-    return filter_xss_admin(variable_get($type .'_help', ''));
-  }
-}
-
-/**
- * Implementation of hook_cron().
- */
-function node_cron() {
-  db_query('DELETE FROM {history} WHERE timestamp < %d', NODE_NEW_LIMIT);
-}
-
-/**
- * Gather a listing of links to nodes.
- *
- * @param $result
- *   A DB result object from a query to fetch node objects.  If your query joins the <code>node_comment_statistics</code> table so that the <code>comment_count</code> field is available, a title attribute will be added to show the number of comments.
- * @param $title
- *   A heading for the resulting list.
- *
- * @return
- *   An HTML list suitable as content for a block.
- */
-function node_title_list($result, $title = NULL) {
-  while ($node = db_fetch_object($result)) {
-    $items[] = l($node->title, 'node/'. $node->nid, $node->comment_count ? array('title' => format_plural($node->comment_count, '1 comment', '%count comments')) : '');
-  }
-
-  return theme('node_list', $items, $title);
-}
-
-/**
- * Format a listing of links to nodes.
- */
-function theme_node_list($items, $title = NULL) {
-  return theme('item_list', $items, $title);
-}
-
-/**
- * Update the 'last viewed' timestamp of the specified node for current user.
- */
-function node_tag_new($nid) {
-  global $user;
-
-  if ($user->uid) {
-    if (node_last_viewed($nid)) {
-      db_query('UPDATE {history} SET timestamp = %d WHERE uid = %d AND nid = %d', time(), $user->uid, $nid);
-    }
-    else {
-      @db_query('INSERT INTO {history} (uid, nid, timestamp) VALUES (%d, %d, %d)', $user->uid, $nid, time());
-    }
-  }
-}
-
-/**
- * Retrieves the timestamp at which the current user last viewed the
- * specified node.
- */
-function node_last_viewed($nid) {
-  global $user;
-  static $history;
-
-  if (!isset($history[$nid])) {
-    $history[$nid] = db_fetch_object(db_query("SELECT timestamp FROM {history} WHERE uid = '$user->uid' AND nid = %d", $nid));
-  }
-
-  return (isset($history[$nid]->timestamp) ? $history[$nid]->timestamp : 0);
-}
-
-/**
- * Decide on the type of marker to be displayed for a given node.
- *
- * @param $nid
- *   Node ID whose history supplies the "last viewed" timestamp.
- * @param $timestamp
- *   Time which is compared against node's "last viewed" timestamp.
- * @return
- *   One of the MARK constants.
- */
-function node_mark($nid, $timestamp) {
-  global $user;
-  static $cache;
-
-  if (!$user->uid) {
-    return MARK_READ;
-  }
-  if (!isset($cache[$nid])) {
-    $cache[$nid] = node_last_viewed($nid);
-  }
-  if ($cache[$nid] == 0 && $timestamp > NODE_NEW_LIMIT) {
-    return MARK_NEW;
-  }
-  elseif ($timestamp > $cache[$nid] && $timestamp > NODE_NEW_LIMIT) {
-    return MARK_UPDATED;
-  }
-  return MARK_READ;
-}
-
-/**
- * Automatically generate a teaser for a node body in a given format.
- */
-function node_teaser($body, $format = NULL) {
-
-  $size = variable_get('teaser_length', 600);
-
-  // find where the delimiter is in the body
-  $delimiter = strpos($body, '<!--break-->');
-
-  // If the size is zero, and there is no delimiter, the entire body is the teaser.
-  if ($size == 0 && $delimiter === FALSE) {
-    return $body;
-  }
-
-  // We check for the presence of the PHP evaluator filter in the current
-  // format. If the body contains PHP code, we do not split it up to prevent
-  // parse errors.
-  if (isset($format)) {
-    $filters = filter_list_format($format);
-    if (isset($filters['filter/1']) && strpos($body, '<?') !== FALSE) {
-      return $body;
-    }
-  }
-
-  // If a valid delimiter has been specified, use it to chop of the teaser.
-  if ($delimiter !== FALSE) {
-    return substr($body, 0, $delimiter);
-  }
-
-  // If we have a short body, the entire body is the teaser.
-  if (strlen($body) < $size) {
-    return $body;
-  }
-
-  // In some cases, no delimiter has been specified (e.g. when posting using
-  // the Blogger API). In this case, we try to split at paragraph boundaries.
-  // When even the first paragraph is too long, we try to split at the end of
-  // the next sentence.
-  $breakpoints = array('</p>' => 4, '<br />' => 0, '<br>' => 0, "\n" => 0, '. ' => 1, '! ' => 1, '? ' => 1, '。' => 3, '؟ ' => 1);
-  foreach ($breakpoints as $point => $charnum) {
-    if ($length = strpos($body, $point, $size)) {
-      return substr($body, 0, $length + $charnum);
-    }
-  }
-
-  // If all else fails, we simply truncate the string.
-  return truncate_utf8($body, $size);
-}
-
-function _node_names($op = '', $node = NULL) {
-  static $node_names = array();
-  static $node_list = array();
-
-  if (empty($node_names)) {
-    $node_names = module_invoke_all('node_info');
-    foreach ($node_names as $type => $value) {
-      $node_list[$type] = $value['name'];
-    }
-  }
-  if ($node) {
-    if (is_array($node)) {
-      $type = $node['type'];
-    }
-    elseif (is_object($node)) {
-      $type = $node->type;
-    }
-    elseif (is_string($node)) {
-      $type = $node;
-    }
-    if (!isset($node_names[$type])) {
-      return FALSE;
-    }
-  }
-  switch ($op) {
-    case 'base':
-      return $node_names[$type]['base'];
-    case 'list':
-      return $node_list;
-    case 'name':
-      return $node_list[$type];
-  }
-}
-
-/**
- * Determine the basename for hook_load etc.
- *
- * @param $node
- *   Either a node object, a node array, or a string containing the node type.
- * @return
- *   The basename for hook_load, hook_nodeapi etc.
- */
-function node_get_base($node) {
-  return _node_names('base', $node);
-}
-
-/**
- * Determine the human readable name for a given type.
- *
- * @param $node
- *   Either a node object, a node array, or a string containing the node type.
- * @return
- *   The human readable name of the node type.
- */
-function node_get_name($node) {
-  return _node_names('name', $node);
-}
-
-/**
- * Return the list of available node types.
- *
- * @param $node
- *   Either a node object, a node array, or a string containing the node type.
- * @return
- *   An array consisting ('#type' => name) pairs.
- */
-function node_get_types() {
-  return _node_names('list');
-}
-
-/**
- * Determine whether a node hook exists.
- *
- * @param &$node
- *   Either a node object, node array, or a string containing the node type.
- * @param $hook
- *   A string containing the name of the hook.
- * @return
- *   TRUE iff the $hook exists in the node type of $node.
- */
-function node_hook(&$node, $hook) {
-  return module_hook(node_get_base($node), $hook);
-}
-
-/**
- * Invoke a node hook.
- *
- * @param &$node
- *   Either a node object, node array, or a string containing the node type.
- * @param $hook
- *   A string containing the name of the hook.
- * @param $a2, $a3, $a4
- *   Arguments to pass on to the hook, after the $node argument.
- * @return
- *   The returned value of the invoked hook.
- */
-function node_invoke(&$node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
-  if (node_hook($node, $hook)) {
-    $function = node_get_base($node) ."_$hook";
-    return ($function($node, $a2, $a3, $a4));
-  }
-}
-
-/**
- * Invoke a hook_nodeapi() operation in all modules.
- *
- * @param &$node
- *   A node object.
- * @param $op
- *   A string containing the name of the nodeapi operation.
- * @param $a3, $a4
- *   Arguments to pass on to the hook, after the $node and $op arguments.
- * @return
- *   The returned value of the invoked hooks.
- */
-function node_invoke_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
-  $return = array();
-  foreach (module_implements('nodeapi') as $name) {
-    $function = $name .'_nodeapi';
-    $result = $function($node, $op, $a3, $a4);
-    if (isset($result) && is_array($result)) {
-      $return = array_merge($return, $result);
-    }
-    else if (isset($result)) {
-      $return[] = $result;
-    }
-  }
-  return $return;
-}
-
-/**
- * Load a node object from the database.
- *
- * @param $param
- *   Either the nid of the node or an array of conditions to match against in the database query
- * @param $revision
- *   Which numbered revision to load. Defaults to the current version.
- * @param $reset
- *   Whether to reset the internal node_load cache.
- *
- * @return
- *   A fully-populated node object.
- */
-function node_load($param = array(), $revision = NULL, $reset = NULL) {
-  static $nodes = array();
-
-  if ($reset) {
-    $nodes = array();
-  }
-
-  $arguments = array();
-  if (is_numeric($param)) {
-    $cachable = $revision == NULL;
-    if ($cachable && isset($nodes[$param])) {
-      return $nodes[$param];
-    }
-    $cond = 'n.nid = %d';
-    $arguments[] = $param;
-  }
-  else {
-    // Turn the conditions into a query.
-    foreach ($param as $key => $value) {
-      $cond[] = 'n.'. db_escape_string($key) ." = '%s'";
-      $arguments[] = $value;
-    }
-    $cond = implode(' AND ', $cond);
-  }
-
-  // Retrieve the node.
-  // No db_rewrite_sql is applied so as to get complete indexing for search.
-  if ($revision) {
-    array_unshift($arguments, $revision);
-    $node = db_fetch_object(db_query('SELECT n.nid, r.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond, $arguments));
-  }
-  else {
-    $node = db_fetch_object(db_query('SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond, $arguments));
-  }
-
-  if ($node->nid) {
-    // Call the node specific callback (if any) and piggy-back the
-    // results to the node or overwrite some values.
-    if ($extra = node_invoke($node, 'load')) {
-      foreach ($extra as $key => $value) {
-        $node->$key = $value;
-      }
-    }
-
-    if ($extra = node_invoke_nodeapi($node, 'load')) {
-      foreach ($extra as $key => $value) {
-        $node->$key = $value;
-      }
-    }
-  }
-
-  if ($cachable) {
-    $nodes[$param] = $node;
-  }
-
-  return $node;
-}
-
-/**
- * Save a node object into the database.
- */
-function node_save(&$node) {
-  global $user;
-
-  $node->is_new = false;
-
-  // Apply filters to some default node fields:
-  if (empty($node->nid)) {
-    // Insert a new node.
-    $node->is_new = true;
-
-    $node->nid = db_next_id('{node}_nid');
-    $node->vid = db_next_id('{node_revisions}_vid');;
-  }
-  else {
-    // We need to ensure that all node fields are filled.
-    $node_current = node_load($node->nid);
-    foreach ($node as $field => $data) {
-      $node_current->$field = $data;
-    }
-    $node = $node_current;
-
-    if ($node->revision) {
-      $node->old_vid = $node->vid;
-      $node->vid = db_next_id('{node_revisions}_vid');
-    }
-  }
-
-  // Set some required fields:
-  if (empty($node->created)) {
-    $node->created = time();
-  }
-  // The changed timestamp is always updated for bookkeeping purposes (revisions, searching, ...)
-  $node->changed = time();
-
-  // Split off revisions data to another structure
-  $revisions_table_values = array('nid' => $node->nid, 'vid' => $node->vid,
-                     'title' => $node->title, 'body' => $node->body,
-                     'teaser' => $node->teaser, 'log' => $node->log, 'timestamp' => $node->changed,
-                     'uid' => $user->uid, 'format' => $node->format);
-  $revisions_table_types = array('nid' => '%d', 'vid' => '%d',
-                     'title' => "'%s'", 'body' => "'%s'",
-                     'teaser' => "'%s'", 'log' => "'%s'", 'timestamp' => '%d',
-                     'uid' => '%d', 'format' => '%d');
-  $node_table_values = array('nid' => $node->nid, 'vid' => $node->vid,
-                    'title' => $node->title, 'type' => $node->type, 'uid' => $node->uid,
-                    'status' => $node->status, 'created' => $node->created,
-                    'changed' => $node->changed, 'comment' => $node->comment,
-                    'promote' => $node->promote, 'moderate' => $node->moderate,
-                    'sticky' => $node->sticky);
-  $node_table_types = array('nid' => '%d', 'vid' => '%d',
-                    'title' => "'%s'", 'type' => "'%s'", 'uid' => '%d',
-                    'status' => '%d', 'created' => '%d',
-                    'changed' => '%d', 'comment' => '%d',
-                    'promote' => '%d', 'moderate' => '%d',
-                    'sticky' => '%d');
-
-  //Generate the node table query and the
-  //the node_revisions table query
-  if ($node->is_new) {
-    $node_query = 'INSERT INTO {node} ('. implode(', ', array_keys($node_table_types)) .') VALUES ('. implode(', ', $node_table_types) .')';
-    $revisions_query = 'INSERT INTO {node_revisions} ('. implode(', ', array_keys($revisions_table_types)) .') VALUES ('. implode(', ', $revisions_table_types) .')';
-  }
-  else {
-    $arr = array();
-    foreach ($node_table_types as $key => $value) {
-      $arr[] = $key .' = '. $value;
-    }
-    $node_table_values[] = $node->nid;
-    $node_query = 'UPDATE {node} SET '. implode(', ', $arr) .' WHERE nid = %d';
-    if ($node->revision) {
-      $revisions_query = 'INSERT INTO {node_revisions} ('. implode(', ', array_keys($revisions_table_types)) .') VALUES ('. implode(', ', $revisions_table_types) .')';
-    }
-    else {
-      $arr = array();
-      foreach ($revisions_table_types as $key => $value) {
-        $arr[] = $key .' = '. $value;
-      }
-      $revisions_table_values[] = $node->vid;
-      $revisions_query = 'UPDATE {node_revisions} SET '. implode(', ', $arr) .' WHERE vid = %d';
-    }
-  }
-
-  // Insert the node into the database:
-  db_query($node_query, $node_table_values);
-  db_query($revisions_query, $revisions_table_values);
-
-  // Call the node specific callback (if any):
-  if ($node->is_new) {
-    node_invoke($node, 'insert');
-    node_invoke_nodeapi($node, 'insert');
-  }
-  else {
-    node_invoke($node, 'update');
-    node_invoke_nodeapi($node, 'update');
-  }
-
-  // Clear the cache so an anonymous poster can see the node being added or updated.
-  cache_clear_all();
-}
-
-/**
- * Generate a display of the given node.
- *
- * @param $node
- *   A node array or node object.
- * @param $teaser
- *   Whether to display the teaser only, as on the main page.
- * @param $page
- *   Whether the node is being displayed by itself as a page.
- * @param $links
- *   Whether or not to display node links. Links are omitted for node previews.
- *
- * @return
- *   An HTML representation of the themed node.
- */
-function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
-  $node = (object)$node;
-
-  // Remove the delimiter (if any) that separates the teaser from the body.
-  // TODO: this strips legitimate uses of '<!--break-->' also.
-  $node->body = str_replace('<!--break-->', '', $node->body);
-
-  if ($node->log != '' && !$teaser && $node->moderate) {
-    $node->body .= '<div class="log"><div class="title">'. t('Log') .':</div>'. filter_xss($node->log) .'</div>';
-  }
-
-  // The 'view' hook can be implemented to overwrite the default function
-  // to display nodes.
-  if (node_hook($node, 'view')) {
-    node_invoke($node, 'view', $teaser, $page);
-  }
-  else {
-    $node = node_prepare($node, $teaser);
-  }
-  // Allow modules to change $node->body before viewing.
-  node_invoke_nodeapi($node, 'view', $teaser, $page);
-  if ($links) {
-    $node->links = module_invoke_all('link', 'node', $node, !$page);
-  }
-  // unset unused $node part so that a bad theme can not open a security hole
-  if ($teaser) {
-    unset($node->body);
-  }
-  else {
-    unset($node->teaser);
-  }
-
-  return theme('node', $node, $teaser, $page);
-}
-
-/**
- * Apply filters to a node in preparation for theming.
- */
-function node_prepare($node, $teaser = FALSE) {
-  $node->readmore = (strlen($node->teaser) < strlen($node->body));
-  if ($teaser == FALSE) {
-    $node->body = check_markup($node->body, $node->format, FALSE);
-  }
-  else {
-    $node->teaser = check_markup($node->teaser, $node->format, FALSE);
-  }
-  return $node;
-}
-
-/**
- * Generate a page displaying a single node, along with its comments.
- */
-function node_show($node, $cid) {
-  $output = node_view($node, FALSE, TRUE);
-
-  if (function_exists('comment_render') && $node->comment) {
-    $output .= comment_render($node, $cid);
-  }
-
-  // Update the history table, stating that this user viewed this node.
-  node_tag_new($node->nid);
-
-  return $output;
-}
-
-/**
- * Implementation of hook_perm().
- */
-function node_perm() {
-  return array('administer nodes', 'access content', 'view revisions', 'revert revisions');
-}
-
-/**
- * Implementation of hook_search().
- */
-function node_search($op = 'search', $keys = null) {
-  switch ($op) {
-    case 'name':
-      return t('content');
-
-    case 'reset':
-      variable_del('node_cron_last');
-      variable_del('node_cron_last_nid');
-      return;
-
-    case 'status':
-      $last = variable_get('node_cron_last', 0);
-      $last_nid = variable_get('node_cron_last_nid', 0);
-      $total = db_result(db_query('SELECT COUNT(*) FROM {node} WHERE status = 1'));
-      $remaining = db_result(db_query('SELECT COUNT(*) FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE n.status = 1 AND ((GREATEST(n.created, n.changed, c.last_comment_timestamp) = %d AND n.nid > %d ) OR (n.created > %d OR n.changed > %d OR c.last_comment_timestamp > %d))', $last, $last_nid, $last, $last, $last));
-      return array('remaining' => $remaining, 'total' => $total);
-
-    case 'admin':
-      $form = array();
-      // Output form for defining rank factor weights.
-      $form['content_ranking'] = array('#type' => 'fieldset', '#title' => t('Content ranking'));
-      $form['content_ranking']['#theme'] = 'node_search_admin';
-      $form['content_ranking']['info'] = array('#type' => 'markup', '#value' => '<em>'. t('The following numbers control which properties the content search should favor when ordering the results. Higher numbers mean more influence, zero means the property is ignored. Changing these numbers does not require the search index to be rebuilt.  Changes take effect immediately.') .'</em>');
-
-      $ranking = array('node_rank_relevance' => t('Keyword relevance'),
-                       'node_rank_recent' => t('Recently posted'));
-      if (module_exist('comment')) {
-        $ranking['node_rank_comments'] = t('Number of comments');
-      }
-      if (module_exist('statistics') && variable_get('statistics_count_content_views', 0)) {
-        $ranking['node_rank_views'] = t('Number of views');
-      }
-
-      // Note: reversed to reflect that higher number = higher ranking.
-      $options = drupal_map_assoc(range(0, 10));
-      foreach ($ranking as $var => $title) {
-        $form['content_ranking']['factors'][$var] = array('#title' => $title, '#type' => 'select', '#options' => $options, '#default_value' => variable_get($var, 5));
-      }
-      return $form;
-
-    case 'search':
-      // Build matching conditions
-      list($join1, $where1) = _db_rewrite_sql();
-      $arguments1 = array();
-      $conditions1 = 'n.status = 1';
-
-      if ($type = search_query_extract($keys, 'type')) {
-        $types = array();
-        foreach (explode(',', $type) as $t) {
-          $types[] = "n.type = '%s'";
-          $arguments1[] = $t;
-        }
-        $conditions1 .= ' AND ('. implode(' OR ', $types) .')';
-        $keys = search_query_insert($keys, 'type');
-      }
-
-      if ($category = search_query_extract($keys, 'category')) {
-        $categories = array();
-        foreach (explode(',', $category) as $c) {
-          $categories[] = "tn.tid = %d";
-          $arguments1[] = $c;
-        }
-        $conditions1 .= ' AND ('. implode(' OR ', $categories) .')';
-        $join1 .= ' INNER JOIN {term_node} tn ON n.nid = tn.nid';
-        $keys = search_query_insert($keys, 'category');
-      }
-
-      // Build ranking expression (we try to map each parameter to a
-      // uniform distribution in the range 0..1).
-      $ranking = array();
-      $arguments2 = array();
-      $join2 = '';
-      // Used to avoid joining on node_comment_statistics twice
-      $stats_join = false;
-      if ($weight = (int)variable_get('node_rank_relevance', 5)) {
-        // Average relevance values hover around 0.15
-        $ranking[] = '%d * i.relevance';
-        $arguments2[] = $weight;
-      }
-      if ($weight = (int)variable_get('node_rank_recent', 5)) {
-        // Exponential decay with half-life of 6 months, starting at last indexed node
-        $ranking[] = '%d * POW(2, (GREATEST(n.created, n.changed, c.last_comment_timestamp) - %d) * 6.43e-8)';
-        $arguments2[] = $weight;
-        $arguments2[] = (int)variable_get('node_cron_last', 0);
-        $join2 .= ' INNER JOIN {node} n ON n.nid = i.sid LEFT JOIN {node_comment_statistics} c ON c.nid = i.sid';
-        $stats_join = true;
-      }
-      if (module_exist('comment') && $weight = (int)variable_get('node_rank_comments', 5)) {
-        // Inverse law that maps the highest reply count on the site to 1 and 0 to 0.
-        $scale = variable_get('node_cron_comments_scale', 0.0);
-        $ranking[] = '%d * (2.0 - 2.0 / (1.0 + c.comment_count * %f))';
-        $arguments2[] = $weight;
-        $arguments2[] = $scale;
-        if (!$stats_join) {
-          $join2 .= ' LEFT JOIN {node_comment_statistics} c ON c.nid = i.sid';
-        }
-      }
-      if (module_exist('statistics') && variable_get('statistics_count_content_views', 0) &&
-          $weight = (int)variable_get('node_rank_views', 5)) {
-        // Inverse law that maps the highest view count on the site to 1 and 0 to 0.
-        $scale = variable_get('node_cron_views_scale', 0.0);
-        $ranking[] = '%d * (2.0 - 2.0 / (1.0 + nc.totalcount * %f))';
-        $arguments2[] = $weight;
-        $arguments2[] = $scale;
-        $join2 .= ' LEFT JOIN {node_counter} nc ON nc.nid = i.sid';
-      }
-      $select2 = (count($ranking) ? implode(' + ', $ranking) : 'i.relevance') . ' AS score';
-
-      // Do search
-      $find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid '. $join1 .' INNER JOIN {users} u ON n.uid = u.uid', $conditions1 . (empty($where1) ? '' : ' AND '. $where1), $arguments1, $select2, $join2, $arguments2);
-
-      // Load results
-      $results = array();
-      foreach ($find as $item) {
-        $node = node_load($item->sid);
-
-        // Get node output (filtered and with module-specific fields).
-        if (node_hook($node, 'view')) {
-          node_invoke($node, 'view', false, false);
-        }
-        else {
-          $node = node_prepare($node, false);
-        }
-        // Allow modules to change $node->body before viewing.
-        node_invoke_nodeapi($node, 'view', false, false);
-
-        // Fetch comments for snippet
-        $node->body .= module_invoke('comment', 'nodeapi', $node, 'update index');
-        // Fetch terms for snippet
-        $node->body .= module_invoke('taxonomy', 'nodeapi', $node, 'update index');
-
-        $extra = node_invoke_nodeapi($node, 'search result');
-        $results[] = array('link' => url('node/'. $item->sid),
-                           'type' => node_get_name($node),
-                           'title' => $node->title,
-                           'user' => theme('username', $node),
-                           'date' => $node->changed,
-                           'node' => $node,
-                           'extra' => $extra,
-                           'snippet' => search_excerpt($keys, $node->body));
-      }
-      return $results;
-  }
-}
-
-/**
- * Implementation of hook_user().
- */
-function node_user($op, &$edit, &$user) {
-  if ($op == 'delete') {
-    db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid);
-    db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $user->uid);
-  }
-}
-
-function theme_node_search_admin($form) {
-  $output = form_render($form['info']);
-
-  $header = array(t('Factor'), t('Weight'));
-  foreach (element_children($form['factors']) as $key) {
-    $row = array();
-    $row[] = $form['factors'][$key]['#title'];
-    unset($form['factors'][$key]['#title']);
-    $row[] = form_render($form['factors'][$key]);
-    $rows[] = $row;
-  }
-  $output .= theme('table', $header, $rows);
-
-  $output .= form_render($form);
-  return $output;
-}
-
-/**
- * Menu callback; presents general node configuration options.
- */
-function node_configure() {
-
-  $form['default_nodes_main'] = array(
-    '#type' => 'select', '#title' => t('Number of posts on main page'), '#default_value' => variable_get('default_nodes_main', 10),
-    '#options' =>  drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
-    '#description' => t('The default maximum number of posts to display per page on overview pages such as the main page.')
-  );
-
-  $form['teaser_length'] = array(
-    '#type' => 'select', '#title' => t('Length of trimmed posts'), '#default_value' => variable_get('teaser_length', 600),
-    '#options' => array(0 => t('Unlimited'), 200 => t('200 characters'), 400 => t('400 characters'), 600 => t('600 characters'),
-      800 => t('800 characters'), 1000 => t('1000 characters'), 1200 => t('1200 characters'), 1400 => t('1400 characters'),
-      1600 => t('1600 characters'), 1800 => t('1800 characters'), 2000 => t('2000 characters')),
-    '#description' => t("The maximum number of characters used in the trimmed version of a post.  Drupal will use this setting to determine at which offset long posts should be trimmed.  The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc.  To disable teasers, set to 'Unlimited'. Note that this setting will only affect new or updated content and will not affect existing teasers.")
-  );
-
-  $form['node_preview'] = array(
-    '#type' => 'radios', '#title' => t('Preview post'), '#default_value' => variable_get('node_preview', 0),
-    '#options' => array(t('Optional'), t('Required')), '#description' => t('Must users preview posts before submitting?')
-  );
-
-  return system_settings_form('node_configure', $form);
-}
-
-/**
- * Retrieve the comment mode for the given node ID (none, read, or read/write).
- */
-function node_comment_mode($nid) {
-  static $comment_mode;
-  if (!isset($comment_mode[$nid])) {
-    $comment_mode[$nid] = db_result(db_query('SELECT comment FROM {node} WHERE nid = %d', $nid));
-  }
-  return $comment_mode[$nid];
-}
-
-/**
- * Implementation of hook_link().
- */
-function node_link($type, $node = 0, $main = 0) {
-  $links = array();
-
-  if ($type == 'node') {
-    if (array_key_exists('links', $node)) {
-      $links = $node->links;
-    }
-
-    if ($main == 1 && $node->teaser && $node->readmore) {
-      $links[] = l(t('read more'), "node/$node->nid", array('title' => t('Read the rest of this posting.'), 'class' => 'read-more'));
-    }
-  }
-
-  return $links;
-}
-
-/**
- * Implementation of hook_menu().
- */
-function node_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/node', 'title' => t('content'),
-      'callback' => 'node_admin_nodes',
-      'access' => user_access('administer nodes'));
-    $items[] = array('path' => 'admin/node/overview', 'title' => t('list'),
-      'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-
-    if (module_exist('search')) {
-      $items[] = array('path' => 'admin/node/search', 'title' => t('search'),
-        'callback' => 'node_admin_search',
-        'access' => user_access('administer nodes'),
-        'type' => MENU_LOCAL_TASK);
-    }
-
-    $items[] = array('path' => 'admin/settings/node', 'title' => t('posts'),
-      'callback' => 'node_configure',
-      'access' => user_access('administer nodes'));
-    $items[] = array('path' => 'admin/settings/content-types', 'title' => t('content types'),
-      'callback' => 'node_types_configure',
-      'access' => user_access('administer nodes'));
-
-    $items[] = array('path' => 'node', 'title' => t('content'),
-      'callback' => 'node_page',
-      'access' => user_access('access content'),
-      'type' => MENU_MODIFIABLE_BY_ADMIN);
-    $items[] = array('path' => 'node/add', 'title' => t('create content'),
-      'callback' => 'node_page',
-      'access' => user_access('access content'),
-      'type' => MENU_ITEM_GROUPING,
-      'weight' => 1);
-    $items[] = array('path' => 'rss.xml', 'title' => t('rss feed'),
-      'callback' => 'node_feed',
-      'access' => user_access('access content'),
-      'type' => MENU_CALLBACK);
-  }
-  else {
-    if (arg(0) == 'node' && is_numeric(arg(1))) {
-      $node = node_load(arg(1));
-      if ($node->nid) {
-        $items[] = array('path' => 'node/'. arg(1), 'title' => t('view'),
-          'callback' => 'node_page',
-          'access' => node_access('view', $node),
-          'type' => MENU_CALLBACK);
-        $items[] = array('path' => 'node/'. arg(1) .'/view', 'title' => t('view'),
-            'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-        $items[] = array('path' => 'node/'. arg(1) .'/edit', 'title' => t('edit'),
-          'callback' => 'node_page',
-          'access' => node_access('update', $node),
-          'weight' => 1,
-          'type' => MENU_LOCAL_TASK);
-        $items[] = array('path' => 'node/'. arg(1) .'/delete', 'title' => t('delete'),
-          'callback' => 'node_delete_confirm',
-          'access' => node_access('delete', $node),
-          'weight' => 1,
-          'type' => MENU_CALLBACK);
-        $revisions_access = ((user_access('view revisions') || user_access('administer nodes')) && node_access('view', $node) && db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d', arg(1))) > 1);
-        $items[] = array('path' => 'node/'. arg(1) .'/revisions', 'title' => t('revisions'),
-          'callback' => 'node_revisions',
-          'access' => $revisions_access,
-          'weight' => 2,
-          'type' => MENU_LOCAL_TASK);
-      }
-    }
-    else if (arg(0) == 'admin' && arg(1) == 'settings' && arg(2) == 'content-types' && is_string(arg(3))) {
-      $items[] = array('path' => 'admin/settings/content-types/'. arg(3),
-        'title' => t("'%name' content type", array('%name' => node_get_name(arg(3)))),
-        'type' => MENU_CALLBACK);
-    }
-  }
-
-  return $items;
-}
-
-function node_last_changed($nid) {
-  $node = db_fetch_object(db_query('SELECT changed FROM {node} WHERE nid = %d', $nid));
-  return ($node->changed);
-}
-
-/**
- * List node administration operations that can be performed.
- */
-function node_operations() {
-  $operations = array(
-    'approve' =>   array(t('Approve the selected posts'), 'UPDATE {node} SET status = 1, moderate = 0 WHERE nid = %d'),
-    'promote' =>   array(t('Promote the selected posts'), 'UPDATE {node} SET status = 1, promote = 1 WHERE nid = %d'),
-    'sticky' =>    array(t('Make the selected posts sticky'), 'UPDATE {node} SET status = 1, sticky = 1 WHERE nid = %d'),
-    'demote' =>    array(t('Demote the selected posts'), 'UPDATE {node} SET promote = 0 WHERE nid = %d'),
-    'unpublish' => array(t('Unpublish the selected posts'), 'UPDATE {node} SET status = 0 WHERE nid = %d'),
-    'delete' =>    array(t('Delete the selected posts'), '')
-  );
-  return $operations;
-}
-
-/**
- * List node administration filters that can be applied.
- */
-function node_filters() {
-  // Regular filters
-  $filters['status'] = array('title' => t('status'),
-    'options' => array('status-1'   => t('published'),     'status-0' => t('not published'),
-                       'moderate-1' => t('in moderation'), 'moderate-0' => t('not in moderation'),
-                       'promote-1'  => t('promoted'),      'promote-0' => t('not promoted'),
-                       'sticky-1'   => t('sticky'),        'sticky-0' => t('not sticky')));
-  $filters['type'] = array('title' => t('type'), 'options' => node_get_types());
-  // The taxonomy filter
-  if ($taxonomy = module_invoke('taxonomy', 'form_all', 1)) {
-    $filters['category'] = array('title' => t('category'), 'options' => $taxonomy);
-  }
-
-  return $filters;
-}
-
-/**
- * Build query for node administration filters based on session.
- */
-function node_build_filter_query() {
-  $filters = node_filters();
-
-  // Build query
-  $where = $args = array();
-  $join = '';
-  foreach ($_SESSION['node_overview_filter'] as $index => $filter) {
-    list($key, $value) = $filter;
-    switch($key) {
-      case 'status':
-        // Note: no exploitable hole as $key/$value have already been checked when submitted
-        list($key, $value) = explode('-', $value, 2);
-        $where[] = 'n.'. $key .' = %d';
-        break;
-      case 'category':
-        $table = "tn$index";
-        $where[] = "$table.tid = %d";
-        $join .= "INNER JOIN {term_node} $table ON n.nid = $table.nid ";
-        break;
-      case 'type':
-        $where[] = "n.type = '%s'";
-    }
-    $args[] = $value;
-  }
-  $where = count($where) ? 'WHERE '. implode(' AND ', $where) : '';
-
-  return array('where' => $where, 'join' => $join, 'args' => $args);
-}
-
-/**
- * Return form for node administration filters.
- */
-function node_filter_form() {
-  $session = &$_SESSION['node_overview_filter'];
-  $session = is_array($session) ? $session : array();
-  $filters = node_filters();
-
-  $i = 0;
-  $form['filters'] = array('#type' => 'fieldset',
-    '#title' => t('Show only items where'),
-    '#theme' => 'node_filters',
-  );
-  foreach ($session as $filter) {
-    list($type, $value) = $filter;
-    if ($type == 'category') {
-      // Load term name from DB rather than search and parse options array.
-      $value = module_invoke('taxonomy', 'get_term', $value);
-      $value = $value->name;
-    }
-    else {
-      $value = $filters[$type]['options'][$value];
-    }
-    $string = ($i++ ? '<em>and</em> where <strong>%a</strong> is <strong>%b</strong>' : '<strong>%a</strong> is <strong>%b</strong>');
-    $form['filters']['current'][] = array('#value' => t($string, array('%a' => $filters[$type]['title'] , '%b' => $value)));
-  }
-
-  foreach ($filters as $key => $filter) {
-    $names[$key] = $filter['title'];
-    $form['filters']['status'][$key] = array('#type' => 'select', '#options' => $filter['options']);
-  }
-
-  $form['filters']['filter'] = array('#type' => 'radios', '#options' => $names, '#default_value' => 'status');
-  $form['filters']['buttons']['submit'] = array('#type' => 'submit', '#value' => (count($session) ? t('Refine') : t('Filter')));
-  if (count($session)) {
-    $form['filters']['buttons']['undo'] = array('#type' => 'submit', '#value' => t('Undo'));
-    $form['filters']['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset'));
-  }
-
-  return drupal_get_form('node_filter_form', $form);
-}
-
-/**
- * Theme node administration filter form.
- */
-function theme_node_filter_form(&$form) {
-  $output .= '<div id="node-admin-filter">';
-  $output .= form_render($form['filters']);
-  $output .= '</div>';
-  $output .= form_render($form);
-  return $output;
-}
-
-/**
- * Theme node administraton filter selector.
- */
-function theme_node_filters(&$form) {
-  $output .= '<ul>';
-  if (sizeof($form['current'])) {
-    foreach (element_children($form['current']) as $key) {
-      $output .= '<li>' . form_render($form['current'][$key]) . '</li>';
-    }
-  }
-
-  $output .= '<li><dl class="multiselect">' . (sizeof($form['current']) ? '<dt><em>'. t('and') .'</em> '. t('where') .'</dt>' : '') . '<dd class="a">';
-  foreach (element_children($form['filter']) as $key) {
-    $output .= form_render($form['filter'][$key]);
-  }
-  $output .= '</dd>';
-
-  $output .= '<dt>'. t('is') .'</dt>' . '<dd class="b">';
-
-  foreach (element_children($form['status']) as $key) {
-    $output .= form_render($form['status'][$key]);
-  }
-  $output .= '</dd>';
-
-  $output .= '</dl>';
-  $output .= '<div class="container-inline" id="node-admin-buttons">'. form_render($form['buttons']) .'</div>';
-  $output .= '</li></ul><br class="clear" />';
-
-  return $output;
-}
-
-/**
- * Process result from node administration filter form.
- */
-function node_filter_form_submit() {
-  global $form_values;
-  $op = $_POST['op'];
-  $filters = node_filters();
-  switch ($op) {
-    case t('Filter'):
-    case t('Refine'):
-      if (isset($form_values['filter'])) {
-        $filter = $form_values['filter'];
-
-        // Flatten the options array to accommodate hierarchical/nested options.
-        $flat_options = form_options_flatten($filters[$filter]['options']);
-
-        if (isset($flat_options[$form_values[$filter]])) {
-          $_SESSION['node_overview_filter'][] = array($filter, $form_values[$filter]);
-        }
-      }
-      break;
-    case t('Undo'):
-      array_pop($_SESSION['node_overview_filter']);
-      break;
-    case t('Reset'):
-      $_SESSION['node_overview_filter'] = array();
-      break;
-  }
-}
-
-/**
- * Generate the content administration overview.
- */
-function node_admin_nodes_submit($form_id, $edit) {
-  $operations = node_operations();
-  if ($operations[$edit['operation']][1]) {
-    // Flag changes
-    $operation = $operations[$edit['operation']][1];
-    foreach ($edit['nodes'] as $nid => $value) {
-      if ($value) {
-        db_query($operation, $nid);
-      }
-    }
-    cache_clear_all();
-    drupal_set_message(t('The update has been performed.'));
-  }
-}
-
-function node_admin_nodes_validate($form_id, $edit) {
-  $edit['nodes'] = array_diff($edit['nodes'], array(0));
-  if (count($edit['nodes']) == 0) {
-    if ($edit['operation'] == 'delete') {
-      form_set_error('', t('Please select some items to perform the delete operation.'));
-    }
-    else {
-      form_set_error('', t('Please select some items to perform the update on.'));
-    }
-  }
-}
-
-/**
- * Menu callback: content administration.
- */
-function node_admin_nodes() {
-  global $form_values;
-  $output = node_filter_form();
-
-  if ($_POST['edit']['operation'] == 'delete' && $_POST['edit']['nodes']) {
-    return node_multiple_delete_confirm();
-  }
-
-  $filter = node_build_filter_query();
-
-  $result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC', 50, 0, NULL, $filter['args']);
-
-  $form['options'] = array('#type' => 'fieldset',
-    '#title' => t('Update options'),
-    '#prefix' => '<div class="container-inline">',
-    '#suffix' => '</div>',
-  );
-  $options = array();
-  foreach (node_operations() as $key => $value) {
-    $options[$key] = $value[0];
-  }
-  $form['options']['operation'] = array('#type' => 'select', '#options' => $options,  '#default_value' => 'approve');
-  $form['options']['submit'] = array('#type' => 'submit', '#value' => t('Update'));
-
-  $destination = drupal_get_destination();
-  while ($node = db_fetch_object($result)) {
-    $nodes[$node->nid] = '';
-    $form['title'][$node->nid] = array('#value' => l($node->title, 'node/'. $node->nid) .' '. theme('mark', node_mark($node->nid, $node->changed)));
-    $form['name'][$node->nid] =  array('#value' => node_get_name($node));
-    $form['username'][$node->nid] = array('#value' => theme('username', $node));
-    $form['status'][$node->nid] =  array('#value' =>  ($node->status ? t('published') : t('not published')));
-    $form['operations'][$node->nid] = array('#value' => l(t('edit'), 'node/'. $node->nid .'/edit', array(), $destination));
-  }
-  $form['nodes'] = array('#type' => 'checkboxes', '#options' => $nodes);
-  $form['pager'] = array('#value' => theme('pager', NULL, 50, 0));
-
-  // Call the form first, to allow for the form_values array to be populated.
-  $output .= drupal_get_form('node_admin_nodes', $form);
-
-  return $output;
-}
-
-/**
- * Theme node administration overview.
- */
-function theme_node_admin_nodes($form) {
-  // Overview table:
-  $header = array(NULL, t('Title'), t('Type'), t('Author'), t('Status'), t('Operations'));
-
-  $output .= form_render($form['options']);
-  if (isset($form['title']) && is_array($form['title'])) {
-    foreach (element_children($form['title']) as $key) {
-      $row = array();
-      $row[] = form_render($form['nodes'][$key]);
-      $row[] = form_render($form['title'][$key]);
-      $row[] = form_render($form['name'][$key]);
-      $row[] = form_render($form['username'][$key]);
-      $row[] = form_render($form['status'][$key]);
-      $row[] = form_render($form['operations'][$key]);
-      $rows[] = $row;
-    }
-
-  }
-  else  {
-    $rows[] = array(array('data' => t('No posts available.'), 'colspan' => '6'));
-  }
-
-  $output .= theme('table', $header, $rows);
-  if ($form['pager']['#value']) {
-    $output .= form_render($form['pager']);
-  }
-
-  $output .= form_render($form);
-
-  return $output;
-}
-
-function node_multiple_delete_confirm() {
-  $edit = $_POST['edit'];
-
-  $form['nodes'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
-  // array_filter returns only elements with true values
-  foreach (array_filter($edit['nodes']) as $nid => $value) {
-    $title = db_result(db_query('SELECT title FROM {node} WHERE nid = %d', $nid));
-    $form['nodes'][$nid] = array('#type' => 'hidden', '#value' => $nid, '#prefix' => '<li>', '#suffix' => check_plain($title) ."</li>\n");
-  }
-  $form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
-
-  return confirm_form('node_multiple_delete_confirm', $form,
-                      t('Are you sure you want to delete these items?'),
-                      'admin/node', t('This action cannot be undone.'),
-                      t('Delete all'), t('Cancel'));
-}
-
-function node_multiple_delete_confirm_submit($form_id, $edit) {
-  if ($edit['confirm']) {
-    foreach ($edit['nodes'] as $nid => $value) {
-      node_delete($nid);
-    }
-    drupal_set_message(t('The items have been deleted.'));
-  }
-  return 'admin/node';
-}
-
-/**
- * Menu callback; presents each node type configuration page.
- */
-function node_types_configure($type = NULL) {
-  if (isset($type)) {
-    $node = new stdClass();
-    $node->type = $type;
-    $form['submission'] = array('#type' => 'fieldset', '#title' =>t('Submission form') );
-    $form['submission'][$type . '_help']  = array(
-      '#type' => 'textarea', '#title' => t('Explanation or submission guidelines'), '#default_value' =>  variable_get($type .'_help', ''),
-      '#description' => t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_get_name($type)))
-    );
-    $form['submission']['minimum_'. $type .'_size'] = array(
-      '#type' => 'select', '#title' => t('Minimum number of words'), '#default_value' => variable_get('minimum_'. $type .'_size', 0), '#options' => drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)),
-      '#description' => t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_get_name($type)))
-    );
-    $form['workflow'] = array('#type' => 'fieldset', '#title' =>t('Workflow'));
-    $form['type'] = array('#type' => 'value', '#value' => $type);
-
-    $form['array_filter'] = array('#type' => 'value', '#value' => TRUE);
-    return system_settings_form($type .'_node_settings', $form);
-  }
-  else {
-    $header = array(t('Type'), t('Operations'));
-
-    $rows = array();
-    foreach (node_get_types() as $type => $name) {
-      $rows[] = array($name, l(t('configure'), 'admin/settings/content-types/'. $type));
-    }
-
-    return theme('table', $header, $rows);
-  }
-}
-
-/**
- * Generate an overview table of older revisions of a node.
- */
-function node_revision_overview($node) {
-  drupal_set_title(t('Revisions for %title', array('%title' => check_plain($node->title))));
-
-  $header = array(t('Revision'), array('data' => t('Operations'), 'colspan' => 2));
-
-  $revisions = node_revision_list($node);
-
-  $rows = array();
-  $revert_permission = FALSE;
-  if ((user_access('revert revisions') || user_access('administer nodes')) && node_access('update', $node)) {
-    $revert_permission = TRUE;
-  }
-  $delete_permission = FALSE;
-  if (user_access('administer nodes')) {
-    $delete_permission = TRUE;
-  }
-  foreach ($revisions as $revision) {
-    $row = array();
-    $operations = array();
-
-    if ($revision->current_vid > 0) {
-      $row[] = array('data' => t('%date by %username', array('%date' => l(format_date($revision->timestamp, 'small'), "node/$node->nid"), '%username' => theme('username', $revision)))
-                               . (($revision->log != '') ? '<p class="revision-log">'. filter_xss($revision->log) .'</p>' : ''),
-                     'class' => 'revision-current');
-      $operations[] = array('data' => theme('placeholder', t('current revision')), 'class' => 'revision-current', 'colspan' => 2);
-    }
-    else {
-      $row[] = t('%date by %username', array('%date' => l(format_date($revision->timestamp, 'small'), "node/$node->nid/revisions/$revision->vid/view"), '%username' => theme('username', $revision)))
-               . (($revision->log != '') ? '<p class="revision-log">'. filter_xss($revision->log) .'</p>' : '');
-      if ($revert_permission) {
-        $operations[] = l(t('revert'), "node/$node->nid/revisions/$revision->vid/revert");
-      }
-      if ($delete_permission) {
-        $operations[] = l(t('delete'), "node/$node->nid/revisions/$revision->vid/delete");
-      }
-    }
-    $rows[] = array_merge($row, $operations);
-  }
-  $output .= theme('table', $header, $rows);
-
-  return $output;
-}
-
-/**
- * Revert to the revision with the specified revision number. A node and nodeapi "update" event is triggered
- * (via the node_save() call) when a revision is reverted.
- */
-function node_revision_revert($nid, $revision) {
-  global $user;
-
-  $node = node_load($nid, $revision);
-  if ((user_access('revert revisions') || user_access('administer nodes')) && node_access('update', $node)) {
-    if ($node->vid) {
-      $node->revision = 1;
-      $node->log = t('Copy of the revision from %date.', array('%date' => theme('placeholder', format_date($node->revision_timestamp))));
-      $node->taxonomy = array_keys($node->taxonomy);
-
-      node_save($node);
-
-      drupal_set_message(t('%title has been reverted back to the revision from %revision-date', array('%revision-date' => theme('placeholder', format_date($node->revision_timestamp)), '%title' => theme('placeholder', check_plain($node->title)))));
-      watchdog('content', t('%type: reverted %title revision %revision.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title), '%revision' => theme('placeholder', $revision))));
-    }
-    else {
-      drupal_set_message(t('You tried to revert to an invalid revision.'), 'error');
-    }
-    drupal_goto('node/'. $nid .'/revisions');
-  }
-  drupal_access_denied();
-}
-
-/**
- * Delete the revision with specified revision number. A "delete revision" nodeapi event is invoked when a
- * revision is deleted.
- */
-function node_revision_delete($nid, $revision) {
-  if (user_access('administer nodes')) {
-    $node = node_load($nid);
-    if (node_access('delete', $node)) {
-      // Don't delete the current revision
-      if ($revision != $node->vid) {
-        $node = node_load($nid, $revision);
-
-        db_query("DELETE FROM {node_revisions} WHERE nid = %d AND vid = %d", $nid, $revision);
-        node_invoke_nodeapi($node, 'delete revision');
-        drupal_set_message(t('Deleted %title revision %revision.', array('%title' => theme('placeholder', $node->title), '%revision' => theme('placeholder', $revision))));
-        watchdog('content', t('%type: deleted %title revision %revision.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title), '%revision' => theme('placeholder', $revision))));
-      }
-
-      else {
-        drupal_set_message(t('Deletion failed. You tried to delete the current revision.'));
-      }
-      if (db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d', $nid)) > 1) {
-        drupal_goto("node/$nid/revisions");
-      }
-      else {
-        drupal_goto("node/$nid");
-      }
-    }
-  }
-
-  drupal_access_denied();
-}
-
-/**
- * Return a list of all the existing revision numbers.
- */
-function node_revision_list($node) {
-  $revisions = array();
-  $result = db_query('SELECT r.vid, r.title, r.log, r.uid, n.vid AS current_vid, r.timestamp, u.name FROM {node_revisions} r LEFT JOIN {node} n ON n.vid = r.vid INNER JOIN {users} u ON u.uid = r.uid WHERE r.nid = %d ORDER BY r.timestamp DESC', $node->nid);
-  while ($revision = db_fetch_object($result)) {
-    $revisions[] = $revision;
-  }
-
-  return $revisions;
-}
-
-function node_admin_search() {
-  $output = search_form(url('admin/node/search'), $_POST['edit']['keys'], 'node') . search_data($_POST['edit']['keys'], 'node');
-  return $output;
-}
-
-/**
- * Implementation of hook_block().
- */
-function node_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $blocks[0]['info'] = t('Syndicate');
-    return $blocks;
-  }
-  else if ($op == 'view') {
-    $block['subject'] = t('Syndicate');
-    $block['content'] = theme('feed_icon', url('rss.xml'));
-
-    return $block;
-  }
-}
-
-/**
- * A generic function for generating RSS feeds from a set of nodes.
- *
- * @param $nodes
- *   An object as returned by db_query() which contains the nid field.
- * @param $channel
- *   An associative array containing title, link, description and other keys.
- *   The link should be an absolute URL.
- */
-function node_feed($nodes = 0, $channel = array()) {
-  global $base_url, $locale;
-
-  if (!$nodes) {
-    $nodes = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10));
-  }
-
-  $item_length = variable_get('feed_item_length', 'teaser');
-  $namespaces = array('xmlns:dc="http://purl.org/dc/elements/1.1/"');
-
-  while ($node = db_fetch_object($nodes)) {
-    // Load the specified node:
-    $item = node_load($node->nid);
-    $link = url("node/$node->nid", NULL, NULL, 1);
-
-    if ($item_length != 'title') {
-      $teaser = ($item_length == 'teaser') ? TRUE : FALSE;
-
-      // Filter and prepare node teaser
-      if (node_hook($item, 'view')) {
-        node_invoke($item, 'view', $teaser, FALSE);
-      }
-      else {
-        $item = node_prepare($item, $teaser);
-      }
-
-      // Allow modules to change $node->teaser before viewing.
-      node_invoke_nodeapi($item, 'view', $teaser, FALSE);
-    }
-
-    // Prepare the item description
-    switch ($item_length) {
-      case 'fulltext':
-        $item_text = $item->body;
-        break;
-      case 'teaser':
-        $item_text = $item->teaser;
-        if ($item->readmore) {
-          $item_text .= '<p>'. l(t('read more'), 'node/'. $item->nid, NULL, NULL, NULL, TRUE) .'</p>';
-        }
-        break;
-      case 'title':
-        $item_text = '';
-        break;
-    }
-
-    // Allow modules to add additional item fields
-    $extra = node_invoke_nodeapi($item, 'rss item');
-    $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' =>  date('r', $item->created)), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid . ' at ' . $base_url, 'attributes' => array('isPermaLink' => 'false'))));
-    foreach ($extra as $element) {
-      if ($element['namespace']) {
-        $namespaces = array_merge($namespaces, $element['namespace']);
-      }
-    }
-    $items .= format_rss_item($item->title, $link, $item_text, $extra);
-  }
-
-  $channel_defaults = array(
-    'version'     => '2.0',
-    'title'       => variable_get('site_name', 'drupal') .' - '. variable_get('site_slogan', ''),
-    'link'        => $base_url,
-    'description' => variable_get('site_mission', ''),
-    'language'    => $locale
-  );
-  $channel = array_merge($channel_defaults, $channel);
-
-  $output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
-  $output .= "<rss version=\"". $channel["version"] . "\" xml:base=\"". $base_url ."\" ". implode(' ', $namespaces) .">\n";
-  $output .= format_rss_channel($channel['title'], $channel['link'], $channel['description'], $items, $channel['language']);
-  $output .= "</rss>\n";
-
-  drupal_set_header('Content-Type: application/rss+xml; charset=utf-8');
-  print $output;
-}
-
-/**
- * Prepare node for save and allow modules to make changes.
- */
-function node_submit($node) {
-  global $user;
-
-  // Convert the node to an object, if necessary.
-  $node = (object)$node;
-
-  // Auto-generate the teaser, but only if it hasn't been set (e.g. by a
-  // module-provided 'teaser' form item).
-  if (!isset($node->teaser)) {
-    $node->teaser = isset($node->body) ? node_teaser($node->body, isset($node->format) ? $node->format : NULL) : '';
-  }
-
-  $access = user_access('administer nodes');
-  if ($access) {
-    // Populate the "authored by" field.
-    if ($account = user_load(array('name' => $node->name))) {
-      $node->uid = $account->uid;
-    }
-    else {
-      $node->uid = 0;
-    }
-
-    $node->created = $node->date ? strtotime($node->date) : NULL;
-  }
-  // Force defaults in case people modify the form:
-  $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
-  foreach (array('status', 'moderate', 'promote', 'sticky', 'revision') as $key) {
-    if (!$access || !isset($node->$key)) {
-      $node->$key = in_array($key, $node_options);
-    }
-  }
-
-  // Do node-type-specific validation checks.
-  node_invoke($node, 'submit');
-  node_invoke_nodeapi($node, 'submit');
-
-  $node->validated = TRUE;
-
-  return $node;
-}
-
-/**
- * Perform validation checks on the given node.
- */
-function node_validate($node, $form = array()) {
-  // Convert the node to an object, if necessary.
-  $node = (object)$node;
-
-  // Make sure the body has the minimum number of words.
-  // todo use a better word counting algorithm that will work in other languages
-  if (isset($node->body) && count(explode(' ', $node->body)) < variable_get('minimum_'. $node->type .'_size', 0)) {
-    form_set_error('body', t('The body of your %type is too short. You need at least %words words.', array('%words' => variable_get('minimum_'. $node->type .'_size', 0), '%type' => node_get_name($node))));
-  }
-
-  if (isset($node->nid) && (node_last_changed($node->nid) > $_POST['edit']['changed'])) {
-    form_set_error('changed', t('This content has been modified by another user, changes cannot be saved.'));
-  }
-
-  if (user_access('administer nodes')) {
-    // Validate the "authored by" field.
-    if (!empty($node->name) && !($account = user_load(array('name' => $node->name)))) {
-      // The use of empty() is mandatory in the context of usernames
-      // as the empty string denotes the anonymous user.  In case we
-      // are dealing with an anonymous user we set the user ID to 0.
-      form_set_error('name', t('The username %name does not exist.', array ('%name' => theme('placeholder', $node->name))));
-    }
-
-    // Validate the "authored on" field. As of PHP 5.1.0, strtotime returns FALSE instead of -1 upon failure.
-    if (!empty($node->date) && strtotime($node->date) <= 0) {
-      form_set_error('date', t('You have to specify a valid date.'));
-    }
-  }
-
-  // Do node-type-specific validation checks.
-  node_invoke($node, 'validate', $form);
-  node_invoke_nodeapi($node, 'validate', $form);
-}
-
-function node_form_validate($form_id, $form_values, $form) {
-  node_validate($form_values, $form);
-}
-
-function node_object_prepare(&$node) {
-  if (user_access('administer nodes')) {
-    // Set up default values, if required.
-    if (!isset($node->created)) {
-      $node->created = time();
-    }
-
-    if (!isset($node->date)) {
-      $node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O');
-    }
-  }
-  node_invoke($node, 'prepare');
-  node_invoke_nodeapi($node, 'prepare');
-}
-
-/**
- * Generate the node editing form.
- */
-function node_form($node) {
-  $node = (object)$node;
-  $form = node_form_array($node);
-  return drupal_get_form($node->type .'_node_form', $form, 'node_form');
-}
-
-/**
-* Generate the node editing form array.
-*/
-function node_form_array($node) {
-  node_object_prepare($node);
-
-  // Set the id of the top-level form tag
-  $form['#id'] = 'node-form';
-
-  /**
-   * Basic node information.
-   * These elements are just values so they are not even sent to the client.
-   */
-  foreach (array('nid', 'vid', 'uid', 'created', 'type') as $key) {
-    $form[$key] = array('#type' => 'value', '#value' => $node->$key);
-  }
-
-  // Changed must be sent to the client, for later overwrite error checking.
-  $form['changed'] = array('#type' => 'hidden', '#value' => $node->changed);
-
-  // Get the node-specific bits.
-  $form = array_merge_recursive($form, node_invoke($node, 'form'));
-  if (!isset($form['title']['#weight'])) {
-    $form['title']['#weight'] = -5;
-  }
-
-  $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
-  // If this is a new node, fill in the default values.
-  if (!isset($node->nid)) {
-    foreach (array('status', 'moderate', 'promote', 'sticky', 'revision') as $key) {
-      $node->$key = in_array($key, $node_options);
-    }
-    global $user;
-    $node->uid = $user->uid;
-  }
-  else {
-    // Nodes being edited should always be preset with the default revision setting.
-    $node->revision = in_array('revision', $node_options);
-  }
-  $form['#node'] = $node;
-
-  if (user_access('administer nodes')) {
-    // Node author information
-    $form['author'] = array('#type' => 'fieldset', '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 20);
-    $form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $node->name ? $node->name : '', '#weight' => -1, '#description' => t('Leave blank for %anonymous.', array('%anonymous' => theme('placeholder', variable_get('anonymous', 'Anonymous')))));
-    $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => $node->date)));
-
-    if (isset($node->nid)) {
-      $form['author']['date']['#default_value'] = $node->date;
-    }
-
-    // Node options for administrators
-    $form['options'] = array('#type' => 'fieldset', '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 25);
-    $form['options']['status']   = array('#type' => 'checkbox', '#title' => t('Published'), '#default_value' => $node->status);
-    $form['options']['moderate'] = array('#type' => 'checkbox', '#title' => t('In moderation queue'), '#default_value' => $node->moderate);
-    $form['options']['promote']  = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => $node->promote);
-    $form['options']['sticky']   = array('#type' => 'checkbox', '#title' => t('Sticky at top of lists'), '#default_value' => $node->sticky);
-    $form['options']['revision'] = array('#type' => 'checkbox', '#title' => t('Create new revision'), '#default_value' => $node->revision);
-  }
-  else {
-    // Put all of these through as values if the user doesn't have access to them.
-    foreach (array('uid', 'created') as $key) {
-      $form[$key] = array('#type' => 'value', '#value' => $node->$key);
-    }
-  }
-
-  // Add the buttons.
-  $form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 40);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 45);
-  if ($node->nid && node_access('delete', $node)) {
-    $form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 50);
-  }
-
-  $form['#after_build'] = array('node_form_add_preview');
-
-  return $form;
-}
-
-function node_form_add_preview($form) {
-  global $form_values;
-
-  $op = isset($_POST['op']) ? $_POST['op'] : '';
-  if ($op == t('Preview')) {
-    drupal_validate_form($form['form_id']['#value'], $form);
-    if (!form_get_errors()) {
-      // We pass the global $form_values here to preserve changes made during form validation
-      $form['node_preview'] = array('#value' => node_preview((object)$form_values), '#weight' => -100);
-    }
-  }
-  if (variable_get('node_preview', 0) && (form_get_errors() || $op != t('Preview'))) {
-    unset($form['submit']);
-  }
-  return $form;
-}
-
-function theme_node_form($form) {
-  $output = "\n<div class=\"node-form\">\n";
-  if (isset($form['node_preview'])) {
-    $output .= form_render($form['node_preview']);
-  }
-
-  // Admin form fields and submit buttons must be rendered first, because
-  // they need to go to the bottom of the form, and so should not be part of
-  // the catch-all call to form_render().
-  $admin = '';
-  if (isset($form['author'])) {
-    $admin .= "    <div class=\"authored\">\n";
-    $admin .= form_render($form['author']);
-    $admin .= "    </div>\n";
-  }
-  if (isset($form['options'])) {
-    $admin .= "    <div class=\"options\">\n";
-    $admin .= form_render($form['options']);
-    $admin .= "    </div>\n";
-  }
-  $buttons = form_render($form['preview']);
-  $buttons .= form_render($form['submit']);
-  $buttons .= isset($form['delete']) ? form_render($form['delete']) : '';
-
-  // Everything else gets rendered here, and is displayed before the admin form
-  // field and the submit buttons.
-  $output .= "  <div class=\"standard\">\n";
-  $output .= form_render($form);
-  $output .= "  </div>\n";
-
-  if (!empty($admin)) {
-    $output .= "  <div class=\"admin\">\n";
-    $output .= $admin;
-    $output .= "  </div>\n";
-  }
-  $output .= $buttons;
-  $output .= "</div>\n";
-
-  return $output;
-}
-
-/**
- * Present a node submission form or a set of links to such forms.
- */
-function node_add($type) {
-  global $user;
-
-  // If a node type has been specified, validate its existence.
-  if (array_key_exists($type, node_get_types()) && node_access('create', $type)) {
-    // Initialize settings:
-    $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type);
-
-    $output = node_form($node);
-    drupal_set_title(t('Submit %name', array('%name' => node_get_name($node))));
-  }
-  else {
-    // If no (valid) node type has been provided, display a node type overview.
-    foreach (node_get_types() as $type => $name) {
-      if (node_access('create', $type)) {
-        $out = '<dt>'. l($name, "node/add/$type", array('title' => t('Add a new %s.', array('%s' => $name)))) .'</dt>';
-        $out .= '<dd>'. implode("\n", module_invoke_all('help', 'node/add#'. $type)) .'</dd>';
-        $item[$name] = $out;
-      }
-    }
-
-    if (isset($item)) {
-      uksort($item, 'strnatcasecmp');
-      $output = t('Choose the appropriate item from the list:') .'<dl>'. implode('', $item) .'</dl>';
-    }
-    else {
-      $output = t('You are not allowed to create content.');
-    }
-  }
-
-  return $output;
-}
-
-/**
- * Generate a node preview.
- */
-function node_preview($node) {
-  if (node_access('create', $node) || node_access('update', $node)) {
-    // Load the user's name when needed:
-    if (isset($node->name)) {
-      // The use of isset() is mandatory in the context of user IDs, because
-      // user ID 0 denotes the anonymous user.
-      if ($user = user_load(array('name' => $node->name))) {
-        $node->uid = $user->uid;
-      }
-      else {
-        $node->uid = 0; // anonymous user
-      }
-    }
-    else if ($node->uid) {
-      $user = user_load(array('uid' => $node->uid));
-      $node->name = $user->name;
-    }
-
-    // Set the timestamps when needed:
-    if ($node->date) {
-      $node->created = strtotime($node->date);
-    }
-    $node->changed = time();
-
-    // Extract a teaser, if it hasn't been set (e.g. by a module-provided
-    // 'teaser' form item).
-    if (!isset($node->teaser)) {
-      $node->teaser = node_teaser($node->body, $node->format);
-    }
-
-    // Display a preview of the node:
-    // Previewing alters $node so it needs to be cloned.
-    if (!form_get_errors()) {
-      $cloned_node = drupal_clone($node);
-      $cloned_node->in_preview = TRUE;
-      $output = theme('node_preview', $cloned_node);
-    }
-    drupal_set_title(t('Preview'));
-    drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('create content'), 'node/add'), l(t('Submit %name', array('%name' => node_get_name($node))), 'node/add/'. $node->type)));
-
-    return $output;
-  }
-}
-
-/**
- * Display a node preview for display during node creation and editing.
- *
- * @param $node
- *   The node object which is being previewed.
- */
-function theme_node_preview($node) {
-  $output = '<div class="preview">';
-  if ($node->teaser && $node->teaser != $node->body) {
-    drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.'));
-    $output .= '<h3>'. t('Preview trimmed version') .'</h3>';
-    $output .= node_view(drupal_clone($node), 1, FALSE, 0);
-    $output .= '<h3>'. t('Preview full version') .'</h3>';
-    $output .= node_view($node, 0, FALSE, 0);
-  }
-  else {
-    $output .= node_view($node, 0, FALSE, 0);
-  }
-  $output .= "</div>\n";
-
-  return $output;
-}
-
-function node_form_submit($form_id, $edit) {
-  global $user;
-
-  // Fix up the node when required:
-  $node = node_submit($edit);
-
-  // Prepare the node's body:
-  if ($node->nid) {
-    // Check whether the current user has the proper access rights to
-    // perform this operation:
-    if (node_access('update', $node)) {
-      node_save($node);
-      watchdog('content', t('%type: updated %title.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
-      drupal_set_message(t('The %post was updated.', array ('%post' => node_get_name($node))));
-    }
-  }
-  else {
-    // Check whether the current user has the proper access rights to
-    // perform this operation:
-    if (node_access('create', $node)) {
-      node_save($node);
-      watchdog('content', t('%type: added %title.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
-      drupal_set_message(t('Your %post was created.', array ('%post' => node_get_name($node))));
-    }
-  }
-  if ($node->nid) {
-    if (node_access('view', $node)) {
-      return 'node/'. $node->nid;
-    }
-    else {
-      return '';
-    }
-  }
-  // it is very unlikely we get here
-  return FALSE;
-}
-
-/**
- * Menu callback -- ask for confirmation of node deletion
- */
-function node_delete_confirm() {
-  $edit = $_POST['edit'];
-  $edit['nid'] = $edit['nid'] ? $edit['nid'] : arg(1);
-  $node = node_load($edit['nid']);
-
-  if (node_access('delete', $node)) {
-    $form['nid'] = array('#type' => 'value', '#value' => $node->nid);
-    $output = confirm_form('node_delete_confirm', $form,
-                   t('Are you sure you want to delete %title?', array('%title' => theme('placeholder', $node->title))),
-                   $_GET['destination'] ? $_GET['destination'] : 'node/'. $node->nid, t('This action cannot be undone.'),
-                   t('Delete'), t('Cancel')  );
-  }
-
-  return $output;
-}
-
-/**
- * Execute node deletion
- */
-function node_delete_confirm_submit($form_id, $form_values) {
-  if ($form_values['confirm']) {
-    node_delete($form_values['nid']);
-  }
-
-  return '';
-}
-
-/**
- * Delete a node.
- */
-function node_delete($nid) {
-
-  $node = node_load($nid);
-
-  if (node_access('delete', $node)) {
-    db_query('DELETE FROM {node} WHERE nid = %d', $node->nid);
-    db_query('DELETE FROM {node_revisions} WHERE nid = %d', $node->nid);
-
-    // Call the node-specific callback (if any):
-    node_invoke($node, 'delete');
-    node_invoke_nodeapi($node, 'delete');
-
-    // Clear the cache so an anonymous poster can see the node being deleted.
-    cache_clear_all();
-
-    // Remove this node from the search index if needed.
-    if (function_exists('search_wipe')) {
-      search_wipe($node->nid, 'node');
-    }
-    drupal_set_message(t('%title has been deleted.', array('%title' => theme('placeholder', $node->title))));
-    watchdog('content', t('%type: deleted %title.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title))));
-  }
-}
-
-/**
- * Menu callback for revisions related activities.
- */
-function node_revisions() {
-  if (is_numeric(arg(1)) && arg(2) == 'revisions') {
-    $op = arg(4) ? arg(4) : 'overview';
-    switch ($op) {
-      case 'overview':
-        $node = node_load(arg(1));
-        if ((user_access('view revisions') || user_access('administer nodes')) && node_access('view', $node)) {
-          return node_revision_overview($node);
-        }
-        drupal_access_denied();
-        return;
-      case 'view':
-        if (is_numeric(arg(3))) {
-          $node = node_load(arg(1), arg(3));
-          if ($node->nid) {
-            if ((user_access('view revisions') || user_access('administer nodes')) && node_access('view', $node)) {
-              drupal_set_title(t('Revision of %title from %date', array('%title' => theme('placeholder', $node->title), '%date' => format_date($node->revision_timestamp))));
-              return node_show($node, arg(2));
-            }
-            drupal_access_denied();
-            return;
-          }
-        }
-        break;
-      case 'revert':
-        node_revision_revert(arg(1), arg(3));
-        break;
-      case 'delete':
-        node_revision_delete(arg(1), arg(3));
-        break;
-    }
-  }
-  drupal_not_found();
-}
-
-/**
- * Generate a listing of promoted nodes.
- */
-function node_page_default() {
-  $result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));
-
-  if (db_num_rows($result)) {
-    drupal_add_link(array('rel' => 'alternate',
-                          'type' => 'application/rss+xml',
-                          'title' => t('RSS'),
-                          'href' => url('rss.xml', NULL, NULL, TRUE)));
-
-    $output = '';
-    while ($node = db_fetch_object($result)) {
-      $output .= node_view(node_load($node->nid), 1);
-    }
-    $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
-  }
-  else {
-    $output = t('
-      <h1 class="title">Welcome to your new PlanetLab website!</h1>
-      <p>Please follow these steps to set up and start using your website:</p>
-      <ol>
-        <li>
-          <strong>Login</strong>
-          To begin, login using a PlanetLab administrative account (e.g., %plc_root_user). This account will have full administration rights and will allow you to configure both the PlanetLab and Drupal aspects of the website.
-        </li>
-        <li>
-          <strong>Configure your website</strong>
-          Once logged in, visit the <a href="%admin">Drupal administration section</a>, where you can <a href="%config">customize and configure</a> all Drupal aspects of the website. Visit the <a href="%db_adm">PlanetLab administration section</a> to configure your PlanetLab installation.
-        </li>
-        <li>
-          <strong>Enable additional functionality</strong>
-          Next, visit the <a href="%modules">module list</a> and enable features which suit your specific needs. You can find additional modules in the <a href="%download_modules">Drupal modules download section</a>.
-        </li>
-        <li>
-          <strong>Customize your website design</strong>
-          To change the "look and feel" of your website, visit the <a href="%themes">themes section</a>. You may choose from one of the included themes or download additional themes from the <a href="%download_themes">Drupal themes download section</a>.
-        </li>
-        <li>
-          <strong>Start posting content</strong>
-          Finally, you can <a href="%content">create content</a> for your website. This message will disappear once you have published your first post.
-        </li>
-      </ol>
-      <p>For more information about administering the PlanetLab portions of the website, please refer to the <a href="%myplc">MyPLC documentation</a>.</p>
-      <p>For more information about Drupal, please refer to the <a href="%help">Help section</a>, or the <a href="%handbook">online Drupal handbooks</a>. You may also post at the <a href="%forum">Drupal forum</a>, or view the wide range of <a href="%support">other support options</a> available.</p>',
-      array('%drupal' => 'http://drupal.org/', '%register' => url('user/register'), '%admin' => url('admin'), '%config' => url('admin/settings'), '%modules' => url('admin/modules'), '%download_modules' => 'http://drupal.org/project/modules', '%themes' => url('admin/themes'), '%download_themes' => 'http://drupal.org/project/themes', '%content' => url('node/add'), '%help' => url('admin/help'), '%handbook' => 'http://drupal.org/handbooks', '%forum' => 'http://drupal.org/forum', '%support' => 'http://drupal.org/support', '%plc_root_user' => PLC_ROOT_USER, '%db_adm' => '/db/adm/index.php', '%myplc' => '/doc/myplc/myplc.php')
-    );
-    $output = '<div id="first-time">'. $output .'</div>';
-  }
-
-  return $output;
-}
-
-/**
- * Menu callback; dispatches control to the appropriate operation handler.
- */
-function node_page() {
-  $op = arg(1);
-
-  if (is_numeric($op)) {
-    $op = (arg(2) && !is_numeric(arg(2))) ? arg(2) : 'view';
-  }
-
-  switch ($op) {
-    case 'view':
-      if (is_numeric(arg(1))) {
-        $node = node_load(arg(1));
-        if ($node->nid) {
-          drupal_set_title(check_plain($node->title));
-          return node_show($node, arg(2));
-        }
-        else if (db_result(db_query('SELECT nid FROM {node} WHERE nid = %d', arg(1)))) {
-          drupal_access_denied();
-        }
-        else {
-          drupal_not_found();
-        }
-      }
-      break;
-    case 'add':
-      return node_add(arg(2));
-      break;
-    case 'edit':
-      if ($_POST['op'] == t('Delete')) {
-        // Note: we redirect from node/uid/edit to node/uid/delete to make the tabs disappear.
-        if ($_REQUEST['destination']) {
-          $destination = drupal_get_destination();
-          unset($_REQUEST['destination']);
-        }
-        drupal_goto('node/'. arg(1) .'/delete', $destination);
-      }
-
-      if (is_numeric(arg(1))) {
-        $node = node_load(arg(1));
-        if ($node->nid) {
-          drupal_set_title(check_plain($node->title));
-          return node_form($node);
-        }
-        else if (db_result(db_query('SELECT nid FROM {node} WHERE nid = %d', arg(1)))) {
-          drupal_access_denied();
-        }
-        else {
-          drupal_not_found();
-        }
-      }
-      break;
-    default:
-      drupal_set_title('');
-      return node_page_default();
-  }
-}
-
-/**
- * shutdown function to make sure we always mark the last node processed.
- */
-function node_update_shutdown() {
-  global $last_change, $last_nid;
-
-  if ($last_change && $last_nid) {
-    variable_set('node_cron_last', $last_change);
-    variable_set('node_cron_last_nid', $last_nid);
-  }
-}
-
-/**
- * Implementation of hook_update_index().
- */
-function node_update_index() {
-  global $last_change, $last_nid;
-
-  register_shutdown_function('node_update_shutdown');
-
-  $last = variable_get('node_cron_last', 0);
-  $last_nid = variable_get('node_cron_last_nid', 0);
-  $limit = (int)variable_get('search_cron_limit', 100);
-
-  // Store the maximum possible comments per thread (used for ranking by reply count)
-  variable_set('node_cron_comments_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}'))));
-  variable_set('node_cron_views_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(totalcount) FROM {node_counter}'))));
-
-  $result = db_query_range('SELECT GREATEST(c.last_comment_timestamp, n.changed) as last_change, n.nid FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE n.status = 1 AND ((GREATEST(n.changed, c.last_comment_timestamp) = %d AND n.nid > %d) OR (n.changed > %d OR c.last_comment_timestamp > %d)) ORDER BY GREATEST(n.changed, c.last_comment_timestamp) ASC, n.nid ASC', $last, $last_nid, $last, $last, $last, 0, $limit);
-
-  while ($node = db_fetch_object($result)) {
-    $last_change = $node->last_change;
-    $last_nid = $node->nid;
-    $node = node_load($node->nid);
-
-    // Get node output (filtered and with module-specific fields).
-    if (node_hook($node, 'view')) {
-      node_invoke($node, 'view', false, false);
-    }
-    else {
-      $node = node_prepare($node, false);
-    }
-    // Allow modules to change $node->body before viewing.
-    node_invoke_nodeapi($node, 'view', false, false);
-
-    $text = '<h1>'. check_plain($node->title) .'</h1>'. $node->body;
-
-    // Fetch extra data normally not visible
-    $extra = node_invoke_nodeapi($node, 'update index');
-    foreach ($extra as $t) {
-      $text .= $t;
-    }
-
-    // Update index
-    search_index($node->nid, 'node', $text);
-  }
-}
-
-/**
- * Implementation of hook_form_alter().
- */
-function node_form_alter($form_id, &$form) {
-  // Node publishing options
-  if (isset($form['type']) && $form['type']['#value'] .'_node_settings' == $form_id) {
-    $form['workflow']['node_options_'. $form['type']['#value']] = array('#type' => 'checkboxes',
-      '#title' => t('Default options'),
-      '#default_value' => variable_get('node_options_'. $form['type']['#value'], array('status', 'promote')),
-      '#options' => array(
-        'status' => t('Published'),
-        'moderate' => t('In moderation queue'),
-        'promote' => t('Promoted to front page'),
-        'sticky' => t('Sticky at top of lists'),
-        'revision' => t('Create new revision'),
-      ),
-      '#description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.'),
-    );
-  }
-
-  // Advanced node search form
-  elseif ($form_id == 'search_form' && arg(1) == 'node') {
-    // Keyword boxes:
-    $form['advanced'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Advanced search'),
-      '#collapsible' => TRUE,
-      '#collapsed' => TRUE,
-      '#attributes' => array('class' => 'search-advanced'),
-    );
-    $form['advanced']['keywords'] = array(
-      '#prefix' => '<div class="criterion">',
-      '#suffix' => '</div>',
-    );
-    $form['advanced']['keywords']['or'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Containing any of the words'),
-      '#size' => 30,
-      '#maxlength' => 255,
-    );
-    $form['advanced']['keywords']['phrase'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Containing the phrase'),
-      '#size' => 30,
-      '#maxlength' => 255,
-    );
-    $form['advanced']['keywords']['negative'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Containing none of the words'),
-      '#size' => 30,
-      '#maxlength' => 255,
-    );
-
-    // Taxonomy box:
-    if ($taxonomy = module_invoke('taxonomy', 'form_all', 1)) {
-      $form['advanced']['category'] = array(
-        '#type' => 'select',
-        '#title' => t('Only in the category(s)'),
-        '#prefix' => '<div class="criterion">',
-        '#size' => 10,
-        '#suffix' => '</div>',
-        '#options' => $taxonomy,
-        '#multiple' => TRUE,
-      );
-    }
-
-    // Node types:
-    $types = node_get_types();
-    $form['advanced']['type'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Only of the type(s)'),
-      '#prefix' => '<div class="criterion">',
-      '#suffix' => '</div>',
-      '#options' => $types,
-    );
-    $form['advanced']['submit'] = array(
-      '#type' => 'submit',
-      '#value' => t('Advanced search'),
-      '#prefix' => '<div class="action">',
-      '#suffix' => '</div><br class="clear" />',
-    );
-
-    $form['#validate']['node_search_validate'] = array();
-  }
-}
-
-/**
- * Form API callback for the search form. Registered in node_form_alter().
- */
-function node_search_validate($form_id, $form_values, $form) {
-  // Initialise using any existing basic search keywords.
-  $keys = $form_values['processed_keys'];
-
-  // Insert extra restrictions into the search keywords string.
-  if (isset($form_values['type']) && is_array($form_values['type'])) {
-    // Retrieve selected types - Forms API sets the value of unselected checkboxes to 0.
-    $form_values['type'] = array_filter($form_values['type']);
-    if (count($form_values['type'])) {
-      $keys = search_query_insert($keys, 'type', implode(',', array_keys($form_values['type'])));
-    }
-  }
-
-  if (isset($form_values['category']) && is_array($form_values['category'])) {
-    $keys = search_query_insert($keys, 'category', implode(',', $form_values['category']));
-  }
-  if ($form_values['or'] != '') {
-    if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' '. $form_values['or'], $matches)) {
-      $keys .= ' '. implode(' OR ', $matches[1]);
-    }
-  }
-  if ($form_values['negative'] != '') {
-    if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' '. $form_values['negative'], $matches)) {
-      $keys .= ' -'. implode(' -', $matches[1]);
-    }
-  }
-  if ($form_values['phrase'] != '') {
-    $keys .= ' "'. str_replace('"', ' ', $form_values['phrase']) .'"';
-  }
-  if (!empty($keys)) {
-    form_set_value($form['basic']['inline']['processed_keys'], trim($keys));
-  }
-}
-
-/**
- * @defgroup node_access Node access rights
- * @{
- * The node access system determines who can do what to which nodes.
- *
- * In determining access rights for a node, node_access() first checks
- * whether the user has the "administer nodes" permission. Such users have
- * unrestricted access to all nodes. Then the node module's hook_access()
- * is called, and a TRUE or FALSE return value will grant or deny access.
- * This allows, for example, the blog module to always grant access to the
- * blog author, and for the book module to always deny editing access to
- * PHP pages.
- *
- * If node module does not intervene (returns NULL), then the
- * node_access table is used to determine access. All node access
- * modules are queried using hook_node_grants() to assemble a list of
- * "grant IDs" for the user. This list is compared against the table.
- * If any row contains the node ID in question (or 0, which stands for "all
- * nodes"), one of the grant IDs returned, and a value of TRUE for the
- * operation in question, then access is granted. Note that this table is a
- * list of grants; any matching row is sufficient to grant access to the
- * node.
- *
- * In node listings, the process above is followed except that
- * hook_access() is not called on each node for performance reasons and for
- * proper functioning of the pager system. When adding a node listing to your
- * module, be sure to use db_rewrite_sql() to add
- * the appropriate clauses to your query for access checks.
- *
- * To see how to write a node access module of your own, see
- * node_access_example.module.
- */
-
-/**
- * Determine whether the current user may perform the given operation on the
- * specified node.
- *
- * @param $op
- *   The operation to be performed on the node. Possible values are:
- *   - "view"
- *   - "update"
- *   - "delete"
- *   - "create"
- * @param $node
- *   The node object (or node array) on which the operation is to be performed,
- *   or node type (e.g. 'forum') for "create" operation.
- * @param $uid
- *   The user ID on which the operation is to be performed.
- * @return
- *   TRUE if the operation may be performed.
- */
-function node_access($op, $node = NULL, $uid = NULL) {
-  // Convert the node to an object if necessary:
-  if ($op != 'create') {
-    $node = (object)$node;
-  }
-  // If the node is in a restricted format, disallow editing.
-  if ($op == 'update' && !filter_access($node->format)) {
-    return FALSE;
-  }
-
-  if (user_access('administer nodes')) {
-    return TRUE;
-  }
-
-  if (!user_access('access content')) {
-    return FALSE;
-  }
-
-  // Can't use node_invoke(), because the access hook takes the $op parameter
-  // before the $node parameter.
-  $access = module_invoke(node_get_base($node), 'access', $op, $node);
-  if (!is_null($access)) {
-    return $access;
-  }
-
-  // If the module did not override the access rights, use those set in the
-  // node_access table.
-  if ($op != 'create' && $node->nid && $node->status) {
-    $grants = array();
-    foreach (node_access_grants($op, $uid) as $realm => $gids) {
-      foreach ($gids as $gid) {
-        $grants[] = "(gid = $gid AND realm = '$realm')";
-      }
-    }
-
-    $grants_sql = '';
-    if (count($grants)) {
-      $grants_sql = 'AND ('. implode(' OR ', $grants) .')';
-    }
-
-    $sql = "SELECT COUNT(*) FROM {node_access} WHERE (nid = 0 OR nid = %d) $grants_sql AND grant_$op >= 1";
-    $result = db_query($sql, $node->nid);
-    return (db_result($result));
-  }
-  return FALSE;
-}
-
-/**
- * Generate an SQL join clause for use in fetching a node listing.
- *
- * @param $node_alias
- *   If the node table has been given an SQL alias other than the default
- *   "n", that must be passed here.
- * @param $node_access_alias
- *   If the node_access table has been given an SQL alias other than the default
- *   "na", that must be passed here.
- * @return
- *   An SQL join clause.
- */
-function _node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
-  if (user_access('administer nodes')) {
-    return '';
-  }
-
-  return 'INNER JOIN {node_access} '. $node_access_alias .' ON '. $node_access_alias .'.nid = '. $node_alias .'.nid';
-}
-
-/**
- * Generate an SQL where clause for use in fetching a node listing.
- *
- * @param $op
- *   The operation that must be allowed to return a node.
- * @param $node_access_alias
- *   If the node_access table has been given an SQL alias other than the default
- *   "na", that must be passed here.
- * @return
- *   An SQL where clause.
- */
-function _node_access_where_sql($op = 'view', $node_access_alias = 'na', $uid = NULL) {
-  if (user_access('administer nodes')) {
-    return;
-  }
-
-  $grants = array();
-  foreach (node_access_grants($op, $uid) as $realm => $gids) {
-    foreach ($gids as $gid) {
-      $grants[] = "($node_access_alias.gid = $gid AND $node_access_alias.realm = '$realm')";
-    }
-  }
-
-  $grants_sql = '';
-  if (count($grants)) {
-    $grants_sql = 'AND ('. implode(' OR ', $grants) .')';
-  }
-
-  $sql = "$node_access_alias.grant_$op >= 1 $grants_sql";
-  return $sql;
-}
-
-/**
- * Fetch an array of permission IDs granted to the given user ID.
- *
- * The implementation here provides only the universal "all" grant. A node
- * access module should implement hook_node_grants() to provide a grant
- * list for the user.
- *
- * @param $op
- *   The operation that the user is trying to perform.
- * @param $uid
- *   The user ID performing the operation. If omitted, the current user is used.
- * @return
- *   An associative array in which the keys are realms, and the values are
- *   arrays of grants for those realms.
- */
-function node_access_grants($op, $uid = NULL) {
-  global $user;
-
-  if (isset($uid)) {
-    $user_object = user_load(array('uid' => $uid));
-  }
-  else {
-    $user_object = $user;
-  }
-
-  return array_merge(array('all' => array(0)), module_invoke_all('node_grants', $user_object, $op));
-}
-
-/**
- * Determine whether the user has a global viewing grant for all nodes.
- */
-function node_access_view_all_nodes() {
-  static $access;
-
-  if (!isset($access)) {
-    $grants = array();
-    foreach (node_access_grants('view') as $realm => $gids) {
-      foreach ($gids as $gid) {
-        $grants[] = "(gid = $gid AND realm = '$realm')";
-      }
-    }
-
-    $grants_sql = '';
-    if (count($grants)) {
-      $grants_sql = 'AND ('. implode(' OR ', $grants) .')';
-    }
-
-    $sql = "SELECT COUNT(*) FROM {node_access} WHERE nid = 0 $grants_sql AND grant_view >= 1";
-    $result = db_query($sql);
-    $access = db_result($result);
-  }
-
-  return $access;
-}
-
-/**
- * Implementation of hook_db_rewrite_sql
- */
-function node_db_rewrite_sql($query, $primary_table, $primary_field) {
-  if ($primary_field == 'nid' && !node_access_view_all_nodes()) {
-    $return['join'] = _node_access_join_sql($primary_table);
-    $return['where'] = _node_access_where_sql();
-    $return['distinct'] = 1;
-    return $return;
-  }
-}
-
-/**
- * @} End of "defgroup node_access".
- */
-
-
diff --git a/modules/page.module b/modules/page.module
deleted file mode 100644 (file)
index 361ce9f..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-// $Id: page.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables the creation of pages that can be added to the navigation system.
- */
-
-/**
- * Implementation of hook_help().
- */
-function page_help($section) {
-  switch ($section) {
-    case 'admin/help#page':
-      $output = '<p>'. t('The page module allows users to create static pages, which are the most basic type of content.  Pages are commonly collected in books via the book module.  Users should create a page if the information on the page is static.  An example would be an "about" page. ') .'</p>';
-      $output .= '<p>'. t('When a  page is created, a user can set authoring information, configure publishing options, whether readers will be able to post comments.  They can also select the content type of the page (e.g., full HTML, filtered HTML). ') .'</p>';
-      $output .= '<p>'. t('As an administrator, you can set the publishing default for a page (in its workflow): you can specify whether a page is by default published, sent to moderation, promoted to the front page, sticky at the top of lists, and whether revisions are enabled by default.    You can set the permissions that different user roles have to view, create, and edit pages.') .'</p>';
-      $output .= '<p>'. t('If the location module is enabled, then location specific information can be added.  If the trackback module is enabled trackbacks can be configured.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>read the node administration help at <a href="%admin-help-node">administer &gt;&gt; help &gt;&gt; node</a>.</li>
-<li>read the page administration help at <a href="%admin-help-page">administer &gt;&gt; help &gt;&gt; page</a>.</li>
-<li>read the story administration help at <a href="%admin-help-story">administer &gt;&gt; help &gt;&gt; story</a>.</li>
-<li>create a page at <a href="%node-add-page">create content &gt;&gt; page</a>.</li>
-<li>administer page content type at <a href="%admin-settings-content-types-page">administer &gt;&gt; settings &gt;&gt; content types &gt;&gt; configure page</a>.</li>
-</ul>
-', array('%admin-help-node' => url('admin/help/node'), '%admin-help-page' => url('admin/help/page'), '%admin-help-story' => url('admin/help/story'), '%node-add-page' => url('node/add/page'), '%admin-settings-content-types-page' => url('admin/settings/content-types/page')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%page">Page page</a>.', array('%page' => 'http://drupal.org/handbook/modules/page/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Enables the creation of pages that can be added to the navigation system.');
-    case 'node/add#page':
-      return t('If you want to add a static page, like a contact page or an about page, use a page.');
-  }
-}
-
-/**
- * Implementation of hook_perm().
- */
-function page_perm() {
-  return array('create pages', 'edit own pages');
-}
-
-/**
- * Implementation of hook_node_info().
- */
-function page_node_info() {
-  return array('page' => array('name' => t('page'), 'base' => 'page'));
-}
-
-/**
- * Implementation of hook_access().
- */
-function page_access($op, $node) {
-  global $user;
-
-  if ($op == 'create') {
-    return user_access('create pages');
-  }
-
-  if ($op == 'update' || $op == 'delete') {
-    if (user_access('edit own pages') && ($user->uid == $node->uid)) {
-      return TRUE;
-    }
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function page_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'node/add/page', 'title' => t('page'),
-      'access' => user_access('create pages'));
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_form().
- */
-function page_form(&$node) {
-
-  $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -5);
-
-  $form['body_filter']['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE);
-  $form['body_filter']['format'] = filter_form($node->format);
-
-  $form['log'] = array(
-    '#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#weight' => 5,
-    '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
-  );
-
-  return $form;
-}
-
-
diff --git a/modules/path.module b/modules/path.module
deleted file mode 100644 (file)
index 5c93e32..0000000
+++ /dev/null
@@ -1,353 +0,0 @@
-<?php
-// $Id: path.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables users to rename URLs.
- */
-
-/**
- * Implementation of hook_help().
- */
-function path_help($section) {
-  switch ($section) {
-    case 'admin/help#path':
-      $output = '<p>'. t('The path module allows you to specify aliases for Drupal URLs.  Such aliases improve readability of URLs for your users and may help internet search engines to index your content more effectively.  More than one alias may be created for a given page.') .'</p>';
-      $output .= t('<p>Some examples of URL aliases are:</p>
-<ul>
-<li>user/login =&gt; login</li>
-<li>image/tid/16 =&gt; store</li>
-<li>taxonomy/term/7+19+20+21 =&gt; store/products/whirlygigs</li>
-<li>node/3 =&gt; contact</li>
-</ul>
-');
-      $output .= '<p>'. t('The path module enables an extra field for aliases in all node input and editing forms (when users have the appropriate permissions).  It also provides an interface to view and edit all URL aliases.  The two permissions are related to URL aliasing are "administer a list of URL aliases" and "add url aliases".  ') .'</p>';
-      $output .= '<p>'. t('This module also comes with user-defined mass URL aliasing capabilities, which is useful if you wish to uniformly use URLs different from the default.  For example, you may want to have your URLs presented in a different language. Access to the Drupal source code on the web server is required to set up these kinds of aliases. ') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>set the path for a post with the path module.</li>
-<li>add a URL alias: <a href="%admin-path-add">administer &gt;&gt; url aliases &gt;&gt; add alias</a>.</li>
-<li>administer the list of URL aliases: <a href="%admin-path">administer &gt;&gt; url aliases</a>.</li>
-<li>read how to <a href="%external-http-drupal-org-node-15365">configure clean URLs</a> for your webserver.
-<li>enable clean url\'s to remove the =? at <a href="%admin-settings">administer &gt;&gt; settings</a>.</li>
-</ul>
-', array('%admin-path-add' => url('admin/path/add'), '%admin-path' => url('admin/path'), '%external-http-drupal-org-node-15365' => 'http://drupal.org/node/15365', '%admin-settings' => url('admin/settings')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%path">Path page</a>.', array('%path' => 'http://drupal.org/handbook/modules/path/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Allows users to rename URLs.');
-    case 'admin/path':
-      return t("<p>Drupal provides users complete control over URLs through aliasing.  This feature is typically used to make URLs human-readable or easy to remember.  For example, one could map the relative URL 'node/1' onto 'about'. Each system path can have multiple aliases.</p>");
-    case 'admin/path/add':
-      return t('<p>Enter the path you wish to create the alias for, followed by the name of the new alias.</p>');
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function path_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/path', 'title' => t('url aliases'),
-      'callback' => 'path_admin',
-      'access' => user_access('administer url aliases'));
-    $items[] = array('path' => 'admin/path/edit', 'title' => t('edit alias'),
-      'callback' => 'path_admin_edit',
-      'access' => user_access('administer url aliases'),
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/path/delete', 'title' => t('delete alias'),
-      'callback' => 'path_admin_delete_confirm',
-      'access' => user_access('administer url aliases'),
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/path/list', 'title' => t('list'),
-      'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-    $items[] = array('path' => 'admin/path/add', 'title' => t('add alias'),
-      'callback' => 'path_admin_edit',
-      'access' => user_access('administer url aliases'),
-      'type' => MENU_LOCAL_TASK);
-  }
-
-  return $items;
-}
-
-/**
- * Menu callback; presents an overview of all URL aliases.
- */
-function path_admin() {
-  return path_overview();
-}
-
-/**
- * Menu callback; handles pages for creating and editing URL aliases.
- */
-function path_admin_edit($pid = 0) {
-  if ($pid) {
-    $alias = path_load($pid);
-    drupal_set_title($alias['dst']);
-    $output = path_form(path_load($pid));
-  }
-  else {
-    $output = path_form();
-  }
-
-  return $output;
-}
-
-/**
- * Menu callback; confirms deleting an URL alias
- **/
-function path_admin_delete_confirm($pid) {
-  $path = path_load($pid);
-  if (user_access('administer url aliases')) {
-    $form['pid'] = array('#type' => 'value', '#value' => $pid);
-    $output = confirm_form('path_admin_delete_confirm', $form,
-  t('Are you sure you want to delete path alias %title?', array('%title' => theme('placeholder', $path['dst']))),
-   $_GET['destination'] ? $_GET['destination'] : 'admin/path', t('This action cannot be undone.'),
-  t('Delete'), t('Cancel') );
-  }
-
-  return $output;
-}
-
-/**
- * Execute URL alias deletion
- **/
-function path_admin_delete_confirm_submit($form_id, $form_values) {
-  if ($form_values['confirm']) {
-    path_admin_delete($form_values['pid']);
-    return 'admin/path';
-  }
-}
-
-/**
- * Post-confirmation; delete an URL alias.
- */
-function path_admin_delete($pid = 0) {
-  db_query('DELETE FROM {url_alias} WHERE pid = %d', $pid);
-  drupal_set_message(t('The alias has been deleted.'));
-}
-
-
-
-/**
- * Set an aliased path for a given Drupal path, preventing duplicates.
- */
-function path_set_alias($path = NULL, $alias = NULL, $pid = NULL) {
-  if ($path && !$alias) {
-    db_query("DELETE FROM {url_alias} WHERE src = '%s'", $path);
-    drupal_clear_path_cache();
-  }
-  else if (!$path && $alias) {
-    db_query("DELETE FROM {url_alias} WHERE dst = '%s'", $alias);
-    drupal_clear_path_cache();
-  }
-  else if ($path && $alias) {
-    $path = urldecode($path);
-    $path_count = db_result(db_query("SELECT COUNT(src) FROM {url_alias} WHERE src = '%s'", $path));
-    $alias = urldecode($alias);
-    $alias_count = db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s'", $alias));
-
-    // We have an insert:
-    if ($path_count == 0 && $alias_count == 0) {
-      db_query("INSERT INTO {url_alias} (src, dst) VALUES ('%s', '%s')", $path, $alias);
-      drupal_clear_path_cache();
-    }
-    else if ($path_count >= 1 && $alias_count == 0) {
-      if ($pid) {
-        db_query("UPDATE {url_alias} SET dst = '%s', src = '%s' WHERE pid = %d", $alias, $path, $pid);
-      }
-      else {
-        db_query("INSERT INTO {url_alias} (src, dst) VALUES ('%s', '%s')", $path, $alias);
-      }
-      drupal_clear_path_cache();
-    }
-    else if ($path_count == 0 && $alias_count == 1) {
-      db_query("UPDATE {url_alias} SET src = '%s' WHERE dst = '%s'", $path, $alias);
-      drupal_clear_path_cache();
-    }
-    else if ($path_count == 1 && $alias_count == 1) {
-      // This will delete the path that alias was originally pointing to:
-      path_set_alias(NULL, $alias);
-      path_set_alias($path);
-      path_set_alias($path, $alias);
-    }
-  }
-}
-
-/**
- * Return a form for editing or creating an individual URL alias.
- */
-function path_form($edit = '') {
-
-  $form['src'] = array('#type' => 'textfield', '#title' => t('Existing system path'), '#default_value' => $edit['src'], '#maxlength' => 64, '#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'));
-  $form['dst'] = array('#type' => 'textfield', '#default_value' => $edit['dst'], '#maxlength' => 64, '#description' => t('Specify an alternative path by which this data can be accessed.  For example, type "about" when writing an about page.  Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'));
-
-  if ($edit['pid']) {
-    $form['pid'] = array('#type' => 'hidden', '#value' => $edit['pid']);
-    $form['submit'] = array('#type' => 'submit', '#value' => t('Update alias'));
-  }
-  else {
-    $form['submit'] = array('#type' => 'submit', '#value' => t('Create new alias'));
-  }
-
-  return drupal_get_form('path_form', $form);
-}
-
-/**
- * Implementation of hook_nodeapi().
- *
- * Allows URL aliases for nodes to be specified at node edit time rather
- * than through the administrative interface.
- */
-function path_nodeapi(&$node, $op, $arg) {
-  if (user_access('create url aliases') || user_access('administer url aliases')) {
-    switch ($op) {
-      case 'validate':
-        $node->path = trim($node->path);
-        if ($node->path && !valid_url($node->path)) {
-          form_set_error('path', t('The path is invalid.'));
-        }
-        else if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s'", $node->path, "node/$node->nid"))) {
-          form_set_error('path', t('The path is already in use.'));
-        }
-        break;
-
-      case 'load':
-        $path = "node/$node->nid";
-        // We don't use drupal_get_path_alias() to avoid custom rewrite functions.
-        // We only care about exact aliases.
-        $result = db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $path);
-        if (db_num_rows($result)) {
-          $node->path = db_result($result);
-        }
-        break;
-
-      case 'insert':
-        // Don't try to insert if path is NULL.  We may have already set
-        // the alias ahead of time.
-        if ($node->path) {
-          path_set_alias("node/$node->nid", $node->path);
-        }
-        break;
-
-      case 'update':
-        path_set_alias("node/$node->nid", $node->path, $node->pid);
-        break;
-
-      case 'delete':
-        $path = "node/$node->nid";
-        if (drupal_get_path_alias($path) != $path) {
-          path_set_alias($path);
-        }
-        break;
-    }
-  }
-}
-
-/**
- * Implementation of hook_form_alter().
- */
-function path_form_alter($form_id, &$form) {
-  if (user_access('create url aliases') && isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
-    $path = $form['#node']->path;
-    $form['path'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('URL path settings'),
-      '#collapsible' => TRUE,
-      '#collapsed' => empty($path),
-      '#weight' => 30,
-    );
-    $form['path']['path'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $path,
-      '#maxlength' => 250,
-      '#collapsible' => TRUE,
-      '#collapsed' => TRUE,
-      '#description' => t('Optionally specify an alternative URL by which this node can be accessed.  For example, type "about" when writing an about page.  Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
-    );
-    if ($path) {
-      $form['path']['pid'] = array(
-        '#type' => 'value',
-        '#value' => db_result(db_query("SELECT pid FROM {url_alias} WHERE dst = '%s'", $path))
-      );
-    }
-  }
-}
-
-
-/**
- * Implementation of hook_perm().
- */
-function path_perm() {
-  return array('create url aliases', 'administer url aliases');
-}
-
-/**
- * Return a listing of all defined URL aliases.
- */
-function path_overview() {
-  $sql = 'SELECT * FROM {url_alias}';
-  $header = array(
-    array('data' => t('Alias'), 'field' => 'dst', 'sort' => 'asc'),
-    array('data' => t('System'), 'field' => 'src'),
-    array('data' => t('Operations'), 'colspan' => '2')
-  );
-  $sql .= tablesort_sql($header);
-  $result = pager_query($sql, 50);
-
-  $destination = drupal_get_destination();
-  while ($data = db_fetch_object($result)) {
-    $rows[] = array($data->dst, $data->src, l(t('edit'), "admin/path/edit/$data->pid", array(), $destination), l(t('delete'), "admin/path/delete/$data->pid", array(), $destination));
-  }
-
-  if (!$rows) {
-    $rows[] = array(array('data' => t('No URL aliases available.'), 'colspan' => '4'));
-  }
-
-  $output = theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 50, 0);
-  return $output;
-}
-
-/**
- * Fetch a specific URL alias from the database.
- */
-function path_load($pid) {
-  return db_fetch_array(db_query('SELECT * FROM {url_alias} WHERE pid = %d', $pid));
-}
-
-/**
- * Verify that a new URL alias is valid, and save it to the database.
- */
-function path_form_submit() {
-  $edit = $GLOBALS['form_values'];
-  $src = $edit['src'];
-  $dst = $edit['dst'];
-  $pid = $edit['pid'];
-
-  if (!valid_url($src)) {
-    form_set_error('src', t('The system path %path is invalid.', array('%path' => theme('placeholder', $src))));
-  }
-
-  if (!valid_url($dst)) {
-    form_set_error('dst', t('The alias %alias is invalid.', array('%alias' => theme('placeholder', $dst))));
-  }
-
-  if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != %d AND dst = '%s'", $pid, $dst))) {
-    form_set_error('dst', t('The alias %alias is already in use.', array('%alias' => theme('placeholder', $dst))));
-  }
-
-  if (form_get_errors()) {
-    return path_form($edit);
-  }
-  else {
-    path_set_alias($src, $dst, $pid);
-
-    drupal_set_message(t('The alias has been saved.'));
-    return 'admin/path';
-  }
-}
-
-
diff --git a/modules/ping.module b/modules/ping.module
deleted file mode 100644 (file)
index fdf45e9..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-// $Id: ping.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Alerts other sites that your site has been updated.
- */
-
-/**
- * Implementation of hook_help().
- */
-function ping_help($section) {
-  switch ($section) {
-    case 'admin/help#ping':
-      $output = '<p>'. t('The ping module is useful for notifying interested sites that your site has changed.  It automatically sends notifications (called "pings") to the <a href="%external-http-pingomatic-com">pingomatic</a> service to tell it that your site has changed. In turn pingomatic will ping other services such as weblogs.com, Technorati, blo.gs, BlogRolling, Feedster.com, Moreover, etc.', array('%external-http-pingomatic-com' => 'http://pingomatic.com/')) .'</p>';
-      $output .= '<p>'. t('The ping module requires <code>cron</code> or a similar periodic job scheduler to be enabled.') .'</p>';
-      $output .= t('<p>You can:</p>
-<ul>
-<li> enable or disable the ping module at <a href="%admin-modules">administer &gt;&gt; modules</a>.</li>
-<li>run your cron job at your sites <a href="%file-cron">cron page</a>.</li>
-<li>read about <a href="%external-http-drupal-org-node-23714">configuring cron jobs</a>.</li>
-</ul></p>
-', array('%admin-modules' => url('admin/modules'), '%file-cron' => 'cron.php', '%external-http-drupal-org-node-23714' => 'http://drupal.org/node/23714'));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%ping">Ping page</a>.', array('%ping' => 'http://drupal.org/handbook/modules/ping/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Alerts other sites when your site has been updated.');
-  }
-}
-
-/**
- * Implementation of hook_cron().
- *
- * Fire off notifications of updates to remote sites.
- */
-function ping_cron() {
-  global $base_url;
-
-  if (variable_get('site_name', 0) && variable_get('site_slogan', 0)) {
-    if (db_num_rows(db_query("SELECT nid FROM {node} WHERE status = 1 AND moderate = 0 AND (created > '". variable_get('cron_last', time()) ."' OR changed > '". variable_get('cron_last', time()) ."')"))) {
-      _ping_notify(variable_get('site_name', '') .' - '. variable_get('site_slogan', ''), $base_url);
-    }
-  }
-}
-
-/**
- * Call hook_ping() in all modules to notify remote sites that there is
- * new content at this one.
- */
-function _ping_notify($name, $url) {
-  module_invoke_all('ping', $name, $url);
-}
-
-/**
- * Implementation of hook_ping().
- *
- * Notifies pingomatic.com, blo.gs, and technorati.com of changes at this site.
- */
-function ping_ping($name = '', $url = '') {
-
-  $result = xmlrpc('http://rpc.pingomatic.com', 'weblogUpdates.ping', $name, $url);
-
-  if ($result === FALSE) {
-    watchdog('directory ping', t('Failed to notify pingomatic.com (site).'), WATCHDOG_WARNING);
-  }
-}
-
-
diff --git a/modules/poll.module b/modules/poll.module
deleted file mode 100644 (file)
index 14a85a8..0000000
+++ /dev/null
@@ -1,501 +0,0 @@
-<?php
-// $Id: poll.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables your site to capture votes on different topics in the form of multiple
- * choice questions.
- */
-
-/**
- * Implementation of hook_help().
- */
-function poll_help($section) {
-  switch ($section) {
-    case 'admin/help#poll':
-      $output = '<p>'. t('The poll module can be used to create simple polls for site users.  A poll is a simple multiple choice questionnaire which displays the cumulative results of the answers to the poll.  Having polls on the site is a good way to get instant feedback from community members.') .'</p>';
-      $output .= '<p>'. t('Users can create a poll. The title of the poll should be the question, then enter the answers and the "base" vote counts. You can also choose the time period over which the vote will run.The <a href="%poll">poll</a> item in the navigation menu will take you to a page where you can see all the current polls, vote on them (if you haven\'t already) and view the results.', array('%poll' => url('poll'))) .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>view the <a href="%poll">polls page</a>.</li>
-<li><a href="%admin-node-configure-types-poll">administer &gt;&gt; settings &gt;&gt; content types &gt;&gt; configure poll</a>.</li>
-</ul>
-', array('%poll' => url('poll'), '%admin-node-configure-types-poll' => url('admin/settings/content-types/poll')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%poll">Poll page</a>.', array('%poll' => 'http://drupal.org/handbook/modules/poll/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t("Allows your site to capture votes on different topics in the form of multiple choice questions.");
-    case 'node/add#poll':
-      return t("A poll is a multiple-choice question which visitors can vote on.");
-  }
-}
-
-/**
- * Implementation of hook_access().
- */
-function poll_access($op, $node) {
-  if ($op == 'create') {
-    return user_access('create polls');
-  }
-}
-
-/**
- * Implementation of hook_block().
- *
- * Generates a block containing the latest poll.
- */
-function poll_block($op = 'list', $delta = 0) {
-  if (user_access('access content')) {
-    if ($op == 'list') {
-      $blocks[0]['info'] = t('Most recent poll');
-      return $blocks;
-    }
-    else if ($op == 'view') {
-      // Retrieve the latest poll.
-      $sql = db_rewrite_sql("SELECT MAX(n.created) FROM {node} n INNER JOIN {poll} p ON p.nid = n.nid WHERE n.status = 1 AND p.active = 1 AND n.moderate = 0");
-      $timestamp = db_result(db_query($sql));
-      if ($timestamp) {
-        $poll = node_load(array('type' => 'poll', 'created' => $timestamp, 'moderate' => 0, 'status' => 1));
-
-        if ($poll->nid) {
-          // poll_view() dumps the output into $poll->body.
-          poll_view($poll, 1, 0, 1);
-        }
-      }
-      $block['subject'] = t('Poll');
-      $block['content'] = $poll->body;
-      return $block;
-    }
-  }
-}
-
-/**
- * Implementation of hook_cron().
- *
- * Closes polls that have exceeded their allowed runtime.
- */
-function poll_cron() {
-  $result = db_query('SELECT p.nid FROM {poll} p INNER JOIN {node} n ON p.nid = n.nid WHERE (n.created + p.runtime) < '. time() .' AND p.active = 1 AND p.runtime != 0');
-  while ($poll = db_fetch_object($result)) {
-    db_query("UPDATE {poll} SET active = 0 WHERE nid = %d", $poll->nid);
-  }
-}
-
-/**
- * Implementation of hook_delete().
- */
-function poll_delete($node) {
-  db_query("DELETE FROM {poll} WHERE nid = %d", $node->nid);
-  db_query("DELETE FROM {poll_choices} WHERE nid = %d", $node->nid);
-  db_query("DELETE FROM {poll_votes} WHERE nid = %d", $node->nid);
-}
-
-/**
- * Implementation of hook_submit().
- */
-function poll_submit(&$node) {
-  // Renumber fields
-  $node->choice = array_values($node->choice);
-  $node->teaser = poll_teaser($node);
-}
-
-/**
- * Implementation of hook_validate().
- */
-function poll_validate($node) {
-  if (isset($node->title)) {
-    // Check for at least two options and validate amount of votes:
-    $realchoices = 0;
-    // Renumber fields
-    $node->choice = array_values($node->choice);
-    foreach ($node->choice as $i => $choice) {
-      if ($choice['chtext'] != '') {
-        $realchoices++;
-      }
-      if ($choice['chvotes'] < 0) {
-        form_set_error("choice][$i][chvotes", t('Negative values are not allowed.'));
-      }
-    }
-
-    if ($realchoices < 2) {
-      form_set_error("choice][$realchoices][chtext", t('You must fill in at least two choices.'));
-    }
-  }
-}
-
-/**
- * Implementation of hook_form().
- */
-function poll_form(&$node) {
-  $admin = user_access('administer nodes');
-
-  $form['title'] = array('#type' => 'textfield', '#title' => t('Question'), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -1);
-
-  $form['choice']['choices'] = array('#type' => 'hidden', '#default_value' => max(2, count($node->choice) ? count($node->choice) : 5));
-  $form['choice']['morechoices'] = array('#type' => 'checkbox', '#title' => t('Need more choices'), '#default_value' => 0, '#description' => t("If the amount of boxes above isn't enough, check this box and click the Preview button below to add some more."), '#weight' => 1);
-  $form['choice'] = form_builder('poll_node_form', $form['choice']);
-  if ($form['choice']['morechoices']['#value']) {
-    $form['choice']['morechoices']['#value'] = 0;
-    $form['choice']['choices']['#value'] *= 2;
-  }
-
-  // if the value was changed in a previous iteration, retain it.
-  $node->choices = $form['choice']['choices']['#value'];
-
-  // Poll choices
-  $form['choice'] += array('#type' => 'fieldset', '#title' => t('Choices'), '#prefix' => '<div class="poll-form">', '#suffix' => '</div>', '#tree' => TRUE);
-  for ($a = 0; $a < $node->choices; $a++) {
-    $form['choice'][$a]['chtext'] = array('#type' => 'textfield', '#title' => t('Choice %n', array('%n' => ($a + 1))), '#default_value' => $node->choice[$a]['chtext']);
-    if ($admin) {
-      $form['choice'][$a]['chvotes'] = array('#type' => 'textfield', '#title' => t('Votes for choice %n', array('%n' => ($a + 1))), '#default_value' => (int)$node->choice[$a]['chvotes'], '#size' => 5, '#maxlength' => 7);
-    }
-  }
-
-  // Poll attributes
-  $_duration = array(0 => t('Unlimited')) + drupal_map_assoc(array(86400, 172800, 345600, 604800, 1209600, 2419200, 4838400, 9676800, 31536000), "format_interval");
-  $_active = array(0 => t('Closed'), 1 => t('Active'));
-
-  if ($admin) {
-    $form['settings'] = array('#type' => 'fieldset', '#title' => t('Settings'));
-    $form['settings']['active'] = array('#type' => 'radios', '#title' => t('Poll status'), '#default_value' => isset($node->active) ? $node->active : 1, '#options' => $_active, '#description' => t('When a poll is closed, visitors can no longer vote for it.'));
-  }
-  $form['settings']['runtime'] = array('#type' => 'select', '#title' => t('Poll duration'), '#default_value' => $node->runtime ? $node->runtime : 0, '#options' => $_duration, '#description' => t('After this period, the poll will be closed automatically.'));
-
-  return $form;
-}
-
-function poll_insert($node) {
-  if (!user_access('administer nodes')) {
-    // Make sure all votes are 0 initially
-    foreach ($node->choice as $i => $choice) {
-      $node->choice[$i]['chvotes'] = 0;
-    }
-    $node->active = 1;
-  }
-
-  db_query("INSERT INTO {poll} (nid, runtime, active) VALUES (%d, %d, %d)", $node->nid, $node->runtime, $node->active);
-
-  foreach ($node->choice as $choice) {
-    if ($choice['chtext'] != '') {
-      db_query("INSERT INTO {poll_choices} (nid, chtext, chvotes, chorder) VALUES (%d, '%s', %d, %d)", $node->nid, $choice['chtext'], $choice['chvotes'], $i++);
-    }
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function poll_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'node/add/poll', 'title' => t('poll'),
-      'access' => user_access('create polls'));
-    $items[] = array('path' => 'poll', 'title' => t('polls'),
-      'callback' => 'poll_page',
-      'access' => user_access('access content'),
-      'type' => MENU_SUGGESTED_ITEM);
-
-    $items[] = array('path' => 'poll/vote',
-      'title' => t('vote'),
-      'callback' => 'poll_vote',
-      'access' => user_access('vote on polls'),
-      'type' => MENU_CALLBACK);
-  }
-  else {
-    if (arg(0) == 'node' && is_numeric(arg(1))) {
-      $node = node_load(arg(1));
-
-      if ($node->type == 'poll' && $node->allowvotes) {
-        $items[] = array('path' => 'node/'. arg(1) .'/results',
-          'title' => t('results'),
-          'callback' => 'poll_results',
-          'access' => user_access('access content'),
-          'weight' => 3,
-          'type' => MENU_LOCAL_TASK);
-      }
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_load().
- */
-function poll_load($node) {
-  global $user;
-
-  // Load the appropriate choices into the $node object
-  $poll = db_fetch_object(db_query("SELECT runtime, active FROM {poll} WHERE nid = %d", $node->nid));
-
-  $result = db_query("SELECT chtext, chvotes, chorder FROM {poll_choices} WHERE nid = %d ORDER BY chorder", $node->nid);
-  while ($choice = db_fetch_array($result)) {
-    $poll->choice[$choice['chorder']] = $choice;
-  }
-
-  // Determine whether or not this user is allowed to vote
-  $poll->allowvotes = FALSE;
-  if (user_access('vote on polls') && $poll->active) {
-    if ($user->uid && db_num_rows(db_query('SELECT uid FROM {poll_votes} WHERE nid = %d AND uid = %d', $node->nid, $user->uid)) == 0) {
-      $poll->allowvotes = TRUE;
-    }
-    else if ($user->uid == 0 && db_num_rows(db_query("SELECT hostname FROM {poll_votes} WHERE nid = %d AND hostname = '%s'", $node->nid, $_SERVER['REMOTE_ADDR'])) == 0) {
-      $poll->allowvotes = TRUE;
-    }
-  }
-  return $poll;
-}
-
-/**
- * Implementation of hook_node_info().
- */
-function poll_node_info() {
-  return array('poll' => array('name' => t("poll"), 'base' => 'poll'));
-}
-
-function poll_page() {
-  // List all polls
-  $sql = "SELECT n.nid, n.title, p.active, n.created, SUM(c.chvotes) AS votes FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid INNER JOIN {poll_choices} c ON n.nid = c.nid WHERE n.status = 1 AND n.moderate = 0 GROUP BY n.nid, n.title, p.active, n.created ORDER BY n.created DESC";
-  $sql = db_rewrite_sql($sql);
-  $result = pager_query($sql, 15);
-  $output = '<ul>';
-  while ($node = db_fetch_object($result)) {
-    $output .= '<li>'. l($node->title, "node/$node->nid") .' - '. format_plural($node->votes, '1 vote', '%count votes') .' - '. ($node->active ? t('open') : t('closed')) .'</li>';
-  }
-  $output .= '</ul>';
-  $output .= theme("pager", NULL, 15);
-  return $output;
-}
-
-/**
- * Implementation of hook_perm().
- */
-function poll_perm() {
-  return array('create polls', 'vote on polls');
-}
-
-/**
- * Creates a simple teaser that lists all the choices.
- */
-function poll_teaser($node) {
-  $teaser = NULL;
-  if (is_array($node->choice)) {
-    foreach ($node->choice as $k => $choice) {
-      $teaser .= '* '. $choice['chtext'] .'\n';
-    }
-  }
-  return $teaser;
-}
-
-/**
- * Generates the voting form for a poll.
- */
-function poll_view_voting(&$node, $teaser, $page, $block) {
-  if ($_POST['op'] == t('Vote')) {
-    poll_vote($node);
-  }
-
-  if ($node->choice) {
-    $list = array();
-    foreach ($node->choice as $i => $choice) {
-      $list[$i] = check_plain($choice['chtext']);
-    }
-    $form['choice'] = array('#type' => 'radios', '#title' => $page ? '' : check_plain($node->title), '#default_value' => -1, '#options' => $list);
-  }
-  $form['nid'] = array('#type' => 'hidden', '#value' => $node->nid);
-  $form['vote'] = array('#type' => 'submit', '#value' => t('Vote'));
-  $form['#action'] = url('node/'. $node->nid);
-  return drupal_get_form('poll_view_voting', $form);
-}
-
-/**
- * Themes the voting form for a poll.
- */
-function theme_poll_view_voting($form) {
-  $output .= '<div class="poll">';
-  $output .= '  <div class="vote-form">';
-  $output .= '    <div class="choices">';
-  $output .= form_render($form['choice']);
-  $output .= '    </div>';
-  $output .= form_render($form['nid']);
-  $output .= form_render($form['vote']);
-  $output .= '  </div>';
-  $output .= form_render($form);
-  $output .= '</div>';
-  return $output;
-}
-
-/**
- * Generates a graphical representation of the results of a poll.
- */
-function poll_view_results(&$node, $teaser, $page, $block) {
-  // Count the votes and find the maximum
-  foreach ($node->choice as $choice) {
-    $total_votes += $choice['chvotes'];
-    $max_votes = max($max_votes, $choice['chvotes']);
-  }
-
-  foreach ($node->choice as $i => $choice) {
-    if ($choice['chtext'] != '') {
-      $poll_results .= theme('poll_bar', check_plain($choice['chtext']), round($choice['chvotes'] * 100 / max($total_votes, 1)), format_plural($choice['chvotes'], '1 vote', '%count votes'), $block);
-    }
-  }
-
-  $output .= theme('poll_results', check_plain($node->title), $poll_results, $total_votes, $node->links, $block);
-
-  return $output;
-}
-
-function theme_poll_results($title, $results, $votes, $links, $block) {
-  if ($block) {
-    $output .= '<div class="poll">';
-    $output .= '<div class="title">'. $title .'</div>';
-    $output .= $results;
-    $output .= '<div class="total">'. t('Total votes: %votes', array('%votes' => $votes)) .'</div>';
-    $output .= '</div>';
-    $output .= '<div class="links">'. theme('links', $links) .'</div>';
-  }
-  else {
-    $output .= '<div class="poll">';
-    $output .= $results;
-    $output .= '<div class="total">'. t('Total votes: %votes', array('%votes' => $votes)) .'</div>';
-    $output .= '</div>';
-  }
-
-  return $output;
-}
-
-function theme_poll_bar($title, $percentage, $votes, $block) {
-  if ($block) {
-    $output  = '<div class="text">'. $title .'</div>';
-    $output .= '<div class="bar"><div style="width: '. $percentage .'%;" class="foreground"></div></div>';
-    $output .= '<div class="percent">'. $percentage .'%</div>';
-  }
-  else {
-    $output  = '<div class="text">'. $title .'</div>';
-    $output .= '<div class="bar"><div style="width: '. $percentage .'%;" class="foreground"></div></div>';
-    $output .= '<div class="percent">'. $percentage .'% ('. $votes .')</div>';
-  }
-
-  return $output;
-}
-
-/**
- * Callback for the 'results' tab for polls you can vote on
- */
-function poll_results() {
-  if ($node = node_load(arg(1))) {
-    drupal_set_title(check_plain($node->title));
-    return node_show($node, 0);
-  }
-  else {
-    drupal_not_found();
-  }
-}
-
-/**
- * Callback for processing a vote
- */
-function poll_vote(&$node) {
-  global $user;
-  $nid = arg(1);
-
-  if ($node = node_load($nid)) {
-    $edit = $_POST['edit'];
-    $choice = $edit['choice'];
-    $vote = $_POST['vote'];
-
-    if (isset($choice) && isset($node->choice[$choice])) {
-      if ($node->allowvotes) {
-        // Mark the user or host as having voted.
-        if ($user->uid) {
-          db_query('INSERT INTO {poll_votes} (nid, uid) VALUES (%d, %d)', $node->nid, $user->uid);
-        }
-        else {
-          db_query("INSERT INTO {poll_votes} (nid, hostname) VALUES (%d, '%s')", $node->nid, $_SERVER['REMOTE_ADDR']);
-        }
-
-        // Add one to the votes.
-        db_query("UPDATE {poll_choices} SET chvotes = chvotes + 1 WHERE nid = %d AND chorder = %d", $node->nid, $choice);
-
-        $node->allowvotes = FALSE;
-        $node->choice[$choice]['chvotes']++;
-        drupal_set_message(t('Your vote was recorded.'));
-      }
-      else {
-        drupal_set_message(t("You're not allowed to vote on this poll."), 'error');
-      }
-    }
-    else {
-      drupal_set_message(t("You didn't specify a valid poll choice."), 'error');
-    }
-
-    drupal_goto('node/'. $nid);
-  }
-  else {
-    drupal_not_found();
-  }
-}
-
-/**
- * Implementation of hook_view().
- *
- * @param $block
- *   An extra parameter that adapts the hook to display a block-ready
- *   rendering of the poll.
- */
-function poll_view(&$node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
-  global $user;
-  $output = '';
-
-  // Special display for side-block
-  if ($block) {
-    // No 'read more' link
-    $node->body = $node->teaser = '';
-
-    $links = module_invoke_all('link', 'node', $node, 1);
-    $links[] = l(t('older polls'), 'poll', array('title' => t('View the list of polls on this site.')));
-    if ($node->allowvotes && $block) {
-      $links[] = l(t('results'), 'node/'. $node->nid .'/results', array('title' => t('View the current poll results.')));
-    }
-
-    $node->links = $links;
-  }
-
-  if ($node->allowvotes && ($block || arg(2) != 'results')) {
-    $output .= poll_view_voting($node, $teaser, $page, $block);
-  }
-  else {
-    $output .= poll_view_results($node, $teaser, $page, $block);
-  }
-
-  $node->body = $node->teaser = $output;
-}
-
-/**
- * Implementation of hook_update().
- */
-function poll_update($node) {
-  db_query('UPDATE {poll} SET runtime = %d, active = %d WHERE nid = %d', $node->runtime, $node->active, $node->nid);
-
-  db_query('DELETE FROM {poll_choices} WHERE nid = %d', $node->nid);
-  db_query('DELETE FROM {poll_votes} WHERE nid = %d', $node->nid);
-  foreach ($node->choice as $choice) {
-    $chvotes = (int)$choice['chvotes'];
-    $chtext = $choice['chtext'];
-
-    if ($chtext != '') {
-      db_query("INSERT INTO {poll_choices} (nid, chtext, chvotes, chorder) VALUES (%d, '%s', %d, %d)", $node->nid, $chtext, $chvotes, $i++);
-    }
-  }
-}
-
-/**
- * Implementation of hook_user().
- */
-function poll_user($op, &$edit, &$user) {
-  if ($op == 'delete') {
-    db_query('UPDATE {poll_votes} SET uid = 0 WHERE uid = %d', $user->uid);
-  }
-}
diff --git a/modules/profile.module b/modules/profile.module
deleted file mode 100644 (file)
index 30bb492..0000000
+++ /dev/null
@@ -1,788 +0,0 @@
-<?php
-// $Id: profile.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Support for configurable user profiles.
- */
-
-/**
- * Flags to define the visibility of a profile field.
- */
-define('PROFILE_PRIVATE', 1);
-define('PROFILE_PUBLIC', 2);
-define('PROFILE_PUBLIC_LISTINGS', 3);
-define('PROFILE_HIDDEN', 4);
-
-/**
- * Implementation of hook_help().
- */
-function profile_help($section) {
-  switch ($section) {
-    case 'admin/help#profile':
-      $output = '<p>'. t('The profile module allows you to define custom fields (such as country, real name, age, ...) in the user profile. This permits users of a site to share more information about themselves, and can help community-based sites to organize users around profile fields.') .'</p>';
-      $output .= t('<p>The following types of fields can be added to the user profile:</p>
-<ul>
-<li>single-line textfield</li>
-<li>multi-line textfield</li>
-<li>checkbox</li>
-<li>list selection</li>
-<li>freeform list</li>
-<li>URL</li>
-<li>date</li>
-</ul>
-');
-      $output .= t('<p>You can</p>
-<ul>
-<li>view user <a href="%profile">profiles</a>.</li>
-<li>administer profile settings: <a href="%admin-settings-profile">administer &gt;&gt; settings &gt;&gt; profiles</a>.</li>
-</ul>
-', array('%profile' => url('profile'), '%admin-settings-profile' => url('admin/settings/profile')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%profile">Profile page</a>.', array('%profile' => 'http://drupal.org/handbook/modules/profile/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Supports configurable user profiles.');
-    case 'admin/settings/profile':
-      return t('<p>Here you can define custom fields that users can fill in in their user profile (such as <em>country</em>, <em>real name</em>, <em>age</em>, ...).</p>');
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function profile_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'profile',
-      'title' => t('user list'),
-      'callback' => 'profile_browse',
-      'access' => user_access('access user profiles'),
-      'type' => MENU_SUGGESTED_ITEM);
-    $items[] = array('path' => 'admin/settings/profile',
-      'title' => t('profiles'),
-      'callback' => 'profile_admin_overview');
-    $items[] = array('path' => 'admin/settings/profile/add',
-      'title' => t('add field'),
-      'callback' => 'profile_field_form',
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/settings/profile/edit',
-      'title' => t('edit field'),
-      'callback' => 'profile_field_form',
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/settings/profile/delete',
-      'title' => t('delete field'),
-      'callback' => 'profile_field_delete',
-      'type' => MENU_CALLBACK);
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_block().
- */
-function profile_block($op = 'list', $delta = 0, $edit = array()) {
-
-  if ($op == 'list') {
-     $blocks[0]['info'] = t('Author information');
-
-     return $blocks;
-  }
-  else if ($op == 'configure' && $delta == 0) {
-    // Compile a list of fields to show
-    $fields = array();
-    $result = db_query('SELECT name, title, weight, visibility FROM {profile_fields} WHERE visibility IN (%d, %d) ORDER BY weight', PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS);
-    while ($record = db_fetch_object($result)) {
-      $fields[$record->name] = $record->title;
-    }
-    $fields['user_profile'] = t('Link to full user profile');
-    $form['profile_block_author_fields'] = array('#type' => 'checkboxes',
-      '#title' => t('Profile fields to display'),
-      '#default_value' => variable_get('profile_block_author_fields', NULL),
-      '#options' => $fields,
-      '#description' => t('Select which profile fields you wish to display in the block. Only fields designated as public in the <a href="%profile-admin">profile field configuration</a> are available.', array('%profile-admin' => url('admin/settings/profile'))),
-    );
-    return $form;
-  }
-  else if ($op == 'save' && $delta == 0) {
-    variable_set('profile_block_author_fields', $edit['profile_block_author_fields']);
-  }
-  else if ($op == 'view') {
-    if (user_access('access user profiles')) {
-      if ((arg(0) == 'node') && is_numeric(arg(1)) && (arg(2) == NULL)) {
-        $node = node_load(arg(1));
-        $account = user_load(array('uid' => $node->uid));
-
-        if ($use_fields = variable_get('profile_block_author_fields', array())) {
-          // Compile a list of fields to show.
-          $fields = array();
-          $result = db_query('SELECT name, title, type, visibility, weight FROM {profile_fields} WHERE visibility IN (%d, %d) ORDER BY weight', PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS);
-          while ($record = db_fetch_object($result)) {
-            // Ensure that field is displayed only if it is among the defined block fields and, if it is private, the user has appropriate permissions.
-            if (isset($use_fields[$record->name]) && $use_fields[$record->name]) {
-              $fields[] = $record;
-            }
-          }
-        }
-
-        if ($fields) {
-          $fields = _profile_update_user_fields($fields, $account);
-          $output .= theme('profile_block', $account, $fields, true);
-        }
-
-        if (isset($use_fields['user_profile']) && $use_fields['user_profile']) {
-          $output .= '<div>' . l(t('View full user profile'), 'user/' . $account->uid) . '</div>';
-        }
-      }
-
-      if ($output) {
-         $block['subject'] = t('About %name', array('%name' => $account->name));
-         $block['content'] = $output;
-         return $block;
-      }
-    }
-  }
-}
-
-/**
- * Implementation of hook_user().
- */
-function profile_user($type, &$edit, &$user, $category = NULL) {
-  switch ($type) {
-    case 'load':
-      return profile_load_profile($user);
-    case 'register':
-      return profile_form_profile($edit, $user, $category);
-    case 'update':
-    case 'insert':
-      return profile_save_profile($edit, $user, $category);
-    case 'view':
-      return profile_view_profile($user);
-    case 'form':
-      return profile_form_profile($edit, $user, $category);
-    case 'validate':
-      return profile_validate_profile($edit, $category);
-    case 'categories':
-      return profile_categories();
-    case 'delete':
-      db_query('DELETE FROM {profile_values} WHERE uid = %d', $user->uid);
-  }
-}
-
-/**
- * Menu callback: Generate a form to add/edit a user profile field.
- */
-function profile_field_form($arg = NULL) {
-  if (arg(3) == 'edit') {
-    if (is_numeric($arg)) {
-      $fid = $arg;
-
-      $edit = db_fetch_array(db_query('SELECT * FROM {profile_fields} WHERE fid = %d', $fid));
-
-      if (!$edit) {
-        drupal_not_found();
-        return;
-      }
-      drupal_set_title(t('edit %title', array('%title' => $edit['title'])));
-      $form['fid'] = array('#type' => 'value',
-        '#value' => $fid,
-      );
-      $type = $edit['type'];
-    }
-    else {
-      drupal_not_found();
-      return;
-    }
-  }
-  else {
-    $types = _profile_field_types();
-    if (!isset($types[$arg])) {
-      drupal_not_found();
-      return;
-    }
-    $type = $arg;
-    drupal_set_title(t('add new %type', array('%type' => $types[$type])));
-    $edit = array('name' => 'profile_');
-    $form['type'] = array('#type' => 'value', '#value' => $type);
-  }
-  $form['fields'] = array('#type' => 'fieldset',
-    '#title' => t('Field settings'),
-  );
-  $form['fields']['category'] = array('#type' => 'textfield',
-    '#title' => t('Category'),
-    '#default_value' => $edit['category'],
-    '#description' => t('The category the new field should be part of. Categories are used to group fields logically. An example category is "Personal information".'),
-    '#required' => TRUE,
-  );
-  $form['fields']['title'] = array('#type' => 'textfield',
-    '#title' => t('Title'),
-    '#default_value' => $edit['title'],
-    '#description' => t('The title of the new field. The title will be shown to the user. An example title is "Favorite color".'),
-    '#required' => TRUE,
-  );
-  $form['fields']['name'] = array('#type' => 'textfield',
-    '#title' => t('Form name'),
-    '#default_value' => $edit['name'],
-    '#description' => t('The name of the field. The form name is not shown to the user but used internally in the HTML code and URLs.
-Unless you know what you are doing, it is highly recommended that you prefix the form name with <code>profile_</code> to avoid name clashes with other fields. Spaces or any other special characters except dash (-) and underscore (_) are not allowed. An example name is "profile_favorite_color" or perhaps just "profile_color".'),
-    '#required' => TRUE,
-  );
-  $form['fields']['explanation'] = array('#type' => 'textarea',
-    '#title' => t('Explanation'),
-    '#default_value' => $edit['explanation'],
-    '#description' => t('An optional explanation to go with the new field. The explanation will be shown to the user.'),
-  );
-  if ($type == 'selection') {
-    $form['fields']['options'] = array('#type' => 'textarea',
-      '#title' => t('Selection options'),
-      '#default_value' => $edit['options'],
-      '#description' => t('A list of all options. Put each option on a separate line. Example options are "red", "blue", "green", etc.'),
-    );
-  }
-  $form['fields']['weight'] = array('#type' => 'weight',
-    '#title' => t('Weight'),
-    '#default_value' => $edit['weight'],
-    '#delta' => 5,
-    '#description' => t('The weights define the order in which the form fields are shown. Lighter fields "float up" towards the top of the category.'),
-  );
-  $form['fields']['visibility'] = array('#type' => 'radios',
-    '#title' => t('Visibility'),
-    '#default_value' => isset($edit['visibility']) ? $edit['visibility'] : PROFILE_PUBLIC,
-    '#options' => array(PROFILE_HIDDEN => t('Hidden profile field, only accessible by administrators, modules and themes.'), PROFILE_PRIVATE => t('Private field, content only available to privileged users.'), PROFILE_PUBLIC => t('Public field, content shown on profile page but not used on member list pages.'), PROFILE_PUBLIC_LISTINGS => t('Public field, content shown on profile page and on member list pages.')),
-  );
-  if ($type == 'selection' || $type == 'list' || $type == 'textfield') {
-    $form['fields']['page'] = array('#type' => 'textfield',
-      '#title' => t('Page title'),
-      '#default_value' => $edit['page'],
-      '#description' => t('To enable browsing this field by value, enter a title for the resulting page. The word <code>%value</code> will be substituted with the corresponding value. An example page title is "People whose favorite color is %value". This is only applicable for a public field.'),
-    );
-  }
-  else if ($type == 'checkbox') {
-    $form['fields']['page'] = array('#type' => 'textfield',
-      '#title' => t('Page title'),
-      '#default_value' => $edit['page'],
-      '#description' => t('To enable browsing this field by value, enter a title for the resulting page. An example page title is "People who are employed". This is only applicable for a public field.'),
-    );
-  }
-  $form['fields']['required'] = array('#type' => 'checkbox',
-    '#title' => t('The user must enter a value.'),
-    '#default_value' => $edit['required'],
-  );
-  $form['fields']['register'] = array('#type' => 'checkbox',
-    '#title' => t('Visible in user registration form.'),
-    '#default_value' => $edit['register'],
-  );
-  $form['submit'] = array('#type' => 'submit',
-    '#value' => t('Save field'),
-  );
-  return drupal_get_form('profile_field_form', $form);
-}
-
-/**
- * Validate profile_field_form submissions.
- */
-function profile_field_form_validate($form_id, $form_values) {
-  // Validate the 'field name':
-  if (eregi('[^a-z0-9_-]', $form_values['name'])) {
-    form_set_error('name', t('The specified form name contains one or more illegal characters. Spaces or any other special characters expect dash (-) and underscore (_) are not allowed.'));
-  }
-
-  if (in_array($form_values['name'], user_fields())) {
-    form_set_error('name', t('The specified form name is reserved for use by Drupal.'));
-  }
-  // Validate the category:
-  if (!$form_values['category']) {
-    form_set_error('category', t('You must enter a category.'));
-  }
-  if ($form_values['category'] == 'account') {
-    form_set_error('category', t('The specified category name is reserved for use by Drupal.'));
-  }
-  $args1 = array($form_values['title'], $form_values['category']);
-  $args2 = array($form_values['name']);
-  $query_suffix = '';
-
-  if (isset($form_values['fid'])) {
-    $args1[] = $args2[] = $form_values['fid'];
-    $query_suffix = ' AND fid != %d';
-  }
-
-  if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE title = '%s' AND category = '%s'". $query_suffix, $args1))) {
-    form_set_error('title', t('The specified title is already in use.'));
-  }
-  if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE name = '%s'". $query_suffix, $args2))) {
-    form_set_error('name', t('The specified name is already in use.'));
-  }
-}
-
-/**
- * Process profile_field_form submissions.
- */
-function profile_field_form_submit($form_id, $form_values) {
-  if (!isset($form_values['fid'])) {
-    db_query("INSERT INTO {profile_fields} (title, name, explanation, category, type, weight, required, register, visibility, options, page) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, '%s', '%s')", $form_values['title'], $form_values['name'], $form_values['explanation'], $form_values['category'], $form_values['type'], $form_values['weight'], $form_values['required'], $form_values['register'], $form_values['visibility'], $form_values['options'], $form_values['page']);
-
-    drupal_set_message(t('The field has been created.'));
-    watchdog('profile', t('Profile field %field added under category %category.', array('%field' => theme('placeholder', $form_values['title']), '%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE, l(t('view'), 'admin/settings/profile'));
-  }
-  else {
-    db_query("UPDATE {profile_fields} SET title = '%s', name = '%s', explanation = '%s', category = '%s', weight = %d, required = %d, register = %d, visibility = %d, options = '%s', page = '%s' WHERE fid = %d", $form_values['title'], $form_values['name'], $form_values['explanation'], $form_values['category'], $form_values['weight'], $form_values['required'], $form_values['register'], $form_values['visibility'], $form_values['options'], $form_values['page'], $form_values['fid']);
-
-    drupal_set_message(t('The field has been updated.'));
-  }
-  cache_clear_all();
-
-  return 'admin/settings/profile';
-}
-
-/**
- * Menu callback; deletes a field from all user profiles.
- */
-function profile_field_delete($fid) {
-  $field = db_fetch_object(db_query("SELECT title FROM {profile_fields} WHERE fid = %d", $fid));
-  if (!$field) {
-    drupal_not_found();
-    return;
-  }
-  $form['fid'] = array('#type' => 'value', '#value' => $fid);
-  $form['title'] = array('#type' => 'value', '#value' => $field->title);
-
-  return confirm_form('profile_field_delete', $form, t('Are you sure you want to delete the field %field?', array('%field' => theme('placeholder', $field->title))), 'admin/settings/profile', t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="%edit-field">edit this field</a> and change it to a %hidden-field so that it may only be accessed by administrators.', array('%edit-field' => url('admin/settings/profile/edit/' . $fid), '%hidden-field' => theme('placeholder', t('hidden profile field')))), t('Delete'), t('Cancel'));
-}
-
-/**
- * Process a field delete form submission.
- */
-function profile_field_delete_submit($form_id, $form_values) {
-  db_query('DELETE FROM {profile_fields} WHERE fid = %d', $form_values['fid']);
-  db_query('DELETE FROM {profile_values} WHERE fid = %d', $form_values['fid']);
-
-  cache_clear_all();
-
-  drupal_set_message(t('The field %field has been deleted.', array('%field' => theme('placeholder', $form_values['title']))));
-  watchdog('profile', t('Profile field %field deleted.', array('%field' => theme('placeholder', $form_values['title']))), WATCHDOG_NOTICE, l(t('view'), 'admin/settings/profile'));
-
-  return 'admin/settings/profile';
-}
-
-/**
- * Menu callback; display a listing of all editable profile fields.
- */
-function profile_admin_overview() {
-
-  $result = db_query('SELECT * FROM {profile_fields} ORDER BY category, weight');
-  $rows = array();
-  while ($field = db_fetch_object($result)) {
-    $rows[] = array(check_plain($field->title), $field->name, _profile_field_types($field->type), $field->category, l(t('edit'), "admin/settings/profile/edit/$field->fid"), l(t('delete'), "admin/settings/profile/delete/$field->fid"));
-  }
-  if (count($rows) == 0) {
-    $rows[] = array(array('data' => t('No fields defined.'), 'colspan' => '6'));
-  }
-
-  $header = array(t('Title'), t('Name'), t('Type'), t('Category'), array('data' => t('Operations'), 'colspan' => '2'));
-
-  $output  = theme('table', $header, $rows);
-  $output .= '<h2>'. t('Add new field') .'</h2>';
-  $output .= '<ul>';
-  foreach (_profile_field_types() as $key => $value) {
-    $output .= '<li>'. l($value, "admin/settings/profile/add/$key") .'</li>';
-  }
-  $output .= '</ul>';
-
-  return $output;
-}
-
-/**
- * Menu callback; display a list of user information.
- */
-function profile_browse() {
-
-  $name = arg(1);
-  list(,,$value) = explode('/', $_GET['q'], 3);
-
-  $field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page, visibility FROM {profile_fields} WHERE name = '%s'", $name));
-
-  if ($name && $field->fid) {
-    // Only allow browsing of fields that have a page title set.
-    if (empty($field->page)) {
-      drupal_not_found();
-      return;
-    }
-    // Do not allow browsing of private fields by non-admins.
-    if (!user_access('administer users') && $field->visibility == PROFILE_PRIVATE) {
-       drupal_access_denied();
-       return;
-    }
-
-    // Compile a list of fields to show.
-    $fields = array();
-    $result = db_query('SELECT name, title, type, weight FROM {profile_fields} WHERE fid != %d AND visibility = %d ORDER BY weight', $field->fid, PROFILE_PUBLIC_LISTINGS);
-    while ($record = db_fetch_object($result)) {
-      $fields[] = $record;
-    }
-
-    // Determine what query to use:
-    $arguments = array($field->fid);
-    switch ($field->type) {
-      case 'checkbox':
-        $query = 'v.value = 1';
-        break;
-      case 'textfield':
-      case 'selection':
-        $query = "v.value = '%s'";
-        $arguments[] = $value;
-        break;
-      case 'list':
-        $query = "v.value LIKE '%%%s%%'";
-        $arguments[] = $value;
-        break;
-      default:
-        drupal_not_found();
-        return;
-    }
-
-    // Extract the affected users:
-    $result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_values} v ON u.uid = v.uid WHERE v.fid = %d AND $query ORDER BY u.access DESC", 20, 0, NULL, $arguments);
-
-    $output = '<div id="profile">';
-    while ($account = db_fetch_object($result)) {
-      $account = user_load(array('uid' => $account->uid));
-      $profile = _profile_update_user_fields($fields, $account);
-      $output .= theme('profile_listing', $account, $profile);
-    }
-    $output .= theme('pager', NULL, 20);
-
-    if ($field->type == 'selection' || $field->type == 'list' || $field->type == 'textfield') {
-      $title = strtr($field->page, array('%value' => theme('placeholder', $value)));
-    }
-    else {
-      $title = $field->page;
-    }
-    $output .= '</div>';
-
-    drupal_set_title($title);
-    return $output;
-  }
-  else if ($name && !$field->fid) {
-    drupal_not_found();
-  }
-  else {
-    // Compile a list of fields to show.
-    $fields = array();
-    $result = db_query('SELECT name, title, type, weight FROM {profile_fields} WHERE visibility = %d ORDER BY category, weight', PROFILE_PUBLIC_LISTINGS);
-    while ($record = db_fetch_object($result)) {
-      $fields[] = $record;
-    }
-
-    // Extract the affected users:
-    $result = pager_query("SELECT uid, access FROM {users} WHERE uid > 0 AND status != 0 ORDER BY access DESC", 20, 0, NULL);
-
-    $output = '<div id="profile">';
-    while ($account = db_fetch_object($result)) {
-      $account = user_load(array('uid' => $account->uid));
-      $profile = _profile_update_user_fields($fields, $account);
-      $output .= theme('profile_listing', $account, $profile);
-    }
-    $output .= '</div>';
-    $output .= theme('pager', NULL, 20);
-
-    drupal_set_title(t('user list'));
-    return $output;
-  }
-}
-
-function profile_load_profile(&$user) {
-  $result = db_query('SELECT f.name, f.type, v.value FROM {profile_fields} f INNER JOIN {profile_values} v ON f.fid = v.fid WHERE uid = %d', $user->uid);
-  while ($field = db_fetch_object($result)) {
-    if (empty($user->{$field->name})) {
-      $user->{$field->name} = _profile_field_serialize($field->type) ? unserialize($field->value) : $field->value;
-    }
-  }
-}
-
-function profile_save_profile(&$edit, &$user, $category) {
-  if ((arg(0) == 'user' && arg(1) == 'register') || (arg(0) == 'admin' && arg(1) == 'user' && arg(2) == 'create')) {
-    $result = db_query('SELECT fid, name, type FROM {profile_fields} WHERE register = 1 AND visibility != %d ORDER BY category, weight', PROFILE_HIDDEN);
-  }
-  else {
-    $result = db_query("SELECT fid, name, type FROM {profile_fields} WHERE LOWER(category) = LOWER('%s') AND visibility != %d", $category, PROFILE_HIDDEN);
-    // Use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues.
-  }
-  while ($field = db_fetch_object($result)) {
-    if (_profile_field_serialize($field->type)) {
-       $edit[$field->name] = serialize($edit[$field->name]);
-    }
-    db_query("DELETE FROM {profile_values} WHERE fid = %d AND uid = %d", $field->fid, $user->uid);
-    db_query("INSERT INTO {profile_values} (fid, uid, value) VALUES (%d, %d, '%s')", $field->fid, $user->uid, $edit[$field->name]);
-    // Mark field as handled (prevents saving to user->data).
-    $edit[$field->name] = NULL;
-  }
-}
-
-function profile_view_field($user, $field) {
-  // Only allow browsing of private fields for admins, if browsing is enabled,
-  // and if a user has permission to view profiles. Note that this check is
-  // necessary because a user may always see their own profile.
-  $browse = user_access('access user profiles')
-         && (user_access('administer users') || $field->visibility != PROFILE_PRIVATE)
-         && !empty($field->page);
-
-  if ($value = $user->{$field->name}) {
-    switch ($field->type) {
-      case 'textarea':
-        return check_markup($value);
-      case 'textfield':
-      case 'selection':
-        return $browse ? l($value, 'profile/'. $field->name .'/'. $value) : check_plain($value);
-      case 'checkbox':
-        return $browse ? l($field->title, 'profile/'. $field->name) : check_plain($field->title);
-      case 'url':
-        return '<a href="'. check_url($value) .'">'. check_plain($value) .'</a>';
-      case 'date':
-        $format = substr(variable_get('date_format_short', 'm/d/Y - H:i'), 0, 5);
-        // Note: Avoid PHP's date() because it does not handle dates before
-        // 1970 on Windows. This would make the date field useless for e.g.
-        // birthdays.
-        $replace = array('d' => sprintf('%02d', $value['day']),
-                         'j' => $value['day'],
-                         'm' => sprintf('%02d', $value['month']),
-                         'M' => map_month($value['month']),
-                         'Y' => $value['year'],
-                         'H:i' => null,
-                         'g:ia' => null);
-        return strtr($format, $replace);
-      case 'list':
-        $values = split("[,\n\r]", $value);
-        $fields = array();
-        foreach ($values as $value) {
-          if ($value = trim($value)) {
-            $fields[] = $browse ? l($value, 'profile/'. $field->name .'/'. $value) : check_plain($value);
-          }
-        }
-        return implode(', ', $fields);
-    }
-  }
-}
-
-function profile_view_profile($user) {
-
-  profile_load_profile($user);
-
-  // Show private fields to administrators and people viewing their own account.
-  if (user_access('administer users') || $GLOBALS['user']->uid == $user->uid) {
-    $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d ORDER BY category, weight', PROFILE_HIDDEN);
-  }
-  else {
-    $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d AND visibility != %d ORDER BY category, weight', PROFILE_PRIVATE, PROFILE_HIDDEN);
-  }
-
-  while ($field = db_fetch_object($result)) {
-    if ($value = profile_view_field($user, $field)) {
-      $description = ($field->visibility == PROFILE_PRIVATE) ? t('The content of this field is private and only visible to yourself.') : '';
-      $title = ($field->type != 'checkbox') ? check_plain($field->title) : NULL;
-      $item = array('title' => $title,
-        'value' => $value,
-        'class' => $field->name,
-      );
-      $fields[$field->category][] = $item;
-    }
-  }
-  return $fields;
-}
-
-function _profile_form_explanation($field) {
-  $output = $field->explanation;
-
-  if ($field->type == 'list') {
-    $output .= ' '. t('Put each item on a separate line or separate them by commas. No HTML allowed.');
-  }
-
-  if ($field->visibility == PROFILE_PRIVATE) {
-    $output .= ' '. t('The content of this field is kept private and will not be shown publicly.');
-  }
-
-  return $output;
-}
-
-function profile_form_profile($edit, $user, $category) {
-  if (arg(0) == 'user' && arg(1) == 'register') {
-    $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d AND register = 1 ORDER BY category, weight', PROFILE_HIDDEN);
-  }
-  elseif (arg(0) == 'admin' && arg(1) == 'user' && arg(2) == 'create') {
-    $result = db_query('SELECT * FROM {profile_fields} WHERE register = 1 ORDER BY category, weight');
-  }
-  elseif (user_access('administer users')) {
-    $result = db_query("SELECT * FROM {profile_fields} WHERE LOWER(category) = LOWER('%s') ORDER BY weight", $category);
-  }
-  else {
-    $result = db_query("SELECT * FROM {profile_fields} WHERE visibility != %d AND LOWER(category) = LOWER('%s') ORDER BY weight", PROFILE_HIDDEN, $category);
-    // Use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues.
-  }
-
-  while ($field = db_fetch_object($result)) {
-    $category = $field->category;
-    if (!isset($fields[$category])) {
-      $fields[$category] = array('#type' => 'fieldset', '#title' => $category, '#weight' => $w++);
-    }
-    switch ($field->type) {
-      case 'textfield':
-      case 'url':
-        $fields[$category][$field->name] = array('#type' => 'textfield',
-          '#title' => check_plain($field->title),
-          '#default_value' => $edit[$field->name],
-          '#maxlength' => 255,
-          '#description' => _profile_form_explanation($field),
-          '#required' => $field->required,
-        );
-        break;
-      case 'textarea':
-        $fields[$category][$field->name] = array('#type' => 'textarea',
-          '#title' => check_plain($field->title),
-          '#default_value' => $edit[$field->name],
-          '#description' => _profile_form_explanation($field),
-          '#required' => $field->required,
-        );
-        break;
-      case 'list':
-        $fields[$category][$field->name] = array('#type' => 'textarea',
-          '#title' => check_plain($field->title),
-          '#default_value' => $edit[$field->name],
-          '#description' => _profile_form_explanation($field),
-          '#required' => $field->required,
-        );
-        break;
-      case 'checkbox':
-        $fields[$category][$field->name] = array('#type' => 'checkbox',
-          '#title' => check_plain($field->title),
-          '#default_value' => $edit[$field->name],
-          '#description' => _profile_form_explanation($field),
-          '#required' => $field->required,
-        );
-        break;
-      case 'selection':
-        $options = $field->required ? array() : array('--');
-        $lines = split("[,\n\r]", $field->options);
-        foreach ($lines as $line) {
-          if ($line = trim($line)) {
-            $options[$line] = $line;
-          }
-        }
-        $fields[$category][$field->name] = array('#type' => 'select',
-          '#title' => check_plain($field->title),
-          '#default_value' => $edit[$field->name],
-          '#options' => $options,
-          '#description' => _profile_form_explanation($field),
-          '#required' => $field->required,
-        );
-        break;
-      case 'date':
-        $fields[$category][$field->name] = array('#type' => 'date',
-          '#title' => check_plain($field->title),
-          '#default_value' => $edit[$field->name],
-          '#description' => _profile_form_explanation($field),
-          '#required' => $field->required,
-        );
-        break;
-    }
-  }
-  return $fields;
-}
-
-/**
- * Helper function: update an array of user fields by calling profile_view_field
- */
-function _profile_update_user_fields($fields, $account) {
-  foreach ($fields as $key => $field) {
-    $fields[$key]->value = profile_view_field($account, $field);
-  }
-  return $fields;
-}
-
-function profile_validate_profile($edit, $category) {
-  if (arg(0) == 'user' && arg(1) == 'register') {
-    $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d AND register = 1 ORDER BY category, weight', PROFILE_HIDDEN);
-  }
-  elseif (arg(0) == 'admin' && arg(1) == 'user' && arg(2) == 'create') {
-    $result = db_query('SELECT * FROM {profile_fields} WHERE register = 1 ORDER BY category, weight');
-  }
-  elseif (user_access('administer users')) {
-    $result = db_query("SELECT * FROM {profile_fields} WHERE LOWER(category) = LOWER('%s') ORDER BY weight", $category);
-  }
-  else {
-    $result = db_query("SELECT * FROM {profile_fields} WHERE visibility != %d AND LOWER(category) = LOWER('%s') ORDER BY weight", PROFILE_HIDDEN, $category);
-    // Use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues.
-  }
-
-  while ($field = db_fetch_object($result)) {
-    if ($edit[$field->name]) {
-      if ($field->type == 'url') {
-        if (!valid_url($edit[$field->name], true)) {
-          form_set_error($field->name, t('The value provided for %field is not a valid URL.', array('%field' => theme('placeholder', $field->title))));
-        }
-      }
-    }
-    else if ($field->required && !user_access('administer users')) {
-      form_set_error($field->name, t('The field %field is required.', array('%field' => theme('placeholder', $field->title))));
-    }
-  }
-
-  return $edit;
-}
-
-function profile_categories() {
-  $result = db_query("SELECT DISTINCT(category) FROM {profile_fields}");
-  while ($category = db_fetch_object($result)) {
-    $data[] = array('name' => check_plain($category->category), 'title' => $category->category, 'weight' => 3);
-  }
-  return $data;
-}
-
-function theme_profile_block($account, $fields = array()) {
-
-  $output .= theme('user_picture', $account);
-
-  foreach ($fields as $field) {
-    if ($field->value) {
-      if ($field->type == 'checkbox') {
-        $output .= "<p>$field->value</p>\n";
-      }
-      else {
-        $output .= "<p><strong>$field->title</strong><br />$field->value</p>\n";
-      }
-    }
-  }
-
-  return $output;
-}
-
-function theme_profile_listing($account, $fields = array()) {
-
-  $output  = "<div class=\"profile\">\n";
-  $output .= theme('user_picture', $account);
-  $output .= ' <div class="name">'. theme('username', $account) ."</div>\n";
-
-  foreach ($fields as $field) {
-    if ($field->value) {
-      $output .= " <div class=\"field\">$field->value</div>\n";
-    }
-  }
-
-  $output .= "</div>\n";
-
-  return $output;
-}
-
-function _profile_field_types($type = NULL) {
-  $types = array('textfield' => t('single-line textfield'),
-                 'textarea' => t('multi-line textfield'),
-                 'checkbox' => t('checkbox'),
-                 'selection' => t('list selection'),
-                 'list' => t('freeform list'),
-                 'url' => t('URL'),
-                 'date' => t('date'));
-  return isset($type) ? $types[$type] : $types;
-}
-
-function _profile_field_serialize($type = NULL) {
-  return $type == 'date';
-}
diff --git a/modules/search.module b/modules/search.module
deleted file mode 100644 (file)
index 5c4c1e9..0000000
+++ /dev/null
@@ -1,1262 +0,0 @@
-<?php
-// $Id: search.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables site-wide keyword searching.
- */
-
-/**
- * Matches Unicode character classes to exclude from the search index.
- *
- * See: http://www.unicode.org/Public/UNIDATA/UCD.html#General_Category_Values
- *
- * The index only contains the following character classes:
- * Lu     Letter, Uppercase
- * Ll     Letter, Lowercase
- * Lt     Letter, Titlecase
- * Lo     Letter, Other
- * Nd     Number, Decimal Digit
- * No     Number, Other
- */
-define('PREG_CLASS_SEARCH_EXCLUDE',
-'\x{0}-\x{2f}\x{3a}-\x{40}\x{5b}-\x{60}\x{7b}-\x{bf}\x{d7}\x{f7}\x{2b0}-'.
-'\x{385}\x{387}\x{3f6}\x{482}-\x{489}\x{559}-\x{55f}\x{589}-\x{5c7}\x{5f3}-'.
-'\x{61f}\x{640}\x{64b}-\x{65e}\x{66a}-\x{66d}\x{670}\x{6d4}\x{6d6}-\x{6ed}'.
-'\x{6fd}\x{6fe}\x{700}-\x{70f}\x{711}\x{730}-\x{74a}\x{7a6}-\x{7b0}\x{901}-'.
-'\x{903}\x{93c}\x{93e}-\x{94d}\x{951}-\x{954}\x{962}-\x{965}\x{970}\x{981}-'.
-'\x{983}\x{9bc}\x{9be}-\x{9cd}\x{9d7}\x{9e2}\x{9e3}\x{9f2}-\x{a03}\x{a3c}-'.
-'\x{a4d}\x{a70}\x{a71}\x{a81}-\x{a83}\x{abc}\x{abe}-\x{acd}\x{ae2}\x{ae3}'.
-'\x{af1}-\x{b03}\x{b3c}\x{b3e}-\x{b57}\x{b70}\x{b82}\x{bbe}-\x{bd7}\x{bf0}-'.
-'\x{c03}\x{c3e}-\x{c56}\x{c82}\x{c83}\x{cbc}\x{cbe}-\x{cd6}\x{d02}\x{d03}'.
-'\x{d3e}-\x{d57}\x{d82}\x{d83}\x{dca}-\x{df4}\x{e31}\x{e34}-\x{e3f}\x{e46}-'.
-'\x{e4f}\x{e5a}\x{e5b}\x{eb1}\x{eb4}-\x{ebc}\x{ec6}-\x{ecd}\x{f01}-\x{f1f}'.
-'\x{f2a}-\x{f3f}\x{f71}-\x{f87}\x{f90}-\x{fd1}\x{102c}-\x{1039}\x{104a}-'.
-'\x{104f}\x{1056}-\x{1059}\x{10fb}\x{10fc}\x{135f}-\x{137c}\x{1390}-\x{1399}'.
-'\x{166d}\x{166e}\x{1680}\x{169b}\x{169c}\x{16eb}-\x{16f0}\x{1712}-\x{1714}'.
-'\x{1732}-\x{1736}\x{1752}\x{1753}\x{1772}\x{1773}\x{17b4}-\x{17db}\x{17dd}'.
-'\x{17f0}-\x{180e}\x{1843}\x{18a9}\x{1920}-\x{1945}\x{19b0}-\x{19c0}\x{19c8}'.
-'\x{19c9}\x{19de}-\x{19ff}\x{1a17}-\x{1a1f}\x{1d2c}-\x{1d61}\x{1d78}\x{1d9b}-'.
-'\x{1dc3}\x{1fbd}\x{1fbf}-\x{1fc1}\x{1fcd}-\x{1fcf}\x{1fdd}-\x{1fdf}\x{1fed}-'.
-'\x{1fef}\x{1ffd}-\x{2070}\x{2074}-\x{207e}\x{2080}-\x{2101}\x{2103}-\x{2106}'.
-'\x{2108}\x{2109}\x{2114}\x{2116}-\x{2118}\x{211e}-\x{2123}\x{2125}\x{2127}'.
-'\x{2129}\x{212e}\x{2132}\x{213a}\x{213b}\x{2140}-\x{2144}\x{214a}-\x{2b13}'.
-'\x{2ce5}-\x{2cff}\x{2d6f}\x{2e00}-\x{3005}\x{3007}-\x{303b}\x{303d}-\x{303f}'.
-'\x{3099}-\x{309e}\x{30a0}\x{30fb}-\x{30fe}\x{3190}-\x{319f}\x{31c0}-\x{31cf}'.
-'\x{3200}-\x{33ff}\x{4dc0}-\x{4dff}\x{a015}\x{a490}-\x{a716}\x{a802}\x{a806}'.
-'\x{a80b}\x{a823}-\x{a82b}\x{d800}-\x{f8ff}\x{fb1e}\x{fb29}\x{fd3e}\x{fd3f}'.
-'\x{fdfc}-\x{fe6b}\x{feff}-\x{ff0f}\x{ff1a}-\x{ff20}\x{ff3b}-\x{ff40}\x{ff5b}-'.
-'\x{ff65}\x{ff70}\x{ff9e}\x{ff9f}\x{ffe0}-\x{fffd}');
-
-/**
- * Matches all 'N' Unicode character classes (numbers)
- */
-define('PREG_CLASS_NUMBERS',
-'\x{30}-\x{39}\x{b2}\x{b3}\x{b9}\x{bc}-\x{be}\x{660}-\x{669}\x{6f0}-\x{6f9}'.
-'\x{966}-\x{96f}\x{9e6}-\x{9ef}\x{9f4}-\x{9f9}\x{a66}-\x{a6f}\x{ae6}-\x{aef}'.
-'\x{b66}-\x{b6f}\x{be7}-\x{bf2}\x{c66}-\x{c6f}\x{ce6}-\x{cef}\x{d66}-\x{d6f}'.
-'\x{e50}-\x{e59}\x{ed0}-\x{ed9}\x{f20}-\x{f33}\x{1040}-\x{1049}\x{1369}-'.
-'\x{137c}\x{16ee}-\x{16f0}\x{17e0}-\x{17e9}\x{17f0}-\x{17f9}\x{1810}-\x{1819}'.
-'\x{1946}-\x{194f}\x{2070}\x{2074}-\x{2079}\x{2080}-\x{2089}\x{2153}-\x{2183}'.
-'\x{2460}-\x{249b}\x{24ea}-\x{24ff}\x{2776}-\x{2793}\x{3007}\x{3021}-\x{3029}'.
-'\x{3038}-\x{303a}\x{3192}-\x{3195}\x{3220}-\x{3229}\x{3251}-\x{325f}\x{3280}-'.
-'\x{3289}\x{32b1}-\x{32bf}\x{ff10}-\x{ff19}');
-
-/**
- * Matches all 'P' Unicode character classes (punctuation)
- */
-define('PREG_CLASS_PUNCTUATION',
-'\x{21}-\x{23}\x{25}-\x{2a}\x{2c}-\x{2f}\x{3a}\x{3b}\x{3f}\x{40}\x{5b}-\x{5d}'.
-'\x{5f}\x{7b}\x{7d}\x{a1}\x{ab}\x{b7}\x{bb}\x{bf}\x{37e}\x{387}\x{55a}-\x{55f}'.
-'\x{589}\x{58a}\x{5be}\x{5c0}\x{5c3}\x{5f3}\x{5f4}\x{60c}\x{60d}\x{61b}\x{61f}'.
-'\x{66a}-\x{66d}\x{6d4}\x{700}-\x{70d}\x{964}\x{965}\x{970}\x{df4}\x{e4f}'.
-'\x{e5a}\x{e5b}\x{f04}-\x{f12}\x{f3a}-\x{f3d}\x{f85}\x{104a}-\x{104f}\x{10fb}'.
-'\x{1361}-\x{1368}\x{166d}\x{166e}\x{169b}\x{169c}\x{16eb}-\x{16ed}\x{1735}'.
-'\x{1736}\x{17d4}-\x{17d6}\x{17d8}-\x{17da}\x{1800}-\x{180a}\x{1944}\x{1945}'.
-'\x{2010}-\x{2027}\x{2030}-\x{2043}\x{2045}-\x{2051}\x{2053}\x{2054}\x{2057}'.
-'\x{207d}\x{207e}\x{208d}\x{208e}\x{2329}\x{232a}\x{23b4}-\x{23b6}\x{2768}-'.
-'\x{2775}\x{27e6}-\x{27eb}\x{2983}-\x{2998}\x{29d8}-\x{29db}\x{29fc}\x{29fd}'.
-'\x{3001}-\x{3003}\x{3008}-\x{3011}\x{3014}-\x{301f}\x{3030}\x{303d}\x{30a0}'.
-'\x{30fb}\x{fd3e}\x{fd3f}\x{fe30}-\x{fe52}\x{fe54}-\x{fe61}\x{fe63}\x{fe68}'.
-'\x{fe6a}\x{fe6b}\x{ff01}-\x{ff03}\x{ff05}-\x{ff0a}\x{ff0c}-\x{ff0f}\x{ff1a}'.
-'\x{ff1b}\x{ff1f}\x{ff20}\x{ff3b}-\x{ff3d}\x{ff3f}\x{ff5b}\x{ff5d}\x{ff5f}-'.
-'\x{ff65}');
-
-/**
- * Matches all CJK characters that are candidates for auto-splitting
- * (Chinese, Japanese, Korean).
- * Contains kana and BMP ideographs.
- */
-define('PREG_CLASS_CJK', '\x{3041}-\x{30ff}\x{31f0}-\x{31ff}\x{3400}-\x{4db5}'.
-'\x{4e00}-\x{9fbb}\x{f900}-\x{fad9}');
-
-/**
- * Implementation of hook_help().
- */
-function search_help($section) {
-  switch ($section) {
-    case 'admin/help#search':
-      $output = '<p>'. t('The search module adds the ability to search for content by keywords.  Search is often the only practical way to find content on a large site.  Search is useful for finding users and posts by searching on keywords.') .'</p>';
-      $output .= '<p>'. t('The search engine works by maintaining an index of the words in your site\'s content. It indexes the posts and users.  You can adjust the settings to tweak the indexing behaviour. Note that the search requires cron to be set up correctly.  The index percentage sets the maximum amount of items that will be indexed in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>read about how your site uses cron in the <a href="%admin-help-system">administer &gt;&gt; help &gt;&gt; system</a>.</li>
-<li>run your <a href="%file-cron">cron.php</a>.</li>
-<li>read about <a href="%external-http-drupal-org-node-23714">configuring cron jobs</a>.</li>
-<li><a href="%admin-settings-search">administer &gt;&gt; settings &gt;&gt; search</a>.</li></ul>
-', array('%admin-help-system' => url('admin/help/system'), '%file-cron' => 'cron.php', '%external-http-drupal-org-node-23714' => 'http://drupal.org/node/23714', '%admin-settings-search' => url('admin/settings/search')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%search">Search page</a>.', array('%search' => 'http://drupal.org/handbook/modules/search/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Enables site-wide keyword searching.');
-    case 'admin/settings/search':
-      return t('
-<p>The search engine works by maintaining an index of the words in your site\'s content. You can adjust the settings below to tweak the indexing behaviour. Note that the search requires cron to be set up correctly.</p>
-');
-    case 'search#noresults':
-      return t('<ul>
-<li>Check if your spelling is correct.</li>
-<li>Remove quotes around phrases to match each word individually: <em>"blue smurf"</em> will match less than <em>blue smurf</em>.</li>
-<li>Consider loosening your query with <em>OR</em>: <em>blue smurf</em> will match less than <em>blue OR smurf</em>.</li>
-</ul>');
-  }
-}
-
-/**
- * Implementation of hook_perm().
- */
-function search_perm() {
-  return array('search content', 'administer search');
-}
-
-/**
- * Implementation of hook_block().
- */
-function search_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $blocks[0]['info'] = t('Search form');
-    return $blocks;
-  }
-  else if ($op == 'view' && user_access('search content')) {
-    $block['content'] = search_box('search_block_form');
-    $block['subject'] = t('Search');
-    return $block;
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function search_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'search', 'title' => t('search'),
-      'callback' => 'search_view',
-      'access' => user_access('search content'),
-      'type' => MENU_SUGGESTED_ITEM);
-    $items[] = array('path' => 'admin/settings/search/wipe', 'title' => t('Clear index'),
-      'callback' => 'search_wipe_confirm',
-      'access' => user_access('administer search'),
-      'type' => MENU_CALLBACK);
-  }
-  else if (arg(0) == 'search') {
-    // To remember the user's search keywords when switching across tabs,
-    // we dynamically add the keywords to the search tabs' paths.
-    $keys = search_get_keys();
-    $keys = strlen($keys) ? '/'. $keys : '';
-    foreach (module_list() as $name) {
-      if (module_hook($name, 'search') && $title = module_invoke($name, 'search', 'name')) {
-        $items[] = array('path' => 'search/'. $name . $keys, 'title' => $title,
-          'callback' => 'search_view',
-          'access' => user_access('search content'),
-          'type' => MENU_LOCAL_TASK);
-      }
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_validate().
- */
-function search_settings_form_validate($form_id, &$form) {
-  if ($_POST['op'] == t('Re-index site')) {
-    drupal_goto('admin/settings/search/wipe');
-  }
-  // If these settings change, the index needs to be rebuilt.
-  if ((variable_get('minimum_word_size', 3) != $form['minimum_word_size']) ||
-      (variable_get('overlap_cjk', true) != $form['overlap_cjk'])) {
-    drupal_set_message(t('The index will be rebuilt.'));
-    search_wipe();
-  }
-}
-
-/**
- * Menu callback; displays the search module settings page.
- */
-function search_settings() {
-  // Collect some stats
-  $remaining = 0;
-  $total = 0;
-  foreach (module_list() as $module) {
-    if (module_hook($module, 'search')) {
-      $status = module_invoke($module, 'search', 'status');
-      $remaining += $status['remaining'];
-      $total += $status['total'];
-    }
-  }
-  $count = format_plural($remaining, 'There is 1 item left to index.', 'There are %count items left to index.');
-  $percentage = ((int)min(100, 100 * ($total - $remaining) / max(1, $total))) . '%';
-  $status = '<p><strong>'. t('%percentage of the site has been indexed.', array('%percentage' => $percentage)) .' '. $count .'</strong></p>';
-  $form['status'] = array('#type' => 'fieldset', '#title' => t('Indexing status'));
-  $form['status']['status'] = array('#type' => 'markup', '#value' => $status);
-  $form['status']['wipe'] = array('#type' => 'submit', '#value' => t('Re-index site'));
-
-  $items = drupal_map_assoc(array(10, 20, 50, 100, 200, 500));
-
-  // Indexing throttle:
-  $form['indexing_throttle'] = array('#type' => 'fieldset', '#title' => t('Indexing throttle'));
-  $form['indexing_throttle']['search_cron_limit'] = array('#type' => 'select', '#title' => t('Items to index per cron run'), '#default_value' => variable_get('search_cron_limit', 100), '#options' => $items, '#description' => t('The maximum amount of items that will be indexed in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.'));
-  // Indexing settings:
-  $form['indexing_settings'] = array('#type' => 'fieldset', '#title' => t('Indexing settings'));
-  $form['indexing_settings']['info'] = array('#type' => 'markup', '#value' => '<em>'. t('<p>Changing the settings below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>');
-  $form['indexing_settings']['minimum_word_size'] = array('#type' => 'textfield', '#title' => t('Minimum word length to index'), '#default_value' => variable_get('minimum_word_size', 3), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be indexed. A lower setting means better search result ranking, but also a larger database. Each search query must contain at least one keyword that is this size (or longer).'));
-  $form['indexing_settings']['overlap_cjk'] = array('#type' => 'checkbox', '#title' => t('Simple CJK handling'), '#default_value' => variable_get('overlap_cjk', true), '#description' => t('Whether to apply a simple Chinese/Japanese/Korean tokenizer based on overlapping sequences. Turn this off if you want to use an external preprocessor for this instead. Does not affect other languages.'));
-
-  // Per module settings
-  $form = array_merge($form, module_invoke_all('search', 'admin'));
-  return $form;
-}
-
-/**
- * Menu callback: confirm wiping of the index.
- */
-function search_wipe_confirm() {
-  return confirm_form('search_wipe_confirm', $form, t('Are you sure you want to re-index the site?'),
-                  'admin/settings/search', t(' The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed. This action cannot be undone.'), t('Re-index site'), t('Cancel'));
-}
-
-/**
- * Handler for wipe confirmation
- */
-function search_wipe_confirm_submit($form_id, &$form) {
-  if ($form['confirm']) {
-    search_wipe();
-    drupal_set_message(t('The index will be rebuilt.'));
-    return 'admin/settings/search';
-  }
-}
-
-/**
- * Wipes a part of or the entire search index.
- *
- * @param $sid
- *  (optional) The SID of the item to wipe. If specified, $type must be passed
- *  too.
- * @param $type
- *  (optional) The type of item to wipe.
- */
-function search_wipe($sid = NULL, $type = NULL, $reindex = FALSE) {
-  if ($type == NULL && $sid == NULL) {
-    module_invoke_all('search', 'reset');
-  }
-  else {
-    db_query("DELETE FROM {search_dataset} WHERE sid = %d AND type = '%s'", $sid, $type);
-    db_query("DELETE FROM {search_index} WHERE fromsid = %d AND fromtype = '%s'", $sid, $type);
-    // When re-indexing, keep link references
-    db_query("DELETE FROM {search_index} WHERE sid = %d AND type = '%s'". ($reindex ? " AND fromsid = 0" : ''), $sid, $type);
-  }
-}
-
-/**
- * Marks a word as dirty (or retrieves the list of dirty words). This is used
- * during indexing (cron). Words which are dirty have outdated total counts in
- * the search_total table, and need to be recounted.
- */
-function search_dirty($word = null) {
-  static $dirty = array();
-  if ($word !== null) {
-    $dirty[$word] = true;
-  }
-  else {
-    return $dirty;
-  }
-}
-
-/**
- * Implementation of hook_cron().
- *
- * Fires hook_update_index() in all modules and cleans up dirty words (see
- * search_dirty).
- */
-function search_cron() {
-  // We register a shutdown function to ensure that search_total is always up
-  // to date.
-  register_shutdown_function('search_update_totals');
-
-  // Update word index
-  foreach (module_list() as $module) {
-    module_invoke($module, 'update_index');
-  }
-}
-
-/**
- * This function is called on shutdown to ensure that search_total is always
- * up to date (even if cron times out or otherwise fails).
- */
-function search_update_totals() {
-  // Update word IDF (Inverse Document Frequency) counts for new/changed words
-  foreach (search_dirty() as $word => $dummy) {
-    // Get total count
-    $total = db_result(db_query("SELECT SUM(score) FROM {search_index} WHERE word = '%s'", $word));
-    // Apply Zipf's law to equalize the probability distribution
-    $total = log10(1 + 1/(max(1, $total)));
-    db_query("UPDATE {search_total} SET count = %f WHERE word = '%s'", $total, $word);
-    if (!db_affected_rows()) {
-      db_query("INSERT INTO {search_total} (word, count) VALUES ('%s', %f)", $word, $total);
-    }
-  }
-  // Find words that were deleted from search_index, but are still in
-  // search_total. We use a LEFT JOIN between the two tables and keep only the
-  // rows which fail to join.
-  $result = db_query("SELECT t.word AS realword, i.word FROM {search_total} t LEFT JOIN {search_index} i ON t.word = i.word WHERE i.word IS NULL");
-  while ($word = db_fetch_object($result)) {
-    db_query("DELETE FROM {search_total} WHERE word = '%s'", $word->realword);
-  }
-}
-
-/**
- * Simplifies a string according to indexing rules.
- */
-function search_simplify($text) {
-  // Decode entities to UTF-8
-  $text = decode_entities($text);
-
-  // Lowercase
-  $text = drupal_strtolower($text);
-
-  // Call an external processor for word handling.
-  search_preprocess($text);
-
-  // Simple CJK handling
-  if (variable_get('overlap_cjk', true)) {
-    $text = preg_replace_callback('/['. PREG_CLASS_CJK .']+/u', 'search_expand_cjk', $text);
-  }
-
-  // To improve searching for numerical data such as dates, IP addresses
-  // or version numbers, we consider a group of numerical characters
-  // separated only by punctuation characters to be one piece.
-  // This also means that searching for e.g. '20/03/1984' also returns
-  // results with '20-03-1984' in them.
-  // Readable regexp: ([number]+)[punctuation]+(?=[number])
-  $text = preg_replace('/(['. PREG_CLASS_NUMBERS .']+)['. PREG_CLASS_PUNCTUATION .']+(?=['. PREG_CLASS_NUMBERS .'])/u', '\1', $text);
-
-  // The dot, underscore and dash are simply removed. This allows meaningful
-  // search behaviour with acronyms and URLs.
-  $text = preg_replace('/[._-]+/', '', $text);
-
-  // With the exception of the rules above, we consider all punctuation,
-  // marks, spacers, etc, to be a word boundary.
-  $text = preg_replace('/['. PREG_CLASS_SEARCH_EXCLUDE . ']+/u', ' ', $text);
-
-  return $text;
-}
-
-/**
- * Basic CJK tokenizer. Simply splits a string into consecutive, overlapping
- * sequences of characters ('minimum_word_size' long).
- */
-function search_expand_cjk($matches) {
-  $min = variable_get('minimum_word_size', 3);
-  $str = $matches[0];
-  $l = drupal_strlen($str);
-  // Passthrough short words
-  if ($l <= $min) {
-    return ' '. $str .' ';
-  }
-  $tokens = ' ';
-  // FIFO queue of characters
-  $chars = array();
-  // Begin loop
-  for ($i = 0; $i < $l; ++$i) {
-    // Grab next character
-    $current = drupal_substr($str, 0, 1);
-    $str = substr($str, strlen($current));
-    $chars[] = $current;
-    if ($i >= $min - 1) {
-      $tokens .= implode('', $chars) .' ';
-      array_shift($chars);
-    }
-  }
-  return $tokens;
-}
-
-/**
- * Splits a string into tokens for indexing.
- */
-function search_index_split($text) {
-  static $last = null;
-  static $lastsplit = null;
-
-  if ($last == $text) {
-    return $lastsplit;
-  }
-  // Process words
-  $text = search_simplify($text);
-  $words = explode(' ', $text);
-  array_walk($words, '_search_index_truncate');
-
-  // Save last keyword result
-  $last = $text;
-  $lastsplit = $words;
-
-  return $words;
-}
-
-/**
- * Helper function for array_walk in search_index_split.
- */
-function _search_index_truncate(&$text) {
-  $text = truncate_utf8($text, 50);
-}
-
-/**
- * Invokes hook_search_preprocess() in modules.
- */
-function search_preprocess(&$text) {
-  foreach (module_implements('search_preprocess') as $module) {
-    $text = module_invoke($module, 'search_preprocess', $text);
-  }
-}
-
-/**
- * Update the full-text search index for a particular item.
- *
- * @param $sid
- *   A number identifying this particular item (e.g. node id).
- *
- * @param $type
- *   A string defining this type of item (e.g. 'node')
- *
- * @param $text
- *   The content of this item. Must be a piece of HTML text.
- *
- * @ingroup search
- */
-function search_index($sid, $type, $text) {
-  $minimum_word_size = variable_get('minimum_word_size', 3);
-
-  // Link matching
-  global $base_url;
-  $node_regexp = '@href=[\'"]?(?:'. preg_quote($base_url, '@') .'/|'. preg_quote(base_path(), '@') .')(?:\?q=)?/?((?![a-z]+:)[^\'">]+)[\'">]@i';
-
-  // Multipliers for scores of words inside certain HTML tags.
-  // Note: 'a' must be included for link ranking to work.
-  $tags = array('h1' => 25,
-                'h2' => 18,
-                'h3' => 15,
-                'h4' => 12,
-                'h5' => 9,
-                'h6' => 6,
-                'u' => 3,
-                'b' => 3,
-                'i' => 3,
-                'strong' => 3,
-                'em' => 3,
-                'a' => 10);
-
-  // Strip off all ignored tags to speed up processing, but insert space before/after
-  // them to keep word boundaries.
-  $text = str_replace(array('<', '>'), array(' <', '> '), $text);
-  $text = strip_tags($text, '<'. implode('><', array_keys($tags)) .'>');
-
-  // Split HTML tags from plain text.
-  $split = preg_split('/\s*<([^>]+?)>\s*/', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
-  // Note: PHP ensures the array consists of alternating delimiters and literals
-  // and begins and ends with a literal (inserting $null as required).
-
-  $tag = false; // Odd/even counter. Tag or no tag.
-  $link = false; // State variable for link analyser
-  $score = 1; // Starting score per word
-  $accum = ' '; // Accumulator for cleaned up data
-  $tagstack = array(); // Stack with open tags
-  $tagwords = 0; // Counter for consecutive words
-  $focus = 1; // Focus state
-
-  $results = array(0 => array()); // Accumulator for words for index
-
-  foreach ($split as $value) {
-    if ($tag) {
-      // Increase or decrease score per word based on tag
-      list($tagname) = explode(' ', $value, 2);
-      $tagname = drupal_strtolower($tagname);
-      // Closing or opening tag?
-      if ($tagname[0] == '/') {
-        $tagname = substr($tagname, 1);
-        // If we encounter unexpected tags, reset score to avoid incorrect boosting.
-        if (!count($tagstack) || $tagstack[0] != $tagname) {
-          $tagstack = array();
-          $score = 1;
-        }
-        else {
-          // Remove from tag stack and decrement score
-          $score = max(1, $score - $tags[array_shift($tagstack)]);
-        }
-        if ($tagname == 'a') {
-          $link = false;
-        }
-      }
-      else {
-        if ($tagstack[0] == $tagname) {
-          // None of the tags we look for make sense when nested identically.
-          // If they are, it's probably broken HTML.
-          $tagstack = array();
-          $score = 1;
-        }
-        else {
-          // Add to open tag stack and increment score
-          array_unshift($tagstack, $tagname);
-          $score += $tags[$tagname];
-        }
-        if ($tagname == 'a') {
-          // Check if link points to a node on this site
-          if (preg_match($node_regexp, $value, $match)) {
-            $path = drupal_get_normal_path($match[1]);
-            if (preg_match('!(?:node|book)/(?:view/)?([0-9]+)!i', $path, $match)) {
-              $linknid = $match[1];
-              if ($linknid > 0) {
-                // Note: ignore links to uncachable nodes to avoid redirect bugs.
-                $node = db_fetch_object(db_query('SELECT n.title, n.nid, n.vid, r.format FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid WHERE n.nid = %d', $linknid));
-                if (filter_format_allowcache($node->format)) {
-                  $link = true;
-                  $linktitle = $node->title;
-                }
-              }
-            }
-          }
-        }
-      }
-      // A tag change occurred, reset counter.
-      $tagwords = 0;
-    }
-    else {
-      // Note: use of PREG_SPLIT_DELIM_CAPTURE above will introduce empty values
-      if ($value != '') {
-        if ($link) {
-          // Check to see if the node link text is its URL. If so, we use the target node title instead.
-          if (preg_match('!^https?://!i', $value)) {
-            $value = $linktitle;
-          }
-        }
-        $words = search_index_split($value);
-        foreach ($words as $word) {
-          // Add word to accumulator
-          $accum .= $word .' ';
-          $num = is_numeric($word);
-          // Check wordlength
-          if ($num || drupal_strlen($word) >= $minimum_word_size) {
-            // Normalize numbers
-            if ($num) {
-              $word = (int)ltrim($word, '-0');
-            }
-
-            if ($link) {
-              if (!isset($results[$linknid])) {
-                $results[$linknid] = array();
-              }
-              $results[$linknid][$word] += $score * $focus;
-            }
-            else {
-              $results[0][$word] += $score * $focus;
-              // Focus is a decaying value in terms of the amount of unique words up to this point.
-              // From 100 words and more, it decays, to e.g. 0.5 at 500 words and 0.3 at 1000 words.
-              $focus = min(1, .01 + 3.5 / (2 + count($results[0]) * .015));
-            }
-          }
-          $tagwords++;
-          // Too many words inside a single tag probably mean a tag was accidentally left open.
-          if (count($tagstack) && $tagwords >= 15) {
-            $tagstack = array();
-            $score = 1;
-          }
-        }
-      }
-    }
-    $tag = !$tag;
-  }
-
-  search_wipe($sid, $type, TRUE);
-
-  // Insert cleaned up data into dataset
-  db_query("INSERT INTO {search_dataset} (sid, type, data) VALUES (%d, '%s', '%s')", $sid, $type, $accum);
-
-  // Insert results into search index
-  foreach ($results[0] as $word => $score) {
-    db_query("INSERT INTO {search_index} (word, sid, type, score) VALUES ('%s', %d, '%s', %f)", $word, $sid, $type, $score);
-    search_dirty($word);
-  }
-  unset($results[0]);
-
-  // Now insert links to nodes
-  foreach ($results as $nid => $words) {
-    foreach ($words as $word => $score) {
-      db_query("INSERT INTO {search_index} (word, sid, type, fromsid, fromtype, score) VALUES ('%s', %d, '%s', %d, '%s', %f)", $word, $nid, 'node', $sid, $type, $score);
-      search_dirty($word);
-    }
-  }
-}
-
-/**
- * Extract a module-specific search option from a search query. e.g. 'type:book'
- */
-function search_query_extract($keys, $option) {
-  if (preg_match('/(^| )'. $option .':([^ ]*)( |$)/i', $keys, $matches)) {
-    return $matches[2];
-  }
-}
-
-/**
- * Return a query with the given module-specific search option inserted in.
- * e.g. 'type:book'.
- */
-function search_query_insert($keys, $option, $value = '') {
-  if (search_query_extract($keys, $option)) {
-    $keys = trim(preg_replace('/(^| )'. $option .':[^ ]*/i', '', $keys));
-  }
-  if ($value != '') {
-    $keys .= ' '. $option .':'. $value;
-  }
-  return $keys;
-}
-
-/**
- * Parse a search query into SQL conditions.
- *
- * We build a query that matches the dataset bodies.
- */
-function search_parse_query($text) {
-  $keys = array('positive' => array(), 'negative' => array());
-
-  // Tokenize query string
-  preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' '. $text, $matches, PREG_SET_ORDER);
-
-  if (count($matches) < 1) {
-    return NULL;
-  }
-
-  // Classify tokens
-  $or = false;
-  foreach ($matches as $match) {
-    $phrase = false;
-    // Strip off phrase quotes
-    if ($match[2]{0} == '"') {
-      $match[2] = substr($match[2], 1, -1);
-      $phrase = true;
-    }
-    // Simplify keyword according to indexing rules and external preprocessors
-    $words = search_simplify($match[2]);
-    // Re-explode in case simplification added more words, except when matching a phrase
-    $words = $phrase ? array($words) : preg_split('/ /', $words, -1, PREG_SPLIT_NO_EMPTY);
-    // Negative matches
-    if ($match[1] == '-') {
-      $keys['negative'] = array_merge($keys['negative'], $words);
-    }
-    // OR operator: instead of a single keyword, we store an array of all
-    // OR'd keywords.
-    elseif ($match[2] == 'OR' && count($keys['positive'])) {
-      $last = array_pop($keys['positive']);
-      // Starting a new OR?
-      if (!is_array($last)) {
-        $last = array($last);
-      }
-      $keys['positive'][] = $last;
-      $or = true;
-      continue;
-    }
-    // Plain keyword
-    else {
-      if ($or) {
-        // Add to last element (which is an array)
-        $keys['positive'][count($keys['positive']) - 1] = array_merge($keys['positive'][count($keys['positive']) - 1], $words);
-      }
-      else {
-        $keys['positive'] = array_merge($keys['positive'], $words);
-      }
-    }
-    $or = false;
-  }
-
-  // Convert keywords into SQL statements.
-  $query = array();
-  $query2 = array();
-  $arguments = array();
-  $arguments2 = array();
-  $matches = 0;
-  // Positive matches
-  foreach ($keys['positive'] as $key) {
-    // Group of ORed terms
-    if (is_array($key) && count($key)) {
-      $queryor = array();
-      $any = false;
-      foreach ($key as $or) {
-        list($q, $count) = _search_parse_query($or, $arguments2);
-        $any |= $count;
-        if ($q) {
-          $queryor[] = $q;
-          $arguments[] = $or;
-        }
-      }
-      if (count($queryor)) {
-        $query[] = '('. implode(' OR ', $queryor) .')';
-        // A group of OR keywords only needs to match once
-        $matches += ($any > 0);
-      }
-    }
-    // Single ANDed term
-    else {
-      list($q, $count) = _search_parse_query($key, $arguments2);
-      if ($q) {
-        $query[] = $q;
-        $arguments[] = $key;
-        // Each AND keyword needs to match at least once
-        $matches += $count;
-      }
-    }
-  }
-  // Negative matches
-  foreach ($keys['negative'] as $key) {
-    list($q) = _search_parse_query($key, $arguments2, true);
-    if ($q) {
-      $query[] = $q;
-      $arguments[] = $key;
-    }
-  }
-  $query = implode(' AND ', $query);
-
-  // Build word-index conditions for the first pass
-  $query2 = substr(str_repeat("i.word = '%s' OR ", count($arguments2)), 0, -4);
-
-  return array($query, $arguments, $query2, $arguments2, $matches);
-}
-
-/**
- * Helper function for search_parse_query();
- */
-function _search_parse_query(&$word, &$scores, $not = false) {
-  $count = 0;
-  // Determine the scorewords of this word/phrase
-  if (!$not) {
-    $split = explode(' ', $word);
-    foreach ($split as $s) {
-      $num = is_numeric($s);
-      if ($num || drupal_strlen($s) >= variable_get('minimum_word_size', 3)) {
-        $s = $num ? ((int)ltrim($s, '-0')) : $s;
-        if (!isset($scores[$s])) {
-          $scores[$s] = $s;
-          $count++;
-        }
-      }
-    }
-  }
-  // Return matching snippet and number of added words
-  return array("d.data ". ($not ? 'NOT ' : '') ."LIKE '%% %s %%'", $count);
-}
-
-/**
- * Do a query on the full-text search index for a word or words.
- *
- * This function is normally only called by each module that support the
- * indexed search (and thus, implements hook_update_index()).
- *
- * Two queries are performed which can be extended by the caller.
- *
- * The first query selects a set of possible matches based on the search index
- * and any extra given restrictions. This is the classic "OR" search.
- *
- * SELECT i.type, i.sid, SUM(i.score*t.count) AS relevance
- * FROM {search_index} i
- * INNER JOIN {search_total} t ON i.word = t.word
- * $join1
- * WHERE $where1 AND (...)
- * GROUP BY i.type, i.sid
- *
- * The second query further refines this set by verifying advanced text
- * conditions (such as AND, negative or phrase matches), and orders the results
- * on a the column or expression 'score':
- *
- * SELECT i.type, i.sid, $select2
- * FROM temp_search_sids i
- * INNER JOIN {search_dataset} d ON i.sid = d.sid AND i.type = d.type
- * $join2
- * WHERE (...)
- * ORDER BY score DESC
- *
- * @param $keywords
- *   A search string as entered by the user.
- *
- * @param $type
- *   A string identifying the calling module.
- *
- * @param $join1
- *   (optional) Inserted into the JOIN part of the first SQL query.
- *   For example "INNER JOIN {node} n ON n.nid = i.sid".
- *
- * @param $where1
- *   (optional) Inserted into the WHERE part of the first SQL query.
- *   For example "(n.status > %d)".
- *
- * @param $arguments1
- *   (optional) Extra SQL arguments belonging to the first query.
- *
- * @param $select2
- *   (optional) Inserted into the SELECT pat of the second query. Must contain
- *   a column selected as 'score'.
- *   defaults to 'i.relevance AS score'
- *
- * @param $join2
- *   (optional) Inserted into the JOIN par of the second SQL query.
- *   For example "INNER JOIN {node_comment_statistics} n ON n.nid = i.sid"
- *
- * @param $arguments2
- *   (optional) Extra SQL arguments belonging to the second query parameter.
- *
- * @param $sort_parameters
- *   (optional) SQL arguments for sorting the final results.
- *              Default: 'ORDER BY score DESC'
- *
- * @return
- *   An array of SIDs for the search results.
- *
- * @ingroup search
- */
-function do_search($keywords, $type, $join1 = '', $where1 = '1', $arguments1 = array(), $select2 = 'i.relevance AS score', $join2 = '', $arguments2 = array(), $sort_parameters = 'ORDER BY score DESC') {
-  $query = search_parse_query($keywords);
-
-  if ($query[2] == '') {
-    form_set_error('keys', t('You must include at least one positive keyword with %count characters or more.', array('%count' => variable_get('minimum_word_size', 3))));
-  }
-  if ($query === NULL || $query[0] == '' || $query[2] == '') {
-    return array();
-  }
-
-  // First pass: select all possible matching sids, doing a simple index-based OR matching on the keywords.
-  // 'matches' is used to reject those items that cannot possibly match the query.
-  $conditions = $where1 .' AND ('. $query[2] .") AND i.type = '%s'";
-  $arguments = array_merge($arguments1, $query[3], array($type, $query[4]));
-  $result = db_query_temporary("SELECT i.type, i.sid, SUM(i.score * t.count) AS relevance, COUNT(*) AS matches FROM {search_index} i INNER JOIN {search_total} t ON i.word = t.word $join1 WHERE $conditions GROUP BY i.type, i.sid HAVING COUNT(*) >= %d", $arguments, 'temp_search_sids');
-
-  // Calculate maximum relevance, to normalize it
-  $normalize = db_result(db_query('SELECT MAX(relevance) FROM temp_search_sids'));
-  if (!$normalize) {
-    return array();
-  }
-  $select2 = str_replace('i.relevance', '('. (1.0 / $normalize) .' * i.relevance)', $select2);
-
-  // Second pass: only keep items that match the complicated keywords conditions (phrase search, negative keywords, ...)
-  $conditions = '('. $query[0] .')';
-  $arguments = array_merge($arguments2, $query[1]);
-  $result = db_query_temporary("SELECT i.type, i.sid, $select2 FROM temp_search_sids i INNER JOIN {search_dataset} d ON i.sid = d.sid AND i.type = d.type $join2 WHERE $conditions $sort_parameters", $arguments, 'temp_search_results');
-  if (($count = db_result(db_query('SELECT COUNT(*) FROM temp_search_results'))) == 0) {
-    return array();
-  }
-  $count_query = "SELECT $count";
-
-  // Do actual search query
-  $result = pager_query("SELECT * FROM temp_search_results", 10, 0, $count_query);
-  $results = array();
-  while ($item = db_fetch_object($result)) {
-    $results[] = $item;
-  }
-  return $results;
-}
-
-/**
- * Helper function for grabbing search keys.
- */
-function search_get_keys() {
-  // Extract keys as remainder of path
-  // Note: support old GET format of searches for existing links.
-  $path = explode('/', $_GET['q'], 3);
-  return count($path) == 3 ? $path[2] : $_REQUEST['keys'];
-}
-
-/**
- * Menu callback; presents the search form and/or search results.
- */
-function search_view() {
-  $type = arg(1);
-
-  // Search form submits with POST but redirects to GET. This way we can keep
-  // the search query URL clean as a whistle:
-  // search/type/keyword+keyword
-  if (!isset($_POST['edit']['form_id'])) {
-    if ($type == '') {
-      // Note: search/node can not be a default tab because it would take on the
-      // path of its parent (search). It would prevent remembering keywords when
-      // switching tabs. This is why we drupal_goto to it from the parent instead.
-      drupal_goto('search/node');
-    }
-
-    $keys = search_get_keys();
-    // Only perform search if there is non-whitespace search term:
-    if (trim($keys)) {
-      // Log the search keys:
-      watchdog('search', t('Search: %keys (%type).', array('%keys' => theme('placeholder', $keys), '%type' => module_invoke($type, 'search', 'name'))), WATCHDOG_NOTICE, l(t('results'), 'search/'. $type .'/'. $keys));
-
-      // Collect the search results:
-      $results = search_data($keys, $type);
-
-      if ($results) {
-        $results = theme('box', t('Search results'), $results);
-      }
-      else {
-        $results = theme('box', t('Your search yielded no results'), search_help('search#noresults'));
-      }
-    }
-
-    // Construct the search form.
-    $output = search_form(NULL, $keys, $type);
-    $output .= $results;
-
-    return $output;
-  }
-
-  return search_form(NULL, $keys, $type);
-}
-
-/**
- * @defgroup search Search interface
- * @{
- * The Drupal search interface manages a global search mechanism.
- *
- * Modules may plug into this system to provide searches of different types of
- * data. Most of the system is handled by search.module, so this must be enabled
- * for all of the search features to work.
- *
- * There are three ways to interact with the search system:
- * - Specifically for searching nodes, you can implement nodeapi('update index')
- *   and nodeapi('search result'). However, note that the search system already
- *   indexes all visible output of a node, i.e. everything displayed normally
- *   by hook_view() and hook_nodeapi('view'). This is usually sufficient.
- *   You should only use this mechanism if you want additional, non-visible data
- *   to be indexed.
- * - Implement hook_search(). This will create a search tab for your module on
- *   the /search page with a simple keyword search form. You may optionally
- *   implement hook_search_item() to customize the display of your results.
- * - Implement hook_update_index(). This allows your module to use Drupal's
- *   HTML indexing mechanism for searching full text efficiently.
- *
- * If your module needs to provide a more complicated search form, then you need
- * to implement it yourself without hook_search(). In that case, you should
- * define it as a local task (tab) under the /search page (e.g. /search/mymodule)
- * so that users can easily find it.
- */
-
-/**
- * Render a search form.
- *
- * @param $action
- *   Form action. Defaults to "search".
- * @param $keys
- *   The search string entered by the user, containing keywords for the search.
- * @param $type
- *   The type of search to render the node for. Must be the name of module
- *   which implements hook_search(). Defaults to 'node'.
- * @param $prompt
- *   A piece of text to put before the form (e.g. "Enter your keywords")
- * @return
- *   An HTML string containing the search form.
- */
-function search_form($action = '', $keys = '', $type = NULL, $prompt = NULL) {
-  if (!$action) {
-    $action = url('search/'. $type);
-  }
-  if (is_null($prompt)) {
-    $prompt = t('Enter your keywords');
-  }
-
-  $form = array(
-    '#action' => $action,
-    '#attributes' => array('class' => 'search-form'),
-  );
-  $form['module'] = array('#type' => 'value', '#value' => $type);
-  $form['basic'] = array('#type' => 'item', '#title' => $prompt);
-  $form['basic']['inline'] = array('#prefix' => '<div class="container-inline">', '#suffix' => '</div>');
-  $form['basic']['inline']['keys'] = array(
-    '#type' => 'textfield',
-    '#title' => '',
-    '#default_value' => $keys,
-    '#size' => $prompt ? 40 : 20,
-    '#maxlength' => 255,
-  );
-  // processed_keys is used to coordinate keyword passing between other forms
-  // that hook into the basic search form.
-  $form['basic']['inline']['processed_keys'] = array('#type' => 'value', '#value' => array());
-  $form['basic']['inline']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
-
-  return drupal_get_form('search_form', $form);
-}
-
-/**
- * As the search form collates keys from other modules hooked in via
- * hook_form_alter, the validation takes place in _submit.
- * search_form_validate() is used solely to set the 'processed_keys' form
- * value for the basic search form.
- */
-function search_form_validate($form_id, $form_values, $form) {
-  form_set_value($form['basic']['inline']['processed_keys'], trim($form_values['keys']));
-}
-
-/**
- * Process a search form submission.
- */
-function search_form_submit($form_id, $form_values) {
-  $keys = $form_values['processed_keys'];
-  if ($keys == '') {
-    form_set_error('keys', t('Please enter some keywords.'));
-    // Fall through to the drupal_goto() call.
-  }
-
-  $type = $form_values['module'] ? $form_values['module'] : 'node';
-  return 'search/'. $type .'/'. $keys;
-}
-
-/**
- * Output a search form for the search block and the theme's search box.
- */
-function search_box($form_id = 'search_theme_form') {
-  // Use search_keys instead of keys to avoid ID conflicts with the search block.
-  $form[$form_id .'_keys'] = array(
-    '#type' => 'textfield',
-    '#size' => 15,
-    '#default_value' => '',
-    '#attributes' => array('title' => t('Enter the terms you wish to search for.')),
-  );
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
-
-  return drupal_get_form($form_id, $form, 'search_box_form');
-}
-
-/**
- * Process a block search form submission.
- */
-function search_box_form_submit($form_id, $form_values) {
-  return 'search/node/'. trim($form_values[$form_id .'_keys']);
-}
-
-/**
- * Theme the theme search form.
- */
-function theme_search_theme_form($form) {
-  return '<div id="search" class="container-inline">'. form_render($form) .'</div>';
-}
-
-/**
- * Theme the block search form.
- */
-function theme_search_block_form($form) {
-  return '<div class="container-inline">'. form_render($form) .'</div>';
-}
-
-/**
- * Perform a standard search on the given keys, and return the formatted results.
- */
-function search_data($keys = NULL, $type = 'node') {
-  if (isset($keys)) {
-    if (module_hook($type, 'search')) {
-      $results = module_invoke($type, 'search', 'search', $keys);
-      if (isset($results) && is_array($results) && count($results)) {
-        if (module_hook($type, 'search_page')) {
-          return module_invoke($type, 'search_page', $results);
-        }
-        else {
-          return theme('search_page', $results, $type);
-        }
-      }
-    }
-  }
-}
-
-/**
- * Returns snippets from a piece of text, with certain keywords highlighted.
- * Used for formatting search results.
- *
- * @param $keys
- *   A string containing a search query.
- *
- * @param $text
- *   The text to extract fragments from.
- *
- * @return
- *   A string containing HTML for the excerpt.
- */
-function search_excerpt($keys, $text) {
-  // We highlight around non-indexable or CJK characters.
-  $boundary = '(?:(?<=['. PREG_CLASS_SEARCH_EXCLUDE . PREG_CLASS_CJK .'])|(?=['. PREG_CLASS_SEARCH_EXCLUDE . PREG_CLASS_CJK .']))';
-
-  // Extract positive keywords and phrases
-  preg_match_all('/ ("([^"]+)"|(?!OR)([^" ]+))/', ' '. $keys, $matches);
-  $keys = array_merge($matches[2], $matches[3]);
-
-  // Prepare text
-  $text = ' '. strip_tags(str_replace(array('<', '>'), array(' <', '> '), $text)) .' ';
-  array_walk($keys, '_search_excerpt_replace');
-  $workkeys = $keys;
-
-  // Extract a fragment per keyword for at most 4 keywords.
-  // First we collect ranges of text around each keyword, starting/ending
-  // at spaces.
-  // If the sum of all fragments is too short, we look for second occurrences.
-  $ranges = array();
-  $included = array();
-  $length = 0;
-  while ($length < 256 && count($workkeys)) {
-    foreach ($workkeys as $k => $key) {
-      if (strlen($key) == 0) {
-        unset($workkeys[$k]);
-        unset($keys[$k]);
-        continue;
-      }
-      if ($length >= 256) {
-        break;
-      }
-      // Remember occurrence of key so we can skip over it if more occurrences
-      // are desired.
-      if (!isset($included[$key])) {
-        $included[$key] = 0;
-      }
-      // Locate a keyword (position $p), then locate a space in front (position
-      // $q) and behind it (position $s)
-      if (preg_match('/'. $boundary . $key . $boundary .'/iu', $text, $match, PREG_OFFSET_CAPTURE, $included[$key])) {
-        $p = $match[0][1];
-        if (($q = strpos($text, ' ', max(0, $p - 60))) !== false) {
-          $end = substr($text, $p, 80);
-          if (($s = strrpos($end, ' ')) !== false) {
-            $ranges[$q] = $p + $s;
-            $length += $p + $s - $q;
-            $included[$key] = $p + 1;
-          }
-          else {
-            unset($workkeys[$k]);
-          }
-        }
-        else {
-          unset($workkeys[$k]);
-        }
-      }
-      else {
-        unset($workkeys[$k]);
-      }
-    }
-  }
-
-  // If we didn't find anything, return the beginning.
-  if (count($ranges) == 0) {
-    return truncate_utf8($text, 256) . ' ...';
-  }
-
-  // Sort the text ranges by starting position.
-  ksort($ranges);
-
-  // Now we collapse overlapping text ranges into one. The sorting makes it O(n).
-  $newranges = array();
-  foreach ($ranges as $from2 => $to2) {
-    if (!isset($from1)) {
-      $from1 = $from2;
-      $to1 = $to2;
-      continue;
-    }
-    if ($from2 <= $to1) {
-      $to1 = max($to1, $to2);
-    }
-    else {
-      $newranges[$from1] = $to1;
-      $from1 = $from2;
-      $to1 = $to2;
-    }
-  }
-  $newranges[$from1] = $to1;
-
-  // Fetch text
-  $out = array();
-  foreach ($newranges as $from => $to) {
-    $out[] = substr($text, $from, $to - $from);
-  }
-  $text = (isset($newranges[0]) ? '' : '... '). implode(' ... ', $out) .' ...';
-
-  // Highlight keywords. Must be done at once to prevent conflicts ('strong' and '<strong>').
-  $text = preg_replace('/'. $boundary .'('. implode('|', $keys) .')'. $boundary .'/iu', '<strong>\0</strong>', $text);
-  return $text;
-}
-
-/**
- * @} End of "defgroup search".
- */
-
-/**
- * Helper function for array_walk in search_except.
- */
-function _search_excerpt_replace(&$text) {
-  $text = preg_quote($text, '/');
-}
-
-/**
- * Format a single result entry of a search query. This function is normally
- * called by theme_search_page() or hook_search_page().
- *
- * @param $item
- *   A single search result as returned by hook_search(). The result should be
- *   an array with keys "link", "title", "type", "user", "date", and "snippet".
- *   Optionally, "extra" can be an array of extra info to show along with the
- *   result.
- * @param $type
- *   The type of item found, such as "user" or "node".
- *
- * @ingroup themeable
- */
-function theme_search_item($item, $type) {
-  $output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';
-  $info = array();
-  if ($item['type']) {
-    $info[] = $item['type'];
-  }
-  if ($item['user']) {
-    $info[] = $item['user'];
-  }
-  if ($item['date']) {
-    $info[] = format_date($item['date'], 'small');
-  }
-  if (is_array($item['extra'])) {
-    $info = array_merge($info, $item['extra']);
-  }
-  $output .= ' <dd>'. ($item['snippet'] ? '<p>'. $item['snippet'] . '</p>' : '') . '<p class="search-info">' . implode(' - ', $info) .'</p></dd>';
-  return $output;
-}
-
-/**
- * Format the result page of a search query.
- *
- * Modules may implement hook_search_page() in order to override this default
- * function to display search results. In that case it is expected they provide
- * their own themeable functions.
- *
- * @param $results
- *   All search result as returned by hook_search().
- * @param $type
- *   The type of item found, such as "user" or "node".
- *
- * @ingroup themeable
- */
-function theme_search_page($results, $type) {
-  $output = '<dl class="search-results">';
-
-  foreach ($results as $entry) {
-    $output .= theme('search_item', $entry, $type);
-  }
-  $output .= '</dl>';
-  $output .= theme('pager', NULL, 10, 0);
-
-  return $output;
-}
diff --git a/modules/statistics.module b/modules/statistics.module
deleted file mode 100644 (file)
index e5a594a..0000000
+++ /dev/null
@@ -1,495 +0,0 @@
-<?php
-// $Id: statistics.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Logs access statistics for your site.
- */
-
-/**
- * Implementation of hook_help().
- */
-function statistics_help($section) {
-  switch ($section) {
-    case 'admin/help#statistics':
-      $output = '<p>'. t('The statistics module keeps track of numerous statistics of site usage. It counts how many times, and from where each of your posts is viewed. The statistics module can be used to learn many useful things about how users are interacting with each other and with your site.') .'</p>';
-      $output .= t('<p>Statistics module features</p>
-<ul>
-<li>Logs show statistics for how many times your site and specific content on your site has been accessed.</li>
-<li>Referrers tells you from where visitors came from (referrer URL).</li>
-<li>Top pages shows you what\'s hot, what is the most popular content on your site.</li>
-<li>Top users shows you the most active users for your site.</li>
-<li>Recent hits displays information about the latest activity on your site.</li>
-<li>Node count displays the number of times a node has been accessed in the node\'s link section next to <em># comments</em>.</li>
-<li>Popular content block creates a block that can display the day\'s top viewed content, the all time top viewed content, and the last content viewed.</li>
-</ul>
-');
-      $output .= t('<p>Configuring the statistics module</p>
-<ul>
-<li>Enable access log allows you to turn the access log on and off. This log is used to store data about every page accessed, such as the remote host\'s IP address, where they came from (referrer), what node they\'ve viewed, and their user name. Enabling the log adds one database call per page displayed by Drupal.</li>
-<li>Discard access logs older than allows you to configure how long an access log entry is saved, after which time it is deleted from the database table. To use this you need to run <em>cron.php</em></li>
-<li>Enable node view counter allows you to turn on and off the node-counting functionality of this module. If it is turned on, an extra database query is added for each node displayed, which increments a counter.</li>
-</ul>
-');
-      $output .= t('<p>You can</p>
-<ul>
-<li>administer statistics <a href="%admin-settings-statistics">administer &gt;&gt; settings &gt;&gt; statistics</a>.</li>
-<li>access statistics logs <a href="%admin-logs">administer &gt;&gt; logs</a>.</li>
-<li>view recent hits <a href="%admin-logs-hits">administer &gt;&gt; logs &gt;&gt; recent hits</a>.</li>
-<li>enable \'popular content\' block in block administration <a href="%admin-block">administer &gt;&gt; blocks </a> but only after you have enabled \'Count content views\' in settings.</li>
-</ul>
-', array('%admin-settings-statistics' => url('admin/settings/statistics'), '%admin-logs' => url('admin/logs'), '%admin-logs-hits' => url('admin/logs/hits'), '%admin-block' => url('admin/block')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%statistics">Statistics page</a>.', array('%statistics' => 'http://drupal.org/handbook/modules/statistics/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Logs access statistics for your site.');
-    case 'admin/settings/statistics':
-      return t('<p>Settings for the statistical information that Drupal will keep about the site. See <a href="%statistics">site statistics</a> for the actual information.</p>', array('%statistics' => url('admin/logs/hits')));
-    case 'admin/logs/hits':
-      return t('<p>This page shows you the most recent hits.</p>');
-    case 'admin/logs/referrers':
-      return t('<p>This page shows you all external referrers. These are links pointing to your web site from outside your web site.</p>');
-    case 'admin/logs/visitors':
-      return t('<p>When you ban a visitor, you prevent his IP address from accessing your site. Unlike blocking a user, banning a visitor works even for anonymous users. The most common use for this is to block bots/web crawlers that are consuming too many resources.</p>');
-  }
-}
-
-/**
- * Implementation of hook_exit().
- *
- * This is where statistics are gathered on page accesses.
- */
-function statistics_exit() {
-  global $user, $recent_activity;
-
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);
-
-  if (variable_get('statistics_count_content_views', 0)) {
-    // We are counting content views.
-    if ((arg(0) == 'node') && is_numeric(arg(1)) && arg(2) == '') {
-      // A node has been viewed, so update the node's counters.
-      db_query('UPDATE {node_counter} SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d', time(), arg(1));
-      // If we affected 0 rows, this is the first time viewing the node.
-      if (!db_affected_rows()) {
-        // We must create a new row to store counters for the new node.
-        db_query('INSERT INTO {node_counter} (nid, daycount, totalcount, timestamp) VALUES (%d, 1, 1, %d)', arg(1), time());
-      }
-    }
-  }
-  if ((variable_get('statistics_enable_access_log', 0)) && (module_invoke('throttle', 'status') == 0)) {
-    // Log this page access.
-    db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", strip_tags(drupal_get_title()), $_GET['q'], referer_uri(), $_SERVER['REMOTE_ADDR'], $user->uid, session_id(), timer_read('page'), time());
-  }
-}
-
-/**
- * Implementation of hook_perm().
- */
-function statistics_perm() {
-  return array('access statistics', 'view post access counter');
-}
-
-/**
- * Implementation of hook_link().
- */
-function statistics_link($type, $node = 0, $main = 0) {
-  global $id;
-  $links = array();
-
-  if ($type != 'comment' && user_access('view post access counter')) {
-    $statistics = statistics_get($node->nid);
-    if ($statistics) {
-      $links[] = format_plural($statistics['totalcount'], '1 read', '%count reads');
-    }
-  }
-
-  return $links;
-}
-
-/**
- * Implementation of hook_menu().
- */
-function statistics_menu($may_cache) {
-  $items = array();
-
-  $access = user_access('access statistics');
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/logs/hits', 'title' => t('recent hits'),
-      'callback' => 'statistics_recent_hits', 'access' => $access,
-      'weight' => 3);
-    $items[] = array('path' => 'admin/logs/pages', 'title' => t('top pages'),
-      'callback' => 'statistics_top_pages', 'access' => $access,
-      'weight' => 1);
-    $items[] = array('path' => 'admin/logs/visitors', 'title' => t('top visitors'),
-      'callback' => 'statistics_top_visitors', 'access' => $access,
-      'weight' => 2);
-    $items[] = array('path' => 'admin/logs/referrers', 'title' => t('referrers'),
-      'callback' => 'statistics_top_referrers', 'access' => $access);
-    $items[] = array('path' => 'admin/logs/access', 'title' => t('details'),
-      'callback' => 'statistics_access_log', 'access' => $access,
-      'type' => MENU_CALLBACK);
-  }
-  else {
-    if (arg(0) == 'user' && is_numeric(arg(1)) && variable_get('statistics_enable_access_log', 0)) {
-      $items[] = array('path' => 'user/'. arg(1) .'/track/navigation', 'title' => t('track page visits'),
-        'callback' => 'statistics_user_tracker', 'access' => $access,
-        'type' => MENU_LOCAL_TASK, 'weight' => 2);
-    }
-    if (arg(0) == 'node' && is_numeric(arg(1)) && variable_get('statistics_enable_access_log', 0)) {
-      $items[] = array('path' => 'node/'. arg(1) .'/track', 'title' => t('track'),
-        'callback' => 'statistics_node_tracker', 'access' => $access,
-        'type' => MENU_LOCAL_TASK, 'weight' => 2);
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_user().
- */
-function statistics_user($op, &$edit, &$user) {
-  if ($op == 'delete') {
-    db_query('UPDATE {accesslog} SET uid = 0 WHERE uid = %d', $user->uid);
-  }
-}
-
-function statistics_access_log($aid) {
-  $result = db_query('SELECT a.*, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE aid = %d', $aid);
-  if ($access = db_fetch_object($result)) {
-    $output  = '<table border="1" cellpadding="2" cellspacing="2">';
-    $output .= ' <tr><th>'. t('URL') ."</th><td>". l(url($access->path, NULL, NULL, TRUE), $access->path) ."</td></tr>";
-    $output .= ' <tr><th>'. t('Title') .'</th><td>'. $access->title .'</td></tr>'; // safe because it comes from drupal_get_title()
-    $output .= ' <tr><th>'. t('Referrer') ."</th><td>". ($access->url ? l($access->url, $access->url) : '') ."</td></tr>";
-    $output .= ' <tr><th>'. t('Date') .'</th><td>'. format_date($access->timestamp, 'large') .'</td></tr>';
-    $output .= ' <tr><th>'. t('User') .'</th><td>'. theme('username', $access) .'</td></tr>';
-    $output .= ' <tr><th>'. t('Hostname') .'</th><td>'. check_plain($access->hostname) .'</td></tr>';
-    $output .= '</table>';
-    return $output;
-  }
-  else {
-    drupal_not_found();
-  }
-}
-
-function statistics_node_tracker() {
-  if ($node = node_load(arg(1))) {
-
-    $header = array(
-        array('data' => t('Time'), 'field' => 'a.timestamp', 'sort' => 'desc'),
-        array('data' => t('Referrer'), 'field' => 'a.url'),
-        array('data' => t('User'), 'field' => 'u.name'),
-        array('data' => t('Operations')));
-
-    $result = pager_query('SELECT a.aid, a.timestamp, a.url, a.uid, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE a.path LIKE \'node/%d%%\'' . tablesort_sql($header), 30, 0, NULL, $node->nid);
-    while ($log = db_fetch_object($result)) {
-      $rows[] = array(
-        array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
-        _statistics_link($log->url),
-        theme('username', $log),
-        l(t('details'), "admin/logs/access/$log->aid"));
-    }
-
-    drupal_set_title(check_plain($node->title));
-    $output = theme('table', $header, $rows);
-    $output .= theme('pager', NULL, 30, 0);
-    return $output;
-  }
-  else {
-    drupal_not_found();
-  }
-}
-
-function statistics_user_tracker() {
-  if ($account = user_load(array('uid' => arg(1)))) {
-
-    $header = array(
-        array('data' => t('Timestamp'), 'field' => 'timestamp', 'sort' => 'desc'),
-        array('data' => t('Page'), 'field' => 'path'),
-        array('data' => t('Operations')));
-
-    $result = pager_query('SELECT aid, timestamp, path, title FROM {accesslog} WHERE uid = %d' . tablesort_sql($header), 30, 0, NULL, $account->uid);
-    while ($log = db_fetch_object($result)) {
-      $rows[] = array(
-        array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
-        _statistics_format_item($log->title, $log->path),
-        l(t('details'), "admin/logs/access/$log->aid"));
-    }
-
-    drupal_set_title($account->name);
-    $output = theme('table', $header, $rows);
-    $output .= theme('pager', NULL, 30, 0);
-    return $output;
-  }
-  else {
-    drupal_not_found();
-  }
-}
-
-/**
- * Menu callback; presents the "recent hits" page.
- */
-function statistics_recent_hits() {
-  $header = array(
-    array('data' => t('Timestamp'), 'field' => 'a.timestamp', 'sort' => 'desc'),
-    array('data' => t('Page'), 'field' => 'a.path'),
-    array('data' => t('User'), 'field' => 'u.name'),
-    array('data' => t('Operations'))
-  );
-
-  $sql = 'SELECT a.aid, a.path, a.title, a.uid, u.name, a.timestamp FROM {accesslog} a LEFT JOIN {users} u ON u.uid = a.uid' . tablesort_sql($header);
-
-  $result = pager_query($sql, 30);
-  while ($log = db_fetch_object($result)) {
-    $rows[] = array(
-      array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
-      _statistics_format_item($log->title, $log->path),
-      theme('username', $log),
-      l(t('details'), "admin/logs/access/$log->aid"));
-  }
-
-  $output = theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 30, 0);
-  return $output;
-}
-
-/**
- * Menu callback; presents the "top pages" page.
- */
-function statistics_top_pages() {
-  $sql = "SELECT COUNT(path) AS hits, path, title, AVG(timer) AS average_time, SUM(timer) AS total_time FROM {accesslog} GROUP BY path, title";
-  $sql_cnt = "SELECT COUNT(DISTINCT(path)) FROM {accesslog}";
-
-  $header = array(
-    array('data' => t('Hits'), 'field' => 'hits', 'sort' => 'desc'),
-    array('data' => t('Page'), 'field' => 'path'),
-    array('data' => t('Average page generation time'), 'field' => 'average_time'),
-    array('data' => t('Total page generation time'), 'field' => 'total_time')
-  );
-  $sql .= tablesort_sql($header);
-  $result = pager_query($sql, 30, 0, $sql_cnt);
-
-  while ($page = db_fetch_object($result)) {
-    $rows[] = array($page->hits, _statistics_format_item($page->title, $page->path), t('%time ms', array('%time' => round($page->average_time))), format_interval(round($page->total_time / 1000)));
-  }
-
-  drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
-  $output = theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 30, 0);
-  return $output;
-}
-
-/**
- * Menu callback; presents the "top visitors" page.
- */
-function statistics_top_visitors() {
-
-  $header = array(
-    array('data' => t('Hits'), 'field' => 'hits', 'sort' => 'desc'),
-    array('data' => t('Visitor'), 'field' => 'u.name'),
-    array('data' => t('Total page generation time'), 'field' => 'total'),
-    array('data' => t('Operations'))
-  );
-
-  $sql = "SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, ac.aid FROM {accesslog} a LEFT JOIN {access} ac ON ac.type = 'host' AND LOWER(a.hostname) LIKE (ac.mask) LEFT JOIN {users} u ON a.uid = u.uid GROUP BY a.hostname, a.uid, u.name, ac.aid". tablesort_sql($header);
-  $sql_cnt = "SELECT COUNT(DISTINCT(uid)) FROM {accesslog}";
-  $result = pager_query($sql, 30, 0, $sql_cnt);
-
-  while ($account = db_fetch_object($result)) {
-    $qs = drupal_get_destination();
-    $ban_link = $account->aid ? l(t('unban'), "admin/access/rules/delete/$account->aid", array(), $qs) : l(t('ban'), "admin/access/rules/add/$account->hostname/host", array(), $qs);
-    $rows[] = array($account->hits, ($account->uid ? theme('username', $account) : $account->hostname), format_interval(round($account->total / 1000)), $ban_link);
-  }
-
-  drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
-  $output = theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 30, 0);
-  return $output;
-}
-
-/**
- * Menu callback; presents the "referrer" page.
- */
-function statistics_top_referrers() {
-  $query = "SELECT url, COUNT(url) AS hits, MAX(timestamp) AS last FROM {accesslog} WHERE url NOT LIKE '%%%s%%' AND url <> '' GROUP BY url";
-  $query_cnt = "SELECT COUNT(DISTINCT(url)) FROM {accesslog} WHERE url <> '' AND url NOT LIKE '%%%s%%'";
-  drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
-
-  $header = array(
-    array('data' => t('Hits'), 'field' => 'hits', 'sort' => 'desc'),
-    array('data' => t('Url'), 'field' => 'url'),
-    array('data' => t('Last visit'), 'field' => 'last'),
-  );
-
-  $query .= tablesort_sql($header);
-  $result = pager_query($query, 30, 0, $query_cnt, $_SERVER['HTTP_HOST']);
-
-  while ($referrer = db_fetch_object($result)) {
-    $rows[] = array($referrer->hits, _statistics_link($referrer->url), t('%time ago', array('%time' => format_interval(time() - $referrer->last))));
-  }
-
-  $output = theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 30, 0);
-  return $output;
-}
-
-/**
- * Implementation of hook_settings().
- */
-function statistics_settings() {
-  // access log settings:
-  $options = array('1' => t('Enabled'), '0' => t('Disabled'));
-  $form['access'] = array('#type' => 'fieldset', '#title' => t('Access log settings'));
-  $form['access']['statistics_enable_access_log'] = array('#type' => 'radios', '#title' => t('Enable access log'), '#default_value' =>  variable_get('statistics_enable_access_log', 0), '#options' => $options, '#description' => t('Log each page access.  Required for referrer statistics.'));
-  $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
-  $form['access']['statistics_flush_accesslog_timer'] = array('#type' => 'select', '#title' => t('Discard access logs older than'), '#default_value'   => variable_get('statistics_flush_accesslog_timer', 259200), '#options' => $period, '#description' => t('Older access log entries (including referrer statistics) will be automatically discarded.  Requires crontab.'));
-
-  // count content views settings
-  $form['content'] = array('#type' => 'fieldset', '#title' => t('Content viewing counter settings'));
-  $form['content']['statistics_count_content_views'] = array('#type' => 'radios', '#title' => t('Count content views'), '#default_value' =>  variable_get('statistics_count_content_views', 0), '#options' => $options, '#description' => t('Increment a counter each time content is viewed.'));
-
-  return $form;
-}
-
-/**
- * Implementation of hook_cron().
- */
-function statistics_cron() {
-  $statistics_timestamp = variable_get('statistics_day_timestamp', '');
-
-  if ((time() - $statistics_timestamp) >= 86400) {
-    /* reset day counts */
-    db_query('UPDATE {node_counter} SET daycount = 0');
-    variable_set('statistics_day_timestamp', time());
-  }
-
-  /* clean expired access logs */
-  db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get('statistics_flush_accesslog_timer', 259200));
-}
-
-/**
- * Returns all time or today top or last viewed node(s).
- *
- * @param $dbfield
- *   one of
- *   - 'totalcount': top viewed content of all time.
- *   - 'daycount': top viewed content for today.
- *   - 'timestamp': last viewed node.
- *
- * @param $dbrows
- *   number of rows to be returned.
- *
- * @return
- *   A query result containing n.nid, n.title, u.uid, u.name of the selected node(s)
- *   or FALSE if the query could not be executed correctly.
- */
-function statistics_title_list($dbfield, $dbrows) {
-  return db_query_range(db_rewrite_sql("SELECT n.nid, n.title, u.uid, u.name FROM {node} n INNER JOIN {node_counter} s ON n.nid = s.nid INNER JOIN {users} u ON n.uid = u.uid WHERE %s <> '0' AND n.status = 1 ORDER BY %s DESC"), 's.'. $dbfield, 's.'. $dbfield, 0, $dbrows);
-}
-
-
-/**
- * Retrieves a node's "view statistics".
- *
- * @param $nid
- *   node ID
- *
- * @return
- *   An array with three entries: [0]=totalcount, [1]=daycount, [2]=timestamp
- *   - totalcount: count of the total number of times that node has been viewed.
- *   - daycount: count of the total number of times that node has been viewed "today".
- *     For the daycount to be reset, cron must be enabled.
- *   - timestamp: timestamp of when that node was last viewed.
- */
-function statistics_get($nid) {
-
-  if ($nid > 0) {
-    /* retrieves an array with both totalcount and daycount */
-    $statistics = db_fetch_array(db_query('SELECT totalcount, daycount, timestamp FROM {node_counter} WHERE nid = %d', $nid));
-  }
-
-  return $statistics;
-}
-
-/**
- * Implementation of hook_block().
- */
-function statistics_block($op = 'list', $delta = 0, $edit = array()) {
-  switch ($op) {
-    case 'list':
-      if (variable_get('statistics_count_content_views', 0)) {
-        $blocks[0]['info'] = t('Popular content');
-      }
-      return $blocks;
-
-    case 'configure':
-      // Popular content block settings
-      $numbers = array('0' => t('Disabled')) + drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40));
-      $form['statistics_block_top_day_num'] = array('#type' => 'select', '#title' => t("Number of day's top views to display"), '#default_value' => variable_get('statistics_block_top_day_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "day" list.'));
-      $form['statistics_block_top_all_num'] = array('#type' => 'select', '#title' => t('Number of all time views to display'), '#default_value' => variable_get('statistics_block_top_all_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "all time" list.'));
-      $form['statistics_block_top_last_num'] = array('#type' => 'select', '#title' => t('Number of most recent views to display'), '#default_value' => variable_get('statistics_block_top_last_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "recently viewed" list.'));
-      return $form;
-
-    case 'save':
-      variable_set('statistics_block_top_day_num', $edit['statistics_block_top_day_num']);
-      variable_set('statistics_block_top_all_num', $edit['statistics_block_top_all_num']);
-      variable_set('statistics_block_top_last_num', $edit['statistics_block_top_last_num']);
-      break;
-
-    case 'view':
-      if (user_access('access content')) {
-        $content = array();
-
-        $daytop = variable_get('statistics_block_top_day_num', 0);
-        if ($daytop && ($result = statistics_title_list('daycount', $daytop)) && db_num_rows($result)) {
-          $content[] = node_title_list($result, t("Today's:"));
-        }
-
-        $alltimetop = variable_get('statistics_block_top_all_num', 0);
-        if ($alltimetop && ($result = statistics_title_list('totalcount', $alltimetop)) && db_num_rows($result)) {
-          $content[] = node_title_list($result, t('All time:'));
-        }
-
-        $lasttop = variable_get('statistics_block_top_last_num', 0);
-        if ($lasttop && ($result = statistics_title_list('timestamp', $lasttop)) && db_num_rows($result)) {
-          $content[] = node_title_list($result, t('Last viewed:'));
-        }
-
-        if (count($content)) {
-          $block['content'] = implode('<br />', $content);
-          $block['subject'] = t('Popular content');
-          return $block;
-        }
-      }
-  }
-}
-
-/**
- * It is possible to adjust the width of columns generated by the
- * statistics module.
- */
-function _statistics_link($path, $width = 35) {
-  $title = drupal_get_path_alias($path);
-  $title = truncate_utf8($title, $width, FALSE, TRUE);
-  return l($title, $path);
-}
-
-function _statistics_format_item($title, $path) {
-  $path = ($path ? $path : '/');
-  $output  = ($title ? "$title<br />" : '');
-  $output .= _statistics_link($path);
-  return $output;
-}
-
-/**
- * Implementation of hook_nodeapi().
- */
-function statistics_nodeapi(&$node, $op, $arg = 0) {
-  switch ($op) {
-    case 'delete':
-      // clean up statistics table when node is deleted
-      db_query('DELETE FROM {node_counter} WHERE nid = %d', $node->nid);
-  }
-}
-
-
diff --git a/modules/story.module b/modules/story.module
deleted file mode 100644 (file)
index 6c4fb18..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-// $Id: story.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables users to submit stories, articles or similar content.
- */
-
-/**
- * Implementation of hook_help().
- */
-function story_help($section) {
-  switch ($section) {
-    case 'admin/help#story':
-      $output = '<p>'. t('The story module is used to create a content post type called <em>stories.</em> Stories are articles in their simplest form: they have a title, a teaser and a body. Stories are typically used to post news articles or as a group blog. ') .'</p>';
-      $output .= '<p>'. t('The story administration interface allows for complex configuration. It provides a submission form, workflow, default view permission, default edit permission, permissions for permission, and attachments.  Trackbacks can also be enabled.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>post a story at <a href="%node-add-story">create content &gt;&gt; story</a>.</li>
-<li>configure story at <a href="%admin-settings-content-types-story">administer &gt;&gt; settings &gt;&gt; content types &gt;&gt; configure story</a>.</li>
-</ul>
-', array('%node-add-story' => url('node/add/story'), '%admin-settings-content-types-story' => url('admin/settings/content-types/story')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%story">Story page</a>.', array('%story' => 'http://drupal.org/handbook/modules/story/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Allows users to submit stories, articles or similar content.');
-    case 'node/add#story':
-      return t('Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles.');
-  }
-}
-
-/**
- * Implementation of hook_node_info().
- */
-function story_node_info() {
-  return array('story' => array('name' => t('story'), 'base' => 'story'));
-}
-
-/**
- * Implementation of hook_perm().
- */
-function story_perm() {
-  return array('create stories', 'edit own stories');
-}
-
-/**
- * Implementation of hook_access().
- */
-function story_access($op, $node) {
-  global $user;
-
-  if ($op == 'create') {
-    return user_access('create stories');
-  }
-
-  if ($op == 'update' || $op == 'delete') {
-    if (user_access('edit own stories') && ($user->uid == $node->uid)) {
-      return TRUE;
-    }
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function story_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'node/add/story', 'title' => t('story'),
-      'access' => user_access('create stories'));
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_form().
- */
-function story_form(&$node) {
-  $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -5);
-  $form['body_filter']['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE);
-  $form['body_filter']['format'] = filter_form($node->format);
-  return $form;
-}
-
diff --git a/modules/system.module b/modules/system.module
deleted file mode 100644 (file)
index c68bba4..0000000
+++ /dev/null
@@ -1,1272 +0,0 @@
-<?php
-// $Id: system.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Configuration system that lets administrators modify the workings of the site.
- */
-
-define('VERSION', '4.7.3');
-
-/**
- * Implementation of hook_help().
- */
-function system_help($section) {
-  global $base_url;
-
-  switch ($section) {
-    case 'admin/help#system':
-      $output = '<p>'. t('The system module provides system-wide defaults such as running jobs at a particular time, and storing web pages to improve efficiency.   The ability to run scheduled jobs makes administering the web site more usable, as administrators do not have to manually start jobs.   The storing of web pages, or caching, allows the site to efficiently re-use web pages and improve web site performance.  The settings module provides control over preferences, behaviours including visual and operational settings.') .'</p>';
-      $output .= '<p>'. t('Some modules require regularly scheduled actions, such as cleaning up logfiles. Cron, which stands for chronograph, is a periodic command scheduler executing commands at intervals specified in seconds. It can be used to control the execution of daily, weekly and monthly jobs (or anything with a period measured in seconds). The aggregator module periodically updates feeds using cron.  Ping periodically notifies services of new content on your site.  Search periodically indexes the content on your site.   Automating tasks is one of the best ways to keep a system running smoothly, and if most of your administration does not require your direct involvement, cron is an ideal solution.') .'</p>';
-      $output .= '<p>'. t('There is a caching mechanism which stores dynamically generated web pages in a database. By caching a web page, the system module does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server\'s load. Only pages requested by <em>anonymous</em> users are cached. In order to reduce server load and save bandwidth, the system module stores and sends cached pages compressed.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>activate your cron job on the cron page <a href="%file-cron">cron.php</a>.</li>
-<li>read how to <a href="%external-http-drupal-org-cron">configure cron jobs</a>.</li>
-<li>administer cache settings in <a href="%admin-settings">administer &gt;&gt; settings</a>.</li>
-</ul>
-', array('%file-cron' => 'cron.php', '%external-http-drupal-org-cron' => 'http://drupal.org/cron', '%admin-settings' => url('admin/settings')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%system">System page</a>.', array('%system' => 'http://drupal.org/handbook/modules/system/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Handles general site configuration for administrators.');
-    case 'admin':
-      return t('<p>Welcome to the administration section. Below are the most recent system events.</p>');
-    case 'admin/settings':
-      return t('<p>General configuration options for your site. Set up the name of the site, e-mail address used in mail-outs, clean URL options, caching, etc.</p>');
-    case 'admin/themes':
-      return t('<p>Select which themes are available to your users and specify the default theme. To configure site-wide display settings, click the "configure" task above. Alternately, to override these settings in a specific theme, click the "configure" link for the corresponding theme.  Note that different themes may have different regions available for rendering content like blocks.  If you want consistency in what your users see, you may wish to enable only one theme.</p>');
-    case 'admin/themes/settings':
-      return t('<p>These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.</p>');
-    case 'admin/themes/settings/'. arg(3):
-      $reference = explode('.', arg(3), 2);
-      $theme = array_pop($reference);
-      return t('<p>These options control the display settings for the <code>%template</code> theme. When your site is displayed using this theme, these settings will be used. By clicking "Reset to defaults," you can choose to use the <a href="%global">global settings</a> for this theme.</p>', array('%template' => $theme, '%global' => url('admin/themes/settings')));
-    case 'admin/modules':
-      return t('<p>Modules are plugins for Drupal that extend its core functionality. Here you can select which modules are enabled. Click on the name of the module in the navigation menu for their individual configuration pages. Once a module is enabled, new <a href="%permissions">permissions</a> might be made available. Modules can automatically be temporarily disabled to reduce server load when your site becomes extremely busy by enabling the throttle.module and checking throttle. The auto-throttle functionality must be enabled on the <a href="%throttle">throttle configuration page</a> after having enabled the throttle module.</p>
-<p>It is important that <a href="%update-php">update.php</a> is run every time a module is updated to a newer version.</p>', array('%permissions' => url('admin/access/permissions'), '%throttle' => url('admin/settings/throttle'), '%update-php' => $base_url .'/update.php'));
-  }
-}
-
-/**
- * Implementation of hook_perm().
- */
-function system_perm() {
-  return array('administer site configuration', 'access administration pages', 'select different theme');
-}
-
-/**
- * Implementation of hook_elements().
- */
-function system_elements() {
-  // Top level form
-  $type['form'] = array('#method' => 'post', '#action' => request_uri());
-
-  // Inputs
-  $type['checkbox'] = array('#input' => TRUE, '#return_value' => 1);
-  $type['submit'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => TRUE);
-  $type['button'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', '#executes_submit_callback' => FALSE);
-  $type['textfield'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 128, '#autocomplete_path' => FALSE);
-  $type['password'] = array('#input' => TRUE, '#size' => 30);
-  $type['password_confirm'] = array('#input' => TRUE, '#process' => array('expand_password_confirm' => array()));
-  $type['textarea'] = array('#input' => TRUE, '#cols' => 60, '#rows' => 5);
-  $type['radios'] = array('#input' => TRUE, '#process' => array('expand_radios' => array()));
-  $type['radio'] = array('#input' => TRUE);
-  $type['checkboxes'] = array('#input' => TRUE, '#process' => array('expand_checkboxes' => array()), '#tree' => TRUE);
-  $type['select'] = array('#input' => TRUE);
-  $type['weight'] = array('#input' => TRUE, '#delta' => 10, '#default_value' => 0);
-  $type['date'] = array('#input' => TRUE, '#process' => array('expand_date' => array()), '#validate' => array('date_validate' => array()));
-  $type['file'] = array('#input' => TRUE, '#size' => 60);
-
-  // Form structure
-  $type['item'] = array();
-  $type['hidden'] = array('#input' => TRUE);
-  $type['value'] = array('#input' => TRUE);
-  $type['markup'] = array('#prefix' => '', '#suffix' => '');
-  $type['fieldset'] = array('#collapsible' => FALSE, '#collapsed' => FALSE);
-  return $type;
-}
-
-/**
- * Implementation of hook_menu().
- */
-function system_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'system/files', 'title' => t('file download'),
-      'callback' => 'file_download',
-      'access' => TRUE,
-      'type' => MENU_CALLBACK);
-
-    $access = user_access('administer site configuration');
-
-    $items[] = array('path' => 'admin', 'title' => t('administer'),
-      'access' => user_access('access administration pages'),
-      'callback' => 'watchdog_overview',
-      'weight' => 9);
-
-    // Themes:
-    $items[] = array('path' => 'admin/themes', 'title' => t('themes'),
-      'callback' => 'system_themes', 'access' => $access);
-
-    $items[] = array('path' => 'admin/themes/select', 'title' => t('list'),
-      'callback' => 'system_themes', 'access' => $access,
-      'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -1);
-
-    $items[] = array('path' => 'admin/themes/settings', 'title' => t('configure'),
-      'callback' => 'system_theme_settings', 'access' => $access,
-      'type' => MENU_LOCAL_TASK);
-
-    // Theme configuration subtabs
-    $items[] = array('path' => 'admin/themes/settings/global', 'title' => t('global settings'),
-      'callback' => 'system_theme_settings', 'access' => $access,
-      'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -1);
-
-    foreach (list_themes() as $theme) {
-      if ($theme->status) {
-        $items[] = array('path' => 'admin/themes/settings/'. $theme->name, 'title' => $theme->name,
-        'callback' => 'system_theme_settings', 'callback arguments' => array($theme->name), 'access' => $access,
-        'type' => MENU_LOCAL_TASK);
-      }
-    }
-
-    // Modules:
-    $items[] = array('path' => 'admin/settings', 'title' => t('settings'),
-      'callback' => 'system_site_settings', 'access' => $access);
-    foreach (module_list() as $name) {
-      if (module_hook($name, 'settings')) {
-        $items[] = array('path' => 'admin/settings/'. $name, 'title' => t($name));
-      }
-    }
-    $items[] = array('path' => 'admin/modules', 'title' => t('modules'),
-      'callback' => 'system_modules', 'access' => $access);
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_user().
- *
- * Allows users to individually set their theme and time zone.
- */
-function system_user($type, $edit, &$user, $category = NULL) {
-  if ($type == 'form' && $category == 'account') {
-    $form['theme_select'] = system_theme_select_form(t('Selecting a different theme will change the look and feel of the site.'), $edit['theme'], 2);
-
-    if (variable_get('configurable_timezones', 1)) {
-      $zones = _system_zonelist();
-      $form['timezone'] = array('#type'=>'fieldset', '#title' => t('Locale settings'), '#weight' => 6);
-      $form['timezone']['timezone'] = array(
-        '#type' => 'select', '#title' => t('Time zone'), '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0),
-        '#options' => $zones, '#description' => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')
-      );
-    }
-
-    return $form;
-  }
-}
-
-/*
- * Returns a fieldset containing the theme select form.
- *
- * @param $description
- *    description of the fieldset
- * @param $default_value
- *    default value of theme radios
- * @param $weight
- *    weight of the fieldset
- * @return
- *    a form array
- */
-function system_theme_select_form($description = '', $default_value = '', $weight = 0) {
-  if (user_access('select different theme')) {
-    foreach (list_themes() as $theme) {
-      if ($theme->status) {
-        $enabled[] = $theme;
-      }
-    }
-
-    if (count($enabled) > 1) {
-      ksort($enabled);
-
-      $form['themes'] = array(
-        '#type' => 'fieldset',
-        '#title' => t('Theme configuration'),
-        '#description' => $description,
-        '#collapsible' => TRUE,
-        '#theme' => 'system_theme_select_form'
-      );
-
-      foreach ($enabled as $info) {
-        // For the default theme, revert to an empty string so the user's theme updates when the site theme is changed.
-        $info->key = $info->name == variable_get('theme_default', 'bluemarine') ? '' : $info->name;
-
-        $info->screenshot = dirname($info->filename) . '/screenshot.png';
-        $screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), false) : t('no screenshot');
-
-        $form['themes'][$info->key]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot);
-        $form['themes'][$info->key]['description'] = array('#type' => 'item', '#title' => $info->name,  '#value' => dirname($info->filename) . ($info->name == variable_get('theme_default', 'bluemarine') ? t('<br /> <em>(site default theme)</em>') : ''));
-        $options[$info->key] = '';
-      }
-
-      $form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $default_value ? $default_value : '');
-      $form['#weight'] = $weight;
-      return $form;
-    }
-  }
-}
-
-function theme_system_theme_select_form($form) {
-  foreach (element_children($form) as $key) {
-    $row = array();
-    if (is_array($form[$key]['description'])) {
-      $row[] = form_render($form[$key]['screenshot']);
-      $row[] = form_render($form[$key]['description']);
-      $row[] = form_render($form['theme'][$key]);
-    }
-    $rows[] = $row;
-  }
-
-  $header = array(t('Screenshot'), t('Name'), t('Selected'));
-  $output = theme('table', $header, $rows);
-  return $output;
-}
-
-function _system_zonelist() {
-  $timestamp = time();
-  $zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14);
-  $zones = array();
-  foreach ($zonelist as $offset) {
-    $zone = $offset * 3600;
-    $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', 'l, F j, Y - H:i') . ' O', $zone);
-  }
-  return $zones;
-}
-
-function system_view_general() {
-  // General settings:
-  $form['general'] = array(
-    '#type' => 'fieldset', '#title' => t('General settings'),
-    '#collapsible' => TRUE, '#collapsed' => TRUE
-  );
-  $form['general']['site_name'] = array(
-    '#type' => 'textfield', '#title' => t('Name'), '#default_value' => variable_get('site_name', 'drupal'),
-    '#description' => t('The name of this web site.'), '#required' => TRUE
-  );
-  $form['general']['site_mail'] = array(
-    '#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => variable_get('site_mail', ini_get('sendmail_from')),
-    '#description' => t('A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc.')
-  );
-  $form['general']['site_slogan'] = array(
-    '#type' => 'textfield', '#title' => t('Slogan'), '#default_value' => variable_get('site_slogan', ''),
-    '#description' => t('The slogan of this website. Some themes display a slogan when available.')
-  );
-
-  $form['general']['site_mission'] = array(
-    '#type' => 'textarea', '#title' => t('Mission'), '#default_value' => variable_get('site_mission', ''),
-    '#description' => t('Your site\'s mission statement or focus.')
-  );
-  $form['general']['site_footer'] = array(
-    '#type' => 'textarea', '#title' => t('Footer message'), '#default_value' => variable_get('site_footer', ''),
-    '#description' => t('This text will be displayed at the bottom of each page.  Useful for adding a copyright notice to your pages.')
-  );
-  $form['general']['anonymous'] = array(
-    '#type' => 'textfield', '#title' => t('Anonymous user'), '#default_value' => variable_get('anonymous', 'Anonymous'),
-    '#description' => t('The name used to indicate anonymous users.')
-  );
-  $form['general']['site_frontpage'] = array(
-    '#type' => 'textfield', '#title' => t('Default front page'), '#default_value' => variable_get('site_frontpage', 'node'),
-    '#description' => t('The home page displays content from this relative URL.  If you are not using clean URLs, specify the part after "?q=".  If unsure, specify "node".')
-  );
-
-  // We check for clean URL support using an image on the client side.
-  $form['general']['clean_url'] = array(
-    '#type' => 'radios',
-    '#title' => t('Clean URLs'),
-    '#default_value' => variable_get('clean_url', 0),
-    '#options' => array(t('Disabled'), t('Enabled')),
-    '#description' => t('This option makes Drupal emit "clean" URLs (i.e. without <code>?q=</code> in the URL.)'),
-  );
-
-  if (!variable_get('clean_url', 0)) {
-    if (strpos(request_uri(), '?q=') !== FALSE) {
-      $form['general']['clean_url']['#description'] .= t(' Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The <a href="%handbook">handbook page on Clean URLs</a> has additional troubleshooting information. %run-test', array('%handbook' => 'http://drupal.org/node/15365', '%run-test' => '<a href ="'. base_path() . 'admin/settings">'. t('Run the clean URL test') .'</a>'));
-      $form['general']['clean_url']['#attributes'] = array('disabled' => 'disabled');
-    }
-    else {
-      $form['general']['clean_url']['#description'] .= t(' You have successfully demonstrated that clean URLs work on your server. You are welcome to enable/disable them as you wish.');
-      $form['general']['#collapsed'] = FALSE;
-    }
-  }
-
-  // Error handling:
-
-  $form['errors'] = array( '#type' => 'fieldset', '#title' =>t('Error handling'), '#collapsible' => TRUE, '#collapsed' => TRUE );
-  $form['errors']['site_403'] = array(
-    '#type' => 'textfield', '#title' => t('Default 403 (access denied) page'), '#default_value' => variable_get('site_403', ''),
-    '#description' => t('This page is displayed when the requested document is denied to the current user.  If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.')
-  );
-
-  $form['errors']['site_404'] = array(
-    '#type' => 'textfield', '#title' => t('Default 404 (not found) page'), '#default_value' =>  variable_get('site_404', ''),
-    '#description' => t('This page is displayed when no other content matches the requested document.  If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.')
-  );
-
-  $form['errors']['error_level'] = array(
-    '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get('error_level', 1),
-    '#options' => array(t('Write errors to the log'), t('Write errors to the log and to the screen')),
-    '#description' =>  t('Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.')
-  );
-
-  $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval');
-  $period['1000000000'] = t('Never');
-  $form['errors']['watchdog_clear'] = array(
-    '#type' => 'select', '#title' => t('Discard log entries older than'), '#default_value' => variable_get('watchdog_clear', 604800), '#options' => $period,
-    '#description' => t('The time log entries should be kept.  Older entries will be automatically discarded.  Requires crontab.')
-  );
-
-
-  // Caching:
-  $form['cache'] = array('#type' => 'fieldset', '#title' => t('Cache settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
-
-  $form['cache']['cache']  = array(
-    '#type' => 'radios',  '#title' => t('Page cache'), '#default_value' => variable_get('cache', CACHE_DISABLED),
-    '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_ENABLED => t('Enabled')),
-    '#description' => t("Drupal has a caching mechanism which stores dynamically generated web pages in a database.  By caching a web page, Drupal does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server's load.  Only pages requested by \"anonymous\" users are cached.  In order to reduce server load and save bandwidth, Drupal stores and sends compressed cached pages.")
-  );
-
-  $period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval');
-  $period[0] = t('none');
-  $form['cache']['cache_lifetime'] = array(
-    '#type' => 'select', '#title' => t('Minimum cache lifetime'), '#default_value' => variable_get('cache_lifetime', 0), '#options' => $period,
-    '#description' => t('Enabling the cache will offer a sufficient performance boost for most low-traffic and medium-traffic sites.  On high-traffic sites it can become necessary to enforce a minimum cache lifetime.  The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated.  A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.')
-  );
-
-
-  // File system:
-  $form['files'] = array('#type' => 'fieldset', '#title' => t('File system settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
-
-  $form['files']['file_directory_path'] = array(
-    '#type' => 'textfield',
-    '#title' => t('File system path'),
-    '#default_value' => file_directory_path(),
-    '#maxlength' => 255,
-    '#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.'),
-    '#after_build' => array('system_check_directory'),
-  );
-
-  $form['files']['file_directory_temp'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Temporary directory'),
-    '#default_value' => file_directory_temp(),
-    '#maxlength' => 255,
-    '#description' => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the Drupal installation directory.'),
-    '#after_build' => array('system_check_directory'),
-  );
-
-  $form['files']['file_downloads'] = array(
-    '#type' => 'radios', '#title' => t('Download method'), '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC),
-    '#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')),
-    '#description' => t('If you want any sort of access control on the downloading of files, this needs to be set to <em>private</em>. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.')
-  );
-
-  // Image handling:
-  $toolkits_available = image_get_available_toolkits();
-  if (count($toolkits_available) > 1) {
-    $form['image'] = array('#type' => 'fieldset', '#title' => t('Image handling'), '#collapsible' => TRUE, '#collapsed' => true);
-    $form['image']['image_toolkit'] = array(
-      '#type' => 'radios', '#title' => t('Select an image processing toolkit'),
-      '#default_value' => variable_get('image_toolkit', image_get_toolkit()), '#options' => $toolkits_available
-    );
-  }
-
-  // Feed settings
-  $form['feed'] = array('#type' => 'fieldset', '#title' => t('RSS feed settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
-  $form['feed']['feed_default_items'] = array(
-    '#type' => 'select', '#title' => t('Number of items per feed'), '#default_value' => variable_get('feed_default_items', 10),
-    '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
-    '#description' => t('The default number of items to include in a feed.')
-  );
-  $form['feed']['feed_item_length'] = array(
-    '#type' => 'select', '#title' => t('Display of XML feed items'), '#default_value' => variable_get('feed_item_length','teaser'),
-    '#options' => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')),
-    '#description' => t('Global setting for the length of XML feed items that are output by default.')
-  );
-
-  // Date settings:
-  $zones = _system_zonelist();
-
-  // Date settings: possible date formats
-  $dateshort = array('Y-m-d H:i','m/d/Y - H:i', 'd/m/Y - H:i', 'Y/m/d - H:i',
-           'd.m.Y - H:i', 'm/d/Y - g:ia', 'd/m/Y - g:ia', 'Y/m/d - g:ia',
-           'M j Y - H:i', 'j M Y - H:i', 'Y M j - H:i',
-           'M j Y - g:ia', 'j M Y - g:ia', 'Y M j - g:ia');
-  $datemedium = array('D, Y-m-d H:i', 'D, m/d/Y - H:i', 'D, d/m/Y - H:i',
-          'D, Y/m/d - H:i', 'F j, Y - H:i', 'j F, Y - H:i', 'Y, F j - H:i',
-          'D, m/d/Y - g:ia', 'D, d/m/Y - g:ia', 'D, Y/m/d - g:ia',
-          'F j, Y - g:ia', 'j F Y - g:ia', 'Y, F j - g:ia', 'j. F Y - G:i');
-  $datelong = array('l, F j, Y - H:i', 'l, j F, Y - H:i', 'l, Y,  F j - H:i',
-        'l, F j, Y - g:ia', 'l, j F Y - g:ia', 'l, Y,  F j - g:ia', 'l, j. F Y - G:i');
-
-  // Date settings: construct choices for user
-  foreach ($dateshort as $f) {
-    $dateshortchoices[$f] = format_date(time(), 'custom', $f);
-  }
-  foreach ($datemedium as $f) {
-    $datemediumchoices[$f] = format_date(time(), 'custom', $f);
-  }
-  foreach ($datelong as $f) {
-    $datelongchoices[$f] = format_date(time(), 'custom', $f);
-  }
-
-  $form['dates'] = array('#type' => 'fieldset', '#title' => t('Date settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
-  $form['dates']['date_default_timezone'] = array(
-    '#type' => 'select', '#title' => t('Default time zone'), '#default_value' => variable_get('date_default_timezone', 0),
-    '#options' => $zones, '#description' => t('Select the default site time zone.')
-  );
-
-  $form['dates']['configurable_timezones'] = array(
-    '#type' => 'radios', '#title' => t('Configurable time zones'), '#default_value' => variable_get('configurable_timezones', 1), '#options' => array(t('Disabled'), t('Enabled')),
-    '#description' => t('Enable or disable user-configurable time zones.  When enabled, users can set their own time zone and dates will be updated accordingly.')
-  );
-
-  $form['dates']['date_format_short'] = array(
-    '#type' => 'select', '#title' => t('Short date format'), '#default_value' => variable_get('date_format_short', $dateshort[0]),
-    '#options' => $dateshortchoices,  '#description' => t('The short format of date display.')
-  );
-
-  $form['dates']['date_format_medium'] = array(
-    '#type' => 'select', '#title' => t('Medium date format'), '#default_value' => variable_get('date_format_medium', $datemedium[0]),
-    '#options' => $datemediumchoices, '#description' => t('The medium sized date display.')
-  );
-
-  $form['dates']['date_format_long'] = array(
-    '#type' => 'select', '#title' => t('Long date format'), '#default_value' => variable_get('date_format_long', $datelong[0]),
-    '#options' => $datelongchoices, '#description' => t('Longer date format used for detailed display.')
-  );
-
-  $form['dates']['date_first_day'] = array(
-    '#type' => 'select', '#title' => t('First day of week'), '#default_value' => variable_get('date_first_day', 0),
-    '#options' => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')),
-    '#description' => t('The first day of the week for calendar views.')
-  );
-
-
-  // Site off-line/maintenance settings
-  $form['site_status'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Site maintenance'),
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE);
-
-  $form['site_status']['site_offline'] = array(
-    '#type' => 'radios',
-    '#title' => t('Site status'),
-    '#default_value' => variable_get('site_offline', 0),
-    '#options' => array(t('Online'), t('Off-line')),
-    '#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Off-line", only users with the "administer site configuration" permission will be able to access your site to perform maintenance; all other visitors will see the site off-line message configured below. Authorized users can log in during "Off-line" mode directly via the <a href="%user-login">user login</a> page.', array('%user-login' => url('user'))),
-  );
-
-  $form['site_status']['site_offline_message'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Site off-line message'),
-    '#default_value' => variable_get('site_offline_message', t('%site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('%site' => variable_get('site_name', t('This Drupal site'))))),
-    '#description' => t('Message to show visitors when the site is in off-line mode.')
-  );
-
-  // String handling: report status and errors.
-  $form['strings'] = array('#type' => 'fieldset', '#title' => t('String handling'), '#collapsible' => TRUE, '#collapsed' => TRUE);
-  $form['strings'] = array_merge($form['strings'], unicode_settings());
-
-  // Cron: report status and errors.
-  $form['cron'] = array('#type' => 'fieldset', '#title' => t('Cron jobs'), '#collapsible' => TRUE, '#collapsed' => TRUE);
-  $form['cron'] = array_merge($form['cron'], system_cron_settings());
-
-  // Check database setup if necessary
-  if (function_exists('db_check_setup') && empty($_POST)) {
-    db_check_setup();
-  }
-  return $form;
-}
-
-/**
- * Checks the existence of the directory specified in $form_element. This
- * function is called from the system_view_general form to check both the
- * file_directory_path and file_directory_temp directories. If validation
- * fails, the form element is flagged with an error from within the
- * file_check_directory function.
- *
- * @param $form_element
- *   The form element containing the name of the directory to check.
- */
-function system_check_directory($form_element) {
-  file_check_directory($form_element['#value'], FILE_CREATE_DIRECTORY, $form_element['#parents'][0]);
-  return $form_element;
-}
-
-/**
- * Return the cron status and errors for admin/settings.
- */
-function system_cron_settings() {
-  $cron_last = variable_get('cron_last', NULL);
-
-  if (is_numeric($cron_last)) {
-    $status = t('Cron is running. The last cron job ran %time ago.', array('%time' => format_interval(time() - $cron_last)));
-  }
-  else {
-    $status = t('Cron has not run. It appears cron jobs have not been setup on your system. Please check the help pages for <a href="%url">configuring cron jobs</a>.', array('%url' => 'http://drupal.org/cron'));
-  }
-
-  $form['settings'] = array('#type' => 'item', '#value' => $status);
-  return $form;
-}
-
-/**
- * Retrieves the current status of an array of files in the system table.
- */
-function system_get_files_database(&$files, $type) {
-  // Extract current files from database.
-  $result = db_query("SELECT filename, name, type, status, throttle, schema_version FROM {system} WHERE type = '%s'", $type);
-  while ($file = db_fetch_object($result)) {
-    if (isset($files[$file->name]) && is_object($files[$file->name])) {
-      $file->old_filename = $file->filename;
-      foreach ($file as $key => $value) {
-        if (!isset($files[$file->name]) || !isset($files[$file->name]->$key)) {
-          $files[$file->name]->$key = $value;
-        }
-      }
-    }
-  }
-}
-
-/**
- * Collect data about all currently available themes
- */
-function system_theme_data() {
-  // Find themes
-  $themes = system_listing('\.theme$', 'themes');
-
-  // Find theme engines
-  $engines = system_listing('\.engine$', 'themes/engines');
-
-  // can't iterate over array itself as it uses a copy of the array items
-  foreach (array_keys($themes) as $key) {
-    drupal_get_filename('theme', $themes[$key]->name, $themes[$key]->filename);
-    drupal_load('theme', $themes[$key]->name);
-    $themes[$key]->owner = $themes[$key]->filename;
-    $themes[$key]->prefix = $key;
-  }
-
-  // Remove all theme engines from the system table
-  db_query("DELETE FROM {system} WHERE type = 'theme_engine'");
-
-  foreach ($engines as $engine) {
-    // Insert theme engine into system table
-    drupal_get_filename('theme_engine', $engine->name, $engine->filename);
-    drupal_load('theme_engine', $engine->name);
-    db_query("INSERT INTO {system} (name, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', %d, %d, %d)", $engine->name, 'theme_engine', $engine->filename, 1, 0, 0);
-
-    // Add templates to the site listing
-    foreach (call_user_func($engine->name . '_templates') as $template) {
-      // Do not double-insert templates with theme files in their directory,
-      // but do register their engine data.
-      if (array_key_exists($template->name, $themes)) {
-        $themes[$template->name]->template = TRUE;
-        $themes[$template->name]->owner = $engine->filename;
-        $themes[$template->name]->prefix = $engine->name;
-      }
-      else {
-        $template->template = TRUE;
-        $template->name = basename(dirname($template->filename));
-        $template->owner = $engine->filename;
-        $template->prefix = $engine->name;
-
-        $themes[$template->name] = $template;
-      }
-    }
-  }
-
-  // Find styles in each theme's directory.
-  foreach ($themes as $theme) {
-    foreach (file_scan_directory(dirname($theme->filename), 'style.css$') as $style) {
-      $style->style = TRUE;
-      $style->template = isset($theme->template) ? $theme->template : FALSE;
-      $style->name = basename(dirname($style->filename));
-      $style->owner = $theme->filename;
-      $style->prefix = $theme->template ? $theme->prefix : $theme->name;
-      // do not double-insert styles with theme files in their directory
-      if (array_key_exists($style->name, $themes)) {
-        continue;
-      }
-      $themes[$style->name] = $style;
-    }
-  }
-
-  // Extract current files from database.
-  system_get_files_database($themes, 'theme');
-
-  db_query("DELETE FROM {system} WHERE type = 'theme'");
-
-  foreach ($themes as $theme) {
-    db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, 'theme', $theme->filename, $theme->status, 0, 0);
-  }
-
-  return $themes;
-}
-
-/**
- * Get a list of available regions from a specified theme.
- *
- * @param $theme_key
- *   The name of a theme.
- * @return
- *   An array of regions in the form $region['name'] = 'description'.
- */
-function system_region_list($theme_key) {
-  static $list = array();
-
-  if (!array_key_exists($theme_key, $list)) {
-    $theme = db_fetch_object(db_query("SELECT * FROM {system} WHERE type = 'theme' AND name = '%s'", $theme_key));
-
-    // Stylesheets can't have regions; use its theme.
-    if (strpos($theme->filename, '.css')) {
-      return system_region_list(basename(dirname($theme->description)));
-    }
-
-    // If this is a custom theme, load it in before moving on.
-    if (file_exists($file = dirname($theme->filename) .'/' . $theme_key . '.theme')) {
-      include_once "./$file";
-    }
-
-    $regions = array();
-
-    // This theme has defined its own regions.
-    if (function_exists($theme_key . '_regions')) {
-      $regions = call_user_func($theme_key . '_regions');
-    }
-    // File is an engine; include its regions.
-    else if (strpos($theme->description, '.engine')) {
-      include_once './' . $theme->description;
-      $theme_engine = basename($theme->description, '.engine');
-      $regions = function_exists($theme_engine . '_regions') ? call_user_func($theme_engine . '_regions') : array();
-    }
-
-    $list[$theme_key] = $regions;
-  }
-
-  return $list[$theme_key];
-}
-
-/**
- * Get the name of the default region for a given theme.
- *
- * @param $theme
- *   The name of a theme.
- * @return
- *   A string that is the region name.
- */
-function system_default_region($theme) {
-  $regions = array_keys(system_region_list($theme));
-  return $regions[0];
-}
-
-/**
- * Returns an array of files objects of the given type from both the
- * site-wide directory (i.e. modules/) and site-specific directory
- * (i.e. sites/somesite/modules/).  The returned array will be keyed
- * using the key specified (name, basename, filename).  Using name or
- * basename will cause site-specific files to shadow files in the
- * default directories.  That is, if a file with the same name appears
- * in both location, only the site-specific version will be included.
- *
- * @param $mask
- *   The regular expression of the files to find.
- * @param $directory
- *   The subdirectory name in which the files are found.  For example,
- *   'modules' will search in both modules/ and
- *   sites/somesite/modules/.
- * @param $key
- *   The key to be passed to file_scan_directory().
- * @param $min_depth
- *   Minimum depth of directories to return files from.
- *
- * @return
- *   An array of file objects of the specified type.
- */
-function system_listing($mask, $directory, $key = 'name', $min_depth = 1) {
-  $config = conf_path();
-  $searchdir = array($directory);
-  $files = array();
-
-  if (file_exists("$config/$directory")) {
-    $searchdir[] = "$config/$directory";
-  }
-
-  // Get current list of items
-  foreach ($searchdir as $dir) {
-    $files = array_merge($files, file_scan_directory($dir, $mask, array('.', '..', 'CVS'), 0, TRUE, $key, $min_depth));
-  }
-
-  return $files;
-}
-
-/**
- * Assign an initial, default set of blocks for a theme.
- *
- * This function is called the first time a new theme is enabled.  The new theme
- * gets a copy of the default theme's blocks, with the difference that if a
- * particular region isn't available in the new theme, the block is assigned
- * to the new theme's default region.
- *
- * @param $theme
- *   The name of a theme.
- */
-function system_initialize_theme_blocks($theme) {
-  // Initialize theme's blocks if none already registered.
-  if (!(db_num_rows(db_query("SELECT module FROM {blocks} WHERE theme = '%s'", $theme)))) {
-    $default_theme = variable_get('theme_default', 'bluemarine');
-    $regions = system_region_list($theme);
-    $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s'", $default_theme);
-    while($block = db_fetch_array($result)) {
-      // If the region isn't supported by the theme, assign the block to the theme's default region.
-      if (!array_key_exists($block['region'], $regions)) {
-        $block['region'] = system_default_region($theme);
-      }
-      db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, visibility, pages, custom, throttle) VALUES ('%s', '%s', '%s', %d, %d, '%s', %d, '%s', %d, %d)",
-          $block['module'], $block['delta'], $theme, $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle']);
-    }
-  }
-}
-
-// Add the submit / reset buttons and run drupal_get_form()
-function system_settings_form($form_id, $form) {
-  $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
-  $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') );
-
-  if (!empty($_POST) && form_get_errors()) {
-    drupal_set_message(t('The settings have not been saved because of the errors.'), 'error');
-  }
-
-  return drupal_get_form($form_id, $form, 'system_settings_form');
-}
-
-function system_theme_settings_submit($form_id, $values) {
-  $op = isset($_POST['op']) ? $_POST['op'] : '';
-  $key = $values['var'];
-
-  // Exclude unnecessary elements.
-  unset($values['var'], $values['submit'], $values['reset'], $values['form_id']);
-
-  if ($op == t('Reset to defaults')) {
-    variable_del($key);
-    drupal_set_message(t('The configuration options have been reset to their default values.'));
-  }
-  else {
-    variable_set($key, $values);
-    drupal_set_message(t('The configuration options have been saved.'));
-  }
-}
-
-/**
- * Execute the system_settings_form.
- *
- * If you want node type configure style handling of your checkboxes,
- * add an array_filter value to your form.
- *
- */
-function system_settings_form_submit($form_id, $values) {
-  $op = isset($_POST['op']) ? $_POST['op'] : '';
-
-  // Exclude unnecessary elements.
-  unset($values['submit'], $values['reset'], $values['form_id']);
-
-  foreach ($values as $key => $value) {
-    if ($op == t('Reset to defaults')) {
-      variable_del($key);
-    }
-    else {
-      if (is_array($value) && isset($values['array_filter'])) {
-        $value = array_keys(array_filter($value));
-      }
-      variable_set($key, $value);
-    }
-  }
-  if ($op == t('Reset to defaults')) {
-    drupal_set_message(t('The configuration options have been reset to their default values.'));
-  }
-  else {
-    drupal_set_message(t('The configuration options have been saved.'));
-  }
-  menu_rebuild();
-}
-
-/**
- * Menu callback; displays a listing of all themes.
- */
-function system_themes() {
-  $themes = system_theme_data();
-  ksort($themes);
-
-  foreach ($themes as $info) {
-    $info->screenshot = dirname($info->filename) . '/screenshot.png';
-    $screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), false) : t('no screenshot');
-
-    $form[$info->name]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot);
-    $form[$info->name]['description'] = array('#type' => 'item', '#title' => $info->name,  '#value' => dirname($info->filename));
-    $options[$info->name] = '';
-    if ($info->status) {
-      $status[] = $info->name;
-    }
-    if ($info->status && (function_exists($info->prefix . '_settings') || function_exists($info->prefix . '_features'))) {
-      $form[$info->name]['operations'] = array('#type' => 'markup', '#value' => l(t('configure'), 'admin/themes/settings/' . $info->name) );
-    }
-    else {
-      // Dummy element for form_render. Cleaner than adding a check in the theme function.
-      $form[$info->name]['operations'] = array();
-    }
-  }
-
-  $form['status'] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $status);
-  $form['theme_default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('theme_default', 'bluemarine'));
-  $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
-  $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') );
-
-  return drupal_get_form('system_themes', $form);
-}
-
-function theme_system_themes($form) {
-  foreach (element_children($form) as $key) {
-    $row = array();
-    if (is_array($form[$key]['description'])) {
-      $row[] = form_render($form[$key]['screenshot']);
-      $row[] = form_render($form[$key]['description']);
-      $row[] = array('data' => form_render($form['status'][$key]), 'align' => 'center');
-      if ($form['theme_default']) {
-        $row[] = array('data' => form_render($form['theme_default'][$key]), 'align' => 'center');
-        $row[] = array('data' => form_render($form[$key]['operations']), 'align' => 'center');
-      }
-    }
-    $rows[] = $row;
-  }
-
-  $header = array(t('Screenshot'), t('Name'), t('Enabled'), t('Default'), t('Operations'));
-  $output = theme('table', $header, $rows);
-  $output .= form_render($form);
-  return $output;
-}
-
-
-function system_themes_submit($form_id, $values) {
-
-  db_query("UPDATE {system} SET status = 0 WHERE type = 'theme'");
-
-  if ($_POST['op'] == t('Save configuration')) {
-    if (is_array($values['status'])) {
-      foreach ($values['status'] as $key => $choice) {
-        // Always enable the default theme, despite its status checkbox being checked:
-        if ($choice || $values['theme_default'] == $key) {
-          // If theme status is being set to 1 from 0, initialize block data for this theme if necessary.
-          if (db_num_rows(db_query("SELECT status FROM {system} WHERE type = 'theme' AND name = '%s' AND status = 0", $key))) {
-            system_initialize_theme_blocks($key);
-          }
-          db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' and name = '%s'", $key);
-        }
-      }
-    }
-    variable_set('theme_default', $values['theme_default']);
-  }
-  else {
-    variable_del('theme_default');
-    db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' AND name = 'bluemarine'");
-  }
-
-  menu_rebuild();
-  drupal_set_message(t('The configuration options have been saved.'));
-  return 'admin/themes';
-}
-
-/**
- * Menu callback; displays a listing of all modules.
- */
-function system_modules() {
-  // Get current list of modules
-  $files = system_listing('\.module$', 'modules', 'name', 0);
-
-  // Extract current files from database.
-  system_get_files_database($files, 'module');
-
-  ksort($files);
-
-  foreach ($files as $filename => $file) {
-    drupal_get_filename('module', $file->name, $file->filename);
-    drupal_load('module', $file->name);
-
-    $file->description = module_invoke($file->name, 'help', 'admin/modules#description');
-
-    $form['name'][$file->name] = array('#value' => $file->name);
-    $form['description'][$file->name] = array('#value' => $file->description);
-    $options[$file->name] = '';
-    if ($file->status) {
-      $status[] = $file->name;
-    }
-    if ($file->throttle) {
-      $throttle[] = $file->name;
-    }
-
-    // log the critical hooks implemented by this module
-    $bootstrap = 0;
-    foreach (bootstrap_hooks() as $hook) {
-      if (module_hook($file->name, $hook)) {
-        $bootstrap = 1;
-        break;
-      }
-    }
-
-    // Update the contents of the system table:
-    if (isset($file->status) || (isset($file->old_filename) && $file->old_filename != $file->filename)) {
-      db_query("UPDATE {system} SET description = '%s', name = '%s', bootstrap = %d, filename = '%s' WHERE filename = '%s'", $file->description, $file->name, $bootstrap, $file->filename, $file->old_filename);
-    }
-    else {
-      // This is a new module.
-      db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap);
-    }
-  }
-
-
-  // Handle status checkboxes, including overriding the generated
-  // checkboxes for required modules.
-  $form['status'] = array('#type' => 'checkboxes', '#default_value' => $status, '#options' => $options);
-  $required = array('block', 'filter', 'node', 'system', 'user', 'watchdog');
-  foreach ($required as $require) {
-    $form['status'][$require] = array('#type' => 'hidden', '#value' => 1, '#suffix' => t('required'));
-  }
-
-  /**
-   * Handle throttle checkboxes, including overriding the generated checkboxes for required modules.
-   */
-  if (module_exist('throttle')) {
-    $form['throttle'] = array('#type' => 'checkboxes', '#default_value' => $throttle, '#options' => $options);
-    $throttle_required = array_merge($required, array('throttle'));
-    foreach ($throttle_required as $require) {
-      $form['throttle'][$require] = array('#type' => 'hidden', '#value' => 0, '#suffix' => t('required'));
-    }
-  }
-
-  $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
-
-  return drupal_get_form('system_modules', $form);
-}
-
-function theme_system_modules($form) {
-  foreach (element_children($form['name']) as $key) {
-    $row = array();
-    $row[] = form_render($form['name'][$key]);
-    $row[] = form_render($form['description'][$key]);
-    $row[] = array('data' => form_render($form['status'][$key]), 'align' => 'center');
-
-    if (module_exist('throttle')) {
-      $row[] = array('data' => form_render($form['throttle'][$key]), 'align' => 'center');
-    }
-    $rows[] = $row;
-  }
-
-  $header = array(t('Name'), t('Description'), t('Enabled'));
-  if (module_exist('throttle')) {
-    $header[] = t('Throttle');
-  }
-
-  $output = theme('table', $header, $rows);
-  $output .= form_render($form);
-  return $output;
-}
-
-
-function system_modules_submit($form_id, $edit) {
-  db_query("UPDATE {system} SET status = 0, throttle = 0 WHERE type = 'module'");
-
-  $new_modules = array();
-  foreach ($edit['status'] as $key => $choice) {
-    if ($choice) {
-      db_query("UPDATE {system} SET status = 1 WHERE type = 'module' AND name = '%s'", $key);
-      if (!module_exist($key)) {
-        $new_modules[] = $key;
-      }
-    }
-  }
-
-  if (is_array($edit['throttle'])) {
-    foreach ($edit['throttle'] as $key => $choice) {
-      if ($choice) {
-        db_query("UPDATE {system} SET throttle = 1 WHERE type = 'module' and name = '%s'", $key);
-      }
-    }
-  }
-
-  module_list(TRUE, FALSE);
-
-  include './includes/install.inc';
-  foreach ($new_modules as $module) {
-    // Set the installed schema version for newly-enabled modules
-    $versions = drupal_get_schema_versions($module);
-    if (drupal_get_installed_schema_version($module) == SCHEMA_UNINSTALLED) {
-      drupal_set_installed_schema_version($module, $versions ? max($versions) : SCHEMA_INSTALLED);
-      module_invoke($module, 'install');
-    }
-  }
-
-  menu_rebuild();
-
-  drupal_set_message(t('The configuration options have been saved.'));
-  return 'admin/modules';
-}
-
-
-/**
- * Menu callback; displays a module's settings page.
- */
-function system_site_settings($module = NULL) {
-
-  if ($module) {
-    $form = module_invoke($module, 'settings');
-  }
-  else {
-    $form = system_view_general();
-    $module = 'system';
-  }
-
-  return system_settings_form($module . '_settings_form', $form);
-}
-
-/**
- * Menu callback; display theme configuration for entire site and individual themes.
- */
-function system_theme_settings($key = '') {
-  $directory_path = file_directory_path();
-  file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
-
-  // Default settings are defined in theme_get_settings() in includes/theme.inc
-  if ($key) {
-    $settings = theme_get_settings($key);
-    $var = str_replace('/', '_', 'theme_'. $key .'_settings');
-    $themes = system_theme_data();
-    $features = function_exists($themes[$key]->prefix . '_features') ? call_user_func($themes[$key]->prefix . '_features') : array();
-  }
-  else {
-    $settings = theme_get_settings('');
-    $var = 'theme_settings';
-  }
-
-  $form['var'] = array('#type' => 'hidden', '#value' => $var);
-
-  // Check for a new uploaded logo, and use that instead.
-  if ($file = file_check_upload('logo_upload')) {
-    if ($info = image_get_info($file->filepath)) {
-      $parts = pathinfo($file->filename);
-      $filename = ($key) ? str_replace('/', '_', $key) . '_logo.' . $parts['extension'] : 'logo.' . $parts['extension'];
-
-      if ($file = file_save_upload('logo_upload', $filename, 1)) {
-        $_POST['edit']['default_logo'] = 0;
-        $_POST['edit']['logo_path'] = $file->filepath;
-        $_POST['edit']['toggle_logo'] = 1;
-      }
-    }
-    else {
-      form_set_error('file_upload', t('Only JPEG, PNG and GIF images are allowed to be used as logos.'));
-    }
-  }
-
-  // Check for a new uploaded favicon, and use that instead.
-  if ($file = file_check_upload('favicon_upload')) {
-    $parts = pathinfo($file->filename);
-    $filename = ($key) ? str_replace('/', '_', $key) . '_favicon.' . $parts['extension'] : 'favicon.' . $parts['extension'];
-
-    if ($file = file_save_upload('favicon_upload', $filename, 1)) {
-      $_POST['edit']['default_favicon'] = 0;
-      $_POST['edit']['favicon_path'] = $file->filepath;
-      $_POST['edit']['toggle_favicon'] = 1;
-    }
-  }
-
-  // Toggle settings
-  $toggles = array(
-    'toggle_logo'                 => t('Logo'),
-    'toggle_name'                 => t('Site name'),
-    'toggle_slogan'               => t('Site slogan'),
-    'toggle_mission'              => t('Mission statement'),
-    'toggle_node_user_picture'    => t('User pictures in posts'),
-    'toggle_comment_user_picture' => t('User pictures in comments'),
-    'toggle_search'               => t('Search box'),
-    'toggle_favicon'              => t('Shortcut icon')
-  );
-
-  // Some features are not always available
-  $disabled = array();
-  if (!variable_get('user_pictures', 0)) {
-    $disabled['toggle_node_user_picture'] = true;
-    $disabled['toggle_comment_user_picture'] = true;
-  }
-  if (!module_exist('search')) {
-    $disabled['toggle_search'] = true;
-  }
-
-  $form['theme_settings'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Toggle display'),
-    '#description' => t('Enable or disable the display of certain page elements.'),
-  );
-  foreach ($toggles as $name => $title) {
-    if ((!$key) || in_array($name, $features)) {
-      // disable search box if search.module is disabled
-      $form['theme_settings'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name]);
-      if (isset($disabled[$name])) {
-        $form['theme_settings'][$name]['#attributes'] = array('disabled' => 'disabled');
-      }
-    }
-  }
-
-  // System wide only settings.
-  if (!$key) {
-    // Create neat 2-column layout for the toggles
-    $form['theme_settings'] += array(
-      '#prefix' => '<div class="theme-settings-left">',
-      '#suffix' => '</div>',
-    );
-
-    // Toggle node display.
-    $node_types = module_invoke('node', 'get_types');
-    if ($node_types) {
-      $form['node_info'] = array(
-        '#type' => 'fieldset',
-        '#title' => t('Display post information on'),
-        '#description' =>  t('Enable or disable the <em>submitted by Username on date</em> text when displaying posts of the following type.'),
-        '#prefix' => '<div class="theme-settings-right">',
-        '#suffix' => '</div>',
-      );
-      foreach ($node_types as $type => $name) {
-        $form['node_info']["toggle_node_info_$type"] = array('#type' => 'checkbox', '#title' => $name, '#default_value' => $settings["toggle_node_info_$type"]);
-      }
-    }
-  }
-
-  // Logo settings
-  if ((!$key) || in_array('toggle_logo', $features)) {
-    $form['logo'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Logo image settings'),
-      '#description' => t('If toggled on, the following logo will be displayed.'),
-      '#attributes' => array('class' => 'theme-settings-bottom'),
-    );
-    $form['logo']["default_logo"] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Use the default logo'),
-      '#default_value' => $settings['default_logo'],
-      '#tree' => FALSE,
-      '#description' => t('Check here if you want the theme to use the logo supplied with it.')
-    );
-    $form['logo']['logo_path'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Path to custom logo'),
-      '#default_value' => $settings['logo_path'],
-      '#description' => t('The path to the file you would like to use as your logo file instead of the default logo.'));
-
-    $form['logo']['logo_upload'] = array(
-      '#type' => 'file',
-      '#title' => t('Upload logo image'),
-      '#maxlength' => 40,
-      '#description' => t("If you don't have direct file access to the server, use this field to upload your logo.")
-    );
-  }
-
-  // Icon settings
-  if ((!$key) || in_array('toggle_favicon', $features)) {
-    $form['favicon'] = array('#type' => 'fieldset', '#title' => t('Shortcut icon settings'));
-    $form['favicon']['text'] = array('#value' => t('Your shortcut icon or \'favicon\' is displayed in the address bar and bookmarks of most browsers.'));
-    $form['favicon']['default_favicon'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Use the default shortcut icon.'),
-      '#default_value' => $settings['default_favicon'],
-      '#description' => t('Check here if you want the theme to use the default shortcut icon.')
-    );
-    $form['favicon']['favicon_path'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Path to custom icon'),
-      '#default_value' =>  $settings['favicon_path'],
-      '#description' => t('The path to the image file you would like to use as your custom shortcut icon.')
-    );
-
-    $form['favicon']['favicon_upload'] = array(
-      '#type' => 'file',
-      '#title' => t('Upload icon image'),
-      '#description' => t("If you don't have direct file access to the server, use this field to upload your shortcut icon.")
-    );
-  }
-
-  if ($key) {
-    // Template-specific settings
-    $function = $themes[$key]->prefix .'_settings';
-    if (function_exists($function)) {
-      if ($themes[$key]->template) {
-        // file is a template or a style of a template
-        $form['specific'] = array('#type' => 'fieldset', '#title' => t('Engine-specific settings'), '#description' => t('These settings only exist for all the templates and styles based on the %engine theme engine.', array('%engine' => $themes[$key]->prefix)));
-      }
-      else {
-        // file is a theme or a style of a theme
-        $form['specific'] = array('#type' => 'fieldset', '#title' => t('Theme-specific settings'), '#description' => t('These settings only exist for the %theme theme and all the styles based on it.', array('%theme' => $themes[$key]->prefix)));
-      }
-      $group = $function();
-      $form['specific'] = array_merge($form['specific'], (is_array($group) ? $group : array()));
-    }
-  }
-  $form['#attributes'] = array('enctype' => 'multipart/form-data');
-
-  return system_settings_form('system_theme_settings', $form);
-
-}
-
-/**
- * Output a confirmation form
- *
- * This function outputs a complete form for confirming an action. A link is
- * offered to go back to the item that is being changed in case the user changes
- * his/her mind.
- *
- * You should use $GLOBALS['values']['edit'][$name] (where $name is usually 'confirm') to
- * check if the confirmation was successful.
- *
- * @param $form_id
- *   The unique form identifier. Used by the form API to construct the theme.
- * @param $form
- *   Additional elements to inject into the form, for example hidden elements.
- * @param $question
- *   The question to ask the user (e.g. "Are you sure you want to delete the
- *   block <em>foo</em>?").
- * @param $path
- *   The page to go to if the user denies the action.
- * @param $description
- *   Additional text to display (defaults to "This action cannot be undone.").
- * @param $yes
- *   A caption for the button which confirms the action (e.g. "Delete",
- *   "Replace", ...).
- * @param $no
- *   A caption for the link which denies the action (e.g. "Cancel").
- * @param $name
- *   The internal name used to refer to the confirmation item.
- * @return
- *   A themed HTML string representing the form.
- */
-
-function confirm_form($form_id, $form, $question, $path, $description = NULL, $yes = NULL, $no = NULL, $name = 'confirm') {
-
-  $description = ($description) ? $description : t('This action cannot be undone.');
-  drupal_set_title($question);
-  $form['#attributes'] = array('class' => 'confirmation');
-  $form['description'] = array('#value' => $description);
-  $form[$name] = array('#type' => 'hidden', '#value' => 1);
-
-  $form['actions'] = array('#prefix' => '<div class="container-inline">', '#suffix' => '</div>');
-  $form['actions']['submit'] = array('#type' => 'submit', '#value' => $yes ? $yes : t('Confirm'));
-  $form['actions']['cancel'] = array('#value' => l($no ? $no : t('Cancel'), $path));
-  return drupal_get_form($form_id, $form, 'confirm_form');
-}
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
deleted file mode 100644 (file)
index 1bb18d5..0000000
+++ /dev/null
@@ -1,1365 +0,0 @@
-<?php
-// $Id: taxonomy.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables the organization of content into categories.
- */
-
-/**
- * Implementation of hook_perm().
- */
-function taxonomy_perm() {
-  return array('administer taxonomy');
-}
-
-/**
- * Implementation of hook_link().
- *
- * This hook is extended with $type = 'taxonomy terms' to allow themes to
- * print lists of terms associated with a node. Themes can print taxonomy
- * links with:
- *
- * if (module_exist('taxonomy')) {
- *   $this->links(taxonomy_link('taxonomy terms', $node));
- * }
- */
-function taxonomy_link($type, $node = NULL) {
-  if ($type == 'taxonomy terms' && $node != NULL) {
-    $links = array();
-    if (array_key_exists('taxonomy', $node)) {
-      foreach ($node->taxonomy as $term) {
-        $links[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description)));
-      }
-    }
-    return $links;
-  }
-}
-
-function taxonomy_term_path($term) {
-  $vocabulary = taxonomy_get_vocabulary($term->vid);
-  if ($vocabulary->module != 'taxonomy' && $path = module_invoke($vocabulary->module, 'term_path', $term)) {
-    return $path;
-  }
-  return 'taxonomy/term/'. $term->tid;
-}
-
-/**
- * Implementation of hook_menu().
- */
-function taxonomy_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/taxonomy',
-      'title' => t('categories'),
-      'callback' => 'taxonomy_overview_vocabularies',
-      'access' => user_access('administer taxonomy'));
-
-    $items[] = array('path' => 'admin/taxonomy/list',
-      'title' => t('list'),
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-      'weight' => -10);
-
-    $items[] = array('path' => 'admin/taxonomy/add/vocabulary',
-      'title' => t('add vocabulary'),
-      'callback' => 'taxonomy_admin_vocabulary_edit',
-      'access' => user_access('administer taxonomy'),
-      'type' => MENU_LOCAL_TASK);
-
-    $items[] = array('path' => 'admin/taxonomy/edit/vocabulary',
-      'title' => t('edit vocabulary'),
-      'callback' => 'taxonomy_admin_vocabulary_edit',
-      'access' => user_access('administer taxonomy'),
-      'type' => MENU_CALLBACK);
-
-    $items[] = array('path' => 'admin/taxonomy/edit/term',
-      'title' => t('edit term'),
-      'callback' => 'taxonomy_admin_term_edit',
-      'access' => user_access('administer taxonomy'),
-      'type' => MENU_CALLBACK);
-
-    $items[] = array('path' => 'taxonomy/term',
-      'title' => t('taxonomy term'),
-      'callback' => 'taxonomy_term_page',
-      'access' => user_access('access content'),
-      'type' => MENU_CALLBACK);
-
-    $items[] = array('path' => 'taxonomy/autocomplete',
-      'title' => t('autocomplete taxonomy'),
-      'callback' => 'taxonomy_autocomplete',
-      'access' => user_access('access content'),
-      'type' => MENU_CALLBACK);
-  }
-  else {
-    if (is_numeric(arg(2))) {
-      $items[] = array('path' => 'admin/taxonomy/' . arg(2),
-        'title' => t('list terms'),
-        'callback' => 'taxonomy_overview_terms',
-        'callback arguments' => array(arg(2)),
-        'access' => user_access('administer taxonomy'),
-        'type' => MENU_CALLBACK);
-
-      $items[] = array('path' => 'admin/taxonomy/' . arg(2) . '/list',
-        'title' => t('list'),
-        'type' => MENU_DEFAULT_LOCAL_TASK,
-        'weight' => -10);
-
-      $items[] = array('path' => 'admin/taxonomy/' . arg(2) . '/add/term',
-        'title' => t('add term'),
-        'callback' => 'taxonomy_form_term',
-        'callback arguments' => array(array('vid' => arg(2))),
-        'access' => user_access('administer taxonomy'),
-        'type' => MENU_LOCAL_TASK);
-    }
-  }
-
-  return $items;
-}
-
-/**
- * List and manage vocabularies.
- */
-function taxonomy_overview_vocabularies() {
-  $vocabularies = taxonomy_get_vocabularies();
-  $rows = array();
-  foreach ($vocabularies as $vocabulary) {
-    $types = array();
-    foreach ($vocabulary->nodes as $type) {
-      $node_type = node_get_name($type);
-      $types[] = $node_type ? $node_type : $type;
-    }
-    $rows[] = array('name' => check_plain($vocabulary->name),
-      'type' => implode(', ', $types),
-      'edit' => l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"),
-      'list' => l(t('list terms'), "admin/taxonomy/$vocabulary->vid"),
-      'add' => l(t('add terms'), "admin/taxonomy/$vocabulary->vid/add/term")
-    );
-  }
-  if (empty($rows)) {
-    $rows[] = array(array('data' => t('No categories available.'), 'colspan' => '5', 'class' => 'message'));
-  }
-  $header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '3'));
-
-  return theme('table', $header, $rows, array('id' => 'taxonomy'));
-}
-
-/**
- * Display a tree of all the terms in a vocabulary, with options to edit
- * each one.
- */
-function taxonomy_overview_terms($vid) {
-  $destination = drupal_get_destination();
-
-  $header = array(t('Name'), t('Operations'));
-  $vocabulary = taxonomy_get_vocabulary($vid);
-
-  drupal_set_title(check_plain($vocabulary->name));
-  $start_from      = $_GET['page'] ? $_GET['page'] : 0;
-  $total_entries   = 0;  // total count for pager
-  $page_increment  = 25; // number of tids per page
-  $displayed_count = 0;  // number of tids shown
-
-  $tree = taxonomy_get_tree($vocabulary->vid);
-  foreach ($tree as $term) {
-    $total_entries++; // we're counting all-totals, not displayed
-    if (($start_from && ($start_from * $page_increment) >= $total_entries) || ($displayed_count == $page_increment)) { continue; }
-    $rows[] = array(_taxonomy_depth($term->depth) . ' ' . l($term->name, "taxonomy/term/$term->tid"), l(t('edit'), "admin/taxonomy/edit/term/$term->tid", array(), $destination));
-    $displayed_count++; // we're counting tids displayed
-  }
-
-  if (!$rows) {
-    $rows[] = array(array('data' => t('No terms available.'), 'colspan' => '2'));
-  }
-
-  $GLOBALS['pager_page_array'][] = $start_from;  // FIXME
-  $GLOBALS['pager_total'][] = intval($total_entries / $page_increment) + 1; // FIXME
-
-  if ($total_entries >= $page_increment) {
-    $rows[] = array(array('data' => theme('pager', NULL, $page_increment), 'colspan' => '2'));
-  }
-
-  return theme('table', $header, $rows, array('id' => 'taxonomy'));
-}
-
-/**
- * Display form for adding and editing vocabularies.
- */
-function taxonomy_form_vocabulary($edit = array()) {
-  $form['name'] = array('#type' => 'textfield',
-    '#title' => t('Vocabulary name'),
-    '#default_value' => $edit['name'],
-    '#maxlength' => 64,
-    '#description' => t('The name for this vocabulary.  Example: "Topic".'),
-    '#required' => TRUE,
-  );
-  $form['description'] = array('#type' => 'textarea',
-    '#title' => t('Description'),
-    '#default_value' => $edit['description'],
-    '#description' => t('Description of the vocabulary; can be used by modules.'),
-  );
-  $form['help'] = array('#type' => 'textfield',
-    '#title' => t('Help text'),
-    '#default_value' => $edit['help'],
-    '#description' => t('Instructions to present to the user when choosing a term.'),
-  );
-  $form['nodes'] = array('#type' => 'checkboxes',
-    '#title' => t('Types'),
-    '#default_value' => $edit['nodes'],
-    '#options' => node_get_types(),
-    '#description' => t('A list of node types you want to associate with this vocabulary.'),
-    '#required' => TRUE,
-  );
-  $form['hierarchy'] = array('#type' => 'radios',
-    '#title' => t('Hierarchy'),
-    '#default_value' => $edit['hierarchy'],
-    '#options' => array(t('Disabled'), t('Single'), t('Multiple')),
-    '#description' => t('Allows <a href="%help-url">a tree-like hierarchy</a> between terms of this vocabulary.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'hierarchy'))),
-  );
-  $form['relations'] = array('#type' => 'checkbox',
-    '#title' => t('Related terms'),
-    '#default_value' => $edit['relations'],
-    '#description' => t('Allows <a href="%help-url">related terms</a> in this vocabulary.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'related-terms'))),
-  );
-  $form['tags'] = array('#type' => 'checkbox',
-    '#title' => t('Free tagging'),
-    '#default_value' => $edit['tags'],
-    '#description' => t('Content is categorized by typing terms instead of choosing from a list.'),
-  );
-  $form['multiple'] = array('#type' => 'checkbox',
-    '#title' => t('Multiple select'),
-    '#default_value' => $edit['multiple'],
-    '#description' => t('Allows nodes to have more than one term from this vocabulary (always true for free tagging).'),
-  );
-  $form['required'] = array('#type' => 'checkbox',
-    '#title' => t('Required'),
-    '#default_value' => $edit['required'],
-    '#description' => t('If enabled, every node <strong>must</strong> have at least one term in this vocabulary.'),
-  );
-  $form['weight'] = array('#type' => 'weight',
-    '#title' => t('Weight'),
-    '#default_value' => $edit['weight'],
-    '#description' => t('In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.'),
-  );
-
-  // Add extra vocabulary form elements.
-  $extra = module_invoke_all('taxonomy', 'form', 'vocabulary');
-  if (is_array($extra)) {
-    foreach ($extra as $key => $element) {
-      $extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $extra[$key]['#weight'] : -18;
-    }
-    $form = array_merge($form, $extra);
-  }
-
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
-  if ($edit['vid']) {
-    $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
-    $form['vid'] = array('#type' => 'value', '#value' => $edit['vid']);
-    $form['module'] = array('#type' => 'value', '#value' => $edit['module']);
-  }
-  return drupal_get_form('taxonomy_form_vocabulary', $form);
-}
-
-/**
- * Accept the form submission for a vocabulary and save the results.
- */
-function taxonomy_form_vocabulary_submit($form_id, $form_values) {
-  // Fix up the nodes array to remove unchecked nodes.
-  $form_values['nodes'] = array_filter($form_values['nodes']);
-  switch (taxonomy_save_vocabulary($form_values)) {
-  case SAVED_NEW:
-    drupal_set_message(t('Created new vocabulary %name.', array('%name' => theme('placeholder', $form_values['name']))));
-    break;
-  case SAVED_UPDATED:
-    drupal_set_message(t('Updated vocabulary %name.', array('%name' => theme('placeholder', $form_values['name']))));
-    break;
-  }
-  return 'admin/taxonomy';
-}
-
-function taxonomy_save_vocabulary(&$edit) {
-  $edit['nodes'] = empty($edit['nodes']) ? array() : $edit['nodes'];
-
-  if ($edit['vid'] && $edit['name']) {
-    db_query("UPDATE {vocabulary} SET name = '%s', description = '%s', help = '%s', multiple = %d, required = %d, hierarchy = %d, relations = %d, tags = %d, weight = %d, module = '%s' WHERE vid = %d", $edit['name'], $edit['description'], $edit['help'], $edit['multiple'], $edit['required'], $edit['hierarchy'], $edit['relations'], $edit['tags'], $edit['weight'], isset($edit['module']) ? $edit['module'] : 'taxonomy', $edit['vid']);
-    db_query("DELETE FROM {vocabulary_node_types} WHERE vid = %d", $edit['vid']);
-    foreach ($edit['nodes'] as $type => $selected) {
-      db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $edit['vid'], $type);
-    }
-    module_invoke_all('taxonomy', 'update', 'vocabulary', $edit);
-    $status = SAVED_UPDATED;
-  }
-  else if ($edit['vid']) {
-    $status = taxonomy_del_vocabulary($edit['vid']);
-  }
-  else {
-    $edit['vid'] = db_next_id('{vocabulary}_vid');
-    db_query("INSERT INTO {vocabulary} (vid, name, description, help, multiple, required, hierarchy, relations, tags, weight, module) VALUES (%d, '%s', '%s', '%s', %d, %d, %d, %d, %d, %d, '%s')", $edit['vid'], $edit['name'], $edit['description'], $edit['help'], $edit['multiple'], $edit['required'], $edit['hierarchy'], $edit['relations'], $edit['tags'], $edit['weight'], isset($edit['module']) ? $edit['module'] : 'taxonomy');
-    foreach ($edit['nodes'] as $type => $selected) {
-      db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $edit['vid'], $type);
-    }
-    module_invoke_all('taxonomy', 'insert', 'vocabulary', $edit);
-    $status = SAVED_NEW;
-  }
-
-  cache_clear_all();
-
-  return $status;
-}
-
-function taxonomy_del_vocabulary($vid) {
-  $vocabulary = (array) taxonomy_get_vocabulary($vid);
-
-  db_query('DELETE FROM {vocabulary} WHERE vid = %d', $vid);
-  db_query('DELETE FROM {vocabulary_node_types} WHERE vid = %d', $vid);
-  $result = db_query('SELECT tid FROM {term_data} WHERE vid = %d', $vid);
-  while ($term = db_fetch_object($result)) {
-    taxonomy_del_term($term->tid);
-  }
-
-  module_invoke_all('taxonomy', 'delete', 'vocabulary', $vocabulary);
-
-  cache_clear_all();
-
-  return SAVED_DELETED;
-}
-
-function _taxonomy_confirm_del_vocabulary($vid) {
-  $vocabulary = taxonomy_get_vocabulary($vid);
-
-  $form['type'] = array('#type' => 'value', '#value' => 'vocabulary');
-  $form['vid'] = array('#type' => 'value', '#value' => $vid);
-  $form['name'] = array('#type' => 'value', '#value' => $vocabulary->name);
-  return confirm_form('taxonomy_vocabulary_confirm_delete', $form,
-                  t('Are you sure you want to delete the vocabulary %title?',
-                  array('%title' => theme('placeholder', $vocabulary->name))),
-                  'admin/taxonomy', t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'),
-                  t('Delete'),
-                  t('Cancel'));
-}
-
-function taxonomy_vocabulary_confirm_delete_submit($form_id, $form_values) {
-  $status = taxonomy_del_vocabulary($form_values['vid']);
-  drupal_set_message(t('Deleted vocabulary %name.', array('%name' => theme('placeholder', $form_values['name']))));
-  return 'admin/taxonomy';
-}
-
-function taxonomy_form_term($edit = array()) {
-  $vocabulary_id = isset($edit['vid']) ? $edit['vid'] : arg(4);
-  $vocabulary = taxonomy_get_vocabulary($vocabulary_id);
-
-  $form['name'] = array('#type' => 'textfield', '#title' => t('Term name'), '#default_value' => $edit['name'], '#maxlength' => 64, '#description' => t('The name for this term.  Example: "Linux".'), '#required' => TRUE);
-
-  $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], '#description' => t('A description of the term.'));
-
-  if ($vocabulary->hierarchy) {
-    $parent = array_keys(taxonomy_get_parents($edit['tid']));
-    $children = taxonomy_get_tree($vocabulary_id, $edit['tid']);
-
-    // A term can't be the child of itself, nor of its children.
-    foreach ($children as $child) {
-      $exclude[] = $child->tid;
-    }
-    $exclude[] = $edit['tid'];
-
-    if ($vocabulary->hierarchy == 1) {
-      $form['parent'] = _taxonomy_term_select(t('Parent'), 'parent', $parent, $vocabulary_id, l(t('Parent term'), 'admin/help/taxonomy', NULL, NULL, 'parent') .'.', 0, '<'. t('root') .'>', $exclude);
-    }
-    elseif ($vocabulary->hierarchy == 2) {
-      $form['parent'] = _taxonomy_term_select(t('Parents'), 'parent', $parent, $vocabulary_id, l(t('Parent terms'), 'admin/help/taxonomy', NULL, NULL, 'parent') .'.', 1, '<'. t('root') .'>', $exclude);
-    }
-  }
-
-  if ($vocabulary->relations) {
-    $form['relations'] = _taxonomy_term_select(t('Related terms'), 'relations', array_keys(taxonomy_get_related($edit['tid'])), $vocabulary_id, NULL, 1, '<'. t('none') .'>', array($edit['tid']));
-  }
-
-  $form['synonyms'] = array('#type' => 'textarea', '#title' => t('Synonyms'), '#default_value' => implode("\n", taxonomy_get_synonyms($edit['tid'])), '#description' => t('<a href="%help-url">Synonyms</a> of this term, one synonym per line.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'synonyms'))));
-  $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $edit['weight'], '#description' => t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.'));
-
-  // Add extra term form elements.
-  $extra = module_invoke_all('taxonomy', 'form', 'term');
-  if (is_array($extra)) {
-    foreach ($extra as $key => $element) {
-      $extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $extra[$key]['#weight'] : -18;
-    }
-    $form = array_merge($form, $extra);
-  }
-
-
-  $form['vid'] = array('#type' => 'value', '#value' => $vocabulary->vid);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
-
-  if ($edit['tid']) {
-    $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
-    $form['tid'] = array('#type' => 'value', '#value' => $edit['tid']);
-  }
-  else {
-    $form['destination'] = array('#type' => 'hidden', '#value' => $_GET['q']);
-  }
-
-  return drupal_get_form('taxonomy_form_term', $form);
-}
-
-/**
- * Accept the form submission for a taxonomy term and save the result.
- */
-function taxonomy_form_term_submit($form_id, $form_values) {
-  switch (taxonomy_save_term($form_values)) {
-    case SAVED_NEW:
-      drupal_set_message(t('Created new term %term.', array('%term' => theme('placeholder', $form_values['name']))));
-      break;
-    case SAVED_UPDATED:
-      drupal_set_message(t('The term %term has been updated.', array('%term' => theme('placeholder', $form_values['name']))));
-      break;
-  }
-  return 'admin/taxonomy';
-}
-
-function taxonomy_save_term(&$edit) {
-  if ($edit['tid'] && $edit['name']) {
-    db_query("UPDATE {term_data} SET name = '%s', description = '%s', weight = %d WHERE tid = %d", $edit['name'], $edit['description'], $edit['weight'], $edit['tid']);
-    module_invoke_all('taxonomy', 'update', 'term', $edit);
-    $status = SAVED_UPDATED;
-  }
-  else if ($edit['tid']) {
-    return taxonomy_del_term($edit['tid']);
-  }
-  else {
-    $edit['tid'] = db_next_id('{term_data}_tid');
-    db_query("INSERT INTO {term_data} (tid, name, description, vid, weight) VALUES (%d, '%s', '%s', %d, %d)", $edit['tid'], $edit['name'], $edit['description'], $edit['vid'], $edit['weight']);
-    module_invoke_all('taxonomy', 'insert', 'term', $edit);
-    $status = SAVED_NEW;
-  }
-
-  db_query('DELETE FROM {term_relation} WHERE tid1 = %d OR tid2 = %d', $edit['tid'], $edit['tid']);
-  if ($edit['relations']) {
-    foreach ($edit['relations'] as $related_id) {
-      if ($related_id != 0) {
-        db_query('INSERT INTO {term_relation} (tid1, tid2) VALUES (%d, %d)', $edit['tid'], $related_id);
-      }
-    }
-  }
-
-  db_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $edit['tid']);
-  if (!isset($edit['parent']) || empty($edit['parent'])) {
-    $edit['parent'] = array(0);
-  }
-  if (is_array($edit['parent'])) {
-    foreach ($edit['parent'] as $parent) {
-      if (is_array($parent)) {
-        foreach ($parent as $tid) {
-          db_query('INSERT INTO {term_hierarchy} (tid, parent) VALUES (%d, %d)', $edit['tid'], $tid);
-        }
-      }
-      else {
-        db_query('INSERT INTO {term_hierarchy} (tid, parent) VALUES (%d, %d)', $edit['tid'], $parent);
-      }
-    }
-  }
-  else {
-    db_query('INSERT INTO {term_hierarchy} (tid, parent) VALUES (%d, %d)', $edit['tid'], $edit['parent']);
-  }
-
-  db_query('DELETE FROM {term_synonym} WHERE tid = %d', $edit['tid']);
-  if ($edit['synonyms']) {
-    foreach (explode ("\n", str_replace("\r", '', $edit['synonyms'])) as $synonym) {
-      if ($synonym) {
-        db_query("INSERT INTO {term_synonym} (tid, name) VALUES (%d, '%s')", $edit['tid'], chop($synonym));
-      }
-    }
-  }
-
-  cache_clear_all();
-
-  return $status;
-}
-
-function taxonomy_del_term($tid) {
-  $tids = array($tid);
-  while ($tids) {
-    $children_tids = $orphans = array();
-    foreach ($tids as $tid) {
-      // See if any of the term's children are about to be become orphans:
-      if ($children = taxonomy_get_children($tid)) {
-        foreach ($children as $child) {
-          // If the term has multiple parents, we don't delete it.
-          $parents = taxonomy_get_parents($child->tid);
-          if (count($parents) == 1) {
-            $orphans[] = $child->tid;
-          }
-        }
-      }
-
-      $term = (array) taxonomy_get_term($tid);
-
-      db_query('DELETE FROM {term_data} WHERE tid = %d', $tid);
-      db_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $tid);
-      db_query('DELETE FROM {term_relation} WHERE tid1 = %d OR tid2 = %d', $tid, $tid);
-      db_query('DELETE FROM {term_synonym} WHERE tid = %d', $tid);
-      db_query('DELETE FROM {term_node} WHERE tid = %d', $tid);
-
-      module_invoke_all('taxonomy', 'delete', 'term', $term);
-    }
-
-    $tids = $orphans;
-  }
-
-  cache_clear_all();
-
-  return SAVED_DELETED;
-}
-
-function _taxonomy_confirm_del_term($tid) {
-  $term = taxonomy_get_term($tid);
-
-  $form['type'] = array('#type' => 'value', '#value' => 'term');
-  $form['name'] = array('#type' => 'value', '#value' => $term->name);
-  $form['tid'] = array('#type' => 'value', '#value' => $tid);
-  return confirm_form('taxonomy_term_confirm_delete', $form,
-                  t('Are you sure you want to delete the term %title?',
-                  array('%title' => theme('placeholder', $term->name))),
-                  'admin/taxonomy',
-                  t('Deleting a term will delete all its children if there are any. This action cannot be undone.'),
-                  t('Delete'),
-                  t('Cancel'));
-}
-
-function taxonomy_term_confirm_delete_submit($form_id, $form_values) {
-  taxonomy_del_term($form_values['tid']);
-  drupal_set_message(t('Deleted term %name.', array('%name' => theme('placeholder', $form_values['name']))));
-  return 'admin/taxonomy';
-}
-
-/**
- * Generate a form element for selecting terms from a vocabulary.
- */
-function taxonomy_form($vid, $value = 0, $help = NULL, $name = 'taxonomy') {
-  $vocabulary = taxonomy_get_vocabulary($vid);
-  $help = ($help) ? $help : $vocabulary->help;
-  if ($vocabulary->required) {
-    $blank = 0;
-  }
-  else {
-    $blank = '<'. t('none') .'>';
-  }
-
-  return _taxonomy_term_select(check_plain($vocabulary->name), $name, $value, $vid, $help, intval($vocabulary->multiple), $blank);
-}
-
-/**
- * Generate a set of options for selecting a term from all vocabularies. Can be
- * passed to form_select.
- */
-function taxonomy_form_all($free_tags = 0) {
-  $vocabularies = taxonomy_get_vocabularies();
-  $options = array();
-  foreach ($vocabularies as $vid => $vocabulary) {
-    if ($vocabulary->tags && !$free_tags) { continue; }
-    $tree = taxonomy_get_tree($vid);
-    $options[$vocabulary->name] = array();
-    if ($tree) {
-      foreach ($tree as $term) {
-        $options[$vocabulary->name][$term->tid] = _taxonomy_depth($term->depth, '-') . $term->name;
-      }
-    }
-  }
-  return $options;
-}
-
-/**
- * Return an array of all vocabulary objects.
- *
- * @param $type
- *   If set, return only those vocabularies associated with this node type.
- */
-function taxonomy_get_vocabularies($type = NULL) {
-  if ($type) {
-    $result = db_query(db_rewrite_sql("SELECT v.vid, v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $type);
-  }
-  else {
-    $result = db_query(db_rewrite_sql('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid ORDER BY v.weight, v.name', 'v', 'vid'));
-  }
-
-  $vocabularies = array();
-  $node_types = array();
-  while ($voc = db_fetch_object($result)) {
-    $node_types[$voc->vid][] = $voc->type;
-    unset($voc->type);
-    $voc->nodes = $node_types[$voc->vid];
-    $vocabularies[$voc->vid] = $voc;
-  }
-
-  return $vocabularies;
-}
-
-/**
- * Generate a form for selecting terms to associate with a node.
- */
-function taxonomy_form_alter($form_id, &$form) {
-  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
-    $node = $form['#node'];
-
-    if (!isset($node->taxonomy)) {
-      if ($node->nid) {
-        $terms = taxonomy_node_get_terms($node->nid);
-      }
-      else {
-        $terms = array();
-      }
-    }
-    else {
-      $terms = $node->taxonomy;
-    }
-
-    $c = db_query(db_rewrite_sql("SELECT v.* FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $node->type);
-
-    while ($vocabulary = db_fetch_object($c)) {
-      if ($vocabulary->tags) {
-        $typed_terms = array();
-        foreach ($terms as $term) {
-          // Extract terms belonging to the vocabulary in question.
-          if ($term->vid == $vocabulary->vid) {
-
-            // Commas and quotes in terms are special cases, so encode 'em.
-            if (preg_match('/,/', $term->name) || preg_match('/"/', $term->name)) {
-              $term->name = '"'.preg_replace('/"/', '""', $term->name).'"';
-            }
-
-            $typed_terms[] = $term->name;
-          }
-        }
-        $typed_string = implode(', ', $typed_terms) . (array_key_exists('tags', $terms) ? $terms['tags'][$vocabulary->vid] : NULL);
-
-        if ($vocabulary->help) {
-          $help = $vocabulary->help;
-        }
-        else {
-          $help = t('A comma-separated list of terms describing this content.  Example: funny, bungee jumping, "Company, Inc.".');
-        }
-        $form['taxonomy']['tags'][$vocabulary->vid] = array('#type' => 'textfield',
-          '#title' => $vocabulary->name,
-          '#description' => $help,
-          '#required' => $vocabulary->required,
-          '#default_value' => $typed_string,
-          '#autocomplete_path' => 'taxonomy/autocomplete/'. $vocabulary->vid,
-          '#weight' => $vocabulary->weight,
-          '#maxlength' => 100,
-        );
-      }
-      else {
-        // Extract terms belonging to the vocabulary in question.
-        $default_terms = array();
-        foreach ($terms as $term) {
-          if ($term->vid == $vocabulary->vid) {
-            $default_terms[$term->tid] = $term;
-          }
-        }
-        $form['taxonomy'][$vocabulary->vid] = taxonomy_form($vocabulary->vid, array_keys($default_terms), $vocabulary->help);
-        $form['taxonomy'][$vocabulary->vid]['#weight'] = $vocabulary->weight;
-        $form['taxonomy'][$vocabulary->vid]['#required'] = $vocabulary->required;
-      }
-    }
-    if (isset($form['taxonomy'])) {
-      $form['taxonomy'] += array('#type' => 'fieldset', '#title' => t('Categories'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#tree' => TRUE, '#weight' => -3);
-    }
-  }
-}
-
-/**
- * Find all terms associated to the given node, within one vocabulary.
- */
-function taxonomy_node_get_terms_by_vocabulary($nid, $vid, $key = 'tid') {
-  $result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight', 't', 'tid'), $vid, $nid);
-  $terms = array();
-  while ($term = db_fetch_object($result)) {
-    $terms[$term->$key] = $term;
-  }
-  return $terms;
-}
-
-/**
- * Find all terms associated to the given node, ordered by vocabulary and term weight.
- */
-function taxonomy_node_get_terms($nid, $key = 'tid') {
-  static $terms;
-
-  if (!isset($terms[$nid])) {
-    $result = db_query(db_rewrite_sql('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name', 't', 'tid'), $nid);
-    $terms[$nid] = array();
-    while ($term = db_fetch_object($result)) {
-      $terms[$nid][$term->$key] = $term;
-    }
-  }
-  return $terms[$nid];
-}
-
-/**
- * Make sure incoming vids are free tagging enabled.
- */
-function taxonomy_node_validate(&$node) {
-  if ($node->taxonomy) {
-    $terms = $node->taxonomy;
-    if ($terms['tags']) {
-      foreach ($terms['tags'] as $vid => $vid_value) {
-        $vocabulary = taxonomy_get_vocabulary($vid);
-        if (!$vocabulary->tags) {
-          // see form_get_error $key = implode('][', $element['#parents']);
-          // on why this is the key
-          form_set_error("taxonomy][tags][$vid", t('The %name vocabulary can not be modified in this way.', array('%name' => theme('placeholder', $vocabulary->name))));
-        }
-      }
-    }
-  }
-}
-
-/**
- * Save term associations for a given node.
- */
-function taxonomy_node_save($nid, $terms) {
-  taxonomy_node_delete($nid);
-
-  // Free tagging vocabularies do not send their tids in the form,
-  // so we'll detect them here and process them independently.
-  if (isset($terms['tags'])) {
-    $typed_input = $terms['tags'];
-    unset($terms['tags']);
-
-    foreach ($typed_input as $vid => $vid_value) {
-      // This regexp allows the following types of user input:
-      // this, "somecmpany, llc", "and ""this"" w,o.rks", foo bar
-      $regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x';
-      preg_match_all($regexp, $vid_value, $matches);
-      $typed_terms = array_unique($matches[1]);
-
-      $inserted = array();
-      foreach ($typed_terms as $typed_term) {
-        // If a user has escaped a term (to demonstrate that it is a group,
-        // or includes a comma or quote character), we remove the escape
-        // formatting so to save the term into the DB as the user intends.
-        $typed_term = str_replace('""', '"', preg_replace('/^"(.*)"$/', '\1', $typed_term));
-        $typed_term = trim($typed_term);
-        if ($typed_term == "") { continue; }
-
-        // See if the term exists in the chosen vocabulary
-        // and return the tid, otherwise, add a new record.
-        $possibilities = taxonomy_get_term_by_name($typed_term);
-        $typed_term_tid = NULL; // tid match if any.
-        foreach ($possibilities as $possibility) {
-          if ($possibility->vid == $vid) {
-            $typed_term_tid = $possibility->tid;
-          }
-        }
-
-        if (!$typed_term_tid) {
-          $edit = array('vid' => $vid, 'name' => $typed_term);
-          $status = taxonomy_save_term($edit);
-          $typed_term_tid = $edit['tid'];
-        }
-
-        // defend against duplicate, different cased tags
-        if (!isset($inserted[$typed_term_tid])) {
-          db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $typed_term_tid);
-          $inserted[$typed_term_tid] = TRUE;
-        }
-      }
-    }
-  }
-
-  if (is_array($terms)) {
-    foreach ($terms as $term) {
-      if (is_array($term)) {
-        foreach ($term as $tid) {
-          if ($tid) {
-            db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $tid);
-          }
-        }
-      }
-      else if (is_object($term)) {
-        db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $term->tid);
-      }
-      else if ($term) {
-        db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $term);
-      }
-    }
-  }
-}
-
-/**
- * Remove associations of a node to its terms.
- */
-function taxonomy_node_delete($nid) {
-  db_query('DELETE FROM {term_node} WHERE nid = %d', $nid);
-}
-
-/**
- * Find all term objects related to a given term ID.
- */
-function taxonomy_get_related($tid, $key = 'tid') {
-  if ($tid) {
-    $result = db_query('SELECT t.*, tid1, tid2 FROM {term_relation}, {term_data} t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = %d OR tid2 = %d) AND t.tid != %d ORDER BY weight, name', $tid, $tid, $tid);
-    $related = array();
-    while ($term = db_fetch_object($result)) {
-      $related[$term->$key] = $term;
-    }
-    return $related;
-  }
-  else {
-    return array();
-  }
-}
-
-/**
- * Find all parents of a given term ID.
- */
-function taxonomy_get_parents($tid, $key = 'tid') {
-  if ($tid) {
-    $result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_hierarchy} h ON h.parent = t.tid WHERE h.tid = %d ORDER BY weight, name', 't', 'tid'), $tid);
-    $parents = array();
-    while ($parent = db_fetch_object($result)) {
-      $parents[$parent->$key] = $parent;
-    }
-    return $parents;
-  }
-  else {
-    return array();
-  }
-}
-
-/**
- * Find all ancestors of a given term ID.
- */
-function taxonomy_get_parents_all($tid) {
-  $parents = array();
-  if ($tid) {
-    $parents[] = taxonomy_get_term($tid);
-    $n = 0;
-    while ($parent = taxonomy_get_parents($parents[$n]->tid)) {
-      $parents = array_merge($parents, $parent);
-      $n++;
-    }
-  }
-  return $parents;
-}
-
-/**
- * Find all children of a term ID.
- */
-function taxonomy_get_children($tid, $vid = 0, $key = 'tid') {
-  if ($vid) {
-    $result = db_query(db_rewrite_sql('SELECT t.* FROM {term_data} t INNER JOIN {term_hierarchy} h ON h.tid = t.tid WHERE t.vid = %d AND h.parent = %d ORDER BY weight, name', 't', 'tid'), $vid, $tid);
-  }
-  else {
-    $result = db_query(db_rewrite_sql('SELECT t.* FROM {term_data} t INNER JOIN {term_hierarchy} h ON h.tid = t.tid WHERE parent = %d ORDER BY weight, name', 't', 'tid'), $tid);
-  }
-  $children = array();
-  while ($term = db_fetch_object($result)) {
-    $children[$term->$key] = $term;
-  }
-  return $children;
-}
-
-/**
- * Create a hierarchical representation of a vocabulary.
- *
- * @param $vid
- *   Which vocabulary to generate the tree for.
- *
- * @param $parent
- *   The term ID under which to generate the tree. If 0, generate the tree
- *   for the entire vocabulary.
- *
- * @param $depth
- *   Internal use only.
- *
- * @param $max_depth
- *   The number of levels of the tree to return. Leave NULL to return all levels.
- *
- * @return
- *   An array of all term objects in the tree. Each term object is extended
- *   to have "depth" and "parents" attributes in addition to its normal ones.
- */
-function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) {
-  static $children, $parents, $terms;
-
-  $depth++;
-
-  // We cache trees, so it's not CPU-intensive to call get_tree() on a term
-  // and its children, too.
-  if (!isset($children[$vid])) {
-    $children[$vid] = array();
-
-    $result = db_query(db_rewrite_sql('SELECT t.tid, t.*, parent FROM {term_data} t INNER JOIN  {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d ORDER BY weight, name', 't', 'tid'), $vid);
-    while ($term = db_fetch_object($result)) {
-      $children[$vid][$term->parent][] = $term->tid;
-      $parents[$vid][$term->tid][] = $term->parent;
-      $terms[$vid][$term->tid] = $term;
-    }
-  }
-
-  $max_depth = (is_null($max_depth)) ? count($children[$vid]) : $max_depth;
-  if ($children[$vid][$parent]) {
-    foreach ($children[$vid][$parent] as $child) {
-      if ($max_depth > $depth) {
-        $terms[$vid][$child]->depth = $depth;
-        // The "parent" attribute is not useful, as it would show one parent only.
-        unset($terms[$vid][$child]->parent);
-        $terms[$vid][$child]->parents = $parents[$vid][$child];
-        $tree[] = $terms[$vid][$child];
-
-        if ($children[$vid][$child]) {
-          $tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth));
-        }
-      }
-    }
-  }
-
-  return $tree ? $tree : array();
-}
-
-/**
- * Return an array of synonyms of the given term ID.
- */
-function taxonomy_get_synonyms($tid) {
-  if ($tid) {
-    $result = db_query('SELECT name FROM {term_synonym} WHERE tid = %d', $tid);
-    while ($synonym = db_fetch_array($result)) {
-      $synonyms[] = $synonym['name'];
-    }
-    return $synonyms ? $synonyms : array();
-  }
-  else {
-    return array();
-  }
-}
-
-/**
- * Return the term object that has the given string as a synonym.
- */
-function taxonomy_get_synonym_root($synonym) {
-  return db_fetch_object(db_query("SELECT * FROM {term_synonym} s, {term_data} t WHERE t.tid = s.tid AND s.name = '%s'", $synonym));
-}
-
-/**
- * Given a term id, count the number of published nodes in it.
- */
-function taxonomy_term_count_nodes($tid, $type = 0) {
-  static $count;
-
-  if (!isset($count[$type])) {
-    // $type == 0 always evaluates true is $type is a string
-    if (is_numeric($type)) {
-      $result = db_query(db_rewrite_sql('SELECT t.tid, COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.nid = n.nid WHERE n.status = 1 GROUP BY t.tid'));
-    }
-    else {
-      $result = db_query(db_rewrite_sql("SELECT t.tid, COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.nid = n.nid WHERE n.status = 1 AND n.type = '%s' GROUP BY t.tid"), $type);
-    }
-    while ($term = db_fetch_object($result)) {
-      $count[$type][$term->tid] = $term->c;
-    }
-  }
-
-  foreach (_taxonomy_term_children($tid) as $c) {
-    $children_count += taxonomy_term_count_nodes($c, $type);
-  }
-  return $count[$type][$tid] + $children_count;
-}
-
-/**
- * Helper for taxonomy_term_count_nodes().
- */
-function _taxonomy_term_children($tid) {
-  static $children;
-
-  if (!isset($children)) {
-    $result = db_query('SELECT tid, parent FROM {term_hierarchy}');
-    while ($term = db_fetch_object($result)) {
-      $children[$term->parent][] = $term->tid;
-    }
-  }
-  return $children[$tid] ? $children[$tid] : array();
-}
-
-/**
- * Try to map a string to an existing term, as for glossary use.
- *
- * Provides a case-insensitive and trimmed mapping, to maximize the
- * likelihood of a successful match.
- *
- * @param name
- *   Name of the term to search for.
- *
- * @return
- *   An array of matching term objects.
- */
-function taxonomy_get_term_by_name($name) {
-  $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE LOWER('%s') LIKE LOWER(t.name)", 't', 'tid'), trim($name));
-  $result = array();
-  while ($term = db_fetch_object($db_result)) {
-    $result[] = $term;
-  }
-
-  return $result;
-}
-
-/**
- * Return the vocabulary object matching a vocabulary ID.
- */
-function taxonomy_get_vocabulary($vid) {
-  static $vocabularies = array();
-
-  if (!array_key_exists($vid, $vocabularies)) {
-    $result = db_query('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE v.vid = %d ORDER BY v.weight, v.name', $vid);
-    $node_types = array();
-    while ($voc = db_fetch_object($result)) {
-      $node_types[] = $voc->type;
-      unset($voc->type);
-      $voc->nodes = $node_types;
-      $vocabularies[$vid] = $voc;
-    }
-  }
-
-  return $vocabularies[$vid];
-}
-
-/**
- * Return the term object matching a term ID.
- */
-function taxonomy_get_term($tid) {
-  // simple cache using a static var?
-  return db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = %d', $tid));
-}
-
-function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $description, $multiple, $blank, $exclude = array()) {
-  $tree = taxonomy_get_tree($vocabulary_id);
-  $options = array();
-
-  if ($blank) {
-    $options[0] = $blank;
-  }
-  if ($tree) {
-    foreach ($tree as $term) {
-      if (!in_array($term->tid, $exclude)) {
-        $options[$term->tid] = _taxonomy_depth($term->depth, '-') . $term->name;
-      }
-    }
-    if (!$blank && !$value) {
-      // required but without a predefined value, so set first as predefined
-      $value = $tree[0]->tid;
-    }
-  }
-
-  return array('#type' => 'select',
-    '#title' => $title,
-    '#default_value' => $value,
-    '#options' => $options,
-    '#description' => $description,
-    '#multiple' => $multiple,
-    '#size' => $multiple ? min(9, count($options)) : 0,
-    '#weight' => -15,
-    '#theme' => 'taxonomy_term_select',
-  );
-}
-
-function theme_taxonomy_term_select($element) {
-  return theme('select', $element);
-}
-
-function _taxonomy_depth($depth, $graphic = '--') {
-  for ($n = 0; $n < $depth; $n++) {
-    $result .= $graphic;
-  }
-  return $result;
-}
-
-/**
- * Finds all nodes that match selected taxonomy conditions.
- *
- * @param $tids
- *   An array of term IDs to match.
- * @param $operator
- *   How to interpret multiple IDs in the array. Can be "or" or "and".
- * @param $depth
- *   How many levels deep to traverse the taxonomy tree. Can be a nonnegative
- *   integer or "all".
- * @param $pager
- *   Whether the nodes are to be used with a pager (the case on most Drupal
- *   pages) or not (in an XML feed, for example).
- * @param $order
- *   The order clause for the query that retrieve the nodes.
- * @return
- *   A resource identifier pointing to the query results.
- */
-function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $pager = TRUE, $order = 'n.sticky DESC, n.created DESC') {
-  if (count($tids) > 0) {
-    // For each term ID, generate an array of descendant term IDs to the right depth.
-    $descendant_tids = array();
-    if ($depth === 'all') {
-      $depth = NULL;
-    }
-    foreach ($tids as $index => $tid) {
-      $term = taxonomy_get_term($tid);
-      $tree = taxonomy_get_tree($term->vid, $tid, -1, $depth);
-      $descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree));
-    }
-
-    if ($operator == 'or') {
-      $str_tids = implode(',', call_user_func_array('array_merge', $descendant_tids));
-      $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 ORDER BY '. $order;
-      $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1';
-    }
-    else {
-      $joins = '';
-      $wheres = '';
-      foreach ($descendant_tids as $index => $tids) {
-        $joins .= ' INNER JOIN {term_node} tn'. $index .' ON n.nid = tn'. $index .'.nid';
-        $wheres .= ' AND tn'. $index .'.tid IN ('. implode(',', $tids) .')';
-      }
-      $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres .' ORDER BY '. $order;
-      $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n '. $joins .' WHERE n.status = 1 ' . $wheres;
-    }
-    $sql = db_rewrite_sql($sql);
-    $sql_count = db_rewrite_sql($sql_count);
-    if ($pager) {
-      $result = pager_query($sql, variable_get('default_nodes_main', 10), 0, $sql_count);
-    }
-    else {
-      $result = db_query_range($sql, 0, variable_get('feed_default_items', 10));
-    }
-  }
-
-  return $result;
-}
-
-/**
- * Accepts the result of a pager_query() call, such as that performed by
- * taxonomy_select_nodes(), and formats each node along with a pager.
-*/
-function taxonomy_render_nodes($result) {
-  if (db_num_rows($result) > 0) {
-    while ($node = db_fetch_object($result)) {
-      $output .= node_view(node_load($node->nid), 1);
-    }
-    $output .= theme('pager', NULL, variable_get('default_nodes_main', 10), 0);
-  }
-  else {
-    $output .= t('There are currently no posts in this category.');
-  }
-  return $output;
-}
-
-/**
- * Implementation of hook_nodeapi().
- */
-function taxonomy_nodeapi($node, $op, $arg = 0) {
-  switch ($op) {
-    case 'load':
-     $output['taxonomy'] = taxonomy_node_get_terms($node->nid);
-     return $output;
-    case 'insert':
-      taxonomy_node_save($node->nid, $node->taxonomy);
-      break;
-    case 'update':
-      taxonomy_node_save($node->nid, $node->taxonomy);
-      break;
-    case 'delete':
-      taxonomy_node_delete($node->nid);
-      break;
-    case 'validate':
-      taxonomy_node_validate($node);
-      break;
-    case 'rss item':
-      return taxonomy_rss_item($node);
-    case 'update index':
-      return taxonomy_node_update_index($node);
-  }
-}
-
-/**
- * Implementation of hook_nodeapi('update_index').
- */
-function taxonomy_node_update_index(&$node) {
-  $output = array();
-  foreach ($node->taxonomy as $term) {
-    $output[] = $term->name;
-  }
-  if (count($output)) {
-    return '<strong>('. implode(', ', $output) .')</strong>';
-  }
-}
-
-/**
- * Menu callback; displays all nodes associated with a term.
- */
-function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
-  if (preg_match('/^([0-9]+[+ ])+[0-9]+$/', $str_tids)) {
-    $operator = 'or';
-    // The '+' character in a query string may be parsed as ' '.
-    $tids = preg_split('/[+ ]/', $str_tids);
-  }
-  else if (preg_match('/^([0-9]+,)*[0-9]+$/', $str_tids)) {
-    $operator = 'and';
-    $tids = explode(',', $str_tids);
-  }
-  else {
-    drupal_not_found();
-  }
-
-  if ($tids) {
-    $result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {term_data} t WHERE t.tid IN (%s)', 't', 'tid'), implode(',', $tids));
-    $tids = array(); // we rebuild the $tids-array so it only contains terms the user has access to.
-    $names = array();
-    while ($term = db_fetch_object($result)) {
-      $tids[] = $term->tid;
-      $names[] = $term->name;
-    }
-
-    if ($names) {
-      drupal_set_title($title = check_plain(implode(', ', $names)));
-
-      switch ($op) {
-        case 'page':
-          // Build breadcrumb based on first hierarchy of first term:
-          $current->tid = $tids[0];
-          $breadcrumbs = array(array('path' => $_GET['q']));
-          while ($parents = taxonomy_get_parents($current->tid)) {
-            $current = array_shift($parents);
-            $breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name);
-          }
-          $breadcrumbs = array_reverse($breadcrumbs);
-          menu_set_location($breadcrumbs);
-
-          drupal_add_link(array('rel' => 'alternate',
-                                'type' => 'application/rss+xml',
-                                'title' => 'RSS - '. $title,
-                                'href' => url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed')));
-
-          $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
-          $output .= theme('feed_icon', url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'));
-          return $output;
-          break;
-
-        case 'feed':
-          $term = taxonomy_get_term($tids[0]);
-          $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE);
-          $channel['title'] = variable_get('site_name', 'drupal') .' - '. $title;
-          $channel['description'] = $term->description;
-
-          $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
-          node_feed($result, $channel);
-          break;
-        default:
-          drupal_not_found();
-      }
-    }
-    else {
-      drupal_not_found();
-    }
-  }
-}
-
-/**
- * Page to add or edit a vocabulary
- */
-function taxonomy_admin_vocabulary_edit($vid = NULL) {
-  if ($_POST['op'] == t('Delete') || $_POST['edit']['confirm']) {
-    return _taxonomy_confirm_del_vocabulary($vid);
-  }
-  elseif ($vid) {
-    $vocabulary = (array)taxonomy_get_vocabulary($vid);
-  }
-  return taxonomy_form_vocabulary($vocabulary);
-}
-
-/**
- * Page to list terms for a vocabulary
- */
-function taxonomy_admin_term_edit($tid = NULL) {
-  if ($_POST['op'] == t('Delete') || $_POST['edit']['confirm']) {
-    return _taxonomy_confirm_del_term($tid);
-  }
-  elseif ($tid) {
-    $term = (array)taxonomy_get_term($tid);
-  }
-  return taxonomy_form_term($term);
-}
-
-/**
- * Provides category information for rss feeds
- */
-function taxonomy_rss_item($node) {
-  $output = array();
-  foreach ($node->taxonomy as $term) {
-    $output[] = array('key'   => 'category',
-                      'value' => check_plain($term->name),
-                      'attributes' => array('domain' => url('taxonomy/term/'. $term->tid, NULL, NULL, TRUE)));
-  }
-  return $output;
-}
-
-/**
- * Implementation of hook_help().
- */
-function taxonomy_help($section) {
-  switch ($section) {
-    case 'admin/help#taxonomy':
-      $output = '<p>'. t('The taxonomy module is one of the most popular features because users often want to create categories to organize content by type. It can automatically classify new content, which is very useful for organizing content on-the-fly. A simple example would be organizing a list of music reviews by musical genre.') .'</p>';
-      $output .= '<p>'. t('Taxonomy is also the study of classification. The taxonomy module allows you to define vocabularies (sets of categories) which are used to classify content. The module supports hierarchical classification and association between terms, allowing for truly flexible information retrieval and classification. The taxonomy module allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). To view and manage the terms of each vocabulary, click on the associated <em>list terms</em> link. To delete a vocabulary and all its terms, choose <em>edit vocabulary.</em>') .'</p>';
-      $output .= '<p>'. t('A controlled vocabulary is a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each piece of content (blog, story, etc.) using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slashdot\'s sections. For more complex implementations, you might create a hierarchical list of categories.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>add a vocabulary at <a href="%admin-taxonomy-add-vocabulary">administer &gt;&gt; categories &gt;&gt;  add vocabulary</a>.</li>
-<li>administer taxonomy at <a href="%admin-taxonomy">administer &gt;&gt; categories</a>.</li>
-<li>restrict content access by category for specific users roles using the <a href="%external-http-drupal-org-project-taxonomy_access">taxonomy access module</a>.</li>
-<li>build a custom view of your categories using the <a href="%external-http-drupal-org-project-taxonomy_browser">taxonomy browser</a>.</li>
-</ul>
-', array('%admin-taxonomy-add-vocabulary' => url('admin/taxonomy/add/vocabulary'), '%admin-taxonomy' => url('admin/taxonomy'), '%external-http-drupal-org-project-taxonomy_access' => 'http://drupal.org/project/taxonomy_access', '%external-http-drupal-org-project-taxonomy_browser' => 'http://drupal.org/project/taxonomy_browser'));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%taxonomy">Taxonomy page</a>.', array('%taxonomy' => 'http://drupal.org/handbook/modules/taxonomy/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Enables the categorization of content.');
-    case 'admin/taxonomy':
-      return t('<p>The taxonomy module allows you to classify content into categories and subcategories; it allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms), taxonomies (controlled vocabularies where relationships are indicated hierarchically), and free vocabularies where terms, or tags, are defined during content creation. To view and manage the terms of each vocabulary, click on the associated <em>list terms</em> link. To delete a vocabulary and all its terms, choose "edit vocabulary".</p>');
-    case 'admin/taxonomy/add/vocabulary':
-      return t("<p>When you create a controlled vocabulary you are creating a set of terms to use for describing content (known as descriptors in indexing lingo).  Drupal allows you to describe each piece of content (blog, story, etc.) using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slashdot.org's or Kuro5hin.org's sections. For more complex implementations, you might create a hierarchical list of categories.</p>");
-  }
-}
-
-/**
- * Helper function for array_map purposes.
- */
-function _taxonomy_get_tid_from_term($term) {
-  return $term->tid;
-}
-
-/**
- * Helper function for autocompletion
- */
-function taxonomy_autocomplete($vid, $string = '') {
-  // The user enters a comma-separated list of tags. We only autocomplete the last tag.
-  // This regexp allows the following types of user input:
-  // this, "somecmpany, llc", "and ""this"" w,o.rks", foo bar
-  $regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x';
-  preg_match_all($regexp, $string, $matches);
-  $array = $matches[1];
-
-  // Fetch last tag
-  $last_string = trim(array_pop($array));
-  if ($last_string != '') {
-    $result = db_query_range(db_rewrite_sql("SELECT t.tid, t.name FROM {term_data} t WHERE t.vid = %d AND LOWER(t.name) LIKE LOWER('%%%s%%')", 't', 'tid'), $vid, $last_string, 0, 10);
-
-    $prefix = count($array) ? implode(', ', $array) .', ' : '';
-
-    $matches = array();
-    while ($tag = db_fetch_object($result)) {
-      $n = $tag->name;
-      // Commas and quotes in terms are special cases, so encode 'em.
-      if (preg_match('/,/', $tag->name) || preg_match('/"/', $tag->name)) {
-        $n = '"'. preg_replace('/"/', '""', $tag->name) .'"';
-      }
-      $matches[$prefix . $n] = check_plain($tag->name);
-    }
-    print drupal_to_js($matches);
-    exit();
-  }
-}
diff --git a/modules/taxonomy_block/LICENSE.txt b/modules/taxonomy_block/LICENSE.txt
deleted file mode 100644 (file)
index 2c095c8..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-GNU GENERAL PUBLIC LICENSE
-
-              Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
-Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
-verbatim copies of this license document, but changing it is not allowed.
-
-                  Preamble
-
-The licenses for most software are designed to take away your freedom to
-share and change it. By contrast, the GNU General Public License is
-intended to guarantee your freedom to share and change free software--to
-make sure the software is free for all its users. This General Public License
-applies to most of the Free Software Foundation's software and to any other
-program whose authors commit to using it. (Some other Free Software
-Foundation software is covered by the GNU Library General Public License
-instead.) You can apply it to your programs, too.
-
-When we speak of free software, we are referring to freedom, not price. Our
-General Public Licenses are designed to make sure that you have the
-freedom to distribute copies of free software (and charge for this service if
-you wish), that you receive source code or can get it if you want it, that you
-can change the software or use pieces of it in new free programs; and that
-you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to
-deny you these rights or to ask you to surrender the rights. These restrictions
-translate to certain responsibilities for you if you distribute copies of the
-software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether gratis or for
-a fee, you must give the recipients all the rights that you have. You must make
-sure that they, too, receive or can get the source code. And you must show
-them these terms so they know their rights.
-
-We protect your rights with two steps: (1) copyright the software, and (2)
-offer you this license which gives you legal permission to copy, distribute
-and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain that
-everyone understands that there is no warranty for this free software. If the
-software is modified by someone else and passed on, we want its recipients
-to know that what they have is not the original, so that any problems
-introduced by others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents. We
-wish to avoid the danger that redistributors of a free program will individually
-obtain patent licenses, in effect making the program proprietary. To prevent
-this, we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and modification
-follow.
-
-           GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
-               MODIFICATION
-
-0. This License applies to any program or other work which contains a notice
-placed by the copyright holder saying it may be distributed under the terms
-of this General Public License. The "Program", below, refers to any such
-program or work, and a "work based on the Program" means either the
-Program or any derivative work under copyright law: that is to say, a work
-containing the Program or a portion of it, either verbatim or with
-modifications and/or translated into another language. (Hereinafter, translation
-is included without limitation in the term "modification".) Each licensee is
-addressed as "you".
-
-Activities other than copying, distribution and modification are not covered
-by this License; they are outside its scope. The act of running the Program is
-not restricted, and the output from the Program is covered only if its contents
-constitute a work based on the Program (independent of having been made
-by running the Program). Whether that is true depends on what the Program
-does.
-
-1. You may copy and distribute verbatim copies of the Program's source
-code as you receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice and
-disclaimer of warranty; keep intact all the notices that refer to this License
-and to the absence of any warranty; and give any other recipients of the
-Program a copy of this License along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and you
-may at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion of it,
-thus forming a work based on the Program, and copy and distribute such
-modifications or work under the terms of Section 1 above, provided that you
-also meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices stating that
-you changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in whole or in
-part contains or is derived from the Program or any part thereof, to be
-licensed as a whole at no charge to all third parties under the terms of this
-License.
-
-c) If the modified program normally reads commands interactively when run,
-you must cause it, when started running for such interactive use in the most
-ordinary way, to print or display an announcement including an appropriate
-copyright notice and a notice that there is no warranty (or else, saying that
-you provide a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this License.
-(Exception: if the Program itself is interactive but does not normally print such
-an announcement, your work based on the Program is not required to print
-an announcement.)
-
-These requirements apply to the modified work as a whole. If identifiable
-sections of that work are not derived from the Program, and can be
-reasonably considered independent and separate works in themselves, then
-this License, and its terms, do not apply to those sections when you distribute
-them as separate works. But when you distribute the same sections as part
-of a whole which is a work based on the Program, the distribution of the
-whole must be on the terms of this License, whose permissions for other
-licensees extend to the entire whole, and thus to each and every part
-regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your rights to
-work written entirely by you; rather, the intent is to exercise the right to
-control the distribution of derivative or collective works based on the
-Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of a
-storage or distribution medium does not bring the other work under the scope
-of this License.
-
-3. You may copy and distribute the Program (or a work based on it, under
-Section 2) in object code or executable form under the terms of Sections 1
-and 2 above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable source
-code, which must be distributed under the terms of Sections 1 and 2 above
-on a medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three years, to give
-any third party, for a charge no more than your cost of physically performing
-source distribution, a complete machine-readable copy of the corresponding
-source code, to be distributed under the terms of Sections 1 and 2 above on
-a medium customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer to distribute
-corresponding source code. (This alternative is allowed only for
-noncommercial distribution and only if you received the program in object
-code or executable form with such an offer, in accord with Subsection b
-above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source code
-means all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation and
-installation of the executable. However, as a special exception, the source
-code distributed need not include anything that is normally distributed (in
-either source or binary form) with the major components (compiler, kernel,
-and so on) of the operating system on which the executable runs, unless that
-component itself accompanies the executable.
-
-If distribution of executable or object code is made by offering access to
-copy from a designated place, then offering equivalent access to copy the
-source code from the same place counts as distribution of the source code,
-even though third parties are not compelled to copy the source along with the
-object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program except as
-expressly provided under this License. Any attempt otherwise to copy,
-modify, sublicense or distribute the Program is void, and will automatically
-terminate your rights under this License. However, parties who have received
-copies, or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the
-Program or its derivative works. These actions are prohibited by law if you
-do not accept this License. Therefore, by modifying or distributing the
-Program (or any work based on the Program), you indicate your acceptance
-of this License to do so, and all its terms and conditions for copying,
-distributing or modifying the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the original
-licensor to copy, distribute or modify the Program subject to these terms and
-conditions. You may not impose any further restrictions on the recipients'
-exercise of the rights granted herein. You are not responsible for enforcing
-compliance by third parties to this License.
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues), conditions
-are imposed on you (whether by court order, agreement or otherwise) that
-contradict the conditions of this License, they do not excuse you from the
-conditions of this License. If you cannot distribute so as to satisfy
-simultaneously your obligations under this License and any other pertinent
-obligations, then as a consequence you may not distribute the Program at all.
-For example, if a patent license would not permit royalty-free redistribution
-of the Program by all those who receive copies directly or indirectly through
-you, then the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply and
-the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or
-other property right claims or to contest validity of any such claims; this
-section has the sole purpose of protecting the integrity of the free software
-distribution system, which is implemented by public license practices. Many
-people have made generous contributions to the wide range of software
-distributed through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing to
-distribute software through any other system and a licensee cannot impose
-that choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in certain
-countries either by patents or by copyrighted interfaces, the original copyright
-holder who places the Program under this License may add an explicit
-geographical distribution limitation excluding those countries, so that
-distribution is permitted only in or among countries not thus excluded. In such
-case, this License incorporates the limitation as if written in the body of this
-License.
-
-9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will be
-similar in spirit to the present version, but may differ in detail to address new
-problems or concerns.
-
-Each version is given a distinguishing version number. If the Program specifies
-a version number of this License which applies to it and "any later version",
-you have the option of following the terms and conditions either of that
-version or of any later version published by the Free Software Foundation. If
-the Program does not specify a version number of this License, you may
-choose any version ever published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free programs
-whose distribution conditions are different, write to the author to ask for
-permission. For software which is copyrighted by the Free Software
-Foundation, write to the Free Software Foundation; we sometimes make
-exceptions for this. Our decision will be guided by the two goals of
-preserving the free status of all derivatives of our free software and of
-promoting the sharing and reuse of software generally.
-
-               NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE,
-THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT
-PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
-STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
-WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
-PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
-NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR
-AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR
-ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
-LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
-SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
-ARISING OUT OF THE USE OR INABILITY TO USE THE
-PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
-OR DATA BEING RENDERED INACCURATE OR LOSSES
-SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
-PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN
-IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.
-
-          END OF TERMS AND CONDITIONS
diff --git a/modules/taxonomy_block/README.txt b/modules/taxonomy_block/README.txt
deleted file mode 100644 (file)
index 39ac160..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-This is a simple module to create blocks based on taxonomy. It displays listings of recently posted nodes based on taxonomy definitions. You can create as many blocks as you like.
-
-Send comments to welch@advomatic.com
-
-Originally developed for stagespace.com by Aaron Welch (crunchywelch) at Advomatic LLC
diff --git a/modules/taxonomy_block/taxonomy_block.install b/modules/taxonomy_block/taxonomy_block.install
deleted file mode 100644 (file)
index e112759..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-// $Id: taxonomy_block.install 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * Implementation of hook_install()
- */
-function taxonomy_block_install() {
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = db_query("
-        CREATE TABLE {taxonomy_block} (
-          bid int(10) unsigned NOT NULL auto_increment,
-          type enum('vocabulary','term') NOT NULL default 'vocabulary',
-          tid int(10) unsigned NOT NULL default '0',
-          description varchar(100) NOT NULL default '',
-          teaser int(10) unsigned NOT NULL default '0',
-          name varchar(100) NOT NULL default '',
-          length int(10) unsigned NOT NULL default '1',
-          PRIMARY KEY  (bid)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;
-      ");
-      break;
-
-    case 'pgsql':
-      db_query("
-        CREATE TABLE {taxonomy_block} (
-          bid serial NOT NULL ,
-          type text check (type in ('vocabulary'::text,'term'::text)) default 'vocabulary',
-          tid integer NOT NULL default 0,
-          description text NOT NULL default '',
-          teaser integer NOT NULL default 0,
-          name text NOT NULL default '',
-          length integer NOT NULL default 1,
-          PRIMARY KEY (bid)
-        );
-      ");
-      break;
-  }
-  return $ret;
-}
-
-function taxonomy_block_update_1() {
-  return _system_update_utf8(array('taxonomy_block'));
-}
diff --git a/modules/taxonomy_block/taxonomy_block.module b/modules/taxonomy_block/taxonomy_block.module
deleted file mode 100644 (file)
index 5dcef1a..0000000
+++ /dev/null
@@ -1,324 +0,0 @@
-<?php
-// $Id: taxonomy_block.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * Implementation of hook_help.
- */
-function taxonomy_block_help($section) {
-  switch ($section) {
-    case 'admin/modules#description' :
-        return t('Makes blocks based on taxonomy vocabularies and terms.');
-      break;
-  }
-}
-
-/**
- * Implementation of hook_perm.
- */
-function taxonomy_block_perm() {
-  return array('administer taxonomy blocks');
-}
-
-/**
- * Implementation of hook_menu.
- */
-function taxonomy_block_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/block/taxonomy_block', 'title' => t('taxonomy block'), 'callback' => 'taxonomy_block_admin', 'access' => user_access('administer taxonomy blocks'));
-    $items[] = array('path' => 'admin/block/taxonomy_block/edit', 'title' => t('edit taxonomy block'), 'callback' => 'taxonomy_block_form', 'access' => user_access('administer taxonomy blocks'), 'type' => MENU_CALLBACK);
-  }
-
-  return $items;
-}
-
-/**
- * Implementation of hook_block.
- */
-function taxonomy_block_block($op = 'list', $delta = 0) {
-  switch ($op) {
-    case 'list':
-      return taxonomy_block_get_blocks();
-      break;
-    case 'view':
-      return taxonomy_block_get_block($delta);
-      break;
-  }
-}
-
-/**
- * Displays the administrator page to this module.
- */
-function taxonomy_block_admin($op = NULL, $bid = NULL) {
-  switch ($op) {
-    case 'delete' :
-      $form['bid'] = array(
-        '#type' => 'hidden',
-        '#value' => $bid,
-        );
-      $output = confirm_form('taxonomy_block_delete_form', $form, t('Are you sure you want to delete the taxonomy block?'), 'admin/block/taxonomy_block');
-      break;
-    default:
-      $output = taxonomy_block_blocks();
-      $output .= taxonomy_block_form();
-      break;
-  }
-
-  drupal_set_title(t('Taxonomy Block Administration'));
-  return $output;
-}
-
-/**
- * Inserts a block into the database.
- */
-function taxonomy_block_insert($edit) {
-  $sql = 'INSERT INTO {taxonomy_block} (tid, name, description, length, type, teaser) VALUES (%d, \'%s\', \'%s\', %d, \'%s\', %d)';
-  db_query($sql, $edit['tid'], $edit['name'], $edit['description'], $edit['length'], $edit['type'], $edit['teaser']);
-  drupal_set_message(t('Created taxonomy block'));
-}
-
-/**
- * Updates a block in the database.
- */
-function taxonomy_block_update($edit) {
-  $sql = 'UPDATE {taxonomy_block} SET tid = %d, name = \'%s\', description = \'%s\', length = %d, type = \'%s\', teaser = %d WHERE bid = %d';
-  db_query($sql, $edit['tid'], $edit['name'], $edit['description'], $edit['length'], $edit['type'], $edit['teaser'], $edit['bid']);
-  drupal_set_message(t('Updated taxonomy block'));
-}
-
-/**
- * Deletes a block from the database.
- */
-function taxonomy_block_delete($bid) {
-  db_query('DELETE FROM {taxonomy_block} WHERE bid = %d', $bid);
-}
-
-/**
-* Displays the block creation form.
-*/
-function taxonomy_block_form($bid = NULL) {
-  if ($bid) {
-    $block = db_fetch_object(db_query('SELECT * FROM {taxonomy_block} WHERE bid = %d', $bid));
-  }
-
-  $form['create_taxonomy_block'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Create Block'),
-    );
-  $form['create_taxonomy_block']['bid'] = array(
-    '#type' => 'hidden',
-    '#value' => $bid,
-  );
-  $form['create_taxonomy_block']['name'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Block Name'),
-    '#default_value' => $block->name,
-    '#description' => t('This is the name of your block.'),
-    );
-  $form['create_taxonomy_block']['description'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Block Description'),
-    '#default_value' => $block->description,
-    '#description' => t('This is the description of your block. It is not displayed to users.'),
-    '#required' => TRUE,
-    );
-  $form['create_taxonomy_block']['teaser'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Teaser Length'),
-    '#default_value' => $block->teaser,
-    '#description' => t('This is the length of node body content to display under each title in characters. Leave blank for none.'),
-    );
-  $form['create_taxonomy_block']['length'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Node Count'),
-    '#default_value' => $block->length,
-    '#description' => t('This is the number of nodes to display.'),
-    '#required' => TRUE,
-    );
-
-  $form['create_taxonomy_block']['tid'] = _taxonomy_block_get_taxonomy_dropdown($block->type == 'vocabulary' ? 'v'. $block->tid : $block->tid);
-
-  if($bid) {
-    $form['create_taxonomy_block'][] = array(
-      '#type' => 'submit',
-      '#value' => t('Edit Block'),
-      );
-    $form['create_taxonomy_block'][] = array(
-      '#type' => 'submit',
-      '#value' => t('Cancel'),
-      );
-  }
-  else {
-    $form['create_taxonomy_block'][] = array(
-      '#type' => 'submit',
-      '#value' => t('Create Block'),
-      );
-  }
-
-  return drupal_get_form('taxonomy_block_form', $form);
-}
-
-/**
- * taxonomy_block_form form validate callback function.
- */
-function taxonomy_block_form_validate($form_id, $edit) {
-  if(!$edit['description']) {
-    form_set_error('description', t('Please provide a description for your block. It will be used in administration screens only.'));
-  }
-  if($edit['length'] <=0) {
-    form_set_error('length', t('Please provide a node count greater than 0.'));
-  }
-  if(!$edit['tid']) {
-    form_set_error('tid', t('Please select a category for your block to display.'));
-  }
-}
-/**
- * taxonomy_block_form form execute callback function.
- */
-function taxonomy_block_form_submit($form_id, $edit) {
-  $op = $_POST['op'];
-
-  if(substr($edit['tid'], 0, 1)=='v') {
-    $edit['type'] = 'vocabulary';
-    $edit['tid'] = substr($edit['tid'], 1);
-  }
-  else {
-    $edit['type'] = 'term';
-  }
-
-  if($op == t('Create Block')) {
-    taxonomy_block_insert($edit);
-  }
-  elseif($op == t('Edit Block')) {
-    taxonomy_block_update($edit);
-  }
-  drupal_goto('admin/block/taxonomy_block');
-}
-
-function taxonomy_block_delete_form_submit($form_id, $edit) {
-  taxonomy_block_delete($edit['bid']);
-  drupal_set_message(t('The block has been deleted.'));
-  drupal_goto('admin/block/taxonomy_block');
-}
-
-/**
-* Displays a list of the blocks.
-*/
-function taxonomy_block_blocks() {
-  $result = db_query('SELECT * FROM {taxonomy_block}');
-  while ($block = db_fetch_object($result)) {
-    $links = array();
-    $links[] = l(t('edit'), 'admin/block/taxonomy_block/edit/'. $block->bid, array('title'=>t('edit block')));;
-    $links[] = l(t('delete'), 'admin/block/taxonomy_block/delete/'. $block->bid, array('title'=>t('delete block')));;
-    $blocks[] = $block->description .' - '. theme('links', $links);
-  }
-
-  $form['show_taxonomy_block'][] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Current Blocks'),
-    '#value' => theme('item_list', $blocks),
-    );
-
-  return drupal_get_form('taxonomy_block_admin', $form);
-}
-
-/**
-* Returns the requested block by $bid.
-*/
-function taxonomy_block_get_block($bid) {
-  $tids = array();
-  $result = db_fetch_object(db_query('SELECT * FROM {taxonomy_block} WHERE bid = %d', $bid));
-  if ($result) {
-    if ($result->type == 'term') {
-      $tids = taxonomy_get_children($result->tid);
-      $tids[$result->tid] = $result->tid;
-    }
-    else {
-      $tids = taxonomy_get_children(0, $result->tid);
-    }
-
-    $nodes = db_query(db_rewrite_sql('SELECT DISTINCT(n.nid), n.title, r.body, n.sticky, n.created FROM {term_node} t INNER JOIN {node} n ON t.nid = n.nid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE t.tid IN (%s) AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC LIMIT %d'), implode(array_keys($tids), ','), $result->length);
-
-    $block['subject'] = $result->name;
-
-    while ($node = db_fetch_object($nodes)) {
-      if($result->teaser) {
-        $teaser = strip_tags(substr($node->body, 0, $result->teaser) . (strlen($node->body) > $result->teaser ? '...' : ''));
-      }
-      $items .= theme('taxonomy_block_list_item', $node, $teaser);
-    }
-    $content = theme('taxonomy_block_list', $items);
-
-    $content .= '<div class="more-link '. (($x % 2 == 1) ? 'even': 'odd') .'">';
-    $content .= l(t("more"), 'taxonomy/term/'. implode(array_keys($tids), '+'), array("title" => t("View all."))) .'</div>';
-    $block['content'] = $content;
-    return $block;
-  }
-  else {
-    return null;
-  }
-}
-
-/**
-* Returns an array of block descriptions for the block config page.
-*/
-function taxonomy_block_get_blocks() {
-  $results = db_query('SELECT * FROM {taxonomy_block}');
-  while ($block = db_fetch_object($results)) {
-    $blocks[$block->bid]['info'] = $block->description;
-  }
-  return $blocks;
-}
-
-/**
-* Returns a dropdown event taxonomy term input control.
-*/
-function _taxonomy_block_get_taxonomy_dropdown($tid = NULL) {
-  $vocabs = taxonomy_get_vocabularies();
-
-  $links[] = '';
-  foreach ($vocabs as $vocab) {
-    $links['v'.$vocab->vid] = $vocab->name;
-    $tree = taxonomy_get_tree($vocab->vid);
-    foreach ($tree as $term) {
-      $links[$term->tid] = $vocab->name .' - '. $term->name;
-    }
-  }
-
-  return array(
-    '#type' => 'select',
-    '#title' => t('Category'),
-    '#default_value' => $tid,
-    '#options' => $links,
-    '#description' => t('Select taxonomy type to display'),
-    '#required' => TRUE,
-    );
-}
-
-/**
- * Format a single item for a list.
- *
- * @ingroup themeable
- */
-function theme_taxonomy_block_list_item($node, $teaser) {
-  $output = '<li>' . l($node->title, 'node/'. $node->nid,  array('title'=>t("view {$node->title} in full") ));
-  if ($teaser) {
-    $output .= '<br/>' . $teaser;
-  }
-  $output .= '</li>';
-
-  return $output;
-}
-
-/**
- * Format the item list.
- *
- * @ingroup themeable
- */
-function theme_taxonomy_block_list($items) {
-  $output = '<div class="item-list"><ul>' . $items . '</ul></div>';
-
-  return $output;
-}
-?>
diff --git a/modules/throttle.module b/modules/throttle.module
deleted file mode 100644 (file)
index 8ee565e..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php
-// $Id: throttle.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Allows configuration of congestion control auto-throttle mechanism.
- */
-
-/**
- * Determine the current load on the site.
- *
- * Call the throttle_status() function from your own modules, themes, blocks,
- * etc. to determine the current throttle status. For example, in your theme
- * you might choose to disable pictures when your site is too busy (reducing
- * bandwidth), or in your modules you might choose to disable some complicated
- * logic when your site is too busy (reducing CPU utilization).
- *
- * @return
- *   0 or 1.  0 means that the throttle is currently disabled.  1 means that
- *   the throttle is currently enabled.  When the throttle is enabled, CPU
- *   and bandwidth intensive functionality should be disabled.
- */
-function throttle_status() {
-  return variable_get('throttle_level', 0);
-}
-
-/**
- * Implementation of hook_exit().
- *
- * Changes the current throttle level based on page hits.
- */
-function throttle_exit() {
-  // The following logic determines what the current throttle level should
-  //  be, and can be disabled by the admin.  If enabled, the mt_rand() function
-  //  returns a number between 0 and N, N being specified by the admin. If
-  //  0 is returned, the throttle logic is run, adding two additional database
-  //  queries.  Otherwise, the following logic is skipped.  This mechanism is
-  //  referred to in the admin page as the 'probability limiter', roughly
-  //  limiting throttle related database calls to 1 in N.
-  if (!mt_rand(0, variable_get('throttle_probability_limiter', 9))) {
-
-    // Count users with activity in the past n seconds, defined in user module
-    $time_period = variable_get('user_block_seconds_online', 2700);
-
-    $throttle = module_invoke('throttle', 'status');
-
-    if ($max_guests = variable_get('throttle_anonymous', 0)) {
-      $guests = db_result(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
-    }
-    else {
-      $guests = 0;
-    }
-    if ($max_users = variable_get('throttle_user', 0)) {
-      $users = db_result(db_query('SELECT COUNT(DISTINCT(uid)) AS count FROM {sessions} WHERE timestamp >= %d AND uid != 0', time() - $time_period));
-    }
-    else {
-      $users = 0;
-    }
-
-    // update the throttle status
-    $message = '';
-    if ($max_users && $users > $max_users) {
-      if (!$throttle) {
-        variable_set('throttle_level', 1);
-        $message = format_plural($users,
-                                 '1 user accessing site; throttle enabled.',
-                                 '%count users accessing site; throttle enabled.');
-      }
-    }
-    elseif ($max_guests && $guests > $max_guests) {
-      if (!$throttle) {
-        variable_set('throttle_level', 1);
-        $message = format_plural($guests,
-                                 '1 guest accessing site; throttle enabled.',
-                                 '%count guests accessing site; throttle enabled.');
-      }
-    }
-    else {
-      if ($throttle) {
-        variable_set('throttle_level', 0);
-        // Note: unorthodox format_plural() usage due to Gettext plural limitations.
-        $message = format_plural($users, '1 user', '%count users') .', ';
-        $message .= format_plural($guests, '1 guest accessing site; throttle disabled', '%count guests accessing site; throttle disabled');
-      }
-    }
-    if ($message) {
-      cache_clear_all();
-      watchdog('throttle', t('Throttle') .': '. $message);
-    }
-  }
-}
-
-function _throttle_validate($value, $form) {
-  if ($value != NULL) {
-    if (!is_numeric($value) || $value < 0) {
-      form_set_error($form, t("'%value' is not a valid auto-throttle setting.  Please enter a positive numeric value.", array('%value' => theme('placeholder', $value))));
-    }
-  }
-}
-
-/**
- * Implementation of hook_help().
- */
-function throttle_help($section) {
-  switch ($section) {
-    case 'admin/help#throttle':
-      $output = '<p>'. t('The throttle module provides a congestion control throttling mechanism for automatically detecting a surge in incoming traffic. If the site gets linked to by a popular website, or otherwise comes under a "Denial of Service" (DoS) attack, your webserver might become overwhelmed. This mechanism is utilized by other modules to automatically optimize their performance by temporarily disabling CPU-intensive functionality.  For example, in the site theme, you might choose to disable pictures when the site is too busy (reducing bandwidth), or in modules, you might choose to disable some complicated logic (reducing CPU utilization).') .'</p>';
-      $output .= '<p>'. t('The congestion control throttle can be automatically enabled when the number of anonymous or authenticated users currently visiting the site exceeds the specified threshold. ') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>enable throttle for modules at <a href="%admin-modules">administer &gt;&gt; module</a>.</li>
-<li>enable throttle for blocks at <a href="%admin-block">administer &gt;&gt; block</a>.</li>
-<li>administer throttle at <a href="%admin-settings-throttle">administer &gt;&gt; settings &gt;&gt; throttle</a>.</li>
-</ul>
-', array('%admin-modules' => url('admin/modules'), '%admin-block' => url('admin/block'), '%admin-settings-throttle' => url('admin/settings/throttle')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%throttle">Throttle page</a>.', array('%throttle' => 'http://drupal.org/handbook/modules/throttle/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Handles the auto-throttling mechanism, to control site congestion.');
-    case 'admin/settings/throttle':
-      return t('If your site gets linked to by a popular website, or otherwise comes under a "Denial of Service" (DoS) attack, your webserver might become overwhelmed.  This module provides a congestion control throttling mechanism for automatically detecting a surge in incoming traffic.  This mechanism is utilized by other Drupal modules to automatically optimize their performance by temporarily disabling CPU-intensive functionality.');
-  }
-}
-
-/**
- * Implementation of hook_settings().
- */
-function throttle_settings() {
-  _throttle_validate(variable_get('throttle_anonymous', ''), 'throttle_anonymous');
-  _throttle_validate(variable_get('throttle_user', ''), 'throttle_user');
-  $probabilities = array(0 => '100%', 1 => '50%', 2 => '33.3%', 3 => '25%', 4 => '20%', 5 => '16.6%', 7 => '12.5%', 9 => '10%', 19 => '5%', 99 => '1%', 199 => '.5%', 399 => '.25%', 989 => '.1%');
-
-  $form['throttle_anonymous'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Auto-throttle on anonymous users'),
-    '#default_value' => variable_get('throttle_anonymous', 0),
-    '#size' => 5,
-    '#maxlength' => 6,
-    '#description' => t('The congestion control throttle can be automatically enabled when the number of anonymous users currently visiting your site exceeds the specified threshold.  For example, to start the throttle when your site has 250 anonymous users online at once, enter \'250\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on anonymous users.  You can inspect the current number of anonymous users using the "Who\'s online" block.')
-  );
-  $form['throttle_user'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Auto-throttle on authenticated users'),
-    '#default_value' => variable_get('throttle_user', 0),
-    '#size' => 5,
-    '#maxlength' => 6,
-    '#description' => t('The congestion control throttle can be automatically enabled when the number of authenticated users currently visiting your site exceeds the specified threshold.  For example, to start the throttle when your site has 50 registered users online at once, enter \'50\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on authenticated users.  You can inspect the current number of authenticated users using the "Who\'s online" block.')
-  );
-  $form['throttle_probability_limiter'] = array(
-    '#type' => 'select',
-    '#title' => t('Auto-throttle probability limiter'),
-    '#default_value' => variable_get('throttle_probability_limiter', 9),
-    '#options' => $probabilities,
-    '#description' => t('The auto-throttle probability limiter is an efficiency mechanism to statistically reduce the overhead of the auto-throttle.  The limiter is expressed as a percentage of page views, so for example if set to the default of 10% we only perform the extra database queries to update the throttle status 1 out of every 10 page views.  The busier your site, the lower you should set the limiter value.')
-  );
-
-  return $form;
-}
diff --git a/modules/tracker.module b/modules/tracker.module
deleted file mode 100644 (file)
index 96bc8fd..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-// $Id: tracker.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables tracking of recent posts for users.
- */
-
-/**
- * Implementation of hook_help().
- */
-function tracker_help($section) {
-  switch ($section) {
-    case 'admin/help#tracker':
-      $output = '<p>'. t('The tracker module displays the most recently added or updated content to the website allowing users to see the most recent contributions.  The tracker module provides user level tracking for those who like to follow the contributions of particular authors.') .'</p>';
-      $output .= '<p>'. t('The  &quot;recent posts&quot; page is available via a link in the navigation menu block and contains a reverse chronological list of new and recently-updated content. The table displays  the content type, the title, the author\'s name, how many comments that item has received, and when it was last updated. Updates include any changes to the text, either by the original author or someone else, as well as any new comments added to an item.  To use the tracker module to <em>watch</em> for a user\'s updated content, click on that user\'s profile, then the <em>track</em> tab.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>view the <a href="%tracker">most recent posts</a>.</li>
-<li>view <a href="%profile">user profiles</a> and select the track tab.</li>
-<li>not administer this module.</li>
-</ul>
-', array('%tracker' => url('tracker'), '%profile' => url('profile')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%tracker">Tracker page</a>.', array('%tracker' => 'http://drupal.org/handbook/modules/tracker/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Enables tracking of recent posts for users.');
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function tracker_menu($may_cache) {
-  global $user;
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'tracker', 'title' => t('recent posts'),
-      'callback' => 'tracker_page', 'access' => user_access('access content'),
-      'weight' => 1);
-
-    if ($user->uid) {
-      $items[] = array('path' => 'tracker/all', 'title' => t('all recent posts'),
-        'type' => MENU_DEFAULT_LOCAL_TASK);
-      $items[] = array('path' => 'tracker/'. $user->uid, 'title' => t('my recent posts'),
-        'type' => MENU_LOCAL_TASK);
-    }
-  }
-  else {
-    if (arg(0) == 'user' && is_numeric(arg(1))) {
-      $items[] = array('path' => 'user/'. arg(1) .'/track', 'title' => t('track'),
-          'callback' => 'tracker_track_user', 'access' => user_access('access content'),
-          'type' => MENU_IS_LOCAL_TASK);
-      $items[] = array('path' => 'user/'. arg(1) .'/track/posts', 'title' => t('track posts'),
-          'type' => MENU_DEFAULT_LOCAL_TASK);
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Menu callback. Prints a listing of active nodes on the site.
- */
-function tracker_track_user() {
-  if ($account = user_load(array('uid' => arg(1)))) {
-    if ($account->status || user_access('administer users')) {
-      drupal_set_title($account->name);
-      return tracker_page($account->uid);
-    }
-    else {
-      drupal_access_denied();
-    }
-  }
-  else {
-    drupal_not_found();
-  }
-}
-
-/**
- * Menu callback. Prints a listing of active nodes on the site.
- */
-function tracker_page($uid = 0) {
-  if ($uid) {
-    $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, l.last_comment_timestamp AS last_post, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_post DESC';
-    $sql = db_rewrite_sql($sql);
-    $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d)';
-    $sql_count = db_rewrite_sql($sql_count);
-    $result = pager_query($sql, 25, 0, $sql_count, COMMENT_PUBLISHED, $uid, $uid);
-  }
-  else {
-    $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, l.last_comment_timestamp AS last_post, l.comment_count FROM {node} n INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 ORDER BY last_post DESC';
-    $sql = db_rewrite_sql($sql);
-    $sql_count = 'SELECT COUNT(n.nid) FROM {node} n WHERE n.status = 1';
-    $sql_count = db_rewrite_sql($sql_count);
-    $result = pager_query($sql, 25, 0, $sql_count);
-  }
-
-  while ($node = db_fetch_object($result)) {
-    // Determine the number of comments:
-    $comments = 0;
-    if (module_exist('comment') && $node->comment_count) {
-      $comments = $node->comment_count;
-
-      if ($new = comment_num_new($node->nid)) {
-        $comments .= '<br />';
-        $comments .= l(format_plural($new, '1 new', '%count new'), "node/$node->nid", NULL, NULL, 'new');
-      }
-    }
-
-    $rows[] = array(
-      node_get_name($node->type),
-      l($node->title, "node/$node->nid") .' '. theme('mark', node_mark($node->nid, $node->changed)),
-      theme('username', $node),
-      array('class' => 'replies', 'data' => $comments),
-      t('%time ago', array('%time' => format_interval(time() - $node->last_post)))
-    );
-  }
-
-  $header = array(t('Type'), t('Post'), t('Author'), t('Replies'), t('Last post'));
-
-  $output = '<div id="tracker">';
-  $output .= theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 25, 0);
-  $output .= '</div>';
-
-  return $output;
-}
diff --git a/modules/upload.module b/modules/upload.module
deleted file mode 100644 (file)
index f03d5f3..0000000
+++ /dev/null
@@ -1,756 +0,0 @@
-<?php
-// $Id: upload.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * File-handling and attaching files to nodes.
- *
- */
-
-/**
- * Implementation of hook_help().
- */
-function upload_help($section) {
-  switch ($section) {
-    case 'admin/help#upload':
-      $output = '<p>'. t('The upload module allows users to upload files to the site.  The ability to upload files to a site is important for members of a community who want to share work. It is also useful to administrators who want to keep uploaded files connected to a node or page.') .'</p>';
-      $output .= '<p>'. t('Users with the upload files permission can upload attachments. You can choose which post types can take attachments on the content types settings page.  Each user role can be customized for the file size of uploads, and the dimension of image files.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>administer user permissions at <a href="%admin-access">administer &gt;&gt; access control</a>.</li>
-<li>administer content at <a href="%admin-content-types">administer &gt;&gt; settings &gt;&gt; content types</a>.</li>
-<li>administer upload at <a href="%admin-upload">administer &gt;&gt; settings &gt;&gt; upload</a>.</li>
-</ul>
-', array('%admin-access' => url('admin/access'), '%admin-content-types' => url('admin/settings/content-types'), '%admin-upload' => url('admin/settings/upload')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%upload">Upload page</a>.', array('%upload' => 'http://drupal.org/handbook/modules/upload/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Allows users to upload and attach files to content.');
-    case 'admin/settings/upload':
-      return t('<p>Users with the <a href="%permissions">upload files permission</a> can upload attachments. Users with the <a href="%permissions">view uploaded files permission</a> can view uploaded attachments. You can choose which post types can take attachments on the <a href="%types">content types settings</a> page.</p>', array('%permissions' => url('admin/access'), '%types' => url('admin/settings/content-types')));
-  }
-}
-
-/**
- * Implementation of hook_perm().
- */
-function upload_perm() {
-  return array('upload files', 'view uploaded files');
-}
-
-/**
- * Implementation of hook_link().
- */
-function upload_link($type, $node = 0, $main = 0) {
-  $links = array();
-
-  // Display a link with the number of attachments
-  if ($main && $type == 'node' && isset($node->files) && user_access('view uploaded files')) {
-    $num_files = 0;
-    foreach ($node->files as $file) {
-      if ($file->list) {
-        $num_files++;
-      }
-    }
-    if ($num_files) {
-      $links[] = l(format_plural($num_files, '1 attachment', '%count attachments'), "node/$node->nid", array('title' => t('Read full article to view attachments.')), NULL, 'attachments');
-    }
-  }
-
-  return $links;
-}
-
-/**
- * Implementation of hook_menu().
- */
-function upload_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'upload/js',
-      'callback' => 'upload_js',
-      'access' => user_access('upload files'),
-      'type' => MENU_CALLBACK
-    );
-  }
-  else {
-    // Add handlers for previewing new uploads.
-    if (isset($_SESSION['file_previews'])) {
-      foreach ($_SESSION['file_previews'] as $fid => $file) {
-        $filename = file_create_filename($file->filename, file_create_path());
-        if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) ==  FILE_DOWNLOADS_PRIVATE) {
-          // strip file_directory_path() from filename. @see file_create_url
-          if (strpos($filename, file_directory_path()) !== false) {
-            $filename = trim(substr($filename, strlen(file_directory_path())), '\\/');
-          }
-          $filename = 'system/files/' . $filename;
-        }
-
-        $items[] = array(
-          'path' => $filename, 'title' => t('file download'),
-          'callback' => 'upload_download',
-          'access' => user_access('view uploaded files'),
-          'type' => MENU_CALLBACK
-        );
-        $_SESSION['file_previews'][$fid]->_filename = $filename;
-      }
-    }
-  }
-
-  return $items;
-}
-
-function upload_settings() {
-  $form['settings_general'] = array('#type' => 'fieldset', '#title' => t('General settings'));
-  $form['settings_general']['upload_max_resolution'] = array(
-    '#type' => 'textfield', '#title' => t('Maximum resolution for uploaded images'), '#default_value' => variable_get('upload_max_resolution', 0),
-    '#size' => 15, '#maxlength' => 10, '#description' => t('The maximum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Set to 0 for no restriction.')
-  );
-
-  $form['settings_general']['upload_list_default'] = array('#type' => 'select', '#title' => t('List files by default'),
-    '#default_value' => variable_get('upload_list_default',1),
-    '#options' => array( 0 => t('No'), 1 => t('Yes') ),
-    '#description' => t('Set whether files attached to nodes are listed or not in the node view by default.'),
-  );
-
-  $roles = user_roles(0, 'upload files');
-
-  foreach ($roles as $rid => $role) {
-    $form["settings_role_$rid"] = array('#type' => 'fieldset', '#title' => t('Settings for %role', array('%role' => theme('placeholder', $role))), '#collapsible' => TRUE, '#collapsed' => TRUE);
-    $form["settings_role_$rid"]["upload_extensions_$rid"] = array(
-      '#type' => 'textfield', '#title' => t('Permitted file extensions'), '#default_value' => variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps"),
-      '#maxlength' => 255, '#description' => t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.')
-    );
-    $form["settings_role_$rid"]["upload_uploadsize_$rid"] = array(
-      '#type' => 'textfield', '#title' => t('Maximum file size per upload'), '#default_value' => variable_get("upload_uploadsize_$rid", 1),
-      '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum size of a file a user can upload (in megabytes).')
-    );
-    $form["settings_role_$rid"]["upload_usersize_$rid"] = array(
-      '#type' => 'textfield', '#title' => t('Total file size per user'), '#default_value' => variable_get("upload_usersize_$rid", 10),
-      '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum size of all files a user can have on the site (in megabytes).')
-    );
-  }
-
-  return $form;
-}
-
-function upload_download() {
-  foreach ($_SESSION['file_previews'] as $file) {
-    if ($file->_filename == $_GET['q']) {
-      file_transfer($file->filepath, array('Content-Type: '. mime_header_encode($file->filemime), 'Content-Length: '. $file->filesize));
-    }
-  }
-}
-
-function upload_file_download($file) {
-  $file = file_create_path($file);
-  $result = db_query("SELECT f.* FROM {files} f WHERE filepath = '%s'", $file);
-  if ($file = db_fetch_object($result)) {
-    if (user_access('view uploaded files')) {
-      $node = node_load($file->nid);
-      if (node_access('view', $node)) {
-        $name = mime_header_encode($file->filename);
-        $type = mime_header_encode($file->filemime);
-        // Serve images and text inline for the browser to display rather than download.
-        $disposition = ereg('^(text/|image/)', $file->filemime) ? 'inline' : 'attachment';
-        return array(
-          'Content-Type: '. $type .'; name='. $name,
-          'Content-Length: '. $file->filesize,
-          'Content-Disposition: '. $disposition .'; filename='. $name
-        );
-      }
-      else {
-        return -1;
-      }
-    }
-    else {
-      return -1;
-    }
-  }
-}
-
-/**
- * Save new uploads and attach them to the node object.
- * append file_previews to the node object as well.
- */
-function _upload_prepare(&$node) {
-
-  // Clean up old file previews if a post didn't get the user to this page.
-  // i.e. the user left the edit page, because they didn't want to upload anything.
-  if(count($_POST) == 0) {
-    if (is_array($_SESSION['file_previews']) && count($_SESSION['file_previews'])) {
-      foreach($_SESSION['file_previews'] as $fid => $file) {
-        file_delete($file->filepath);
-      }
-      unset($_SESSION['file_previews']);
-    }
-  }
-
-  // $_SESSION['file_current_upload'] tracks the fid of the file submitted this page request.
-  // form_builder sets the value of file->list to 0 for checkboxes added to a form after
-  // it has been submitted. Since unchecked checkboxes have no return value and do not
-  // get a key in _POST form_builder has no way of knowing the difference between a check
-  // box that wasn't present on the last form build, and a checkbox that is unchecked.
-
-  unset($_SESSION['file_current_upload']);
-
-  global $user;
-
-  // Save new file uploads to tmp dir.
-  if (($file = file_check_upload()) && user_access('upload files')) {
-
-    // Scale image uploads.
-    $file = _upload_image($file);
-
-    $key = 'upload_'. count($_SESSION['file_previews']);
-    $file->fid = $key;
-    $file->source = $key;
-    $file->list = variable_get('upload_list_default',1);
-    $_SESSION['file_previews'][$key] = $file;
-
-    // Store the uploaded fid for this page request in case of submit without
-    // preview or attach. See earlier notes.
-    $_SESSION['file_current_upload'] = $key;
-  }
-
-  // Attach file previews to node object.
-  if (is_array($_SESSION['file_previews']) && count($_SESSION['file_previews'])) {
-    foreach($_SESSION['file_previews'] as $fid => $file) {
-      if ($user->uid != 1) {
-        // Here something.php.pps becomes something.php_.pps
-        $file->filename = upload_munge_filename($file->filename, NULL, 0);
-        $file->description = $file->filename;
-      }
-      $node->files[$fid] = $file;
-    }
-  }
-}
-
-function upload_form_alter($form_id, &$form) {
-  if (isset($form['type'])) {
-    if ($form['type']['#value'] .'_node_settings' == $form_id) {
-      $form['workflow']['upload_'. $form['type']['#value']] = array(
-        '#type' => 'radios', '#title' => t('Attachments'), '#default_value' => variable_get('upload_'. $form['type']['#value'], 1),
-        '#options' => array(t('Disabled'), t('Enabled')),
-      );
-    }
-
-    $node = $form['#node'];
-    if ($form['type']['#value'] .'_node_form' == $form_id && variable_get("upload_$node->type", TRUE) && user_access('upload files')) {
-      drupal_add_js('misc/progress.js');
-      drupal_add_js('misc/upload.js');
-
-      // Attachments fieldset
-      $form['attachments'] = array(
-        '#type' => 'fieldset',
-        '#title' => t('File attachments'),
-        '#collapsible' => TRUE,
-        '#collapsed' => empty($node->files),
-        '#description' => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'),
-        '#prefix' => '<div class="attachments">',
-        '#suffix' => '</div>',
-        '#weight' => 30,
-      );
-
-      // Wrapper for fieldset contents (used by upload JS).
-      $form['attachments']['wrapper'] = array(
-        '#prefix' => '<div id="attach-wrapper">',
-        '#suffix' => '</div>',
-      );
-      $form['attachments']['wrapper'] += _upload_form($node);
-      $form['#attributes']['enctype'] = 'multipart/form-data';
-    }
-  }
-}
-
-function _upload_validate(&$node) {
-  // Accumulator for disk space quotas.
-  $filesize = 0;
-
-  // Check if node->files exists, and if it contains something.
-  if (is_array($node->files)) {
-    // Update existing files with form data.
-    foreach($node->files as $fid => $file) {
-      // Convert file to object for compatibility
-      $file = (object)$file;
-
-      // Validate new uploads.
-      if (strpos($fid, 'upload') !== false && !$file->remove) {
-        global $user;
-
-        // Bypass validation for uid  = 1.
-        if ($user->uid != 1) {
-          // Update filesize accumulator.
-          $filesize += $file->filesize;
-
-          // Validate file against all users roles.
-          // Only denies an upload when all roles prevent it.
-
-          $total_usersize = upload_space_used($user->uid) + $filesize;
-          $error = array();
-          foreach ($user->roles as $rid => $name) {
-            $extensions = variable_get("upload_extensions_$rid", 'jpg jpeg gif png txt html doc xls pdf ppt pps');
-            $uploadsize = variable_get("upload_uploadsize_$rid", 1) * 1024 * 1024;
-            $usersize = variable_get("upload_usersize_$rid", 1) * 1024 * 1024;
-
-            $regex = '/\.('. ereg_replace(' +', '|', preg_quote($extensions)) .')$/i';
-
-            if (!preg_match($regex, $file->filename)) {
-              $error['extension']++;
-            }
-
-            if ($uploadsize && $file->filesize > $uploadsize) {
-              $error['uploadsize']++;
-            }
-
-            if ($usersize && $total_usersize + $file->filesize > $usersize) {
-              $error['usersize']++;
-            }
-          }
-
-          $user_roles = count($user->roles);
-          $valid = TRUE;
-          if ($error['extension'] == $user_roles) {
-            form_set_error('upload', t('The selected file %name can not be attached to this post, because it is only possible to attach files with the following extensions: %files-allowed.', array('%name' => theme('placeholder', $file->filename), '%files-allowed' => theme('placeholder', $extensions))));
-            $valid = FALSE;
-          }
-          elseif ($error['uploadsize'] == $user_roles) {
-            form_set_error('upload', t('The selected file %name can not be attached to this post, because it exceeded the maximum filesize of %maxsize.', array('%name' => theme('placeholder', $file->filename), '%maxsize' => theme('placeholder', format_size($uploadsize)))));
-            $valid = FALSE;
-          }
-          elseif ($error['usersize'] == $user_roles) {
-            form_set_error('upload', t('The selected file %name can not be attached to this post, because the disk quota of %quota has been reached.', array('%name' => theme('placeholder', $file->filename), '%quota' => theme('placeholder', format_size($usersize)))));
-            $valid = FALSE;
-          }
-          elseif (strlen($file->filename) > 255) {
-            form_set_error('upload', t('The selected file %name can not be attached to this post, because the filename is too long.', array('%name' => theme('placeholder', $file->filename))));
-            $valid = FALSE;
-          }
-
-          if (!$valid) {
-            unset($node->files[$fid], $_SESSION['file_previews'][$fid]);
-            file_delete($file->filepath);
-          }
-        }
-      }
-    }
-  }
-}
-
-/**
- * Implementation of hook_nodeapi().
- */
-function upload_nodeapi(&$node, $op, $teaser) {
-  switch ($op) {
-
-    case 'load':
-      $output = '';
-      if (variable_get("upload_$node->type", 1) == 1) {
-        $output['files'] = upload_load($node);
-        return $output;
-      }
-      break;
-
-    case 'prepare':
-      _upload_prepare($node);
-      break;
-
-    case 'validate':
-      _upload_validate($node);
-      break;
-
-    case 'view':
-      if (isset($node->files) && user_access('view uploaded files')) {
-        // Manipulate so that inline references work in preview
-        if (!variable_get('clean_url', 0)) {
-          $previews = array();
-          foreach ($node->files as $file) {
-            if (strpos($file->fid, 'upload') !== false) {
-              $previews[] = $file;
-            }
-          }
-
-          // URLs to files being previewed are actually Drupal paths. When Clean
-          // URLs are disabled, the two do not match. We perform an automatic
-          // replacement from temporary to permanent URLs. That way, the author
-          // can use the final URL in the body before having actually saved (to
-          // place inline images for example).
-          foreach ($previews as $file) {
-            $old = file_create_filename($file->filename, file_create_path());
-            $new = url($old);
-            $node->body = str_replace($old, $new, $node->body);
-            $node->teaser = str_replace($old, $new, $node->teaser);
-          }
-        }
-
-        // Add the attachments list to node body
-        if (count($node->files) && !$teaser) {
-          $node->body .= theme('upload_attachments', $node->files);
-        }
-      }
-      break;
-
-    case 'insert':
-    case 'update':
-      if (user_access('upload files')) {
-        upload_save($node);
-      }
-      break;
-
-    case 'delete':
-      upload_delete($node);
-      break;
-
-    case 'delete revision':
-      upload_delete_revision($node);
-      break;
-
-    case 'search result':
-      return is_array($node->files) ? format_plural(count($node->files), '1 attachment', '%count attachments') : null;
-
-    case 'rss item':
-      if (is_array($node->files)) {
-        $files = array();
-        foreach ($node->files as $file) {
-          if ($file->list) {
-            $files[] = $file;
-          }
-        }
-        if (count($files) > 0) {
-          // RSS only allows one enclosure per item
-          $file = array_shift($files);
-          return array(
-            array(
-              'key' => 'enclosure',
-              'attributes' => array(
-                'url' => file_create_url($file->filepath),
-                'length' => $file->filesize,
-                'type' => $file->filemime
-              )
-            )
-          );
-        }
-      }
-      return array();
-  }
-}
-
-/**
- * Displays file attachments in table
- */
-function theme_upload_attachments($files) {
-  $header = array(t('Attachment'), t('Size'));
-  $rows = array();
-  foreach ($files as $file) {
-    if ($file->list) {
-      $href = check_url(($file->fid ? file_create_url($file->filepath) : url(file_create_filename($file->filename, file_create_path()))));
-      $text = check_plain($file->description ? $file->description : $file->filename);
-      $rows[] = array(l($text, $href), format_size($file->filesize));
-    }
-  }
-  if (count($rows)) {
-    return theme('table', $header, $rows, array('id' => 'attachments'));
-  }
-}
-
-/**
- * Determine how much disk space is occupied by a user's uploaded files.
- *
- * @param $uid
- *   The integer user id of a user.
- * @return
- *   The amount of disk space used by the user in bytes.
- */
-function upload_space_used($uid) {
-  return db_result(db_query('SELECT SUM(filesize) FROM {files} f INNER JOIN {node} n ON f.nid = n.nid WHERE n.uid = %d', $uid));
-}
-
-/**
- * Determine how much disk space is occupied by uploaded files.
- *
- * @return
- *   The amount of disk space used by uploaded files in bytes.
- */
-function upload_total_space_used() {
-  return db_result(db_query('SELECT SUM(filesize) FROM {files}'));
-}
-
-/**
- * Munge the filename as needed for security purposes.
- *
- * @param $filename
- *   The name of a file to modify.
- * @param $extensions
- *   A space separated list of valid extensions. If this is blank, we'll use
- *   the admin-defined defaults for the user role from upload_extensions_$rid.
- * @param $alerts
- *   Whether alerts (watchdog, drupal_set_message()) should be displayed.
- * @return $filename
- *   The potentially modified $filename.
- */
-function upload_munge_filename($filename, $extensions = NULL, $alerts = 1) {
-  global $user;
-
-  $original = $filename;
-
-  // Allow potentially insecure uploads for very savvy users and admin
-  if (!variable_get('allow_insecure_uploads', 0)) {
-
-    if (!isset($extensions)) {
-      $extensions = '';
-      foreach ($user->roles as $rid => $name) {
-        $extensions .= ' '. variable_get("upload_extensions_$rid", variable_get('upload_extensions_default', 'jpg jpeg gif png txt html doc xls pdf ppt pps'));
-      }
-
-    }
-
-    $whitelist = array_unique(explode(' ', trim($extensions)));
-
-    $filename_parts = explode('.', $filename);
-
-    $new_filename = array_shift($filename_parts); // Remove file basename.
-    $final_extension = array_pop($filename_parts); // Remove final extension.
-
-    foreach($filename_parts as $filename_part) {
-      $new_filename .= ".$filename_part";
-      if (!in_array($filename_part, $whitelist) && preg_match("/^[a-zA-Z]{2,5}\d?$/", $filename_part)) {
-        $new_filename .= '_';
-      }
-    }
-    $filename = "$new_filename.$final_extension";
-  }
-
-  if ($alerts && $original != $filename) {
-    $message = t('Your filename has been renamed to conform to site policy.');
-    drupal_set_message($message);
-  }
-
-  return $filename;
-}
-
-/**
- * Undo the effect of upload_munge_filename().
- */
-function upload_unmunge_filename($filename) {
-  return str_replace('_.', '.', $filename);
-}
-
-function upload_save($node) {
-  if (!is_array($node->files)) {
-    return;
-  }
-
-  foreach ($node->files as $fid => $file) {
-    // Convert file to object for compatibility
-    $file = (object)$file;
-
-    // Remove file. Process removals first since no further processing
-    // will be required.
-    if ($file->remove) {
-      // Remove file previews...
-      if (strpos($file->fid, 'upload') !== false) {
-        file_delete($file->filepath);
-      }
-
-      // Remove managed files.
-      else {
-        db_query('DELETE FROM {file_revisions} WHERE fid = %d AND vid = %d', $fid, $node->vid);
-        // Only delete a file if it isn't used by any revision
-        $count = db_result(db_query('SELECT COUNT(fid) FROM {file_revisions} WHERE fid = %d', $fid));
-        if ($count < 1) {
-          db_query('DELETE FROM {files} WHERE fid = %d', $fid);
-          file_delete($file->filepath);
-        }
-      }
-    }
-
-    // New file upload
-    elseif (strpos($file->fid, 'upload') !== false) {
-      if ($file = file_save_upload($file, $file->filename)) {
-        $file->fid = db_next_id('{files}_fid');
-        db_query("INSERT INTO {files} (fid, nid, filename, filepath, filemime, filesize) VALUES (%d, %d, '%s', '%s', '%s', %d)", $file->fid, $node->nid, $file->filename, $file->filepath, $file->filemime, $file->filesize);
-        db_query("INSERT INTO {file_revisions} (fid, vid, list, description) VALUES (%d, %d, %d, '%s')", $file->fid, $node->vid, $file->list, $file->description);
-      }
-      unset($_SESSION['file_previews'][$fid]);
-    }
-
-    // Create a new revision, as needed
-    elseif ($node->old_vid && is_numeric($fid)) {
-      db_query("INSERT INTO {file_revisions} (fid, vid, list, description) VALUES (%d, %d, %d, '%s')", $file->fid, $node->vid, $file->list, $file->description);
-    }
-
-    // Update existing revision
-    else {
-      db_query("UPDATE {file_revisions} SET list = %d, description = '%s' WHERE fid = %d AND vid = %d", $file->list, $file->description, $file->fid, $node->vid);
-    }
-  }
-}
-
-function upload_delete($node) {
-  $files = array();
-  $result = db_query('SELECT * FROM {files} WHERE nid = %d', $node->nid);
-  while ($file = db_fetch_object($result)) {
-    $files[$file->fid] = $file;
-  }
-
-  foreach ($files as $fid => $file) {
-    // Delete all file revision information associated with the node
-    db_query('DELETE FROM {file_revisions} WHERE fid = %d', $fid);
-    file_delete($file->filepath);
-  }
-
-  // Delete all files associated with the node
-  db_query('DELETE FROM {files} WHERE nid = %d', $node->nid);
-}
-
-function upload_delete_revision($node) {
-  if (is_array($node->files)) {
-    foreach ($node->files as $file) {
-      // Check if the file will be used after this revision is deleted
-      $count = db_result(db_query('SELECT COUNT(fid) FROM {file_revisions} WHERE fid = %d', $file->fid));
-
-      // if the file won't be used, delete it
-      if ($count < 2) {
-        db_query('DELETE FROM {files} WHERE fid = %d', $file->fid);
-        file_delete($file->filepath);
-      }
-    }
-  }
-
-  // delete the revision
-  db_query('DELETE FROM {file_revisions} WHERE vid = %d', $node->vid);
-}
-
-function _upload_form($node) {
-
-  $form['#theme'] = 'upload_form_new';
-
-  if (is_array($node->files) && count($node->files)) {
-    $form['files']['#theme'] = 'upload_form_current';
-    $form['files']['#tree'] = TRUE;
-    foreach ($node->files as $key => $file) {
-      $description = file_create_url((strpos($file->fid, 'upload') === false ? $file->filepath : file_create_filename($file->filename, file_create_path())));
-      $description = "<small>". check_plain($description) ."</small>";
-      $form['files'][$key]['description'] = array('#type' => 'textfield', '#default_value' => (strlen($file->description)) ? $file->description : $file->filename, '#maxlength' => 256, '#description' => $description );
-
-      $form['files'][$key]['size'] = array('#type' => 'markup', '#value' => format_size($file->filesize));
-      $form['files'][$key]['remove'] = array('#type' => 'checkbox', '#default_value' => $file->remove);
-      $form['files'][$key]['list'] = array('#type' => 'checkbox',  '#default_value' => $file->list);
-      // if the file was uploaded this page request, set value. this fixes the problem
-      // formapi has recognizing new checkboxes. see comments in _upload_prepare.
-      if ($_SESSION['file_current_upload'] == $file->fid) {
-        $form['files'][$key]['list']['#value'] = variable_get('upload_list_default',1);
-      }
-      $form['files'][$key]['filename'] = array('#type' => 'value',  '#value' => $file->filename);
-      $form['files'][$key]['filepath'] = array('#type' => 'value',  '#value' => $file->filepath);
-      $form['files'][$key]['filemime'] = array('#type' => 'value',  '#value' => $file->filemime);
-      $form['files'][$key]['filesize'] = array('#type' => 'value',  '#value' => $file->filesize);
-      $form['files'][$key]['fid'] = array('#type' => 'value',  '#value' => $file->fid);
-    }
-  }
-
-  if (user_access('upload files')) {
-    // This div is hidden when the user uploads through JS.
-    $form['new'] = array(
-      '#prefix' => '<div id="attach-hide">',
-      '#suffix' => '</div>',
-    );
-    $form['new']['upload'] = array('#type' => 'file', '#title' => t('Attach new file'), '#size' => 40);
-    $form['new']['attach'] = array('#type' => 'button', '#value' => t('Attach'), '#name'=> 'attach', '#attributes' => array('id' => 'attach'));
-    // The class triggers the js upload behaviour.
-    $form['attach'] = array('#type' => 'hidden', '#value' => url('upload/js', NULL, NULL, TRUE), '#attributes' => array('class' => 'upload'));
-  }
-
-  // Needed for JS
-  $form['current']['vid'] = array('#type' => 'hidden', '#value' => $node->vid);
-  return $form;
-}
-
-/**
- * Theme the attachments list.
- */
-function theme_upload_form_current(&$form) {
-  $header = array(t('Delete'), t('List'), t('Description'), t('Size'));
-
-  foreach (element_children($form) as $key) {
-    $row = array();
-    $row[] = form_render($form[$key]['remove']);
-    $row[] = form_render($form[$key]['list']);
-    $row[] = form_render($form[$key]['description']);
-    $row[] = form_render($form[$key]['size']);
-    $rows[] = $row;
-  }
-  $output = theme('table', $header, $rows);
-  $output .= form_render($form);
-  return $output;
-}
-
-/**
- * Theme the attachment form.
- * Note: required to output prefix/suffix.
- */
-function theme_upload_form_new($form) {
-  $output = form_render($form);
-  return $output;
-}
-
-function upload_load($node) {
-  $files = array();
-
-  if ($node->vid) {
-    $result = db_query('SELECT * FROM {files} f INNER JOIN {file_revisions} r ON f.fid = r.fid WHERE r.vid = %d ORDER BY f.fid', $node->vid);
-    while ($file = db_fetch_object($result)) {
-      $files[$file->fid] = $file;
-    }
-  }
-
-  return $files;
-}
-
-/**
- * Check an upload, if it is an image, make sure it fits within the
- * maximum dimensions allowed.
- */
-function _upload_image($file) {
-  $info = image_get_info($file->filepath);
-
-  if ($info) {
-    list($width, $height) = explode('x', variable_get('upload_max_resolution', 0));
-    if ($width && $height) {
-      $result = image_scale($file->filepath, $file->filepath, $width, $height);
-      if ($result) {
-        $file->filesize = filesize($file->filepath);
-        drupal_set_message(t('The image was resized to fit within the maximum allowed resolution of %resolution pixels.', array('%resolution' => theme('placeholder', variable_get('upload_max_resolution', 0)))));
-      }
-    }
-  }
-
-  return $file;
-}
-
-/**
- * Menu-callback for JavaScript-based uploads.
- */
-function upload_js() {
-  // We only do the upload.module part of the node validation process.
-  $node = (object)$_POST['edit'];
-
-  // Load existing node files.
-  $node->files = upload_load($node);
-
-  // Handle new uploads, and merge tmp files into node-files.
-  _upload_prepare($node);
-  _upload_validate($node);
-
-  $form = _upload_form($node);
-  foreach (module_implements('form_alter') as $module) {
-    $function = $module .'_form_alter';
-    $function('upload_js', $form);
-  }
-  $form = form_builder('upload_js', $form);
-  $output = theme('status_messages') . form_render($form);
-  // We send the updated file attachments form.
-  print drupal_to_js(array('status' => TRUE, 'data' => $output));
-  exit;
-}
diff --git a/modules/user.module b/modules/user.module
deleted file mode 100644 (file)
index fe3a7a3..0000000
+++ /dev/null
@@ -1,2134 +0,0 @@
-<?php
-// $Id: user.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Enables the user registration and login system.
- */
-
-/**
- * Invokes hook_user() in every module.
- *
- * We cannot use module_invoke() for this, because the arguments need to
- * be passed by reference.
- */
-function user_module_invoke($type, &$array, &$user, $category = NULL) {
-  foreach (module_list() as $module) {
-    $function = $module .'_user';
-    if (function_exists($function)) {
-      $function($type, $array, $user, $category);
-    }
-  }
-}
-
-function user_external_load($authname) {
-  $result = db_query("SELECT uid FROM {authmap} WHERE authname = '%s'", $authname);
-
-  if ($user = db_fetch_object($result)) {
-    return user_load($user);
-  }
-  else {
-    return 0;
-  }
-}
-
-/**
- * Fetch a user object.
- *
- * @param $array
- *   An associative array of attributes to search for in selecting the
- *   user, such as user name or e-mail address.
- *
- * @return
- *   A fully-loaded $user object upon successful user load or FALSE if user cannot be loaded.
- */
-function user_load($array = array()) {
-  // Dynamically compose a SQL query:
-  $query = array();
-  $params = array();
-
-  foreach ($array as $key => $value) {
-    if ($key == 'uid' || $key == 'status') {
-      $query[] = "$key = %d";
-      $params[] = $value;
-    }
-    else if ($key == 'pass') {
-      $query[] = "pass = '%s'";
-      $params[] = md5($value);
-    }
-    else {
-      $query[]= "LOWER($key) = LOWER('%s')";
-      $params[] = $value;
-    }
-  }
-  $result = db_query('SELECT * FROM {users} u WHERE ' . implode(' AND ', $query), $params);
-
-  if (db_num_rows($result)) {
-    $user = db_fetch_object($result);
-    $user = drupal_unpack($user);
-
-    $user->roles = array();
-    if ($user->uid) {
-      $user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user';
-    }
-    else {
-      $user->roles[DRUPAL_ANONYMOUS_RID] = 'anonymous user';
-    }
-    $result = db_query('SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d', $user->uid);
-    while ($role = db_fetch_object($result)) {
-      $user->roles[$role->rid] = $role->name;
-    }
-    user_module_invoke('load', $array, $user);
-  }
-  else {
-    $user = FALSE;
-  }
-
-  return $user;
-}
-
-/**
- * Save changes to a user account or add a new user.
- *
- * @param $account
- *   The $user object for the user to modify or add. If $user->uid is
- *   omitted, a new user will be added.
- *
- * @param $array
- *   An array of fields and values to save. For example array('name' => 'My name');
- *   Setting a field to null deletes it from the data column.
- *
- * @param $category
- *   (optional) The category for storing profile information in.
- */
-function user_save($account, $array = array(), $category = 'account') {
-  // Dynamically compose a SQL query:
-  $user_fields = user_fields();
-  if ($account->uid) {
-    user_module_invoke('update', $array, $account, $category);
-
-    $data = unserialize(db_result(db_query('SELECT data FROM {users} WHERE uid = %d', $account->uid)));
-    foreach ($array as $key => $value) {
-      if ($key == 'pass' && !empty($value)) {
-        $query .= "$key = '%s', ";
-        $v[] = md5($value);
-      }
-      else if ((substr($key, 0, 4) !== 'auth') && ($key != 'pass')) {
-        if (in_array($key, $user_fields)) {
-          // Save standard fields
-          $query .= "$key = '%s', ";
-          $v[] = $value;
-        }
-        else if ($key != 'roles') {
-          // Roles is a special case: it used below.
-          if ($value === null) {
-            unset($data[$key]);
-          }
-          else {
-            $data[$key] = $value;
-          }
-        }
-      }
-    }
-    $query .= "data = '%s' ";
-    $v[] = serialize($data);
-
-    db_query("UPDATE {users} SET $query WHERE uid = %d", array_merge($v, array($account->uid)));
-
-    // Reload user roles if provided
-    if (is_array($array['roles'])) {
-      db_query('DELETE FROM {users_roles} WHERE uid = %d', $account->uid);
-
-      foreach (array_keys($array['roles']) as $rid) {
-        if (!in_array($rid, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) {
-          db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $account->uid, $rid);
-        }
-      }
-    }
-
-    // Delete a blocked user's sessions to kick them if they are online.
-    if (isset($array['status']) && $array['status'] == 0) {
-      db_query('DELETE FROM {sessions} WHERE uid = %d', $account->uid);
-    }
-
-    // Refresh user object
-    $user = user_load(array('uid' => $account->uid));
-  }
-  else {
-    $array['created'] = time();
-    $array['uid'] = db_next_id('{users}_uid');
-
-    // Note, we wait with saving the data column to prevent module-handled
-    // fields from being saved there. We cannot invoke hook_user('insert') here
-    // because we don't have a fully initialized user object yet.
-    foreach ($array as $key => $value) {
-      switch($key) {
-        case 'pass':
-          $fields[] = $key;
-          $values[] = md5($value);
-          $s[] = "'%s'";
-          break;
-        case 'uid':        case 'mode':     case 'sort':
-        case 'threshold':  case 'created':  case 'access':
-        case 'login':      case 'status':
-          $fields[] = $key;
-          $values[] = $value;
-          $s[] = "%d";
-          break;
-        default:
-          if (substr($key, 0, 4) !== 'auth' && in_array($key, $user_fields)) {
-            $fields[] = $key;
-            $values[] = $value;
-            $s[] = "'%s'";
-          }
-          break;
-      }
-    }
-    db_query('INSERT INTO {users} ('. implode(', ', $fields) .') VALUES ('. implode(', ', $s) .')', $values);
-
-    // Reload user roles (delete just to be safe).
-    db_query('DELETE FROM {users_roles} WHERE uid = %d', $array['uid']);
-    foreach ((array)$array['roles'] as $rid) {
-      if (!in_array($rid, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) {
-        db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $array['uid'], $rid);
-      }
-    }
-
-    // Build the initial user object.
-    $user = user_load(array('uid' => $array['uid']));
-
-    user_module_invoke('insert', $array, $user, $category);
-
-    // Build and save the serialized data field now
-    $data = array();
-    foreach ($array as $key => $value) {
-      if ((substr($key, 0, 4) !== 'auth') && ($key != 'roles') && (!in_array($key, $user_fields)) && ($value !== null)) {
-        $data[$key] = $value;
-      }
-    }
-    db_query("UPDATE {users} SET data = '%s' WHERE uid = %d", serialize($data), $user->uid);
-
-    // Build the finished user object.
-    $user = user_load(array('uid' => $array['uid']));
-  }
-
-  // Save distributed authentication mappings
-  $authmaps = array();
-  foreach ($array as $key => $value) {
-    if (substr($key, 0, 4) == 'auth') {
-      $authmaps[$key] = $value;
-    }
-  }
-  if (sizeof($authmaps) > 0) {
-    user_set_authmaps($user, $authmaps);
-  }
-
-  return $user;
-}
-
-/**
- * Verify the syntax of the given name.
- */
-function user_validate_name($name) {
-  if (!strlen($name)) return t('You must enter a username.');
-  if (substr($name, 0, 1) == ' ') return t('The username cannot begin with a space.');
-  if (substr($name, -1) == ' ') return t('The username cannot end with a space.');
-  if (ereg('  ', $name)) return t('The username cannot contain multiple spaces in a row.');
-  if (ereg("[^\x80-\xF7 [:alnum:]@_.-]", $name)) return t('The username contains an illegal character.');
-  if (preg_match('/[\x{80}-\x{A0}'.          // Non-printable ISO-8859-1 + NBSP
-                   '\x{AD}'.                 // Soft-hyphen
-                   '\x{2000}-\x{200F}'.      // Various space characters
-                   '\x{2028}-\x{202F}'.      // Bidirectional text overrides
-                   '\x{205F}-\x{206F}'.      // Various text hinting characters
-                   '\x{FEFF}'.               // Byte order mark
-                   '\x{FF01}-\x{FF60}'.      // Full-width latin
-                   '\x{FFF9}-\x{FFFD}]/u',   // Replacement characters
-                   $name)) {
-    return t('The username contains an illegal character.');
-  }
-  if (ereg('@', $name) && !eregi('@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$', $name)) return t('The username is not a valid authentication ID.');
-  if (strlen($name) > 56) return t('The username %name is too long: it must be less than 56 characters.', array('%name' => theme('placeholder', $name)));
-}
-
-function user_validate_mail($mail) {
-  if (!$mail) return t('You must enter an e-mail address.');
-  if (!valid_email_address($mail)) {
-    return t('The e-mail address %mail is not valid.', array('%mail' => theme('placeholder', $mail)));
-  }
-}
-
-function user_validate_picture($file, &$edit, $user) {
-  global $form_values;
-  // Initialize the picture:
-  $form_values['picture'] = $user->picture;
-
-  // Check that uploaded file is an image, with a maximum file size
-  // and maximum height/width.
-  $info = image_get_info($file->filepath);
-  list($maxwidth, $maxheight) = explode('x', variable_get('user_picture_dimensions', '85x85'));
-
-  if (!$info || !$info['extension']) {
-    form_set_error('picture_upload', t('The uploaded file was not an image.'));
-  }
-  else if (image_get_toolkit()) {
-    image_scale($file->filepath, $file->filepath, $maxwidth, $maxheight);
-  }
-  else if (filesize($file->filepath) > (variable_get('user_picture_file_size', '30') * 1000)) {
-    form_set_error('picture_upload', t('The uploaded image is too large; the maximum file size is %size kB.', array('%size' => variable_get('user_picture_file_size', '30'))));
-  }
-  else if ($info['width'] > $maxwidth || $info['height'] > $maxheight) {
-    form_set_error('picture_upload', t('The uploaded image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'))));
-  }
-
-  if (!form_get_errors()) {
-    if ($file = file_save_upload('picture_upload', variable_get('user_picture_path', 'pictures') .'/picture-'. $user->uid . '.' . $info['extension'], 1)) {
-      $form_values['picture'] = $file->filepath;
-    }
-    else {
-      form_set_error('picture_upload', t("Failed to upload the picture image; the %directory directory doesn't exist.", array('%directory' => '<em>'. variable_get('user_picture_path', 'pictures') .'</em>')));
-    }
-  }
-}
-
-/**
- * Generate a random alphanumeric password.
- */
-function user_password($length = 10) {
-  // This variable contains the list of allowable characters for the
-  // password.  Note that the number 0 and the letter 'O' have been
-  // removed to avoid confusion between the two.  The same is true
-  // of 'I', 1, and l.
-  $allowable_characters = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789';
-
-  // Zero-based count of characters in the allowable list:
-  $len = strlen($allowable_characters) - 1;
-
-  // Declare the password as a blank string.
-  $pass = '';
-
-  // Loop the number of times specified by $length.
-  for ($i = 0; $i < $length; $i++) {
-
-    // Each iteration, pick a random character from the
-    // allowable string and append it to the password:
-    $pass .= $allowable_characters[mt_rand(0, $len)];
-  }
-
-  return $pass;
-}
-
-/**
- * Determine whether the user has a given privilege.
- *
- * @param $string
- *   The permission, such as "administer nodes", being checked for.
- * @param $account
- *   (optional) The account to check, if not given use currently logged in user.
- *
- * @return
- *   boolean TRUE if the current user has the requested permission.
- *
- * All permission checks in Drupal should go through this function. This
- * way, we guarantee consistent behavior, and ensure that the superuser
- * can perform all actions.
- */
-function user_access($string, $account = NULL) {
-  global $user;
-  static $perm = array();
-
-  if (is_null($account)) {
-    $account = $user;
-  }
-
-  // User #1 has all privileges:
-  if ($account->uid == 1) {
-    return TRUE;
-  }
-
-  // To reduce the number of SQL queries, we cache the user's permissions
-  // in a static variable.
-  if (!isset($perm[$account->uid])) {
-    $result = db_query("SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN (%s)", implode(',', array_keys($account->roles)));
-
-    $perm[$account->uid] = '';
-    while ($row = db_fetch_object($result)) {
-      $perm[$account->uid] .= "$row->perm, ";
-    }
-  }
-
-  if (isset($perm[$account->uid])) {
-    return strpos($perm[$account->uid], "$string, ") !== FALSE;
-  }
-
-  return FALSE;
-}
-
-/**
- * Checks for usernames blocked by user administration
- *
- * @return boolean true for blocked users, false for active
- */
-function user_is_blocked($name) {
-  $allow = db_fetch_object(db_query("SELECT * FROM {users} WHERE status = 1 AND name = LOWER('%s')", $name));
-  $deny  = db_fetch_object(db_query("SELECT * FROM {users} WHERE status = 0 AND name = LOWER('%s')", $name));
-
-  return $deny && !$allow;
-}
-
-/**
- * Send an e-mail message, using Drupal variables and default settings.
- * More information in the <a href="http://php.net/manual/en/function.mail.php">PHP function reference for mail()</a>
- * @param $mail
- *  The mail adres or addresses where the message will be send to. The
- *  formatting of this string must comply with RFC 2822. Some examples are:
- *    user@example.com
- *    user@example.com, anotheruser@example.com
- *    User <user@example.com>
- *    User <user@example.com>, Another User <anotheruser@example.com>
- *  @param $subject
- *    Subject of the email to be sent. This must not contain any newline characters, or the mail may not be sent properly.
- *  @param $message
- *    Message to be sent. Drupal will format the correct line endings for you.
- *  @param $header
- *    String to be inserted at the end of the email header. This is typically
- *    used to add extra headers (From, Cc, and Bcc). Multiple extra headers
- *    should be separated with a CRLF (\r\n).
- *    <em>When sending mail, the mail must contain a From header.</em>
- * @return Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.
- */
-function user_mail($mail, $subject, $message, $header) {
-  if (variable_get('smtp_library', '') && file_exists(variable_get('smtp_library', ''))) {
-   include_once './' . variable_get('smtp_library', '');
-    return user_mail_wrapper($mail, $subject, $message, $header);
-  }
-  else {
-    /*
-    ** Note: if you are having problems with sending mail, or mails look wrong
-    ** when they are received you may have to modify the str_replace to suit
-    ** your systems.
-    **  - \r\n will work under dos and windows.
-    **  - \n will work for linux, unix and BSDs.
-    **  - \r will work for macs.
-    **
-    ** According to RFC 2646, it's quite rude to not wrap your e-mails:
-    **
-    ** "The Text/Plain media type is the lowest common denominator of
-    ** Internet e-mail, with lines of no more than 997 characters (by
-    ** convention usually no more than 80), and where the CRLF sequence
-    ** represents a line break [MIME-IMT]."
-    **
-    ** CRLF === \r\n
-    **
-    ** http://www.rfc-editor.org/rfc/rfc2646.txt
-    **
-    */
-    return mail(
-      $mail,
-      mime_header_encode($subject),
-      str_replace("\r", '', $message),
-      "MIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8; format=flowed\nContent-transfer-encoding: 8Bit\n" . $header
-    );
-  }
-}
-
-function user_fields() {
-  static $fields;
-
-  if (!$fields) {
-    $result = db_query('SELECT * FROM {users} WHERE uid = 1');
-    if (db_num_rows($result)) {
-      $fields = array_keys(db_fetch_array($result));
-    }
-    else {
-      // Make sure we return the default fields at least
-      $fields = array('uid', 'name', 'pass', 'mail', 'picture', 'mode', 'sort', 'threshold', 'theme', 'signature', 'created', 'access', 'login', 'status', 'timezone', 'language', 'init', 'data');
-    }
-  }
-
-  return $fields;
-}
-
-/**
- * Implementation of hook_perm().
- */
-function user_perm() {
-  return array('administer access control', 'administer users', 'access user profiles', 'change own username');
-}
-
-/**
- * Implementation of hook_file_download().
- *
- * Ensure that user pictures (avatars) are always downloadable.
- */
-function user_file_download($file) {
-  if (strpos($file, variable_get('user_picture_path', 'pictures') .'/picture-') === 0) {
-    $info = image_get_info(file_create_path($file));
-    return array('Content-type: '. $info['mime_type']);
-  }
-}
-
-/**
- * Implementation of hook_search().
- */
-function user_search($op = 'search', $keys = null) {
-  switch ($op) {
-    case 'name':
-      if (user_access('access user profiles')) {
-        return t('users');
-      }
-    case 'search':
-      if (user_access('access user profiles')) {
-        $find = array();
-        // Replace wildcards with MySQL/PostgreSQL wildcards.
-        $keys = preg_replace('!\*+!', '%', $keys);
-        $result = pager_query("SELECT * FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys);
-        while ($account = db_fetch_object($result)) {
-          $find[] = array('title' => $account->name, 'link' => url('user/'. $account->uid));
-        }
-        return $find;
-      }
-  }
-}
-
-/**
- * Implementation of hook_user().
- */
-function user_user($type, &$edit, &$user, $category = NULL) {
-  if ($type == 'view') {
-    $items[] = array('title' => t('Member for'),
-      'value' => format_interval(time() - $user->created),
-      'class' => 'member',
-    );
-
-    return array(t('History') => $items);
-  }
-  if ($type == 'form' && $category == 'account') {
-    return user_edit_form(arg(1), $edit);
-  }
-
-  if ($type == 'validate' && $category == 'account') {
-    return _user_edit_validate(arg(1), $edit);
-  }
-
-  if ($type == 'submit' && $category == 'account') {
-    return _user_edit_submit(arg(1), $edit);
-  }
-
-  if ($type == 'categories') {
-    return array(array('name' => 'account', 'title' => t('account settings'), 'weight' => 1));
-  }
-}
-
-/**
- * Implementation of hook_block().
- */
-function user_block($op = 'list', $delta = 0, $edit = array()) {
-  global $user;
-
-  if ($op == 'list') {
-     $blocks[0]['info'] = t('User login');
-     $blocks[1]['info'] = t('Navigation');
-     $blocks[2]['info'] = t('Who\'s new');
-     $blocks[3]['info'] = t('Who\'s online');
-
-     return $blocks;
-  }
-  else if ($op == 'configure' && $delta == 3) {
-    $period = drupal_map_assoc(array(30, 60, 120, 180, 300, 600, 900, 1800, 2700, 3600, 5400, 7200, 10800, 21600, 43200, 86400), 'format_interval');
-    $form['user_block_seconds_online'] = array('#type' => 'select', '#title' => t('User activity'), '#default_value' => variable_get('user_block_seconds_online', 900), '#options' => $period, '#description' => t('A user is considered online for this long after they have last viewed a page.'));
-    $form['user_block_max_list_count'] = array('#type' => 'select', '#title' => t('User list length'), '#default_value' => variable_get('user_block_max_list_count', 10), '#options' => drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100)), '#description' => t('Maximum number of currently online users to display.'));
-
-    return $form;
-  }
-  else if ($op == 'save' && $delta == 3) {
-    variable_set('user_block_seconds_online', $edit['user_block_seconds_online']);
-    variable_set('user_block_max_list_count', $edit['user_block_max_list_count']);
-  }
-  else if ($op == 'view') {
-    $block = array();
-
-    switch ($delta) {
-      case 0:
-        // For usability's sake, avoid showing two login forms on one page.
-        if (!$user->uid && !(arg(0) == 'user' && !is_numeric(arg(1)))) {
-          // Unset the time, if any. This prevents a 404 if a user relogs in
-          // on the page they were sent to when they logged out. See
-          // user_login_submit() for explanation of the time parameter.
-          unset($_GET['time']);
-          $form['#action'] = url($_GET['q'], drupal_get_destination());
-          $form['#id'] = 'user-login-form';
-          $form['name'] = array('#type' => 'textfield',
-            '#title' => t('Username'),
-            '#maxlength' => 60,
-            '#size' => 15,
-            '#required' => TRUE,
-          );
-          $form['pass'] = array('#type' => 'password',
-            '#title' => t('Password'),
-            '#size' => 15,
-            '#required' => TRUE,
-          );
-          $form['submit'] = array('#type' => 'submit',
-            '#value' => t('Log in'),
-          );
-
-          if (variable_get('user_register', 1)) {
-            $items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.')));
-          }
-          $items[] = l(t('Request new password'), 'user/password', array('title' => t('Request new password via e-mail.')));
-          $form['links'] = array('#value' => theme('item_list', $items));
-
-          $block['subject'] = t('User login');
-          $block['content'] = drupal_get_form('user_login_block', $form, 'user_login');
-        }
-        return $block;
-
-      case 1:
-        if ($menu = theme('menu_tree')) {
-           $block['subject'] = $user->uid ? $user->name : t('Navigation');
-           $block['content'] = $menu;
-        }
-        return $block;
-
-      case 2:
-        if (user_access('access content')) {
-          // Retrieve a list of new users who have subsequently accessed the site successfully.
-          $result = db_query_range('SELECT uid, name FROM {users} WHERE status != 0 AND access != 0 ORDER BY created DESC', 0, 5);
-          while ($account = db_fetch_object($result)) {
-            $items[] = $account;
-          }
-          $output = theme('user_list', $items);
-
-          $block['subject'] = t('Who\'s new');
-          $block['content'] = $output;
-        }
-        return $block;
-
-      case 3:
-        if (user_access('access content')) {
-          // Count users with activity in the past defined period.
-          $time_period = variable_get('user_block_seconds_online', 900);
-
-          // Perform database queries to gather online user lists.
-          $guests = db_fetch_object(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
-          $users = db_query('SELECT uid, name, access FROM {users} WHERE access >= %d AND uid != 0 ORDER BY access DESC', time() - $time_period);
-          $total_users = db_num_rows($users);
-
-          // Format the output with proper grammar.
-          if ($total_users == 1 && $guests->count == 1) {
-            $output = t('There is currently %members and %visitors online.', array('%members' => format_plural($total_users, '1 user', '%count users'), '%visitors' => format_plural($guests->count, '1 guest', '%count guests')));
-          }
-          else {
-            $output = t('There are currently %members and %visitors online.', array('%members' => format_plural($total_users, '1 user', '%count users'), '%visitors' => format_plural($guests->count, '1 guest', '%count guests')));
-          }
-
-          // Display a list of currently online users.
-          $max_users = variable_get('user_block_max_list_count', 10);
-          if ($total_users && $max_users) {
-            $items = array();
-
-            while ($max_users-- && $account = db_fetch_object($users)) {
-              $items[] = $account;
-            }
-
-            $output .= theme('user_list', $items, t('Online users'));
-          }
-
-          $block['subject'] = t('Who\'s online');
-          $block['content'] = $output;
-        }
-        return $block;
-    }
-  }
-}
-
-function theme_user_picture($account) {
-  if (variable_get('user_pictures', 0)) {
-    if ($account->picture && file_exists($account->picture)) {
-      $picture = file_create_url($account->picture);
-    }
-    else if (variable_get('user_picture_default', '')) {
-      $picture = variable_get('user_picture_default', '');
-    }
-
-    if (isset($picture)) {
-      $alt = t('%user\'s picture', array('%user' => $account->name ? $account->name : variable_get('anonymous', 'Anonymous')));
-      $picture = theme('image', $picture, $alt, $alt, '', false);
-      if (!empty($account->uid) && user_access('access user profiles')) {
-        $picture = l($picture, "user/$account->uid", array('title' => t('View user profile.')), NULL, NULL, FALSE, TRUE);
-      }
-
-      return "<div class=\"picture\">$picture</div>";
-    }
-  }
-}
-
-/**
- * Theme a user page
- * @param $account the user object
- * @param $fields a multidimensional array for the fields, in the form of array (
- *   'category1' => array(item_array1, item_array2), 'category2' => array(item_array3,
- *    .. etc.). Item arrays are formatted as array(array('title' => 'item title',
- * 'value' => 'item value', 'class' => 'class-name'), ... etc.). Module names are incorporated
- * into the CSS class.
- *
- * @ingroup themeable
- */
-function theme_user_profile($account, $fields) {
-  $output = '<div class="profile">';
-  $output .= theme('user_picture', $account);
-  foreach ($fields as $category => $items) {
-    if (strlen($category) > 0) {
-      $output .= '<h2 class="title">'. $category .'</h2>';
-    }
-    $output .= '<dl>';
-    foreach ($items as $item) {
-      if (isset($item['title'])) {
-        $output .= '<dt class="'. $item['class'] .'">'. $item['title'] .'</dt>';
-      }
-      $output .= '<dd class="'. $item['class'] .'">'. $item['value'] .'</dd>';
-    }
-    $output .= '</dl>';
-  }
-  $output .= '</div>';
-
-  return $output;
-}
-
-/**
- * Make a list of users.
- * @param $items an array with user objects. Should contain at least the name and uid
- *
- * @ingroup themeable
- */
-function theme_user_list($users, $title = NULL) {
-  if (!empty($users)) {
-    foreach ($users as $user) {
-      $items[] = theme('username', $user);
-    }
-  }
-  return theme('item_list', $items, $title);
-}
-
-/**
- * Implementation of hook_menu().
- */
-function user_menu($may_cache) {
-  global $user;
-
-  $items = array();
-
-  $admin_access = user_access('administer users');
-  $access_access = user_access('administer access control');
-  $view_access = user_access('access user profiles');
-
-  if ($may_cache) {
-    $items[] = array('path' => 'user', 'title' => t('user account'),
-      'callback' => 'user_login', 'access' => TRUE, 'type' => MENU_CALLBACK);
-
-    $items[] = array('path' => 'user/autocomplete', 'title' => t('user autocomplete'),
-      'callback' => 'user_autocomplete', 'access' => $view_access, 'type' => MENU_CALLBACK);
-
-    // Registration and login pages.
-    $items[] = array('path' => 'user/login', 'title' => t('log in'),
-      'callback' => 'user_login', 'type' => MENU_DEFAULT_LOCAL_TASK);
-    $items[] = array('path' => 'user/register', 'title' => t('register'),
-      'callback' => 'user_register', 'access' => $user->uid == 0 && variable_get('user_register', 1), 'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'user/password', 'title' => t('request new password'),
-      'callback' => 'user_pass', 'access' => $user->uid == 0, 'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'user/reset', 'title' => t('reset password'),
-      'callback' => 'user_pass_reset', 'access' => TRUE, 'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'user/help', 'title' => t('help'),
-      'callback' => 'user_help_page', 'type' => MENU_CALLBACK);
-
-    // Admin user pages
-    $items[] = array('path' => 'admin/user', 'title' => t('users'),
-      'callback' => 'user_admin', 'access' => $admin_access);
-    $items[] = array('path' => 'admin/user/list', 'title' => t('list'),
-      'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-    $items[] = array('path' => 'admin/user/create', 'title' => t('add user'),
-      'callback' => 'user_admin', 'access' => $admin_access,
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/settings/user', 'title' => t('users'),
-      'callback' => 'user_configure');
-
-    // Admin access pages
-    $items[] = array('path' => 'admin/access', 'title' => t('access control'),
-      'callback' => 'user_admin_perm', 'access' => $access_access);
-    $items[] = array('path' => 'admin/access/permissions', 'title' => t('permissions'),
-      'callback' => 'user_admin_perm', 'access' => $access_access,
-      'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-    $items[] = array('path' => 'admin/access/roles', 'title' => t('roles'),
-      'callback' => 'user_admin_role', 'access' => $access_access,
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/access/roles/edit', 'title' => t('edit role'),
-      'callback' => 'user_admin_role', 'access' => $access_access,
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/access/rules', 'title' => t('access rules'),
-      'callback' => 'user_admin_access', 'access' => $access_access,
-      'type' => MENU_LOCAL_TASK, 'weight' => 10);
-    $items[] = array('path' => 'admin/access/rules/list', 'title' => t('list'),
-      'access' => $access_access, 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-    $items[] = array('path' => 'admin/access/rules/add', 'title' => t('add rule'),
-      'callback' => 'user_admin_access_add', 'access' => $access_access,
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/access/rules/check', 'title' => t('check rules'),
-      'callback' => 'user_admin_access_check', 'access' => $access_access,
-      'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/access/rules/edit', 'title' => t('edit rule'),
-      'callback' => 'user_admin_access_edit', 'access' => $access_access,
-      'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'admin/access/rules/delete', 'title' => t('delete rule'),
-      'callback' => 'user_admin_access_delete', 'access' => $access_access,
-      'type' => MENU_CALLBACK);
-
-    if (module_exist('search')) {
-      $items[] = array('path' => 'admin/user/search', 'title' => t('search'),
-        'callback' => 'user_admin', 'access' => $admin_access,
-        'type' => MENU_LOCAL_TASK);
-    }
-
-    // Your personal page
-    if ($user->uid) {
-      $items[] = array('path' => 'user/'. $user->uid, 'title' => t('my account'),
-        'callback' => 'user_view', 'callback arguments' => array(arg(1)), 'access' => TRUE,
-        'type' => MENU_DYNAMIC_ITEM);
-    }
-
-    $items[] = array('path' => 'logout', 'title' => t('log out'),
-      'access' => $user->uid != 0,
-      'callback' => 'user_logout',
-      'weight' => 10);
-  }
-  else {
-    if (arg(0) == 'user' && is_numeric(arg(1)) && arg(1) > 0) {
-      $account = user_load(array('uid' => arg(1)));
-
-      if ($user !== FALSE) {
-        // Always let a user view their own account
-        $view_access |= $user->uid == arg(1);
-        // Only admins can view blocked accounts
-        $view_access &= $account->status || $admin_access;
-
-        $items[] = array('path' => 'user/'. arg(1), 'title' => t('user'),
-          'type' => MENU_CALLBACK, 'callback' => 'user_view',
-          'callback arguments' => array(arg(1)), 'access' => $view_access);
-
-        $items[] = array('path' => 'user/'. arg(1) .'/view', 'title' => t('view'),
-          'access' => $view_access, 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-
-        $items[] = array('path' => 'user/'. arg(1) .'/edit', 'title' => t('edit'),
-          'callback' => 'user_edit', 'access' => $admin_access || $user->uid == arg(1),
-          'type' => MENU_LOCAL_TASK);
-        $items[] = array('path' => 'user/'. arg(1) .'/delete', 'title' => t('delete'),
-          'callback' => 'user_edit', 'access' => $admin_access,
-          'type' => MENU_CALLBACK);
-
-        if (arg(2) == 'edit') {
-          if (($categories = _user_categories($account)) && (count($categories) > 1)) {
-            foreach ($categories as $key => $category) {
-              $items[] = array(
-                'path' => 'user/'. arg(1) .'/edit/'. $category['name'],
-                'title' => $category['title'],
-                'type' => $category['name'] == 'account' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
-                'weight' => $category['weight'],
-                'access' => ($admin_access || $user->uid == arg(1)));
-            }
-          }
-        }
-      }
-    }
-  }
-
-  return $items;
-}
-
-/**
- * Accepts an user object, $account, or a DA name and returns an associative
- * array of modules and DA names. Called at external login.
- */
-function user_get_authmaps($authname = NULL) {
-  $result = db_query("SELECT authname, module FROM {authmap} WHERE authname = '%s'", $authname);
-  if (db_num_rows($result) > 0) {
-    while ($authmap = db_fetch_object($result)) {
-      $authmaps[$authmap->module] = $authmap->authname;
-    }
-    return $authmaps;
-  }
-  else {
-    return 0;
-  }
-}
-
-function user_set_authmaps($account, $authmaps) {
-  foreach ($authmaps as $key => $value) {
-    $module = explode('_', $key, 2);
-    if ($value) {
-      db_query("UPDATE {authmap} SET authname = '%s' WHERE uid = %d AND module = '%s'", $value, $account->uid, $module['1']);
-      if (!db_affected_rows()) {
-        db_query("INSERT INTO {authmap} (authname, uid, module) VALUES ('%s', %d, '%s')", $value, $account->uid, $module[1]);
-      }
-    }
-    else {
-      db_query("DELETE FROM {authmap} WHERE uid = %d AND module = '%s'", $account->uid, $module['1']);
-    }
-  }
-}
-
-function user_auth_help_links() {
-  $links = array();
-  foreach (module_list() as $module) {
-    if (module_hook($module, 'auth')) {
-      $links[] = l(module_invoke($module, 'info', 'name'), "user/help#$module");
-    }
-  }
-  return $links;
-}
-
-/*** User features *********************************************************/
-
-
-
-function user_login($msg = '') {
-  global $user, $base_url;
-
-  // If we are already logged on, go to the user
-  // page instead. The added time prevents caching.
-  if ($user->uid) {
-    drupal_goto('user/'. $user->uid, 'time='. time());
-  }
-
-  // Display login form:
-  if ($msg) {
-    $form['message'] = array('#value' => '<p>'. check_plain($msg) .'</p>');
-  }
-  unset($_GET['time']);
-  $form['#action'] = url($_GET['q'], drupal_get_destination());
-  $form['name'] = array('#type' => 'textfield',
-    '#title' => t('Username'),
-    '#size' => 30,
-    '#maxlength' => 60,
-    '#required' => TRUE,
-    '#attributes' => array('tabindex' => '1'),
-  );
-  if (variable_get('drupal_authentication_service', FALSE) && count(user_auth_help_links()) > 0) {
-    $form['name']['#description'] = t('Enter your %s username, or an ID from one of our affiliates: %a.', array('%s' => variable_get('site_name', 'local'), '%a' => implode(', ', user_auth_help_links())));
-  }
-  else {
-    $form['name']['#description'] = t('Enter your %s username.', array('%s' => variable_get('site_name', 'local')));
-  }
-  $form['pass'] = array('#type' => 'password',
-    '#title' => t('Password'),
-    '#description' => t('Enter the password that accompanies your username.'),
-    '#required' => TRUE,
-    '#attributes' => array('tabindex' => '2'),
-  );
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'), '#weight' => 2, '#attributes' => array('tabindex' => '3'));
-  return drupal_get_form('user_login', $form);
-}
-
-function user_login_validate($form_id, $form_values) {
-  if ($form_values['name']) {
-    if (user_is_blocked($form_values['name'])) {
-      // blocked in user administration
-      form_set_error('login', t('The username %name has not been activated or is blocked.', array('%name' => theme('placeholder', $form_values['name']))));
-    }
-    else if (drupal_is_denied('user', $form_values['name'])) {
-      // denied by access controls
-      form_set_error('login', t('The name %name is a reserved username.', array('%name' => theme('placeholder', $form_values['name']))));
-    }
-    else if ($form_values['pass']) {
-      $user = user_authenticate($form_values['name'], trim($form_values['pass']));
-
-      if (!$user->uid) {
-        form_set_error('login', t('Sorry. Unrecognized username or password.') .' '. l(t('Have you forgotten your password?'), 'user/password'));
-        watchdog('user', t('Login attempt failed for %user.', array('%user' => theme('placeholder', $form_values['name']))));
-      }
-    }
-  }
-}
-
-function user_login_submit($form_id, $form_values) {
-  global $user;
-  if ($user->uid) {
-    // To handle the edge case where this function is called during a
-    // bootstrap, check for the existence of t().
-    if (function_exists('t')) {
-      $message = t('Session opened for %name.', array('%name' => theme('placeholder', $user->name)));
-    }
-    else {
-       $message = "Session opened for ". check_plain($user->name);
-    }
-    watchdog('user', $message);
-
-    // Update the user table timestamp noting user has logged in.
-    db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $user->uid);
-
-    user_module_invoke('login', $form_values, $user);
-
-    $old_session_id = session_id();
-    session_regenerate_id();
-    db_query("UPDATE {sessions} SET sid = '%s' WHERE sid = '%s'", session_id(), $old_session_id);
-
-    // Create a timestamped final URL so that browsers don't return the user to
-    // a cached page (where it would appear as if they never logged in or out).
-    return array($_REQUEST['destination'], 'time='. time());
-  }
-}
-
-function user_authenticate($name, $pass) {
-  global $user;
-
-  // Try to log in the user locally. Don't set $user unless successful.
-  if ($account = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1))) {
-    $user = $account;
-  }
-
-  // Strip name and server from ID:
-  if ($server = strrchr($name, '@')) {
-    $name = substr($name, 0, strlen($name) - strlen($server));
-    $server = substr($server, 1);
-  }
-
-  // When possible, determine corresponding external auth source. Invoke
-  // source, and log in user if successful:
-  if (!$user->uid && $server && $result = user_get_authmaps("$name@$server")) {
-    if (module_invoke(key($result), 'auth', $name, $pass, $server)) {
-      $user = user_external_load("$name@$server");
-      watchdog('user', t('External load by %user using module %module.', array('%user' => theme('placeholder', $name .'@'. $server), '%module' => theme('placeholder', key($result)))));
-    }
-    else {
-      $error = t('Invalid password for %s.', array('%s' => theme('placeholder', $name .'@'. $server)));
-    }
-  }
-
-  // Try each external authentication source in series. Register user if
-  // successful.
-  else if (!$user->uid && $server) {
-    foreach (module_list() as $module) {
-      if (module_hook($module, 'auth')) {
-        if (module_invoke($module, 'auth', $name, $pass, $server)) {
-          if (variable_get('user_register', 1) == 1) {
-            $account = user_load(array('name' => "$name@$server"));
-            if (!$account->uid) { // Register this new user.
-              $user = user_save('', array('name' => "$name@$server", 'pass' => user_password(), 'init' => "$name@$server", 'status' => 1, "authname_$module" => "$name@$server"));
-              watchdog('user', t('New external user: %user using module %module.', array('%user' => theme('placeholder', $name .'@'. $server), '%module' => theme('placeholder', $module))), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit'));
-              break;
-            }
-          }
-        }
-      }
-    }
-  }
-  return $user;
-}
-
-/**
- * Menu callback; logs the current user out, and redirects to the home page.
- */
-function user_logout() {
-  global $user;
-
-  watchdog('user', t('Session closed for %name.', array('%name' => theme('placeholder', $user->name))));
-
-  // Destroy the current session:
-  session_destroy();
-  module_invoke_all('user', 'logout', NULL, $user);
-
-  // We have to use $GLOBALS to unset a global variable:
-  $user = user_load(array('uid' => 0));
-
-  // The time prevents caching.
-  drupal_goto(NULL, 'time='. time());
-}
-
-function user_pass() {
-
-  // Display form:
-  $form['name'] = array('#type' => 'textfield',
-    '#title' => t('Username'),
-    '#size' => 30,
-    '#maxlength' => 60,
-  );
-  $form['mail'] = array('#type' => 'textfield',
-    '#title' => t('E-mail address'),
-    '#size' => 30,
-    '#maxlength' => 64,
-  );
-  $form['submit'] = array('#type' => 'submit',
-    '#value' => t('E-mail new password'),
-    '#weight' => 2,
-  );
-  return drupal_get_form('user_pass', $form);
-}
-
-function user_pass_validate() {
-  global $form_values;
-
-  $name = $form_values['name'];
-  $mail = $form_values['mail'];
-  if ($name && !($form_values['account'] = user_load(array('name' => $name, 'status' => 1)))) {
-    form_set_error('name', t('Sorry. The username %name is not recognized.', array('%name' => theme('placeholder', $name))));
-  }
-  else if ($mail && !($form_values['account'] = user_load(array('mail' => $mail, 'status' => 1)))) {
-    form_set_error('mail', t('Sorry. The e-mail address %email is not recognized.', array('%email' => theme('placeholder', $mail))));
-  }
-  else if (!$mail && !$name) {
-    form_set_error('password', t('You must provide either a username or e-mail address.'));
-  }
-}
-
-function user_pass_submit($form_id, $form_values) {
-  global $base_url;
-
-  $account = $form_values['account'];
-  $from = variable_get('site_mail', ini_get('sendmail_from'));
-
-  // Mail one time login URL and instructions.
-  $variables = array('%username' => $account->name, '%site' => variable_get('site_name', 'drupal'), '%login_url' => user_pass_reset_url($account), '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $account->mail, '%date' => format_date(time()), '%login_uri' => url('user', NULL, NULL, TRUE), '%edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE));
-  $subject = _user_mail_text('pass_subject', $variables);
-  $body = _user_mail_text('pass_body', $variables);
-  $headers = "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from";
-  $mail_success = user_mail($account->mail, $subject, $body, $headers);
-
-  if ($mail_success) {
-    watchdog('user', t('Password reset instructions mailed to %name at %email.', array('%name' => '<em>'. $account->name .'</em>', '%email' => '<em>'. $account->mail .'</em>')));
-    drupal_set_message(t('Further instructions have been sent to your e-mail address.'));
-  }
-  else {
-    watchdog('user', t('Error mailing password reset instructions to %name at %email.', array('%name' => theme('placeholder', $account->name), '%email' => theme('placeholder', $account->mail))), WATCHDOG_ERROR);
-    drupal_set_message(t('Unable to send mail. Please contact the site admin.'));
-  }
-  return 'user';
-}
-
-function theme_user_pass($form) {
-  $output = '<p>'. t('Enter your username <strong><em>or</em></strong> your e-mail address.') .'</p>';
-  $output .= form_render($form);
-  return $output;
-}
-
-/**
- * Menu callback; process one time login link and redirects to the user page on success.
- */
-function user_pass_reset($uid, $timestamp, $hashed_pass, $action = NULL) {
-  global $user;
-
-  // Check if the user is already logged in. The back button is often the culprit here.
-  if ($user->uid) {
-    drupal_set_message(t('You have already used this one-time login link. It is not necessary to use this link to login anymore. You are already logged in.'));
-    drupal_goto();
-  }
-  else {
-    // Time out, in seconds, until login URL expires. 24 hours = 86400 seconds.
-    $timeout = 86400;
-    $current = time();
-    // Some redundant checks for extra security ?
-    if ($timestamp < $current && $account = user_load(array('uid' => $uid, 'status' => 1)) ) {
-      // No time out for first time login.
-      if ($account->login && $current - $timestamp > $timeout) {
-        drupal_set_message(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'));
-        drupal_goto('user/password');
-      }
-      else if ($account->uid && $timestamp > $account->login && $timestamp < $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
-        // First stage is a confirmation form, then login
-        if ($action == 'login') {
-          watchdog('user', t('User %name used one-time login link at time %timestamp.', array('%name' => "<em>$account->name</em>", '%timestamp' => $timestamp)));
-          // Update the user table noting user has logged in.
-          // And this also makes this hashed password a one-time-only login.
-          db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $account->uid);
-          // Now we can set the new user.
-          $user = $account;
-          // And proceed with normal login, going to user page.
-          user_module_invoke('login', $edit, $user);
-          drupal_set_message(t('You have just used your one-time login link. It is no longer necessary to use this link to login. Please change your password.'));
-          drupal_goto('user/'. $user->uid .'/edit');
-        }
-        else {
-          $form['message'] = array('#value' => t('<p>This is a one-time login for %user_name and will expire on %expiration_date</p><p>Click on this button to login to the site and change your password.</p>', array('%user_name' => theme('placeholder',$account->name), '%expiration_date' => format_date($timestamp + $timeout))));
-          $form['help'] = array('#value' => t('<p>This login can be used only once.</p>'));
-          $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'));
-          $form['#action'] = url("user/reset/$uid/$timestamp/$hashed_pass/login");
-          return drupal_get_form('user_pass_reset', $form);
-        }
-      }
-      else {
-        drupal_set_message(t('You have tried to use a one-time login link which has either been used or is no longer valid. Please request a new one using the form below.'));
-        drupal_goto('user/password');
-      }
-    }
-    else {
-      // Deny access, no more clues.
-      // Everything will be in the watchdog's URL for the administrator to check.
-      drupal_access_denied();
-    }
-  }
-}
-
-function user_pass_reset_url($account) {
-  $timestamp = time();
-  return url("user/reset/$account->uid/$timestamp/".user_pass_rehash($account->pass, $timestamp, $account->login), NULL, NULL, TRUE);
-}
-
-function user_pass_rehash($password, $timestamp, $login) {
-  return md5($timestamp . $password . $login);
-}
-
-function user_register() {
-  global $user;
-
-  $admin = user_access('administer users');
-
-  // If we aren't admin but already logged on, go to the
-  // user page instead. The added time prevents caching.
-  if (!$admin && $user->uid) {
-    drupal_goto('user/'. $user->uid, 'time='. time());
-  }
-
-  // Display the registration form.
-  if (!$admin) {
-    $form['user_registration_help'] = array('#type' => 'markup', '#value' => filter_xss_admin(variable_get('user_registration_help', '')));
-  }
-  $affiliates = user_auth_help_links();
-  if (!$admin && count($affiliates) > 0) {
-    $affiliates = implode(', ', $affiliates);
-    $form['affiliates'] = array('#type' => 'markup', '#value' => '<p>'. t('Note: if you have an account with one of our affiliates (%s), you may <a href="%login_uri">login now</a> instead of registering.', array('%s' => $affiliates, '%login_uri' => url('user'))) .'</p>');
-  }
-  $form['name'] = array('#type' => 'textfield',
-    '#title' => t('Username'),
-    '#size' => 30,
-    '#maxlength' => 60,
-    '#description' => t('Your full name or your preferred username; only letters, numbers and spaces are allowed.'),
-    '#required' => TRUE);
-  $form['mail'] = array('#type' => 'textfield',
-    '#title' => t('E-mail address'),
-    '#size' => 30,
-    '#maxlength' => 64,
-    '#description' => t('A password and instructions will be sent to this e-mail address, so make sure it is accurate.'),
-    '#required' => TRUE,
-  );
-  if ($admin) {
-    $form['pass'] = array('#type' => 'password',
-      '#title' => t('Password'),
-      '#size' => 30,
-      '#description' => t('Provide a password for the new account.'),
-      '#required' => TRUE,
-    );
-    $form['notify'] = array(
-     '#type' => 'checkbox',
-     '#title' => t('Notify user of new account')
-    );
-  }
-  $extra = _user_forms($null, $null, $null, 'register');
-
-  // Only display form_group around default fields if there are other groups.
-  if ($extra) {
-    $form['account'] = array('#type' => 'fieldset', '#title' => t('Account information'));
-    $form['account']['name'] = $form['name'];
-    $form['account']['mail'] = $form['mail'];
-    $form['account']['pass'] = $form['pass'];
-    $form['account']['notify'] = $form['notify'];
-    unset($form['name'], $form['mail'], $form['pass'], $form['notify']);
-    $form = array_merge($form, $extra);
-  }
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Create new account'), '#weight' => 30);
-
-  return drupal_get_form('user_register', $form);
-}
-
-function user_register_validate($form_id, $form_values) {
-  user_module_invoke('validate', $form_values, $form_values, 'account');
-}
-
-function user_register_submit($form_id, $form_values) {
-  global $base_url;
-
-  $admin = user_access('administer users');
-
-  $mail = $form_values['mail'];
-  $name = $form_values['name'];
-  $pass = $admin ? $form_values['pass'] : user_password();
-  $notify = $form_values['notify'];
-  $from = variable_get('site_mail', ini_get('sendmail_from'));
-
-  if (!$admin && array_intersect(array_keys($form_values), array('uid', 'roles', 'init', 'session', 'status'))) {
-    watchdog('security', t('Detected malicious attempt to alter protected user fields.'), WATCHDOG_WARNING);
-    return 'user/register';
-  }
-
-  $account = user_save('', array_merge($form_values, array('pass' => $pass, 'init' => $mail, 'status' => ($admin || variable_get('user_register', 1) == 1))));
-  watchdog('user', t('New user: %name %email.', array('%name' => theme('placeholder', $name), '%email' => theme('placeholder', '<'. $mail .'>'))), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $account->uid .'/edit'));
-
-  $variables = array('%username' => $name, '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $mail, '%date' => format_date(time()), '%login_uri' => url('user', NULL, NULL, TRUE), '%edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE), '%login_url' => user_pass_reset_url($account));
-
-  // The first user may login immediately, and receives a customized welcome e-mail.
-  if ($account->uid == 1) {
-    user_mail($mail, t('Drupal user account details for %s', array('%s' => $name)), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n  username: %username\n  password: %password\n\n%edit_uri\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
-    drupal_set_message(t('<p>Welcome to Drupal. You are user #1, which gives you full and immediate access.  All future registrants will receive their passwords via e-mail, so please make sure your website e-mail address is set properly under the general settings on the <a href="%settings">settings page</a>.</p><p> Your password is <strong>%pass</strong>. You may change your password below.</p>', array('%pass' => $pass, '%settings' => url('admin/settings'))));
-    user_authenticate($account->name, trim($pass));
-
-    // Set the installed schema version of the system module to the most recent version.
-    include_once './includes/install.inc';
-    drupal_set_installed_schema_version('system', max(drupal_get_schema_versions('system')));
-
-    return 'user/1/edit';
-  }
-  else {
-    if ($admin && !$notify) {
-      drupal_set_message(t('Created a new user account. No e-mail has been sent.'));
-
-      return 'admin/user';
-    }
-    else if ($account->status || $notify) {
-      // Create new user account, no administrator approval required.
-      $subject = $notify ? _user_mail_text('admin_subject', $variables) : _user_mail_text('welcome_subject', $variables);
-      $body = $notify ? _user_mail_text('admin_body', $variables) : _user_mail_text('welcome_body', $variables);
-
-      user_mail($mail, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
-
-      if ($notify) {
-        drupal_set_message(t('Password and further instructions have been e-mailed to the new user %user.', array('%user' => theme('placeholder', $name))));
-        return 'admin/user';
-      }
-      else {
-        drupal_set_message(t('Your password and further instructions have been sent to your e-mail address.'));
-        return '';
-      }
-    }
-    else {
-      // Create new user account, administrator approval required.
-      $subject = _user_mail_text('approval_subject', $variables);
-      $body = _user_mail_text('approval_body', $variables);
-
-      user_mail($mail, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
-      user_mail(variable_get('site_mail', ini_get('sendmail_from')), $subject, t("%u has applied for an account.\n\n%uri", array('%u' => $account->name, '%uri' => url("user/$account->uid/edit", NULL, NULL, TRUE))), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
-      drupal_set_message(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.<br />In the meantime, your password and further instructions have been sent to your e-mail address.'));
-
-    }
-  }
-}
-
-function user_edit_form($uid, $edit) {
-  // Account information:
-  $form['account'] = array('#type' => 'fieldset',
-    '#title' => t('Account information'),
-  );
-  if (user_access('change own username') || user_access('administer users')) {
-    $form['account']['name'] = array('#type' => 'textfield',
-      '#title' => t('Username'),
-      '#default_value' => $edit['name'],
-      '#maxlength' => 60,
-      '#description' => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'),
-      '#required' => TRUE,
-    );
-  }
-  $form['account']['mail'] = array('#type' => 'textfield',
-    '#title' => t('E-mail address'),
-    '#default_value' => $edit['mail'],
-    '#maxlength' => 64,
-    '#description' => t('Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'),
-    '#required' => TRUE,
-  );
-  $form['account']['pass'] = array('#type' => 'password_confirm',
-    '#title' => t('Password'),
-    '#description' => t('To change the current user password, enter the new password in both fields.'),
-  );
-  if (user_access('administer users')) {
-    $form['account']['status'] = array('#type' => 'radios', '#title' => t('Status'), '#default_value' => $edit['status'], '#options' => array(t('Blocked'), t('Active')));
-  }
-  if (user_access('administer access control')) {
-    $roles = user_roles(1);
-    unset($roles[DRUPAL_AUTHENTICATED_RID]);
-    if ($roles) {
-      $form['account']['roles'] = array('#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => array_keys((array)$edit['roles']), '#options' => $roles, '#description' => t('The user receives the combined permissions of the %au role, and all roles selected here.', array('%au' => theme('placeholder', t('authenticated user')))));
-    }
-  }
-
-  // Picture/avatar:
-  if (variable_get('user_pictures', 0)) {
-    $form['picture'] = array('#type' => 'fieldset', '#title' => t('Picture'), '#weight' => 1);
-    $picture = theme('user_picture', (object)$edit);
-    if ($picture) {
-      $form['picture']['current_picture'] = array('#type' => 'markup', '#value' => $picture);
-      $form['picture']['picture_delete'] = array('#type' => 'checkbox', '#title' => t('Delete picture'), '#description' => t('Check this box to delete your current picture.'));
-    } else {
-      $form['picture']['picture_delete'] = array('#type' => 'hidden');
-    }
-    $form['picture']['picture_upload'] = array('#type' => 'file', '#title' => t('Upload picture'), '#size' => 48, '#description' => t('Your virtual face or picture.  Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) .' '. variable_get('user_picture_guidelines', ''));
-  }
-
-  return $form;
-}
-
-function _user_edit_validate($uid, &$edit) {
-  $user = user_load(array('uid' => $uid));
-  // Validate the username:
-  if (user_access('change own username') || user_access('administer users') || arg(1) == 'register') {
-    if ($error = user_validate_name($edit['name'])) {
-      form_set_error('name', $error);
-    }
-    else if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(name) = LOWER('%s')", $uid, $edit['name'])) > 0) {
-      form_set_error('name', t('The name %name is already taken.', array('%name' => theme('placeholder', $edit['name']))));
-    }
-    else if (drupal_is_denied('user', $edit['name'])) {
-      form_set_error('name', t('The name %name has been denied access.', array('%name' => theme('placeholder', $edit['name']))));
-    }
-  }
-
-  // Validate the e-mail address:
-  if ($error = user_validate_mail($edit['mail'])) {
-    form_set_error('mail', $error);
-  }
-  else if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) {
-    form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => theme('placeholder', $edit['mail']))));
-  }
-  else if (drupal_is_denied('mail', $edit['mail'])) {
-    form_set_error('mail', t('The e-mail address %email has been denied access.', array('%email' => theme('placeholder', $edit['mail']))));
-  }
-
-  // If required, validate the uploaded picture.
-  if ($file = file_check_upload('picture_upload')) {
-    user_validate_picture($file, $edit, $user);
-  }
-}
-
-function _user_edit_submit($uid, &$edit) {
-  $user = user_load(array('uid' => $uid));
-  // Delete picture if requested, and if no replacement picture was given.
-  if ($edit['picture_delete']) {
-    if ($user->picture && file_exists($user->picture)) {
-      file_delete($user->picture);
-    }
-    $edit['picture'] = '';
-  }
-  if (isset($edit['roles'])) {
-    $edit['roles'] = array_filter($edit['roles']);
-  }
-}
-
-function user_edit($category = 'account') {
-  global $user;
-
-  $account = user_load(array('uid' => arg(1)));
-  if ($account === FALSE) {
-    drupal_set_message(t('The account does not exist or has already been deleted.'));
-    drupal_goto('admin/user');
-  }
-  $edit = $_POST['op'] ? $_POST['edit'] : (array)$account;
-
-  if (arg(2) == 'delete') {
-    if ($edit['confirm']) {
-      db_query('DELETE FROM {users} WHERE uid = %d', $account->uid);
-      db_query('DELETE FROM {sessions} WHERE uid = %d', $account->uid);
-      db_query('DELETE FROM {users_roles} WHERE uid = %d', $account->uid);
-      db_query('DELETE FROM {authmap} WHERE uid = %d', $account->uid);
-      watchdog('user', t('Deleted user: %name %email.', array('%name' => theme('placeholder', $account->name), '%email' => theme('placeholder', '<'. $account->mail .'>'))), WATCHDOG_NOTICE);
-      drupal_set_message(t('The account has been deleted.'));
-      module_invoke_all('user', 'delete', $edit, $account);
-      drupal_goto('admin/user');
-    }
-    else {
-      return confirm_form('user_confirm_delete', array(), t('Are you sure you want to delete the account %name?', array('%name' => theme('placeholder', $account->name))), 'user/'. $account->uid, t('All submissions made by this user will be attributed to the anonymous account. This action cannot be undone.'), t('Delete'), t('Cancel'));
-    }
-  }
-  else if ($_POST['op'] == t('Delete')) {
-    if ($_REQUEST['destination']) {
-      $destination = drupal_get_destination();
-      unset($_REQUEST['destination']);
-    }
-    // Note: we redirect from user/uid/edit to user/uid/delete to make the tabs disappear.
-    drupal_goto("user/$account->uid/delete", $destination);
-  }
-
-  $form = _user_forms($edit, $account, $category);
-  $form['_category'] = array('#type' => 'value', '#value' => $category);
-  $form['_account'] = array('#type' => 'value', '#value' => $account);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 30);
-  if (user_access('administer users')) {
-    $form['delete'] = array('#type' => 'submit', '#value' => t('Delete'), '#weight' => 31);
-  }
-  $form['#attributes']['enctype'] = 'multipart/form-data';
-
-  drupal_set_title($account->name);
-  return drupal_get_form('user_edit', $form);
-}
-
-function user_edit_validate($form_id, $form_values) {
-  user_module_invoke('validate', $form_values, $form_values['_account'], $form_values['_category']);
-  // Validate input to ensure that non-privileged users can't alter protected data.
-  if ((!user_access('administer users') && array_intersect(array_keys($form_values), array('uid', 'init', 'session'))) || (!user_access('administer access control') && isset($form_values['roles']))) {
-    $message = t('Detected malicious attempt to alter protected user fields.');
-    watchdog('security', $message, WATCHDOG_WARNING);
-    // set this to a value type field
-    form_set_error('category', $message);
-  }
-}
-
-function user_edit_submit($form_id, $form_values) {
-  $account = $form_values['_account'];
-  $category = $form_values['_category'];
-  unset($form_values['_account'], $form_values['submit'], $form_values['delete'], $form_values['form_id'], $form_values['_category']);
-  user_module_invoke('submit', $form_values, $account, $category);
-  user_save($account, $form_values, $category);
-  // Delete that user's menu cache.
-  cache_clear_all('menu:'. $account->uid, TRUE);
-  drupal_set_message(t('The changes have been saved.'));
-  return 'user/'. $account->uid;
-}
-
-function user_view($uid = 0) {
-  global $user;
-
-  $account = user_load(array('uid' => $uid));
-  if ($account === FALSE || ($account->access == 0 && !user_access('administer users'))) {
-    return drupal_not_found();
-  }
-  // Retrieve and merge all profile fields:
-  $fields = array();
-  foreach (module_list() as $module) {
-    if ($data = module_invoke($module, 'user', 'view', '', $account)) {
-      foreach ($data as $category => $items) {
-        foreach ($items as $item) {
-          $item['class'] = "$module-". $item['class'];
-          $fields[$category][] = $item;
-        }
-      }
-    }
-  }
-  drupal_set_title($account->name);
-  return theme('user_profile', $account, $fields);
-}
-
-/*** Administrative features ***********************************************/
-
-function _user_mail_text($messageid, $variables = array()) {
-
-  // Check if an admin setting overrides the default string.
-  if ($admin_setting = variable_get('user_mail_' . $messageid, FALSE)) {
-    return strtr($admin_setting, $variables);
-  }
-  // No override, return with default strings.
-  else {
-    switch ($messageid) {
-      case 'welcome_subject':
-        return t('Account details for %username at %site', $variables);
-      case 'welcome_body':
-        return t("%username,\n\nThank you for registering at %site. You may now log in to %login_uri using the following username and password:\n\nusername: %username\npassword: %password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n%login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to %edit_uri so you can change your password.\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://drupal.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n--  %site team", $variables);
-      case 'admin_subject':
-        return t('An administrator created an account for you at %site', $variables);
-      case 'admin_body':
-        return t("%username,\n\nA site administrator at %site has created an account for you. You may now log in to %login_uri using the following username and password:\n\nusername: %username\npassword: %password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n%login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to %edit_uri so you can change your password.\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drupal.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n--  %site team", $variables);
-      case 'approval_subject':
-        return t('Account details for %username at %site (pending admin approval)', $variables);
-      case 'approval_body':
-        return t("%username,\n\nThank you for registering at %site. Your application for an account is currently pending approval. Once it has been granted, you may log in to %login_uri using the following username and password:\n\nusername: %username\npassword: %password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n%login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you may wish to change your password at %edit_uri\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n--  %site team", $variables);
-      case 'pass_subject':
-        return t('Replacement login information for %username at %site', $variables);
-      case 'pass_body':
-        return t("%username,\n\nA request to reset the password for your account has been made at %site.\n\nYou may now log in to %uri_brief clicking on this link or copying and pasting it in your browser:\n\n%login_url\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to %edit_uri so you can change your password.", $variables);
-    }
-  }
-}
-
-function user_configure_settings() {
-}
-
-/**
- * Menu callback: check an access rule
- */
-function user_admin_access_check() {
-  $form['user'] = array('#type' => 'fieldset', '#title' => t('Username'));
-  $form['user']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a username to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
-  $form['user']['type'] = array('#type' => 'hidden', '#value' => 'user');
-  $form['user']['submit'] = array('#type' => 'submit', '#value' => t('Check username'));
-  $output .= drupal_get_form('check_user', $form, 'user_admin_access_check');
-  unset($form); // prevent endless loop?
-
-  $form['mail'] = array('#type' => 'fieldset', '#title' => t('E-mail'));
-  $form['mail']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter an e-mail address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
-  $form['mail']['type'] = array('#type' => 'hidden', '#value' => 'mail');
-  $form['mail']['submit'] = array('#type' => 'submit', '#value' => t('Check e-mail'));
-  $output .= drupal_get_form('check_mail', $form, 'user_admin_access_check');
-  unset($form); // prevent endless loop?
-
-  $form['host'] = array('#type' => 'fieldset', '#title' => t('Hostname'));
-  $form['host']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a hostname or IP address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
-  $form['host']['type'] = array('#type' => 'hidden', '#value' => 'host');
-  $form['host']['submit'] = array('#type' => 'submit', '#value' => t('Check hostname'));
-  $output .= drupal_get_form('check_host', $form, 'user_admin_access_check');
-  unset($form); // prevent endless loop?
-
-  return $output;
-}
-
-function user_admin_access_check_validate($form_id, $edit) {
-  if (empty($edit['test'])) {
-    form_set_error($edit['type'], t('No value entered. Please enter a test string and try again.'));
-  }
-}
-
-function user_admin_access_check_submit($form_id, $edit) {
-  switch ($edit['type']) {
-    case 'user':
-      if (drupal_is_denied('user', $edit['test'])) {
-        drupal_set_message(t('The username %name is not allowed.', array('%name' => theme('placeholder', $edit['test']))));
-      }
-      else {
-        drupal_set_message(t('The username %name is allowed.', array('%name' => theme('placeholder', $edit['test']))));
-      }
-      break;
-    case 'mail':
-      if (drupal_is_denied('mail', $edit['test'])) {
-        drupal_set_message(t('The e-mail address %mail is not allowed.', array('%mail' => theme('placeholder', $edit['test']))));
-      }
-      else {
-        drupal_set_message(t('The e-mail address %mail is allowed.', array('%mail' => theme('placeholder', $edit['test']))));
-      }
-      break;
-    case 'host':
-      if (drupal_is_denied('host', $edit['test'])) {
-        drupal_set_message(t('The hostname %host is not allowed.', array('%host' => theme('placeholder', $edit['test']))));
-      }
-      else {
-        drupal_set_message(t('The hostname %host is allowed.', array('%host' => theme('placeholder', $edit['test']))));
-      }
-      break;
-    default:
-      break;
-  }
-}
-
-/**
- * Menu callback: add an access rule
- */
-function user_admin_access_add($mask = NULL, $type = NULL) {
-  if ($edit = $_POST['edit']) {
-    if (!$edit['mask']) {
-      form_set_error('mask', t('You must enter a mask.'));
-    }
-    else {
-      $aid = db_next_id('{access}_aid');
-      db_query("INSERT INTO {access} (aid, mask, type, status) VALUES ('%s', '%s', '%s', %d)", $aid, $edit['mask'], $edit['type'], $edit['status']);
-      drupal_set_message(t('The access rule has been added.'));
-      drupal_goto('admin/access/rules');
-    }
-  }
-  else {
-    $edit['mask'] = $mask;
-    $edit['type'] = $type;
-  }
-
-  $form = _user_admin_access_form($edit);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Add rule'));
-
-  return drupal_get_form('access_rule', $form);
-}
-
-/**
- * Menu callback: delete an access rule
- */
-function user_admin_access_delete($aid = 0) {
-  $access_types = array('user' => t('username'), 'mail' => t('e-mail'));
-  $edit = db_fetch_object(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
-
-  $form = array();
-  $form['aid'] = array('#type' => 'hidden', '#value' => $aid);
-  $output = confirm_form('user_admin_access_delete_confirm', $form,
-                  t('Are you sure you want to delete the %type rule for %rule?', array('%type' => $access_types[$edit->type], '%rule' => theme('placeholder', $edit->mask))),
-                  'admin/access/rules',
-                  t('This action cannot be undone.'),
-                  t('Delete'),
-                  t('Cancel'));
-  return $output;
-}
-
-function user_admin_access_delete_confirm_submit($form_id, $edit) {
-  db_query('DELETE FROM {access} WHERE aid = %d', $edit['aid']);
-  drupal_set_message(t('The access rule has been deleted.'));
-  return 'admin/access/rules';
-}
-
-/**
- * Menu callback: edit an access rule
- */
-function user_admin_access_edit($aid = 0) {
-  if ($edit = $_POST['edit']) {
-    if (!$edit['mask']) {
-      form_set_error('mask', t('You must enter a mask.'));
-    }
-    else {
-      db_query("UPDATE {access} SET mask = '%s', type = '%s', status = '%s' WHERE aid = %d", $edit['mask'], $edit['type'], $edit['status'], $aid);
-      drupal_set_message(t('The access rule has been saved.'));
-      drupal_goto('admin/access/rules');
-    }
-  }
-  else {
-    $edit = db_fetch_array(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
-  }
-  $form = _user_admin_access_form($edit);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save rule'));
-
-  return drupal_get_form('access_rule', $form);
-}
-
-function _user_admin_access_form($edit) {
-  $form['status'] = array(
-    '#type' => 'radios',
-    '#title' => t('Access type'),
-    '#default_value' => 0,
-    '#options' => array('1' => t('Allow'), '0' => t('Deny')),
-  );
-  $type_options = array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host'));
-  $form['type'] = array(
-    '#type' => 'radios',
-    '#title' => t('Rule type'),
-    '#default_value' => (isset($type_options[$edit['type']]) ? $edit['type'] : 'user'),
-    '#options' => $type_options,
-  );
-  $form['mask'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Mask'),
-    '#size' => 30,
-    '#maxlength' => 64,
-    '#default_value' => $edit['mask'],
-    '#description' => '%: '. t('Matches any number of characters, even zero characters') .'.<br />_: '. t('Matches exactly one character.'),
-    '#required' => TRUE,
-  );
-  return $form;
-}
-
-/**
- * Menu callback: list all access rules
- */
-function user_admin_access() {
-  $header = array(array('data' => t('Access type'), 'field' => 'status'), array('data' => t('Rule type'), 'field' => 'type'), array('data' =>t('Mask'), 'field' => 'mask'), array('data' => t('Operations'), 'colspan' => 2));
-  $result = db_query("SELECT aid, type, status, mask FROM {access}". tablesort_sql($header));
-  $access_types = array('user' => t('username'), 'mail' => t('e-mail'), 'host' => t('host'));
-  $rows = array();
-  while ($rule = db_fetch_object($result)) {
-    $rows[] = array($rule->status ? t('allow') : t('deny'), $access_types[$rule->type], $rule->mask, l(t('edit'), 'admin/access/rules/edit/'. $rule->aid), l(t('delete'), 'admin/access/rules/delete/'. $rule->aid));
-  }
-  if (count($rows) == 0) {
-    $rows[] = array(array('data' => '<em>'. t('There are currently no access rules.') .'</em>', 'colspan' => 5));
-  }
-  $output .= theme('table', $header, $rows);
-
-  return $output;
-}
-
-/**
- * Retrieve an array of roles matching specified conditions.
- *
- * @param $membersonly
- *   Set this to TRUE to exclude the 'anonymous' role.
- * @param $permission
- *   A string containing a permission. If set, only roles containing that permission are returned.
- *
- * @return
- *   An associative array with the role id as the key and the role name as value.
- */
-function user_roles($membersonly = 0, $permission = 0) {
-  $roles = array();
-
-  if ($permission) {
-    $result = db_query("SELECT r.* FROM {role} r INNER JOIN {permission} p ON r.rid = p.rid WHERE p.perm LIKE '%%%s%%' ORDER BY r.name", $permission);
-  }
-  else {
-    $result = db_query('SELECT * FROM {role} ORDER BY name');
-  }
-  while ($role = db_fetch_object($result)) {
-    if (!$membersonly || ($membersonly && $role->rid != DRUPAL_ANONYMOUS_RID)) {
-      $roles[$role->rid] = $role->name;
-    }
-  }
-  return $roles;
-}
-
-/**
- * Menu callback: administer permissions.
- */
-function user_admin_perm($str_rids = NULL) {
-  if (preg_match('/^([0-9]+[+ ])*[0-9]+$/', $str_rids)) {
-    // The '+' character in a query string may be parsed as ' '.
-    $rids = preg_split('/[+ ]/', $str_rids);
-  }
-
-  if($rids) {
-    $breadcrumbs = drupal_get_breadcrumb();
-    $breadcrumbs[] = l(t('all roles'), 'admin/access');
-    drupal_set_breadcrumb($breadcrumbs);
-    $result = db_query('SELECT r.rid, p.perm FROM {role} r LEFT JOIN {permission} p ON r.rid = p.rid WHERE r.rid IN (%s) ORDER BY name', implode(', ', $rids));
-  }
-  else {
-    $result = db_query('SELECT r.rid, p.perm FROM {role} r LEFT JOIN {permission} p ON r.rid = p.rid ORDER BY name');
-  }
-
-  // Compile role array:
-  $roles = array();
-  while ($role = db_fetch_object($result)) {
-    $role_permissions[$role->rid] = $role->perm;
-  }
-
-  if($rids) {
-    $result = db_query('SELECT rid, name FROM {role} r WHERE r.rid IN (%s) ORDER BY name', implode(', ', $rids));
-  }
-  else {
-    $result = db_query('SELECT rid, name FROM {role} ORDER BY name');
-  }
-  $role_names = array();
-  while ($role = db_fetch_object($result)) {
-    $role_names[$role->rid] = $role->name;
-  }
-
-  // Render role/permission overview:
-  $options = array();
-  foreach (module_list(FALSE, FALSE, TRUE) as $module) {
-    if ($permissions = module_invoke($module, 'perm')) {
-      $form['permission'][] = array('#type' => 'markup', '#value' => t('%module module', array('%module' => $module)));
-      asort($permissions);
-      foreach ($permissions as $perm) {
-        $options[$perm] = '';
-        $form['permission'][$perm] = array('#type' => 'markup', '#value' => t($perm));
-        foreach ($role_names as $rid => $name) {
-          // Builds arrays for checked boxes for each role
-          if (strstr($role_permissions[$rid], $perm)) {
-            $status[$rid][] = $perm;
-          }
-        }
-      }
-    }
-  }
-  // Have to build checkboxes here after checkbox arrays are built
-  foreach ($role_names as $rid => $name) {
-    $form['checkboxes'][$rid] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $status[$rid]);
-    $form['role_names'][$rid] = array('#type' => 'markup', '#value' => l($name, 'admin/access/'. $rid), '#tree' => TRUE);
-  }
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save permissions'));
-
-  return drupal_get_form('user_admin_perm', $form);
-}
-
-function theme_user_admin_perm($form) {
-  foreach (element_children($form['permission']) as $key) {
-    // Don't take form control structures
-    if (is_array($form['permission'][$key])) {
-      $row = array();
-      // Module name
-      if (is_numeric($key)) {
-        $row[] = array('data' => form_render($form['permission'][$key]), 'class' => 'module', 'colspan' => count($form['role_names']) + 1);
-      // Permissions
-      }
-      else {
-        $row[] = array('data' => form_render($form['permission'][$key]), 'class' => 'permission');
-        foreach (element_children($form['checkboxes']) as $rid) {
-          if (is_array($form['checkboxes'][$rid])) {
-            $row[] = array('data' => form_render($form['checkboxes'][$rid][$key]), 'align' => 'center', 'title' => t($key));
-          }
-        }
-      }
-      $rows[] = $row;
-    }
-  }
-  $header[] = (t('Permission'));
-  foreach (element_children($form['role_names']) as $rid) {
-    if (is_array($form['role_names'][$rid])) {
-      $header[] = form_render($form['role_names'][$rid]);
-    }
-  }
-  $output = theme('table', $header, $rows, array('id' => 'permissions'));
-  $output .= form_render($form);
-  return $output;
-}
-
-function user_admin_perm_submit($form_id, $edit) {
-  // Save permissions:
-  $result = db_query('SELECT * FROM {role}');
-  while ($role = db_fetch_object($result)) {
-    if(isset($edit[$role->rid])) {
-      // Delete, so if we clear every checkbox we reset that role;
-      // otherwise permissions are active and denied everywhere.
-      db_query('DELETE FROM {permission} WHERE rid = %d', $role->rid);
-      foreach ($edit[$role->rid] as $key => $value) {
-        if (!$value) {
-          unset($edit[$role->rid][$key]);
-        }
-      }
-      if (count($edit[$role->rid])) {
-        db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $role->rid, implode(', ', array_keys($edit[$role->rid])));
-      }
-    }
-  }
-
-  drupal_set_message(t('The changes have been saved.'));
-
-  // Clear the cached pages and menus:
-  menu_rebuild();
-
-}
-
-/**
- * Menu callback: administer roles.
- */
-function user_admin_role() {
-  $edit = isset($_POST['edit']) ? $_POST['edit'] : '';
-  $op = isset($_POST['op']) ? $_POST['op'] : '';
-  $id = arg(4);
-
-  if ($op == t('Save role')) {
-    if ($edit['name']) {
-      db_query("UPDATE {role} SET name = '%s' WHERE rid = %d", $edit['name'], $id);
-      drupal_set_message(t('The changes have been saved.'));
-      drupal_goto('admin/access/roles');
-    }
-    else {
-      form_set_error('name', t('You must specify a valid role name.'));
-    }
-  }
-  else if ($op == t('Delete role')) {
-    db_query('DELETE FROM {role} WHERE rid = %d', $id);
-    db_query('DELETE FROM {permission} WHERE rid = %d', $id);
-    // Update the users who have this role set:
-    db_query('DELETE FROM {users_roles} WHERE rid = %d', $id);
-
-    drupal_set_message(t('The role has been deleted.'));
-    drupal_goto('admin/access/roles');
-  }
-  else if ($op == t('Add role')) {
-    if ($edit['name']) {
-      db_query("INSERT INTO {role} (name) VALUES ('%s')", $edit['name']);
-      drupal_set_message(t('The role has been added.'));
-      drupal_goto('admin/access/roles');
-    }
-    else {
-      form_set_error('name', t('You must specify a valid role name.'));
-    }
-  }
-  else if ($id) {
-    // Display the role form.
-    $role = db_fetch_object(db_query('SELECT * FROM {role} WHERE rid = %d', $id));
-    $form['name'] = array('#type' => 'textfield', '#title' => t('Role name'), '#default_value' => $role->name, '#size' => 30, '#maxlength' => 64, '#description' => t('The name for this role. Example: "moderator", "editorial board", "site architect".'));
-    $form['submit'] = array('#type' => 'submit', '#value' => t('Save role'));
-    $form['delete'] = array('#type' => 'submit', '#value' => t('Delete role'));
-    return drupal_get_form('user_admin_role', $form);
-  }
-  $form['name'] = array('#type' => 'textfield', '#size' => 32, '#maxlength' => 64);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Add role'));
-  return drupal_get_form('user_admin_new_role', $form);
-}
-
-function theme_user_admin_new_role($form) {
-  $header = array(t('Name'), t('Operations'));
-  foreach (user_roles() as $rid => $name) {
-    if (!in_array($rid, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) {
-      $rows[] = array($name, l(t('edit'), 'admin/access/roles/edit/'. $rid));
-    }
-    else {
-      $rows[] = array($name, '<span class="disabled">'. t('locked') .'</span>');
-    }
-  }
-  $rows[] = array(form_render($form['name']), form_render($form['submit']));
-
-  return theme('table', $header, $rows);
-}
-
-function user_admin_account() {
-  $header = array(
-    array('data' => t('Username'), 'field' => 'u.name'),
-    array('data' => t('Status'), 'field' => 'u.status'),
-    array('data' => t('Member for'), 'field' => 'u.created', 'sort' => 'desc'),
-    array('data' => t('Last access'), 'field' => 'u.access'),
-    t('Operations')
-  );
-  $sql = 'SELECT u.uid, u.name, u.status, u.created, u.access FROM {users} u WHERE uid != 0';
-  $sql .= tablesort_sql($header);
-  $result = pager_query($sql, 50);
-
-  $status = array(t('blocked'), t('active'));
-  while ($account = db_fetch_object($result)) {
-    $rows[] = array(theme('username', $account),
-                    $status[$account->status],
-                    format_interval(time() - $account->created),
-                    $account->access ? t('%time ago', array('%time' => format_interval(time() - $account->access))) : t('never'),
-                    l(t('edit'), "user/$account->uid/edit", array()));
-  }
-
-  $output = theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 50, 0);
-  return $output;
-}
-
-function user_configure() {
-  // User registration settings.
-  $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings'));
-  $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.')));
-  $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help', ''), '#description' => t('This text is displayed at the top of the user registration form.  It\'s useful for helping or instructing your users.'));
-
-  // User e-mail settings.
-  $form['email'] = array('#type' => 'fieldset', '#title' => t('User e-mail settings'));
-  $form['email']['user_mail_welcome_subject'] = array('#type' => 'textfield', '#title' => t('Subject of welcome e-mail'), '#default_value' => _user_mail_text('welcome_subject'), '#maxlength' => 180, '#description' => t('Customize the subject of your welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.');
-  $form['email']['user_mail_welcome_body'] = array('#type' => 'textarea', '#title' => t('Body of welcome e-mail'), '#default_value' => _user_mail_text('welcome_body'), '#rows' => 15, '#description' => t('Customize the body of the welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.');
-  $form['email']['user_mail_admin_subject'] = array('#type' => 'textfield', '#title' => t('Subject of welcome e-mail (user created by administrator)'), '#default_value' => _user_mail_text('admin_subject'), '#maxlength' => 180, '#description' => t('Customize the subject of your welcome e-mail, which is sent to new member accounts created by an administrator.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.');
-  $form['email']['user_mail_admin_body'] = array('#type' => 'textarea', '#title' => t('Body of welcome e-mail (user created by administrator)'), '#default_value' => _user_mail_text('admin_body'), '#rows' => 15, '#description' => t('Customize the body of the welcome e-mail, which is sent to new member accounts created by an administrator.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.');
-  $form['email']['user_mail_approval_subject'] = array('#type' => 'textfield', '#title' => t('Subject of welcome e-mail (awaiting admin approval)'), '#default_value' => _user_mail_text('approval_subject'), '#maxlength' => 180, '#description' => t('Customize the subject of your awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri, %login_url.');
-  $form['email']['user_mail_approval_body'] = array('#type' => 'textarea', '#title' => t('Body of welcome e-mail (awaiting admin approval)'), '#default_value' => _user_mail_text('approval_body'), '#rows' => 15, '#description' => t('Customize the body of the awaiting approval welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' %username, %site, %password, %uri, %uri_brief, %mailto, %login_uri, %edit_uri, %login_url.');
-  $form['email']['user_mail_pass_subject'] = array('#type' => 'textfield', '#title' => t('Subject of password recovery e-mail'), '#default_value' => _user_mail_text('pass_subject'), '#maxlength' => 180, '#description' => t('Customize the Subject of your forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %date, %login_uri, %edit_uri.');
-  $form['email']['user_mail_pass_body'] = array('#type' => 'textarea', '#title' => t('Body of password recovery e-mail'), '#default_value' => _user_mail_text('pass_body'), '#rows' => 15, '#description' => t('Customize the body of the forgotten password e-mail.') .' '. t('Available variables are:') .' %username, %site, %login_url, %uri, %uri_brief, %mailto, %login_uri, %edit_uri.');
-
-  // If picture support is enabled, check whether the picture directory exists:
-  if (variable_get('user_pictures', 0)) {
-    $picture_path = file_create_path(variable_get('user_picture_path', 'pictures'));
-    file_check_directory($picture_path, 1, 'user_picture_path');
-  }
-
-  $form['pictures'] = array('#type' => 'fieldset', '#title' => t('Pictures'));
-  $form['pictures']['user_pictures'] = array('#type' => 'radios', '#title' => t('Picture support'), '#default_value' => variable_get('user_pictures', 0), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Enable picture support.'));
-  $form['pictures']['user_picture_path'] = array('#type' => 'textfield', '#title' => t('Picture image path'), '#default_value' => variable_get('user_picture_path', 'pictures'), '#size' => 30, '#maxlength' => 255, '#description' => t('Subdirectory in the directory "%dir" where pictures will be stored.', array('%dir' => file_directory_path() .'/')));
-  $form['pictures']['user_picture_default'] = array('#type' => 'textfield', '#title' => t('Default picture'), '#default_value' => variable_get('user_picture_default', ''), '#size' => 30, '#maxlength' => 255, '#description' => t('URL of picture to display for users with no custom picture selected. Leave blank for none.'));
-  $form['pictures']['user_picture_dimensions'] = array('#type' => 'textfield', '#title' => t('Picture maximum dimensions'), '#default_value' => variable_get('user_picture_dimensions', '85x85'), '#size' => 15, '#maxlength' => 10, '#description' => t('Maximum dimensions for pictures.'));
-  $form['pictures']['user_picture_file_size'] = array('#type' => 'textfield', '#title' => t('Picture maximum file size'), '#default_value' => variable_get('user_picture_file_size', '30'), '#size' => 15, '#maxlength' => 10, '#description' => t('Maximum file size for pictures, in kB.'));
-  $form['pictures']['user_picture_guidelines'] = array('#type' => 'textarea', '#title' => t('Picture guidelines'), '#default_value' => variable_get('user_picture_guidelines', ''), '#description' => t('This text is displayed at the picture upload form in addition to the default guidelines.  It\'s useful for helping or instructing your users.'));
-
-  return system_settings_form('user_configure_settings', $form);
-}
-
-function user_admin() {
-  $edit = isset($_POST['edit']) ? $_POST['edit'] : '';
-  $op = isset($_POST['op']) ? $_POST['op'] : '';
-
-  if (empty($op)) {
-    $op = arg(2);
-  }
-
-  switch ($op) {
-    case 'search':
-    case t('Search'):
-      $output = search_form(url('admin/user/search'), $_POST['edit']['keys'], 'user') . search_data($_POST['edit']['keys'], 'user');
-      break;
-    case t('Create new account'):
-    case 'create':
-      $output = user_register();
-      break;
-    default:
-      $output = user_admin_account();
-  }
-  return $output;
-}
-
-/**
- * Implementation of hook_help().
- */
-function user_help($section) {
-  global $user;
-
-  switch ($section) {
-    case 'admin/help#user':
-      $output = '<p>'. t('The user module allows users to register, login, and logout. Users benefit from being able to sign on because it associates content they create with their account and allows various permissions to be set for their roles.  The user module supports user roles which can setup fine grained permissions allowing each role to do only what the administrator wants them to. Each user is assigned to one or more roles. By default there are two roles <em>anonymous</em> - a user who has not logged in, and <em>authenticated</em> a user who has signed up and who has been authorized. ') .'</p>';
-      $output .= '<p>'. t('Users can use their own name or handle and can fine tune some personal configuration settings through their individual my account page.  Registered users need to authenticate by supplying either a local username and password, or a remote username and password such as DelphiForums ID, or one from a Drupal powered website.  A visitor accessing your website is assigned an unique ID, the so-called session ID, which is stored in a cookie. For security\'s sake, the cookie does not contain personal information but acts as a key to retrieve the information stored on your server. ') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>view your <a href="%user">user page</a>.</li>
-<li>administer users at <a href="%admin-user">administer &gt;&gt; user</a>.</li>
-<li>allow users who have the "select different theme" permission to select themes from their user account by enabling themes in <a href="%admin-themes">administer &gt;&gt; themes</a>.</li>
-<li>read user profile help at <a href="%admin-help-profile">administer &gt;&gt; help &gt;&gt; profile</a>.</li>
-<li>read about distributed authentication in the system module help at <a href="%admin-help-system">administer &gt;&gt; help &gt;&gt; system</a>.</li>
-</ul>
-', array('%user' => url('user'), '%admin-user' => url('admin/user'), '%admin-themes' => url('admin/themes'), '%admin-help-profile' => url('admin/help/profile'), '%admin-help-system' => url('admin/help/system')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%user">User page</a>.', array('%user' => 'http://drupal.org/handbook/modules/user/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Manages the user registration and login system.');
-    case 'admin/user':
-      return t('<p>Drupal allows users to register, login, logout, maintain user profiles, etc. No participant can use his own name to post content until he signs up for a user account.</p>');
-    case 'admin/user/create':
-    case 'admin/user/account/create':
-      return t('<p>This web page allows the administrators to register a new users by hand. Note that you cannot have a user where either the e-mail address or the username match another user in the system.</p>');
-    case strstr($section, 'admin/access/rules'):
-      return t('<p>Set up username and e-mail address access rules for new <em>and</em> existing accounts (currently logged in accounts will not be logged out). If a username or e-mail address for an account matches any deny rule, but not an allow rule, then the account will not be allowed to be created or to log in. A host rule is effective for every page view, not just registrations.</p>');
-    case 'admin/access':
-      return t('<p>Permissions let you control what users can do on your site.  Each user role (defined on the <a href="%role">user roles page</a>) has its own set of permissions. For example, you could give users classified as "Administrators" permission to "administer nodes" but deny this power to ordinary, "authenticated" users. You can use permissions to reveal new features to privileged users (those with subscriptions, for example). Permissions also allow trusted users to share the administrative burden of running a busy site.</p>', array('%role' => url('admin/access/roles')));
-    case 'admin/access/roles':
-      return t('<p>Roles allow you to fine tune the security and administration of Drupal. A role defines a group of users that have certain privileges as defined in <a href="%permissions">user permissions</a>. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <em>role names</em> of the various roles. To delete a role choose "edit".</p><p>By default, Drupal comes with two user roles:</p>
-      <ul>
-      <li>Anonymous user: this role is used for users that don\'t have a user account or that are not authenticated.</li>
-      <li>Authenticated user: this role is automatically granted to all logged in users.</li>
-      </ul>', array('%permissions' => url('admin/access/permissions')));
-    case 'admin/user/search':
-      return t('<p>Enter a simple pattern ("*" may be used as a wildcard match) to search for a username.  For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda".</p>');
-    case 'admin/user/configure':
-    case 'admin/user/configure/settings':
-      return t('<p>In order to use the full power of Drupal a visitor must sign up for an account. This page lets you setup how a user signs up, logs out, the guidelines from the system about user subscriptions, and the e-mails the system will send to the user.</p>');
-    case 'user/help#user':
-      $site = variable_get('site_name', 'this website');
-
-      $output = t("
-      <h3>Distributed authentication<a id=\"da\"></a></h3>
-      <p>One of the more tedious moments in visiting a new website is filling out the registration form. Here at %site, you do not have to fill out a registration form if you are already a member of %help-links. This capability is called <em>distributed authentication</em>, and is unique to <a href=\"%drupal\">Drupal</a>, the software which powers %site.</p>
-      <p>Distributed authentication enables a new user to input a username and password into the login box, and immediately be recognized, even if that user never registered at %site. This works because Drupal knows how to communicate with external registration databases. For example, lets say that new user 'Joe' is already a registered member of <a href=\"%delphi-forums\">Delphi Forums</a>. Drupal informs Joe on registration and login screens that he may login with his Delphi ID instead of registering with %site. Joe likes that idea, and logs in with a username of joe@remote.delphiforums.com and his usual Delphi password. Drupal then contacts the <em>remote.delphiforums.com</em> server behind the scenes (usually using <a href=\"%xml\">XML-RPC</a>, <a href=\"%http-post\">HTTP POST</a>, or <a href=\"%soap\">SOAP</a>) and asks: \"Is the password for user Joe correct?\".  If Delphi replies yes, then we create a new %site account for Joe and log him into it.  Joe may keep on logging into %site in the same manner, and he will always be logged into the same account.</p>", array('%help-links' => (implode(', ', user_auth_help_links())), '%site' => "<em>$site</em>", '%drupal' => 'http://drupal.org', '%delphi-forums' => 'http://www.delphiforums.com', '%xml' => 'http://www.xmlrpc.com', '%http-post' => 'http://www.w3.org/Protocols/', '%soap' => 'http://www.soapware.org'));
-
-        foreach (module_list() as $module) {
-          if (module_hook($module, 'auth')) {
-            $output .= "<h4><a id=\"$module\"></a>". module_invoke($module, 'info', 'name') .'</h4>';
-            $output .= module_invoke($module, 'help', "user/help#$module");
-          }
-        }
-
-        return $output;
-  }
-
-}
-
-/**
- * Menu callback; Prints user-specific help information.
- */
-function user_help_page() {
-  return user_help('user/help#user');
-}
-
-/**
- * Retrieve a list of all user setting/information categories and sort them by weight.
- */
-function _user_categories($account) {
-  $categories = array();
-
-  foreach (module_list() as $module) {
-    if ($data = module_invoke($module, 'user', 'categories', NULL, $account, '')) {
-      $categories = array_merge($data, $categories);
-    }
-  }
-
-  usort($categories, '_user_sort');
-
-  return $categories;
-}
-
-function _user_sort($a, $b) {
-  return $a['weight'] < $b['weight'] ? -1 : ($a['weight'] > $b['weight'] ? 1 : ($a['title'] < $b['title'] ? -1 : 1));
-}
-
-/**
- * Retrieve a list of all form elements for the specified category.
- */
-function _user_forms(&$edit, $account, $category, $hook = 'form') {
-  $groups = array();
-  foreach (module_list() as $module) {
-    if ($data = module_invoke($module, 'user', $hook, $edit, $account, $category)) {
-      $groups = array_merge_recursive($data, $groups);
-    }
-  }
-  uasort($groups, '_user_sort');
-
-  return empty($groups) ? FALSE : $groups;
-}
-
-/**
- * Retrieve a pipe delimited string of autocomplete suggestions for existing users
- */
-function user_autocomplete($string) {
-  $matches = array();
-  $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10);
-  while ($user = db_fetch_object($result)) {
-    $matches[$user->name] = check_plain($user->name);
-  }
-  print drupal_to_js($matches);
-  exit();
-}
diff --git a/modules/watchdog.module b/modules/watchdog.module
deleted file mode 100644 (file)
index 3b0822b..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-<?php
-// $Id: watchdog.module 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * System monitoring and logging for administrators.
- *
- * The watchdog module monitors your site and keeps a list of
- * recorded events containing usage and performance data, errors,
- * warnings, and similar operational information.
- *
- * @see watchdog().
- */
-
-/**
- * Implementation of hook_help().
- */
-function watchdog_help($section) {
-  switch ($section) {
-    case 'admin/help#watchdog':
-      $output = '<p>'. t('The watchdog module monitors your system, capturing system events in a log to be reviewed by an authorized individual at a later time.  This is useful for site administrators who want a quick overview of activities on their site. The logs also record the sequence of events, so it can be useful for debugging site errors.') .'</p>';
-      $output .= '<p>'. t('The watchdog log is simply a list of recorded events containing usage data, performance data, errors, warnings and operational information. Administrators should check the watchdog report on a regular basis to ensure their site is working properly.') .'</p>';
-      $output .= t('<p>You can</p>
-<ul>
-<li>view watchdog logs at <a href="%admin-watchdog">administer &gt;&gt; watchdog</a>.</li>
-<li>view watchdog event logs at <a href="%admin-watchdog-events">administer &gt;&gt; watchdog &gt;&gt; events</a>.</li>
-</ul>
-', array('%admin-watchdog' => url('admin/watchdog'), '%admin-watchdog-events' => url('admin/watchdog/events')));
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%watchdog">Watchdog page</a>.', array('%watchdog' => 'http://drupal.org/handbook/modules/watchdog/')) .'</p>';
-      return $output;
-    case 'admin/modules#description':
-      return t('Logs and records system events.');
-    case 'admin/logs':
-      return t('<p>The watchdog module monitors your web site, capturing system events in a log to be reviewed by an authorized individual at a later time.  The watchdog log is simply a list of recorded events containing usage data, performance data, errors, warnings and operational information.  It is vital to check the watchdog report on a regular basis as it is often the only way to tell what is going on.</p>');
-  }
-}
-
-/**
- * Implementation of hook_menu().
- */
-function watchdog_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/logs', 'title' => t('logs'),
-      'callback' => 'watchdog_overview');
-    $items[] = array('path' => 'admin/logs/event', 'title' => t('details'),
-      'callback' => 'watchdog_event',
-      'type' => MENU_CALLBACK);
-  }
-  return $items;
-}
-
-/**
- * Implementation of hook_cron().
- *
- * Remove expired log messages and flood control events.
- */
-function watchdog_cron() {
-  db_query('DELETE FROM {watchdog} WHERE timestamp < %d', time() - variable_get('watchdog_clear', 604800));
-  db_query('DELETE FROM {flood} WHERE timestamp < %d', time() - 3600);
-}
-
-/**
- * Implementation of hook_user().
- */
-function watchdog_user($op, &$edit, &$user) {
-  if ($op == 'delete') {
-    db_query('UPDATE {watchdog} SET uid = 0 WHERE uid = %d', $user->uid);
-  }
-}
-
-/**
- * Menu callback; displays a listing of log messages.
- */
-function watchdog_overview() {
-  $icons = array(WATCHDOG_NOTICE  => '',
-                 WATCHDOG_WARNING => theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')),
-                 WATCHDOG_ERROR   => theme('image', 'misc/watchdog-error.png', t('error'), t('error')));
-  $classes = array(WATCHDOG_NOTICE => 'watchdog-notice', WATCHDOG_WARNING => 'watchdog-warning', WATCHDOG_ERROR => 'watchdog-error');
-
-  $names['all'] = t('all messages');
-  foreach (_watchdog_get_message_types() as $type) {
-    $names[$type] = t('%type messages', array('%type' => t($type)));
-  }
-
-  if (empty($_SESSION['watchdog_overview_filter'])) {
-    $_SESSION['watchdog_overview_filter'] = 'all';
-  }
-
-  $form['filter'] = array(
-    '#type' => 'select',
-    '#title' => t('Filter by message type'),
-    '#options' => $names,
-    '#default_value' => $_SESSION['watchdog_overview_filter']
-  );
-  $form['#action'] = url('admin/logs');
-
-  $form['submit'] = array('#type' => 'submit', '#value' =>t('Filter'));
-  $output = drupal_get_form('watchdog_form_overview', $form);
-
-  $header = array(
-    ' ',
-    array('data' => t('Type'), 'field' => 'w.type'),
-    array('data' => t('Date'), 'field' => 'w.wid', 'sort' => 'desc'),
-    array('data' => t('Message'), 'field' => 'w.message'),
-    array('data' => t('User'), 'field' => 'u.name'),
-    array('data' => t('Operations'))
-  );
-
-  $sql = "SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid";
-  $tablesort = tablesort_sql($header);
-  $type = $_SESSION['watchdog_overview_filter'];
-  if ($type != 'all') {
-    $result = pager_query($sql ." WHERE w.type = '%s'". $tablesort, 50, 0, NULL, $type);
-  }
-  else {
-    $result = pager_query($sql . $tablesort, 50);
-  }
-
-  while ($watchdog = db_fetch_object($result)) {
-    $rows[] = array('data' =>
-      array(
-        // Cells
-        $icons[$watchdog->severity],
-        t($watchdog->type),
-        format_date($watchdog->timestamp, 'small'),
-        l(truncate_utf8($watchdog->message, 56, TRUE, TRUE), 'admin/logs/event/'. $watchdog->wid, array(), NULL, NULL, FALSE, TRUE),
-        theme('username', $watchdog),
-        $watchdog->link,
-      ),
-      // Attributes for tr
-      'class' => "watchdog-". preg_replace('/[^a-z]/i', '-', $watchdog->type) .' '. $classes[$watchdog->severity]
-    );
-  }
-
-  if (!$rows) {
-    $rows[] = array(array('data' => t('No log messages available.'), 'colspan' => 6));
-  }
-
-  $output .= theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 50, 0);
-
-  return $output;
-}
-
-function theme_watchdog_form_overview($form) {
-  return '<div class="container-inline">'. form_render($form) .'</div>';
-}
-
-function watchdog_form_overview_submit($form_id, $form) {
-  global $form_values;
-  $_SESSION['watchdog_overview_filter'] = $form_values['filter'];
-}
-
-/**
- * Menu callback; displays details about a log message.
- */
-function watchdog_event($id) {
-  $severity = array(WATCHDOG_NOTICE => t('notice'), WATCHDOG_WARNING => t('warning'), WATCHDOG_ERROR => t('error'));
-  $output = '';
-  $result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid WHERE w.wid = %d', $id);
-  if ($watchdog = db_fetch_object($result)) {
-    $header = array(t('Type'), t('Date'), t('User'), t('Location'), t('Referrer'), t('Message'), t('Severity'), t('Hostname'));
-    $data = array(t($watchdog->type), format_date($watchdog->timestamp, 'large'), theme('username', $watchdog), l($watchdog->location, $watchdog->location), l($watchdog->referer, $watchdog->referer), $watchdog->message, $severity[$watchdog->severity], $watchdog->hostname);
-    $output = theme('watchdog_event', $header, $data);
-  }
-  return $output;
-}
-
-function theme_watchdog_event($header, $data) {
-  $output = '';
-  $output .= '<table class="watchdog-event">';
-
-  $n = count($header);
-  for ($i = 0; $i < $n; $i++) {
-    $output .= '<tr class="' . ($i % 2 == 0 ? 'even' : 'odd') . '"><th>' . $header[$i] . '</th><td>' . $data[$i] . '</td></tr>';
-  }
-
-  $output .= '</table>';
-
-  return $output;
-}
-
-function _watchdog_get_message_types() {
-  $types = array();
-
-  $result = db_query('SELECT DISTINCT(type) FROM {watchdog} ORDER BY type');
-  while ($object = db_fetch_object($result)) {
-    $types[] = $object->type;
-  }
-
-  return $types;
-}
similarity index 100%
rename from drupal.conf
rename to planetlab.conf
diff --git a/plot-latlong/.mapimages/Africa.png b/plot-latlong/.mapimages/Africa.png
deleted file mode 100755 (executable)
index cd4cfea..0000000
Binary files a/plot-latlong/.mapimages/Africa.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Australia.png b/plot-latlong/.mapimages/Australia.png
deleted file mode 100755 (executable)
index c0f6b04..0000000
Binary files a/plot-latlong/.mapimages/Australia.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Belgium.png b/plot-latlong/.mapimages/Belgium.png
deleted file mode 100755 (executable)
index 335faca..0000000
Binary files a/plot-latlong/.mapimages/Belgium.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Canada.png b/plot-latlong/.mapimages/Canada.png
deleted file mode 100755 (executable)
index b782efb..0000000
Binary files a/plot-latlong/.mapimages/Canada.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Caribbean.png b/plot-latlong/.mapimages/Caribbean.png
deleted file mode 100755 (executable)
index 3d37287..0000000
Binary files a/plot-latlong/.mapimages/Caribbean.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/CentralAmerica.png b/plot-latlong/.mapimages/CentralAmerica.png
deleted file mode 100755 (executable)
index 67ae790..0000000
Binary files a/plot-latlong/.mapimages/CentralAmerica.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/China.png b/plot-latlong/.mapimages/China.png
deleted file mode 100755 (executable)
index c825fc0..0000000
Binary files a/plot-latlong/.mapimages/China.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Europe.png b/plot-latlong/.mapimages/Europe.png
deleted file mode 100755 (executable)
index c5728cb..0000000
Binary files a/plot-latlong/.mapimages/Europe.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/France.png b/plot-latlong/.mapimages/France.png
deleted file mode 100755 (executable)
index a1f3b2d..0000000
Binary files a/plot-latlong/.mapimages/France.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Germany.png b/plot-latlong/.mapimages/Germany.png
deleted file mode 100755 (executable)
index a8bfa4b..0000000
Binary files a/plot-latlong/.mapimages/Germany.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Hawaii.png b/plot-latlong/.mapimages/Hawaii.png
deleted file mode 100755 (executable)
index fa417f8..0000000
Binary files a/plot-latlong/.mapimages/Hawaii.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/India.png b/plot-latlong/.mapimages/India.png
deleted file mode 100755 (executable)
index 3c609dd..0000000
Binary files a/plot-latlong/.mapimages/India.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Italy.png b/plot-latlong/.mapimages/Italy.png
deleted file mode 100755 (executable)
index 2f7ba30..0000000
Binary files a/plot-latlong/.mapimages/Italy.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Japan.png b/plot-latlong/.mapimages/Japan.png
deleted file mode 100755 (executable)
index b4997d5..0000000
Binary files a/plot-latlong/.mapimages/Japan.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Korea.png b/plot-latlong/.mapimages/Korea.png
deleted file mode 100755 (executable)
index d2e3af3..0000000
Binary files a/plot-latlong/.mapimages/Korea.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/MalaysiaIndonesia.png b/plot-latlong/.mapimages/MalaysiaIndonesia.png
deleted file mode 100755 (executable)
index 3d8c0a0..0000000
Binary files a/plot-latlong/.mapimages/MalaysiaIndonesia.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/MiddleEast.png b/plot-latlong/.mapimages/MiddleEast.png
deleted file mode 100755 (executable)
index eb8847f..0000000
Binary files a/plot-latlong/.mapimages/MiddleEast.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/NOSEFI.png b/plot-latlong/.mapimages/NOSEFI.png
deleted file mode 100755 (executable)
index a5c1de2..0000000
Binary files a/plot-latlong/.mapimages/NOSEFI.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Netherlands.png b/plot-latlong/.mapimages/Netherlands.png
deleted file mode 100755 (executable)
index 1e87009..0000000
Binary files a/plot-latlong/.mapimages/Netherlands.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/NewZealand.png b/plot-latlong/.mapimages/NewZealand.png
deleted file mode 100755 (executable)
index 3750a0f..0000000
Binary files a/plot-latlong/.mapimages/NewZealand.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/Philippines.png b/plot-latlong/.mapimages/Philippines.png
deleted file mode 100755 (executable)
index 18c0a3f..0000000
Binary files a/plot-latlong/.mapimages/Philippines.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/SouthAmerica.png b/plot-latlong/.mapimages/SouthAmerica.png
deleted file mode 100755 (executable)
index 763db3f..0000000
Binary files a/plot-latlong/.mapimages/SouthAmerica.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/UK.png b/plot-latlong/.mapimages/UK.png
deleted file mode 100755 (executable)
index 71dd394..0000000
Binary files a/plot-latlong/.mapimages/UK.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/USA100.png b/plot-latlong/.mapimages/USA100.png
deleted file mode 100755 (executable)
index 542c8b3..0000000
Binary files a/plot-latlong/.mapimages/USA100.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/USA200.png b/plot-latlong/.mapimages/USA200.png
deleted file mode 100755 (executable)
index 8dbafae..0000000
Binary files a/plot-latlong/.mapimages/USA200.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/USA50-new.png b/plot-latlong/.mapimages/USA50-new.png
deleted file mode 100755 (executable)
index 1833e27..0000000
Binary files a/plot-latlong/.mapimages/USA50-new.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/World100.png b/plot-latlong/.mapimages/World100.png
deleted file mode 100755 (executable)
index 82b65a4..0000000
Binary files a/plot-latlong/.mapimages/World100.png and /dev/null differ
diff --git a/plot-latlong/.mapimages/World50-new.png b/plot-latlong/.mapimages/World50-new.png
deleted file mode 100755 (executable)
index 99af593..0000000
Binary files a/plot-latlong/.mapimages/World50-new.png and /dev/null differ
diff --git a/plot-latlong/.mapinfo b/plot-latlong/.mapinfo
deleted file mode 100755 (executable)
index 0e32ee5..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-MAP World World100.png 90 -170 -90 190
-MAP USA USA100.png 50 -125 24 -66
-MAP World50 World50-new.png 90 -170 -90 190
-MAP World100 World100.png 90 -170 -90 190
-MAP Africa Africa.png 38 -18 -35 52
-MAP Australia Australia.png -10 110 -45 155
-MAP Canada Canada.png 75 -142 41 -50
-MAP Caribbean Caribbean.png 27 -85 10 -59
-MAP CentralAmerica CentralAmerica.png 19 -93 5 -77
-MAP China China.png 54 73 18 135
-MAP Europe Europe.png 60 -15 35 30
-MAP Hawaii Hawaii.png 23 -161 18 -154
-MAP India India.png 36 68 5 110
-MAP Japan Japan.png 42 125 30 149
-MAP Korea Korea.png 44 124 34 131
-MAP MalaysiaIndonesia MalaysiaIndonesia.png 8 95 -11 135
-MAP MiddleEast MiddleEast.png 43 25 12 78
-MAP NewZealand NewZealand.png -34 166 -48 180
-MAP NOSEFI NOSEFI.png 72 4 55 32
-MAP Philippines Philippines.png 19 117 5 127
-MAP USA50 USA50-new.png 50 -125 24 -66
-MAP USA100 USA100.png 50 -125 24 -66
-MAP USA200 USA200.png 50 -125 24 -66
-MAP SouthAmerica SouthAmerica.png 13 -82 -56 -34
-MAP Belgium Belgium.png 51.6 2.5 49.4 6.6
-MAP France France.png 52 -5 42 9
-MAP Germany Germany.png 56 5 47 16
-MAP Italy Italy.png 48 6 35 19
-MAP Netherlands Netherlands.png 53.6 3.3 50.7 7.3
-MAP UK UK.png 59 -11 49 2
-# Calculated via trial and error.
-PROJECTION  USA50 ALBER  703.18 30.8 45.5 21.7 -99.9 232 390
-PROJECTION USA100 ALBER 1406.35 30.8 45.5 21.7 -99.9 464 781
-PROJECTION    USA ALBER 1406.35 30.8 45.5 21.7 -99.9 464 781
-PROJECTION USA200 ALBER 2812.7  30.8 45.5 21.7 -99.9 929 1561
diff --git a/plot-latlong/CONFIG b/plot-latlong/CONFIG
deleted file mode 100755 (executable)
index 367c7fd..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-OVERVIEW
-
-This document describes the format of the .mapinfo configuration file,
-which specifies the maps (and their projection parameters) available to
-users of plot-latlong.
-
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-SYNTAX
-
-The .mapinfo file has a simple line-oriented syntax.  Each line
-independently specifies some piece of information, and the order of the
-lines is unimportant.  Blank lines and lines starting with '#', which
-may be preceded by whitespace, are ignored.  All other lines must have
-the syntax described below.
-
-We use a few conventions in the following description of the syntax.
-Placeholders are denoted by words enclosed in angle brackets (e.g.,
-<map-name>).  All other words are literals that should be included
-verbatim.  The order of the words on each line is significant.  One or
-more whitespace characters should separate the individual words on each line.
-
-1) map definitions:
-
-  MAP <map-name> <image-path> <top-lat> <top-long> <bot-lat> <bot-long>
-
-  MAP World World100.png 90 -170 -90 190
-
-These lines specify a map that is available to the user and supply some
-basic attributes.
-
-The values are
-
-  <map-name> -- the name of the map; this is the name used for the '-m'
-             command line argument; the name must consist of letters,
-             digits, and underscores--no spaces are allowed
-
-  <image-path> -- the name of the PNG file containing the map image; the
-             path is relative to the location of the .mapimages directory,
-             so in most cases, the path can be a simple filename such as
-             "World100.png"
-
-  <top-lat>
-  <top-long> -- the lat/long of the top-left corner of the map image in
-             decimal degrees
-
-  <bot-lat>
-  <bot-long> -- the lat/long of the bottom-right corner of the map image in
-             decimal degrees
-
-
-2) map projection parameters:
-
-  PROJECTION <map-name> <projection-name> <projection parameters>
-
-  PROJECTION  USA50 ALBER  704.0 30.8 45.5 21.86 -99.9 232 388
-
-These lines specify the parameters for nonlinear map projections.  In
-contrast, the values given in MAP lines are sufficient for linear map
-projections.
-
-The values are
-
-  <map-name> -- the name of the map; this value should match the name used
-             in the corresponding MAP line
-
-  <projection-name> -- the name of the nonlinear projection that will be
-             applied to the map; currently, if maps are not linear, they may
-             have one nonlinear projection specified for them; multiple
-             nonlinear projections for the same map are not allowed
-
-  <projection parameters> -- a variable set of values that provides the
-             actual parameters for the map projection; see below for details
-
-
-The following describes the supported projections and their parameters.
-Only one projection is currently supported:
-
-  ALBER -- an Alber/Lambert projection; this is used by the USA maps
-           included in the distribution    
-
-           See the publication "Map Projections Used by the U.S. Geological
-           Survey Bulletin 1532" for details about this projection.
-
-    parameters:
-
-     <R> <phi_1> <phi_2> <phi_0> <lambda_0> <false-easting> <false-northing>
-
-     where
-
-       <R> -- radius of sphere
-       <phi_1> -- standard parallel (lower)
-       <phi_2> -- standard parallel (upper)
-       <phi_0> -- origin latitude
-       <lambda_0> -- origin longitude
-       <false-easting> -- the false easting amount
-       <false-northing> -- the false northing amount
-
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-TIPS & TRICKS
-
-Creating maps at different scales is both useful and relatively easy.
-The following describes the steps for creating maps at different scales
-using existing maps:
-
- 1) Use an image editing tool/package like ImageMagick or NetPBM to create
-    a map image at a different size; e.g.,
-
-      convert -scale '50%' .mapimages/World100.png .mapimages/World50.png
-
-    would create a half-sized image using the 'convert' tool of ImageMagick.
-
- 2) Add a MAP line to .mapinfo; specifically, copy the MAP line of the 
-    source map and change the map name and image path--don't change the
-    lat/long parameters; e.g.,
-
-         MAP World100 World100.png 90 -170 -90 190
-     =>  MAP World50  World50.png  90 -170 -90 190
-
- 3) For maps created with nonlinear projections, add a PROJECTION line to
-    .mapinfo; again, you may simply copy and tweak the PROJECTION line of
-    the source map; e.g.,
-
-        PROJECTION  USA50 ALBER  704.0 30.8 45.5 21.86 -99.9 232 388
-        PROJECTION USA100 ALBER 1408.0 30.8 45.5 21.86 -99.9 464 776
-        PROJECTION USA200 ALBER 2816.0 30.8 45.5 21.86 -99.9 928 1552
-
-    For the Alber/Lambert projection, you need only change the <R>,
-    <false-easting>, and <false-northing> parameters.  These values change
-    in direct proportion to the change in size of the image itself.  For
-    example, if the size is halved, then these parameter values should be
-    halved; if the size is doubled, then the values should be doubled.
-    In the above example, USA100 is the USA map at 100%; USA50 and USA200
-    represent images at 50% and 200%, respectively.
diff --git a/plot-latlong/README b/plot-latlong/README
deleted file mode 100755 (executable)
index 961224e..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-                          plot-latlong
-
-                           version 0.3
-
-                           Jun 10, 2005
-
-                 (c) 2003,2004,2005 CAIDA/UCSD
-
-  (http://www.caida.org/tools/visualization/plot-latlong/index.xml)
-
-                   plot-latlong-info@caida.org
-                   plot-latlong-bugs@caida.org
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-CHANGES
-
- * v0.3 released Jun 10, 2005
-   - added -i option to specify location of mapinfo file.
-
- * v0.2 released Apr 6, 2004
-
-   - added test-gd script for testing the GD installation
-
- * v0.1 released Oct 3, 2003 -- initial release
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-DESCRIPTION
-
-plot-latlong is a small command line tool written in perl for plotting
-points on geographic maps given a list of latitude/longitude (lat/long)
-pairs.  This is aimed at situations in which
-
-  * a moderate amount of accuracy and precision is sufficient
-  * a large number of locations need to be plotted (tens of thousands of
-    locations can be easily handled)
-  * the plotting needs to be automatable (from a shell script, for example)
-  * a lightweight tool (both small and with few dependencies) that just plots
-    points is sufficient
-  * ease of modification is important (so that special requirements can be
-    met)
-
-plot-latlong can handle nonlinear map projections (currently the
-Alber/Lambert projection) and is intentionally minimalistic so that it can
-serve as a building block.  Users can build upon it in three ways: (1) add
-new maps, (2) run the output images through packages like NetPBM to add
-titles, etc., and (3) modify the source to change how points are drawn, to
-add labels, etc.  plot-latlong can also be used to simply compute the
-mapping from lat/long to pixel coordinates (for a given map).  These pixel
-coordinates can then be fed to other programs to draw more elaborate
-pictures.
-
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-IMPLEMENTED FEATURES
-
-The list of implemented features is intentionally short:
-
-  * drawing points at a user-specified size
-  * printing out just the pixel coordinates of input lat/long pairs
-  * support for linear projections (the relationship between pixels
-    and lat/long values is linear)
-  * support for the Alber/Lambert nonlinear projection
-
-The distribution includes over two dozen maps, covering the continents
-and several country groups.  Users can also supply maps to use, so
-long as the projection type is supported and the projection parameters
-are known.
-
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-CAVEATS
-
-plot-latlong is unsuitable for applications demanding high accuracy.
-Accuracy is likely no better than 5-10 miles--and even this is merely a
-shot in the dark, since we're not in a position to rigorously determine the
-accuracy of the generated plots.  The following factors contribute to
-increased inaccuracy:
-
-  * the relative coarseness of the supplied maps
-  * unverified projection parameters for the supplied maps
-  * the USA maps, which use the Alber/Lambert projection, have parameters
-    calibrated by eye
-  * the geodetic datum assumed by the supplied maps is unknown to us
-    (http://www.colorado.edu/geography/gcraft/notes/datum/datum_f.html)
-
-     + lat/long coordinate values are not universal; values are always
-       specified in some system, the datum, and mismatches in the assumed
-       datum can lead to the specification of physical locations that are
-       separated by as much as 1km
-
-     + to assess whether plot-latlong will be sufficient for your needs,
-       you might try comparing the results with those from the
-       Tiger Map Server (http://tiger.census.gov/cgi-bin/mapbrowse-tbl/)
-       and MapQuest (http://www.mapquest.com/maps/latlong.adp).
-
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-REQUIREMENTS
-
-The requirements for running plot-latlong are:
-
-  * UNIX-like operating system
-  * perl (http://www.perl.com)
-  * GD.pm (http://stein.cshl.org/WWW/software/GD/), which in turn requires
-    (see the README of GD.pm):
-
-     + the gd graphics library (http://www.boutell.com/gd/)
-     + the PNG graphics library (http://www.libpng.org/pub/png/libpng.html)
-     + the zlib compression library (http://www.gzip.org/zlib/)
-
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-INSTALLATION
-
-No installation, per se, is required, but for the greatest convenience,
-it is best to copy some files to your home directory, as in the following:
-
-     cp plot-latlong $HOME/bin
-     cp -R .mapinfo .mapimages $HOME
-
-Assuming $HOME/bin is in your PATH, you can now run plot-latlong from
-anywhere.
-
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-USAGE
-
-plot-latlong reads lat/long values from stdin and writes a PNG to
-stdout.  The input should contain one pair of lat/long values per line
-with the values separated by whitespace.  Each coordinate should be a
-decimal value, with negative values indicating south or west.  Blank lines
-and lines starting with the pound character ('#') are ignored.
-
-Command line options are
-
-  -m <map-name> specifies the name of a map to use (default: the first
-     map listed in .mapinfo: 'World'); see .mapinfo for the valid map names;
-     see the file CONFIG for a description of the .mapinfo format
-
-  -s <point-size> specifies the size of the points to draw (default: 1);
-     points are filled squares, and the size is the width in pixels
-
-     (NOTE: Points drawn at the default size of 1 pixel may be hard to see
-            when only a few points are plotted.  Use '-s 10' when plotting
-            a small number of points.)
-
-  -c causes the pixel coordinates of each lat/long to be printed to stderr;
-     the coordinates (0, 0) are at the upper left corner, and values increase
-     to the right and down
-
-  -i <map-info-file> specifies an alternate location for .mapinfo (other
-     than in the current directory or $HOME).
-
-Examples:
-
-$ cat locations.txt | ./plot-latlong >plot.png
-
-$ ./plot-latlong -m USA -s 10 >plot.png <<EOF
-# san diego
-32.8155594 -117.1361008
-
-# miami, fl
-25.7707844 -80.2112045
-
-# new york, ny
-40.6691055 -73.9439468
-EOF
-
-$ cat locations.txt | ./plot-latlong -c >/dev/null 2>xy.txt
-$ head xy.txt
-33.58 -86.52 250.44 168.946555555556
-33.59 -86.96 249.12 168.916611111111
-...
-
-
-NOTE: You may safely ignore the following warning:
-
-             gd-png warning: alpha channel not supported
-
-      This warning says that the input map image had transparency information,
-      which some GD versions don't support.  None of the map images included
-      in the distribution have transparency, but maps of your own may.
-      In such cases, use an image editing tool to remove the transparency
-      information.
-
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-ACKNOWLEDGMENTS
-
-The code for handling the Alber/Lambert map projection is derived from
-GTrace v1.0.0beta (http://www.caida.org/tools/visualization/gtrace),
-which was written by Ram Periakaruppan.  The included set of maps are also
-derived from the GTrace distribution.  GTrace redistributed these maps
-with the permission of VisualRoute (http://www.visualroute.com),
-the original source of the maps.
-
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-LICENSE
-
-Copyright (C) 2003,2004,2005 The Regents of the University of California.
-All Rights Reserved.
-
-Permission to use, copy, modify and distribute any part of this
-plot-latlong software package for educational, research and non-profit
-purposes, without fee, and without a written agreement is hereby
-granted, provided that the above copyright notice, this paragraph
-and the following paragraphs appear in all copies.
-  
-Those desiring to incorporate this into commercial products or use
-for commercial purposes should contact the Technology Transfer
-Office, University of California, San Diego, 9500 Gilman Drive, La
-Jolla, CA 92093-0910, Ph: (858) 534-5815, FAX: (858) 534-7345.
-
-IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
-PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
-DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND THE
-UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
-SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. THE UNIVERSITY
-OF CALIFORNIA MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES
-OF ANY KIND, EITHER IMPLIED OR EXPRESS, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-PARTICULAR PURPOSE, OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE
-ANY PATENT, TRADEMARK OR OTHER RIGHTS.
-The plot-latlong software is developed by the plot-latlong Team at the
-University of California, San Diego under the Cooperative Association
-for Internet Data Analysis (CAIDA) Program.  Support for this work is
-provided by the National Communications System (NCS) via NSF grant
-ANI-0221172, entitled "Routing and Peering Analysis for Enhancing
-Internet Performance and Security."
diff --git a/plot-latlong/plot-latlong b/plot-latlong/plot-latlong
deleted file mode 100755 (executable)
index d1f574e..0000000
+++ /dev/null
@@ -1,390 +0,0 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-## Plots user supplied lat/longs on a user chosen map.
-##
-## plot-latlong reads lat/long values from stdin and writes a PNG to
-## stdout.  The input should contain one pair of lat/long values per line,
-## with the values separated by whitespace.  Blank lines and lines starting
-## with the pound character ('#') are ignored.
-##
-## Command line options are
-##
-##  -m <map-name> specifies the name of a map to use (default: the first
-##     map listed in .mapinfo: 'World'); see .mapinfo for the valid map names;
-##     see the file CONFIG for a description of the .mapinfo format
-##
-##  -s <point-size> specifies the size of the points to draw (default: 1);
-##     points are filled squares, and the size is the width in pixels
-##
-##  -c causes the pixel coordinates of each lat/long to be printed to stderr;
-##     the coordinates (0, 0) are at the upper left corner, and values increase
-##     to the right and down
-##
-##  -i <map-info-file> specifies an alternate location for .mapinfo (other
-##     than in the current directory or $HOME).
-##
-##----------------------------------------------------------------------------
-##
-## The code for handling the Alber/Lambert map projection is derived from
-## GTrace v1.0.0beta (http://www.caida.org/tools/visualization/gtrace),
-## which was written by Ram Periakaruppan.  The included set of maps are also
-## derived from the GTrace distribution.  GTrace redistributed these maps
-## with the permission of VisualRoute (http://www.visualroute.com),
-## the original source of the maps.
-##
-##----------------------------------------------------------------------------
-##
-## Copyright (C) 2003,2004,2005 The Regents of the University of California.
-## All Rights Reserved.
-## 
-## Permission to use, copy, modify and distribute any part of this
-## plot-latlong software package for educational, research and non-profit
-## purposes, without fee, and without a written agreement is hereby
-## granted, provided that the above copyright notice, this paragraph
-## and the following paragraphs appear in all copies.
-##  
-## Those desiring to incorporate this into commercial products or use
-## for commercial purposes should contact the Technology Transfer
-## Office, University of California, San Diego, 9500 Gilman Drive, La
-## Jolla, CA 92093-0910, Ph: (858) 534-5815, FAX: (858) 534-7345.
-## 
-## IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
-## PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
-## DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS
-## SOFTWARE, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF
-## THE POSSIBILITY OF SUCH DAMAGE.
-## 
-## THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND THE
-## UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
-## SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. THE UNIVERSITY
-## OF CALIFORNIA MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES
-## OF ANY KIND, EITHER IMPLIED OR EXPRESS, INCLUDING, BUT NOT LIMITED
-## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-## PARTICULAR PURPOSE, OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE
-## ANY PATENT, TRADEMARK OR OTHER RIGHTS.
-##  
-## The plot-latlong software is developed by the plot-latlong Team at the
-## University of California, San Diego under the Cooperative Association
-## for Internet Data Analysis (CAIDA) Program.  Support for this work is
-## provided by the National Communications System (NCS) via NSF grant
-## ANI-0221172, entitled "Routing and Peering Analysis for Enhancing
-## Internet Performance and Security."
-##
-##############################################################################
-
-use strict;
-use File::Basename;
-use GD;
-use Getopt::Std;
-use vars qw($opt_m $opt_s $opt_c $opt_i);
-
-sub usage
-{
-  die "usage: cat datapoints | plot-latlong [-m <map-name>] [-s <point-size>] [-c] [-i <map-info-file>] >output.png\n";
-}
-
-if (not getopts('m:s:ci:'))
-{
-  usage();
-}
-
-my $DEBUG = 0;
-my $PI = 3.141592654;
-
-my $point_size = $opt_s || 1;
-
-my $first_map;
-my $map_directory;  # directory containing map images
-my %configuration;
-my @mapinfo_locations = (".mapinfo", "$ENV{HOME}/.mapinfo");
-if ($opt_i) {
-    unshift @mapinfo_locations, $opt_i;
-}
-load_configuration(@mapinfo_locations);
-
-my $selected_map = $opt_m || $first_map;
-
-# lat/long of the upper-left and lower-right corners of the map image
-my $map_top_lat;
-my $map_top_long;
-my $map_bottom_lat;
-my $map_bottom_long;
-
-# parameters for linear projection: pixels per degree
-my $map_lat_scale;
-my $map_long_scale;
-
-# parameters for Alber projection (supplied by user):
-# (in degrees)
-my $R;              # radius of sphere
-#my $phi_1;          # standard parallel
-#my $phi_2;          # standard parallel
-#my $phi_0;          # origin latitude
-#my $lambda_0;       # origin longitude
-my $false_easting;  # the false easting amount
-my $false_northing; # the false northing amount
-
-# values for Alber projection calculated from user parameters:
-# (in radians)
-my $PHI_1;
-my $PHI_2;
-my $PHI_0;
-my $LAMBDA_0;
-my $N;
-my $C;
-
-my $conversion_fn;  # pointer to function for converting lat/long to (x, y)
-
-my $map = load_map($selected_map);
-
-#############################################################################
-
-my $green = $map->colorAllocate(64, 192, 64);
-my $red = $map->colorAllocate(220, 64, 64);
-
-while (<>)
-{
-  chomp;
-  next if /^\s*$/;
-  next if /^\s*#/;
-
-  # REQUIRE: -90 <= $lat <= 90
-  my ($lat, $long) = split /\s+/;
-  my $adjusted_long = $long;
-  if ($long < $map_top_long) {
-      $adjusted_long += 360;
-  } elsif ($long > $map_bottom_long) {
-      $adjusted_long -= 360;
-  }
-  my ($x, $y) = &$conversion_fn($lat, $adjusted_long);
-
-  print STDERR "$lat $long $x $y\n" if $DEBUG || $opt_c;
-
-  if ($point_size == 1)
-  {
-    $map->setPixel($x, $y, $red);
-  }
-  else
-  {
-    my $half = int($point_size / 2);
-    my $left_x = $x - $half;
-    my $top_y = $y - $half;
-    $map->filledRectangle($left_x, $top_y,
-                         $left_x + $point_size - 1, $top_y + $point_size - 1,
-                         $red);
-  }
-}
-
-print $map->png if not $DEBUG;
-
-#############################################################################
-#############################################################################
-
-sub convert_latlong_to_xy_linear
-{
-  my ($lat, $long) = @_;
-
-  my $lat_rel = $map_top_lat - $lat;
-  my $long_rel = $long - $map_top_long;
-
-  return ($long_rel * $map_long_scale, $lat_rel * $map_lat_scale);
-}
-
-#############################################################################
-
-
-# See the publication "Map Projections Used by the U.S. Geological
-# Survey Bulletin 1532" for details about this projection.
-#
-# However, the present coder does not know exactly which projection this
-# function corresponds to in the USGS Bulletin.
-
-sub round {
-    my ($number) = @_;
-    return int($number + .5 * ($number <=> 0));
-}
-
-sub convert_latlong_to_xy_alber
-{
-  my ($lat, $long) = @_;
-
-  my $phi = ($lat * $PI) / 180.0;
-  my $lambda = ($long * $PI) / 180.0;
-
-  my $p   = ($R * sqrt($C - 2.0 * $N * sin($phi))) / $N;
-  my $p_0 = ($R * sqrt($C - 2.0 * $N * sin($PHI_0))) / $N;
-  my $theta = $N * ($lambda - $LAMBDA_0);
-
-  my $x = $false_easting + round($p * sin($theta));
-  my $y = $false_northing - round($p_0 - $p * cos($theta));
-
-  return ($x, $y);
-}
-
-############################################################################
-
-sub load_map
-{
-  my ($name) = @_;
-
-  if (not exists $configuration{"MAP $name"})
-  {
-    die "ERROR: Map '$name' not found in map configuration file.\n";
-  }
-
-  print("OPEN: $name ", $configuration{"MAP $name"}, "\n") if $DEBUG;
-
-  my $filename;
-  ($filename, $map_top_lat, $map_top_long, $map_bottom_lat, $map_bottom_long)
-    = split(/\s+/, $configuration{"MAP $name"});
-
-  my $path = "$map_directory/$filename";
-  my $retval = new GD::Image($path)
-    or die "ERROR: Couldn't open map image '$path': $!\n";
-
-  my ($map_width, $map_height) = $retval->getBounds();
-
-  print("DIM: $map_width $map_height\n") if $DEBUG;
-
-  $map_lat_scale = $map_height / ($map_top_lat - $map_bottom_lat);
-  $map_long_scale = $map_width / ($map_bottom_long - $map_top_long);
-
-  print("SCALE: $map_lat_scale $map_long_scale\n") if $DEBUG;
-
-  # -- projections -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-  if (not exists $configuration{"PROJECTION $name"})
-  {
-    $conversion_fn = \&convert_latlong_to_xy_linear;
-  }
-  else
-  {
-    my @F = split(/\s+/, $configuration{"PROJECTION $name"});
-    if ($F[0] eq "ALBER")
-    {
-      ($R, $false_easting, $false_northing) = @F[1,6,7];
-      my ($phi_1, $phi_2, $phi_0, $lambda_0) = @F[2..5];
-
-      $PHI_1 = ($phi_1 * $PI) / 180.0;
-      $PHI_2 = ($phi_2 * $PI) / 180.0;
-      $PHI_0 = ($phi_0 * $PI) / 180.0;
-      $LAMBDA_0 = ($lambda_0 * $PI) / 180.0;
-
-      $N = (sin($PHI_1) + sin($PHI_2)) / 2.0;
-      $C = cos($PHI_1) ** 2 + 2.0 * $N * sin($PHI_1);
-
-      $conversion_fn = \&convert_latlong_to_xy_alber;
-    }
-    else
-    {
-      die "INTERNAL ERROR: unknown projection '$F[0]'\n";
-    }
-  }
-
-  return $retval;
-}
-
-#############################################################################
-
-sub load_configuration
-{
-  foreach my $filename (@_)
-  {
-    if (-f $filename)
-    {
-      $map_directory = dirname($filename) . "/.mapimages";
-      load_configuration_aux($filename);
-      return;
-    }
-  }
-
-  die "ERROR: Couldn't find map configuration file; looked for: @_\n";
-}
-
-sub load_configuration_aux
-{
-  my ($filename) = @_;
-
-  open CONFIG, "$filename"
-    or die "ERROR: Couldn't open map configuration file '$filename': $!\n";
-  while (<CONFIG>)
-  {
-    chomp;
-    next if /^\s*$/;
-    next if /^\s*#/;
-
-    my @F = split /\s+/;
-    if ($F[0] eq "MAP")
-    {
-      if ($#F == 6)
-      {
-       my ($top_lat, $top_long, $bot_lat, $bot_long) = @F[3..6];
-       if (!check_coordinate($top_lat)
-           || !check_coordinate($top_long)
-           || !check_coordinate($bot_lat)
-           || !check_coordinate($bot_long))
-       {
-         die "ERROR: Line $.: boundary coordinates are malformed in map configuration file.\n";
-       }
-
-       if ($top_lat < $bot_lat || $top_long > $bot_long)
-       {
-         die "ERROR: Line $.: boundary coordinates have wrong relations in map configuration file.\n";
-       }
-
-       $first_map = $F[1] if not defined $first_map;
-       $configuration{"MAP $F[1]"} = join(" ", @F[2..6]);
-       next;
-      }
-    }
-    elsif ($F[0] eq "PROJECTION")
-    {
-      if ($#F >= 2)
-      {
-       if ($F[2] eq "ALBER")
-       {
-         if ($#F == 9)
-         {
-           foreach my $x (@F[3..9])
-           {
-             if (not check_number($x))
-             {
-               die "ERROR: Line $.: projection parameters are malformed in map configuration file.\n";
-             }
-           }
-
-           $configuration{"PROJECTION $F[1]"} = join(" ", @F[2..9]);
-           next;
-         }
-       }
-       else
-       {
-         die "ERROR: Line $.: unknown map projection '$F[2]' in map configuration file.\n";
-       }
-      }
-    }
-    else
-    {
-      die "ERROR: Line $.: unknown key '$F[0]' in map configuration file.\n";
-    }
-
-    die "ERROR: Line $. of map configuration file is malformed.\n";
-  }
-  close CONFIG;
-}
-
-#############################################################################
-
-sub check_coordinate
-{
-  my ($x) = @_;
-
-  return $x =~ /^(\-?)\d+(\.\d+)?$/;
-}
-
-
-sub check_number
-{
-  return check_coordinate(@_);
-}
diff --git a/scripts/code-clean.sh b/scripts/code-clean.sh
deleted file mode 100644 (file)
index 10a3a26..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-# $Id: code-clean.sh 144 2007-03-28 07:52:20Z thierry $
-
-find . -name "*~" -type f | xargs rm -f
-find . -name ".#*" -type f | xargs rm -f
-find . -name "*.rej" -type f | xargs rm -f
-find . -name "*.orig" -type f | xargs rm -f
-find . -name "DEADJOE" -type f | xargs rm -f
-find . -type f | grep -v ".psp" | grep -v ".gif" | grep -v ".jpg" | grep -v ".png" | grep -v ".tgz" | grep -v ".ico" | grep -v "druplicon" | xargs perl -wi -pe 's/\s+$/\n/'
-find . -type f | grep -v ".psp" | grep -v ".gif" | grep -v ".jpg" | grep -v ".png" | grep -v ".tgz" | grep -v ".ico" | grep -v "druplicon" | xargs perl -wi -pe 's/\t/  /g'
diff --git a/scripts/code-style.pl b/scripts/code-style.pl
deleted file mode 100644 (file)
index 3b285a5..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-#!/usr/bin/perl -w
-# $Id: code-style.pl 144 2007-03-28 07:52:20Z thierry $
-
-# Author: Alexander Schwartz (alexander.schwartz@gmx.net)
-# Licence: GPL
-# First version: 2001-10-15
-
-# Originally written for Drupal (http://drupal.org/) to ensure stylish
-# code.  This program tries to show as many improvements as possible with
-# no false positives.
-
-# $Id: code-style.pl 144 2007-03-28 07:52:20Z thierry $
-
-$comment = 0;
-$program = 0;
-if ($ARGV[0] eq '-debug') {
-  $debug=1;
-  shift (@ARGV);
-}
-else {
-  $debug=0;
-}
-while (<>) {
-  $org=$_;
-  s/\\["']//g;
-  # please don't use nested comments for now... thanks!
-  # handles comments // style, but don't mess with http://
-  s/\/\/[^:].*//;
-  # handles comments /**/ on a single line
-  s/\/\*.*\*\///g;
-  # handles comments /**/ over several lines
-  if ($comment == 1) {
-    if (s/.*\*\///) {
-      $comment = 0;
-    }
-    else {
-      next;
-    }
-  }
-  if (s/\/\*.*//) {
-    $comment = 1;
-  }
-  if (/^\s*#/) {
-    next;
-  }
-
-  if (s/<\?php//) {
-    $program = 1;
-  }
-  if (/\?>/) {
-    $program = 0;
-  }
-
-  # enforce "bar". foo() ."bar" syntax
-  if (/^("[^"]*"|[^"])*("[^"]*")\.[^ ]/ && $program) {
-    $msg = "'\".' -> '\". '";
-  }
-  elsif (/^("[^"]*"|[^"])*("[^"]*")\s+\./ && $program) {
-    $msg = "'\" .' -> '\".'";
-  }
-  # enforce "bar". foo() ."bar" syntax
-  elsif (/^("[^"]*"|[^"])*[^ "]\.("[^"]*")/ && $program) {
-    $msg = "'.\"' -> '.\"'";
-  }
-  elsif (/^("[^"]*"|[^"])*[^ "]\.\s+("[^"]*")/ && $program) {
-    $msg = "'. \"' -> '.\"'";
-  }
-  # XHTML requires closing tag
-  elsif (/<br>/i) {
-    $msg = "'<br>' -> '<br />'";
-  }
-  elsif (/\$REQUEST_URI/i) {
-    $msg = "the use of REQUEST_URI is prone to XSS exploits and does not work on IIS; use request_uri() instead";
-  }
-  elsif (/\"REQUEST_URI\"/i) {
-    $msg = "the use of REQUEST_URI is prone to XSS exploits and does not work on IIS; use request_uri() instead";
-  }
-
-  # XHTML compatibility mode suggests a blank before /
-  # i.e. <br />
-  elsif (/<[a-z][^>]*[^ >]\/>/i) {
-    $msg = "'<foo/".">' -> '<foo />'";
-  }
-  # we write '{' on the same line, not on the next
-  elsif (/^\s*{/ && $program) {
-    $msg = "take '{' to previous line";
-  }
-  elsif (/([a-z])([A-Z])/) {
-    $msg = "no mixed case function or variable names, use lower case and _";
-  }
-  elsif (/<[\/]*[A-Z]+[^>]*>/) {
-    $msg = "XHTML demands tags to be lowercase";
-  }
-
-  # trying to recognize splitted lines
-  # there are only a few valid last characters in programming mode,
-  # only sometimes it is ( if you use if/else with a single statement
-
-  # from here on we need no more strings
-  while (s/^([^"]*)"[^"]*"/$1#/) {};
-  while (s/^([^']*)'[^']*'/$1#/) {};
-
-  # it should be 'if (' all the time
-  if (/(^|[^a-zA-Z])(if|else|elseif|while|foreach|switch|return|for)\(/) {
-    $msg = "'(' -> ' ('";
-  }
-  #elsif (/[^;{}:\s\n]\s*\n*$/ && $program && !/^[\s}]*(if|else)/) {
-  #  $msg = "don't split lines";
-  #}
-  elsif (/\}\s*else/) {
-    $msg = "'} else' -> '}\\nelse'";
-  }
-  elsif (/[^{\s\n]\s*\n*$/ && $program && /^\s*(if|else)/) {
-    $msg = "every if/else needs a { at eol";
-  }
-  elsif (/([\(\[]) / && $program) {
-    $msg = "'$1 ' -> '$1'";
-  }
-  elsif (/ ([\)\]])/ && $program) {
-    $msg = "' $1' -> '$1'";
-  }
-  # but no brackets
-  elsif (/([a-z-A-Z_][a-zA-Z0-9_-]*)\s+\(/ && $program) {
-    if ($1 ne "switch" and $1 ne "if" and $1 ne "while" and $1 ne "foreach" and $1 ne "return" and $1 ne "for" and $1 ne "elseif") {
-      $msg = "'$1 (' -> '$1('";
-    }
-  }
-  # there should be a space before '{'
-  if (/[^ ]{/ && $program) {
-    $msg = "missing space before '{'";
-  }
-  # there should be a space after ','
-  elsif (/[,][^ \n\r]/ && $program) {
-    $msg = "missing space after ','";
-  }
-  # spaces before and after, only foreach may use $foo=>bar
-  elsif (/[^ =|\-|\+](\+|\-)[^ =>|\-|\+]/ && $program && !/foreach/) {
-    $msg = "'$1' -> ' $1 '";
-  }
-  elsif (/[^ =](\*|==|\.=|=>|=|\|\|)[^ =>]/ && $program && !/foreach/) {
-    $msg = "'$1' -> ' $1 '";
-  }
-  # ensure $bar["foo"] and $bar[$foo] and $bar[0]
-  elsif (/\[[^#][^\]]*\]/ && !/\[[0-9\$][^\]]*\]/ && !/\[\]/) {
-    $msg = "only [\"foo\"], [\$foo] or [0] is allowed";
-  }
-  # first try to find missing quotes after = in (X)HTML tags
-  elsif (/<[^>]*=[a-zA-Z0-9][^>]*>/) {
-    $msg = "=... -> =\"...\"";
-  }
-  if (defined $msg) {
-    if ($debug==0) {
-      print $ARGV .":". $. .": $msg : ". $org;
-    }
-    undef $msg;
-  }
-  elsif ($debug==1) {
-    print $org;
-  }
-} continue {
-  close ARGV if eof;
-}
diff --git a/scripts/cron-curl.sh b/scripts/cron-curl.sh
deleted file mode 100644 (file)
index c3030ea..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-# $Id: cron-curl.sh 144 2007-03-28 07:52:20Z thierry $
-
-curl --silent --compressed http://yoursite.com/cron.php
diff --git a/scripts/cron-lynx.sh b/scripts/cron-lynx.sh
deleted file mode 100644 (file)
index 7ab13db..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-# $Id: cron-lynx.sh 144 2007-03-28 07:52:20Z thierry $
-
-/usr/bin/lynx -source http://yoursite.com/cron.php > /dev/null 2>&1
diff --git a/scripts/prefix.sh b/scripts/prefix.sh
deleted file mode 100644 (file)
index 87fd498..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-# $Id: prefix.sh 144 2007-03-28 07:52:20Z thierry $
-
-if [ $# != 2 ]; then
-  cat >&2 << EOH
-This is Drupal database prefixer.
-
-Usage:
-  $0 prefix original_db.sql >prefixed_db.sql
-
-- all tables will prefixed with 'prefix'
-EOH
-
-exit 1;
-fi
-
-PREFIX=$1;
-sed "s/^CREATE TABLE /CREATE TABLE $PREFIX/;
-     s/^INSERT INTO /INSERT INTO $PREFIX/;
-     s/^REPLACE /REPLACE $PREFIX/;
-     s/^ALTER TABLE /ALTER TABLE $PREFIX/;
-     s/^CREATE SEQUENCE /CREATE SEQUENCE $PREFIX/;
-     s/^ALTER SEQUENCE /ALTER SEQUENCE $PREFIX/;
-     s/^CREATE INDEX \(.*\) ON /CREATE INDEX $PREFIX\\1 ON $PREFIX/;
-     s/^CREATE UNIQUE INDEX \(.*\) ON /CREATE UNIQUE INDEX $PREFIX\\1 ON $PREFIX/;
-     s/^UPDATE \(.*\) SET /UPDATE $PREFIX\\1 SET /;
-     s/^DROP TABLE IF EXISTS /DROP TABLE IF EXISTS $PREFIX/;
-     s/ DEFAULT nextval('/ DEFAULT nextval('$PREFIX/;
-     " $2
-
diff --git a/sites/default/settings.php b/sites/default/settings.php
deleted file mode 100644 (file)
index 6f2ca2b..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-// $Id: settings.php 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Drupal site-specific configuration file.
- *
- * The configuration file to be loaded is based upon the rules below.
- *
- * The configuration directory will be discovered by stripping the
- * website's hostname from left to right and pathname from right to
- * left. The first configuration file found will be used and any
- * others will be ignored. If no other configuration file is found
- * then the default configuration file at 'sites/default' will be used.
- *
- * For example, for a fictitious site installed at
- * http://www.drupal.org/mysite/test/, the 'settings.php'
- * is searched in the following directories:
- *
- *  1. sites/www.drupal.org.mysite.test
- *  2. sites/drupal.org.mysite.test
- *  3. sites/org.mysite.test
- *
- *  4. sites/www.drupal.org.mysite
- *  5. sites/drupal.org.mysite
- *  6. sites/org.mysite
- *
- *  7. sites/www.drupal.org
- *  8. sites/drupal.org
- *  9. sites/org
- *
- * 10. sites/default
- *
- * If you are installing on a non-standard port number, prefix the
- * hostname with that number.  For example,
- * http://www.drupal.org:8080/mysite/test/ could be loaded from
- * sites/8080.www.drupal.org.mysite.test/.
- */
-
-/**
- * Database settings:
- *
- * Note that the $db_url variable gets parsed using PHP's built-in
- * URL parser (i.e. using the "parse_url()" function) so make sure
- * not to confuse the parser. If your username, password
- * or database name contain characters used to delineate
- * $db_url parts, you can escape them via URI hex encodings:
- *
- *   : = %3a   / = %2f   @ = %40
- *   + = %2b   ( = %28   ) = %29
- *   ? = %3f   = = %3d   & = %26
- *
- * To specify multiple connections to be used in your site (i.e. for
- * complex custom modules) you can also specify an associative array
- * of $db_url variables with the 'default' element used until otherwise
- * requested.
- *
- * You can optionally set prefixes for some or all database table names
- * by using the $db_prefix setting. If a prefix is specified, the table
- * name will be prepended with its value. Be sure to use valid database
- * characters only, usually alphanumeric and underscore. If no prefixes
- * are desired, leave it as an empty string ''.
- *
- * To have all database names prefixed, set $db_prefix as a string:
- *
- *   $db_prefix = 'main_';
- *
- * To provide prefixes for specific tables, set $db_prefix as an array.
- * The array's keys are the table names and the values are the prefixes.
- * The 'default' element holds the prefix for any tables not specified
- * elsewhere in the array. Example:
- *
- *   $db_prefix = array(
- *     'default'   => 'main_',
- *     'users'     => 'shared_',
- *     'sessions'  => 'shared_',
- *     'role'      => 'shared_',
- *     'authmap'   => 'shared_',
- *     'sequences' => 'shared_',
- *   );
- *
- * Database URL format:
- *   $db_url = 'mysql://username:password@localhost/databasename';
- *   $db_url = 'mysqli://username:password@localhost/databasename';
- *   $db_url = 'pgsql://username:password@localhost/databasename';
- */
-
-require_once('plc_config.php');
-
-if (PLC_DB_TYPE == 'postgresql') {
-  $db_url = 'pgsql://';
-} elseif (PLC_DB_TYPE == 'mysql') {
-  $db_url = 'mysql://';
-}
-$db_url .= PLC_DB_USER . ':';
-$db_url .= PLC_DB_PASSWORD . '@';
-$db_url .= PLC_DB_HOST . ':';
-$db_url .= PLC_DB_PORT . '/';
-$db_url .= 'drupal';
-$db_prefix = '';
-
-/**
- * Base URL (optional).
- *
- * If you are experiencing issues with different site domains,
- * uncomment the Base URL statement below (remove the leading hash sign)
- * and fill in the URL to your Drupal installation.
- *
- * You might also want to force users to use a given domain.
- * See the .htaccess file for more information.
- *
- * Examples:
- *   $base_url = 'http://www.example.com';
- *   $base_url = 'http://www.example.com:8888';
- *   $base_url = 'http://www.example.com/drupal';
- *   $base_url = 'https://www.example.com:8888/drupal';
- *
- * It is not allowed to have a trailing slash; Drupal will add it
- * for you.
- */
-# $base_url = 'http://www.example.com';  // NO trailing slash!
-
-/**
- * PHP settings:
- *
- * To see what PHP settings are possible, including whether they can
- * be set at runtime (ie., when ini_set() occurs), read the PHP
- * documentation at http://www.php.net/manual/en/ini.php#ini.list
- * and take a look at the .htaccess file to see which non-runtime
- * settings are used there. Settings defined here should not be
- * duplicated there so as to avoid conflict issues.
- */
-ini_set('arg_separator.output',     '&amp;');
-ini_set('magic_quotes_runtime',     0);
-ini_set('magic_quotes_sybase',      0);
-ini_set('session.cache_expire',     200000);
-ini_set('session.cache_limiter',    'none');
-ini_set('session.cookie_lifetime',  2000000);
-ini_set('session.gc_maxlifetime',   200000);
-ini_set('session.save_handler',     'user');
-ini_set('session.use_only_cookies', 1);
-ini_set('session.use_trans_sid',    0);
-ini_set('url_rewriter.tags',        '');
-ini_set('memory_limit', '12M');
-
-/**
- * Variable overrides:
- *
- * To override specific entries in the 'variable' table for this site,
- * set them here. You usually don't need to use this feature. This is
- * useful in a configuration file for a vhost or directory, rather than
- * the default settings.php. Any configuration setting from the 'variable'
- * table can be given a new value.
- *
- * Remove the leading hash signs to enable.
- */
-# $conf = array(
-#   'site_name' => 'My Drupal site',
-#   'theme_default' => 'pushbutton',
-#   'anonymous' => 'Visitor'
-# );
-
diff --git a/themes/bluemarine/block.tpl.php b/themes/bluemarine/block.tpl.php
deleted file mode 100644 (file)
index 75f2708..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-  <div class="block block-<?php print $block->module; ?>" id="block-<?php print $block->module; ?>-<?php print $block->delta; ?>">
-    <h2 class="title"><?php print $block->subject; ?></h2>
-    <div class="content"><?php print $block->content; ?></div>
- </div>
diff --git a/themes/bluemarine/box.tpl.php b/themes/bluemarine/box.tpl.php
deleted file mode 100644 (file)
index a66bd27..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-  <div class="box">
-    <?php if ($title) { ?><h2 class="title"><?php print $title; ?></h2><?php } ?>
-    <div class="content"><?php print $content; ?></div>
- </div>
-
diff --git a/themes/bluemarine/comment.tpl.php b/themes/bluemarine/comment.tpl.php
deleted file mode 100644 (file)
index 1cee35c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-  <div class="comment<?php if ($comment->status == COMMENT_NOT_PUBLISHED) print ' comment-unpublished'; ?>">
-    <?php if ($picture) {
-    print $picture;
-  } ?>
-<h3 class="title"><?php print $title; ?></h3><?php if ($new != '') { ?><span class="new"><?php print $new; ?></span><?php } ?>
-    <div class="submitted"><?php print $submitted; ?></div>
-    <div class="content"><?php print $content; ?></div>
-    <div class="links">&raquo; <?php print $links; ?></div>
-  </div>
diff --git a/themes/bluemarine/logo.png b/themes/bluemarine/logo.png
deleted file mode 100644 (file)
index e72da09..0000000
Binary files a/themes/bluemarine/logo.png and /dev/null differ
diff --git a/themes/bluemarine/node.tpl.php b/themes/bluemarine/node.tpl.php
deleted file mode 100644 (file)
index a5e1502..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-  <div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
-    <?php if ($picture) {
-      print $picture;
-    }?>
-    <?php if ($page == 0) { ?><h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2><?php }; ?>
-    <span class="submitted"><?php print $submitted?></span>
-    <span class="taxonomy"><?php print $terms?></span>
-    <div class="content"><?php print $content?></div>
-    <?php if ($links) { ?><div class="links">&raquo; <?php print $links?></div><?php }; ?>
-  </div>
diff --git a/themes/bluemarine/page.tpl.php b/themes/bluemarine/page.tpl.php
deleted file mode 100644 (file)
index e65278d..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language ?>" xml:lang="<?php print $language ?>">
-
-<head>
-  <title><?php print $head_title ?></title>
-  <?php print $head ?>
-  <?php print $styles ?>
-  <script type="text/javascript"><?php /* Needed to avoid Flash of Unstyle Content in IE */ ?> </script>
-</head>
-
-<body>
-
-<table border="0" cellpadding="0" cellspacing="0" id="header">
-  <tr>
-    <td id="logo">
-      <?php if ($logo) { ?><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print $logo ?>" alt="<?php print t('Home') ?>" /></a><?php } ?>
-      <?php if ($site_name) { ?><h1 class='site-name'><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><?php print $site_name ?></a></h1><?php } ?>
-      <?php if ($site_slogan) { ?><div class='site-slogan'><?php print $site_slogan ?></div><?php } ?>
-    </td>
-    <td id="menu">
-      <?php if (isset($secondary_links)) { ?><div id="secondary"><?php print theme('links', $secondary_links) ?></div><?php } ?>
-      <?php if (isset($primary_links)) { ?><div id="primary"><?php print theme('links', $primary_links) ?></div><?php } ?>
-      <?php print $search_box ?>
-    </td>
-  </tr>
-  <tr>
-    <td colspan="2"><div><?php print $header ?></div></td>
-  </tr>
-</table>
-
-<table border="0" cellpadding="0" cellspacing="0" id="content">
-  <tr>
-    <?php if ($sidebar_left) { ?><td id="sidebar-left">
-      <?php print $sidebar_left ?>
-    </td><?php } ?>
-    <td valign="top">
-      <?php if ($mission) { ?><div id="mission"><?php print $mission ?></div><?php } ?>
-      <div id="main">
-        <?php print $breadcrumb ?>
-        <h1 class="title"><?php print $title ?></h1>
-        <div class="tabs"><?php print $tabs ?></div>
-        <?php print $help ?>
-        <?php print $messages ?>
-        <?php print $content; ?>
-      </div>
-    </td>
-    <?php if ($sidebar_right) { ?><td id="sidebar-right">
-      <?php print $sidebar_right ?>
-    </td><?php } ?>
-  </tr>
-</table>
-
-<div id="footer">
-  <?php print $footer_message ?>
-</div>
-<?php print $closure ?>
-</body>
-</html>
diff --git a/themes/bluemarine/screenshot.png b/themes/bluemarine/screenshot.png
deleted file mode 100644 (file)
index 9c6a909..0000000
Binary files a/themes/bluemarine/screenshot.png and /dev/null differ
diff --git a/themes/bluemarine/style.css b/themes/bluemarine/style.css
deleted file mode 100644 (file)
index 958ece1..0000000
+++ /dev/null
@@ -1,356 +0,0 @@
-/* $Id: style.css 144 2007-03-28 07:52:20Z thierry $ */
-
-/*
-** HTML elements
-*/
-body {
-  margin: 0;
-  padding: 0;
-  color: #000;
-  background-color: #fff;
-  font: 76% Verdana, Arial, Helvetica, sans-serif;
-}
-tr.odd td, tr.even td {
-  padding: 0.3em;
-}
-h1, h2, h3, h4, h5, h6 {
-  margin-bottom: 0.5em;
-}
-h1 {
-  font-size: 1.3em;
-}
-h2 {
-  font-size: 1.2em;
-}
-h3, h4, h5, h6 {
-  font-size: 1.1em;
-}
-p {
-  margin-top: 0.5em;
-  margin-bottom: 0.9em;
-}
-a {
-  text-decoration: none;
-  font-weight: bold;
-}
-a:link {
-  color: #39c;
-}
-a:visited {
-  color: #369;
-}
-a:hover {
-  color: #39c;
-  text-decoration: underline;
-}
-fieldset {
-  border: 1px solid #ccc;
-}
-pre {
-  background-color: #eee;
-  padding: 0.75em 1.5em;
-  font-size: 12px;
-  border: 1px solid #ddd;
-}
-table {
-  /* make <td> sizes relative to body size! */
-  font-size: 1em;
-}
-.form-item label {
-  font-size: 1em;
-  color: #222;
-}
-.item-list .title {
-  font-size: 1em;
-  color: #222;
-}
-.links {
-  margin-bottom: 0em;
-}
-.comment .links {
-  margin-bottom: 0em;
-}
-
-/*
-** Page layout blocks / IDs
-*/
-#header, #content {
-  width: 100%;
-}
-#header {
-  background-color: #69c;
-}
-#logo {
-  vertical-align: middle;
-  border: 0;
-}
-#logo img {
-  float: left;
-  padding: 0em 1.0em 0em 1em;
-  border: 0;
-}
-#menu {
-  padding: 0.5em 0.5em 0 0.5em;
-  text-align: right;
-  vertical-align: middle;
-}
-#primary {
-  font-size: 1.0em;
-  padding: 0em 0.8em 0.5em 0;
-  color: #9cf;
-}
-#primary a {
-  font-weight: bold;
-  color: #fff;
-}
-#secondary {
-  padding: 0 1em 0.5em 0;
-  font-size: 0.8em;
-  color: #9cf;
-}
-#secondary a {
-  font-weight: bold;
-  color: #9cf;
-}
-#search .form-text, #search .form-submit {
-  border: 1px solid #369;
-  font-size: 1.1em;
-  height: 1.5em;
-  vertical-align: middle;
-}
-#search .form-text {
-  width: 8em;
-  padding: 0 0.5em 0 0.5em;
-}
-#mission {
-  background-color: #369;
-  padding: 1.5em 2em;
-  color: #fff;
-}
-#mission a, #mission a:visited {
-  color: #9cf;
-  font-weight: bold;
-}
-.site-name {
-  margin: 0.6em 0em 0em 0em;
-  padding: 0em;
-  font-size: 2em;
-}
-.site-name a:link, .site-name a:visited {
-  color: #fff;
-}
-.site-name a:hover {
-  color: #369;
-  text-decoration: none;
-}
-.site-slogan {
-  font-size: 1em;
-  color: #eee;
-  display: block;
-  margin: 0em 0em 0em 0em;
-  font-style: italic;
-  font-weight: bold;
-}
-#main {
-  /* padding in px not ex because IE messes up 100% width tables otherwise */
-  padding: 10px;
-}
-#mission, .node .content, .comment .content {
-  line-height: 1.4;
-}
-#help {
-  font-size: 0.9em;
-  margin-bottom: 1em;
-}
-.breadcrumb {
-  margin-bottom: .5em;
-}
-.messages {
-  background-color: #eee;
-  border: 1px solid #ccc;
-  padding: 0.3em;
-  margin-bottom: 1em;
-}
-.error {
-  border-color: red;
-}
-#sidebar-left, #sidebar-right {
-  background-color: #ddd;
-  width: 16em;
-  /* padding in px not ex because IE messes up 100% width tables otherwise */
-  padding: 10px;
-  vertical-align: top;
-}
-#footer {
-  background-color: #eee;
-  padding: 1em;
-  font-size: 0.8em;
-}
-
-/*
-** Common declarations for child classes of node, comment, block, box, etc.
-** If you want any of them styled differently for a specific parent, add
-** additional rules /with only the differing properties!/ to .parent .class.
-** See .comment .title for an example.
-*/
-.title, .title a {
-  font-weight: bold;
-  font-size: 1.3em;
-  color: #777;
-  margin: 0 auto 0 auto;  /* decrease default margins for h<x>.title */
-}
-.submitted {
-  color: #999;
-  font-size: 0.8em;
-}
-.links {
-  color: #999;
-}
-.links a {
-  font-weight: bold;
-}
-.block, .box {
-  padding: 0 0 1.5em 0;
-}
-.block {
-  border-bottom: 1px solid #bbb;
-  padding-bottom: 0.75em;
-  margin-bottom: 1.5em;
-}
-.block .title {
-  margin-bottom: .25em;
-}
-.box .title {
-  font-size: 1.1em;
-}
-.node {
-  margin: .5em 0 2em 0;
-}
-.sticky {
-  padding: .5em;
-  background-color: #eee;
-  border: solid 1px #ddd;
-}
-.node .content, .comment .content {
-  margin: .5em 0 .5em 0;
-}
-.node .taxonomy {
-  color: #999;
-  font-size: 0.8em;
-  padding: 1.5em;
-}
-.node .picture {
-  border: 1px solid #ddd;
-  float: right;
-  margin: 0.5em;
-}
-.comment {
-  border: 1px solid #abc;
-  padding: .5em;
-  margin-bottom: 1em;
-}
-.comment .title a {
-  font-size: 1.1em;
-  font-weight: normal;
-}
-.comment .new {
-  text-align: right;
-  font-weight: bold;
-  font-size: 0.8em;
-  float: right;
-  color: red;
-}
-.comment .picture {
-  border: 1px solid #abc;
-  float: right;
-  margin: 0.5em;
-}
-
-/*
-** Module specific styles
-*/
-#aggregator .feed-source {
-  background-color: #eee;
-  border: 1px solid #ccc;
-  padding: 1em;
-  margin: 1em 0 1em 0;
-}
-#aggregator .news-item .categories, #aggregator .source, #aggregator .age {
-  color: #999;
-  font-style: italic;
-  font-size: 0.9em;
-}
-#aggregator .title {
-  margin-bottom: 0.5em;
-  font-size: 1em;
-}
-#aggregator h3 {
-  margin-top: 1em;
-}
-#forum table {
-  width: 100%;
-}
-#forum td {
-  padding: 0.5em 0.5em 0.5em 0.5em;
-}
-#forum td.forum, #forum td.posts {
-  background-color: #eee;
-}
-#forum td.topics, #forum td.last-reply {
-  background-color: #ddd;
-}
-#forum td.container {
-  background-color: #ccc;
-}
-#forum td.container a {
-  color: #555;
-}
-#forum td.statistics, #forum td.settings, #forum td.pager {
-  height: 1.5em;
-  border: 1px solid #bbb;
-}
-#forum td .name {
-  color: #96c;
-}
-#forum td .links {
-  padding-top: 0.7em;
-  font-size: 0.9em;
-}
-#profile .profile {
-  clear: both;
-  border: 1px solid #abc;
-  padding: .5em;
-  margin: 1em 0em 1em 0em;
-}
-#profile .profile .name {
-  padding-bottom: 0.5em;
-}
-.block-forum h3 {
-  margin-bottom: .5em;
-}
-.calendar a {
-  text-decoration: none;
-}
-.calendar td, .calendar th {
-  padding: 0.4em 0;
-  border-color: #888;
-}
-.calendar .day-today {
-  background-color: #69c;
-}
-.calendar .day-today a {
-  color: #fff;
-}
-.calendar .day-selected {
-  background-color: #369;
-  color: #fff;
-}
-.calendar .header-week {
-  background-color: #ccc;
-}
-.calendar .day-blank {
-  background-color: #ccc;
-}
-.calendar .row-week td a:hover {
-  background-color: #fff; color: #000;
-}
diff --git a/themes/chameleon/background.png b/themes/chameleon/background.png
deleted file mode 100644 (file)
index 194588a..0000000
Binary files a/themes/chameleon/background.png and /dev/null differ
diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme
deleted file mode 100644 (file)
index b0754a6..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
-// $Id: chameleon.theme 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * A slim, CSS-driven theme.
- */
-
-function chameleon_features() {
-  return array(
-       'toggle_logo',
-       'toggle_favicon',
-       'toggle_name',
-       'toggle_slogan');
-}
-
-function chameleon_regions() {
-  return array(
-       'left' => t('left sidebar'),
-       'right' => t('right sidebar')
-  );
-}
-
-function chameleon_page($content) {
-  $language = $GLOBALS['locale'];
-
-  if (theme_get_setting('toggle_favicon')) {
-    drupal_set_html_head('<link rel="shortcut icon" href="'. check_url(theme_get_setting('favicon')) .'" type="image/x-icon" />');
-  }
-
-  $title = drupal_get_title();
-
-  $output  = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
-  $output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$language\" xml:lang=\"$language\">\n";
-  $output .= "<head>\n";
-  $output .= " <title>". ($title ? strip_tags($title) ." | ". variable_get("site_name", "drupal") : variable_get("site_name", "drupal") ." | ". variable_get("site_slogan", "")) ."</title>\n";
-  $output .= drupal_get_html_head();
-  $output .= theme('stylesheet_import', base_path() . path_to_theme() ."/common.css");
-  $output .= theme_get_styles();
-  $output .= "</head>";
-  $output .= "<body>\n";
-  $output .= " <div id=\"header\">";
-
-  if ($logo = theme_get_setting('logo')) {
-    $output .= "  <a href=\"". base_path() ."\" title=\"". t('Home') ."\"><img src=\"$logo\" alt=\"". t('Home') ."\" /></a>";
-  }
-  if (theme_get_setting('toggle_name')) {
-    $output .= "  <h1 class=\"site-name title\">". l(variable_get('site_name', 'drupal'), ""). "</h1>";
-  }
-  if (theme_get_setting('toggle_slogan')) {
-    $output .= "  <div class=\"site-slogan\">". variable_get('site_slogan', '') ."</div>";
-  }
-
-  $output .= "</div>\n";
-
-  $primary_links = theme('links', menu_primary_links());
-  $secondary_links = theme('links', menu_secondary_links());
-  if (isset($primary_links) || isset($secondary_links)) {
-    $output .= ' <div class="navlinks">';
-    if (isset($primary_links)) {
-      $output .= '<div class="primary">'. $primary_links .'</div>';
-    }
-    if (isset($secondary_links)) {
-      $output .= '<div class="secondary">'. $secondary_links .'</div>';
-    }
-    $output .= " </div>\n";
-  }
-
-  $output .= " <table id=\"content\">\n";
-  $output .= "  <tr>\n";
-
-  if ($blocks = theme_blocks("left")) {
-    $output .= "   <td id=\"sidebar-left\">$blocks</td>\n";
-  }
-
-  $output .= "   <td id=\"main\">\n";
-
-  if ($title) {
-    $output .= theme("breadcrumb", drupal_get_breadcrumb());
-    $output .= "<h2>$title</h2>";
-  }
-
-  if ($tabs = theme('menu_local_tasks')) {
-    $output .= $tabs;
-  }
-
-  $output .= theme('help');
-
-  $output .= theme('status_messages');
-
-  $output .= "\n<!-- begin content -->\n";
-  $output .= $content;
-  $output .= "\n<!-- end content -->\n";
-
-  if ($footer = variable_get('site_footer', '')) {
-    $output .= " <div id=\"footer\">$footer</div>\n";
-  }
-
-  $output  .= "   </td>\n";
-
-  if ($blocks = theme_blocks("right")) {
-    $output .= "   <td id=\"sidebar-right\">$blocks</td>\n";
-  }
-
-  $output .= "  </tr>\n";
-  $output .= " </table>\n";
-
-  $output .=  theme_closure();
-  $output .= " </body>\n";
-  $output .= "</html>\n";
-
-  return $output;
-}
-
-function chameleon_node($node, $teaser = 0, $page = 0) {
-
-  $output  = "<div class=\"node". ((!$node->status) ? ' node-unpublished' : '') ."\">\n";
-
-  if (!$page) {
-    $output .= " <h2 class=\"title\">". ($teaser ? l($node->title, "node/$node->nid") : check_plain($node->title)) ."</h2>\n";
-  }
-
-  $output .= " <div class=\"content\">\n";
-
-  if ($teaser && $node->teaser) {
-    $output .= $node->teaser;
-  }
-  else {
-    $output .= $node->body;
-  }
-
-  $output .= " </div>\n";
-
-  $submitted = theme_get_setting("toggle_node_info_$node->type") ? array(t("By %author at %date", array('%author' => theme('username', $node), '%date' => format_date($node->created, 'small')))) : array();
-
-  $terms = array();
-  if (module_exist('taxonomy')) {
-    $terms = taxonomy_link("taxonomy terms", $node);
-  }
-
-  $links = array_merge($submitted, $terms);
-  if ($node->links) {
-    $links = array_merge($links, $node->links);
-  }
-  if (count($links)) {
-    $output .= " <div class=\"links\">". theme('links', $links) ."</div>\n";
-  }
-
-  $output .= "</div>\n";
-
-  return $output;
-}
-
-function chameleon_comment($comment, $links = "") {
-  $submitted = array(t('By %author at %date', array('%author' => theme('username', $comment), '%date' => format_date($comment->timestamp. 'small'))));
-
-  $output  = "<div class=\"comment". ($comment->status == COMMENT_NOT_PUBLISHED ? ' comment-unpublished' : '') ."\">\n";
-  $output .= " <h3 class=\"title\">". l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid") ."</h3>\n";
-  $output .= " <div class=\"content\">". $comment->comment ."</div>\n";
-  $output .= " <div class=\"links\">". theme('links', array_merge($submitted, $links)) ."</div>\n";
-  $output .= "</div>\n";
-
-  return $output;
-}
-
-function chameleon_help() {
-  if ($help = menu_get_active_help()) {
-    return '<div class="help">'. $help .'</div><hr />';
-  }
-}
-
-?>
diff --git a/themes/chameleon/common.css b/themes/chameleon/common.css
deleted file mode 100644 (file)
index 363c23a..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $Id: common.css 144 2007-03-28 07:52:20Z thierry $ */
-
-/*
-** HTML elements
-*/
-a, a:link, a:active {
-  font-weight: bold;
-  text-decoration: none;
-}
-a:hover {
-  text-decoration: underline;
-}
-body {
-  margin: 0;
-  padding: 3em;
-  font-size: .9em;
-  line-height: 1.3em;
-}
-blockquote {
-  font-style: italic;
-}
-table {
-  margin: 0;
-  padding: .5em;
-  border-collapse: collapse;
-}
-code, pre {
- font-size: 1em;
-}
-pre {
- font-size: 0.8em;
- padding: 1em;
- background: #eee;
-}
-li {
- padding-bottom: .3em;
-}
-h1, h2, h3, h4, h5, h6 {
-  margin-bottom: .25em;
-}
-h1 {
-  font-size: 1.3em;
-}
-h2 {
-  font-size: 1.2em;
-}
-h3 {
-  font-size: 1.1em;
-}
-h4, h5, h6 {
-  font-size: 1em;
-}
-p {
-  margin: 0 0 .5em 0;
-}
-br {
-  line-height: 0.6em;
-}
-
-/*
-** Page layout blocks / IDs
-*/
-#header {
-  margin-bottom: 2em;
-}
-#help {
-  font-size: 0.8em;
-}
-#content {
-  clear: both;
-}
-#sidebar-left, #sidebar-right {
-  vertical-align: top;
-  padding: 10px;
-}
-#main {
-  padding-left: 1em;
-  padding-right: 1em;
-  vertical-align: top;
-}
-#footer {
- font-size: 0.8em;
- padding-top: 2em;
- text-align: center;
-}
-
-/*
-** Common declarations for child classes of node, comment, block, box etc
-*/
-.title {
-  margin: 0 0 .25em 0;
-}
-.content {
-  margin: 0 0 .5em 0;
-}
-.links {
-  font-size: 0.8em;
-  line-height: 1.25em;
-}
-.block {
-  width: 180px;
-}
-.messages {
-  padding: 0.3em;
-  margin: 0.5em 0em 0.5em 0em;
-}
-.status {
-  border: 1px solid #3a3;
-  color: #3a3;
-}
-.error, form-item input.error {
-  border: 1px solid red;
-  color: red;
-}
-
-/*
-** Common navigation links added on the admin/themes/settings page
-*/
-.navlinks {
-  padding: 0em 0.5em 1.5em 0em;
-  clear: both;
-}
-.primary a {
-  font-size: 1.0em;
-  padding: 0em 0.5em 0em 0em;
-}
-.secondary a {
-  font-size: 0.9em;
-  padding: 0em 0.5em 0em 0em;
-}
-
-/*
-** Logo Image Positioning
-*/
-#header img {
-  float: left;
-  padding: 0em 2em .5em 0em;
-}
-#header {
-  clear: both;
-}
-/*
-** Module specific styles
-*/
-.form-item textarea {
-  font-size: 1em;
-}
-#aggregator .feed-source {
-  border: 1px solid gray;
-  padding: 1em;
-}
diff --git a/themes/chameleon/logo.png b/themes/chameleon/logo.png
deleted file mode 100644 (file)
index 320fa96..0000000
Binary files a/themes/chameleon/logo.png and /dev/null differ
diff --git a/themes/chameleon/marvin/bullet.png b/themes/chameleon/marvin/bullet.png
deleted file mode 100644 (file)
index 937c8ed..0000000
Binary files a/themes/chameleon/marvin/bullet.png and /dev/null differ
diff --git a/themes/chameleon/marvin/druplicon-watermark.png b/themes/chameleon/marvin/druplicon-watermark.png
deleted file mode 100644 (file)
index 4f91cd3..0000000
Binary files a/themes/chameleon/marvin/druplicon-watermark.png and /dev/null differ
diff --git a/themes/chameleon/marvin/logo.png b/themes/chameleon/marvin/logo.png
deleted file mode 100644 (file)
index 320fa96..0000000
Binary files a/themes/chameleon/marvin/logo.png and /dev/null differ
diff --git a/themes/chameleon/marvin/screenshot.png b/themes/chameleon/marvin/screenshot.png
deleted file mode 100644 (file)
index b46b21c..0000000
Binary files a/themes/chameleon/marvin/screenshot.png and /dev/null differ
diff --git a/themes/chameleon/marvin/style.css b/themes/chameleon/marvin/style.css
deleted file mode 100644 (file)
index a24de12..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/* $Id: style.css 144 2007-03-28 07:52:20Z thierry $ */
-
-/*
-** HTML elements
-*/
-body {
-  background: #fff url(druplicon-watermark.png) no-repeat top right;
-  font-family: arial, helvetica, sans-serif;
-}
-a:link {
-  color: #656
-}
-a:visited {
-  color: #656
-}
-a:active {
-  color: #ccc
-}
-h2 {
-  background-color: #eaeaea;
-  border: solid 1px #777;
-  font-size: 1.1em;
-  margin: 0.5em 0em 0.5em 0em;
-  padding: 0.5em;
-}
-h2.title {
-  background-color: #fff;
-  border: solid 1px #888;
-  margin-top: 1em;
-}
-p {
-  margin: 0 1em 1em 0;
-  padding: 0;
-}
-table {
-  font-size: 1em;
-}
-
-/*
-** Page layout blocks / IDs
-*/
-#main {
-  width: 80%;
-}
-#header .title {
-  padding-top: .75em;
-}
-
-/*
-** Common declarations for child classes of node, comment, block, box etc
-*/
-.node .submitted {
-  color: #7c7c7c;
-  font-size: 0.9em;
-  float: left;
-  padding: 0.5em 0em 0.5em 1em;
-}
-.node .taxonomy {
-  color: #7c7c7c;
-  font-size: 0.9em;
-  float: right;
-}
-.node .content {
-  clear: both;
-  padding-left: 1em;
-}
-.node .links {
-  padding: 1em;
-}
-.comment {
-  border: solid 1px #777;
-  margin: 0.5em 0 0.5em 0;
-  padding: 0.5em;
-}
-.block {
-  margin-bottom: 10px;
-  font-size: 0.9em;
-}
-.block .content {
-  border: solid 1px #888;
-  border-top: none;
-  margin: 0;
-  padding: 5px;
-}
-.block h2.title {
-  margin: 0;
-}
-
-/*
-** Module specific styles
-*/
-.item-list ul li {
-  list-style-image: url(bullet.png);
-}
-.calendar .day-today {
-  background-color: #ccc;
-}
-.calendar .day-selected {
-  background-color: #bbb;
-}
-.calendar .header-month {
-  background-color: #ddd;
-}
-.calendar .header-week {
-  background-color: #ccc;
-}
-.calendar .day-blank {
-  background-color: #ddd;
-}
-.calendar .day-link a {
-  color: #000;
-}
-.calendar .row-week {
-  color: #aaa;
-}
-.path, .path a, .path a:visited {
-  color: #888;
-}
\ No newline at end of file
diff --git a/themes/chameleon/screenshot.png b/themes/chameleon/screenshot.png
deleted file mode 100644 (file)
index 7c8bdee..0000000
Binary files a/themes/chameleon/screenshot.png and /dev/null differ
diff --git a/themes/chameleon/style.css b/themes/chameleon/style.css
deleted file mode 100644 (file)
index 9b8030c..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $Id: style.css 144 2007-03-28 07:52:20Z thierry $ */
-
-/*
-** HTML elements
-*/
-a, a:link, a:active {
-  color: #930;
-}
-a:visited {
-  color: #630;
-}
-body {
-  padding: 5em 0 0 3em;
-  background-image: url(background.png);
-  background-repeat: repeat-x;
-  font-family: trebuchet ms, tahoma, verdana, arial, helvetica;
-  border-top: 10px solid gray;
-}
-ul {
-  list-style-type: disc;
-}
-
-/*
-** Page layout blocks / IDs
-*/
-#main {
-  width: 500px;
-}
-#sidebar-left {
-  border-right: 1px solid gray;
-}
-#sidebar-right {
-  border-left: 1px solid gray;
-}
-
-/*
-** Common declarations for child classes of node, comment, block, box etc
-*/
-#header .title {
-  font-size: 2em;
-  font-weight: bold;
-  padding-top: .75em;
-}
-#header .title a,
-#header .title a:link,
-#header .title a:visited,
-#header .title a:active {
-  text-decoration: none;
-  color: #aaa;
-}
-#header .title a:hover {
-  color: #930;
-}
-#header .site-slogan {
-  margin-top: -0.1em;
-  font-size: 0.8em;
-}
-.node .title {
-  font-size: 1.2em;
-}
-.node .title a,
-.node .title a:link,
-.node .title a:active,
-.node .title a:visited {
-  text-decoration: none;
-  font-weight: normal;
-}
-.node .title a:hover {
-  text-decoration: underline;
-}
-.links {
-  margin: 1em 0 3em 0;
-  text-align: right;
- }
-.comment .content, .block .content, .menu {
-  font-size: 0.9em;
-}
-.block {
-  padding-bottom: 1em;
-}
-.block .title {
-  font-size: 1em;
-}
-
-/*
-** Module specific styles
-*/
-.item-list ul li {
-  list-style: square;
-}
diff --git a/themes/engines/phptemplate/block.tpl.php b/themes/engines/phptemplate/block.tpl.php
deleted file mode 100644 (file)
index ca670db..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<div class="<?php print "block block-$block->module" ?>" id="<?php print "block-$block->module-$block->delta"; ?>">
-  <h2><?php print $block->subject ?></h2>
-  <div class="content"><?php print $block->content ?></div>
-</div>
diff --git a/themes/engines/phptemplate/box.tpl.php b/themes/engines/phptemplate/box.tpl.php
deleted file mode 100644 (file)
index 56667e7..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<div class="box">
-  <?php if ($title): ?>
-  <h2 class="title"><?php print $title ?></h2>
-  <?php endif; ?>
-  <div class="content"><?php print $content ?></div>
-</div>
diff --git a/themes/engines/phptemplate/comment.tpl.php b/themes/engines/phptemplate/comment.tpl.php
deleted file mode 100644 (file)
index 2456c58..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<div class="comment<?php print ($comment->new) ? ' comment-new' : ''; print ($comment->status == COMMENT_NOT_PUBLISHED) ? ' comment-unpublished' : ''; ?>">
-<?php if ($comment->new) : ?>
-  <a id="new"></a>
-  <span class="new"><?php print $new ?></span>
-<?php endif; ?>
-
-<div class="title"><?php print $title ?></div>
-  <?php print $picture ?>
-  <div class="author"><?php print $submitted ?></div>
-  <div class="content"><?php print $content ?></div>
-  <?php if ($picture) : ?>
-    <br class="clear" />
-  <?php endif; ?>
-  <div class="links"><?php print $links ?></div>
-</div>
diff --git a/themes/engines/phptemplate/default.tpl.php b/themes/engines/phptemplate/default.tpl.php
deleted file mode 100644 (file)
index 8008a2c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- PHPTemplate was instructed to override the  <?php print $hook ?> theme function, but no valid template file was found. -->
diff --git a/themes/engines/phptemplate/node.tpl.php b/themes/engines/phptemplate/node.tpl.php
deleted file mode 100644 (file)
index 028aeb3..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
-  <?php if ($page == 0): ?>
-    <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
-  <?php endif; ?>
-  <?php print $picture ?>
-
-  <div class="info"><?php print $submitted ?><span class="terms"><?php print $terms ?></span></div>
-  <div class="content">
-    <?php print $content ?>
-  </div>
-<?php if ($links): ?>
-
-    <?php if ($picture): ?>
-      <br class='clear' />
-    <?php endif; ?>
-    <div class="links"><?php print $links ?></div>
-<?php endif; ?>
-</div>
diff --git a/themes/engines/phptemplate/phptemplate.engine b/themes/engines/phptemplate/phptemplate.engine
deleted file mode 100644 (file)
index 2e03796..0000000
+++ /dev/null
@@ -1,344 +0,0 @@
-<?php
-// $Id: phptemplate.engine 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Handles integration of templates written in pure php with the Drupal theme system.
- */
-
-function phptemplate_init($template) {
-  $file = dirname($template->filename) . '/template.php';
-  if (file_exists($file)) {
-   include_once "./$file";
-  }
-}
-
-function phptemplate_templates($directory = 'themes') {
-  return system_listing('^page\.tpl\.php$', $directory, 'filename');
-}
-
-/**
- * Declare the available regions implemented by this engine.
- *
- * @return
- *  An array of regions.  The first array element will be used as the default region for themes.
- */
-function phptemplate_regions() {
-  return array(
-       'left' => t('left sidebar'),
-       'right' => t('right sidebar'),
-       'content' => t('content'),
-       'header' => t('header'),
-       'footer' => t('footer')
-  );
-}
-
-/**
- * Execute a template engine call.
- *
- * Each call to the template engine has two parts. Namely preparing
- * the variables, and then doing something with them.
- *
- * The first step is done by all template engines / themes, the second
- * step is dependent on the engine used.
- *
- * @param $hook
- *   The name of the theme function being executed.
- * @param $variables
- *   A sequential array of variables passed to the theme function.
- * @param $file
- *   A suggested template file to use. If the file is not found, the default $hook.tpl.php will be used.
- * @return
- *  The HTML generated by the template system.
- */
-function _phptemplate_callback($hook, $variables = array(), $file = NULL) {
-
-  $variables = array_merge($variables, _phptemplate_default_variables($hook, $variables));
-
-  // Allow specified variables to be overridden
-  if (function_exists('_phptemplate_variables')) {
-    $variables = array_merge($variables, _phptemplate_variables($hook, $variables));
-  }
-
-  if (isset($variables['template_file'])) {
-    $file = $variables['template_file'];
-  }
-
-  if (function_exists('_phptemplate_' . $hook)) {
-    return call_user_func('_phptemplate_' . $hook, $variables, $file);
-  }
-  elseif (function_exists('_phptemplate_default')) {
-    return call_user_func('_phptemplate_default', $hook, $variables, $file);
-  }
-
-}
-
-/**
- * Adds additional helper variables to all templates.
- *
- * Counts how many times certain hooks have been called. Sidebar left / right are special cases.
- *
- * @param $hook
- *   The name of the theme function being executed.
- * @param $variables
- *   A sequential array of variables passed to the theme function.
- */
-function _phptemplate_default_variables($hook, $variables) {
-  global $theme, $sidebar_indicator;
-  static $count = array();
-
-  $count[$hook] = isset($count[$hook]) && is_int($count[$hook]) ? $count[$hook] : 1;
-  $variables['zebra'] = ($count[$hook] % 2) ? 'odd' : 'even';
-  $variables['id'] = $count[$hook]++;
-
-  if ($hook == 'block') {
-    $count['block_counter'][$sidebar_indicator] = isset($count['block_counter'][$sidebar_indicator]) && is_int($count['block_counter'][$sidebar_indicator]) ? $count['block_counter'][$sidebar_indicator] : 1;
-    $variables['block_zebra'] = ($count['block_counter'][$sidebar_indicator] % 2) ? 'odd' : 'even';
-    $variables['block_id'] = $count['block_counter'][$sidebar_indicator]++;
-  }
-  elseif ($hook == 'page') {
-    $regions = system_region_list($theme);
-    // Load all region content assigned via blocks.
-    foreach (array_keys($regions) as $region) {
-      // Skip blocks in this region that have already been loaded.
-      // This pre-loading is necessary because phptemplate uses variable names different from
-      // the region names, e.g., 'sidebar_left' instead of 'left'.
-      if (!in_array($region, array('left', 'right', 'footer'))) {
-        isset($variables[$region]) ? $variables[$region] .= theme('blocks', $region) : $variables[$region] = theme('blocks', $region);
-      }
-    }
-  }
-  // Tell all templates where they are located.
-  $variables['directory'] = path_to_theme();
-  $variables['is_front'] = drupal_is_front_page();
-
-  return $variables;
-}
-
-/**
- * @return
- *  Array of template features
- */
-function phptemplate_features() {
-  return array(
-    'toggle_logo',
-    'toggle_comment_user_picture',
-    'toggle_favicon',
-    'toggle_mission',
-    'toggle_name',
-    'toggle_node_user_picture',
-    'toggle_search',
-    'toggle_slogan'
-  );
-}
-
-/**
- * Prepare the values passed to the theme_page function to be passed
- * into a pluggable template engine.
- */
-function phptemplate_page($content) {
-
-  /* Set title and breadcrumb to declared values */
-  if (drupal_is_front_page()) {
-    $mission = filter_xss_admin(theme_get_setting('mission'));
-  }
-
-  /* Add favicon */
-  if (theme_get_setting('toggle_favicon') && ($favicon_url = check_url(theme_get_setting('favicon')))) {
-    drupal_set_html_head('<link rel="shortcut icon" href="'. $favicon_url .'" type="image/x-icon" />');
-  }
-
-  /**
-  * Populate sidebars.
-  */
-  $layout = 'none';
-  global $sidebar_indicator;
-  /**
-   * Sidebar_indicator tells the block counting code to count sidebars separately.
-   */
-  $sidebar_indicator = 'left';
-  $sidebar_left = theme('blocks', 'left');
-  if ($sidebar_left != '') {
-    $layout = 'left';
-  }
-
-  $sidebar_indicator = 'right';
-  $sidebar_right = theme('blocks', 'right');
-  if ($sidebar_right != '') {
-    $layout = ($layout == 'left') ? 'both' : 'right';
-  }
-  $sidebar_indicator = NULL;
-
-  // Construct page title
-  if (drupal_get_title()) {
-    $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'drupal'));
-  }
-  else {
-    $head_title = array(variable_get('site_name', 'drupal'));
-    if (variable_get('site_slogan', '')) {
-      $head_title[] = variable_get('site_slogan', '');
-    }
-  }
-
-  $variables = array(
-    'base_path'           => base_path(),
-    'breadcrumb'          => theme('breadcrumb', drupal_get_breadcrumb()),
-    'closure'             => theme('closure'),
-    'content'             => '<!-- begin content -->' . $content . '<!-- end content -->',
-    'footer_message'      => filter_xss_admin(variable_get('site_footer', FALSE)) . "\n" . theme('blocks', 'footer'),
-    'head'                => drupal_get_html_head(),
-    'head_title'          => implode(' | ', $head_title),
-    'help'                => theme('help'),
-    'language'            => $GLOBALS['locale'],
-    'layout'              => $layout,
-    'logo'                => theme_get_setting('logo'),
-    'messages'            => theme('status_messages'),
-    'mission'             => isset($mission) ? $mission : '',
-    'primary_links'       => menu_primary_links(),
-    'search_box'          => (theme_get_setting('toggle_search') ? search_box() : ''),
-    'secondary_links'     => menu_secondary_links(),
-    'sidebar_left'        => $sidebar_left,
-    'sidebar_right'       => $sidebar_right,
-    'site_name'           => (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''),
-    'site_slogan'         => (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''),
-    'styles'              => theme_get_styles(),
-    'tabs'                => theme('menu_local_tasks'),
-    'title'               => drupal_get_title()
-  );
-
-  if ((arg(0) == 'node') && is_numeric(arg(1))) {
-    $variables['node'] = node_load(arg(1));
-  }
-
-  return _phptemplate_callback('page', $variables);
-}
-
-/*
- * Prepare the values passed to the theme_node function to be passed
- * into a pluggable template engine.
- */
-function phptemplate_node($node, $teaser = 0, $page = 0) {
-  if (module_exist('taxonomy')) {
-    $taxonomy = taxonomy_link('taxonomy terms', $node);
-  }
-  else {
-    $taxonomy = array();
-  }
-
-  $variables = array(
-    'content'        => ($teaser && $node->teaser) ? $node->teaser : $node->body,
-    'date'           => format_date($node->created),
-    'links'          => $node->links ? theme('links', $node->links) : '',
-    'name'           => theme('username', $node),
-    'node'           => $node,  // we pass the actual node to allow more customization
-    'node_url'       => url('node/'. $node->nid),
-    'page'           => $page,
-    'taxonomy'       => $taxonomy,
-    'teaser'         => $teaser,
-    'terms'          => theme('links', $taxonomy),
-    'title'          => check_plain($node->title)
-  );
-
-  // Flatten the node object's member fields.
-  $variables = array_merge((array)$node, $variables);
-
-  // Display info only on certain node types.
-  if (theme_get_setting('toggle_node_info_' . $node->type)) {
-    $variables['submitted'] =  t('Submitted by %a on %b.', array('%a' => theme('username', $node), '%b' => format_date($node->created)));
-    $variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : '';
-  }
-  else {
-    $variables['submitted'] = '';
-    $variables['picture'] = '';
-  }
-
-  return _phptemplate_callback('node', $variables, 'node-' . $node->type);
-}
-
-/**
- * Prepare the values passed to the theme_comment function to be passed
- * into a pluggable template engine.
- */
-function phptemplate_comment($comment, $links = 0) {
-  return _phptemplate_callback('comment', array(
-    'author'    => theme('username', $comment),
-    'comment'   => $comment,
-    'content'   => $comment->comment,
-    'date'      => format_date($comment->timestamp),
-    'links'     => isset($links) ? theme('links', $links) : '',
-    'new'       => $comment->new ? t('new') : '',
-    'picture'   => theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $comment) : '',
-    'submitted' => t('Submitted by %a on %b.',
-                      array('%a' => theme('username', $comment),
-                            '%b' => format_date($comment->timestamp))),
-    'title'     => l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid")
-  ));
-}
-
-/**
- * Prepare the values passed to the theme_block function to be passed
- * into a pluggable template engine.
- */
-function phptemplate_block($block) {
-  return _phptemplate_callback('block', array('block' => $block));
-}
-
-/**
- * Prepare the values passed to the theme_box function to be passed
- * into a pluggable template engine.
- */
-function phptemplate_box($title, $content, $region = 'main') {
-  return _phptemplate_callback('box', array(
-    'content' =>   $content,
-    'region'  =>   $region,
-    'title'   =>   $title
-  ));
-}
-
-/**
- * Default callback for PHPTemplate.
- *
- * Load a template file, and pass the variable array to it.
- * If the suggested file is not found, PHPTemplate will attempt to use
- * a $hook.tpl.php file in the template directory, and failing that a
- * $hook.tpl.php in the PHPTemplate directory.
- *
- * @param $hook
- *   The name of the theme function being executed.
- * @param $variables
- *   A sequential array of variables passed to the theme function.
- * @param $file
- *   A suggested template file to use.
- */
-function _phptemplate_default($hook, $variables, $file = NULL) {
-  if (!empty($file) && file_exists(path_to_theme() . "/$file.tpl.php")) {
-    $file = path_to_theme() . "/$file.tpl.php";
-  }
-  else {
-    if (file_exists(path_to_theme() . "/$hook.tpl.php")) {
-      $file = path_to_theme() . "/$hook.tpl.php";
-    }
-    else {
-      if (in_array($hook, array('node', 'block', 'box', 'comment'))) {
-        $file = "themes/engines/phptemplate/$hook.tpl.php";
-      }
-      else {
-        $variables['hook'] = $hook;
-        watchdog('error', t('PHPTemplate was instructed to override the %name theme function, but no valid template file was found.', array('%name' => theme('placeholder', $hook))));
-        $file = 'themes/engines/phptemplate/default.tpl.php';
-      }
-    }
-  }
-
-  if (isset($file)) {
-    extract($variables, EXTR_SKIP);  // Extract the variables to a local namespace
-    ob_start();                      // Start output buffering
-    include "./$file";               // Include the file
-    $contents = ob_get_contents();   // Get the contents of the buffer
-    ob_end_clean();                  // End buffering and discard
-    return $contents;                // Return the contents
-  }
-
-}
-
-?>
diff --git a/themes/pushbutton/arrow-next-hover.png b/themes/pushbutton/arrow-next-hover.png
deleted file mode 100644 (file)
index 5e32cd2..0000000
Binary files a/themes/pushbutton/arrow-next-hover.png and /dev/null differ
diff --git a/themes/pushbutton/arrow-next-visited.png b/themes/pushbutton/arrow-next-visited.png
deleted file mode 100644 (file)
index 3928014..0000000
Binary files a/themes/pushbutton/arrow-next-visited.png and /dev/null differ
diff --git a/themes/pushbutton/arrow-next.png b/themes/pushbutton/arrow-next.png
deleted file mode 100644 (file)
index cf3ae6a..0000000
Binary files a/themes/pushbutton/arrow-next.png and /dev/null differ
diff --git a/themes/pushbutton/arrow-prev-hover.png b/themes/pushbutton/arrow-prev-hover.png
deleted file mode 100644 (file)
index cd85f90..0000000
Binary files a/themes/pushbutton/arrow-prev-hover.png and /dev/null differ
diff --git a/themes/pushbutton/arrow-prev-visited.png b/themes/pushbutton/arrow-prev-visited.png
deleted file mode 100644 (file)
index 38f6e31..0000000
Binary files a/themes/pushbutton/arrow-prev-visited.png and /dev/null differ
diff --git a/themes/pushbutton/arrow-prev.png b/themes/pushbutton/arrow-prev.png
deleted file mode 100644 (file)
index e6764ec..0000000
Binary files a/themes/pushbutton/arrow-prev.png and /dev/null differ
diff --git a/themes/pushbutton/arrow-up-hover.png b/themes/pushbutton/arrow-up-hover.png
deleted file mode 100644 (file)
index 3bff735..0000000
Binary files a/themes/pushbutton/arrow-up-hover.png and /dev/null differ
diff --git a/themes/pushbutton/arrow-up-visited.png b/themes/pushbutton/arrow-up-visited.png
deleted file mode 100644 (file)
index 2df0fdd..0000000
Binary files a/themes/pushbutton/arrow-up-visited.png and /dev/null differ
diff --git a/themes/pushbutton/arrow-up.png b/themes/pushbutton/arrow-up.png
deleted file mode 100644 (file)
index 81dd410..0000000
Binary files a/themes/pushbutton/arrow-up.png and /dev/null differ
diff --git a/themes/pushbutton/background.png b/themes/pushbutton/background.png
deleted file mode 100644 (file)
index 889e1cc..0000000
Binary files a/themes/pushbutton/background.png and /dev/null differ
diff --git a/themes/pushbutton/block.tpl.php b/themes/pushbutton/block.tpl.php
deleted file mode 100644 (file)
index 782ed50..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<div class="<?php print "block block-$block->module" ?>" id="<?php print "block-$block->module-$block->delta"; ?>">
-  <div class="title"><h3><?php print $block->subject ?></h3></div>
-  <div class="content"><?php print $block->content ?></div>
-</div>
\ No newline at end of file
diff --git a/themes/pushbutton/box.tpl.php b/themes/pushbutton/box.tpl.php
deleted file mode 100644 (file)
index cf48ffa..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<div class="box">
-  <?php if ($title): ?>
-  <h2 class="title"><?php print $title ?></h2>
-  <?php endif; ?>
-  <div class="content"><?php print $content ?></div>
-</div>
\ No newline at end of file
diff --git a/themes/pushbutton/comment.tpl.php b/themes/pushbutton/comment.tpl.php
deleted file mode 100644 (file)
index 2f2113b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<div class="comment<?php if ($comment->status == COMMENT_NOT_PUBLISHED) print ' comment-unpublished'; ?>">
-  <?php if ($picture) : ?>
-    <?php print $picture ?>
-  <?php endif; ?>
-  <h3 class="title"><?php print $title ?></h3>
-  <div class="submitted"><?php print $submitted ?><?php if ($comment->new) : ?><span class="new"> *<?php print $new ?></span><?php endif; ?></div>
-  <div class="content"><?php print $content ?></div>
-  <!-- BEGIN: links -->
-  <div class="links">&raquo; <?php print $links ?></div>
-  <!-- END: links -->
-</div>
diff --git a/themes/pushbutton/forum-container.jpg b/themes/pushbutton/forum-container.jpg
deleted file mode 100644 (file)
index 46ea78f..0000000
Binary files a/themes/pushbutton/forum-container.jpg and /dev/null differ
diff --git a/themes/pushbutton/forum-link.png b/themes/pushbutton/forum-link.png
deleted file mode 100644 (file)
index 56c50b1..0000000
Binary files a/themes/pushbutton/forum-link.png and /dev/null differ
diff --git a/themes/pushbutton/header-a.jpg b/themes/pushbutton/header-a.jpg
deleted file mode 100644 (file)
index 26b6c01..0000000
Binary files a/themes/pushbutton/header-a.jpg and /dev/null differ
diff --git a/themes/pushbutton/header-b.jpg b/themes/pushbutton/header-b.jpg
deleted file mode 100644 (file)
index 17ed854..0000000
Binary files a/themes/pushbutton/header-b.jpg and /dev/null differ
diff --git a/themes/pushbutton/header-c.png b/themes/pushbutton/header-c.png
deleted file mode 100644 (file)
index 711a3c7..0000000
Binary files a/themes/pushbutton/header-c.png and /dev/null differ
diff --git a/themes/pushbutton/icon-block.png b/themes/pushbutton/icon-block.png
deleted file mode 100644 (file)
index c12933b..0000000
Binary files a/themes/pushbutton/icon-block.png and /dev/null differ
diff --git a/themes/pushbutton/icon-comment.png b/themes/pushbutton/icon-comment.png
deleted file mode 100644 (file)
index 9ef36de..0000000
Binary files a/themes/pushbutton/icon-comment.png and /dev/null differ
diff --git a/themes/pushbutton/logo-active.jpg b/themes/pushbutton/logo-active.jpg
deleted file mode 100644 (file)
index 67e8908..0000000
Binary files a/themes/pushbutton/logo-active.jpg and /dev/null differ
diff --git a/themes/pushbutton/logo-background.jpg b/themes/pushbutton/logo-background.jpg
deleted file mode 100644 (file)
index d47005f..0000000
Binary files a/themes/pushbutton/logo-background.jpg and /dev/null differ
diff --git a/themes/pushbutton/logo-hover.jpg b/themes/pushbutton/logo-hover.jpg
deleted file mode 100644 (file)
index 5e662f5..0000000
Binary files a/themes/pushbutton/logo-hover.jpg and /dev/null differ
diff --git a/themes/pushbutton/logo.png b/themes/pushbutton/logo.png
deleted file mode 100644 (file)
index 4d0a7e9..0000000
Binary files a/themes/pushbutton/logo.png and /dev/null differ
diff --git a/themes/pushbutton/node.tpl.php b/themes/pushbutton/node.tpl.php
deleted file mode 100644 (file)
index 8eccce9..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
-  <?php print $picture ?>
-  <?php if ($page == 0): ?>
-    <h1 class="title"><a href="<?php print $node_url ?>"><?php print $title ?></a></h1>
-  <?php endif; ?>
-    <span class="submitted"><?php print $submitted ?></span>
-    <span class="taxonomy"><?php print $terms ?></span>
-    <div class="content"><?php print $content ?></div>
-    <?php if ($links): ?>
-    <div class="links">&raquo; <?php print $links ?></div>
-    <?php endif; ?>
-</div>
diff --git a/themes/pushbutton/page.tpl.php b/themes/pushbutton/page.tpl.php
deleted file mode 100644 (file)
index 33fb1d3..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language ?>" xml:lang="<?php print $language ?>">
-<head>
-  <title><?php print $head_title ?></title>
-  <meta http-equiv="Content-Style-Type" content="text/css" />
-  <?php print $head ?>
-  <?php print $styles ?>
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class="hide"><a href="#content" title="<?php print t('Skip navigation') ?>." accesskey="2"><?php print t('Skip navigation') ?></a>.</div>
-
-<table id="primary-menu" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%">
-  <tr>
-    <td id="home" width="10%">
-      <?php if ($logo) : ?>
-        <a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print($logo) ?>" alt="<?php print t('Home') ?>" border="0" /></a>
-      <?php endif; ?>
-    </td>
-
-    <td id="site-info" width="20%">
-      <?php if ($site_name) : ?>
-        <div class='site-name'><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><?php print($site_name) ?></a></div>
-      <?php endif;?>
-      <?php if ($site_slogan) : ?>
-        <div class='site-slogan'><?php print($site_slogan) ?></div>
-      <?php endif;?>
-    </td>
-    <td class="primary-links" width="70%" align="center" valign="middle">
-      <?php print theme('links', $primary_links) ?>
-    </td>
-  </tr>
-</table>
-
-<table id="secondary-menu" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%">
-  <tr>
-    <td class="secondary-links" width="75%"  align="center" valign="middle">
-      <?php print theme('links', $secondary_links) ?>
-    </td>
-    <td  width="25%"  align="center" valign="middle">
-      <?php print $search_box ?>
-    </td>
-  </tr>
-  <tr>
-    <td colspan="2"><div><?php print $header ?></div></td>
-  </tr>
-</table>
-
-<table id="content" border="0" cellpadding="15" cellspacing="0" width="100%">
-  <tr>
-    <?php if ($sidebar_left != ""): ?>
-    <td id="sidebar-left">
-      <?php print $sidebar_left ?>
-    </td>
-    <?php endif; ?>
-
-    <td valign="top">
-      <?php if ($mission != ""): ?>
-      <div id="mission"><?php print $mission ?></div>
-      <?php endif; ?>
-
-      <div id="main">
-        <?php if ($title != ""): ?>
-          <?php print $breadcrumb ?>
-          <h1 class="title"><?php print $title ?></h1>
-
-          <?php if ($tabs != ""): ?>
-            <div class="tabs"><?php print $tabs ?></div>
-          <?php endif; ?>
-
-        <?php endif; ?>
-
-        <?php if ($help != ""): ?>
-            <div id="help"><?php print $help ?></div>
-        <?php endif; ?>
-
-        <?php if ($messages != ""): ?>
-          <?php print $messages ?>
-        <?php endif; ?>
-
-      <!-- start main content -->
-      <?php print($content) ?>
-      <!-- end main content -->
-
-      </div><!-- main -->
-    </td>
-    <?php if ($sidebar_right != ""): ?>
-    <td id="sidebar-right">
-      <?php print $sidebar_right ?>
-    </td>
-    <?php endif; ?>
-  </tr>
-</table>
-
-<table id="footer-menu" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%">
-  <tr>
-    <td align="center" valign="middle">
-    <?php if (isset($primary_links)) : ?>
-      <div class="primary-links">
-        <?php print theme('links', $primary_links) ?>
-      </div>
-    <?php endif; ?>
-    <?php if (isset($secondary_links)) : ?>
-      <div class="secondary-links">
-        <?php print theme('links', $secondary_links) ?>
-      </div>
-    <?php endif; ?>
-    </td>
-  </tr>
-</table>
-
-<?php if ($footer_message) : ?>
-<div id="footer-message">
-    <p><?php print $footer_message;?></p>
-</div>
-<?php endif; ?>
-<?php print $closure;?>
-</body>
-</html>
diff --git a/themes/pushbutton/screenshot.png b/themes/pushbutton/screenshot.png
deleted file mode 100644 (file)
index 139e1a7..0000000
Binary files a/themes/pushbutton/screenshot.png and /dev/null differ
diff --git a/themes/pushbutton/style.css b/themes/pushbutton/style.css
deleted file mode 100644 (file)
index 99744f5..0000000
+++ /dev/null
@@ -1,617 +0,0 @@
-/* $Id: style.css 144 2007-03-28 07:52:20Z thierry $ */
-
-/*
-** HTML elements
-*/
-body  {
-  color: #000;
-  background-color: #fff;
-  margin: 0;
-  padding: 0;
-}
-body, p, td, li, ul, ol  {
-  font-family: Verdana, Helvetica, Arial, sans-serif;
-}
-h1, h2, h3, h4, h5, h6 {
-  font-family: "Trebuchet MS", Geneva, Arial, Helvetica, SunSans-Regular, Verdana, sans-serif;
-  margin: 0;
-}
-h1 {
-  color: #369;
-  font-size: 1.6em;
-}
-tr.odd td, tr.even td {
-  padding: 0.3em;
-}
-a:link {
-  text-decoration: none;
-  font-weight: bold;
-  color: #ff8c00;
-}
-a:visited {
-  text-decoration: none;
-  font-weight: bold;
-  color: #c96;
-}
-a:hover, a:active {
-  font-weight: bold;
-  color: #ff4500;
-  text-decoration: underline;
-}
-fieldset {
-  border: 1px solid #ccc;
-}
-p {
-  margin: 0 0 1.3em 0;
-  padding: 0;
-}
-blockquote {
-  border-left: 4px solid #69c;
-  padding: 0 15px 0 15px;
-  margin: 25px 100px 25px 50px;
-  color: #696969;
-  text-align: left;
-  font-size: 1.2em;
-  line-height: 1.3em;
-  font-family: "Trebuchet MS", Geneva, Arial, Helvetica, SunSans-Regular, Verdana, sans-serif;
-}
-pre {
-  background-color: #eee;
-  padding: 0.75em 1.5em;
-  font-size: 1.2em;
-  border: 1px solid #ddd;
-}
-.form-item {
-  margin-top: 1em;
-}
-.form-item label {
-  color: #369;
-}
-.item-list .title {
-  color: #369;
-  font-size: 0.85em;
-}
-
-/*
-** Page layout blocks / IDs
-*/
-#primary-menu  {
-  border-collapse: separate;
-  background-color: #e0edfb;
-  border-bottom: 3px solid #69c;
-}
-#primary-menu tr {
-  background: transparent url(header-a.jpg) left bottom repeat;
-}
-td#home {
-  background: transparent url(logo-background.jpg) left top repeat;
-}
-td#home a:link img, td#home a:visited img {
-  background: transparent url(logo-active.jpg) repeat;
-  width: 144px;
-  height: 63px;
-}
-td#home a:hover img {
-  background: transparent url(logo-hover.jpg) repeat;
-  width: 144px;
-  height: 63px;
-}
-.primary-links, .primary-links a:link, .primary-links a:visited {
-  color: #369;
-}
-.primary-links a:hover {
-  color: #000;
-}
-#primary-menu .primary-links   {
-  background: transparent url(header-b.jpg) left top no-repeat;
-  font-size: 0.79em;
-}
-#primary-menu .primary-links h1, #primary-menu .primary-links h2, #primary-menu .primary-links h3 {
-  font-size: 2.3em;
-  color: #369;
-}
-#secondary-menu {
-  border-collapse: separate;
-  background-color: #369;
-  border-bottom: 3px solid #69c;
-}
-.secondary-links, .secondary-links a:link, .secondary-links a:visited  {
-  color: #e4e9eb;
-}
-.secondary-links a:hover {
-  color: #fff;
-  text-decoration: underline;
-}
-#secondary-menu .secondary-links {
-  font-size: 0.85em;
-}
-.tabs {
-  margin: 15px 0 15px 0;
-}
-.tabs ul.primary {
-  border-collapse: collapse;
-  padding: 0 0 3px 10px;
-  white-space: nowrap;
-  list-style: none;
-  margin: 0 0 0 0;
-  height: auto;
-  line-height: normal;
-  border-bottom: 2px solid #336699;
-}
-.tabs ul.primary li {
-  display: inline;
-}
-.tabs ul.primary li a {
-  padding: 3px 10px 3px 10px;
-  background: #fff url(tabs-off.png) left top no-repeat;
-  border-color: #6699CC;
-  border-width: 2px;
-  border-style: none solid none none;
-  height: auto;
-  margin-right: 10px;
-  text-decoration: none;
-  text-transform: lowercase;
-}
-.tabs ul.primary li.active a {
-  background: #336699 url(tabs-on.png) left top no-repeat;
-  border-right: 2px solid #336699;
-  color: #fff;
-}
-.tabs ul.primary li a:hover {
-  background-color: #fffaf0;
-  color: #ff4500;
-}
-.tabs ul.secondary {
-  border-collapse: collapse;
-  padding: 10px 0 10px 0;
-  margin: 0 0 0 0;
-  white-space: nowrap;
-  width: 100%;
-  list-style: none;
-  height: auto;
-  line-height: normal;
-  border-bottom: none;
-}
-.tabs ul.secondary li {
-  display: inline;
-  height: auto;
-  padding: 0 0 0 10px;
-  text-decoration: none;
-  border-right: none;
-}
-.tabs ul.secondary li a {
-  background: #fff url(tabs-option-off.png) left center no-repeat;
-  padding: 10px 0 10px 25px;
-  margin: 0 0 0 0;
-}
-.tabs ul.secondary li a.active {
-  background: #fff url(tabs-option-on.png) left center no-repeat;
-  color: #369;
-  border-bottom: none;
-}
-.tabs ul.secondary li a:hover {
-  background: #fff url(tabs-option-hover.png) left center no-repeat;
-  color: #FF4500
-}
-#content {
-  background-color: #fff;
-}
-#contentstart {
-  background-color: #fff;
-}
-#menu {
-  padding: 0.5em 0.5em 0 0.5em;
-  text-align: right;
-  vertical-align: middle;
-}
-#search .form-text, #search .form-submit {
-  border: 1px solid #369;
-  font-size: 0.85em;
-  margin: 0.2em;
-}
-#search .form-text {
-  width: 9em;
-}
-#search .form-submit {
-  height: 1.5em;
-}
-#mission {
-  background-color: #fff;
-  color: #696969;
-  border-top: 2px solid #dcdcdc;
-  border-bottom: 2px solid #dcdcdc;
-  padding: 10px 10px 10px 10px;
-  margin: 20px 35px 0 35px;
-  font-family: "Trebuchet MS", Geneva, Arial, Helvetica, SunSans-Regular, Verdana, sans-serif;
-  font-size: 1.1em;
-  font-weight: normal;
-}
-#site-info {
-  background-color: #bdd3ea;
-  background-image: url('header-c.png');
-  font-family: "Trebuchet MS", Geneva, Arial, Helvetica, SunSans-Regular, Verdana, sans-serif;
-}
-.site-name {
-  font-size: 1.2em;
-}
-.site-name a:link, .site-name a:visited {
-  color: #fff;
-}
-.site-name a:hover {
-  color: #ff8c00;
-  text-decoration: none;
-}
-.site-slogan {
-  font-size: 0.8em;
-  font-weight: bold;
-}
-#main {
-  /* padding in px not ex because IE messes up 100% width tables otherwise */
-  padding: 30px 35px 50px 35px;
-  background: transparent url(background.png) center center no-repeat;
-  /* fix background overlapping text in IE (aka Peekaboo Bug) */
-  position: relative;
-}
-#mission, .node .content, .comment .content {
-  line-height: 1.4;
-}
-#help {
-  font-size: 0.9em;
-  margin-bottom: 1em;
-}
-.breadcrumb {
-  margin-bottom: .5em;
-}
-.messages {
-  background-color: #eee;
-  border: 1px solid #ccc;
-  padding: 0.3em;
-  margin-bottom: 1em;
-}
-.error {
-  border-color: red;
-}
-.nav {
-  padding: 0;
-  margin: 0;
-}
-#sidebar-left, #sidebar-right {
-  font-size: 0.75em;
-  width: 175px;
-  /* padding in px not ex because IE messes up 100% width tables otherwise */
-  padding: 25px 10px 75px 10px;
-  vertical-align: top;
-  background: #FFFAF0;
-}
-#sidebar-left {
-  border-right: 3px solid #f5f5f5;
-}
-#sidebar-right {
-  border-left: 3px solid #f5f5f5;
-}
-#sidebar-left li, #sidebar-right li {
-  font-size: 1em;
-}
-.node .content {
-  text-align: left;
-  font-size: 0.85em;
-  line-height: 1.3;
-}
-.comment .content {
-  text-align: left;
-  font-size: 0.85em;
-  line-height: 1.3;
-}
-#footer-message {
-  padding: 15px 100px 30px 100px;
-  font-size: 0.85em;
-  text-align: center;
-  color: #aaa;
-}
-table#footer-menu {
-  border-top: 3px solid #6699cc;
-  border-bottom: 3px solid #6699cc;
-  background-color: #369;
-  color: #e4e9eb;
-}
-#footer-menu td {
-  padding: 5px;
-  font-size: 0.75em;
-}
-#footer-menu .primary-links, #footer-menu a:link, #footer-menu a:visited  {
-  color: #e4e9eb;
-}
-#footer-menu a:hover  {
-  color: #fff;
-  text-decoration: underline;
-}
-#footer-menu .primary-links h1, #footer-menu .primary-links h2, #footer-menu .primary-links h3 {
-  font-size: 1.3em;
-  color: #e4e9eb;
-}
-/*
-** Common declarations for child classes of node, comment, block, box, etc.
-** If you want any of them styled differently for a specific parent, add
-** additional rules /with only the differing properties!/ to .parent .class.
-** See .comment .title for an example.
-*/
-#content .title, #content .title a {
-  color: #369;
-}
-.content h1 {
-  color: #369;
-  font-size: 1.9em;
-}
-.content h2 {
-  color: #58b;
-  font-size: 1.7em;
-}
-.content h3 {
-  color: #69c;
-  font-size: 1.5em;
-}
-.content h4 {
-  color: #8be;
-  font-size: 1.3em;
-}
-.content h5 {
-  color: #96c6f6;
-  font-size: 1.15em;
-}
-.submitted {
-  color: #999;
-  font-size: 0.79em;
-}
-.links {
-  color: #ff8c00;
-  font-size: 0.8em;
-  padding: 0;
-  margin: 0;
-}
-.links a {
-  font-weight: bold;
-}
-.box {
-  padding: 0 0 1.5em 0;
-}
-.box {
-  padding: 0;
-  margin: 0;
-}
-.box h2 {
-  font-size: 9px;
-}
-.block .title h3 {
-  border-bottom: 2px solid #6699cc;
-  color: #369;
-  font-size: 18px;
-  font-weight: bold;
-  padding: 10px 5px 10px 30px;
-  margin-bottom: .25em;
-  background: transparent url(icon-block.png) left center no-repeat;
-}
-.block .content {
-  padding: 5px 5px 5px 5px;
-}
-.block {
-  margin-bottom: 1.5em;
-}
-.box .title {
-  font-size: 1.1em;
-}
-.node {
-  margin: .5em 0 2.5em 0;
-}
-.node .content, .comment .content {
-  margin: .5em 0 .5em 0;
-}
-.node .taxonomy {
-  color: #999;
-  font-size: 0.83em;
-  padding: 1.5em;
-}
-.node .picture {
-  border: 1px solid #fff;
-  float: right;
-  margin: 0.5em;
-}
-.comment {
-  border: 1px solid #abc;
-  padding: .5em;
-  margin-bottom: 1em;
-}
-.comment .title {
-  font-size: 1em;
-  padding: 10px 0 12px 19px;
-  background: transparent url(icon-comment.png) left center no-repeat;
-}
-.comment .new {
-  font-weight: bold;
-  font-size: 1em;
-  margin-left: 2px;
-  color: red;
-}
-.comment .picture {
-  border: 1px solid #fff;
-  float: right;
-  margin: 10px;
-}
-.links {
-  font-size: 0.75em;
-}
-.links .prev, .links .next, .links .up {
-  font-size: 1.15em;
-}
-.titles .prev, .titles .next  {
-  font-size: 0.85em;
-  font-weight: bold;
-  color: #444;
-}
-.hide {
-  display: none
-}
-.nav .links .next a:link {
-  padding: 17px 17px 17px 0;
-  background: transparent url(arrow-next.png) right center no-repeat;
-}
-.nav .links .next a:visited {
-  padding: 17px 17px 17px 0;
-  background: transparent url(arrow-next-visited.png) right center no-repeat;
-}
-.nav .links .next a:hover {
-  padding: 17px 17px 17px 0;
-  background: transparent url(arrow-next-hover.png) right center no-repeat;
-}
-.nav .links .prev a:link {
-  padding: 17px 0 17px 17px;
-  background: transparent url(arrow-prev.png) left center no-repeat;
-}
-.nav .links .prev a:visited {
-  padding: 17px 0 17px 17px;
-  background: transparent url(arrow-prev-visited.png) left center no-repeat;
-}
-.nav .links .prev a:hover {
-  padding: 17px 0 17px 17px;
-  background: transparent url(arrow-prev-hover.png) left center no-repeat;
-}
-.nav .links .up a:link {
-  padding: 11px 0 17px 0;
-  background: transparent url(arrow-up.png) center top no-repeat;
-}
-.nav .links .up a:visited {
-  padding: 11px 0 17px 0;
-  background: transparent url(arrow-up-visited.png) center top no-repeat;
-}
-.nav .links .up a:hover {
-  padding: 11px 0 17px 0;
-  background: transparent url(arrow-up-hover.png) center top no-repeat;
-}
-
-/*
-** Module specific styles
-*/
-.content .active {
-  color: #369;
-}
-#aggregator .feed-source {
-  background-color: #eee;
-  border: 1px solid #ccc;
-  padding: 1em;
-  margin: 1em 0 1em 0;
-}
-#aggregator .news-item .source {
-  color: #999;
-  font-style: italic;
-  font-size: 0.85em;
-}
-#aggregator .title {
-  font-size: 1em;
-}
-#aggregator h3 {
-  margin-top: 1em;
-}
-#tracker th {
-  text-align: center;
-  background-color: #f5f5f5;
-  border-bottom: 1px solid #ddd;
-  border-right: 1px solid #ddd;
-  border-left: 1px solid #fafafa;
-}
-#tracker th img {
-  float: right;
-}
-#tracker tr.even, #tracker tr.odd {
-  background-color: #fff;
-}
-#tracker td {
-  vertical-align: top;
-  padding: 1em 1em 1em 0;
-  border-bottom: 1px solid #bbb;
-}
-#forum {
-  margin: 15px 0 15px 0;
-  background-color: #fff;
-}
-#forum table {
-  width: 100%;
-  border: 2px solid #69c;
-}
-#forum table tr th {
-  text-align: center;
-  background: #69c;
-  color: #fff;
-  font-size: 0.75em;
-  border-bottom: 1px solid #aaa;
-}
-#forum table tr th a  {
-  color: #fff;
-  text-decoration: underline;
-}
-#forum table tr th img  {
-  margin: 0;
-}
-#forum tr.odd {
-  background: #e0edfb;
-}
-#forum tr.even {
-  background: #fff;
-}
-#forum td {
-  padding: 0.5em 0.5em 0.5em 0.5em;
-}
-#forum td.container {
-  color: #000;
-  background: #369 url(forum-container.jpg) right top no-repeat;
-  border: 2px solid #69c;
-}
-#forum td.container a {
-  color: #e4e9eb;
-  padding: 20px 0 20px 35px;
-  background: transparent url(forum-link.png) left center no-repeat;
-}
-#forum td.container a:visited {
-  color: #e4e9eb;
-}
-#forum td.statistics, #forum td.settings, #forum td.pager {
-  height: 1.5em;
-  border: 1px solid #bbb;
-}
-#forum td .name {
-  color: #96c;
-}
-#forum td .links {
-  padding-top: 0.7em;
-  font-size: 0.9em;
-}
-.block-forum h3 {
-  margin-bottom: .5em;
-}
-.calendar a {
-  text-decoration: none;
-}
-.calendar td, .calendar th {
-  padding: 0.4em 0;
-  border-color: #888;
-}
-.calendar .row-week td a {
-  padding: 0.4em 0;
-}
-.calendar .day-today {
-  background-color: #69c;
-}
-.calendar .day-today a {
-  color: #fff;
-}
-.calendar .day-selected {
-  background-color: #369;
-  color: #fff;
-}
-.calendar .header-week {
-  background-color: #ccc;
-}
-.calendar .day-blank {
-  background-color: #ccc;
-}
-.calendar .row-week td a:hover {
-  background-color: #fff; color: #000;
-}
diff --git a/themes/pushbutton/tabs-off.png b/themes/pushbutton/tabs-off.png
deleted file mode 100644 (file)
index 5199a9e..0000000
Binary files a/themes/pushbutton/tabs-off.png and /dev/null differ
diff --git a/themes/pushbutton/tabs-on.png b/themes/pushbutton/tabs-on.png
deleted file mode 100644 (file)
index 4f73e50..0000000
Binary files a/themes/pushbutton/tabs-on.png and /dev/null differ
diff --git a/themes/pushbutton/tabs-option-hover.png b/themes/pushbutton/tabs-option-hover.png
deleted file mode 100644 (file)
index 6a77858..0000000
Binary files a/themes/pushbutton/tabs-option-hover.png and /dev/null differ
diff --git a/themes/pushbutton/tabs-option-off.png b/themes/pushbutton/tabs-option-off.png
deleted file mode 100644 (file)
index e3c3a3a..0000000
Binary files a/themes/pushbutton/tabs-option-off.png and /dev/null differ
diff --git a/themes/pushbutton/tabs-option-on.png b/themes/pushbutton/tabs-option-on.png
deleted file mode 100644 (file)
index 93ca794..0000000
Binary files a/themes/pushbutton/tabs-option-on.png and /dev/null differ
diff --git a/update.php b/update.php
deleted file mode 100644 (file)
index edb4d4b..0000000
+++ /dev/null
@@ -1,718 +0,0 @@
-<?php
-// $Id: update.php 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * Administrative page for handling updates from one Drupal version to another.
- *
- * Point your browser to "http://www.example.com/update.php" and follow the
- * instructions.
- *
- * If you are not logged in as administrator, you will need to modify the access
- * check statement below. Change the TRUE to a FALSE to disable the access
- * check. After finishing the upgrade, be sure to open this file and change the
- * FALSE back to a TRUE!
- */
-
-// Enforce access checking?
-$access_check = TRUE;
-
-
-function update_sql($sql) {
-  $result = db_query($sql);
-  return array('success' => $result !== FALSE, 'query' => check_plain($sql));
-}
-
-/**
- * Add a column to a database using syntax appropriate for PostgreSQL.
- * Save result of SQL commands in $ret array.
- *
- * Note: when you add a column with NOT NULL and you are not sure if there are
- * already rows in the table, you MUST also add DEFAULT. Otherwise PostgreSQL won't
- * work when the table is not empty. If NOT NULL and DEFAULT are set the
- * PostgreSQL version will set values of the added column in old rows to the
- * DEFAULT value.
- *
- * @param $ret
- *   Array to which results will be added.
- * @param $table
- *   Name of the table, without {}
- * @param $column
- *   Name of the column
- * @param $type
- *   Type of column
- * @param $attributes
- *   Additional optional attributes. Recognized attributes:
- *     not null => TRUE|FALSE
- *     default  => NULL|FALSE|value (with or without '', it won't be added)
- * @return
- *   nothing, but modifies $ret parameter.
- */
-function db_add_column(&$ret, $table, $column, $type, $attributes = array()) {
-  if (array_key_exists('not null', $attributes) and $attributes['not null']) {
-    $not_null = 'NOT NULL';
-  }
-  if (array_key_exists('default', $attributes)) {
-    if (is_null($attributes['default'])) {
-      $default_val = 'NULL';
-      $default = 'default NULL';
-    }
-    elseif ($attributes['default'] === FALSE) {
-      $default = '';
-    }
-    else {
-      $default_val = "$attributes[default]";
-      $default = "default $attributes[default]";
-    }
-  }
-
-  $ret[] = update_sql("ALTER TABLE {". $table ."} ADD $column $type");
-  if ($default) { $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column SET $default"); }
-  if ($not_null) {
-    if ($default) { $ret[] = update_sql("UPDATE {". $table ."} SET $column = $default_val"); }
-    $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column SET NOT NULL");
-  }
-}
-
-/**
- * Change a column definition using syntax appropriate for PostgreSQL.
- * Save result of SQL commands in $ret array.
- *
- * Remember that changing a column definition involves adding a new column
- * and dropping an old one. This means that any indices, primary keys and
- * sequences from serial-type columns are dropped and might need to be
- * recreated.
- *
- * @param $ret
- *   Array to which results will be added.
- * @param $table
- *   Name of the table, without {}
- * @param $column
- *   Name of the column to change
- * @param $column_new
- *   New name for the column (set to the same as $column if you don't want to change the name)
- * @param $type
- *   Type of column
- * @param $attributes
- *   Additional optional attributes. Recognized attributes:
- *     not null => TRUE|FALSE
- *     default  => NULL|FALSE|value (with or without '', it won't be added)
- * @return
- *   nothing, but modifies $ret parameter.
- */
-function db_change_column(&$ret, $table, $column, $column_new, $type, $attributes = array()) {
-  if (array_key_exists('not null', $attributes) and $attributes['not null']) {
-    $not_null = 'NOT NULL';
-  }
-  if (array_key_exists('default', $attributes)) {
-    if (is_null($attributes['default'])) {
-      $default_val = 'NULL';
-      $default = 'default NULL';
-    }
-    elseif ($attributes['default'] === FALSE) {
-      $default = '';
-    }
-    else {
-      $default_val = "$attributes[default]";
-      $default = "default $attributes[default]";
-    }
-  }
-
-  $ret[] = update_sql("ALTER TABLE {". $table ."} RENAME $column TO ". $column ."_old");
-  $ret[] = update_sql("ALTER TABLE {". $table ."} ADD $column_new $type");
-  $ret[] = update_sql("UPDATE {". $table ."} SET $column_new = ". $column ."_old");
-  if ($default) { $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column_new SET $default"); }
-  if ($not_null) { $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column_new SET NOT NULL"); }
-  $ret[] = update_sql("ALTER TABLE {". $table ."} DROP ". $column ."_old");
-}
-
-/**
- * If the schema version for Drupal core is stored in the variables table
- * (4.6.x and earlier) move it to the schema_version column of the system
- * table.
- *
- * This function may be removed when update 156 is removed, which is the last
- * update in the 4.6 to 4.7 migration.
- */
-function update_fix_schema_version() {
-  if ($update_start = variable_get('update_start', FALSE)) {
-    // Some updates were made to the 4.6 branch and 4.7 branch. This sets
-    // temporary variables to prevent the updates from being executed twice and
-    // throwing errors.
-    switch ($update_start) {
-      case '2005-04-14':
-        variable_set('update_132_done', TRUE);
-        break;
-
-      case '2005-05-06':
-        variable_set('update_132_done', TRUE);
-        variable_set('update_135_done', TRUE);
-        break;
-
-      case '2005-05-07':
-        variable_set('update_132_done', TRUE);
-        variable_set('update_135_done', TRUE);
-        variable_set('update_137_done', TRUE);
-        break;
-
-    }
-    // The schema_version column (added below) was changed during 4.7beta.
-    // Update_170 is only for those beta users.
-    variable_set('update_170_done', TRUE);
-
-    $sql_updates = array(
-      '2004-10-31: first update since Drupal 4.5.0 release' => 110,
-      '2004-11-07' => 111, '2004-11-15' => 112, '2004-11-28' => 113,
-      '2004-12-05' => 114, '2005-01-07' => 115, '2005-01-14' => 116,
-      '2005-01-18' => 117, '2005-01-19' => 118, '2005-01-20' => 119,
-      '2005-01-25' => 120, '2005-01-26' => 121, '2005-01-27' => 122,
-      '2005-01-28' => 123, '2005-02-11' => 124, '2005-02-23' => 125,
-      '2005-03-03' => 126, '2005-03-18' => 127, '2005-03-21' => 128,
-      // The following three updates were made on the 4.6 branch
-      '2005-04-14' => 128, '2005-05-06' => 128, '2005-05-07' => 128,
-      '2005-04-08: first update since Drupal 4.6.0 release' => 129,
-      '2005-04-10' => 130, '2005-04-11' => 131, '2005-04-14' => 132,
-      '2005-04-24' => 133, '2005-04-30' => 134, '2005-05-06' => 135,
-      '2005-05-08' => 136, '2005-05-09' => 137, '2005-05-10' => 138,
-      '2005-05-11' => 139, '2005-05-12' => 140, '2005-05-22' => 141,
-      '2005-07-29' => 142, '2005-07-30' => 143, '2005-08-08' => 144,
-      '2005-08-15' => 145, '2005-08-25' => 146, '2005-09-07' => 147,
-      '2005-09-18' => 148, '2005-09-27' => 149, '2005-10-15' => 150,
-      '2005-10-23' => 151, '2005-10-28' => 152, '2005-11-03' => 153,
-      '2005-11-14' => 154, '2005-11-27' => 155, '2005-12-03' => 156,
-    );
-
-    // Add schema version column
-    switch ($GLOBALS['db_type']) {
-      case 'pgsql':
-        $ret = array();
-        db_add_column($ret, 'system', 'schema_version', 'smallint', array('not null' => TRUE, 'default' => -1));
-        break;
-
-      case 'mysql':
-      case 'mysqli':
-        db_query('ALTER TABLE {system} ADD schema_version smallint(3) not null default -1');
-        break;
-    }
-    // Set all enabled (contrib) modules to schema version 0 (installed)
-    db_query('UPDATE {system} SET schema_version = 0 WHERE status = 1');
-
-    // Set schema version for core
-    drupal_set_installed_schema_version('system', $sql_updates[$update_start]);
-    variable_del('update_start');
-  }
-}
-
-/**
- * System update 130 changes the sessions table, which breaks the update
- * script's ability to use session variables. This changes the table
- * appropriately.
- *
- * This code, including the 'update_sessions_fixed' variable, may be removed
- * when update 130 is removed. It is part of the Drupal 4.6 to 4.7 migration.
- */
-function update_fix_sessions() {
-  $ret = array();
-
-  if (drupal_get_installed_schema_version('system') < 130 && !variable_get('update_sessions_fixed', FALSE)) {
-    if ($GLOBALS['db_type'] == 'mysql') {
-      db_query("ALTER TABLE {sessions} ADD cache int(11) NOT NULL default '0' AFTER timestamp");
-    }
-    elseif ($GLOBALS['db_type'] == 'pgsql') {
-      db_add_column($ret, 'sessions', 'cache', 'int', array('default' => 0, 'not null' => TRUE));
-    }
-
-    variable_set('update_sessions_fixed', TRUE);
-  }
-}
-
-/**
- * System update 115 changes the watchdog table, which breaks the update
- * script's ability to use logging. This changes the table appropriately.
- *
- * This code, including the 'update_watchdog_115_fixed' variable, may be removed
- * when update 115 is removed. It is part of the Drupal 4.5 to 4.7 migration.
- */
-function update_fix_watchdog_115() {
-  if (drupal_get_installed_schema_version('system') < 115 && !variable_get('update_watchdog_115_fixed', FALSE)) {
-    if ($GLOBALS['db_type'] == 'mysql') {
-      $ret[] = update_sql("ALTER TABLE {watchdog} ADD severity tinyint(3) unsigned NOT NULL default '0'");
-    }
-    else if ($GLOBALS['db_type'] == 'pgsql') {
-      $ret[] = update_sql('ALTER TABLE {watchdog} ADD severity smallint');
-      $ret[] = update_sql('UPDATE {watchdog} SET severity = 0');
-      $ret[] = update_sql('ALTER TABLE {watchdog} ALTER COLUMN severity SET NOT NULL');
-      $ret[] = update_sql('ALTER TABLE {watchdog} ALTER COLUMN severity SET DEFAULT 0');
-    }
-
-    variable_set('update_watchdog_115_fixed', TRUE);
-  }
-}
-
-/**
- * System update 142 changes the watchdog table, which breaks the update
- * script's ability to use logging. This changes the table appropriately.
- *
- * This code, including the 'update_watchdog_fixed' variable, may be removed
- * when update 142 is removed. It is part of the Drupal 4.6 to 4.7 migration.
- */
-function update_fix_watchdog() {
-  if (drupal_get_installed_schema_version('system') < 142 && !variable_get('update_watchdog_fixed', FALSE)) {
-    switch ($GLOBALS['db_type']) {
-      case 'pgsql':
-        $ret = array();
-        db_add_column($ret, 'watchdog', 'referer', 'varchar(128)', array('not null' => TRUE, 'default' => "''"));
-        break;
-      case 'mysql':
-      case 'mysqli':
-        db_query("ALTER TABLE {watchdog} ADD COLUMN referer varchar(128) NOT NULL");
-        break;
-    }
-
-    variable_set('update_watchdog_fixed', TRUE);
-  }
-}
-
-/**
- * Perform one update and store the results which will later be displayed on
- * the finished page.
- *
- * @param $module
- *   The module whose update will be run.
- * @param $number
- *   The update number to run.
- *
- * @return
- *   TRUE if the update was finished. Otherwise, FALSE.
- */
-function update_data($module, $number) {
-  $ret = module_invoke($module, 'update_'. $number);
-  // Assume the update finished unless the update results indicate otherwise.
-  $finished = 1;
-  if (isset($ret['#finished'])) {
-    $finished = $ret['#finished'];
-    unset($ret['#finished']);
-  }
-
-  // Save the query and results for display by update_finished_page().
-  if (!isset($_SESSION['update_results'])) {
-    $_SESSION['update_results'] = array();
-  }
-  if (!isset($_SESSION['update_results'][$module])) {
-    $_SESSION['update_results'][$module] = array();
-  }
-  if (!isset($_SESSION['update_results'][$module][$number])) {
-    $_SESSION['update_results'][$module][$number] = array();
-  }
-  $_SESSION['update_results'][$module][$number] = array_merge($_SESSION['update_results'][$module][$number], $ret);
-
-  if ($finished == 1) {
-    // Update the installed version
-    drupal_set_installed_schema_version($module, $number);
-  }
-
-  return $finished;
-}
-
-function update_selection_page() {
-  $output = '<p>The version of Drupal you are updating from has been automatically detected. You can select a different version, but you should not need to.</p>';
-  $output .= '<p>Click Update to start the update process.</p>';
-
-  $form = array();
-  $form['start'] = array(
-    '#tree' => TRUE,
-    '#type' => 'fieldset',
-    '#title' => 'Select versions',
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-  );
-  foreach (module_list() as $module) {
-    $updates = drupal_get_schema_versions($module);
-    if ($updates !== FALSE) {
-      $updates = drupal_map_assoc($updates);
-      $updates[] = 'No updates available';
-
-      $form['start'][$module] = array(
-        '#type' => 'select',
-        '#title' => $module . ' module',
-        '#default_value' => array_search(drupal_get_installed_schema_version($module), $updates) + 1,
-        '#options' => $updates,
-      );
-    }
-  }
-
-  $form['has_js'] = array(
-    '#type' => 'hidden',
-    '#default_value' => FALSE,
-    '#attributes' => array('id' => 'edit-has_js'),
-  );
-  $form['submit'] = array(
-    '#type' => 'submit',
-    '#value' => 'Update',
-  );
-
-  drupal_set_title('Drupal database update');
-  // Prevent browser from using cached drupal.js or update.js
-  drupal_add_js('misc/update.js', TRUE);
-  $output .= drupal_get_form('update_script_selection_form', $form);
-
-  return $output;
-}
-
-function update_update_page() {
-  // Set the installed version so updates start at the correct place.
-  $_SESSION['update_remaining'] = array();
-  foreach ($_POST['edit']['start'] as $module => $version) {
-    drupal_set_installed_schema_version($module, $version - 1);
-    $max_version = max(drupal_get_schema_versions($module));
-    if ($version <= $max_version) {
-      foreach (range($version, $max_version) as $update) {
-        $_SESSION['update_remaining'][] = array('module' => $module, 'version' => $update);
-      }
-    }
-  }
-  // Keep track of total number of updates
-  $_SESSION['update_total'] = count($_SESSION['update_remaining']);
-
-  if ($_POST['edit']['has_js']) {
-    return update_progress_page();
-  }
-  else {
-    return update_progress_page_nojs();
-  }
-}
-
-function update_progress_page() {
-  // Prevent browser from using cached drupal.js or update.js
-  drupal_add_js('misc/progress.js', TRUE);
-  drupal_add_js('misc/update.js', TRUE);
-
-  drupal_set_title('Updating');
-  $output = '<div id="progress"></div>';
-  $output .= '<p id="wait">Please wait while your site is being updated.</p>';
-  return $output;
-}
-
-/**
- * Perform updates for one second or until finished.
- *
- * @return
- *   An array indicating the status after doing updates. The first element is
- *   the overall percentage finished. The second element is a status message.
- */
-function update_do_updates() {
-  while (($update = reset($_SESSION['update_remaining']))) {
-    $update_finished = update_data($update['module'], $update['version']);
-    if ($update_finished == 1) {
-      // Dequeue the completed update.
-      unset($_SESSION['update_remaining'][key($_SESSION['update_remaining'])]);
-      $update_finished = 0; // Make sure this step isn't counted double
-    }
-    if (timer_read('page') > 1000) {
-      break;
-    }
-  }
-
-  if ($_SESSION['update_total']) {
-    $percentage = floor(($_SESSION['update_total'] - count($_SESSION['update_remaining']) + $update_finished) / $_SESSION['update_total'] * 100);
-  }
-  else {
-    $percentage = 100;
-  }
-
-  // When no updates remain, clear the cache.
-  if (!isset($update['module'])) {
-    db_query('DELETE FROM {cache}');
-  }
-
-  return array($percentage, isset($update['module']) ? 'Updating '. $update['module'] .' module' : 'Updating complete');
-}
-
-/**
- * Perform updates for the JS version and return progress.
- */
-function update_do_update_page() {
-  global $conf;
-
-  // HTTP Post required
-  if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-    drupal_set_message('HTTP Post is required.', 'error');
-    drupal_set_title('Error');
-    return '';
-  }
-
-  // Error handling: if PHP dies, the output will fail to parse as JSON, and
-  // the Javascript will tell the user to continue to the op=error page.
-  list($percentage, $message) = update_do_updates();
-  print drupal_to_js(array('status' => TRUE, 'percentage' => $percentage, 'message' => $message));
-}
-
-/**
- * Perform updates for the non-JS version and return the status page.
- */
-function update_progress_page_nojs() {
-  drupal_set_title('Updating');
-
-  $new_op = 'do_update_nojs';
-  if ($_SERVER['REQUEST_METHOD'] == 'GET') {
-    // Error handling: if PHP dies, it will output whatever is in the output
-    // buffer, followed by the error message.
-    ob_start();
-    $fallback = '<p class="error">An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href="update.php?op=error">update summary</a>.</p><p class="error">';
-    print theme('maintenance_page', $fallback, FALSE, TRUE);
-
-    list($percentage, $message) = update_do_updates();
-    if ($percentage == 100) {
-      $new_op = 'finished';
-    }
-
-    // Updates successful; remove fallback
-    ob_end_clean();
-  }
-  else {
-    // This is the first page so return some output immediately.
-    $percentage = 0;
-    $message = 'Starting updates';
-  }
-
-  drupal_set_html_head('<meta http-equiv="Refresh" content="0; URL=update.php?op='. $new_op .'">');
-  $output = theme('progress_bar', $percentage, $message);
-  $output .= '<p>Updating your site will take a few seconds.</p>';
-
-  // Note: do not output drupal_set_message()s until the summary page.
-  print theme('maintenance_page', $output, FALSE);
-  return NULL;
-}
-
-function update_finished_page($success) {
-  drupal_set_title('Drupal database update');
-  // NOTE: we can't use l() here because the URL would point to 'update.php?q=admin'.
-  $links[] = '<a href="'. base_path() .'">main page</a>';
-  $links[] = '<a href="'. base_path() .'?q=admin">administration pages</a>';
-
-  // Report end result
-  if ($success) {
-    $output = '<p>Updates were attempted. If you see no failures below, you may proceed happily to the <a href="index.php?q=admin">administration pages</a>. Otherwise, you may need to update your database manually. All errors have been <a href="index.php?q=admin/logs">logged</a>.</p>';
-  }
-  else {
-    $update = reset($_SESSION['update_remaining']);
-    $output = '<p class="error">The update process was aborted prematurely while running <strong>update #'. $update['version'] .' in '. $update['module'] .'.module</strong>. All other errors have been <a href="index.php?q=admin/logs">logged</a>. You may need to check the <code>watchdog</code> database table manually.</p>';
-  }
-
-  if ($GLOBALS['access_check'] == FALSE) {
-    $output .= "<p><strong>Reminder: don't forget to set the <code>\$access_check</code> value at the top of <code>update.php</code> back to <code>TRUE</code>.</strong></p>";
-  }
-
-  $output .= theme('item_list', $links);
-
-  // Output a list of queries executed
-  if ($_SESSION['update_results']) {
-    $output .= '<div id="update-results">';
-    $output .= '<h2>The following queries were executed</h2>';
-    foreach ($_SESSION['update_results'] as $module => $updates) {
-      $output .= '<h3>'. $module .' module</h3>';
-      foreach ($updates as $number => $queries) {
-        $output .= '<h4>Update #'. $number .'</h4>';
-        $output .= '<ul>';
-        foreach ($queries as $query) {
-          if ($query['success']) {
-            $output .= '<li class="success">'. $query['query'] .'</li>';
-          }
-          else {
-            $output .= '<li class="failure"><strong>Failed:</strong> '. $query['query'] .'</li>';
-          }
-        }
-        if (!count($queries)) {
-          $output .= '<li class="none">No queries</li>';
-        }
-        $output .= '</ul>';
-      }
-    }
-    $output .= '</div>';
-    unset($_SESSION['update_results']);
-  }
-
-  return $output;
-}
-
-function update_info_page() {
-  drupal_set_title('Drupal database update');
-  $output = "<ol>\n";
-  $output .= "<li>Use this script to <strong>upgrade an existing Drupal installation</strong>. You don't need this script when installing Drupal from scratch.</li>";
-  $output .= "<li>Before doing anything, backup your database. This process will change your database and its values, and some things might get lost.</li>\n";
-  $output .= "<li>Update your Drupal sources, check the notes below and <a href=\"update.php?op=selection\">run the database upgrade script</a>. Don't upgrade your database twice as it may cause problems.</li>\n";
-  $output .= "<li>Go through the various administration pages to change the existing and new settings to your liking.</li>\n";
-  $output .= "</ol>";
-  $output .= '<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>';
-  return $output;
-}
-
-function update_access_denied_page() {
-  drupal_set_title('Access denied');
-  return '<p>Access denied. You are not authorized to access this page. Please log in as the admin user (the first user you created). If you cannot log in, you will have to edit <code>update.php</code> to bypass this access check. To do this:</p>
-<ol>
- <li>With a text editor find the update.php file on your system. It should be in the main Drupal directory that you installed all the files into.</li>
- <li>There is a line near top of update.php that says <code>$access_check = TRUE;</code>. Change it to <code>$access_check = FALSE;</code>.</li>
- <li>As soon as the script is done, you must change the update.php script back to its original form to <code>$access_check = TRUE;</code>.</li>
- <li>To avoid having this problem in future, remember to log in to your website as the admin user (the user you first created) before you backup your database at the beginning of the update process.</li>
-</ol>';
-}
-
-// This code may be removed later.  It is part of the Drupal 4.5 to 4.7 migration.
-function update_fix_system_table() {
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
-  $row = db_fetch_object(db_query_range('SELECT * FROM {system}', 0, 1));
-  if (!isset($row->weight)) {
-    $ret = array();
-    switch ($GLOBALS['db_type']) {
-      case 'pgsql':
-        db_add_column($ret, 'system', 'weight', 'smallint', array('not null' => TRUE, 'default' => 0));
-        $ret[] = update_sql('CREATE INDEX {system}_weight_idx ON {system} (weight)');
-        break;
-      case 'mysql':
-      case 'mysqli':
-        $ret[] = update_sql("ALTER TABLE {system} ADD weight tinyint(2) default '0' NOT NULL, ADD KEY (weight)");
-        break;
-    }
-  }
-}
-
-// This code may be removed later.  It is part of the Drupal 4.6 to 4.7 migration.
-function update_fix_access_table() {
-  if (variable_get('update_access_fixed', FALSE)) {
-    return;
-  }
-
-  switch ($GLOBALS['db_type']) {
-    // Only for MySQL 4.1+
-    case 'mysqli':
-      break;
-    case 'mysql':
-      if (version_compare(mysql_get_server_info($GLOBALS['active_db']), '4.1.0', '<')) {
-        return;
-      }
-      break;
-    case 'pgsql':
-      return;
-  }
-
-  // Convert access table to UTF-8 if needed.
-  $result = db_fetch_array(db_query('SHOW CREATE TABLE {access}'));
-  if (!preg_match('/utf8/i', array_pop($result))) {
-    update_convert_table_utf8('access');
-  }
-
-  // Don't run again
-  variable_set('update_access_fixed', TRUE);
-}
-
-/**
- * Convert a single MySQL table to UTF-8.
- *
- * We change all text columns to their corresponding binary type,
- * then back to text, but with a UTF-8 character set.
- * See: http://dev.mysql.com/doc/refman/4.1/en/charset-conversion.html
- */
-function update_convert_table_utf8($table) {
-  $ret = array();
-  $types = array('char' => 'binary',
-                 'varchar' => 'varbinary',
-                 'tinytext' => 'tinyblob',
-                 'text' => 'blob',
-                 'mediumtext' => 'mediumblob',
-                 'longtext' => 'longblob');
-
-  // Get next table in list
-  $convert_to_binary = array();
-  $convert_to_utf8 = array();
-
-  // Set table default charset
-  $ret[] = update_sql('ALTER TABLE {'. $table .'} DEFAULT CHARACTER SET utf8');
-
-  // Find out which columns need converting and build SQL statements
-  $result = db_query('SHOW FULL COLUMNS FROM {'. $table .'}');
-  while ($column = db_fetch_array($result)) {
-    list($type) = explode('(', $column['Type']);
-    if (isset($types[$type])) {
-      $names = 'CHANGE `'. $column['Field'] .'` `'. $column['Field'] .'` ';
-      $attributes = ' DEFAULT '. ($column['Default'] == 'NULL' ? 'NULL ' :
-                     "'". db_escape_string($column['Default']) ."' ") .
-                    ($column['Null'] == 'YES' ? 'NULL' : 'NOT NULL');
-
-      $convert_to_binary[] = $names . preg_replace('/'. $type .'/i', $types[$type], $column['Type']) . $attributes;
-      $convert_to_utf8[] = $names . $column['Type'] .' CHARACTER SET utf8'. $attributes;
-    }
-  }
-
-  if (count($convert_to_binary)) {
-    // Convert text columns to binary
-    $ret[] = update_sql('ALTER TABLE {'. $table .'} '. implode(', ', $convert_to_binary));
-    // Convert binary columns to UTF-8
-    $ret[] = update_sql('ALTER TABLE {'. $table .'} '. implode(', ', $convert_to_utf8));
-  }
-  return $ret;
-}
-
-// Some unavoidable errors happen because the database is not yet up-to-date.
-// Our custom error handler is not yet installed, so we just suppress them.
-ini_set('display_errors', FALSE);
-
-include_once './includes/bootstrap.inc';
-update_fix_system_table();
-update_fix_access_table();
-
-drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-drupal_maintenance_theme();
-
-// Turn error reporting back on. From now on, only fatal errors (which are
-// not passed through the error handler) will cause a message to be printed.
-ini_set('display_errors', TRUE);
-
-// Access check:
-if (($access_check == FALSE) || ($user->uid == 1)) {
-
-  include_once './includes/install.inc';
-
-  update_fix_schema_version();
-  update_fix_watchdog_115();
-  update_fix_watchdog();
-  update_fix_sessions();
-
-  $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
-  switch ($op) {
-    case 'Update':
-      $output = update_update_page();
-      break;
-
-    case 'finished':
-      $output = update_finished_page(true);
-      break;
-
-    case 'error':
-      $output = update_finished_page(false);
-      break;
-
-    case 'do_update':
-      $output = update_do_update_page();
-      break;
-
-    case 'do_update_nojs':
-      $output = update_progress_page_nojs();
-      break;
-
-    case 'selection':
-      $output = update_selection_page();
-      break;
-
-    default:
-      $output = update_info_page();
-      break;
-  }
-}
-else {
-  $output = update_access_denied_page();
-}
-
-if (isset($output)) {
-  print theme('maintenance_page', $output);
-}
diff --git a/xmlrpc.php b/xmlrpc.php
deleted file mode 100644 (file)
index 3fca0b7..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-// $Id: xmlrpc.php 144 2007-03-28 07:52:20Z thierry $
-
-/**
- * @file
- * PHP page for handling incoming XML-RPC requests from clients.
- */
-
-include_once './includes/bootstrap.inc';
-drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-include_once './includes/xmlrpc.inc';
-include_once './includes/xmlrpcs.inc';
-
-xmlrpc_server(module_invoke_all('xmlrpc'));