diff options
Diffstat (limited to 'modules')
57 files changed, 752 insertions, 1210 deletions
diff --git a/modules/admin.module b/modules/admin.module index 1eddba355..32a4bd704 100644 --- a/modules/admin.module +++ b/modules/admin.module @@ -13,7 +13,7 @@ function admin_help($section) { $output = ""; switch ($section) { - case "admin/system/modules": + case "admin/system/modules#description": $output .= t("Handles the administration pages."); break; case "admin": @@ -26,15 +26,6 @@ function admin_help($section) { return $output; } -function admin_system($field){ - $output = ""; - if ($field == "description") { - $output = admin_help("admin/system/modules"); - } - - return $output; -} - function admin_link($type) { if ($type == "system" && user_access("access administration pages")) { menu("admin", t("administer"), NULL, NULL, 9); diff --git a/modules/aggregator.module b/modules/aggregator.module index 8d47d238f..956e266bf 100644 --- a/modules/aggregator.module +++ b/modules/aggregator.module @@ -51,32 +51,22 @@ function import_help($section = "admin/import/help") { $output .= "</ul>"; $output .= "<h3>RSS feed blocks</h3>"; $output .= "<p>In addition to providing subscribed content through the news aggregator, Drupal automatically creates a block for each subscribed feed and every bundle created. Beside each headline in each block, Drupal includes an icon which acts a blog it link. Enable any or all of the blocks using block management.</p>"; - $output = t($output, array( - "%amphetadesk" => "<a href=\"http://www.disobey.com/amphetadesk/\">AmphetaDesk</a>", - "%rss" => "<a href=\"http://groups.yahoo.com/group/rss-dev/files/specification.html\">Rich Site Summary</a>", - "%slashdot-rss" => "<a href=\"http://slashdot.org/slashdot.rdf\">http://slashdot.org/slashdot.rfd</a>", - "%syndic8" => "<a href=\"http://www.syndic8.com/\">Syndic8</a>", - "%rss-what" => "<a href=\"http://www.xml.com/pub/a/2002/12/18/dive-into-xml.html\">What is RSS</a>", - "%rss-evolution" => "<a href=\"http://www.webreference.com/authoring/languages/xml/rss/1/\">The Evolution of RSS</a>", - "%admin-news" => l(t("RSS/RDF"), "admin/node/syndication/news"), - "%new-feed" => l(t("new feed"), "admin/node/syndication/news/add/feed"), - "%update-items" => l(t("update items"), "admin/node/syndication/news"), - )); + $output = t($output, array("%amphetadesk" => "<a href=\"http://www.disobey.com/amphetadesk/\">AmphetaDesk</a>", "%rss" => "<a href=\"http://groups.yahoo.com/group/rss-dev/files/specification.html\">Rich Site Summary</a>", "%slashdot-rss" => "<a href=\"http://slashdot.org/slashdot.rdf\">http://slashdot.org/slashdot.rfd</a>", "%syndic8" => "<a href=\"http://www.syndic8.com/\">Syndic8</a>", "%rss-what" => "<a href=\"http://www.xml.com/pub/a/2002/12/18/dive-into-xml.html\">What is RSS</a>", "%rss-evolution" => "<a href=\"http://www.webreference.com/authoring/languages/xml/rss/1/\">The Evolution of RSS</a>", "%admin-news" => l(t("RSS/RDF"), "admin/node/syndication/news"), "%new-feed" => l(t("new feed"), "admin/node/syndication/news/add/feed"), "%update-items" => l(t("update items"), "admin/node/syndication/news"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Used to aggregate syndicated content (RSS and RDF)."); break; case 'admin/system/modules/import': $output = t("Drupal's news aggregator controls how many RSS/RDF items from a single source are displayed in a \"Block\", and on the page that goes with that block."); break; case 'admin/node/syndication/news': - $output = t("Several web sites, especially news related sites, syndicate parts of their site's content for other web sites to display. Usually, the syndicated content includes the latest headlines with a direct link to that story on the remote site. Some syndicated content also includes a description of the headline. The standard method of syndication is using the XML based Rich Site Summary (RSS). To get a feed to work you <b>must</b> run \"cron.php\". To display the feed in a block you must turn on the %block. <br /><ul><li>To delete a feed choose \"edit feed\"</li><li>To clear all of the entries from a feed choose \"Remove items\"</li><li>To check whether a feed is working, and to get new items <b>now</b> click on \"update items\"</li></ul><ul><li>To delete a bundle choose \"edit bundle\".</li></ul>", array("%block" => l(t("feed's block"), "admin/system/block") )); + $output = t("Several web sites, especially news related sites, syndicate parts of their site's content for other web sites to display. Usually, the syndicated content includes the latest headlines with a direct link to that story on the remote site. Some syndicated content also includes a description of the headline. The standard method of syndication is using the XML based Rich Site Summary (RSS). To get a feed to work you <b>must</b> run \"cron.php\". To display the feed in a block you must turn on the %block. <br /><ul><li>To delete a feed choose \"edit feed\"</li><li>To clear all of the entries from a feed choose \"Remove items\"</li><li>To check whether a feed is working, and to get new items <b>now</b> click on \"update items\"</li></ul><ul><li>To delete a bundle choose \"edit bundle\".</li></ul>", array("%block" => l(t("feed's block"), "admin/system/block"))); break; case 'admin/node/syndication/news/add/feed': - $output = t("Add a site that has an RSS/RDF feed. The URL is the full path to the RSS feed file. For the feed to update automatically you must run \"cron.php\". The \"Attributes\" are used to bundle this feed with other feeds (See %bundle), and to tag articles from this feed.<br />Note: 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.", array("%bundle" => l(t("add new bundle"), "admin/node/syndication/news/add/bundle") )); + $output = t("Add a site that has an RSS/RDF feed. The URL is the full path to the RSS feed file. For the feed to update automatically you must run \"cron.php\". The \"Attributes\" are used to bundle this feed with other feeds (See %bundle), and to tag articles from this feed.<br />Note: 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.", array("%bundle" => l(t("add new bundle"), "admin/node/syndication/news/add/bundle"))); break; case 'admin/node/syndication/news/add/bundle': - $output = t("Bundles provide a generalized way of creating composite feeds. They allow you, for example, to combine various sport-related feeds into one bundle called <i>Sport</i>. If an article from a feed has been \"tag\"-ged (See %tag too look at and change tags.) with a matching \"Attribute\" then it will be added to the bundle.", array("%tag" => l(t("tag news item"), "admin/node/syndication/news/tag") )); + $output = t("Bundles provide a generalized way of creating composite feeds. They allow you, for example, to combine various sport-related feeds into one bundle called <i>Sport</i>. If an article from a feed has been \"tag\"-ged (See %tag too look at and change tags.) with a matching \"Attribute\" then it will be added to the bundle.", array("%tag" => l(t("tag news item"), "admin/node/syndication/news/tag"))); break; case 'admin/node/syndication/news/tag': $output = t("This allows you to see and change an news item's \"tag\". All articles are originally tagged with the \"Attributes\" of their feed."); @@ -86,15 +76,6 @@ function import_help($section = "admin/import/help") { return $output; } -function import_system($field){ - $output = ""; - - $system["description"] = import_help("admin/system/modules"); - $system["admin_help"] = import_help("admin/system/modules/import"); - - return $system[$field]; -} - function import_settings() { $number = array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 45 => 45, 50 => 50, 55 => 55, 60 => 60, 65 => 65, 70 => 70, 75 => 75, 80 => 80, 85 => 85, 90 => 90, 95 => 95, 100 => 100); $output .= form_select(t("Items per block"), "import_block_limit", variable_get("import_block_limit", 15), $number, t("The maximum number of news items displayed in one block.")); @@ -119,7 +100,7 @@ function import_link($type) { if (user_access("administer news feeds")) { menu("admin/node/syndication", t("syndication"), NULL, NULL, 5); - menu("admin/node/syndication/news", t("RSS/RDF"), "import_admin", import_help("admin/node/syndication/news") ); + menu("admin/node/syndication/news", t("RSS/RDF"), "import_admin", import_help("admin/node/syndication/news")); menu("admin/node/syndication/news/add/feed", t("new feed"), "import_admin", import_help("admin/node/syndication/news/add/feed"), 2); menu("admin/node/syndication/news/add/bundle", t("new bundle"), "import_admin", import_help("admin/node/syndication/news/add/bundle"), 3); menu("admin/node/syndication/news/tag", t("tag items"), "import_admin", import_help("admin/node/syndication/news/tag"), 4); @@ -535,7 +516,7 @@ function import_get_bundle($bid) { function import_view() { $result = db_query("SELECT f.*, COUNT(i.iid) AS items FROM {feed} f LEFT JOIN {item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.timestamp, f.attributes, f.link, f.description ORDER BY f.title"); - $output .= "<h3>". t("Feed overview"). "</h3>"; + $output .= "<h3>". t("Feed overview") ."</h3>"; $header = array(t("title"), t("attributes"), t("items"), t("last update"), t("next update"), array("data" => t("operations"), "colspan" => 3)); unset($rows); @@ -546,7 +527,7 @@ function import_view() { $result = db_query("SELECT * FROM {bundle} ORDER BY title"); - $output .= "<h3>". t("Bundle overview"). "</h3>"; + $output .= "<h3>". t("Bundle overview") ."</h3>"; $header = array(t("title"), t("attributes"), t("operations")); unset($rows); @@ -568,7 +549,7 @@ function import_tag() { } $output .= table($header, $rows); - $output .= "<input type=\"submit\" name=\"op\" value=\"" . t("Save attributes") . "\" />\n"; + $output .= "<input type=\"submit\" name=\"op\" value=\"". t("Save attributes") ."\" />\n"; return form($output); } @@ -768,7 +749,7 @@ function import_page_sources() { $output .= "<div style=\"margin-left: 20px;\">$feed->description</div><br />"; } - $output .= "<div style=\"text-align: right\">" . l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) . "</div><br />"; + $output .= "<div style=\"text-align: right\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />"; theme("header"); theme("box", t("News feeds"), import_page_info()); diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 8d47d238f..956e266bf 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -51,32 +51,22 @@ function import_help($section = "admin/import/help") { $output .= "</ul>"; $output .= "<h3>RSS feed blocks</h3>"; $output .= "<p>In addition to providing subscribed content through the news aggregator, Drupal automatically creates a block for each subscribed feed and every bundle created. Beside each headline in each block, Drupal includes an icon which acts a blog it link. Enable any or all of the blocks using block management.</p>"; - $output = t($output, array( - "%amphetadesk" => "<a href=\"http://www.disobey.com/amphetadesk/\">AmphetaDesk</a>", - "%rss" => "<a href=\"http://groups.yahoo.com/group/rss-dev/files/specification.html\">Rich Site Summary</a>", - "%slashdot-rss" => "<a href=\"http://slashdot.org/slashdot.rdf\">http://slashdot.org/slashdot.rfd</a>", - "%syndic8" => "<a href=\"http://www.syndic8.com/\">Syndic8</a>", - "%rss-what" => "<a href=\"http://www.xml.com/pub/a/2002/12/18/dive-into-xml.html\">What is RSS</a>", - "%rss-evolution" => "<a href=\"http://www.webreference.com/authoring/languages/xml/rss/1/\">The Evolution of RSS</a>", - "%admin-news" => l(t("RSS/RDF"), "admin/node/syndication/news"), - "%new-feed" => l(t("new feed"), "admin/node/syndication/news/add/feed"), - "%update-items" => l(t("update items"), "admin/node/syndication/news"), - )); + $output = t($output, array("%amphetadesk" => "<a href=\"http://www.disobey.com/amphetadesk/\">AmphetaDesk</a>", "%rss" => "<a href=\"http://groups.yahoo.com/group/rss-dev/files/specification.html\">Rich Site Summary</a>", "%slashdot-rss" => "<a href=\"http://slashdot.org/slashdot.rdf\">http://slashdot.org/slashdot.rfd</a>", "%syndic8" => "<a href=\"http://www.syndic8.com/\">Syndic8</a>", "%rss-what" => "<a href=\"http://www.xml.com/pub/a/2002/12/18/dive-into-xml.html\">What is RSS</a>", "%rss-evolution" => "<a href=\"http://www.webreference.com/authoring/languages/xml/rss/1/\">The Evolution of RSS</a>", "%admin-news" => l(t("RSS/RDF"), "admin/node/syndication/news"), "%new-feed" => l(t("new feed"), "admin/node/syndication/news/add/feed"), "%update-items" => l(t("update items"), "admin/node/syndication/news"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Used to aggregate syndicated content (RSS and RDF)."); break; case 'admin/system/modules/import': $output = t("Drupal's news aggregator controls how many RSS/RDF items from a single source are displayed in a \"Block\", and on the page that goes with that block."); break; case 'admin/node/syndication/news': - $output = t("Several web sites, especially news related sites, syndicate parts of their site's content for other web sites to display. Usually, the syndicated content includes the latest headlines with a direct link to that story on the remote site. Some syndicated content also includes a description of the headline. The standard method of syndication is using the XML based Rich Site Summary (RSS). To get a feed to work you <b>must</b> run \"cron.php\". To display the feed in a block you must turn on the %block. <br /><ul><li>To delete a feed choose \"edit feed\"</li><li>To clear all of the entries from a feed choose \"Remove items\"</li><li>To check whether a feed is working, and to get new items <b>now</b> click on \"update items\"</li></ul><ul><li>To delete a bundle choose \"edit bundle\".</li></ul>", array("%block" => l(t("feed's block"), "admin/system/block") )); + $output = t("Several web sites, especially news related sites, syndicate parts of their site's content for other web sites to display. Usually, the syndicated content includes the latest headlines with a direct link to that story on the remote site. Some syndicated content also includes a description of the headline. The standard method of syndication is using the XML based Rich Site Summary (RSS). To get a feed to work you <b>must</b> run \"cron.php\". To display the feed in a block you must turn on the %block. <br /><ul><li>To delete a feed choose \"edit feed\"</li><li>To clear all of the entries from a feed choose \"Remove items\"</li><li>To check whether a feed is working, and to get new items <b>now</b> click on \"update items\"</li></ul><ul><li>To delete a bundle choose \"edit bundle\".</li></ul>", array("%block" => l(t("feed's block"), "admin/system/block"))); break; case 'admin/node/syndication/news/add/feed': - $output = t("Add a site that has an RSS/RDF feed. The URL is the full path to the RSS feed file. For the feed to update automatically you must run \"cron.php\". The \"Attributes\" are used to bundle this feed with other feeds (See %bundle), and to tag articles from this feed.<br />Note: 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.", array("%bundle" => l(t("add new bundle"), "admin/node/syndication/news/add/bundle") )); + $output = t("Add a site that has an RSS/RDF feed. The URL is the full path to the RSS feed file. For the feed to update automatically you must run \"cron.php\". The \"Attributes\" are used to bundle this feed with other feeds (See %bundle), and to tag articles from this feed.<br />Note: 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.", array("%bundle" => l(t("add new bundle"), "admin/node/syndication/news/add/bundle"))); break; case 'admin/node/syndication/news/add/bundle': - $output = t("Bundles provide a generalized way of creating composite feeds. They allow you, for example, to combine various sport-related feeds into one bundle called <i>Sport</i>. If an article from a feed has been \"tag\"-ged (See %tag too look at and change tags.) with a matching \"Attribute\" then it will be added to the bundle.", array("%tag" => l(t("tag news item"), "admin/node/syndication/news/tag") )); + $output = t("Bundles provide a generalized way of creating composite feeds. They allow you, for example, to combine various sport-related feeds into one bundle called <i>Sport</i>. If an article from a feed has been \"tag\"-ged (See %tag too look at and change tags.) with a matching \"Attribute\" then it will be added to the bundle.", array("%tag" => l(t("tag news item"), "admin/node/syndication/news/tag"))); break; case 'admin/node/syndication/news/tag': $output = t("This allows you to see and change an news item's \"tag\". All articles are originally tagged with the \"Attributes\" of their feed."); @@ -86,15 +76,6 @@ function import_help($section = "admin/import/help") { return $output; } -function import_system($field){ - $output = ""; - - $system["description"] = import_help("admin/system/modules"); - $system["admin_help"] = import_help("admin/system/modules/import"); - - return $system[$field]; -} - function import_settings() { $number = array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 45 => 45, 50 => 50, 55 => 55, 60 => 60, 65 => 65, 70 => 70, 75 => 75, 80 => 80, 85 => 85, 90 => 90, 95 => 95, 100 => 100); $output .= form_select(t("Items per block"), "import_block_limit", variable_get("import_block_limit", 15), $number, t("The maximum number of news items displayed in one block.")); @@ -119,7 +100,7 @@ function import_link($type) { if (user_access("administer news feeds")) { menu("admin/node/syndication", t("syndication"), NULL, NULL, 5); - menu("admin/node/syndication/news", t("RSS/RDF"), "import_admin", import_help("admin/node/syndication/news") ); + menu("admin/node/syndication/news", t("RSS/RDF"), "import_admin", import_help("admin/node/syndication/news")); menu("admin/node/syndication/news/add/feed", t("new feed"), "import_admin", import_help("admin/node/syndication/news/add/feed"), 2); menu("admin/node/syndication/news/add/bundle", t("new bundle"), "import_admin", import_help("admin/node/syndication/news/add/bundle"), 3); menu("admin/node/syndication/news/tag", t("tag items"), "import_admin", import_help("admin/node/syndication/news/tag"), 4); @@ -535,7 +516,7 @@ function import_get_bundle($bid) { function import_view() { $result = db_query("SELECT f.*, COUNT(i.iid) AS items FROM {feed} f LEFT JOIN {item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.timestamp, f.attributes, f.link, f.description ORDER BY f.title"); - $output .= "<h3>". t("Feed overview"). "</h3>"; + $output .= "<h3>". t("Feed overview") ."</h3>"; $header = array(t("title"), t("attributes"), t("items"), t("last update"), t("next update"), array("data" => t("operations"), "colspan" => 3)); unset($rows); @@ -546,7 +527,7 @@ function import_view() { $result = db_query("SELECT * FROM {bundle} ORDER BY title"); - $output .= "<h3>". t("Bundle overview"). "</h3>"; + $output .= "<h3>". t("Bundle overview") ."</h3>"; $header = array(t("title"), t("attributes"), t("operations")); unset($rows); @@ -568,7 +549,7 @@ function import_tag() { } $output .= table($header, $rows); - $output .= "<input type=\"submit\" name=\"op\" value=\"" . t("Save attributes") . "\" />\n"; + $output .= "<input type=\"submit\" name=\"op\" value=\"". t("Save attributes") ."\" />\n"; return form($output); } @@ -768,7 +749,7 @@ function import_page_sources() { $output .= "<div style=\"margin-left: 20px;\">$feed->description</div><br />"; } - $output .= "<div style=\"text-align: right\">" . l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) . "</div><br />"; + $output .= "<div style=\"text-align: right\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />"; theme("header"); theme("box", t("News feeds"), import_page_info()); diff --git a/modules/archive.module b/modules/archive.module index e9ce7e0fe..49130bdbf 100644 --- a/modules/archive.module +++ b/modules/archive.module @@ -5,7 +5,7 @@ function archive_help($section) { $output = ""; switch ($section) { - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Displays a calendar to navigate old content."); break; case 'admin/system/modules/archive': @@ -15,14 +15,6 @@ function archive_help($section) { return $output; } -function archive_system($field){ - $output = ""; - - if ($field == "description") { $output = archive_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = archive_help("admin/system/modules/archive"); }; - - return $output; -} function archive_calendar($original = 0) { global $user; @@ -64,7 +56,7 @@ function archive_calendar($original = 0) { // Extract last day of the month: $last = date("t", $start_of_month); - $end_of_month = mktime(23,59,59, $month, $last, $year); + $end_of_month = mktime(23, 59, 59, $month, $last, $year); $cache = cache_get("archive:calendar:$start_of_month"); @@ -97,7 +89,7 @@ function archive_calendar($original = 0) { $weekstart = variable_get("default_firstday", 0); // Last day of week - ($weekstart - 1 == -1 ) ? $lastday = 6 : $lastday = $weekstart - 1; + ($weekstart - 1 == -1) ? $lastday = 6 : $lastday = $weekstart - 1; // Generate the days of the week: $firstcolumn = mktime(0, 0, 0, 3, 20 + $weekstart, 1994); diff --git a/modules/archive/archive.module b/modules/archive/archive.module index e9ce7e0fe..49130bdbf 100644 --- a/modules/archive/archive.module +++ b/modules/archive/archive.module @@ -5,7 +5,7 @@ function archive_help($section) { $output = ""; switch ($section) { - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Displays a calendar to navigate old content."); break; case 'admin/system/modules/archive': @@ -15,14 +15,6 @@ function archive_help($section) { return $output; } -function archive_system($field){ - $output = ""; - - if ($field == "description") { $output = archive_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = archive_help("admin/system/modules/archive"); }; - - return $output; -} function archive_calendar($original = 0) { global $user; @@ -64,7 +56,7 @@ function archive_calendar($original = 0) { // Extract last day of the month: $last = date("t", $start_of_month); - $end_of_month = mktime(23,59,59, $month, $last, $year); + $end_of_month = mktime(23, 59, 59, $month, $last, $year); $cache = cache_get("archive:calendar:$start_of_month"); @@ -97,7 +89,7 @@ function archive_calendar($original = 0) { $weekstart = variable_get("default_firstday", 0); // Last day of week - ($weekstart - 1 == -1 ) ? $lastday = 6 : $lastday = $weekstart - 1; + ($weekstart - 1 == -1) ? $lastday = 6 : $lastday = $weekstart - 1; // Generate the days of the week: $firstcolumn = mktime(0, 0, 0, 3, 20 + $weekstart, 1994); diff --git a/modules/block.module b/modules/block.module index ce0a02209..40c26c036 100644 --- a/modules/block.module +++ b/modules/block.module @@ -36,7 +36,7 @@ function block_help($section = "admin/block/help") { $output .= "<p>For more in-depth examples, we recommend that you check the existing boxes and use them as a starting point.</p>"; $output = t($output, array("%pcre" => "<a href=\"http://php.net/pcre/\">". t("Perl-Compatible Regular Expressions (PCRE)") ."</a>")); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Controls the boxes that are displayed around the main content."); break; case 'admin/system/block': @@ -53,14 +53,6 @@ function block_help($section = "admin/block/help") { return $output; } -function block_system($field){ - $output = ""; - - if ($field == "description") { $output = block_help("admin/system/modules"); } - - return $output; -} - function block_perm() { return array("administer blocks"); } @@ -337,7 +329,7 @@ function block_user($type, &$edit, &$user) { while ($block = db_fetch_object($result)) { $data = module_invoke($block->module, "block", "list"); if ($data[$block->delta]["info"]) { - $form .= "<tr><td>".$data[$block->delta]["info"]."</td><td>". form_checkbox(NULL, "block][$block->module][$block->delta", 1, $user->block[$block->module][$block->delta]) ."</td></tr>\n"; + $form .= "<tr><td>". $data[$block->delta]["info"] ."</td><td>". form_checkbox(NULL, "block][$block->module][$block->delta", 1, $user->block[$block->module][$block->delta]) ."</td></tr>\n"; } } diff --git a/modules/block/block.module b/modules/block/block.module index ce0a02209..40c26c036 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -36,7 +36,7 @@ function block_help($section = "admin/block/help") { $output .= "<p>For more in-depth examples, we recommend that you check the existing boxes and use them as a starting point.</p>"; $output = t($output, array("%pcre" => "<a href=\"http://php.net/pcre/\">". t("Perl-Compatible Regular Expressions (PCRE)") ."</a>")); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Controls the boxes that are displayed around the main content."); break; case 'admin/system/block': @@ -53,14 +53,6 @@ function block_help($section = "admin/block/help") { return $output; } -function block_system($field){ - $output = ""; - - if ($field == "description") { $output = block_help("admin/system/modules"); } - - return $output; -} - function block_perm() { return array("administer blocks"); } @@ -337,7 +329,7 @@ function block_user($type, &$edit, &$user) { while ($block = db_fetch_object($result)) { $data = module_invoke($block->module, "block", "list"); if ($data[$block->delta]["info"]) { - $form .= "<tr><td>".$data[$block->delta]["info"]."</td><td>". form_checkbox(NULL, "block][$block->module][$block->delta", 1, $user->block[$block->module][$block->delta]) ."</td></tr>\n"; + $form .= "<tr><td>". $data[$block->delta]["info"] ."</td><td>". form_checkbox(NULL, "block][$block->module][$block->delta", 1, $user->block[$block->module][$block->delta]) ."</td></tr>\n"; } } diff --git a/modules/blog.module b/modules/blog.module index b75f3654c..ba27e1f41 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -1,15 +1,6 @@ <?php // $Id$ -function blog_system($field){ - $output = ""; - - if ($field == "description") { $output = blog_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = blog_help("admin/system/modules/blog"); }; - - return $output; -} - function blog_settings() { $output = form_textarea(t("Explanation or submission guidelines"), "blog_help", variable_get("blog_help", ""), 70, 4, t("This text is displayed at the top of the blog submission form. It's useful for helping or instructing your users.")); $words = t("words"); @@ -84,9 +75,9 @@ function blog_help($section) { $output .= "<p>Blogs are made up of individual entries (nodes) that are timestamped and are typically viewed by day as you would a diary. Blogs often contain links to things you've seen and/or agree/disagree with. A typical example of a long term blog can be seen at %scripting-com.</p>"; $output .= "<p>The blog module adds a \"user blogs\" 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. Personal user menus gain a \"create a blog entry\" link (which takes you to a submission form) and a \"view personal blog\" link (which displays your blog entries as other people will see them). On the bottom of each of your own blog entries, there is an \"edit this blog entry\" link that lets you edit or delete that entry.</p>"; $output .= "<p>If a user has the ability to post blogs, then the import module (news aggregator) will display a blog-it link <b>(b)</b> next to each news item in its lists. Click on this and you will be taken 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 you to add your explanation. This actively encourages people to add blog entries about things they see and hear elsewhere in the Drupal site and from your syndicated partner sites.</p>"; - $output = t($output,array("%scripting-com" => "<a href=\"http://www.scripting.com/\">http://www.scripting.com/</a>" )); + $output = t($output, array("%scripting-com" => "<a href=\"http://www.scripting.com/\">http://www.scripting.com/</a>" )); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output .= t("Enables keeping a blog or easily and regularly updated web page."); break; case 'admin/system/modules/blog': @@ -108,7 +99,7 @@ function blog_feed_user($uid = 0) { } $result = db_query_range("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = %d AND n.status = 1 ORDER BY n.nid DESC", $uid, 0, 15); - $channel["title"] = $account->name. "'s blog"; + $channel["title"] = $account->name ."'s blog"; $channel["link"] = url("blog/view/$uid"); $channel["description"] = $term->description; node_feed($result, $channel); @@ -136,7 +127,7 @@ function blog_page_user($uid) { node_view(node_load(array("nid" => $node->nid)), 1); } print pager_display(NULL, variable_get("default_nodes_main", 10)); - print "<div style=\"text-align: right\">" . l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed/$account->uid", array("title" => t("View the XML version of %username's blog", array ("%username" => $account->name)))) . "</div>"; + print "<div style=\"text-align: right\">" . l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed/$account->uid", array("title" => t("View the XML version of %username's blog", array("%username" => $account->name)))) . "</div>"; } function blog_page_last() { @@ -247,7 +238,7 @@ function blog_view($node, $main = 0) { $breadcrumb[] = l(t("Home"), NULL); $breadcrumb[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid"); // print the breadcrumb - theme("breadcrumb",$breadcrumb); + theme("breadcrumb", $breadcrumb); } // prepair the node content $node = blog_content($node); @@ -265,7 +256,7 @@ function blog_link($type, $node = 0, $main) { menu("node/add/blog", t("blog entry"), "blog_page", NULL, 0); } if (user_access("maintain personal blog")) { - menu("blog/" . $user->uid,t("my blog"), "user_page", NULL, 1); + menu("blog/" . $user->uid, t("my blog"), "user_page", NULL, 1); } } diff --git a/modules/blog/blog.module b/modules/blog/blog.module index b75f3654c..ba27e1f41 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -1,15 +1,6 @@ <?php // $Id$ -function blog_system($field){ - $output = ""; - - if ($field == "description") { $output = blog_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = blog_help("admin/system/modules/blog"); }; - - return $output; -} - function blog_settings() { $output = form_textarea(t("Explanation or submission guidelines"), "blog_help", variable_get("blog_help", ""), 70, 4, t("This text is displayed at the top of the blog submission form. It's useful for helping or instructing your users.")); $words = t("words"); @@ -84,9 +75,9 @@ function blog_help($section) { $output .= "<p>Blogs are made up of individual entries (nodes) that are timestamped and are typically viewed by day as you would a diary. Blogs often contain links to things you've seen and/or agree/disagree with. A typical example of a long term blog can be seen at %scripting-com.</p>"; $output .= "<p>The blog module adds a \"user blogs\" 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. Personal user menus gain a \"create a blog entry\" link (which takes you to a submission form) and a \"view personal blog\" link (which displays your blog entries as other people will see them). On the bottom of each of your own blog entries, there is an \"edit this blog entry\" link that lets you edit or delete that entry.</p>"; $output .= "<p>If a user has the ability to post blogs, then the import module (news aggregator) will display a blog-it link <b>(b)</b> next to each news item in its lists. Click on this and you will be taken 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 you to add your explanation. This actively encourages people to add blog entries about things they see and hear elsewhere in the Drupal site and from your syndicated partner sites.</p>"; - $output = t($output,array("%scripting-com" => "<a href=\"http://www.scripting.com/\">http://www.scripting.com/</a>" )); + $output = t($output, array("%scripting-com" => "<a href=\"http://www.scripting.com/\">http://www.scripting.com/</a>" )); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output .= t("Enables keeping a blog or easily and regularly updated web page."); break; case 'admin/system/modules/blog': @@ -108,7 +99,7 @@ function blog_feed_user($uid = 0) { } $result = db_query_range("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = %d AND n.status = 1 ORDER BY n.nid DESC", $uid, 0, 15); - $channel["title"] = $account->name. "'s blog"; + $channel["title"] = $account->name ."'s blog"; $channel["link"] = url("blog/view/$uid"); $channel["description"] = $term->description; node_feed($result, $channel); @@ -136,7 +127,7 @@ function blog_page_user($uid) { node_view(node_load(array("nid" => $node->nid)), 1); } print pager_display(NULL, variable_get("default_nodes_main", 10)); - print "<div style=\"text-align: right\">" . l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed/$account->uid", array("title" => t("View the XML version of %username's blog", array ("%username" => $account->name)))) . "</div>"; + print "<div style=\"text-align: right\">" . l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed/$account->uid", array("title" => t("View the XML version of %username's blog", array("%username" => $account->name)))) . "</div>"; } function blog_page_last() { @@ -247,7 +238,7 @@ function blog_view($node, $main = 0) { $breadcrumb[] = l(t("Home"), NULL); $breadcrumb[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid"); // print the breadcrumb - theme("breadcrumb",$breadcrumb); + theme("breadcrumb", $breadcrumb); } // prepair the node content $node = blog_content($node); @@ -265,7 +256,7 @@ function blog_link($type, $node = 0, $main) { menu("node/add/blog", t("blog entry"), "blog_page", NULL, 0); } if (user_access("maintain personal blog")) { - menu("blog/" . $user->uid,t("my blog"), "user_page", NULL, 1); + menu("blog/" . $user->uid, t("my blog"), "user_page", NULL, 1); } } diff --git a/modules/bloggerapi.module b/modules/bloggerapi.module index ff4c21fec..acd080677 100644 --- a/modules/bloggerapi.module +++ b/modules/bloggerapi.module @@ -154,7 +154,7 @@ function bloggerapi_driver($method, $params = 0, $error = 0) { case "editPost": $node = node_load(array("nid" => $cparams[1])); if ($node->uid == $user->uid) { - return array("nid" => $cparams[1], "type" => "blog", "name" => $user->name, "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0); + return array("nid" => $cparams[1], "uid" => $user->uid, "type" => "blog", "name" => $user->name, "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0); } else { return bloggerapi_error("Error updating node"); @@ -190,7 +190,7 @@ function bloggerapi_user_blogs() { global $user; if ($user->uid) { - $struct = new xmlrpcval(array("url" => new xmlrpcval(url("blog/$user->uid")), "blogid" => new xmlrpcval($user->uid), "blogName" => new xmlrpcval($user->name . "'s blog at ". variable_get("site_name", "drupal"))),"struct"); + $struct = new xmlrpcval(array("url" => new xmlrpcval(url("blog/$user->uid")), "blogid" => new xmlrpcval($user->uid), "blogName" => new xmlrpcval($user->name . "'s blog at ". variable_get("site_name", "drupal"))), "struct"); return new xmlrpcval(array($struct), "array"); } else { @@ -218,13 +218,13 @@ function bloggerapi_user_info() { function bloggerapi_node_load($nid) { global $user; - $blog = node_load(array("nid" => $nid)); + $blog = node_load(array("nid" => $nid, "type" => "blog")); if ($blog->uid == $user->uid) { $body = "<title>$blog->title</title>\n". $blog->body; return new xmlrpcval(array("userid" => new xmlrpcval($user->name, "string"), - "dateCreated" => new xmlrpcval(iso8601_encode($blog->timestamp),"dateTime.iso8601"), - "content" => new xmlrpcval($body,"string"), - "postid" => new xmlrpcval($blog->nid,"string") + "dateCreated" => new xmlrpcval(iso8601_encode($blog->timestamp), "dateTime.iso8601"), + "content" => new xmlrpcval($body, "string"), + "postid" => new xmlrpcval($blog->nid, "string") ), "struct"); } else { @@ -236,14 +236,14 @@ function bloggerapi_node_recent($num) { global $user; if (($num == 0) or ($num > 100)) $num = 50; - $result = db_query_range("SELECT n.*, u.name FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.uid = %d ORDER BY n.nid DESC", $user->uid, 0, $num); + $result = db_query_range("SELECT n.*, u.name FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND n.uid = %d ORDER BY n.nid DESC", $user->uid, 0, $num); if ($result) { while ($blog = db_fetch_object($result)) { $body = "<title>$blog->title</title>\n". $blog->body; - $blogs[] = new xmlrpcval(array("userid" => new xmlrpcval($blog->name,"string"), - "dateCreated" => new xmlrpcval(iso8601_encode($blog->created),"dateTime.iso8601"), - "content" => new xmlrpcval($body,"string"), - "postid" => new xmlrpcval($blog->nid,"string") + $blogs[] = new xmlrpcval(array("userid" => new xmlrpcval($blog->name, "string"), + "dateCreated" => new xmlrpcval(iso8601_encode($blog->created), "dateTime.iso8601"), + "content" => new xmlrpcval($body, "string"), + "postid" => new xmlrpcval($blog->nid, "string") ), "struct"); } return new xmlrpcval($blogs, "array"); @@ -257,7 +257,7 @@ function bloggerapi_node_recent($num) { function bloggerapi_node_delete($nid) { global $user; - $node = node_load(array("nid" => $nid)); + $node = node_load(array("nid" => $nid, "type" => "blog")); if ($node->uid == $user->uid) { if (node_access("delete", $node)) { @@ -270,7 +270,7 @@ function bloggerapi_node_delete($nid) { watchdog("special", "$node->type: deleted '$node->title', via Blogger API"); $message = "Node: $node->nid, was deleted"; - return new xmlrpcval($message, "string"); + return new xmlrpcval(1, "boolean"); } } else { @@ -282,7 +282,7 @@ function bloggerapi_node_delete($nid) { ** Helper functions */ -function tt(){ +function tt() { $tt = array_flip(get_html_translation_table(HTML_ENTITIES)); $tt["'"] = "'"; return $tt; @@ -293,7 +293,7 @@ function bloggerapi_error($message) { $error->error = 1; $error->error_msg = $message; - $error->error_resp = new xmlrpcresp(0, $xmlrpcerruser+1, $message); + $error->error_resp = new xmlrpcresp(0, $xmlrpcerruser + 1, $message); return $error; } @@ -321,7 +321,7 @@ function bloggerapi_convert($params) { } function bloggerapi_title($body) { - $title = strip_tags(strtr($title ? $title : substr(strip_tags(strtr($body, tt() )), 0, 30), tt() )); + $title = strip_tags(strtr($title ? $title : substr(strip_tags(strtr($body, tt())), 0, 30), tt())); return $title; } @@ -333,14 +333,6 @@ function bloggerapi_perm() { return array("access Blogger API"); } -function bloggerapi_system($field){ - $output = ""; - - if ($field == "description") {$output .= bloggerapi_help("admin/system/modules"); }; - - return $output; -} - function bloggerapi_help($section) { $output = ""; @@ -364,10 +356,10 @@ function bloggerapi_help($section) { $output .= "<p>You can't use remote authentication when posting using a Blogger API enabled client, even when you could use that to authenticate on the site itself. You will have to use the site's local username, enter a password for that account, and then use that combination to post using the Blogger API client.</p>"; $output .= "<h3>Notes and limitations</h3>"; $output .= "<ul><li>The Blogger API contains an AppKey that is discarded in the Drupal Implementation.</li><li>The Blogger API does not allow for a title element. Our work around for this is either to use <title></title> tags in the body of your post or let the module create a title by inspecting the first few lines of the post body.</li><li>The publish parameter is always set to <i>1</i>.</li><li>When using the <i>getUserInfo</i> call, Drupal attempts to generate a first and last name from the Drupal username; no distinction is made internally</li><li><i>GetUsersBlogs</i> only returns one blog because unlike Blogger, Drupal only allows one blog per user.</li></ul>"; - $output = t($output, array("%blogger-com" => "<a href=\"http://www.blogger.com/\">Blogger</a>", "%blogger_api" => "%blogger-api\">Blogger API</a>", "%client-radio" => "<a href=\"http://radio.userland.com/\">Radio</a>", "%client-blogbuddy" => "<a href=\"http://blogbuddy.sourceforge.net/\">BlogBuddy</a>", "%client-w_bloggar" => "<a href=\"http://www.wbloggar.com/\">w.bloggar</a>", "%client-textrouter" => "<a href=\"http://projects.kittle.info/tr/\">TextRouter</a>", "%xml-rpc" => "<a href=\"http://www.xmlrpc.com/\">XML-RPC</a>", "%userland-software" => "<a href=\"http://www.userland.com/\">UserLand Software</a>", "%weblogs-com" => "<a href=\"http://www.weblogs.com/\">weblogs.com</a>", "%dist-auth" => l(t("distributed authentication"), "user/help"), "%echo-proj" => "<a href=\"http://www.intertwingly.net/wiki/pie/RoadMap\">". t("Echo project") ."</a>", "%bloggerapi-newpost" => "%blogger-api/xmlrpc_newPost.html\">blogger.newPost()*</a>", "%bloggerapi-editpost" => "%blogger-api/xmlrpc_editPost.html\">blogger.editPost()*</a>", "%bloggerapi-getuserblogs" => "%blogger-api/xmlrpc_getUserBlogs.html\">blogger.getUsersBlogs()*</a>", "%bloggerapi-getuserinfo" => "%blogger-api/xmlrpc_getUserInfo.html\">blogger.getUserInfo()*</a>", "%bloggerapi-gettemplate" => "%blogger-api/xmlrpc_getTemplate.html\">blogger.getTemplate()*</a>", "%bloggerapi-settemplate" => "%blogger-api/xmlrpc_setTemplate.html\">blogger.setTemplate()*</a>", "%mess-296" => "%blogger-dev/296\">blogger.getPost()*</a>", "%mess-225" => "%blogger-dev/225\">blogger.getRecentPosts()*</a>", "%mess-147" => "%blogger-dev/147\">blogger.deletePost()*</a>","%mod-config" => l(t("modules configuration page"), "admin/systems/modules"), "%user-management" => l(t("user management"), "admin/user/permission") )); + $output = t($output, array("%blogger-com" => "<a href=\"http://www.blogger.com/\">Blogger</a>", "%blogger_api" => "%blogger-api\">Blogger API</a>", "%client-radio" => "<a href=\"http://radio.userland.com/\">Radio</a>", "%client-blogbuddy" => "<a href=\"http://blogbuddy.sourceforge.net/\">BlogBuddy</a>", "%client-w_bloggar" => "<a href=\"http://www.wbloggar.com/\">w.bloggar</a>", "%client-textrouter" => "<a href=\"http://projects.kittle.info/tr/\">TextRouter</a>", "%xml-rpc" => "<a href=\"http://www.xmlrpc.com/\">XML-RPC</a>", "%userland-software" => "<a href=\"http://www.userland.com/\">UserLand Software</a>", "%weblogs-com" => "<a href=\"http://www.weblogs.com/\">weblogs.com</a>", "%dist-auth" => l(t("distributed authentication"), "user/help"), "%echo-proj" => "<a href=\"http://www.intertwingly.net/wiki/pie/RoadMap\">". t("Echo project") ."</a>", "%bloggerapi-newpost" => "%blogger-api/xmlrpc_newPost.html\">blogger.newPost()*</a>", "%bloggerapi-editpost" => "%blogger-api/xmlrpc_editPost.html\">blogger.editPost()*</a>", "%bloggerapi-getuserblogs" => "%blogger-api/xmlrpc_getUserBlogs.html\">blogger.getUsersBlogs()*</a>", "%bloggerapi-getuserinfo" => "%blogger-api/xmlrpc_getUserInfo.html\">blogger.getUserInfo()*</a>", "%bloggerapi-gettemplate" => "%blogger-api/xmlrpc_getTemplate.html\">blogger.getTemplate()*</a>", "%bloggerapi-settemplate" => "%blogger-api/xmlrpc_setTemplate.html\">blogger.setTemplate()*</a>", "%mess-296" => "%blogger-dev/296\">blogger.getPost()*</a>", "%mess-225" => "%blogger-dev/225\">blogger.getRecentPosts()*</a>", "%mess-147" => "%blogger-dev/147\">blogger.deletePost()*</a>","%mod-config" => l(t("modules configuration page"), "admin/systems/modules"), "%user-management" => l(t("user management"), "admin/user/permission"))); $output = strtr($output, array("%blogger-api" => "<a href=\"http://www.blogger.com/developers/api/1_docs","%blogger-dev" => "<a href=\"http://groups.yahoo.com/group/bloggerDev/message")); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output .= t("Enables users to post using tools or applications that support the Blogger API."); break; } diff --git a/modules/book.module b/modules/book.module index 652c5a968..d27591c80 100644 --- a/modules/book.module +++ b/modules/book.module @@ -1,14 +1,6 @@ <?php // $Id$ -function book_system($field){ - $output = ""; - - if ($field == "description") { $output = book_help("admin/system/modules"); }; - return $output; - -} - function book_node($field) { global $user; @@ -79,7 +71,7 @@ function book_link($type, $node = 0, $main = 0) { if ($type == "system") { if (user_access("maintain books")) { - menu("node/add/book", t("book page"), "book_page", NULL,0); + menu("node/add/book", t("book page"), "book_page", NULL, 0); menu("admin/node/book", t("books"), NULL, NULL, 4); menu("admin/node/book/orphan", t("orphan pages"), NULL, NULL, 8); menu("admin/node/book/help", t("help"), NULL, NULL, 9); @@ -418,7 +410,7 @@ function book_show($node, $cid) { if (node_access("view", $node)) { if ($node->type == "book") { - book_view($node,0); + book_view($node, 0); } else { @@ -448,7 +440,7 @@ function book_show($node, $cid) { ** View the node */ theme("breadcrumb", $node->breadcrumb); - theme("node",$node, 0); + theme("node", $node, 0); } else { @@ -859,9 +851,9 @@ function book_help($section = "admin/node/book/help") { $output .= "<p>In order to set up the FAQ, you have to create a new book which will hold all your content. To do so, click on the %create link. Give it a thoughtful title, and body. A title like \"Estonia Travel - FAQ\" is nice. You may always edit these fields later. You will probably want to designate <i><root></i> as the parent of this page. Leave the <i>log message</i> and <i>type</i> fields blank for now. After you have submitted this book page, you are ready to begin filling up your book with questions that are frequently asked.</p>"; $output .= "<p>Whenever you come across a post which you want to include in your FAQ, click on the <i>administer</i> link. Then click on the <i>edit book outline</i> button at the bottom of the page. Then place the relevant post wherever is most appropriate in your book by selecting a <i>parent</i>. Books are quite flexible. They can have sections like <i>Flying to Estonia</i>, <i>Eating in Estonia</i> and so on. As you get more experienced with the book module, you can reorganize posts in your book so that it stays organized.</p>"; $output .= "<p>Notes:</p><ul><li>Any comments attached to those relevant posts which you designate as book pages will also be transported into your book. This is a great feature, since much wisdom is shared via comments. Remember that all future comments and edits will automatically be reflected in your book.</li><li>You may wish to edit the title of posts when adding them to your FAQ. This is done on the same page as the <i>Edit book outline</i> button. Clear titles improve navigability enormously.</li><li>Book pages may come from any content type (blog, story, page, etc.). If you are creating a post solely for inclusion in your book, then use the %create link.</li><li>If you don't see the <i>administer</i> link, then you probably have insufficient %permission.</li><li>If you want to get really fancy, note that books are one of the few content types which allow raw PHP in their <i>body</i>. So you've got lots of geeky possibilities there.</li></ul>"; - $output = t($output, array("%permissions" => l(t("permissions"), "admin/user/permission"), "%create" => l(t("create book page"), "node/add/book"), "%collaborative-book" => l(t("collaborative book"), "admin/node/book"), "%orphans-book" => l(t("review their books for orphans"), "admin/node/book/orphan"), "%export-book" => l(t("export their books"), "book/print"), "%create" => l(t("create book page"), "node/add/book") )); + $output = t($output, array("%permissions" => l(t("permissions"), "admin/user/permission"), "%create" => l(t("create book page"), "node/add/book"), "%collaborative-book" => l(t("collaborative book"), "admin/node/book"), "%orphans-book" => l(t("review their books for orphans"), "admin/node/book/orphan"), "%export-book" => l(t("export their books"), "book/print"), "%create" => l(t("create book page"), "node/add/book"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Allows users to collaboratively author a book."); break; case 'admin/node/book': diff --git a/modules/book/book.module b/modules/book/book.module index 652c5a968..d27591c80 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -1,14 +1,6 @@ <?php // $Id$ -function book_system($field){ - $output = ""; - - if ($field == "description") { $output = book_help("admin/system/modules"); }; - return $output; - -} - function book_node($field) { global $user; @@ -79,7 +71,7 @@ function book_link($type, $node = 0, $main = 0) { if ($type == "system") { if (user_access("maintain books")) { - menu("node/add/book", t("book page"), "book_page", NULL,0); + menu("node/add/book", t("book page"), "book_page", NULL, 0); menu("admin/node/book", t("books"), NULL, NULL, 4); menu("admin/node/book/orphan", t("orphan pages"), NULL, NULL, 8); menu("admin/node/book/help", t("help"), NULL, NULL, 9); @@ -418,7 +410,7 @@ function book_show($node, $cid) { if (node_access("view", $node)) { if ($node->type == "book") { - book_view($node,0); + book_view($node, 0); } else { @@ -448,7 +440,7 @@ function book_show($node, $cid) { ** View the node */ theme("breadcrumb", $node->breadcrumb); - theme("node",$node, 0); + theme("node", $node, 0); } else { @@ -859,9 +851,9 @@ function book_help($section = "admin/node/book/help") { $output .= "<p>In order to set up the FAQ, you have to create a new book which will hold all your content. To do so, click on the %create link. Give it a thoughtful title, and body. A title like \"Estonia Travel - FAQ\" is nice. You may always edit these fields later. You will probably want to designate <i><root></i> as the parent of this page. Leave the <i>log message</i> and <i>type</i> fields blank for now. After you have submitted this book page, you are ready to begin filling up your book with questions that are frequently asked.</p>"; $output .= "<p>Whenever you come across a post which you want to include in your FAQ, click on the <i>administer</i> link. Then click on the <i>edit book outline</i> button at the bottom of the page. Then place the relevant post wherever is most appropriate in your book by selecting a <i>parent</i>. Books are quite flexible. They can have sections like <i>Flying to Estonia</i>, <i>Eating in Estonia</i> and so on. As you get more experienced with the book module, you can reorganize posts in your book so that it stays organized.</p>"; $output .= "<p>Notes:</p><ul><li>Any comments attached to those relevant posts which you designate as book pages will also be transported into your book. This is a great feature, since much wisdom is shared via comments. Remember that all future comments and edits will automatically be reflected in your book.</li><li>You may wish to edit the title of posts when adding them to your FAQ. This is done on the same page as the <i>Edit book outline</i> button. Clear titles improve navigability enormously.</li><li>Book pages may come from any content type (blog, story, page, etc.). If you are creating a post solely for inclusion in your book, then use the %create link.</li><li>If you don't see the <i>administer</i> link, then you probably have insufficient %permission.</li><li>If you want to get really fancy, note that books are one of the few content types which allow raw PHP in their <i>body</i>. So you've got lots of geeky possibilities there.</li></ul>"; - $output = t($output, array("%permissions" => l(t("permissions"), "admin/user/permission"), "%create" => l(t("create book page"), "node/add/book"), "%collaborative-book" => l(t("collaborative book"), "admin/node/book"), "%orphans-book" => l(t("review their books for orphans"), "admin/node/book/orphan"), "%export-book" => l(t("export their books"), "book/print"), "%create" => l(t("create book page"), "node/add/book") )); + $output = t($output, array("%permissions" => l(t("permissions"), "admin/user/permission"), "%create" => l(t("create book page"), "node/add/book"), "%collaborative-book" => l(t("collaborative book"), "admin/node/book"), "%orphans-book" => l(t("review their books for orphans"), "admin/node/book/orphan"), "%export-book" => l(t("export their books"), "book/print"), "%create" => l(t("create book page"), "node/add/book"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Allows users to collaboratively author a book."); break; case 'admin/node/book': diff --git a/modules/cloud.module b/modules/cloud.module index c5a6051a6..17f8fa8c3 100644 --- a/modules/cloud.module +++ b/modules/cloud.module @@ -10,32 +10,26 @@ function cloud_help($section = "admin/node/syndication/cloud/help") { case 'admin/node/syndication/cloud/help': $output .= "The cloud monitor tracks or crawls other interesting web sites and displays their last modification dates. Visitors to the host site learn about relevant sites and can easily see if there is new content. Here is how it works:"; $output .= "<ul>"; - $output .= strtr("<li>The site administrator enters names and URLs of the relevant pages on the %cloud-add page.</li>", array("%cloud-add" => l(t("content") ." » ". t("syndication") ." » ". t("site cloud") ." » ". t("add new site"), "admin/node/syndication/cloud/add") )); + $output .= "<li>The site administrator enters names and URLs of the relevant pages on the %cloud-add page.</li>"; $output .= "<li>Drupal's cron function, triggers the cloud module to check all the registered web sites for recent changes or updates. (A page is updated when there is an <i>x</i>-byte difference since the last time it checked, where <i>x</i> is a configuration option.)</li>"; $output .= " <li>The module exports both a page and a block that display the registered sites ordered by their last modification date.</li>"; $output .= "</ul>"; + $output = t($output, array("%cloud-add" => l(t("content") ." » ". t("syndication") ." » ". t("site cloud") ." » ". t("add new site"), "admin/node/syndication/cloud/add"))); break; case 'cloud': - $output .= "<p>The cloud monitor tracks or crawls other interesting web sites and displays their latest modification dates. It acts as a link watcher such that you can keep an eye on the other sites in the cloud.</p>"; + $output .= t("<p>The cloud monitor tracks or crawls other interesting web sites and displays their latest modification dates. It acts as a link watcher such that you can keep an eye on the other sites in the cloud.</p>"); break; - case 'admin/system/modules': - $output = "Tracks other sites and displays last date changed."; + case 'admin/system/modules#description': + $output = t("Tracks other sites and displays last date changed."); break; case 'admin/node/syndication/cloud': - $output = strtr("The cloud monitor tracks or crawls other interesting web sites and displays their last modification dates. Visitors to this site learn about other relevant sites and can easily see if there is new content. To get this working you <b>must</b> setup cron support. To get the site cloud block to display you must turn on the <i>site cloud</i> block in %block. To go to a monitored site, click on the site name, to immediately load and/or update the record for a site, click on \"update site\", to delete a site go to \"edit site\". ", array("%block" => l(t("administer") ." » ". t("configuration") ." » ". t("blocks"), "admin/block") )); + $output = t("The cloud monitor tracks or crawls other interesting web sites and displays their last modification dates. Visitors to this site learn about other relevant sites and can easily see if there is new content. To get this working you <b>must</b> setup cron support. To get the site cloud block to display you must turn on the <i>site cloud</i> block in %block. To go to a monitored site, click on the site name, to immediately load and/or update the record for a site, click on \"update site\", to delete a site go to \"edit site\". ", array("%block" => l(t("administer") ." » ". t("configuration") ." » ". t("blocks"), "admin/block"))); break; case 'admin/node/syndication/cloud/add': - $output = "Add a site to the site cloud. Don't forget the \"http://\" for your URLs."; + $output = t("Add a site to the site cloud. Don't forget the \"http://\" for your URLs."); break; } - return t($output); -} - -function cloud_system($field){ - $output = ""; - - if ($field == "description") {$output = cloud_help("admin/system/modules");}; return $output; } diff --git a/modules/comment.module b/modules/comment.module index e0f4cce9d..a03f236d9 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -68,9 +68,9 @@ function comment_help($section = "admin/comment/help") { $output .= "<h4>Initial comment scores</h4>"; $output .= "<p>Finally, you may want to enter some <i>initial comment scores</i>. In %comment-inital you can assign a beginning rating for all comments posted by a particular permission role. If you do not assign any initial scores, Drupal will assign a rating of <b>0</b> as the default.</p>"; - $output = t($output, array("%comment-config" => l(t("site configuration » modules » comment"), "admin/system/modules/comment"), "%site-config" => l(t("site configuration"), "admin/system"), "%user-permissions" => l(t("user management » user permissions"), "admin/user/permission"), "%tracker" => l(t("view recent posts"), "tracker"), "%tracker-recent" => l(t("Recent activity"), "tracker"), "%download-notify" => "<a href=\"http://drupal.org/node/view/68\">". t("download") ."</a>", "%permission" => l(t("moderate comments"), "admin/user/permissions"), "%comment-moderation" => l(t("comment management » comment moderation"), "admin/comment/moderation"), "%comment-votes" => l(t("comment management » comment moderation » votes"), "admin/comment/moderation/votes"), "%comment-matrix" => l(t("comment management » comment moderation » matrix"), "admin/comment/moderation/matrix"), "%comment-thresholds" => l(t("comment management » comment moderation » thresholds"), "admin/comment/moderation/thresholds"), "%slashdot" => "<a href=\"http://slashdot.org/\">Slashdot</a>", "%comment-inital" => l(t("comment management » initial comment scores"), "admin/comments/moderation/roles") )); + $output = t($output, array("%comment-config" => l(t("site configuration » modules » comment"), "admin/system/modules/comment"), "%site-config" => l(t("site configuration"), "admin/system"), "%user-permissions" => l(t("user management » user permissions"), "admin/user/permission"), "%tracker" => l(t("view recent posts"), "tracker"), "%tracker-recent" => l(t("Recent activity"), "tracker"), "%download-notify" => "<a href=\"http://drupal.org/node/view/68\">". t("download") ."</a>", "%permission" => l(t("moderate comments"), "admin/user/permissions"), "%comment-moderation" => l(t("comment management » comment moderation"), "admin/comment/moderation"), "%comment-votes" => l(t("comment management » comment moderation » votes"), "admin/comment/moderation/votes"), "%comment-matrix" => l(t("comment management » comment moderation » matrix"), "admin/comment/moderation/matrix"), "%comment-thresholds" => l(t("comment management » comment moderation » thresholds"), "admin/comment/moderation/thresholds"), "%slashdot" => "<a href=\"http://slashdot.org/\">Slashdot</a>", "%comment-inital" => l(t("comment management » initial comment scores"), "admin/comments/moderation/roles"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables user to comment on content (nodes)."); break; case 'admin/system/modules/comment': @@ -89,7 +89,7 @@ function comment_help($section = "admin/comment/help") { $output = t("Below is a list of the comments posted to your site that need approval. To approve a comment click on <b>\"edit comment\"</b> and then change it's <b>moderation status</b> to Approved.<br />Click on a subject to see the comment, the author's name to edit the author's user information, \"edit comment\" to edit the comment, and \"delete comment\" to remove the comment."); break; case 'admin/comments/moderation': - $output = t("If you have a get a lot of comments, you can enable comment moderation. Once moderation is enabled users can vote on a comment based on dropdown menus. %votes sets up the names in the dropdown menu, and the order in which they appear, using weights. %matrix sets up the value of each user's vote, and %threshold sets up the levels at which a comment will be displayed.", array("%votes" => l(t("Votes"), "admin/comment/moderation/votes"), "%matrix" => l(t("Matrix"),"admin/comment/moderation/matrix"), "%threshold" => l(t("threshold"),"admin/comment/moderation/threshold"))); + $output = t("If you have a get a lot of comments, you can enable comment moderation. Once moderation is enabled users can vote on a comment based on dropdown menus. %votes sets up the names in the dropdown menu, and the order in which they appear, using weights. %matrix sets up the value of each user's vote, and %threshold sets up the levels at which a comment will be displayed.", array("%votes" => l(t("Votes"), "admin/comment/moderation/votes"), "%matrix" => l(t("Matrix"), "admin/comment/moderation/matrix"), "%threshold" => l(t("threshold"), "admin/comment/moderation/threshold"))); break; case 'admin/comment/moderation/votes': $output = t("Here is where you setup the names of each type of vote. Weight lets you set the order of the drop down menu. Click <b>edit</b> to edit a current vote weight.<br />Notes: <ul><li>you can have more than one type with the same name. The system does not protect you from this.</li><li>To <b>delete</b> a name/weight combiniation go to the <b>edit</b> area.</li></ul>"); @@ -110,15 +110,6 @@ function comment_help($section = "admin/comment/help") { return $output; } -function comment_system($field) { - $output = ""; - - if ($field == "description") {$output = comment_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = comment_help("admin/system/modules/comment"); }; - - return $output; -} - function comment_settings() { $output .= form_select(t("Default display mode"), "comment_default_mode", variable_get("comment_default_mode", 4), _comment_get_modes(), t("The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.")); @@ -178,7 +169,7 @@ function comment_access($op, $comment) { } function comment_referer_save() { - $_SESSION["comment_referer"] = arg(0)."/".arg(1)."/".arg(2); + $_SESSION["comment_referer"] = arg(0) ."/". arg(1) ."/". arg(2); } /* @@ -439,7 +430,7 @@ function comment_post($edit) { // We need to get the value at the correct depth: $parts = explode(".", $max); - $parent_depth = count(explode(".",$parent->thread)); + $parent_depth = count(explode(".", $parent->thread)); $last = $parts[$parent_depth]; /* @@ -457,7 +448,7 @@ function comment_post($edit) { } // Finally build the thread field for this new comment: - $thread = "$parent->thread.".$decimals.$units."/"; + $thread = "$parent->thread.". $decimals.$units ."/"; } } @@ -511,7 +502,7 @@ function comment_links($comment, $return = 1) { */ if ($return) { - $links[] = l(t("parent"), comment_referer_load()."#$comment->cid"); + $links[] = l(t("parent"), comment_referer_load() ."#$comment->cid"); } /* @@ -728,7 +719,7 @@ function comment_render($node, $cid = 0) { ** Start a form, to use with comment control and moderation. */ - $result = pager_query($query, $comments_per_page, 0, "SELECT COUNT(*) FROM {comments} WHERE nid = '".check_query($nid)."'"); + $result = pager_query($query, $comments_per_page, 0, "SELECT COUNT(*) FROM {comments} WHERE nid = '". check_query($nid) ."'"); if ((variable_get("comment_controls", 0) == 0) || (variable_get("comment_controls", 0) == 2)) { print "<form method=\"post\" action=\"". url("comment") ."\"><div>\n"; @@ -1015,7 +1006,7 @@ function comment_admin_overview($status = 0) { $result = pager_query($sql, 50); while ($comment = db_fetch_object($result)) { - $rows[] = array(l($comment->subject, "node/view/$comment->nid/$comment->cid#$comment->cid", array("title" => htmlspecialchars(substr($comment->comment, 0, 128)))) ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme_mark() : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."</td><td>". format_date($comment->timestamp, "small"). "</td><td>". l(t("edit comment"), "admin/comment/edit/$comment->cid"), l(t("delete comment"), "admin/comment/delete/$comment->cid")); + $rows[] = array(l($comment->subject, "node/view/$comment->nid/$comment->cid#$comment->cid", array("title" => htmlspecialchars(substr($comment->comment, 0, 128)))) ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme_mark() : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>". l(t("edit comment"), "admin/comment/edit/$comment->cid"), l(t("delete comment"), "admin/comment/delete/$comment->cid")); } if ($pager = pager_display(NULL, 50, 0, "admin", tablesort_pager())) { @@ -1033,7 +1024,7 @@ function comment_mod_matrix($edit) { db_query("DELETE FROM {moderation_roles} "); foreach ($edit as $role_id => $votes) { foreach ($votes as $mid => $value) { - $sql[] = "('$mid', '$role_id', '". ($value ? $value : 0 ) ."')"; + $sql[] = "('$mid', '$role_id', '". ($value ? $value : 0) ."')"; } } db_query("INSERT INTO {moderation_roles} (mid, rid, value) VALUES ". implode(", ", $sql)); @@ -1114,7 +1105,7 @@ function comment_mod_votes($edit) { $output = status("Vote added"); } - $output .= "<h3>" . t("Moderation votes overview") . "</h3>"; + $output .= "<h3>". t("Moderation votes overview") ."</h3>"; $header = array(t("votes"), t("weight"), t("operations")); $result = db_query("SELECT mid, vote, weight FROM {moderation_votes} ORDER BY weight"); @@ -1382,7 +1373,7 @@ function comment($comment, $links = 0) { } function comment_folded($comment) { - print "<div class=\"comment-folded\"><span class=\"subject\">". l($comment->subject, comment_referer_load()."/$comment->cid#$comment->cid") ."</span> <span class=\"credit\">". t("by") . " " . format_name($comment) ."</span></div>"; + print "<div class=\"comment-folded\"><span class=\"subject\">". l($comment->subject, comment_referer_load() ."/$comment->cid#$comment->cid") ."</span> <span class=\"credit\">". t("by") ." ". format_name($comment) ."</span></div>"; } function comment_flat_collapsed($comment, $threshold) { diff --git a/modules/comment/comment.module b/modules/comment/comment.module index e0f4cce9d..a03f236d9 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -68,9 +68,9 @@ function comment_help($section = "admin/comment/help") { $output .= "<h4>Initial comment scores</h4>"; $output .= "<p>Finally, you may want to enter some <i>initial comment scores</i>. In %comment-inital you can assign a beginning rating for all comments posted by a particular permission role. If you do not assign any initial scores, Drupal will assign a rating of <b>0</b> as the default.</p>"; - $output = t($output, array("%comment-config" => l(t("site configuration » modules » comment"), "admin/system/modules/comment"), "%site-config" => l(t("site configuration"), "admin/system"), "%user-permissions" => l(t("user management » user permissions"), "admin/user/permission"), "%tracker" => l(t("view recent posts"), "tracker"), "%tracker-recent" => l(t("Recent activity"), "tracker"), "%download-notify" => "<a href=\"http://drupal.org/node/view/68\">". t("download") ."</a>", "%permission" => l(t("moderate comments"), "admin/user/permissions"), "%comment-moderation" => l(t("comment management » comment moderation"), "admin/comment/moderation"), "%comment-votes" => l(t("comment management » comment moderation » votes"), "admin/comment/moderation/votes"), "%comment-matrix" => l(t("comment management » comment moderation » matrix"), "admin/comment/moderation/matrix"), "%comment-thresholds" => l(t("comment management » comment moderation » thresholds"), "admin/comment/moderation/thresholds"), "%slashdot" => "<a href=\"http://slashdot.org/\">Slashdot</a>", "%comment-inital" => l(t("comment management » initial comment scores"), "admin/comments/moderation/roles") )); + $output = t($output, array("%comment-config" => l(t("site configuration » modules » comment"), "admin/system/modules/comment"), "%site-config" => l(t("site configuration"), "admin/system"), "%user-permissions" => l(t("user management » user permissions"), "admin/user/permission"), "%tracker" => l(t("view recent posts"), "tracker"), "%tracker-recent" => l(t("Recent activity"), "tracker"), "%download-notify" => "<a href=\"http://drupal.org/node/view/68\">". t("download") ."</a>", "%permission" => l(t("moderate comments"), "admin/user/permissions"), "%comment-moderation" => l(t("comment management » comment moderation"), "admin/comment/moderation"), "%comment-votes" => l(t("comment management » comment moderation » votes"), "admin/comment/moderation/votes"), "%comment-matrix" => l(t("comment management » comment moderation » matrix"), "admin/comment/moderation/matrix"), "%comment-thresholds" => l(t("comment management » comment moderation » thresholds"), "admin/comment/moderation/thresholds"), "%slashdot" => "<a href=\"http://slashdot.org/\">Slashdot</a>", "%comment-inital" => l(t("comment management » initial comment scores"), "admin/comments/moderation/roles"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables user to comment on content (nodes)."); break; case 'admin/system/modules/comment': @@ -89,7 +89,7 @@ function comment_help($section = "admin/comment/help") { $output = t("Below is a list of the comments posted to your site that need approval. To approve a comment click on <b>\"edit comment\"</b> and then change it's <b>moderation status</b> to Approved.<br />Click on a subject to see the comment, the author's name to edit the author's user information, \"edit comment\" to edit the comment, and \"delete comment\" to remove the comment."); break; case 'admin/comments/moderation': - $output = t("If you have a get a lot of comments, you can enable comment moderation. Once moderation is enabled users can vote on a comment based on dropdown menus. %votes sets up the names in the dropdown menu, and the order in which they appear, using weights. %matrix sets up the value of each user's vote, and %threshold sets up the levels at which a comment will be displayed.", array("%votes" => l(t("Votes"), "admin/comment/moderation/votes"), "%matrix" => l(t("Matrix"),"admin/comment/moderation/matrix"), "%threshold" => l(t("threshold"),"admin/comment/moderation/threshold"))); + $output = t("If you have a get a lot of comments, you can enable comment moderation. Once moderation is enabled users can vote on a comment based on dropdown menus. %votes sets up the names in the dropdown menu, and the order in which they appear, using weights. %matrix sets up the value of each user's vote, and %threshold sets up the levels at which a comment will be displayed.", array("%votes" => l(t("Votes"), "admin/comment/moderation/votes"), "%matrix" => l(t("Matrix"), "admin/comment/moderation/matrix"), "%threshold" => l(t("threshold"), "admin/comment/moderation/threshold"))); break; case 'admin/comment/moderation/votes': $output = t("Here is where you setup the names of each type of vote. Weight lets you set the order of the drop down menu. Click <b>edit</b> to edit a current vote weight.<br />Notes: <ul><li>you can have more than one type with the same name. The system does not protect you from this.</li><li>To <b>delete</b> a name/weight combiniation go to the <b>edit</b> area.</li></ul>"); @@ -110,15 +110,6 @@ function comment_help($section = "admin/comment/help") { return $output; } -function comment_system($field) { - $output = ""; - - if ($field == "description") {$output = comment_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = comment_help("admin/system/modules/comment"); }; - - return $output; -} - function comment_settings() { $output .= form_select(t("Default display mode"), "comment_default_mode", variable_get("comment_default_mode", 4), _comment_get_modes(), t("The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.")); @@ -178,7 +169,7 @@ function comment_access($op, $comment) { } function comment_referer_save() { - $_SESSION["comment_referer"] = arg(0)."/".arg(1)."/".arg(2); + $_SESSION["comment_referer"] = arg(0) ."/". arg(1) ."/". arg(2); } /* @@ -439,7 +430,7 @@ function comment_post($edit) { // We need to get the value at the correct depth: $parts = explode(".", $max); - $parent_depth = count(explode(".",$parent->thread)); + $parent_depth = count(explode(".", $parent->thread)); $last = $parts[$parent_depth]; /* @@ -457,7 +448,7 @@ function comment_post($edit) { } // Finally build the thread field for this new comment: - $thread = "$parent->thread.".$decimals.$units."/"; + $thread = "$parent->thread.". $decimals.$units ."/"; } } @@ -511,7 +502,7 @@ function comment_links($comment, $return = 1) { */ if ($return) { - $links[] = l(t("parent"), comment_referer_load()."#$comment->cid"); + $links[] = l(t("parent"), comment_referer_load() ."#$comment->cid"); } /* @@ -728,7 +719,7 @@ function comment_render($node, $cid = 0) { ** Start a form, to use with comment control and moderation. */ - $result = pager_query($query, $comments_per_page, 0, "SELECT COUNT(*) FROM {comments} WHERE nid = '".check_query($nid)."'"); + $result = pager_query($query, $comments_per_page, 0, "SELECT COUNT(*) FROM {comments} WHERE nid = '". check_query($nid) ."'"); if ((variable_get("comment_controls", 0) == 0) || (variable_get("comment_controls", 0) == 2)) { print "<form method=\"post\" action=\"". url("comment") ."\"><div>\n"; @@ -1015,7 +1006,7 @@ function comment_admin_overview($status = 0) { $result = pager_query($sql, 50); while ($comment = db_fetch_object($result)) { - $rows[] = array(l($comment->subject, "node/view/$comment->nid/$comment->cid#$comment->cid", array("title" => htmlspecialchars(substr($comment->comment, 0, 128)))) ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme_mark() : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."</td><td>". format_date($comment->timestamp, "small"). "</td><td>". l(t("edit comment"), "admin/comment/edit/$comment->cid"), l(t("delete comment"), "admin/comment/delete/$comment->cid")); + $rows[] = array(l($comment->subject, "node/view/$comment->nid/$comment->cid#$comment->cid", array("title" => htmlspecialchars(substr($comment->comment, 0, 128)))) ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme_mark() : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>". l(t("edit comment"), "admin/comment/edit/$comment->cid"), l(t("delete comment"), "admin/comment/delete/$comment->cid")); } if ($pager = pager_display(NULL, 50, 0, "admin", tablesort_pager())) { @@ -1033,7 +1024,7 @@ function comment_mod_matrix($edit) { db_query("DELETE FROM {moderation_roles} "); foreach ($edit as $role_id => $votes) { foreach ($votes as $mid => $value) { - $sql[] = "('$mid', '$role_id', '". ($value ? $value : 0 ) ."')"; + $sql[] = "('$mid', '$role_id', '". ($value ? $value : 0) ."')"; } } db_query("INSERT INTO {moderation_roles} (mid, rid, value) VALUES ". implode(", ", $sql)); @@ -1114,7 +1105,7 @@ function comment_mod_votes($edit) { $output = status("Vote added"); } - $output .= "<h3>" . t("Moderation votes overview") . "</h3>"; + $output .= "<h3>". t("Moderation votes overview") ."</h3>"; $header = array(t("votes"), t("weight"), t("operations")); $result = db_query("SELECT mid, vote, weight FROM {moderation_votes} ORDER BY weight"); @@ -1382,7 +1373,7 @@ function comment($comment, $links = 0) { } function comment_folded($comment) { - print "<div class=\"comment-folded\"><span class=\"subject\">". l($comment->subject, comment_referer_load()."/$comment->cid#$comment->cid") ."</span> <span class=\"credit\">". t("by") . " " . format_name($comment) ."</span></div>"; + print "<div class=\"comment-folded\"><span class=\"subject\">". l($comment->subject, comment_referer_load() ."/$comment->cid#$comment->cid") ."</span> <span class=\"credit\">". t("by") ." ". format_name($comment) ."</span></div>"; } function comment_flat_collapsed($comment, $threshold) { diff --git a/modules/drupal.module b/modules/drupal.module index 926b1a694..93ebc1205 100644 --- a/modules/drupal.module +++ b/modules/drupal.module @@ -4,7 +4,7 @@ function drupal_help($section = "admin/drupal/help") { $output = ""; - switch($section) { + switch ($section) { case 'admin/help': case 'admin/drupal/help': $output .= "<p>The \"Drupal\" module features a capability whereby other drupal sites may <i>call home</i> to report their existence. In turn, this enables a pod of Drupal sites to find, cooperate and advertise each other.</p>"; @@ -14,22 +14,21 @@ function drupal_help($section = "admin/drupal/help") { $output .= "<p>Also note that your installation need not use drupal.org as its directory server. For example, this feature is perfectly capable of aggregating pings from all of your departmental drupal installations sites within an enterprise.</p>"; $output .= t($output, array("%drupal-sites" => "<a href=\"http://www.drupal.org/node/view/3\">". t("Drupal sites page") ."</a>", "%Drupal" => "<a href=\"http://www.drupal.org\">drupal.org</a>", "%xml-rpc" => "<a href=\"http://www.xmlrpc.com/\">XLM-RPC</a>", "%drupal-settings" => l(t("Administration » site configuration » modules » drupal"), "admin/system/modules/drupal"), "%cron" => l(t("cron run"), "admin/system/help#cron") )); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Lets users log in using a Drupal ID and can notify drupal.org about your site."); break; case 'admin/system/modules/drupal': - $output = t("Using this your Drupal site can \"call home\" and add itself to the Drupal directory. If you want it to add itself to a different directory server you can change the %Drupal-setting setting -- but the directory server has to be able to handle Drupal XML. To get a full site listing go to the %general and set:<ul><li>The site name,</li><li>The site E-Mail address,</li><li>The site slogan, and</li><li>The site mission statement.</li></ul>", array("%Drupal-setting" => l(t("Drupal XML-RPC server"), "admin/system/modules/drupal"), "%general" => l(t("site configuration"), "admin/system") )); + $output = t("Using this your Drupal site can \"call home\" and add itself to the Drupal directory. If you want it to add itself to a different directory server you can change the %Drupal-setting setting -- but the directory server has to be able to handle Drupal XML. To get a full site listing go to the %general and set:<ul><li>The site name,</li><li>The site E-Mail address,</li><li>The site slogan, and</li><li>The site mission statement.</li></ul>", array("%Drupal-setting" => l(t("Drupal XML-RPC server"), "admin/system/modules/drupal"), "%general" => l(t("site configuration"), "admin/system"))); break; - } - - return $output; -} + case 'user/help': + $site = variable_get("site_name", "this web site"); -function drupal_system($field) { - $output = ""; + $output = "<p>%drupal is the name of the software which powers %site. There are Drupal web sites all over the world, and many of them share their registration databases so that users may freely login to any Drupal site using a single <b>Drupal ID</b>.</p>\n"; + $output .= "<p>So please feel free to login to your account here at %site with a username from another Drupal site. The format of a Drupal ID is similar to an email address: <b>username</b>@<i>server</i>. An example of valid Drupal ID is <b>mwlily</b>@<i>www.drupal.org</i>.</p>"; - if ($field == "description") { $output = drupal_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = drupal_help("admin/system/modules/drupal"); }; + $output = t($output, array("%drupal" => "<a href=\"http://www.drupal.org\">Drupal</a>", "%site" => "<i>$site</i>")); + break; + } return $output; } @@ -160,7 +159,7 @@ function drupal_auth($username, $password, $server) { function drupal_page() { theme("header"); - theme("box", "Drupal", drupal_auth_help()); + theme("box", "Drupal", drupal_help("user/help")); theme("footer"); } @@ -179,15 +178,6 @@ function drupal_login($arguments) { } } -function drupal_auth_help() { - $site = variable_get("site_name", "this web site"); - - $output = "<p><a href=\"http://www.drupal.org\">Drupal</a> is the name of the software which powers %s. There are Drupal web sites all over the world, and many of them share their registration databases so that users may freely login to any Drupal site using a single <b>Drupal ID</b>.</p>\n"; - $output .= "<p>So please feel free to login to your account here at %s with a username from another Drupal site. The format of a Drupal ID is similar to an email address: <b>username</b>@<i>server</i>. An example of valid Drupal ID is <b>mwlily</b>@<i>www.drupal.org</i>.</p>"; - - return t($output, array("%s" => "<i>$site</i>")); -} - function drupal_user($type, $edit, $user) { $module = "drupal"; diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module index 926b1a694..93ebc1205 100644 --- a/modules/drupal/drupal.module +++ b/modules/drupal/drupal.module @@ -4,7 +4,7 @@ function drupal_help($section = "admin/drupal/help") { $output = ""; - switch($section) { + switch ($section) { case 'admin/help': case 'admin/drupal/help': $output .= "<p>The \"Drupal\" module features a capability whereby other drupal sites may <i>call home</i> to report their existence. In turn, this enables a pod of Drupal sites to find, cooperate and advertise each other.</p>"; @@ -14,22 +14,21 @@ function drupal_help($section = "admin/drupal/help") { $output .= "<p>Also note that your installation need not use drupal.org as its directory server. For example, this feature is perfectly capable of aggregating pings from all of your departmental drupal installations sites within an enterprise.</p>"; $output .= t($output, array("%drupal-sites" => "<a href=\"http://www.drupal.org/node/view/3\">". t("Drupal sites page") ."</a>", "%Drupal" => "<a href=\"http://www.drupal.org\">drupal.org</a>", "%xml-rpc" => "<a href=\"http://www.xmlrpc.com/\">XLM-RPC</a>", "%drupal-settings" => l(t("Administration » site configuration » modules » drupal"), "admin/system/modules/drupal"), "%cron" => l(t("cron run"), "admin/system/help#cron") )); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Lets users log in using a Drupal ID and can notify drupal.org about your site."); break; case 'admin/system/modules/drupal': - $output = t("Using this your Drupal site can \"call home\" and add itself to the Drupal directory. If you want it to add itself to a different directory server you can change the %Drupal-setting setting -- but the directory server has to be able to handle Drupal XML. To get a full site listing go to the %general and set:<ul><li>The site name,</li><li>The site E-Mail address,</li><li>The site slogan, and</li><li>The site mission statement.</li></ul>", array("%Drupal-setting" => l(t("Drupal XML-RPC server"), "admin/system/modules/drupal"), "%general" => l(t("site configuration"), "admin/system") )); + $output = t("Using this your Drupal site can \"call home\" and add itself to the Drupal directory. If you want it to add itself to a different directory server you can change the %Drupal-setting setting -- but the directory server has to be able to handle Drupal XML. To get a full site listing go to the %general and set:<ul><li>The site name,</li><li>The site E-Mail address,</li><li>The site slogan, and</li><li>The site mission statement.</li></ul>", array("%Drupal-setting" => l(t("Drupal XML-RPC server"), "admin/system/modules/drupal"), "%general" => l(t("site configuration"), "admin/system"))); break; - } - - return $output; -} + case 'user/help': + $site = variable_get("site_name", "this web site"); -function drupal_system($field) { - $output = ""; + $output = "<p>%drupal is the name of the software which powers %site. There are Drupal web sites all over the world, and many of them share their registration databases so that users may freely login to any Drupal site using a single <b>Drupal ID</b>.</p>\n"; + $output .= "<p>So please feel free to login to your account here at %site with a username from another Drupal site. The format of a Drupal ID is similar to an email address: <b>username</b>@<i>server</i>. An example of valid Drupal ID is <b>mwlily</b>@<i>www.drupal.org</i>.</p>"; - if ($field == "description") { $output = drupal_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = drupal_help("admin/system/modules/drupal"); }; + $output = t($output, array("%drupal" => "<a href=\"http://www.drupal.org\">Drupal</a>", "%site" => "<i>$site</i>")); + break; + } return $output; } @@ -160,7 +159,7 @@ function drupal_auth($username, $password, $server) { function drupal_page() { theme("header"); - theme("box", "Drupal", drupal_auth_help()); + theme("box", "Drupal", drupal_help("user/help")); theme("footer"); } @@ -179,15 +178,6 @@ function drupal_login($arguments) { } } -function drupal_auth_help() { - $site = variable_get("site_name", "this web site"); - - $output = "<p><a href=\"http://www.drupal.org\">Drupal</a> is the name of the software which powers %s. There are Drupal web sites all over the world, and many of them share their registration databases so that users may freely login to any Drupal site using a single <b>Drupal ID</b>.</p>\n"; - $output .= "<p>So please feel free to login to your account here at %s with a username from another Drupal site. The format of a Drupal ID is similar to an email address: <b>username</b>@<i>server</i>. An example of valid Drupal ID is <b>mwlily</b>@<i>www.drupal.org</i>.</p>"; - - return t($output, array("%s" => "<i>$site</i>")); -} - function drupal_user($type, $edit, $user) { $module = "drupal"; diff --git a/modules/forum.module b/modules/forum.module index 99dbec746..0edd25244 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -1,15 +1,6 @@ <?php // $Id$ -function forum_system($field){ - $output = ""; - - if ($field == "description") { $output = forum_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = forum_help("admin/system/modules/forum"); }; - - return $output; -} - function forum_node($field) { $info["name"] = t("forum topic"); $info["description"] = t("A forum is a threaded discussion, enabling users to communicate about a particular topic."); @@ -42,7 +33,7 @@ function forum_settings() { $output .= form_textarea(t("Explanation or submission guidelines"), "forum_help", variable_get("forum_help", ""), 70, 5, t("This text will be displayed at the top of the forum submission form. Useful for helping or instructing your users.")); $output .= form_select(t("Forum vocabulary"), "forum_nav_vocabulary", variable_get("forum_nav_vocabulary", ""), $vocs, t("The taxonomy vocabulary that will be used as the navigation tree.")); $output .= form_textfield(t("Forum icon path"), "forum_icon_path", variable_get("forum_icon_path", ""), 30, 255, t("The path to the forum icons. Leave blank to disable icons. Don't add a trailing slash. Default icons are available in the 'misc' directory.")); - $number = array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 50 => 50, 60 => 60, 80 => 80, 100 => 100, 10000=>10000); + $number = array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 50 => 50, 60 => 60, 80 => 80, 100 => 100, 10000 => 10000); $output .= form_select(t("Hot topic threshold"), "forum_hot_topic", variable_get("forum_hot_topic", 15), $number, t("The number of posts a topic must have to be considered <b>hot</b>.")); $number = array(10 => 10, 25 => 25, 50 => 50, 75 => 75, 100 => 100); $output .= form_select(t("Topics per page"), "forum_per_page", variable_get("forum_per_page", 25), $number, t("The default number of topics displayed per page; links to browse older messages are automatically being displayed.")); @@ -110,7 +101,7 @@ function forum_link($type, $node = 0, $main = 0) { if (!$main && $type == "node" && $node->type == "forum") { // get previous and next topic - $result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid); + $result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order", 1)), $node->tid); while ($topic = db_fetch_object($result)) { if ($stop == 1) { @@ -130,11 +121,11 @@ function forum_link($type, $node = 0, $main = 0) { } if ($prev) { - $links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100)."...")); + $links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100) ."...")); } if ($next) { - $links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100)."...")); + $links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100) ."...")); } } @@ -161,7 +152,7 @@ function forum_view($node, $main = 0) { $breadcrumb[] = l(t("Forums"), "forum"); $breadcrumb[] = l($term_data->name, "forum/$term_data->tid"); // print the breadcrumb - theme("breadcrumb",$breadcrumb); + theme("breadcrumb", $breadcrumb); } // prepair the node content $node = forum_content($node); @@ -330,13 +321,13 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { $forum_topic_list_header = array( array("data" => " "), array("data" => t("Topic"), "field" => "n.title"), - array("data" => t("Replies"),"field" => "num_comments"), + array("data" => t("Replies"), "field" => "num_comments"), array("data" => t("Created"), "field" => "n.created"), array("data" => t("Last reply"), "field" => "date_sort", "sort" => "desc"), ); $sql_sortby = _forum_get_topic_order($sortby); - for ($i=0; $i < count($forum_topic_list_header); $i++) { + for ($i = 0; $i < count($forum_topic_list_header); $i++) { if ($forum_topic_list_header[$i]["field"] == $sql_sortby) { $forum_topic_list_header[$i]["order"] = $sql_sortby; } @@ -346,7 +337,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { $voc = taxonomy_get_vocabulary($term->vid); // show topics with the correct tid, or in the forum but with shadow = 1 - $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid"; + $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = '". check_query($tid) ."' AND f.shadow = 1) OR f.tid = '". check_query($tid) ."') AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid"; $sql .= tablesort_sql($forum_topic_list_header); $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {term_node} r ON n.nid = r.nid WHERE n.nid = r.nid AND ( (r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum'"; @@ -400,7 +391,7 @@ function _forum_new($tid) { $read[] = $r->nid; } - $nid = db_result(db_query_range("SELECT n.nid FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid WHERE n.type = 'forum' AND f.nid = n.nid AND n.status = 1 AND f.tid = %d ".($read ? "AND NOT (n.nid IN (".implode(",", $read).")) " : "") ."ORDER BY created", $tid, 0, 1)); + $nid = db_result(db_query_range("SELECT n.nid FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid WHERE n.type = 'forum' AND f.nid = n.nid AND n.status = 1 AND f.tid = %d ". ($read ? "AND NOT (n.nid IN (". implode(",", $read) .")) " : "") ."ORDER BY created", $tid, 0, 1)); return $nid ? $nid : 0; } @@ -428,7 +419,7 @@ function forum_page() { } if (empty($sortby)) { - $sortby = isset($user->sortby) ? $user->sortby : variable_get("forum_order",1); + $sortby = isset($user->sortby) ? $user->sortby : variable_get("forum_order", 1); } if (empty($forum_per_page)) { @@ -529,7 +520,7 @@ function forum_theme_list($forums, $parents, $tid) { if ($links) { $description .= " <div class=\"navigation\">". t("Jump to: %links", array("%links" => implode(", ", $links))) .".</div>\n"; } - $description .="</div>\n"; + $description .= "</div>\n"; $rows[] = array( array("data" => $description, "class" => "description"), @@ -601,7 +592,7 @@ function _forum_icon($new_posts, $num_posts = 0, $comment_mode = 0) { } // default - $file = $base_path."/forum-$icon.gif"; + $file = $base_path ."/forum-$icon.gif"; return "<img src=\"$file\" alt=\"\" title=\"\" />"; } @@ -647,17 +638,17 @@ function forum_help($section = "admin/forum/help") { case 'admin/forum/help': $output .= "<h3>Creating a forum</h3>"; $output .= "<p>The forum module uses taxonomy to organize itself. To create a forum you first have to create a %taxonomy. When doing this, choose a sensible name for it (such as \"fora\") and make sure under \"Types\" that \"forum\" is selected. Once you have done this, %taxo-terms to it. Each term will become a forum. If you fill in the description field, users will be given additonal information about the forum on the main forum page. For example: \"troubleshooting\" - \"Please ask your questions here.\"</p>"; - $output .= "<p>When you are happy with your vocabulary, go to ". l("site configuration » modules » forum","admin/system/modules/forum") ." and set <b>Forum vocabulary</b> to the one you have just created. There will now be fora active on the site. For users to access them they must have the \"access content\" %permission and to create a topic they must have the \"create forum topics\" %permission. These permissions can be set in the %permission pages.</p>"; + $output .= "<p>When you are happy with your vocabulary, go to %forums and set <b>Forum vocabulary</b> to the one you have just created. There will now be fora active on the site. For users to access them they must have the \"access content\" %permission and to create a topic they must have the \"create forum topics\" %permission. These permissions can be set in the %permission pages.</p>"; $output .= "<h4>Icons</h4>"; $output .= "<p>To disable icons, set the icon path as blank in %forums.</p>"; $output .= "<p>All files in the icon directory are assumed to be images. You may use images of whatever size you wish, but it is recommended to use 15x15 or 16x16.</p>"; - $output = t($output, array("%taxonomy" => l(t("taxonomy vocabulary"), "admin/taxonomy/add/vocabulary"), "%taxo-terms" => l(t("add some terms"), "admin/taxonomy"), "%forums" => l(t("site configutation » modules » forum"), "admin/system/modules/forum"), "%permission" => l(t("permission"), "admin/user/permission") )); + $output = t($output, array("%taxonomy" => l(t("taxonomy vocabulary"), "admin/taxonomy/add/vocabulary"), "%taxo-terms" => l(t("add some terms"), "admin/taxonomy"), "%forums" => l(t("site configutation » modules » forum"), "admin/system/modules/forum"), "%permission" => l(t("permission"), "admin/user/permission"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enable threaded discussions about general topics."); break; case 'admin/system/modules/forum': - $output = t("Forums are threaded discussions based on the taxonomy system so you must first %taxonomy-create of type \"forum\" to place the forum tree in. Then %taxonomy-add to this taxonomy. Each term becomes the name of a forum. If you define a term as a \"Container\" (See below) the term is not a forum itself, but rather holds forms. This lets you group your forums.", array("%taxonomy-create" => l(t("create a taxonomy"), "admin/taxonomy/add/vocabulary"), "%taxonomy" => l(t("add terms"), "admin/taxonomy") )); + $output = t("Forums are threaded discussions based on the taxonomy system so you must first %taxonomy-create of type \"forum\" to place the forum tree in. Then %taxonomy-add to this taxonomy. Each term becomes the name of a forum. If you define a term as a \"Container\" (See below) the term is not a forum itself, but rather holds forms. This lets you group your forums.", array("%taxonomy-create" => l(t("create a taxonomy"), "admin/taxonomy/add/vocabulary"), "%taxonomy" => l(t("add terms"), "admin/taxonomy"))); break; } diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 99dbec746..0edd25244 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -1,15 +1,6 @@ <?php // $Id$ -function forum_system($field){ - $output = ""; - - if ($field == "description") { $output = forum_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = forum_help("admin/system/modules/forum"); }; - - return $output; -} - function forum_node($field) { $info["name"] = t("forum topic"); $info["description"] = t("A forum is a threaded discussion, enabling users to communicate about a particular topic."); @@ -42,7 +33,7 @@ function forum_settings() { $output .= form_textarea(t("Explanation or submission guidelines"), "forum_help", variable_get("forum_help", ""), 70, 5, t("This text will be displayed at the top of the forum submission form. Useful for helping or instructing your users.")); $output .= form_select(t("Forum vocabulary"), "forum_nav_vocabulary", variable_get("forum_nav_vocabulary", ""), $vocs, t("The taxonomy vocabulary that will be used as the navigation tree.")); $output .= form_textfield(t("Forum icon path"), "forum_icon_path", variable_get("forum_icon_path", ""), 30, 255, t("The path to the forum icons. Leave blank to disable icons. Don't add a trailing slash. Default icons are available in the 'misc' directory.")); - $number = array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 50 => 50, 60 => 60, 80 => 80, 100 => 100, 10000=>10000); + $number = array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 50 => 50, 60 => 60, 80 => 80, 100 => 100, 10000 => 10000); $output .= form_select(t("Hot topic threshold"), "forum_hot_topic", variable_get("forum_hot_topic", 15), $number, t("The number of posts a topic must have to be considered <b>hot</b>.")); $number = array(10 => 10, 25 => 25, 50 => 50, 75 => 75, 100 => 100); $output .= form_select(t("Topics per page"), "forum_per_page", variable_get("forum_per_page", 25), $number, t("The default number of topics displayed per page; links to browse older messages are automatically being displayed.")); @@ -110,7 +101,7 @@ function forum_link($type, $node = 0, $main = 0) { if (!$main && $type == "node" && $node->type == "forum") { // get previous and next topic - $result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid); + $result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order", 1)), $node->tid); while ($topic = db_fetch_object($result)) { if ($stop == 1) { @@ -130,11 +121,11 @@ function forum_link($type, $node = 0, $main = 0) { } if ($prev) { - $links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100)."...")); + $links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100) ."...")); } if ($next) { - $links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100)."...")); + $links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100) ."...")); } } @@ -161,7 +152,7 @@ function forum_view($node, $main = 0) { $breadcrumb[] = l(t("Forums"), "forum"); $breadcrumb[] = l($term_data->name, "forum/$term_data->tid"); // print the breadcrumb - theme("breadcrumb",$breadcrumb); + theme("breadcrumb", $breadcrumb); } // prepair the node content $node = forum_content($node); @@ -330,13 +321,13 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { $forum_topic_list_header = array( array("data" => " "), array("data" => t("Topic"), "field" => "n.title"), - array("data" => t("Replies"),"field" => "num_comments"), + array("data" => t("Replies"), "field" => "num_comments"), array("data" => t("Created"), "field" => "n.created"), array("data" => t("Last reply"), "field" => "date_sort", "sort" => "desc"), ); $sql_sortby = _forum_get_topic_order($sortby); - for ($i=0; $i < count($forum_topic_list_header); $i++) { + for ($i = 0; $i < count($forum_topic_list_header); $i++) { if ($forum_topic_list_header[$i]["field"] == $sql_sortby) { $forum_topic_list_header[$i]["order"] = $sql_sortby; } @@ -346,7 +337,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { $voc = taxonomy_get_vocabulary($term->vid); // show topics with the correct tid, or in the forum but with shadow = 1 - $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid"; + $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = '". check_query($tid) ."' AND f.shadow = 1) OR f.tid = '". check_query($tid) ."') AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid"; $sql .= tablesort_sql($forum_topic_list_header); $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {term_node} r ON n.nid = r.nid WHERE n.nid = r.nid AND ( (r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum'"; @@ -400,7 +391,7 @@ function _forum_new($tid) { $read[] = $r->nid; } - $nid = db_result(db_query_range("SELECT n.nid FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid WHERE n.type = 'forum' AND f.nid = n.nid AND n.status = 1 AND f.tid = %d ".($read ? "AND NOT (n.nid IN (".implode(",", $read).")) " : "") ."ORDER BY created", $tid, 0, 1)); + $nid = db_result(db_query_range("SELECT n.nid FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid WHERE n.type = 'forum' AND f.nid = n.nid AND n.status = 1 AND f.tid = %d ". ($read ? "AND NOT (n.nid IN (". implode(",", $read) .")) " : "") ."ORDER BY created", $tid, 0, 1)); return $nid ? $nid : 0; } @@ -428,7 +419,7 @@ function forum_page() { } if (empty($sortby)) { - $sortby = isset($user->sortby) ? $user->sortby : variable_get("forum_order",1); + $sortby = isset($user->sortby) ? $user->sortby : variable_get("forum_order", 1); } if (empty($forum_per_page)) { @@ -529,7 +520,7 @@ function forum_theme_list($forums, $parents, $tid) { if ($links) { $description .= " <div class=\"navigation\">". t("Jump to: %links", array("%links" => implode(", ", $links))) .".</div>\n"; } - $description .="</div>\n"; + $description .= "</div>\n"; $rows[] = array( array("data" => $description, "class" => "description"), @@ -601,7 +592,7 @@ function _forum_icon($new_posts, $num_posts = 0, $comment_mode = 0) { } // default - $file = $base_path."/forum-$icon.gif"; + $file = $base_path ."/forum-$icon.gif"; return "<img src=\"$file\" alt=\"\" title=\"\" />"; } @@ -647,17 +638,17 @@ function forum_help($section = "admin/forum/help") { case 'admin/forum/help': $output .= "<h3>Creating a forum</h3>"; $output .= "<p>The forum module uses taxonomy to organize itself. To create a forum you first have to create a %taxonomy. When doing this, choose a sensible name for it (such as \"fora\") and make sure under \"Types\" that \"forum\" is selected. Once you have done this, %taxo-terms to it. Each term will become a forum. If you fill in the description field, users will be given additonal information about the forum on the main forum page. For example: \"troubleshooting\" - \"Please ask your questions here.\"</p>"; - $output .= "<p>When you are happy with your vocabulary, go to ". l("site configuration » modules » forum","admin/system/modules/forum") ." and set <b>Forum vocabulary</b> to the one you have just created. There will now be fora active on the site. For users to access them they must have the \"access content\" %permission and to create a topic they must have the \"create forum topics\" %permission. These permissions can be set in the %permission pages.</p>"; + $output .= "<p>When you are happy with your vocabulary, go to %forums and set <b>Forum vocabulary</b> to the one you have just created. There will now be fora active on the site. For users to access them they must have the \"access content\" %permission and to create a topic they must have the \"create forum topics\" %permission. These permissions can be set in the %permission pages.</p>"; $output .= "<h4>Icons</h4>"; $output .= "<p>To disable icons, set the icon path as blank in %forums.</p>"; $output .= "<p>All files in the icon directory are assumed to be images. You may use images of whatever size you wish, but it is recommended to use 15x15 or 16x16.</p>"; - $output = t($output, array("%taxonomy" => l(t("taxonomy vocabulary"), "admin/taxonomy/add/vocabulary"), "%taxo-terms" => l(t("add some terms"), "admin/taxonomy"), "%forums" => l(t("site configutation » modules » forum"), "admin/system/modules/forum"), "%permission" => l(t("permission"), "admin/user/permission") )); + $output = t($output, array("%taxonomy" => l(t("taxonomy vocabulary"), "admin/taxonomy/add/vocabulary"), "%taxo-terms" => l(t("add some terms"), "admin/taxonomy"), "%forums" => l(t("site configutation » modules » forum"), "admin/system/modules/forum"), "%permission" => l(t("permission"), "admin/user/permission"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enable threaded discussions about general topics."); break; case 'admin/system/modules/forum': - $output = t("Forums are threaded discussions based on the taxonomy system so you must first %taxonomy-create of type \"forum\" to place the forum tree in. Then %taxonomy-add to this taxonomy. Each term becomes the name of a forum. If you define a term as a \"Container\" (See below) the term is not a forum itself, but rather holds forms. This lets you group your forums.", array("%taxonomy-create" => l(t("create a taxonomy"), "admin/taxonomy/add/vocabulary"), "%taxonomy" => l(t("add terms"), "admin/taxonomy") )); + $output = t("Forums are threaded discussions based on the taxonomy system so you must first %taxonomy-create of type \"forum\" to place the forum tree in. Then %taxonomy-add to this taxonomy. Each term becomes the name of a forum. If you define a term as a \"Container\" (See below) the term is not a forum itself, but rather holds forms. This lets you group your forums.", array("%taxonomy-create" => l(t("create a taxonomy"), "admin/taxonomy/add/vocabulary"), "%taxonomy" => l(t("add terms"), "admin/taxonomy"))); break; } diff --git a/modules/help.module b/modules/help.module index 953c11fde..cfb5e846d 100644 --- a/modules/help.module +++ b/modules/help.module @@ -1,18 +1,10 @@ <?php // $Id$ -function help_system($field){ - $output = ""; - - if ($field == "description") {$output = admin_help("admin/system/modules"); }; - - return $output; -} - function help_link($type) { if ($type == "system" && user_access("access administration pages")) { menu("admin/help/glossary", t("glossary"), "help_glossary", NULL, 8); - menu("admin/help", t("help"), "help_admin", NULL, 9); + menu("admin/help", t("help"), "help_help", NULL, 9); } } @@ -39,7 +31,7 @@ function help_glossary() { return $output; } -function help_admin($section = "admin/help") { +function help_help($section = "admin/help") { $output = ""; switch ($section) { @@ -57,9 +49,8 @@ function help_admin($section = "admin/help") { } $output = "<small>". implode(" · ", $links) ."</small><hr />". $output; break; - - case 'admin/system/modules': - $out = t("Manages displaying online help."); + case 'admin/system/modules#description': + $output = t("Manages displaying online help."); break; } return $output; diff --git a/modules/help/help.module b/modules/help/help.module index 953c11fde..cfb5e846d 100644 --- a/modules/help/help.module +++ b/modules/help/help.module @@ -1,18 +1,10 @@ <?php // $Id$ -function help_system($field){ - $output = ""; - - if ($field == "description") {$output = admin_help("admin/system/modules"); }; - - return $output; -} - function help_link($type) { if ($type == "system" && user_access("access administration pages")) { menu("admin/help/glossary", t("glossary"), "help_glossary", NULL, 8); - menu("admin/help", t("help"), "help_admin", NULL, 9); + menu("admin/help", t("help"), "help_help", NULL, 9); } } @@ -39,7 +31,7 @@ function help_glossary() { return $output; } -function help_admin($section = "admin/help") { +function help_help($section = "admin/help") { $output = ""; switch ($section) { @@ -57,9 +49,8 @@ function help_admin($section = "admin/help") { } $output = "<small>". implode(" · ", $links) ."</small><hr />". $output; break; - - case 'admin/system/modules': - $out = t("Manages displaying online help."); + case 'admin/system/modules#description': + $output = t("Manages displaying online help."); break; } return $output; diff --git a/modules/import.module b/modules/import.module index 8d47d238f..956e266bf 100644 --- a/modules/import.module +++ b/modules/import.module @@ -51,32 +51,22 @@ function import_help($section = "admin/import/help") { $output .= "</ul>"; $output .= "<h3>RSS feed blocks</h3>"; $output .= "<p>In addition to providing subscribed content through the news aggregator, Drupal automatically creates a block for each subscribed feed and every bundle created. Beside each headline in each block, Drupal includes an icon which acts a blog it link. Enable any or all of the blocks using block management.</p>"; - $output = t($output, array( - "%amphetadesk" => "<a href=\"http://www.disobey.com/amphetadesk/\">AmphetaDesk</a>", - "%rss" => "<a href=\"http://groups.yahoo.com/group/rss-dev/files/specification.html\">Rich Site Summary</a>", - "%slashdot-rss" => "<a href=\"http://slashdot.org/slashdot.rdf\">http://slashdot.org/slashdot.rfd</a>", - "%syndic8" => "<a href=\"http://www.syndic8.com/\">Syndic8</a>", - "%rss-what" => "<a href=\"http://www.xml.com/pub/a/2002/12/18/dive-into-xml.html\">What is RSS</a>", - "%rss-evolution" => "<a href=\"http://www.webreference.com/authoring/languages/xml/rss/1/\">The Evolution of RSS</a>", - "%admin-news" => l(t("RSS/RDF"), "admin/node/syndication/news"), - "%new-feed" => l(t("new feed"), "admin/node/syndication/news/add/feed"), - "%update-items" => l(t("update items"), "admin/node/syndication/news"), - )); + $output = t($output, array("%amphetadesk" => "<a href=\"http://www.disobey.com/amphetadesk/\">AmphetaDesk</a>", "%rss" => "<a href=\"http://groups.yahoo.com/group/rss-dev/files/specification.html\">Rich Site Summary</a>", "%slashdot-rss" => "<a href=\"http://slashdot.org/slashdot.rdf\">http://slashdot.org/slashdot.rfd</a>", "%syndic8" => "<a href=\"http://www.syndic8.com/\">Syndic8</a>", "%rss-what" => "<a href=\"http://www.xml.com/pub/a/2002/12/18/dive-into-xml.html\">What is RSS</a>", "%rss-evolution" => "<a href=\"http://www.webreference.com/authoring/languages/xml/rss/1/\">The Evolution of RSS</a>", "%admin-news" => l(t("RSS/RDF"), "admin/node/syndication/news"), "%new-feed" => l(t("new feed"), "admin/node/syndication/news/add/feed"), "%update-items" => l(t("update items"), "admin/node/syndication/news"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Used to aggregate syndicated content (RSS and RDF)."); break; case 'admin/system/modules/import': $output = t("Drupal's news aggregator controls how many RSS/RDF items from a single source are displayed in a \"Block\", and on the page that goes with that block."); break; case 'admin/node/syndication/news': - $output = t("Several web sites, especially news related sites, syndicate parts of their site's content for other web sites to display. Usually, the syndicated content includes the latest headlines with a direct link to that story on the remote site. Some syndicated content also includes a description of the headline. The standard method of syndication is using the XML based Rich Site Summary (RSS). To get a feed to work you <b>must</b> run \"cron.php\". To display the feed in a block you must turn on the %block. <br /><ul><li>To delete a feed choose \"edit feed\"</li><li>To clear all of the entries from a feed choose \"Remove items\"</li><li>To check whether a feed is working, and to get new items <b>now</b> click on \"update items\"</li></ul><ul><li>To delete a bundle choose \"edit bundle\".</li></ul>", array("%block" => l(t("feed's block"), "admin/system/block") )); + $output = t("Several web sites, especially news related sites, syndicate parts of their site's content for other web sites to display. Usually, the syndicated content includes the latest headlines with a direct link to that story on the remote site. Some syndicated content also includes a description of the headline. The standard method of syndication is using the XML based Rich Site Summary (RSS). To get a feed to work you <b>must</b> run \"cron.php\". To display the feed in a block you must turn on the %block. <br /><ul><li>To delete a feed choose \"edit feed\"</li><li>To clear all of the entries from a feed choose \"Remove items\"</li><li>To check whether a feed is working, and to get new items <b>now</b> click on \"update items\"</li></ul><ul><li>To delete a bundle choose \"edit bundle\".</li></ul>", array("%block" => l(t("feed's block"), "admin/system/block"))); break; case 'admin/node/syndication/news/add/feed': - $output = t("Add a site that has an RSS/RDF feed. The URL is the full path to the RSS feed file. For the feed to update automatically you must run \"cron.php\". The \"Attributes\" are used to bundle this feed with other feeds (See %bundle), and to tag articles from this feed.<br />Note: 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.", array("%bundle" => l(t("add new bundle"), "admin/node/syndication/news/add/bundle") )); + $output = t("Add a site that has an RSS/RDF feed. The URL is the full path to the RSS feed file. For the feed to update automatically you must run \"cron.php\". The \"Attributes\" are used to bundle this feed with other feeds (See %bundle), and to tag articles from this feed.<br />Note: 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.", array("%bundle" => l(t("add new bundle"), "admin/node/syndication/news/add/bundle"))); break; case 'admin/node/syndication/news/add/bundle': - $output = t("Bundles provide a generalized way of creating composite feeds. They allow you, for example, to combine various sport-related feeds into one bundle called <i>Sport</i>. If an article from a feed has been \"tag\"-ged (See %tag too look at and change tags.) with a matching \"Attribute\" then it will be added to the bundle.", array("%tag" => l(t("tag news item"), "admin/node/syndication/news/tag") )); + $output = t("Bundles provide a generalized way of creating composite feeds. They allow you, for example, to combine various sport-related feeds into one bundle called <i>Sport</i>. If an article from a feed has been \"tag\"-ged (See %tag too look at and change tags.) with a matching \"Attribute\" then it will be added to the bundle.", array("%tag" => l(t("tag news item"), "admin/node/syndication/news/tag"))); break; case 'admin/node/syndication/news/tag': $output = t("This allows you to see and change an news item's \"tag\". All articles are originally tagged with the \"Attributes\" of their feed."); @@ -86,15 +76,6 @@ function import_help($section = "admin/import/help") { return $output; } -function import_system($field){ - $output = ""; - - $system["description"] = import_help("admin/system/modules"); - $system["admin_help"] = import_help("admin/system/modules/import"); - - return $system[$field]; -} - function import_settings() { $number = array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 45 => 45, 50 => 50, 55 => 55, 60 => 60, 65 => 65, 70 => 70, 75 => 75, 80 => 80, 85 => 85, 90 => 90, 95 => 95, 100 => 100); $output .= form_select(t("Items per block"), "import_block_limit", variable_get("import_block_limit", 15), $number, t("The maximum number of news items displayed in one block.")); @@ -119,7 +100,7 @@ function import_link($type) { if (user_access("administer news feeds")) { menu("admin/node/syndication", t("syndication"), NULL, NULL, 5); - menu("admin/node/syndication/news", t("RSS/RDF"), "import_admin", import_help("admin/node/syndication/news") ); + menu("admin/node/syndication/news", t("RSS/RDF"), "import_admin", import_help("admin/node/syndication/news")); menu("admin/node/syndication/news/add/feed", t("new feed"), "import_admin", import_help("admin/node/syndication/news/add/feed"), 2); menu("admin/node/syndication/news/add/bundle", t("new bundle"), "import_admin", import_help("admin/node/syndication/news/add/bundle"), 3); menu("admin/node/syndication/news/tag", t("tag items"), "import_admin", import_help("admin/node/syndication/news/tag"), 4); @@ -535,7 +516,7 @@ function import_get_bundle($bid) { function import_view() { $result = db_query("SELECT f.*, COUNT(i.iid) AS items FROM {feed} f LEFT JOIN {item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.timestamp, f.attributes, f.link, f.description ORDER BY f.title"); - $output .= "<h3>". t("Feed overview"). "</h3>"; + $output .= "<h3>". t("Feed overview") ."</h3>"; $header = array(t("title"), t("attributes"), t("items"), t("last update"), t("next update"), array("data" => t("operations"), "colspan" => 3)); unset($rows); @@ -546,7 +527,7 @@ function import_view() { $result = db_query("SELECT * FROM {bundle} ORDER BY title"); - $output .= "<h3>". t("Bundle overview"). "</h3>"; + $output .= "<h3>". t("Bundle overview") ."</h3>"; $header = array(t("title"), t("attributes"), t("operations")); unset($rows); @@ -568,7 +549,7 @@ function import_tag() { } $output .= table($header, $rows); - $output .= "<input type=\"submit\" name=\"op\" value=\"" . t("Save attributes") . "\" />\n"; + $output .= "<input type=\"submit\" name=\"op\" value=\"". t("Save attributes") ."\" />\n"; return form($output); } @@ -768,7 +749,7 @@ function import_page_sources() { $output .= "<div style=\"margin-left: 20px;\">$feed->description</div><br />"; } - $output .= "<div style=\"text-align: right\">" . l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) . "</div><br />"; + $output .= "<div style=\"text-align: right\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />"; theme("header"); theme("box", t("News feeds"), import_page_info()); diff --git a/modules/jabber.module b/modules/jabber.module index e9c4d7cc8..7d31bf17b 100644 --- a/modules/jabber.module +++ b/modules/jabber.module @@ -1,9 +1,25 @@ <?php // $Id$ -function jabber_system($field){ - $system["description"] = t("Enables login with Jabber ID and password."); - return $system[$field]; +function jabber_help($section) { + $output = ""; + + switch ($section) { + case 'admin/system/modules#description': + $output = t("Enables login with Jabber ID and password."); + break; + + case 'user/help': + $site = variable_get("site_name", "this web site"); + + $output = "<p>%jabber is an %opensource instant messaging system designed to give the power of choice and freedom back to the users of instant messaging. Not only does Jabber allow its users to use (and create) clients for numerous platforms, but it allows people to communicate to whomever they want in the way which is most convenient for them.</p>"; + $output .= "<p>You may login to %site using a <b>Jabber ID</b>. The format of a Jabber ID is the same as an email address: <b>name</b>@<i>server</i> An example of valid Jabber ID is <b>mwlily</b>@<i>jabber.com</i>. Note that you must be able to access port 111 on the Jabber server from your web server. For example, sourceforge.net blocks port 111 so Jabber authentication does not work.</p>"; + + $output = t($output, array("%jabber" => "a <href=\"http://www.jabber.org/\">Jabber</a>", "%opensource" => "<a href=\"http://www.opensouce.org\">". t("open source") ."</a>", "%site" => "<i>$site</i>")); + break; + } + + return $output; } function jabber_info($field = 0) { @@ -146,21 +162,11 @@ function jabber_auth($username, $password, $server) { function jabber_page() { - theme("header"); - theme("box", "Jabber", jabber_auth_help()); + theme("box", "Jabber", jabber_help("user/help")); theme("footer"); } -function jabber_auth_help() { - $site = variable_get("site_name", "this web site"); - - $output = "<p><a href=\"http://www.jabber.org/\">Jabber</a> is an <a href=\"http://www.opensource.org\">open source</a> instant messaging system designed to give the power of choice and freedom back to the users of instant messaging. Not only does Jabber allow its users to use (and create) clients for numerous platforms, but it allows people to communicate to whomever they want in the way which is most convenient for them.</p>"; - $output .= "<p>You may login to %s using a <b>Jabber ID</b>. The format of a Jabber ID is the same as an email address: <b>name</b>@<i>server</i> An example of valid Jabber ID is <b>mwlily</b>@<i>jabber.com</i>. Note that you must be able to access port 111 on the Jabber server from your web server. For example, sourceforge.net blocks port 111 so Jabber authentication does not work.</p>"; - - return t($output, array("%s" => "<i>$site</i>")); -} - function jabber_user($type, $edit, $user) { $module = "jabber"; $name = module_invoke($module, "info", "name"); diff --git a/modules/locale.module b/modules/locale.module index b57c321b5..faecd98b5 100644 --- a/modules/locale.module +++ b/modules/locale.module @@ -4,7 +4,7 @@ function locale_help($section = "admin/locale/help") { $output = ""; - switch($section) { + switch ($section) { case 'admin/help': case 'admin/locale/help': $output .= "<p>Most programs are written and documented in English, and use English to interact with users. This is also true for a great deal of web sites. However, most people are less comfortable with English than with their native language, and would prefer to use their mother tongue as much as possible. Many people love see their web site showing a lot less English, and far more of their own language.</p>"; @@ -33,9 +33,9 @@ function locale_help($section = "admin/locale/help") { mysql> ALTER TABLE {locales} ADD nl TEXT DEFAULT '' NOT NULL; mysql> ALTER TABLE {locales} ADD fr TEXT DEFAULT '' NOT NULL; </pre>"; - $output = t($output, array("%overview" => l(t("overview"), "admin/locale") )); + $output = t($output, array("%overview" => l(t("overview"), "admin/locale"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables the translation of the user interface to languages other than English."); break; case 'admin/locale': @@ -55,14 +55,6 @@ function locale_help($section = "admin/locale/help") { return $output; } -function locale_system($field){ - $output = ""; - - if ($field == "description") { $output = locale_help("admin/system/modules"); } - - return $output; -} - function locale_perm() { return array("administer locales"); } diff --git a/modules/locale/locale.module b/modules/locale/locale.module index b57c321b5..faecd98b5 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -4,7 +4,7 @@ function locale_help($section = "admin/locale/help") { $output = ""; - switch($section) { + switch ($section) { case 'admin/help': case 'admin/locale/help': $output .= "<p>Most programs are written and documented in English, and use English to interact with users. This is also true for a great deal of web sites. However, most people are less comfortable with English than with their native language, and would prefer to use their mother tongue as much as possible. Many people love see their web site showing a lot less English, and far more of their own language.</p>"; @@ -33,9 +33,9 @@ function locale_help($section = "admin/locale/help") { mysql> ALTER TABLE {locales} ADD nl TEXT DEFAULT '' NOT NULL; mysql> ALTER TABLE {locales} ADD fr TEXT DEFAULT '' NOT NULL; </pre>"; - $output = t($output, array("%overview" => l(t("overview"), "admin/locale") )); + $output = t($output, array("%overview" => l(t("overview"), "admin/locale"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables the translation of the user interface to languages other than English."); break; case 'admin/locale': @@ -55,14 +55,6 @@ function locale_help($section = "admin/locale/help") { return $output; } -function locale_system($field){ - $output = ""; - - if ($field == "description") { $output = locale_help("admin/system/modules"); } - - return $output; -} - function locale_perm() { return array("administer locales"); } diff --git a/modules/node.module b/modules/node.module index 5b495e145..995521a73 100644 --- a/modules/node.module +++ b/modules/node.module @@ -31,26 +31,26 @@ function node_help($section = "admin/node/help") { $output .= "<dt>Published</dt><dd>When using Drupal's moderation system a node remains unpublished -- unavaliable to non-moderators -- until it is marked Published.</dd></dl>"; $output .= "<p>Now that you know what is in a node, here are some of the types of nodes available.</p>"; - $output = t($output, array("%teaser" => l(t("click here"), "admin/system/modules/node"), "%queue" => l(t("click here"), "admin/system/modules/queue") )); + $output = t($output, array("%teaser" => l(t("click here"), "admin/system/modules/node"), "%queue" => l(t("click here"), "admin/system/modules/queue"))); if ($mod == "admin") { foreach (module_list() as $name) { if (module_hook($name, "node") && $name != "node") { - $output .= "<h3>". t("Node type: %module", array("%module" => module_invoke($name, "node", "name"))). "</h3>"; + $output .= "<h3>". t("Node type: %module", array("%module" => module_invoke($name, "node", "name"))) ."</h3>"; $output .= module_invoke($name, "node", "description"); } } } break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("The core that allows content to be submitted to the site."); break; case 'admin/system/modules/node': $output = t("Settings for the core of Drupal. Almost everything is a node so these settings will affect most of the site."); break; case 'admin/node': - $output = t("Below is a list of all of the nodes in your site. Other forms of content are listed elsewhere (e.g. %comment).<br />Clicking a title views that node, while clicking an author's name edits their user information.<br />Other node-related tasks are available from the menu on the left.",array("%comments" => l(t("comments"), "admin/comment") )); + $output = t("Below is a list of all of the nodes in your site. Other forms of content are listed elsewhere (e.g. %comment).<br />Clicking a title views that node, while clicking an author's name edits their user information.<br />Other node-related tasks are available from the menu on the left.", array("%comments" => l(t("comments"), "admin/comment"))); break; case 'admin/node/search': $output = t("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\"."); @@ -64,15 +64,6 @@ function node_help($section = "admin/node/help") { return $output; } -function node_system($field){ - $output = ""; - - if ($field == "description") {$output = node_help("admin/system/modules"); } - else if ($field == "admin_help") {$output = node_help("admin/system/modules/node");}; - - return $output; -} - /* ** Accepts a DB result object which can be used to fetch node objects. ** Returns an HTML list suitable as content for a block. @@ -464,7 +455,7 @@ function node_access($op, $node = 0) { // Can't use node_invoke: // the access hook takes the $op parameter before the $node parameter. - return module_invoke ($type, "access", $op, $node); + return module_invoke($type, "access", $op, $node); } function node_perm() { @@ -698,7 +689,7 @@ function node_admin_nodes() { */ $result = pager_query("SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid ". $filters[$filter][1], 50); - $header = array(NULL, t("title"), t("type"), t("author"), t("status"), array ("data" => t("operations"), "colspan" => 2)); + $header = array(NULL, t("title"), t("type"), t("author"), t("status"), array("data" => t("operations"), "colspan" => 2)); while ($node = db_fetch_object($result)) { $rows[] = array(form_checkbox(NULL, "status][$node->nid", 1, 0), l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme_mark() : ""), module_invoke($node->type, "node", "name"), format_name($node), ($node->status ? t("published") : t("not published")), l(t("edit node"), "admin/node/edit/$node->nid"), l(t("delete node"), "admin/node/delete/$node->nid")); diff --git a/modules/node/node.module b/modules/node/node.module index 5b495e145..995521a73 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -31,26 +31,26 @@ function node_help($section = "admin/node/help") { $output .= "<dt>Published</dt><dd>When using Drupal's moderation system a node remains unpublished -- unavaliable to non-moderators -- until it is marked Published.</dd></dl>"; $output .= "<p>Now that you know what is in a node, here are some of the types of nodes available.</p>"; - $output = t($output, array("%teaser" => l(t("click here"), "admin/system/modules/node"), "%queue" => l(t("click here"), "admin/system/modules/queue") )); + $output = t($output, array("%teaser" => l(t("click here"), "admin/system/modules/node"), "%queue" => l(t("click here"), "admin/system/modules/queue"))); if ($mod == "admin") { foreach (module_list() as $name) { if (module_hook($name, "node") && $name != "node") { - $output .= "<h3>". t("Node type: %module", array("%module" => module_invoke($name, "node", "name"))). "</h3>"; + $output .= "<h3>". t("Node type: %module", array("%module" => module_invoke($name, "node", "name"))) ."</h3>"; $output .= module_invoke($name, "node", "description"); } } } break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("The core that allows content to be submitted to the site."); break; case 'admin/system/modules/node': $output = t("Settings for the core of Drupal. Almost everything is a node so these settings will affect most of the site."); break; case 'admin/node': - $output = t("Below is a list of all of the nodes in your site. Other forms of content are listed elsewhere (e.g. %comment).<br />Clicking a title views that node, while clicking an author's name edits their user information.<br />Other node-related tasks are available from the menu on the left.",array("%comments" => l(t("comments"), "admin/comment") )); + $output = t("Below is a list of all of the nodes in your site. Other forms of content are listed elsewhere (e.g. %comment).<br />Clicking a title views that node, while clicking an author's name edits their user information.<br />Other node-related tasks are available from the menu on the left.", array("%comments" => l(t("comments"), "admin/comment"))); break; case 'admin/node/search': $output = t("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\"."); @@ -64,15 +64,6 @@ function node_help($section = "admin/node/help") { return $output; } -function node_system($field){ - $output = ""; - - if ($field == "description") {$output = node_help("admin/system/modules"); } - else if ($field == "admin_help") {$output = node_help("admin/system/modules/node");}; - - return $output; -} - /* ** Accepts a DB result object which can be used to fetch node objects. ** Returns an HTML list suitable as content for a block. @@ -464,7 +455,7 @@ function node_access($op, $node = 0) { // Can't use node_invoke: // the access hook takes the $op parameter before the $node parameter. - return module_invoke ($type, "access", $op, $node); + return module_invoke($type, "access", $op, $node); } function node_perm() { @@ -698,7 +689,7 @@ function node_admin_nodes() { */ $result = pager_query("SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid ". $filters[$filter][1], 50); - $header = array(NULL, t("title"), t("type"), t("author"), t("status"), array ("data" => t("operations"), "colspan" => 2)); + $header = array(NULL, t("title"), t("type"), t("author"), t("status"), array("data" => t("operations"), "colspan" => 2)); while ($node = db_fetch_object($result)) { $rows[] = array(form_checkbox(NULL, "status][$node->nid", 1, 0), l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme_mark() : ""), module_invoke($node->type, "node", "name"), format_name($node), ($node->status ? t("published") : t("not published")), l(t("edit node"), "admin/node/edit/$node->nid"), l(t("delete node"), "admin/node/delete/$node->nid")); diff --git a/modules/page.module b/modules/page.module index 5826402ac..d7bdc3a3b 100644 --- a/modules/page.module +++ b/modules/page.module @@ -11,7 +11,7 @@ function page_help($section = "admin/page/help") { $output .= "<p>Site pages, unlike many other forms of Drupal content, may be made of PHP code in addition to HTML and text. All Drupal objects and functions are available to a site administrator.</p>"; $output = t($output); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables the creation of a static pages that can be added to the navigation system."); break; @@ -20,14 +20,6 @@ function page_help($section = "admin/page/help") { return $output; } -function page_system($field) { - $output = ""; - - if ($field == "description") {$output = page_help("admin/system/modules"); }; - - return $output; -} - function page_perm() { return array("maintain static pages"); } diff --git a/modules/page/page.module b/modules/page/page.module index 5826402ac..d7bdc3a3b 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -11,7 +11,7 @@ function page_help($section = "admin/page/help") { $output .= "<p>Site pages, unlike many other forms of Drupal content, may be made of PHP code in addition to HTML and text. All Drupal objects and functions are available to a site administrator.</p>"; $output = t($output); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables the creation of a static pages that can be added to the navigation system."); break; @@ -20,14 +20,6 @@ function page_help($section = "admin/page/help") { return $output; } -function page_system($field) { - $output = ""; - - if ($field == "description") {$output = page_help("admin/system/modules"); }; - - return $output; -} - function page_perm() { return array("maintain static pages"); } diff --git a/modules/path.module b/modules/path.module index 1e4d428f7..7fed2cf71 100644 --- a/modules/path.module +++ b/modules/path.module @@ -1,13 +1,6 @@ <?php /* $Id$ */ -function path_system($field) { - $system["description"] = path_help("admin/system/modules"); - $system["admin_help"] = path_help("admin/system/modules/path"); - - return $system[$field]; -} - function path_admin() { $op = strtolower($_POST["op"]); $edit = $_POST["edit"]; @@ -111,27 +104,30 @@ function path_form($edit = "", $error = "") { } function path_help($section = "admin/path/help") { + $output = ""; + switch ($section) { - case "admin/system/modules": - $output = "Enables users to create custom URLs."; + case "admin/system/modules#description": + $output = t("Enables users to create custom URLs."); break; - case "admin/path": - $output = "Drupal provides users complete control over URLs through aliasing. While the original Drupal URLs are always created and accessible, advanced users have the option to override these normal paths."; + $output = t("Drupal provides users complete control over URLs through aliasing. While the original Drupal URLs are always created and accessible, advanced users have the option to override these normal paths."); break; - case "admin/path/add": - $output = "Enter the path you wish to create the alias for, followed by the name of the new alias. Each path can be associated with only one alias."; + $output = t("Enter the path you wish to create the alias for, followed by the name of the new alias. Each path can be associated with only one alias."); break; - case "admin/path/help": $output .= "<h3>Background</h3><p>URL aliasing gives users the ability to have control over all Drupal paths. This functionality will integrate seamlessly into node forms and also provide the administrator an interface to view all aliases that have been created.</p><p>Aliases have a 1 to 1 relationship with their original Drupal URLs. In otherwards you cannot have an alias map to more than one path. Likewise, a Drupal URL can't be mapped to more than one alias.</p>"; $output .= "<h3>Permissions</h3><p>Two new permissions are introduced for aliasing URLs: <i>create url aliases</i> and <i>administer url aliases</i>.</p>"; - $output .= "<ol><li><b>create url aliases</b> - Allows users to create aliases for nodes. Enabling this permission will display a new path field to the user in any node form, allowing them to enter an alias for that node. They will be able to edit/delete the alias after it is created using the same form.</li><li><b>administer url aliases</b> - Allows users to access the alias administration interface. They must also have the <i>access administration pages</i> permission set as well. This interface displays all aliases and provides a way to create and modify them as well. This is also the location to build aliases for things other than nodes. For example, you can create an alias for a taxonomy URL or even re-map the admin path (although the original admin path will still be accessible since aliases do not cancel out original paths).</li></ol>"; + $output .= "<ol>"; + $output .= "<li><b>create url aliases</b> - Allows users to create aliases for nodes. Enabling this permission will display a new path field to the user in any node form, allowing them to enter an alias for that node. They will be able to edit/delete the alias after it is created using the same form.</li>"; + $output .= "<li><b>administer url aliases</b> - Allows users to access the alias administration interface. They must also have the <i>access administration pages</i> permission set as well. This interface displays all aliases and provides a way to create and modify them as well. This is also the location to build aliases for things other than nodes. For example, you can create an alias for a taxonomy URL or even re-map the admin path (although the original admin path will still be accessible since aliases do not cancel out original paths).</li>"; + $output .= "</ol>"; + $output = t($output); break; } - return t($output); + return $output; } function path_link($type, $node = NULL) { diff --git a/modules/path/path.module b/modules/path/path.module index 1e4d428f7..7fed2cf71 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -1,13 +1,6 @@ <?php /* $Id$ */ -function path_system($field) { - $system["description"] = path_help("admin/system/modules"); - $system["admin_help"] = path_help("admin/system/modules/path"); - - return $system[$field]; -} - function path_admin() { $op = strtolower($_POST["op"]); $edit = $_POST["edit"]; @@ -111,27 +104,30 @@ function path_form($edit = "", $error = "") { } function path_help($section = "admin/path/help") { + $output = ""; + switch ($section) { - case "admin/system/modules": - $output = "Enables users to create custom URLs."; + case "admin/system/modules#description": + $output = t("Enables users to create custom URLs."); break; - case "admin/path": - $output = "Drupal provides users complete control over URLs through aliasing. While the original Drupal URLs are always created and accessible, advanced users have the option to override these normal paths."; + $output = t("Drupal provides users complete control over URLs through aliasing. While the original Drupal URLs are always created and accessible, advanced users have the option to override these normal paths."); break; - case "admin/path/add": - $output = "Enter the path you wish to create the alias for, followed by the name of the new alias. Each path can be associated with only one alias."; + $output = t("Enter the path you wish to create the alias for, followed by the name of the new alias. Each path can be associated with only one alias."); break; - case "admin/path/help": $output .= "<h3>Background</h3><p>URL aliasing gives users the ability to have control over all Drupal paths. This functionality will integrate seamlessly into node forms and also provide the administrator an interface to view all aliases that have been created.</p><p>Aliases have a 1 to 1 relationship with their original Drupal URLs. In otherwards you cannot have an alias map to more than one path. Likewise, a Drupal URL can't be mapped to more than one alias.</p>"; $output .= "<h3>Permissions</h3><p>Two new permissions are introduced for aliasing URLs: <i>create url aliases</i> and <i>administer url aliases</i>.</p>"; - $output .= "<ol><li><b>create url aliases</b> - Allows users to create aliases for nodes. Enabling this permission will display a new path field to the user in any node form, allowing them to enter an alias for that node. They will be able to edit/delete the alias after it is created using the same form.</li><li><b>administer url aliases</b> - Allows users to access the alias administration interface. They must also have the <i>access administration pages</i> permission set as well. This interface displays all aliases and provides a way to create and modify them as well. This is also the location to build aliases for things other than nodes. For example, you can create an alias for a taxonomy URL or even re-map the admin path (although the original admin path will still be accessible since aliases do not cancel out original paths).</li></ol>"; + $output .= "<ol>"; + $output .= "<li><b>create url aliases</b> - Allows users to create aliases for nodes. Enabling this permission will display a new path field to the user in any node form, allowing them to enter an alias for that node. They will be able to edit/delete the alias after it is created using the same form.</li>"; + $output .= "<li><b>administer url aliases</b> - Allows users to access the alias administration interface. They must also have the <i>access administration pages</i> permission set as well. This interface displays all aliases and provides a way to create and modify them as well. This is also the location to build aliases for things other than nodes. For example, you can create an alias for a taxonomy URL or even re-map the admin path (although the original admin path will still be accessible since aliases do not cancel out original paths).</li>"; + $output .= "</ol>"; + $output = t($output); break; } - return t($output); + return $output; } function path_link($type, $node = NULL) { diff --git a/modules/ping.module b/modules/ping.module index 5befbc36b..a791e44f6 100644 --- a/modules/ping.module +++ b/modules/ping.module @@ -17,7 +17,7 @@ function ping_help($section = "admin/ping/help") { $output = t($output, array("%weblogs" => "<a href=\"http://www.weblogs.com/\">Weblogs.com</a>", "%weblogs-XML" => "<a href=\"http://www.xmlrpc.com/weblogsCom/\">". t("XML-RPC interface of weblogs.com") ."</a>", "%weblogs-RSS" => "<a href=\"http://www.xmlrpc.com/weblogsComForRSS\">". t("Weblogs.Com for RSS") ."</a>", "%weblogs-RSS-changes" => "<a href=\"http://www.weblogs.com/rssUpdates/changes.xml\">". t("the weblogs.com for RSS") ."</a>", "%blo-gs" => "<a href=\"http://blo.gs/\">blo.gs</a>", "%blogtracker" => "<a href=\"http://www.dansanderson.com/blogtracker\">blogtracker</a>", "%blogrolling" => "<a href=\"http://www.blogrolling.com\">blogtolling.com</a>", "%blo-gs-XML" => "<a href=\"http://blo.gs/ping.php\">". t("XML-RPC interface of blo.gs") ."</a>" )); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Alerts other site(s) that your site has been updated."); break; } @@ -25,14 +25,6 @@ function ping_help($section = "admin/ping/help") { return t($output); } -function ping_system($field){ - $output = ""; - - if ($field == "description") { $output = ping_help("admin/system/modules"); }; - - return $output; -} - function ping_cron() { global $base_url; diff --git a/modules/ping/ping.module b/modules/ping/ping.module index 5befbc36b..a791e44f6 100644 --- a/modules/ping/ping.module +++ b/modules/ping/ping.module @@ -17,7 +17,7 @@ function ping_help($section = "admin/ping/help") { $output = t($output, array("%weblogs" => "<a href=\"http://www.weblogs.com/\">Weblogs.com</a>", "%weblogs-XML" => "<a href=\"http://www.xmlrpc.com/weblogsCom/\">". t("XML-RPC interface of weblogs.com") ."</a>", "%weblogs-RSS" => "<a href=\"http://www.xmlrpc.com/weblogsComForRSS\">". t("Weblogs.Com for RSS") ."</a>", "%weblogs-RSS-changes" => "<a href=\"http://www.weblogs.com/rssUpdates/changes.xml\">". t("the weblogs.com for RSS") ."</a>", "%blo-gs" => "<a href=\"http://blo.gs/\">blo.gs</a>", "%blogtracker" => "<a href=\"http://www.dansanderson.com/blogtracker\">blogtracker</a>", "%blogrolling" => "<a href=\"http://www.blogrolling.com\">blogtolling.com</a>", "%blo-gs-XML" => "<a href=\"http://blo.gs/ping.php\">". t("XML-RPC interface of blo.gs") ."</a>" )); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Alerts other site(s) that your site has been updated."); break; } @@ -25,14 +25,6 @@ function ping_help($section = "admin/ping/help") { return t($output); } -function ping_system($field){ - $output = ""; - - if ($field == "description") { $output = ping_help("admin/system/modules"); }; - - return $output; -} - function ping_cron() { global $base_url; diff --git a/modules/poll.module b/modules/poll.module index 89d6bb2be..ccfa3011b 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -151,9 +151,9 @@ function poll_help($section = "admin/poll/help") { $output .= "<li>To administer polls you need the \"administer nodes\" permission.</li>"; $output .= "</ul>"; $output .= "<p>Creating a poll is much like creating any other node. Click \"create poll\" in your user box. 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.</p><p>The %poll item in the navigation links 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.</p>"; - $output = t($output, array("%permissions" => l(t("permissions"), "admin/user/permission"), "%poll" => l(t("Poll"), "poll") )); + $output = t($output, array("%permissions" => l(t("permissions"), "admin/user/permission"), "%poll" => l(t("Poll"), "poll"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables your site to capture votes on different topics in the form of multiple choice questions."); break; } @@ -182,7 +182,7 @@ function poll_link($type, $node = 0, $main) { if ($type == "system") { if (user_access("create polls")) { - menu("node/add/poll",t("poll"), "poll_page", NULL, 0); + menu("node/add/poll", t("poll"), "poll_page", NULL, 0); } } else if ($type == "page" && user_access("access content")) { @@ -262,14 +262,6 @@ function poll_perm() { return array("create polls", "vote on polls"); } -function poll_system($field){ - $output = ""; - - if ($field == "description") { $output = poll_help("admin/system/modules"); }; - - return $output; -} - function poll_teaser($node) { // Create a simple teaser that lists all the choices if (is_array($node->choice)) { diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 89d6bb2be..ccfa3011b 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -151,9 +151,9 @@ function poll_help($section = "admin/poll/help") { $output .= "<li>To administer polls you need the \"administer nodes\" permission.</li>"; $output .= "</ul>"; $output .= "<p>Creating a poll is much like creating any other node. Click \"create poll\" in your user box. 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.</p><p>The %poll item in the navigation links 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.</p>"; - $output = t($output, array("%permissions" => l(t("permissions"), "admin/user/permission"), "%poll" => l(t("Poll"), "poll") )); + $output = t($output, array("%permissions" => l(t("permissions"), "admin/user/permission"), "%poll" => l(t("Poll"), "poll"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables your site to capture votes on different topics in the form of multiple choice questions."); break; } @@ -182,7 +182,7 @@ function poll_link($type, $node = 0, $main) { if ($type == "system") { if (user_access("create polls")) { - menu("node/add/poll",t("poll"), "poll_page", NULL, 0); + menu("node/add/poll", t("poll"), "poll_page", NULL, 0); } } else if ($type == "page" && user_access("access content")) { @@ -262,14 +262,6 @@ function poll_perm() { return array("create polls", "vote on polls"); } -function poll_system($field){ - $output = ""; - - if ($field == "description") { $output = poll_help("admin/system/modules"); }; - - return $output; -} - function poll_teaser($node) { // Create a simple teaser that lists all the choices if (is_array($node->choice)) { diff --git a/modules/profile.module b/modules/profile.module index f3a07f3e5..6abf5b439 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -40,25 +40,16 @@ function profile_help($section) { $output = ""; switch ($section) { - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Support for configurable user profiles."); break; case 'admin/system/modules/profile': - $output = t("When a user creates an account you can ask for some extra information, as well as letting the user have a small picture, called an avatar.<br />Notes:<ul><li>In order for a user to enter information you <b>must</b> check \"enable\".</li><li>In order for other people too see the entered information you must make it \"public\".</li><li>If an item is \"public\", but not enabled, the user can never give it a value and it will never be seen. Public does <b>not</b> imply \"enable\".</li><li>If an item is enabled, but not shown in the registration form the user will have to %edit to place information in the field.</ul>", array("%edit" => l(t("edit their account"), "user/edit") )); + $output = t("When a user creates an account you can ask for some extra information, as well as letting the user have a small picture, called an avatar.<br />Notes:<ul><li>In order for a user to enter information you <b>must</b> check \"enable\".</li><li>In order for other people too see the entered information you must make it \"public\".</li><li>If an item is \"public\", but not enabled, the user can never give it a value and it will never be seen. Public does <b>not</b> imply \"enable\".</li><li>If an item is enabled, but not shown in the registration form the user will have to %edit to place information in the field.</ul>", array("%edit" => l(t("edit their account"), "user/edit"))); break; } return $output; } -function profile_system($field) { - $output = ""; - - if ($field == "description") {$output = profile_help("admin/system/modules"); } - else if ($field == "admin_help") {$output = profile_help("admin/system/modules/profile"); }; - - return $output; -} - function profile_settings() { global $profile_fields; if (!$profile_fields) { diff --git a/modules/profile/profile.module b/modules/profile/profile.module index f3a07f3e5..6abf5b439 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -40,25 +40,16 @@ function profile_help($section) { $output = ""; switch ($section) { - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Support for configurable user profiles."); break; case 'admin/system/modules/profile': - $output = t("When a user creates an account you can ask for some extra information, as well as letting the user have a small picture, called an avatar.<br />Notes:<ul><li>In order for a user to enter information you <b>must</b> check \"enable\".</li><li>In order for other people too see the entered information you must make it \"public\".</li><li>If an item is \"public\", but not enabled, the user can never give it a value and it will never be seen. Public does <b>not</b> imply \"enable\".</li><li>If an item is enabled, but not shown in the registration form the user will have to %edit to place information in the field.</ul>", array("%edit" => l(t("edit their account"), "user/edit") )); + $output = t("When a user creates an account you can ask for some extra information, as well as letting the user have a small picture, called an avatar.<br />Notes:<ul><li>In order for a user to enter information you <b>must</b> check \"enable\".</li><li>In order for other people too see the entered information you must make it \"public\".</li><li>If an item is \"public\", but not enabled, the user can never give it a value and it will never be seen. Public does <b>not</b> imply \"enable\".</li><li>If an item is enabled, but not shown in the registration form the user will have to %edit to place information in the field.</ul>", array("%edit" => l(t("edit their account"), "user/edit"))); break; } return $output; } -function profile_system($field) { - $output = ""; - - if ($field == "description") {$output = profile_help("admin/system/modules"); } - else if ($field == "admin_help") {$output = profile_help("admin/system/modules/profile"); }; - - return $output; -} - function profile_settings() { global $profile_fields; if (!$profile_fields) { diff --git a/modules/queue.module b/modules/queue.module index ab8ba3b90..a6240d422 100644 --- a/modules/queue.module +++ b/modules/queue.module @@ -1,20 +1,11 @@ <?php // $Id$ -function queue_system($field){ - $output = ""; - - if ($field == "description") {$output = queue_help("admin/system/modules"); } - else if ($field == "admin_help") {$output = queue_help("admin/system/modules/queue"); }; - - return $output; -} - function queue_help($section) { $output = ""; switch ($section) { - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables content to be moderated by the community."); break; case 'admin/system/modules/queue': diff --git a/modules/search.module b/modules/search.module index a3f1707f3..6f9e68b8d 100644 --- a/modules/search.module +++ b/modules/search.module @@ -11,9 +11,9 @@ function search_help($section = "admin/search/help") { $output .= "<p>The search page allows you to search the web site's content. You can specify multiple words, and they will all be searched for. You can also use wildcards, so 'walk*' will match 'walk', 'walking', 'walker', 'walkable' and so on. Furthermore, searches are not case sensitive so searching for 'walk', 'Walk' or 'WALK' will yield exactly the same results.</p>"; $output .= "<b>Words excluded from the search</b>"; $output .= "<p>Words that frequently occur, typically called 'noise words', are ignored. Example words are 'a', 'at', 'and', 'are', 'as', 'how', 'where', etc. Words shorter than %number letters are also ignored.</p>"; - $output = t($output, array("%number" => variable_get("minimum_word_size", 2) )); + $output = t($output, array("%number" => variable_get("minimum_word_size", 2))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables site wide keyword searching."); break; case 'admin/system/modules/search': @@ -23,15 +23,6 @@ function search_help($section = "admin/search/help") { return $output; } -function search_system($field){ - $output = ""; - - if ($field == "description") {$output = search_help("admin/system/modules"); } - else if ($field == "admin_help") {$output = search_help("admin/system/modules/queue"); }; - - return $output; -} - /** * Return an array of valid search access permissions */ diff --git a/modules/search/search.module b/modules/search/search.module index a3f1707f3..6f9e68b8d 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -11,9 +11,9 @@ function search_help($section = "admin/search/help") { $output .= "<p>The search page allows you to search the web site's content. You can specify multiple words, and they will all be searched for. You can also use wildcards, so 'walk*' will match 'walk', 'walking', 'walker', 'walkable' and so on. Furthermore, searches are not case sensitive so searching for 'walk', 'Walk' or 'WALK' will yield exactly the same results.</p>"; $output .= "<b>Words excluded from the search</b>"; $output .= "<p>Words that frequently occur, typically called 'noise words', are ignored. Example words are 'a', 'at', 'and', 'are', 'as', 'how', 'where', etc. Words shorter than %number letters are also ignored.</p>"; - $output = t($output, array("%number" => variable_get("minimum_word_size", 2) )); + $output = t($output, array("%number" => variable_get("minimum_word_size", 2))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables site wide keyword searching."); break; case 'admin/system/modules/search': @@ -23,15 +23,6 @@ function search_help($section = "admin/search/help") { return $output; } -function search_system($field){ - $output = ""; - - if ($field == "description") {$output = search_help("admin/system/modules"); } - else if ($field == "admin_help") {$output = search_help("admin/system/modules/queue"); }; - - return $output; -} - /** * Return an array of valid search access permissions */ diff --git a/modules/statistics.module b/modules/statistics.module index 71ce5af62..446b91f59 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -65,17 +65,6 @@ function statistics_exit() { } } -/* System hook, sets description of module in admin page */ -function statistics_system($field) { - $output .= ""; - - if ($field == "description") {$output = statistics_help("admin/system/modules"); } - else if ($field == "admin_help") {$output = statistics_help("admin/system/modules/statistics"); }; - - return $output; -} - - /* Permissions hook, defines module's permissions */ function statistics_perm() { /* @@ -118,10 +107,10 @@ function statistics_link($type, $node = 0, $main = 0) { if ((user_access("administer statistics module") || (user_access("administer statistics")))) { menu("admin/statistics", t("statistics"), "statistics_admin", statistics_help("admin/statistics"), 6); - menu("admin/statistics/referrers", t("referrer log"), "statistics_admin", statistics_help("admin/statistics/referrers") ); - menu("admin/statistics/referrers/internal", t("internal referrers only"), "statistics_admin", statistics_help("admin/statistics/referrers/internal") ); - menu("admin/statistics/referrers/external", t("external referrers only"), "statistics_admin", statistics_help("admin/statistics/referrers/external") ); - menu("admin/statistics/log", t("access log"), "statistics_admin", statistics_help("admin/statistics/log") ); + menu("admin/statistics/referrers", t("referrer log"), "statistics_admin", statistics_help("admin/statistics/referrers")); + menu("admin/statistics/referrers/internal", t("internal referrers only"), "statistics_admin", statistics_help("admin/statistics/referrers/internal")); + menu("admin/statistics/referrers/external", t("external referrers only"), "statistics_admin", statistics_help("admin/statistics/referrers/external")); + menu("admin/statistics/log", t("access log"), "statistics_admin", statistics_help("admin/statistics/log")); menu("admin/statistics/log/node", t("track node"), "statistics_admin", statistics_help("admin/statistics/log/node"), 0, 1); //hidden menu("admin/statistics/log/user", t("track user"), "statistics_admin", statistics_help("admin/statistics/log/user"), 0, 1); //hidden menu("admin/statistics/log/host", t("track host"), "statistics_admin", statistics_help("admin/statistics/log/host"), 0, 1); //hidden @@ -213,13 +202,13 @@ function statistics_help($section = "admin/statistics/help") { // throttle limit not reached, execute normally }</pre></p>"; $output .= "<p>Note: Even though the configuration for the throttle is handled by the 'throttle.module', the throttle logic itself is part of the 'statistics.module'. The configuration has been separated in order to make things easier for the average site that will not be utilizing the throttling mechanism. More information about how the throttle works can be found on the throttle.module help page. (Find the throttle help page %here-help if you have enabled the throttle.module).</p>"; - $output = t($output, array("%throttle" => l(t("throttle.module"), "admin/system/modules"), "%modules" => l(t("enabled"), "admin/system/modules"), "%permissions" => l(t("permissions section"), "admin/user/permission"), "%referers" => l(t("referrers log"), "admin.statistics/referrers"), "%access" => l(t("access log"), "admin.statistics/log"), "%configuration" => l(t("site configuration"), "admin/system/modules/statistics"), "%here-block" => l(t("here"), "admin/system/block"), "%here-help" => l(t("here"), "admin/help#throttle") )); + $output = t($output, array("%throttle" => l(t("throttle.module"), "admin/system/modules"), "%modules" => l(t("enabled"), "admin/system/modules"), "%permissions" => l(t("permissions section"), "admin/user/permission"), "%referers" => l(t("referrers log"), "admin.statistics/referrers"), "%access" => l(t("access log"), "admin.statistics/log"), "%configuration" => l(t("site configuration"), "admin/system/modules/statistics"), "%here-block" => l(t("here"), "admin/system/block"), "%here-help" => l(t("here"), "admin/help#throttle"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Logs access statistics for your site."); break; case 'admin/system/modules/statistics': - $output = t("Settings for the statistical information that Drupal will keep about the site. See %statistics for the actual information.", array("%statistics" => l(t("site statistics"),"admin/statistics") )); + $output = t("Settings for the statistical information that Drupal will keep about the site. See %statistics for the actual information.", array("%statistics" => l(t("site statistics"), "admin/statistics"))); break; case 'admin/statistics': $output = t("This page gives you an at-a-glance look at your top nodes. It is useful for understanding what content on your site is the most popular."); @@ -773,7 +762,7 @@ function statistics_block($op = "list", $delta = 0) { return $blocks; } else if (user_access("access content")) { - switch($delta) { + switch ($delta) { case 0: $block["subject"] = variable_get("statistics_block_top_title", t("Popular content")); $block["content"] = statistics_display_topnodes_block(); diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 71ce5af62..446b91f59 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -65,17 +65,6 @@ function statistics_exit() { } } -/* System hook, sets description of module in admin page */ -function statistics_system($field) { - $output .= ""; - - if ($field == "description") {$output = statistics_help("admin/system/modules"); } - else if ($field == "admin_help") {$output = statistics_help("admin/system/modules/statistics"); }; - - return $output; -} - - /* Permissions hook, defines module's permissions */ function statistics_perm() { /* @@ -118,10 +107,10 @@ function statistics_link($type, $node = 0, $main = 0) { if ((user_access("administer statistics module") || (user_access("administer statistics")))) { menu("admin/statistics", t("statistics"), "statistics_admin", statistics_help("admin/statistics"), 6); - menu("admin/statistics/referrers", t("referrer log"), "statistics_admin", statistics_help("admin/statistics/referrers") ); - menu("admin/statistics/referrers/internal", t("internal referrers only"), "statistics_admin", statistics_help("admin/statistics/referrers/internal") ); - menu("admin/statistics/referrers/external", t("external referrers only"), "statistics_admin", statistics_help("admin/statistics/referrers/external") ); - menu("admin/statistics/log", t("access log"), "statistics_admin", statistics_help("admin/statistics/log") ); + menu("admin/statistics/referrers", t("referrer log"), "statistics_admin", statistics_help("admin/statistics/referrers")); + menu("admin/statistics/referrers/internal", t("internal referrers only"), "statistics_admin", statistics_help("admin/statistics/referrers/internal")); + menu("admin/statistics/referrers/external", t("external referrers only"), "statistics_admin", statistics_help("admin/statistics/referrers/external")); + menu("admin/statistics/log", t("access log"), "statistics_admin", statistics_help("admin/statistics/log")); menu("admin/statistics/log/node", t("track node"), "statistics_admin", statistics_help("admin/statistics/log/node"), 0, 1); //hidden menu("admin/statistics/log/user", t("track user"), "statistics_admin", statistics_help("admin/statistics/log/user"), 0, 1); //hidden menu("admin/statistics/log/host", t("track host"), "statistics_admin", statistics_help("admin/statistics/log/host"), 0, 1); //hidden @@ -213,13 +202,13 @@ function statistics_help($section = "admin/statistics/help") { // throttle limit not reached, execute normally }</pre></p>"; $output .= "<p>Note: Even though the configuration for the throttle is handled by the 'throttle.module', the throttle logic itself is part of the 'statistics.module'. The configuration has been separated in order to make things easier for the average site that will not be utilizing the throttling mechanism. More information about how the throttle works can be found on the throttle.module help page. (Find the throttle help page %here-help if you have enabled the throttle.module).</p>"; - $output = t($output, array("%throttle" => l(t("throttle.module"), "admin/system/modules"), "%modules" => l(t("enabled"), "admin/system/modules"), "%permissions" => l(t("permissions section"), "admin/user/permission"), "%referers" => l(t("referrers log"), "admin.statistics/referrers"), "%access" => l(t("access log"), "admin.statistics/log"), "%configuration" => l(t("site configuration"), "admin/system/modules/statistics"), "%here-block" => l(t("here"), "admin/system/block"), "%here-help" => l(t("here"), "admin/help#throttle") )); + $output = t($output, array("%throttle" => l(t("throttle.module"), "admin/system/modules"), "%modules" => l(t("enabled"), "admin/system/modules"), "%permissions" => l(t("permissions section"), "admin/user/permission"), "%referers" => l(t("referrers log"), "admin.statistics/referrers"), "%access" => l(t("access log"), "admin.statistics/log"), "%configuration" => l(t("site configuration"), "admin/system/modules/statistics"), "%here-block" => l(t("here"), "admin/system/block"), "%here-help" => l(t("here"), "admin/help#throttle"))); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Logs access statistics for your site."); break; case 'admin/system/modules/statistics': - $output = t("Settings for the statistical information that Drupal will keep about the site. See %statistics for the actual information.", array("%statistics" => l(t("site statistics"),"admin/statistics") )); + $output = t("Settings for the statistical information that Drupal will keep about the site. See %statistics for the actual information.", array("%statistics" => l(t("site statistics"), "admin/statistics"))); break; case 'admin/statistics': $output = t("This page gives you an at-a-glance look at your top nodes. It is useful for understanding what content on your site is the most popular."); @@ -773,7 +762,7 @@ function statistics_block($op = "list", $delta = 0) { return $blocks; } else if (user_access("access content")) { - switch($delta) { + switch ($delta) { case 0: $block["subject"] = variable_get("statistics_block_top_title", t("Popular content")); $block["content"] = statistics_display_topnodes_block(); diff --git a/modules/story.module b/modules/story.module index 0b58aff63..f7e1c4bfc 100644 --- a/modules/story.module +++ b/modules/story.module @@ -5,7 +5,7 @@ function story_help($section = "admin/story/help") { $output = ""; switch ($section) { - case "admin/system/modules": + case "admin/system/modules#description": $output = t("Enables users to submit stories, articles or similar content."); break; case "admin/system/modules/story": @@ -14,22 +14,13 @@ function story_help($section = "admin/story/help") { case "admin/story/help": $output = "<p>The story module lets your users submit articles for consideration by the rest of the community, who can vote on them if moderation is enabled. Stories usually follow a publishing flow of <b>submit -> moderate -> post to the main page -> comments</b>. Administrators are able to shortcut this flow as desired.</p>"; $output .= "In %story-config you can set up an introductory text for story authors, and a floor on the number of words which may be included in a story. This is designed to help discourage the submission of trivially short stories."; - $output = t($output, array("%story-config" => l(t("site configuration » modules » story"), "admin/system/modules/story") )); + $output = t($output, array("%story-config" => l(t("site configuration » modules » story"), "admin/system/modules/story"))); break; } return $output; } -function story_system($field){ - $output = ""; - - if ($field == "description") { $output = story_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = story_help("admin/system/modules/story"); }; - - return $output; -} - function story_settings() { $output .= form_textarea("Explanation or submission guidelines", "story_help", variable_get("story_help", ""), 70, 5, "This text will be displayed at the top of the story submission form. It is useful for helping or instructing your users."); $output .= form_select(t("Minimum number of words"), "minimum_story_size", variable_get("minimum_story_size", 0), array(0 => "0 words", 10 => "10 words", 25 => "25 words", 50 => "50 words", 75 => "75 words", 100 => "100 words", 125 => "125 words", 150 => "150 words", 175 => "175 words", 200 => "200 words"), t("The minimum number of words a story 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.")); diff --git a/modules/story/story.module b/modules/story/story.module index 0b58aff63..f7e1c4bfc 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -5,7 +5,7 @@ function story_help($section = "admin/story/help") { $output = ""; switch ($section) { - case "admin/system/modules": + case "admin/system/modules#description": $output = t("Enables users to submit stories, articles or similar content."); break; case "admin/system/modules/story": @@ -14,22 +14,13 @@ function story_help($section = "admin/story/help") { case "admin/story/help": $output = "<p>The story module lets your users submit articles for consideration by the rest of the community, who can vote on them if moderation is enabled. Stories usually follow a publishing flow of <b>submit -> moderate -> post to the main page -> comments</b>. Administrators are able to shortcut this flow as desired.</p>"; $output .= "In %story-config you can set up an introductory text for story authors, and a floor on the number of words which may be included in a story. This is designed to help discourage the submission of trivially short stories."; - $output = t($output, array("%story-config" => l(t("site configuration » modules » story"), "admin/system/modules/story") )); + $output = t($output, array("%story-config" => l(t("site configuration » modules » story"), "admin/system/modules/story"))); break; } return $output; } -function story_system($field){ - $output = ""; - - if ($field == "description") { $output = story_help("admin/system/modules"); } - else if ($field == "admin_help") { $output = story_help("admin/system/modules/story"); }; - - return $output; -} - function story_settings() { $output .= form_textarea("Explanation or submission guidelines", "story_help", variable_get("story_help", ""), 70, 5, "This text will be displayed at the top of the story submission form. It is useful for helping or instructing your users."); $output .= form_select(t("Minimum number of words"), "minimum_story_size", variable_get("minimum_story_size", 0), array(0 => "0 words", 10 => "10 words", 25 => "25 words", 50 => "50 words", 75 => "75 words", 100 => "100 words", 125 => "125 words", 150 => "150 words", 175 => "175 words", 200 => "200 words"), t("The minimum number of words a story 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.")); diff --git a/modules/system.module b/modules/system.module index 180b239bc..11680ee19 100644 --- a/modules/system.module +++ b/modules/system.module @@ -2,6 +2,7 @@ // $Id$ function system_help($section = "admin/system/help") { + global $base_url; $output = ""; switch ($section) { @@ -19,37 +20,31 @@ function system_help($section = "admin/system/help") { break; case "admin/system/help": $output .= "<p>Drupal comes with system-wide defaults but the setting-module provides control over many Drupal preferences, behaviours including visual and operational settings.</p>"; - $output .= "<h3><a id=\"cron\">Cron</a></h3>". system_help_cron(); - $output .= "<h3><a id=\"cache\">Cache</a></h3>". system_help_cache(); - $output = t($output); + $output .= "<h3><a id=\"cron\">Cron</a></h3>"; + // Start of system_help_cron + $output .= "<p>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). 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>Whenever %cron-link is accessed, cron will run: it calls the _cron hook in each module allowing the module to run tasks if they have not been executed in the last <i>n</i> seconds, where n is the period of that task. When all the tasks are finished, cron is done.</p>"; + $output .= "<p>The recommended way to set up your cron system is to set up a Unix/Linux crontab entry (see \"man crontab\") that frequently visits %cron-link. Note that cron does not guarantee the commands will be executed at the specified interval. However, Drupal will try its best to run the tasks as close to the specified intervals as possible. The more you visit cron.php, the more accurate cron will be.</p>"; + $output .= "<p>If your hosting company does not allow you to set up crontab entries, you can always ask someone else to set up an entry for you. After all, virtually any Unix/Linux machine with access to the internet can set up a crontab entry to frequently visit %cron-link.</p>"; + $output .= "<p>For the Unix/Linux crontab itself, use a browser like %lynx or %wget but make sure the process terminates: either use <code>/usr/bin/lynx -source $base_url/cron.php</code> or <code>/usr/bin/wget -o /dev/null -O /dev/null %cron-link</code>. Take a look at the example scripts in the <code>scripts</code>-directory. Make sure to adjust them to fit your needs. A good crontab line to run the cron script once every hour would be:"; + $output .= "<pre> 00 * * * * /home/www/drupal/scripts/cron-lynx.sh</pre>"; + $output .= "Note that it is essential to access <code>cron.php</code> using a browser on the web site's domain; do not run it using command line PHP and avoid using <code>localhost</code> or <code>127.0.0.1</code> or some of the environment varibles will not be set correctly and features may not work as expected.</p>"; + // End of system_help_cron + $output .= "<h3><a id=\"cache\">Cache</a></h3>"; + // Start of system_help_cache + $output .= "<p>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.</p>"; + // End of system_help_cache + $output = t($output, array("%cron-link" => "<a href=\"$base_url/cron.php\ +\">$base_url/cron.php</a>", "%lynx" => "<a href=\"http://lynx.browser.org\">lynx</a>", "%wget" => "<a href=\"http://www.gnu.org/software/wget/wget.html\">wget</a>" )); + break; + case 'admin/system/modules#description': + $output = t("Configuration system that lets administrators modify the workings of the site."); break; } return $output; } -function system_system($field) { - $system["description"] = t("Configuration system that lets administrators modify the workings of the site."); // NOTE: we can't move this to the help function. - return $system[$field]; -} - -function system_help_cache() { - $output .= "<p>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.</p>"; - return $output; -} - -function system_help_cron() { - global $base_url; - - $output .= "<p>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). 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>Whenever <a href=\"$base_url/cron.php\">$base_url/cron.php</a> is accessed, cron will run: it calls the _cron hook in each module allowing the module to run tasks if they have not been executed in the last <i>n</i> seconds, where n is the period of that task. When all the tasks are finished, cron is done.</p>"; - $output .= "<p>The recommended way to set up your cron system is to set up a Unix/Linux crontab entry (see \"man crontab\") that frequently visits <a href=\"$base_url/cron.php\">$base_url/cron.php</a>. Note that cron does not guarantee the commands will be executed at the specified interval. However, Drupal will try its best to run the tasks as close to the specified intervals as possible. The more you visit cron.php, the more accurate cron will be.</p>"; - $output .= "<p>If your hosting company does not allow you to set up crontab entries, you can always ask someone else to set up an entry for you. After all, virtually any Unix/Linux machine with access to the internet can set up a crontab entry to frequently visit <a href=\"$base_url/cron.php\">$base_url/cron.php</a>.</p>"; - $output .= "<p>For the Unix/Linux crontab itself, use a browser like <i>lynx</i> or <i>wget</i> but make sure the process terminates: either use <code>/usr/bin/lynx -source $base_url/cron.php</code> or <code>/usr/bin/wget -o /dev/null -O /dev/null $base_url/cron.php</code>. Take a look at the example scripts in the <code>scripts</code>-directory. Make sure to adjust them to fit your needs. A good crontab line to run the cron script once every hour would be: <pre> 00 * * * * /home/www/drupal/scripts/cron-lynx.sh</pre>Note that it is essential to access <code>cron.php</code> using a browser on the web site's domain; do not run it using command line PHP and avoid using <code>localhost</code> or <code>127.0.0.1</code> or some of the environment varibles will not be set correctly and features may not work as expected.</p>"; - - return $output; -} - function system_perm() { return array("administer site configuration", "access administration pages", "bypass input data check", "create php content"); } @@ -57,10 +52,6 @@ function system_perm() { function system_link($type) { if ($type == "system") { if (user_access("administer site configuration")) { - $help["general"] = t("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."); - $help["themes"] = t("Select which themes are available to your users and specify the default theme."); - $help["modules"] = t("Modules are plugins for Drupal that extend its core functionality. Here you can select which modules are enabled. On the left hand side click on the name of the module for their individual configurations. Once a module is enabled, you will need to grant permissions to users in user management."); - $help["filters"] = t("Filters fit between the raw text in a node and the HTML output. They allow you to replace text selectively. Uses include automatic conversion of emoticons into graphics and filtering HTML content from users' submissions."); menu("admin/system", t("configuration"), "system_admin", system_help("admin/system"), 3); menu("admin/system/themes", t("themes"), "system_admin", system_help("admin/system/themes"), 2); @@ -78,7 +69,7 @@ function system_link($type) { foreach (module_list(1) as $name) { // NOTE: refresh the list because some modules might have been enabled/disabled. if (module_hook($name, "settings")) { - menu("admin/system/modules/$name", t($name), "system_admin", module_invoke($name, "system", "admin_help")); + menu("admin/system/modules/$name", t($name), "system_admin", module_invoke($name, "help", "admin/system/modules/$name") ? module_invoke($name, "help", "admin/system/modules/$name") : module_invoke($name, "system", "admin_help")); } } menu("admin/system/filters", t("filters"), "system_admin", system_help("admin/system/filters"), 4); @@ -306,8 +297,8 @@ function system_listing($type, $directory, $required = array()) { foreach ($files as $filename => $file) { include_once($filename); if ($type == "module") { - $info->name = module_invoke($file->name, "system", "name") ? module_invoke($file->name, "system", "name") : $file->name; - $info->description = module_invoke($file->name, "system", "description"); + $info->name = module_invoke($file->name, "help", "admin/system/modules#name") ? module_invoke($file->name, "help", "admin/system/modules#name") : module_invoke($file->name, "system", "name") ? module_invoke($file->name, "system", "name") : $file->name; + $info->description = module_invoke($file->name, "help", "admin/system/modules#description") ? module_invoke($file->name, "help", "admin/system/modules#description") : module_invoke($file->name, "system", "description"); } elseif ($type == "theme") { $class = "Theme_$file->name"; diff --git a/modules/system/system.module b/modules/system/system.module index 180b239bc..11680ee19 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -2,6 +2,7 @@ // $Id$ function system_help($section = "admin/system/help") { + global $base_url; $output = ""; switch ($section) { @@ -19,37 +20,31 @@ function system_help($section = "admin/system/help") { break; case "admin/system/help": $output .= "<p>Drupal comes with system-wide defaults but the setting-module provides control over many Drupal preferences, behaviours including visual and operational settings.</p>"; - $output .= "<h3><a id=\"cron\">Cron</a></h3>". system_help_cron(); - $output .= "<h3><a id=\"cache\">Cache</a></h3>". system_help_cache(); - $output = t($output); + $output .= "<h3><a id=\"cron\">Cron</a></h3>"; + // Start of system_help_cron + $output .= "<p>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). 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>Whenever %cron-link is accessed, cron will run: it calls the _cron hook in each module allowing the module to run tasks if they have not been executed in the last <i>n</i> seconds, where n is the period of that task. When all the tasks are finished, cron is done.</p>"; + $output .= "<p>The recommended way to set up your cron system is to set up a Unix/Linux crontab entry (see \"man crontab\") that frequently visits %cron-link. Note that cron does not guarantee the commands will be executed at the specified interval. However, Drupal will try its best to run the tasks as close to the specified intervals as possible. The more you visit cron.php, the more accurate cron will be.</p>"; + $output .= "<p>If your hosting company does not allow you to set up crontab entries, you can always ask someone else to set up an entry for you. After all, virtually any Unix/Linux machine with access to the internet can set up a crontab entry to frequently visit %cron-link.</p>"; + $output .= "<p>For the Unix/Linux crontab itself, use a browser like %lynx or %wget but make sure the process terminates: either use <code>/usr/bin/lynx -source $base_url/cron.php</code> or <code>/usr/bin/wget -o /dev/null -O /dev/null %cron-link</code>. Take a look at the example scripts in the <code>scripts</code>-directory. Make sure to adjust them to fit your needs. A good crontab line to run the cron script once every hour would be:"; + $output .= "<pre> 00 * * * * /home/www/drupal/scripts/cron-lynx.sh</pre>"; + $output .= "Note that it is essential to access <code>cron.php</code> using a browser on the web site's domain; do not run it using command line PHP and avoid using <code>localhost</code> or <code>127.0.0.1</code> or some of the environment varibles will not be set correctly and features may not work as expected.</p>"; + // End of system_help_cron + $output .= "<h3><a id=\"cache\">Cache</a></h3>"; + // Start of system_help_cache + $output .= "<p>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.</p>"; + // End of system_help_cache + $output = t($output, array("%cron-link" => "<a href=\"$base_url/cron.php\ +\">$base_url/cron.php</a>", "%lynx" => "<a href=\"http://lynx.browser.org\">lynx</a>", "%wget" => "<a href=\"http://www.gnu.org/software/wget/wget.html\">wget</a>" )); + break; + case 'admin/system/modules#description': + $output = t("Configuration system that lets administrators modify the workings of the site."); break; } return $output; } -function system_system($field) { - $system["description"] = t("Configuration system that lets administrators modify the workings of the site."); // NOTE: we can't move this to the help function. - return $system[$field]; -} - -function system_help_cache() { - $output .= "<p>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.</p>"; - return $output; -} - -function system_help_cron() { - global $base_url; - - $output .= "<p>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). 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>Whenever <a href=\"$base_url/cron.php\">$base_url/cron.php</a> is accessed, cron will run: it calls the _cron hook in each module allowing the module to run tasks if they have not been executed in the last <i>n</i> seconds, where n is the period of that task. When all the tasks are finished, cron is done.</p>"; - $output .= "<p>The recommended way to set up your cron system is to set up a Unix/Linux crontab entry (see \"man crontab\") that frequently visits <a href=\"$base_url/cron.php\">$base_url/cron.php</a>. Note that cron does not guarantee the commands will be executed at the specified interval. However, Drupal will try its best to run the tasks as close to the specified intervals as possible. The more you visit cron.php, the more accurate cron will be.</p>"; - $output .= "<p>If your hosting company does not allow you to set up crontab entries, you can always ask someone else to set up an entry for you. After all, virtually any Unix/Linux machine with access to the internet can set up a crontab entry to frequently visit <a href=\"$base_url/cron.php\">$base_url/cron.php</a>.</p>"; - $output .= "<p>For the Unix/Linux crontab itself, use a browser like <i>lynx</i> or <i>wget</i> but make sure the process terminates: either use <code>/usr/bin/lynx -source $base_url/cron.php</code> or <code>/usr/bin/wget -o /dev/null -O /dev/null $base_url/cron.php</code>. Take a look at the example scripts in the <code>scripts</code>-directory. Make sure to adjust them to fit your needs. A good crontab line to run the cron script once every hour would be: <pre> 00 * * * * /home/www/drupal/scripts/cron-lynx.sh</pre>Note that it is essential to access <code>cron.php</code> using a browser on the web site's domain; do not run it using command line PHP and avoid using <code>localhost</code> or <code>127.0.0.1</code> or some of the environment varibles will not be set correctly and features may not work as expected.</p>"; - - return $output; -} - function system_perm() { return array("administer site configuration", "access administration pages", "bypass input data check", "create php content"); } @@ -57,10 +52,6 @@ function system_perm() { function system_link($type) { if ($type == "system") { if (user_access("administer site configuration")) { - $help["general"] = t("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."); - $help["themes"] = t("Select which themes are available to your users and specify the default theme."); - $help["modules"] = t("Modules are plugins for Drupal that extend its core functionality. Here you can select which modules are enabled. On the left hand side click on the name of the module for their individual configurations. Once a module is enabled, you will need to grant permissions to users in user management."); - $help["filters"] = t("Filters fit between the raw text in a node and the HTML output. They allow you to replace text selectively. Uses include automatic conversion of emoticons into graphics and filtering HTML content from users' submissions."); menu("admin/system", t("configuration"), "system_admin", system_help("admin/system"), 3); menu("admin/system/themes", t("themes"), "system_admin", system_help("admin/system/themes"), 2); @@ -78,7 +69,7 @@ function system_link($type) { foreach (module_list(1) as $name) { // NOTE: refresh the list because some modules might have been enabled/disabled. if (module_hook($name, "settings")) { - menu("admin/system/modules/$name", t($name), "system_admin", module_invoke($name, "system", "admin_help")); + menu("admin/system/modules/$name", t($name), "system_admin", module_invoke($name, "help", "admin/system/modules/$name") ? module_invoke($name, "help", "admin/system/modules/$name") : module_invoke($name, "system", "admin_help")); } } menu("admin/system/filters", t("filters"), "system_admin", system_help("admin/system/filters"), 4); @@ -306,8 +297,8 @@ function system_listing($type, $directory, $required = array()) { foreach ($files as $filename => $file) { include_once($filename); if ($type == "module") { - $info->name = module_invoke($file->name, "system", "name") ? module_invoke($file->name, "system", "name") : $file->name; - $info->description = module_invoke($file->name, "system", "description"); + $info->name = module_invoke($file->name, "help", "admin/system/modules#name") ? module_invoke($file->name, "help", "admin/system/modules#name") : module_invoke($file->name, "system", "name") ? module_invoke($file->name, "system", "name") : $file->name; + $info->description = module_invoke($file->name, "help", "admin/system/modules#description") ? module_invoke($file->name, "help", "admin/system/modules#description") : module_invoke($file->name, "system", "description"); } elseif ($type == "theme") { $class = "Theme_$file->name"; diff --git a/modules/taxonomy.module b/modules/taxonomy.module index df37c6022..68d64b9ae 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -1,14 +1,6 @@ <?php // $Id$ -function taxonomy_system($field){ - $output = ""; - - if ($field == "description") {$output = taxonomy_help("admin/system/modules"); }; - - return $output; -} - function taxonomy_feed($taxonomy) { global $id, $type; @@ -76,12 +68,12 @@ function taxonomy_form_vocabulary($edit = array()) { } } - $form .= form_textfield(t("Vocabulary name"), "name", $edit["name"], 50, 64, t("Required") . ". " . t("The name for this vocabulary. Example: 'Topic'") . "."); - $form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") . ". " . t("Description of the vocabulary, can be used by modules.")); - $form .= form_select(t("Types"), "nodes", explode(",", $edit["nodes"]), $nodetypes, t("Required") . ". " . t("A list of node types you want to associate this vocabulary with."), "", 1); - $form .= form_checkbox(t("Related terms"), "relations", 1, $edit["relations"], t("Optional") . ". " . t("Allows ". l("related terms", "admin/taxonomy/help#relatedterms") ." in this vocabulary.")); - $form .= form_select(t("Hierarchy"), "hierarchy", $edit["hierarchy"], array(t("Disabled"), t("Single"), t("Multiple")), t("Optional") . ". ". t("Allows ". l("a tree-like hierarchy", "admin/taxonomy/help#hierarchy") ." between terms of this vocabulary."), "", 0); - $form .= form_checkbox(t("Multiple select"), "multiple", 1, $edit["multiple"], t("Optional") . ". " . t("Allows nodes to have more than one term in this vocabulary.")); + $form .= form_textfield(t("Vocabulary name"), "name", $edit["name"], 50, 64, t("Required") .". ". t("The name for this vocabulary. Example: 'Topic'") ."."); + $form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") .". ". t("Description of the vocabulary, can be used by modules.")); + $form .= form_select(t("Types"), "nodes", explode(",", $edit["nodes"]), $nodetypes, t("Required") .". ". t("A list of node types you want to associate this vocabulary with."), "", 1); + $form .= form_checkbox(t("Related terms"), "relations", 1, $edit["relations"], t("Optional") .". ". t("Allows ". l("related terms", "admin/taxonomy/help#relatedterms") ." in this vocabulary.")); + $form .= form_select(t("Hierarchy"), "hierarchy", $edit["hierarchy"], array(t("Disabled"), t("Single"), t("Multiple")), t("Optional") .". ". t("Allows ". l("a tree-like hierarchy", "admin/taxonomy/help#hierarchy") ." between terms of this vocabulary."), "", 0); + $form .= form_checkbox(t("Multiple select"), "multiple", 1, $edit["multiple"], t("Optional") .". ". t("Allows nodes to have more than one term in this vocabulary.")); $form .= form_checkbox(t("Required"), "required", 1, $edit["required"], t("If enabled every node <b>must</b> have at least one term in this vocabulary")); $form .= form_weight(t("Weight"), "weight", $edit["weight"], 10, t("Optional. In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.")); $form .= form_submit(t("Submit")); @@ -152,8 +144,8 @@ function taxonomy_form_term($edit = array()) { $vocabulary_id = isset($edit["vid"]) ? $edit["vid"] : arg(4); $vocabulary = taxonomy_get_vocabulary($vocabulary_id); - $form = form_textfield(t("Term name"), "name", $edit["name"], 50, 64, t("Required") . ". " . t("The name for this term. Example: 'Linux'.")); - $form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") . ". " . t("A description of the term.")); + $form = form_textfield(t("Term name"), "name", $edit["name"], 50, 64, t("Required") .". ". t("The name for this term. Example: 'Linux'.")); + $form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") .". ". t("A description of the term.")); if ($vocabulary->hierarchy) { $parent = array_keys(taxonomy_get_parents($edit["tid"])); @@ -166,15 +158,15 @@ function taxonomy_form_term($edit = array()) { $exclude[] = $edit["tid"]; if ($vocabulary->hierarchy == 1) { - $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") . ". " . l(t("Parent term"), "admin/taxonomy/help#parent") .".", 0, "<" . t("root") . ">", $exclude); + $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") .". ". l(t("Parent term"), "admin/taxonomy/help#parent") .".", 0, "<". t("root") .">", $exclude); } elseif ($vocabulary->hierarchy == 2) { - $form .= _taxonomy_term_select(t("Parents"), "parent", $parent, $vocabulary_id, t("Required") . ". ". l(t("Parent terms"), "admin/taxonomy/help#parent") .".", 1, "<" . t("root") . ">", $exclude); + $form .= _taxonomy_term_select(t("Parents"), "parent", $parent, $vocabulary_id, t("Required") .". ". l(t("Parent terms"), "admin/taxonomy/help#parent") .".", 1, "<". t("root") .">", $exclude); } } if ($vocabulary->relations) { - $form .= _taxonomy_term_select(t("Related terms"), "relations", array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, t("Optional") . ". ", 1, "<" . t("none") . ">", array($edit["tid"])); + $form .= _taxonomy_term_select(t("Related terms"), "relations", array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, t("Optional") .". ", 1, "<". t("none") .">", array($edit["tid"])); } $form .= form_textarea(t("Synonyms"), "synonyms", implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, t("Optional") . ". ". t(l("Synonyms", "admin/taxonomy/help#synonyms") ." of this term, one synonym per line.")); @@ -277,7 +269,7 @@ function _taxonomy_confirm_del_term($tid) { function taxonomy_overview() { - $output .= "<h3>" . t("Vocabularies overview") . "</h3>"; + $output .= "<h3>". t("Vocabularies overview") ."</h3>"; $header = array(t("name"), t("node types"), array("data" => t("operations"), "colspan" => 3)); @@ -308,7 +300,7 @@ function taxonomy_form($vocabulary_id, $value = 0) { } else { $verb = "can"; - $blank = "<" . t("none") . ">"; + $blank = "<". t("none") .">"; } if ($vocabulary->multiple) { @@ -615,7 +607,7 @@ function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $descripti if (count($options) > 0) { foreach ($options as $option) { - $select .= "<option value=\"".$option["tid"]."\"". (is_array($value) ? (in_array($option["tid"], $value) ? " selected=\"selected\"" : "") : ($option["tid"] == $value ? " selected=\"selected\"" : "")) .">". check_form($option["name"]) ."</option>"; + $select .= "<option value=\"". $option["tid"] ."\"". (is_array($value) ? (in_array($option["tid"], $value) ? " selected=\"selected\"" : "") : ($option["tid"] == $value ? " selected=\"selected\"" : "")) .">". check_form($option["name"]) ."</option>"; } $size = min(12, count($options)); @@ -666,7 +658,7 @@ function taxonomy_select_nodes($taxonomy, $pager = 1) { $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid WHERE r.tid IN ($taxonomy->str_tids) AND n.status = '1'"; } else { - $sql = "SELECT n.nid, n.title, n.type, n.created, n.changed, n.uid, u.name FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid WHERE r.tid IN ($taxonomy->str_tids) AND n.status = '1' GROUP BY n.nid, n.title, n.type, n.created, n.changed, n.uid, u.name HAVING COUNT(n.nid) = ".count($taxonomy->tids)." ORDER BY static DESC, created DESC"; + $sql = "SELECT n.nid, n.title, n.type, n.created, n.changed, n.uid, u.name FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid WHERE r.tid IN ($taxonomy->str_tids) AND n.status = '1' GROUP BY n.nid, n.title, n.type, n.created, n.changed, n.uid, u.name HAVING COUNT(n.nid) = ". count($taxonomy->tids) ." ORDER BY static DESC, created DESC"; // Special trick as we could not find anything better: $count = db_num_rows(db_query("SELECT n.nid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid WHERE r.tid IN ($taxonomy->str_tids) AND n.status = '1' GROUP BY n.nid HAVING COUNT(n.nid) = ". count($taxonomy->tids))); @@ -807,16 +799,16 @@ function taxonomy_help($section = "admin/taxonomy/help") { $output = ""; switch ($section) { - case "admin/system/modules": + case 'admin/system/modules#description': $output = t("Enables the organization of content into categories."); break; - case "admin/taxonomy": + case 'admin/taxonomy': $output = t("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) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). To delete a term choose \"edit term\". To delete a vocabulary, and all its terms, choose \"edit vocabulary\"."); break; - case "admin/taxonomy/add/vocabulary": + case 'admin/taxonomy/add/vocabulary': $output = t("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 node type (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."); break; - case "admin/taxonomy/help": + case 'admin/taxonomy/help': $output .= "<h3>Background</h3><p>Taxonomy is the study of classification. Drupal's taxonomy module allows you to define categories which are used to classify content. The module supports hierarchical classification and association between terms, allowing for truly flexible information retrieval and classification. For more details about %classification-types and insight into the development of the <i>taxonomy.module</i>, see this %drupal-dis.</p>"; $output .= "<h3>An example taxonomy: food</h3><ul><li>Dairy<ul><li>Milk</li></ul></li><li>Drink<ul><li>Alchohol<ul><li>Beer</li><li>Wine</li></ul></li><li>Pop</li><li>Milk</li></ul></li><li>Meat<ul><li>Beef</li><li>Chicken</li><li>Lamb</li></ul></li><li>Spices<ul><li>Sugar</li></ul></li></ul>"; $output .= "<p><b>Notes</b></p><ul><li>The term <i>Milk</i> appears within both <i>Dairy</i> and <i>Drink</i>. This is an example of <i>multiple parents</i> for a term.</li><li>In Drupal the order of siblings (e.g. <i>Beef</i>, <i>Chicken</i>, <i>Lamb</i>) in a taxonomy may be controlled with the <i>weight</i> parameter.</li></ul>"; diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index df37c6022..68d64b9ae 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -1,14 +1,6 @@ <?php // $Id$ -function taxonomy_system($field){ - $output = ""; - - if ($field == "description") {$output = taxonomy_help("admin/system/modules"); }; - - return $output; -} - function taxonomy_feed($taxonomy) { global $id, $type; @@ -76,12 +68,12 @@ function taxonomy_form_vocabulary($edit = array()) { } } - $form .= form_textfield(t("Vocabulary name"), "name", $edit["name"], 50, 64, t("Required") . ". " . t("The name for this vocabulary. Example: 'Topic'") . "."); - $form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") . ". " . t("Description of the vocabulary, can be used by modules.")); - $form .= form_select(t("Types"), "nodes", explode(",", $edit["nodes"]), $nodetypes, t("Required") . ". " . t("A list of node types you want to associate this vocabulary with."), "", 1); - $form .= form_checkbox(t("Related terms"), "relations", 1, $edit["relations"], t("Optional") . ". " . t("Allows ". l("related terms", "admin/taxonomy/help#relatedterms") ." in this vocabulary.")); - $form .= form_select(t("Hierarchy"), "hierarchy", $edit["hierarchy"], array(t("Disabled"), t("Single"), t("Multiple")), t("Optional") . ". ". t("Allows ". l("a tree-like hierarchy", "admin/taxonomy/help#hierarchy") ." between terms of this vocabulary."), "", 0); - $form .= form_checkbox(t("Multiple select"), "multiple", 1, $edit["multiple"], t("Optional") . ". " . t("Allows nodes to have more than one term in this vocabulary.")); + $form .= form_textfield(t("Vocabulary name"), "name", $edit["name"], 50, 64, t("Required") .". ". t("The name for this vocabulary. Example: 'Topic'") ."."); + $form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") .". ". t("Description of the vocabulary, can be used by modules.")); + $form .= form_select(t("Types"), "nodes", explode(",", $edit["nodes"]), $nodetypes, t("Required") .". ". t("A list of node types you want to associate this vocabulary with."), "", 1); + $form .= form_checkbox(t("Related terms"), "relations", 1, $edit["relations"], t("Optional") .". ". t("Allows ". l("related terms", "admin/taxonomy/help#relatedterms") ." in this vocabulary.")); + $form .= form_select(t("Hierarchy"), "hierarchy", $edit["hierarchy"], array(t("Disabled"), t("Single"), t("Multiple")), t("Optional") .". ". t("Allows ". l("a tree-like hierarchy", "admin/taxonomy/help#hierarchy") ." between terms of this vocabulary."), "", 0); + $form .= form_checkbox(t("Multiple select"), "multiple", 1, $edit["multiple"], t("Optional") .". ". t("Allows nodes to have more than one term in this vocabulary.")); $form .= form_checkbox(t("Required"), "required", 1, $edit["required"], t("If enabled every node <b>must</b> have at least one term in this vocabulary")); $form .= form_weight(t("Weight"), "weight", $edit["weight"], 10, t("Optional. In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.")); $form .= form_submit(t("Submit")); @@ -152,8 +144,8 @@ function taxonomy_form_term($edit = array()) { $vocabulary_id = isset($edit["vid"]) ? $edit["vid"] : arg(4); $vocabulary = taxonomy_get_vocabulary($vocabulary_id); - $form = form_textfield(t("Term name"), "name", $edit["name"], 50, 64, t("Required") . ". " . t("The name for this term. Example: 'Linux'.")); - $form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") . ". " . t("A description of the term.")); + $form = form_textfield(t("Term name"), "name", $edit["name"], 50, 64, t("Required") .". ". t("The name for this term. Example: 'Linux'.")); + $form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") .". ". t("A description of the term.")); if ($vocabulary->hierarchy) { $parent = array_keys(taxonomy_get_parents($edit["tid"])); @@ -166,15 +158,15 @@ function taxonomy_form_term($edit = array()) { $exclude[] = $edit["tid"]; if ($vocabulary->hierarchy == 1) { - $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") . ". " . l(t("Parent term"), "admin/taxonomy/help#parent") .".", 0, "<" . t("root") . ">", $exclude); + $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") .". ". l(t("Parent term"), "admin/taxonomy/help#parent") .".", 0, "<". t("root") .">", $exclude); } elseif ($vocabulary->hierarchy == 2) { - $form .= _taxonomy_term_select(t("Parents"), "parent", $parent, $vocabulary_id, t("Required") . ". ". l(t("Parent terms"), "admin/taxonomy/help#parent") .".", 1, "<" . t("root") . ">", $exclude); + $form .= _taxonomy_term_select(t("Parents"), "parent", $parent, $vocabulary_id, t("Required") .". ". l(t("Parent terms"), "admin/taxonomy/help#parent") .".", 1, "<". t("root") .">", $exclude); } } if ($vocabulary->relations) { - $form .= _taxonomy_term_select(t("Related terms"), "relations", array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, t("Optional") . ". ", 1, "<" . t("none") . ">", array($edit["tid"])); + $form .= _taxonomy_term_select(t("Related terms"), "relations", array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, t("Optional") .". ", 1, "<". t("none") .">", array($edit["tid"])); } $form .= form_textarea(t("Synonyms"), "synonyms", implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, t("Optional") . ". ". t(l("Synonyms", "admin/taxonomy/help#synonyms") ." of this term, one synonym per line.")); @@ -277,7 +269,7 @@ function _taxonomy_confirm_del_term($tid) { function taxonomy_overview() { - $output .= "<h3>" . t("Vocabularies overview") . "</h3>"; + $output .= "<h3>". t("Vocabularies overview") ."</h3>"; $header = array(t("name"), t("node types"), array("data" => t("operations"), "colspan" => 3)); @@ -308,7 +300,7 @@ function taxonomy_form($vocabulary_id, $value = 0) { } else { $verb = "can"; - $blank = "<" . t("none") . ">"; + $blank = "<". t("none") .">"; } if ($vocabulary->multiple) { @@ -615,7 +607,7 @@ function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $descripti if (count($options) > 0) { foreach ($options as $option) { - $select .= "<option value=\"".$option["tid"]."\"". (is_array($value) ? (in_array($option["tid"], $value) ? " selected=\"selected\"" : "") : ($option["tid"] == $value ? " selected=\"selected\"" : "")) .">". check_form($option["name"]) ."</option>"; + $select .= "<option value=\"". $option["tid"] ."\"". (is_array($value) ? (in_array($option["tid"], $value) ? " selected=\"selected\"" : "") : ($option["tid"] == $value ? " selected=\"selected\"" : "")) .">". check_form($option["name"]) ."</option>"; } $size = min(12, count($options)); @@ -666,7 +658,7 @@ function taxonomy_select_nodes($taxonomy, $pager = 1) { $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid WHERE r.tid IN ($taxonomy->str_tids) AND n.status = '1'"; } else { - $sql = "SELECT n.nid, n.title, n.type, n.created, n.changed, n.uid, u.name FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid WHERE r.tid IN ($taxonomy->str_tids) AND n.status = '1' GROUP BY n.nid, n.title, n.type, n.created, n.changed, n.uid, u.name HAVING COUNT(n.nid) = ".count($taxonomy->tids)." ORDER BY static DESC, created DESC"; + $sql = "SELECT n.nid, n.title, n.type, n.created, n.changed, n.uid, u.name FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid WHERE r.tid IN ($taxonomy->str_tids) AND n.status = '1' GROUP BY n.nid, n.title, n.type, n.created, n.changed, n.uid, u.name HAVING COUNT(n.nid) = ". count($taxonomy->tids) ." ORDER BY static DESC, created DESC"; // Special trick as we could not find anything better: $count = db_num_rows(db_query("SELECT n.nid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid WHERE r.tid IN ($taxonomy->str_tids) AND n.status = '1' GROUP BY n.nid HAVING COUNT(n.nid) = ". count($taxonomy->tids))); @@ -807,16 +799,16 @@ function taxonomy_help($section = "admin/taxonomy/help") { $output = ""; switch ($section) { - case "admin/system/modules": + case 'admin/system/modules#description': $output = t("Enables the organization of content into categories."); break; - case "admin/taxonomy": + case 'admin/taxonomy': $output = t("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) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). To delete a term choose \"edit term\". To delete a vocabulary, and all its terms, choose \"edit vocabulary\"."); break; - case "admin/taxonomy/add/vocabulary": + case 'admin/taxonomy/add/vocabulary': $output = t("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 node type (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."); break; - case "admin/taxonomy/help": + case 'admin/taxonomy/help': $output .= "<h3>Background</h3><p>Taxonomy is the study of classification. Drupal's taxonomy module allows you to define categories which are used to classify content. The module supports hierarchical classification and association between terms, allowing for truly flexible information retrieval and classification. For more details about %classification-types and insight into the development of the <i>taxonomy.module</i>, see this %drupal-dis.</p>"; $output .= "<h3>An example taxonomy: food</h3><ul><li>Dairy<ul><li>Milk</li></ul></li><li>Drink<ul><li>Alchohol<ul><li>Beer</li><li>Wine</li></ul></li><li>Pop</li><li>Milk</li></ul></li><li>Meat<ul><li>Beef</li><li>Chicken</li><li>Lamb</li></ul></li><li>Spices<ul><li>Sugar</li></ul></li></ul>"; $output .= "<p><b>Notes</b></p><ul><li>The term <i>Milk</i> appears within both <i>Dairy</i> and <i>Drink</i>. This is an example of <i>multiple parents</i> for a term.</li><li>In Drupal the order of siblings (e.g. <i>Beef</i>, <i>Chicken</i>, <i>Lamb</i>) in a taxonomy may be controlled with the <i>weight</i> parameter.</li></ul>"; diff --git a/modules/throttle.module b/modules/throttle.module index ff19470fa..dd11a0dfb 100644 --- a/modules/throttle.module +++ b/modules/throttle.module @@ -1,16 +1,6 @@ <?php // $Id$ -function throttle_system($field) { - $output = ""; - - if ($field == "description") {$output = throttle_help("admin/system/modules"); } - else if ($field == "admin_help") {$output = throttle_help("admin/system/modules/throttle"); }; - - return $output; -} - - function throttle_perm() { /* ** throttle module defines the following permissions: @@ -22,11 +12,11 @@ function throttle_perm() { function throttle_help($section = "admin/throttle/help") { switch ($section) { - case "admin/system/modules": + case "admin/system/modules#description": $output = t("Allows configuration of congestion control auto-throttle mechanism."); break; case "admin/system/modules/throttle": - return t("If your site gets popular, or comes under a \"Denial of Service\" (DOS) attack, your hardware might become overwhelmed. These settings allow you to \"slow down\" the access to your site. To use throttle you need to have the %access enabled. For Drupal to preform throttling it needs to do an extra database query. This extra query happens on page displays. <b>Auto-throttle probability limiter</b> tells Drupal to do this extra DB query once every \"x\" page displays, where \"x\" is the percentage. So if it is set to 10%, the default, then for every 100 web pages it displays, it will preform the extra query ten time. ", array("%access" => l(t("access log"), "admin/system/modules/statistics") )); + return t("If your site gets popular, or comes under a \"Denial of Service\" (DOS) attack, your hardware might become overwhelmed. These settings allow you to \"slow down\" the access to your site. To use throttle you need to have the %access enabled. For Drupal to preform throttling it needs to do an extra database query. This extra query happens on page displays. <b>Auto-throttle probability limiter</b> tells Drupal to do this extra DB query once every \"x\" page displays, where \"x\" is the percentage. So if it is set to 10%, the default, then for every 100 web pages it displays, it will preform the extra query ten time. ", array("%access" => l(t("access log"), "admin/system/modules/statistics"))); case "admin/throttle/help": $output .= "<h3>Introduction</h3><p>This Drupal module allows you to enable and configure the auto-throttle congestion control mechanism offered by the %stats-mod. The auto-throttle mechanism allows your site to automatically adapt to different server levels.</p>"; $output .= "<p>This module also adds a block that displays the current status of the throttle. You must have \"%throttle-block\" privileges to view the block. As a general rule of thumb, only site administrators should be granted access to this block.</p>"; @@ -58,7 +48,7 @@ function throttle_help($section = "admin/throttle/help") { else { // throttle limit not reached, execute normally }</pre></p>"; - $output = t($output, array("%stats-mod" => l(t("statistics-module"), "admin/statistics"), "%throttle-block" => l(t("access throttle block"), "admin/user/permission"), "%modules-enable" => l(t("enabled"), "admin/ststem/modules"),"throttle-config" => l(t("configuration section"), "admin/system/modules/throttle"), "%stats-config" => l(t("statistcs.module"), "admin/system/modules/statistics"), "%throttle-access" => l(t("access throttle block"), "admin/user/permission"),"%throttle-block-enable" => l(t("here"), "admin/block"), "%permissions" => l(t("user permissions"), "admin/user/permission") )); + $output = t($output, array("%stats-mod" => l(t("statistics-module"), "admin/statistics"), "%throttle-block" => l(t("access throttle block"), "admin/user/permission"), "%modules-enable" => l(t("enabled"), "admin/ststem/modules"), "throttle-config" => l(t("configuration section"), "admin/system/modules/throttle"), "%stats-config" => l(t("statistcs.module"), "admin/system/modules/statistics"), "%throttle-access" => l(t("access throttle block"), "admin/user/permission"), "%throttle-block-enable" => l(t("here"), "admin/block"), "%permissions" => l(t("user permissions"), "admin/user/permission"))); break; } diff --git a/modules/throttle/throttle.module b/modules/throttle/throttle.module index ff19470fa..dd11a0dfb 100644 --- a/modules/throttle/throttle.module +++ b/modules/throttle/throttle.module @@ -1,16 +1,6 @@ <?php // $Id$ -function throttle_system($field) { - $output = ""; - - if ($field == "description") {$output = throttle_help("admin/system/modules"); } - else if ($field == "admin_help") {$output = throttle_help("admin/system/modules/throttle"); }; - - return $output; -} - - function throttle_perm() { /* ** throttle module defines the following permissions: @@ -22,11 +12,11 @@ function throttle_perm() { function throttle_help($section = "admin/throttle/help") { switch ($section) { - case "admin/system/modules": + case "admin/system/modules#description": $output = t("Allows configuration of congestion control auto-throttle mechanism."); break; case "admin/system/modules/throttle": - return t("If your site gets popular, or comes under a \"Denial of Service\" (DOS) attack, your hardware might become overwhelmed. These settings allow you to \"slow down\" the access to your site. To use throttle you need to have the %access enabled. For Drupal to preform throttling it needs to do an extra database query. This extra query happens on page displays. <b>Auto-throttle probability limiter</b> tells Drupal to do this extra DB query once every \"x\" page displays, where \"x\" is the percentage. So if it is set to 10%, the default, then for every 100 web pages it displays, it will preform the extra query ten time. ", array("%access" => l(t("access log"), "admin/system/modules/statistics") )); + return t("If your site gets popular, or comes under a \"Denial of Service\" (DOS) attack, your hardware might become overwhelmed. These settings allow you to \"slow down\" the access to your site. To use throttle you need to have the %access enabled. For Drupal to preform throttling it needs to do an extra database query. This extra query happens on page displays. <b>Auto-throttle probability limiter</b> tells Drupal to do this extra DB query once every \"x\" page displays, where \"x\" is the percentage. So if it is set to 10%, the default, then for every 100 web pages it displays, it will preform the extra query ten time. ", array("%access" => l(t("access log"), "admin/system/modules/statistics"))); case "admin/throttle/help": $output .= "<h3>Introduction</h3><p>This Drupal module allows you to enable and configure the auto-throttle congestion control mechanism offered by the %stats-mod. The auto-throttle mechanism allows your site to automatically adapt to different server levels.</p>"; $output .= "<p>This module also adds a block that displays the current status of the throttle. You must have \"%throttle-block\" privileges to view the block. As a general rule of thumb, only site administrators should be granted access to this block.</p>"; @@ -58,7 +48,7 @@ function throttle_help($section = "admin/throttle/help") { else { // throttle limit not reached, execute normally }</pre></p>"; - $output = t($output, array("%stats-mod" => l(t("statistics-module"), "admin/statistics"), "%throttle-block" => l(t("access throttle block"), "admin/user/permission"), "%modules-enable" => l(t("enabled"), "admin/ststem/modules"),"throttle-config" => l(t("configuration section"), "admin/system/modules/throttle"), "%stats-config" => l(t("statistcs.module"), "admin/system/modules/statistics"), "%throttle-access" => l(t("access throttle block"), "admin/user/permission"),"%throttle-block-enable" => l(t("here"), "admin/block"), "%permissions" => l(t("user permissions"), "admin/user/permission") )); + $output = t($output, array("%stats-mod" => l(t("statistics-module"), "admin/statistics"), "%throttle-block" => l(t("access throttle block"), "admin/user/permission"), "%modules-enable" => l(t("enabled"), "admin/ststem/modules"), "throttle-config" => l(t("configuration section"), "admin/system/modules/throttle"), "%stats-config" => l(t("statistcs.module"), "admin/system/modules/statistics"), "%throttle-access" => l(t("access throttle block"), "admin/user/permission"), "%throttle-block-enable" => l(t("here"), "admin/block"), "%permissions" => l(t("user permissions"), "admin/user/permission"))); break; } diff --git a/modules/title.module b/modules/title.module index 5e6c2e6bd..47c956c3e 100644 --- a/modules/title.module +++ b/modules/title.module @@ -1,18 +1,11 @@ <?php // $Id$ -function title_system($field){ - $output = ""; - - if ($field == "description") {$output = title_help("admin/system/modules"); }; - return $output; -} - function title_help($section) { $output = ""; switch ($section) { - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables users to link to stories, articles or similar content by title."); break; } @@ -29,7 +22,7 @@ function title_page() { if (db_num_rows($result) == 0) { // No node with exact title found, try substring. - $result = db_query("SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.title LIKE '%". check_query($title). "%' AND n.status = 1 ORDER BY n.created DESC"); + $result = db_query("SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.title LIKE '%". check_query($title) ."%' AND n.status = 1 ORDER BY n.created DESC"); } if (db_num_rows($result) == 0 && module_exist("search")) { @@ -70,7 +63,7 @@ function title_page() { // filter [node title|description] links. '|description' is optional. function title_filter($text) { - if(variable_get("title_filter_link", 0)) { + if (variable_get("title_filter_link", 0)) { $pattern = '\[([^\|\]]+)(?>\|?)(.*?)\]'; // $1 == title: matches at least 1 char up to the first '|' or ']' // $2 == text: matches all after a following '|' (if there is) up to the next ']'. may include '|'s. $replacement = 'l("$2" ? "$2" : "$1", "title/". urlencode("$1"))'; diff --git a/modules/tracker.module b/modules/tracker.module index 1fdd6c093..d40079cb3 100644 --- a/modules/tracker.module +++ b/modules/tracker.module @@ -8,7 +8,7 @@ function tracker_help($section = "admin/tracker/help") { case 'admin/tracker/help': $output = t("<p>The tracker module is a handy module for displaying the most recent posts. By following the <i>view recent posts</i> link in the user block, a user may quickly review all recent postings.</p>"); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables tracking of recent posts for users."); break; } @@ -16,13 +16,6 @@ function tracker_help($section = "admin/tracker/help") { return $output; } -function tracker_system($field) { - $output = ""; - - if ($field == "description") {$output = tracker_help("admin/system/modules"); }; - return $output; -} - function tracker_link($type) { $links = array(); @@ -73,7 +66,7 @@ function tracker_posts($id = 0) { $comments = array(); while ($comment = db_fetch_object($cresult)) { - $comments[] = "<li>". t("%subject by %author", array("%subject" => l($comment->subject, "node/view/$node->nid#$comment->cid"), "%author" => format_name($comment))). " ". (node_is_new($comment->nid, $comment->timestamp) ? theme("theme_mark") : "") ."</li>\n"; + $comments[] = "<li>". t("%subject by %author", array("%subject" => l($comment->subject, "node/view/$node->nid#$comment->cid"), "%author" => format_name($comment))) ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme("theme_mark") : "") ."</li>\n"; } if ($comments) { diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module index 1fdd6c093..d40079cb3 100644 --- a/modules/tracker/tracker.module +++ b/modules/tracker/tracker.module @@ -8,7 +8,7 @@ function tracker_help($section = "admin/tracker/help") { case 'admin/tracker/help': $output = t("<p>The tracker module is a handy module for displaying the most recent posts. By following the <i>view recent posts</i> link in the user block, a user may quickly review all recent postings.</p>"); break; - case 'admin/system/modules': + case 'admin/system/modules#description': $output = t("Enables tracking of recent posts for users."); break; } @@ -16,13 +16,6 @@ function tracker_help($section = "admin/tracker/help") { return $output; } -function tracker_system($field) { - $output = ""; - - if ($field == "description") {$output = tracker_help("admin/system/modules"); }; - return $output; -} - function tracker_link($type) { $links = array(); @@ -73,7 +66,7 @@ function tracker_posts($id = 0) { $comments = array(); while ($comment = db_fetch_object($cresult)) { - $comments[] = "<li>". t("%subject by %author", array("%subject" => l($comment->subject, "node/view/$node->nid#$comment->cid"), "%author" => format_name($comment))). " ". (node_is_new($comment->nid, $comment->timestamp) ? theme("theme_mark") : "") ."</li>\n"; + $comments[] = "<li>". t("%subject by %author", array("%subject" => l($comment->subject, "node/view/$node->nid#$comment->cid"), "%author" => format_name($comment))) ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme("theme_mark") : "") ."</li>\n"; } if ($comments) { diff --git a/modules/user.module b/modules/user.module index 221901fd7..4c8daaa12 100644 --- a/modules/user.module +++ b/modules/user.module @@ -4,12 +4,6 @@ session_set_save_handler("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc"); session_start(); -function user_system($field){ - $system["description"] = t("Enables the user registration and login system."); - $system["admin_help"] = t("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."); - return $system[$field]; -} - /*** Session functions *****************************************************/ function sess_open($save_path, $session_name) { @@ -484,11 +478,11 @@ function user_block($op = "list", $delta = 0) { } function theme_user_list($items, $title = NULL) { - return theme("theme_item_list",$items, $title); + return theme("theme_item_list", $items, $title); } function theme_menu_list($items, $title = NULL) { - return theme("theme_item_list",$items, $title); + return theme("theme_item_list", $items, $title); } function user_link($type) { @@ -521,7 +515,7 @@ function user_link($type) { $i = 2; foreach (user_roles(1) as $key => $value) { - menu("admin/user/account/". $i++, t("users with role '%role'", array("%role" => $value)), "user_admin", NULL, 4); + menu("admin/user/account/$i", t("users with role '%role'", array("%role" => $value)), "user_admin", user_help("admin/user/account/".$i++), 4); } } } @@ -583,7 +577,7 @@ function user_set_authmaps($account, $authmaps) { function user_auth_help_links() { $links = array(); foreach (module_list() as $module) { - if (module_hook($module, "auth_help")) { + if (module_hook($module, "auth")) { $links[] = l(module_invoke($module, "info", "name"), "user/help#$module"); } } @@ -946,7 +940,7 @@ function user_register($edit = array()) { $affiliates = user_auth_help_links(); if (count($affiliates) > 0) { $affiliates = implode(", ", $affiliates); - $output .= "<p>" . t("Note: If you have an account with one of our affiliates (%s), you may ". l("login now", "user/login") ." instead of registering.", array("%s" => $affiliates)) ."</p>"; + $output .= "<p>". t("Note: If you have an account with one of our affiliates (%s), you may ". l("login now", "user/login") ." instead of registering.", array("%s" => $affiliates)) ."</p>"; } $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64, t("A password and instructions will be sent to this e-mail address, so make sure it is accurate.")); @@ -970,7 +964,7 @@ function user_delete() { $edit = $_POST["edit"]; if ($edit["confirm"]) { - watchdog("user","$user->name deactivated her own account."); + watchdog("user", "$user->name deactivated her own account."); db_query("UPDATE {users} SET mail = 'deleted', status = '0' WHERE uid = %d", $user->uid); $output .= t("Your account has been deactivated."); } @@ -1072,7 +1066,7 @@ function user_edit($edit = array()) { $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 55, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 55, 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.")); - $output .= implode("\n", module_invoke_all ("user", "edit_form", $edit, $user)); + $output .= implode("\n", module_invoke_all("user", "edit_form", $edit, $user)); $output .= form_item(t("Password"), "<input type=\"password\" name=\"edit[pass1]\" size=\"12\" maxlength=\"24\" /> <input type=\"password\" name=\"edit[pass2]\" size=\"12\" maxlength=\"24\" />", t("Enter your new password twice if you want to change your current password or leave it blank if you are happy with your current password.")); $output .= form_submit(t("Save user information")); @@ -1201,7 +1195,7 @@ function user_page() { break; case "help": theme("header"); - theme("box", t("Distributed authentication"), user_help_users_da()); + theme("box", t("Distributed authentication"), user_help("user/help")); theme("footer"); break; default: @@ -1218,7 +1212,7 @@ function _user_mail_text($message) { return "Account details for %username at %site"; case "welcome_body": - return t("%username,\n\nThank you for registering at %site. You may now log in to ". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at ". url("user/edit") ."\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"); + return t("%username,\n\nThank you for registering at %site. You may now log in to ". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at ". url("user/edit") ."\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"); case "welcome_approval_subject": return "Account details for %username at %site (pending admin approval)"; @@ -1241,17 +1235,17 @@ function user_settings() { $output .= form_textarea(t("User registration guidelines"), "user_registration_help", variable_get("user_registration_help", ""), 70, 4, t("This text is displayed at the top of the user registration form. It's useful for helping or instructing your users.")); - $output .= form_textfield(t("Subject of welcome e-mail"), "user_mail_welcome_subject", variable_get("user_mail_welcome_subject", _user_mail_text("welcome_subject")), 70, 180, 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"); + $output .= form_textfield(t("Subject of welcome e-mail"), "user_mail_welcome_subject", variable_get("user_mail_welcome_subject", _user_mail_text("welcome_subject")), 70, 180, 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"); - $output .= form_textarea(t("Body of welcome e-mail"), "user_mail_welcome_body", variable_get("user_mail_welcome_body", _user_mail_text("welcome_body")), 70, 10, 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"); + $output .= form_textarea(t("Body of welcome e-mail"), "user_mail_welcome_body", variable_get("user_mail_welcome_body", _user_mail_text("welcome_body")), 70, 10, 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"); - $output .= form_textfield(t("Subject of welcome e-mail (awaiting admin approval)"), "user_mail_approval_subject", variable_get("user_mail_approval_subject", _user_mail_text("welcome_approval_subject")), 70, 180, 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"); + $output .= form_textfield(t("Subject of welcome e-mail (awaiting admin approval)"), "user_mail_approval_subject", variable_get("user_mail_approval_subject", _user_mail_text("welcome_approval_subject")), 70, 180, 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"); - $output .= form_textarea(t("Body of welcome e-mail (awaiting admin approval)"), "user_mail_approval_body", variable_get("user_mail_approval_body", _user_mail_text("welcome_approval_body")), 70, 10, 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"); + $output .= form_textarea(t("Body of welcome e-mail (awaiting admin approval)"), "user_mail_approval_body", variable_get("user_mail_approval_body", _user_mail_text("welcome_approval_body")), 70, 10, 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"); - $output .= form_textfield(t("Subject of password recovery e-mail"), "user_mail_pass_subject", variable_get("user_mail_pass_subject", _user_mail_text("pass_subject")), 70, 180, t("Customize the Subject of your forgotten password e-mail.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto, %date"); + $output .= form_textfield(t("Subject of password recovery e-mail"), "user_mail_pass_subject", variable_get("user_mail_pass_subject", _user_mail_text("pass_subject")), 70, 180, t("Customize the Subject of your forgotten password e-mail.") ." ". t("Available variables are:") ." ". "%username, %site, %password, %uri, %uri_brief, %mailto, %date"); - $output .= form_textarea(t("Body of password recovery e-mail"), "user_mail_pass_body", variable_get("user_mail_pass_body", _user_mail_text("pass_body")), 70, 10, t("Customize the body of the forgotten password e-mail.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto"); + $output .= form_textarea(t("Body of password recovery e-mail"), "user_mail_pass_body", variable_get("user_mail_pass_body", _user_mail_text("pass_body")), 70, 10, t("Customize the body of the forgotten password e-mail.") ." ". t("Available variables are:") ." ". "%username, %site, %password, %uri, %uri_brief, %mailto"); return $output; } @@ -1309,11 +1303,11 @@ function user_admin_access($edit = array()) { } if ($type == "mail") { - $output .= "<h3>" . t("E-mail rules") . "</h3>"; + $output .= "<h3>". t("E-mail rules") ."</h3>"; } if ($type == "user") { - $output .= "<h3>" . t("Username rules") . "</h3>"; + $output .= "<h3>". t("Username rules") ."</h3>"; } if ($op == t("Add rule")) { @@ -1345,20 +1339,20 @@ function user_admin_access($edit = array()) { $rows[] = array(t("Deny"), $rule->mask, l(t("delete rule"), "admin/user/access/$type/$rule->aid")); } - $rows[] = array("<select name=\"edit[status]\"><option value=\"1\">". t("Allow") ."</option><option value=\"0\">". t("Deny") ."</option></select>", "<input size=\"32\" maxlength=\"64\" name=\"edit[mask]\" />", "<input type=\"submit\" name=\"op\" value=\"" . t("Add rule") . "\" />"); + $rows[] = array("<select name=\"edit[status]\"><option value=\"1\">". t("Allow") ."</option><option value=\"0\">". t("Deny") ."</option></select>", "<input size=\"32\" maxlength=\"64\" name=\"edit[mask]\" />", "<input type=\"submit\" name=\"op\" value=\"". t("Add rule") ."\" />"); $output .= table($header, $rows); - $output .= "<p><small>%: " . t("Matches any number of characters, even zero characters") . ".<br />_: " . t("Matches exactly one character.") . "</small></p>"; + $output .= "<p><small>%: ". t("Matches any number of characters, even zero characters") .".<br />_: ". t("Matches exactly one character.") ."</small></p>"; if ($type != "user") { - $output .= "<h3>" . t("Check e-mail address") . "</h3>"; + $output .= "<h3>". t("Check e-mail address") ."</h3>"; } else { - $output .= "<h3>" . t("Check username") . "</h3>"; + $output .= "<h3>". t("Check username") ."</h3>"; } - $output .= "$message<input type=\"text\" size=\"32\" maxlength=\"64\" name=\"edit[test]\" value=\"". $edit["test"] ."\" /><input type=\"submit\" name=\"op\" value=\"" . t("Check") . "\" />"; + $output .= "$message<input type=\"text\" size=\"32\" maxlength=\"64\" name=\"edit[test]\" value=\"". $edit["test"] ."\" /><input type=\"submit\" name=\"op\" value=\"". t("Check") ."\" />"; return form($output); } @@ -1697,125 +1691,115 @@ function user_admin() { return $output; } } -// this help is for end users -function user_help_users_da() { - $site = "<i>". variable_get("site_name", "this website"). "</i>"; - - $output = " - <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 %s, you do not have to fill out a registration form - if you are already a member of "; - - $output .= implode(", ", user_auth_help_links()); - $output .= ". This capability is called <i>Distributed - Authentication</i>, and is unique to <a href=\"http://www.drupal.org\">Drupal</a>, - the software which powers %s.</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 %s. 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=\"http://www.delphiforums.com\">Delphi Forums</a>. Drupal informs Joe - on registration and login screens that he may login with his Delphi ID instead - of registering with %s. Joe likes that idea, and logs in with a username - of joe@remote.delphiforums.com and his usual Delphi password. Drupal then contacts - the <i>remote.delphiforums.com</i> server behind the scenes (usually using <a href=\"http://www.xmlrpc.com\">XML-RPC</a>, - <a href=\"http://www.w3.org/Protocols/\">HTTP POST</a>, or <a href=\"http://www.soapware.org\">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 %s in the same manner, and he will always be logged into the - same account.</p>"; - - $output = strtr($output, array("%s" => $site)); - - 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, "auth_help"); - } - } - - return $output; -} - // the following functions comprise help for admins and developers function user_help($section = "admin/user/help") { + $output = ""; switch ($section) { - case "admin/user/help": - $output = user_help_admin(); - $output .= user_help_admin_da(); - $output .= user_help_devel_da(); - $output .= user_help_devel_userhook(); - return t($output); - case "admin/user": - return t("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.<br />Click on either the \"username\" or \"edit account\" to edit a user's information."); - case "admin/user/account": - return t("This page allows you to review and edit any user's profile. To edit a profile click on either the \"username\" or \"edit account\"."); - case "admin/user/account/create": - return t("This web page allows the administrators to register a new users by hand.<br />Note:<ul><li>You cannot have a user where either the e-mail address or the username match another user in the system.</li></ul>"); - case "admin/user/account/0": - return t("This page allows you to review and edit an active user's profile. To edit a profile click on either the \"username\" or \"edit account\"."); - case "admin/user/account/1": - return t("This page allows you to review and edit a new user's profile. To edit a profile click on either the \"username\" or \"edit account\"."); - case "admin/user/account/2": - return t("This page allows you to review and edit a blocked user's profile. To edit a profile click on either the \"username\" or \"edit account\"."); - case "admin/user/access": - return t("Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on <a href=\"%e-mail\">e-mail rules</a>, for the username mask click on <a href=\"%username\">username rules</a>.", array("%e-mail" => url("admin/user/access/mail"), "%username" => url("admin/user/access/user"))); - case "admin/user/access/mail": - return t("Setup and test the e-mail access rules. The access function checks if you match a deny and <b>not</b> an allow. If you match <b>only</b> a deny then it is denied. Any other case, such as both a deny and an allow pattern matching, allows the pattern.<br />Notes: <ul><li>To delete a rule click on \"delete rule\".</li><li>The order of the rules does <b>not</b> matter.</li></ul>"); - case "admin/user/access/user": - return t("Setup and test the Username access rules. The access function checks if you match a deny and <b>not</b> an allow. If you do then it is denied. Any other case, such as a deny pattern and an allow pattern, allows the pattern.<br />Notes: <ul><li>To delete a rule click on \"delete rule\".</li><li>The order of the rules does <b>not</b> matter.</li></ul>"); - case "admin/user/permission": - return t("In this area you will define the <b>permissions</b> for each user role (role names are defined on the <a href=\"%role\">user roles page</a>). Each permission describes a fine-grained logical operation, such as being able to access the administration pages, or adding/modifying a user account. You could say a permission represents access granted to a user to perform a set of operations.", array("%role" => url("admin/user/role"))); - case "admin/user/role": - return t("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=\"%permission\">user permissions</a>. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <b>names</b> of the various roles. To delete a role choose \"edit role\"<br />By default, Drupal comes with two user roles: <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 assigned automatically to authenticated users. Most registered users will belong to this user role unless specified otherwise.</li></ul>", array("%permission" => url("admin/user/permission"))); - case "admin/user/search": - return t("Enter a simple pattern ( '*' may be user as a wildcard match) to search for a username. For example, one may search for 'br' and Drupal might return 'brian', 'brad', and 'brenda'."); - } -} + case 'admin/user': + $output .= t("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.<br />Click on either the \"username\" or \"edit account\" to edit a user's information."); + break; + case 'admin/user/account/create': + $output .= t("This web page allows the administrators to register a new users by hand.<br />Note:<ul><li>You cannot have a user where either the e-mail address or the username match another user in the system.</li></ul>"); + break; + case (preg_match("/^admin\/user\/account.*/i", $section) ? $section : !$section): + $output .= t("This page allows you to review and edit %role-name. To edit a profile click on either the \"username\" or \"edit account\"."); -function user_help_admin() { - $output .= "<h3>Introduction</h3><p>Drupal offers a powerful access system that allows users to register, login, logout, maintain user profiles, etc. By using \"". l ("roles", "admin/user/role") ."\" you can setup fine grained ". l("permissions", "admin/user/permission") ." allowing each role to do only what you want them to. Each user is assigned to a role. By default there are two roles \"anonymous\" - a user who has not logged in, and \"authorized\" a user who has signed up and who has been authorized. As anonymous users, participants suffer numerous disadvantages, for example they cannot sign their names to nodes, and their moderated posts beginning at a lower score.</p>"; - $output .= "<p>In contrast, those with a user account can use their own name or handle and are granted various privileges: the most important is probably the ability to moderate new submissions, to rate comments, and to fine-tune the site to their personal liking, with saved personal settings. Drupal themes make fine tuning quite a pleasure.</p>"; - $output .= "<p>Registered users need to authenticate by supplying either a local username and password, or a remote username and password such as a ". l("jabber", "www.jabber.org") .", ". l("Delphi", "www.delphiforums.com") .", or one from another ". l("Drupal", "www.drupal.org") ." website. See ". l("distributed authentication", "#da") ." for more information on this innovative feature."; - $output .= "The local username and password, hashed with Message Digest 5 (MD5), are stored in your database. When you enter a password it is also hashed with MD5 and compaired with what is in the database. If the hashes match, the username and password are correct. Once a user authenticated session is started, and until that session is over, the user won't have to re-authenticate. To keep track of the individual sessions, Drupal relies on ". l("PHP's session support", "www.php.net/manual/en/ref.session.php") .". 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's side. When a visitor accesses your site, Drupal will check whether a specific session ID has been sent with the request. If this is the case, the prior saved environment is recreated.</p>"; - $output .= "<h3>User preferences and profiles</h3><p>Each Drupal user has a profile, and a set of preferences which may be edited by clicking on the ". l("user account", "user") ." link. Of course, a user must be logged into reach those pages. There, users will find a page for changing their preferred time zone, language, username, e-mail address, password, theme, signature, homepage, and ". l("distributed authentication", "#da") ." names. Changes made here take effect immediately. Also, administrators may make profile and preferences changes in the ". l("Admin Center", "admin/user") ." on behalf of their users.</p>"; - $output .= "<p>Module developers are provided several hooks for adding custom fields to the user view/edit pages. These hooks are described in the Developer section of the ". l("Drupal documentation", "drupal.org/node/view/316") .". For an example, see the <code>jabber_user()</code> function in <i>/modules/jabber.module</i>.</p>"; - return $output; -} + $role = substr(strrchr($section, "/"), 1); -function user_help_admin_da() { + if ($role == "account") { + $replace = t("any user's profile"); + } + else if ($role == "1") { + $replace = t("a blocked user's profile"); + } + else { + $output = strtr($output, array("%role-name" => t("a user with the '%role-name' role"))); + $role_names = user_roles(1); + $replace = $role_names[$role]; + } + $output = strtr($output, array("%role-name" => $replace)); + break; + case 'admin/user/access': + $output .= t("Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on %e-mail, for the username mask click on %username.", array("%e-mail" => l(t("e-mail rules"), "admin/user/access/mail"), "%username" => l(t("username rules"), "admin/user/access/user"))); + break; + case 'admin/user/access/mail': + $output .= t("Setup and test the e-mail access rules. The access function checks if you match a deny and <b>not</b> an allow. If you match <b>only</b> a deny then it is denied. Any other case, such as both a deny and an allow pattern matching, allows the pattern.<br />Notes: <ul><li>To delete a rule click on \"delete rule\".</li><li>The order of the rules does <b>not</b> matter.</li></ul>"); + break; + case 'admin/user/access/user': + $output .= t("Setup and test the Username access rules. The access function checks if you match a deny and <b>not</b> an allow. If you do then it is denied. Any other case, such as a deny pattern and an allow pattern, allows the pattern.<br />Notes: <ul><li>To delete a rule click on \"delete rule\".</li><li>The order of the rules does <b>not</b> matter.</li></ul>"); + break; + case 'admin/user/permission': + $output .= t("In this area you will define the <b>permissions</b> for each user role (role names are defined on the %role). Each permission describes a fine-grained logical operation, such as being able to access the administration pages, or adding/modifying a user account. You could say a permission represents access granted to a user to perform a set of operations.", array("%role" => l(t("user roles page"), "admin/user/role"))); + break; + case 'admin/user/role': + $output .= "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 %permission. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <b>names</b> of the various roles. To delete a role choose \"edit role\"<br />By default, Drupal comes with two user roles:"; + $output .= "<ul>"; + $output .= "<li>Anonymous user: this role is used for users that don't have a user account or that are not authenticated.</li>"; + $output .= "<li>Authenticated user: this role is assigned automatically to authenticated users. Most registered users will belong to this user role unless specified otherwise.</li>"; + $output .= "</ul>"; + $output = t($output, array("%permission" => l(t("user permissions"), "admin/user/permission"))); + case 'admin/user/search': + $output .= t("Enter a simple pattern ( '*' may be user as a wildcard match) to search for a username. For example, one may search for 'br' and Drupal might return 'brian', 'brad', and 'brenda'."); + break; + case 'admin/system/modules#description': + $output .= t("Enables the user registration and login system."); + break; + case 'admin/system/modules/user': + $output .= t("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."); + break; + case 'user/help': + $site = variable_get("site_name", "this website"); - $output .= "<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. The reg form provides helpful information to the website owner, but not much value for the user. The value for the end user is usually the ability to post a messages or receive personalized news, etc. Distributed authentication (DA) gives the user what they want without having to fill out the reg form. Removing this obstacle yields more registered and active users for the website.</p>"; - $output .= "<p>DA enables a new user to input a username and password into the login box and immediately be recognized, even if that user never registered on your site. This works because Drupal knows how to communicate with external registration databases. For example, lets say that your new user 'Joe' is already a registered member of Delphi Forums. If your Drupal has delphi.module installed, then Drupal will inform Joe on the registration and login screens that he may login with his Delphi ID instead of registering with your Drupal instance. Joe likes that idea, and logs in with a username of joe@remote.delphiforums.com and his usual Delphi password. Drupal then communicates with remote.delphiforums.com (usually using ". l("XML-RPC","www.xmlrpc.com") ." ". l("HTTP POST", "www.w3.org/Protocols/") .", or ". l("SOAP", "www.soapware.org") .") behind the scenes and asks "is this password for username=joe?" If Delphi replies yes, then Drupal will create a new local account for joe and log joe into it. Joe may keep on logging into your Drupal instance in the same manner, and he will be logged into the same joe@remote.delphiforums.com account.</p>"; - $output .= "<p>One key element of DA is the 'authmap' table, which maps a user's authname (e.g. joe@remote.delphiforums.com) to his local UID (i.e. universal identification number). This map is checked whenever a user successfully logs into an external authentication source. Once Drupal knows that the current user is definately joe@remote.delphiforums.com (because Delphi says so), he looks up Joe's UID and logs Joe into that account.</p>"; - $output .= "<p>To disable distributed authentication, simply ". l("disable", "admin/system/modules") ." or remove all DA modules. For a virgin install, that means removing/disabling <i>jabber.module</i> and <i>drupal.module</i></p>"; - $output .= "<p>Drupal is setup so that it is very easy to add support for any external authentication source. You currently have the following authentication modules installed ...</p>"; + $output .= "<h3>Distributed authentication<a id=\"da\"></a></h3>"; + $output .= "<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 <i>Distributed Authentication</i>, and is unique to %drupal, the software which powers %site.</p>"; + $output .= "<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 %delphi-forums. 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 <i>remote.delphiforums.com</i> server behind the scenes (usually using %xml, %http-post, or %soap) 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>"; - foreach (module_list() as $module) { - if (module_hook($module, "auth")) { - $output .= "<h4>" . module_invoke($module, "info", "name") . "</h4>"; - $output .= module_invoke($module, "auth_help"); - } - } - return $output; -} + $output = t($output, array("%help-links" => (implode(", ", user_auth_help_links())), "%site" => "<i>$site</i>", "%drupal" => "<a href=\"http://www.drupal.org\">Drupal</a>", "%delphi-forums" => "<a href=\"http://www.delphiforums.com\">Delphi Forums</a>", "%xml" => "<a href=\"http://www.xmlrpc.com\">XML-RPC</a>", "%http-post" => "<a href=\"http://www.w3.org/Protocols/\">HTTP POST</a>", "%soap" => "<a href=\"http://www.soapware.org\">SOAP</a>")); -function user_help_devel_da() { - $output .= "<h3>Writing distributed authentication modules</h3><p>Drupal is specifically architected to enable easy authoring of new authentication modules. I'll deconstruct the ". l("Blogger", "www.blogger.com") ." authentication module, and hopefully provide all the details you'll need to write your own auth module. If you want to download the full text of this module, visit the ". l("Blogger source", "cvs.drupal.org/viewcvs.cgi/contributions/modules/authentication/Blogger/?cvsroot=contrib") ." in the ". l("Drupal contributions CVS repository", "cvs.drupal.org/viewcvs/contributions/?cvsroot=contrib") .".</p>"; - $output .= "<h4>Code review</h4><pre><?php</pre><p>The first line of every Drupal module, including the authentication modules, is the same. It is the standard processing instruction for any PHP file. Authentication modules are always written in PHP, although they typically interact with systems written in many different programming languages and operating systems languages.</p>"; - $output .= "<pre>function blogger_info(\$field = NULL) { + 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"); + } + } + break; + case 'admin/user/help': + + // Start of user_help_admin + $output .= "<h3>Introduction</h3><p>Drupal offers a powerful access system that allows users to register, login, logout, maintain user profiles, etc. By using \"%user-role\" you can setup fine grained %user-permission allowing each role to do only what you want them to. Each user is assigned to a role. By default there are two roles \"anonymous\" - a user who has not logged in, and \"authorized\" a user who has signed up and who has been authorized. As anonymous users, participants suffer numerous disadvantages, for example they cannot sign their names to nodes, and their moderated posts beginning at a lower score.</p>"; + $output .= "<p>In contrast, those with a user account can use their own name or handle and are granted various privileges: the most important is probably the ability to moderate new submissions, to rate comments, and to fine-tune the site to their personal liking, with saved personal settings. Drupal themes make fine tuning quite a pleasure.</p>"; + $output .= "<p>Registered users need to authenticate by supplying either a local username and password, or a remote username and password such as a %jabber, %delphiforums, or one from another %drupal website. See %da-auth for more information on this innovative feature."; + $output .= "The local username and password, hashed with Message Digest 5 (MD5), are stored in your database. When you enter a password it is also hashed with MD5 and compaired with what is in the database. If the hashes match, the username and password are correct. Once a user authenticated session is started, and until that session is over, the user won't have to re-authenticate. To keep track of the individual sessions, Drupal relies on %php-sess. 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. When a visitor accesses your site, Drupal will check whether a specific session ID has been sent with the request. If this is the case, the prior saved environment is recreated.</p>"; + $output .= "<h3>User preferences and profiles</h3><p>Each Drupal user has a profile, and a set of preferences which may be edited by clicking on the %user-prefs link. Of course, a user must be logged into reach those pages. There, users will find a page for changing their preferred time zone, language, username, e-mail address, password, theme, signature, homepage, and %da-auth names. Changes made here take effect immediately. Also, administrators may make profile and preferences changes in %admin-user on behalf of their users.</p>"; + $output .= "<p>Module developers are provided several hooks for adding custom fields to the user view/edit pages. These hooks are described in the Developer section of the %da-devel. For an example, see the <code>jabber_user()</code> function in <i>/modules/jabber.module</i>.</p>"; + //end of user_help_admin + + //start of user_help_admin_da + $output .= "<h3>Distributed authentication<a id=\"da\"></a></h3>"; + $output .= "<p>One of the more tedious moments in visiting a new website is filling out the registration form. The reg form provides helpful information to the website owner, but not much value for the user. The value for the end user is usually the ability to post a messages or receive personalized news, etc. Distributed authentication (DA) gives the user what they want without having to fill out the reg form. Removing this obstacle yields more registered and active users for the website.</p>"; + $output .= "<p>DA enables a new user to input a username and password into the login box and immediately be recognized, even if that user never registered on your site. This works because Drupal knows how to communicate with external registration databases. For example, lets say that your new user 'Joe' is already a registered member of Delphi Forums. If your Drupal has delphi.module installed, then Drupal will inform Joe on the registration and login screens that he may login with his Delphi ID instead of registering with your Drupal instance. Joe likes that idea, and logs in with a username of joe@remote.delphiforums.com and his usual Delphi password. Drupal then communicates with remote.delphiforums.com (usually using %xml, %http-post, or %soap) behind the scenes and asks "is this password for username=joe?" If Delphi replies yes, then Drupal will create a new local account for joe and log joe into it. Joe may keep on logging into your Drupal instance in the same manner, and he will be logged into the same joe@remote.delphiforums.com account.</p>"; + $output .= "<p>One key element of DA is the 'authmap' table, which maps a user's authname (e.g. joe@remote.delphiforums.com) to his local UID (i.e. user identification number). This map is checked whenever a user successfully logs into an external authentication source. Once Drupal knows that the current user is definately joe@remote.delphiforums.com (because Delphi says so), he looks up Joe's UID and logs Joe into that account.</p>"; + $output .= "<p>To disable distributed authentication, simply %dis-mod or remove all DA modules. For a virgin install, that means removing/disabling <i>jabber.module</i> and <i>drupal.module</i></p>"; + $output .= "<p>Drupal is setup so that it is very easy to add support for any external authentication source. You currently have the following authentication modules installed ...</p>"; + $output .= "%module-list"; + // end of user_help_admin_da + + // start of user_help_devel_da + $output .= "<h3>Writing distributed authentication modules</h3><p>Drupal is specifically architected to enable easy authoring of new authentication modules. I'll deconstruct the %blogger authentication module, and hopefully provide all the details you'll need to write your own auth module. If you want to download the full text of this module, visit the %blogger-source in the %contrib-cvs.</p>"; + $output .= "<h4>Code review</h4>"; + $output .= "<pre><?php</pre><p>The first line of every Drupal module, including the authentication modules, is the same. It is the standard processing instruction for any PHP file. Authentication modules are always written in PHP, although they typically interact with systems written in many different programming languages and operating systems languages.</p>"; + $output .= "<pre>function blogger_info(\$field = NULL) { \$info[\"name\"] = \"Blogger\"; \$info[\"protocol\"] = \"XML-RPC\"; - \$info[\"link\"] = \"<a href=\\\"module.php?mod=user&op=sa_help#blogger\\\">Blogger</a>\"; +// \$info[\"link\"] = \"<a href=\\\"module.php\?mod=user\&op=sa_help\#blogger\\\">Blogger</a>\"; \$info[\"maintainer\"] = \"Moshe Weitzman\"; \$info[\"maintaineremail\"] = \"weitzman at tejasa.com\"; if (\$field) return \$info[\$field]; else return \$info; }</pre>"; - $output .= "<p>The <i>_info</i> function is always the first function defined in your module. This function populates an array called <i>\$info</i> with various pieces of data. Some of this data is used by Drupal ("name", "link"), and some of it just informs the users of your module. Simply copy the <i>blogger_info</i> function in your module - but wherever it says <i>blogger</i> here, substitute your own module name.</p>"; - $output .= "<pre>function blogger_auth(\$name, \$pass, \$server) { + $output .= "<p>The <i>_info</i> function is always the first function defined in your module. This function populates an array called <i>\$info</i> with various pieces of data. Some of this data is used by Drupal ("name", "link"), and some of it just informs the users of your module. Simply copy the <i>blogger_info</i> function in your module - but wherever it says <i>blogger</i> here, substitute your own module name.</p>"; + $output .= "<pre>function blogger_auth(\$name, \$pass, \$server) { // user did not present a Blogger ID so don't bother trying. if (\$server !== "blogger.com") { return 0; @@ -1844,11 +1828,11 @@ function user_help_devel_da() { return 0; } }</pre>"; - $output .= "<p>The <i>_auth</i> function is the heart of any authentication module. This function is called whenever a user is attempting to login using your authentication module. For successful authentications, this function returns TRUE. Otherwise, it returns FALSE. This function always accepts 3 parameters, as shown above. These parameters are passed by the user system (user.module). The user system parses the username as typed by the user into 2 substrings - \$name and \$server. The parsing rules are:</p>"; - $output .= "<table border=\"0\" cellspacing=\"4\" cellpadding=\"4\" style=\"margin: auto; width: 80%;\"><tr><th colspan=\"2\" style=\"text-align: left;\">_auth function parameters</th></tr><tr><th>\$name</th><td>The substring before the final <i>'@'</i> character in the username field</td></tr><tr><th>\$pass</th><td>The whole string submitted by the user in the password field</td></tr><tr><th>\$server</th><td>The substring after the final <i>'@'</i> symbol in the username field</td></tr></table>"; - $output .= "<p>So now lets use that \$name, \$pass, and \$server which was passed to our <i>_auth</i> function. Blogger authenticates users via ". l("XML-RPC", "www.xmlrpc.org") .". Your module may authenticate using a different technique. Drupal doesn't reallly care how your module communicates with its registration source. It just <b>trusts</b> the module.</p>"; - $output .= "<p>The lines above illustrate a typical ". l("XML-RPC", "www.xmlrpc.org") ." method call. Here we build up a message and send it to Blogger, storing the response in a variable called <i>\$response</i>. The message we pass conforms to the published ". l("Blogger XML-RPC Application Programmers Interface (API)", "plant.blogger.com/API") .". Your module will no doubt implement a different API. One peculiarity of this module is that we don't actually use the $server parameter. Blogger only accepts authentication at <i>plant.blogger.com</i>, so we hard-code that value into the <i>xmlrpc_client()</i> function. A more typical example might be the jabber module, which uses the <i>\$server</i> parameter to determine where to send the authentication request. Also of note is the '5' parameter in the <i>\$client->send\(\)</i> call. This is a timeout value in seconds. All authentication modules should implement a timeout on their external calls. This makes sure to return control to the user.module if your registration database has become inoperable or unreachable.</p>"; - $output .= "<pre> + $output .= "<p>The <i>_auth</i> function is the heart of any authentication module. This function is called whenever a user is attempting to login using your authentication module. For successful authentications, this function returns TRUE. Otherwise, it returns FALSE. This function always accepts 3 parameters, as shown above. These parameters are passed by the user system (user.module). The user system parses the username as typed by the user into 2 substrings - \$name and \$server. The parsing rules are:</p>"; + $output .= "<table border=\"0\" cellspacing=\"4\" cellpadding=\"4\" style=\"margin: auto; width: 80%;\"><tr><th colspan=\"2\" style=\"text-align: left;\">_auth function parameters</th></tr><tr><th>\$name</th><td>The substring before the final <i>'@'</i> character in the username field</td></tr><tr><th>\$pass</th><td>The whole string submitted by the user in the password field</td></tr><tr><th>\$server</th><td>The substring after the final <i>'@'</i> symbol in the username field</td></tr></table>"; + $output .= "<p>So now lets use that \$name, \$pass, and \$server which was passed to our <i>_auth</i> function. Blogger authenticates users via %xml. Your module may authenticate using a different technique. Drupal doesn't reallly care how your module communicates with its registration source. It just <b>trusts</b> the module.</p>"; + $output .= "<p>The lines above illustrate a typical %xml method call. Here we build up a message and send it to Blogger, storing the response in a variable called <i>\$response</i>. The message we pass conforms to the published %blogger-api. Your module will no doubt implement a different API. One peculiarity of this module is that we don't actually use the \$server parameter. Blogger only accepts authentication at <i>plant.blogger.com</i>, so we hard-code that value into the <i>xmlrpc_client()</i> function. A more typical example might be the jabber module, which uses the <i>\$server</i> parameter to determine where to send the authentication request. Also of note is the '5'th parameter in the <i>\$client->send\(\)</i> call. This is a timeout value in seconds. All authentication modules should implement a timeout on their external calls. This makes sure to return control to the user.module if your registration database has become inoperable or unreachable.</p>"; + $output .= "<pre> if (\$result && !stristr(\$result->serialize(), "fault")) { // watchdog(\"user\", \"Success Blogger Auth. Response: \" . \$result->serialize()); return 1; @@ -1862,36 +1846,41 @@ function user_help_devel_da() { return 0; } </pre>"; - $output .= "<p>This second half of the <i>_auth</i> function examines the <i>\$response</i> from plant.blogger.com and returns a TRUE (1) or FALSE (0) as appropriate. This is a critical decision, so be sure that you have good logic here, and perform sufficient testing for all cases. In the case of Blogger, we search for the string 'fault' in the response. If that string is present, or there is no repsonse, our function returns FALSE. Otherwise, Blogger has returned valid data to our method request and we return TRUE. Note: Everything starting with \"//\" is a comment and is not executed.</p>"; - $output .= "<pre>function blogger_page() { + $output .= "<p>This second half of the <i>_auth</i> function examines the <i>\$response</i> from plant.blogger.com and returns a TRUE (1) or FALSE (0) as appropriate. This is a critical decision, so be sure that you have good logic here, and perform sufficient testing for all cases. In the case of Blogger, we search for the string 'fault' in the response. If that string is present, or there is no repsonse, our function returns FALSE. Otherwise, Blogger has returned valid data to our method request and we return TRUE. Note: Everything starting with \"//\" is a comment and is not executed.</p>"; + $output .= "<pre>function blogger_page() { theme("header"); - theme("box", "Blogger", blogger_auth_help()); + theme("box", "Blogger", blogger_help(\"user/help\")); theme("footer"); }</pre>"; - $output .= "<p>The _page function is not currently used, but it might be in the future. For now, just copy what you see here, substituting your module name for <i>blogger</i>.</p>"; - $output .= "<code>function blogger_auth_help() {<br /> - \$site = variable_get("site_name", "this web site");<br /> - \$html_output = "<blockquote> - <p>You may login to <i>%s</i> using a <b>Blogger ID</b> and password. A Blogger ID consists of your Blogger username followed by <i>@blogger.com</i>. So a valid blogger ID is mwlily@blogger.com. If you are a Blogger member, go ahead and login now.</p> - <p>Blogger offers you instant communication power by letting you post your thoughts to the web whenever the urge strikes. - Blogger will publish to your current web site or help you create one. <a href=\"http://www.blogger.com/about.pyra\">Learn more about it</a>.";</blockquote> - return sprintf(t(\$html_output), \$site);<br /> -}</code>"; - $output .= "<p>The <i>_auth_help</i> function is prominently linked within Drupal, so you'll want to write the best possible user help here. You'll want to tell users what a proper username looks like and you may also want to advertise a bit about your service at the end. Note that your help text is passed through a t() function in the last line. This is Drupal's localization function. Translators may localize your help text just like any other text in Drupal.</p>"; - $output .= "<h4>Publishing your module</h4><p>Once you've written and tested your authentication module, you'll usually want to share it with the world. The best way to do this is to add the module to the ". l("Drupal contributions CVS repository", "cvs.drupal.org/viewcvs.cgi/contributions/modules/authentication?cvsroot=contrib") .". You'll need to request priveleges to this repository - see ". l("the README file", "cvs.drupal.org/viewcvs.cgi/contributions/README?rev=HEAD&cvsroot=contrib&content-type=text/vnd.viewcvs-markup") ." for the details. Then you should announce your contribution on the ". l("drupal-devel and drupal-support mailing lists", "drupal.org/node/view/322") .". You might also want to post a story on ". l("Drupal.org", "www.drupal.org") .".</p>"; - return $output; -} - -function user_help_devel_userhook() { - - $output .= "<h3><a id=\"userhook\">module_user()</a></h3><p>The <b>_user()</b> hook provides a mechanism for inserting text and form fields into the ". l("registration","user/register") .", ". l("user account view/edit", "user") .", and ". l("administer users", "admin/user") ." pages. This is useful if you want to add a custom field for your particular community. This is best illustrated by the ". l("profile.module", "cvs.drupal.org/viewcvs/drupal/modules/profile.module") .". The profile.module is meant to be customized for your needs. Please download it and hack away until it does what you need.</p>"; - - $output .= "<p>Consider this simpler example from a fictional recipe community web site called Julia's Kitchen. Julia customizes her Drupal powered site by creating a new file called <i>julia.module</i>. That file does the following:<ul><li>new members must agree to Julia's Privacy Policy on the reg page.</li><li>members may list their favorite ingredients on their public user profile page</li></ul></p>"; - - $output .= "<p>Julia achieves this with the following code. The comments below should help you understand what is going on.</p>"; - - $output .= "<pre> + $output .= "<p>The _page function is not currently used, but it might be in the future. For now, just copy what you see here, substituting your module name for <i>blogger</i>.</p>"; + $output .= "<pre><code>function blogger_help(\$section) { + \$output = ""; + + switch (\$section) { + case 'user/help': + \$site = variable_get("site_name", "this web site");<br /> + \$output .= "<p>You may login to %site using a <b>Blogger ID</b> and password. A Blogger ID consists of your Blogger username followed by <i>@blogger.com</i>. So a valid blogger ID is <i>mwlily</i>@<b>blogger.com</b>. If you are a Blogger member, go ahead and login now.</p>"; + \$output .= "<p>Blogger offers you instant communication power by letting you post your thoughts to the web whenever the urge strikes. Blogger will publish to your current web site or help you create one. <a href=\"http://www.blogger.com/about.pyra\">Learn more about it</a>."; + \$output = t(\$output, array(\"%site\" => \"<i>\$site</i>\")); + } + + return output; +}</code></pre>"; + $output .= "<p>The <i>_help</i> function is prominently linked within Drupal, so you'll want to write the best possible user help here. You'll want to tell users what a proper username looks like and you may also want to advertise a bit about your service at the end. Note that your help text is passed through a t() function in the last line. This is Drupal's localization function. Translators may localize your help text just like any other text in Drupal.</p>"; + $output .= "<h4>Publishing your module</h4><p>Once you've written and tested your authentication module, you'll usually want to share it with the world. The best way to do this is to add the module to the %contrib-cvs. You'll need to request priveleges to this repository - see %csv-readme for the details. Then you should announce your contribution on the %drupal-lists. You might also want to post a story on %drupal-org.</p>"; + // end of user_help_devel_da + + // start of user_help_devel_userhook + $output .= "<h3><a id=\"userhook\">module_user()</a></h3><p>The <b>_user()</b> hook provides a mechanism for inserting text and form fields into the %registrtion, %user-acct, and %user-admin pages. This is useful if you want to add a custom field for your particular community. This is best illustrated by the %profile-mod. The profile.module is meant to be customized for your needs. Please download it and hack away until it does what you need.</p>"; + + $output .= "<p>Consider this simpler example from a fictional recipe community web site called Julia's Kitchen. Julia customizes her Drupal powered site by creating a new file called <i>julia.module</i>. That file does the following:<ul>"; + $output .= "<li>new members must agree to Julia's Privacy Policy on the reg page.</li>"; + $output .= "<li>members may list their favorite ingredients on their public user profile page</li>"; + $output .= "</ul></p>"; + $output .= "<p>Julia achieves this with the following code. The comments below should help you understand what is going on.</p>"; + + $output .= "<pre> function julia_user(\$type, \$edit, &\$user) { // What type of registration action are we taking? switch (\$type) { @@ -1929,6 +1918,19 @@ function julia_user(\$type, \$edit, &\$user) { } } </pre>"; + // end of user_help_devel_userhook + $output = t($output, array("%user-role" => l(t("roles"), "admin/user/role"), "%user-permission" => l(t("permission"), "admin/user/permission"), "%jabber" => "<a href=\"http://www.jabber.org\">jabber</a>", "%delphiforums" => "<a href=\"http://www.delphiforums.com/\">Delphi Forums</a>", "%drupal" => "<a href=http:\"http://www.drupal.org/\">Drupal</a>", "%da-auth" => l(t("distributed authentication"), "/user/help/#da"), "%php-sess" => "<a href=\"http://www.php.net/manual/en/ref.session.php\">". t("PHP's session support") ."</a>", "%user-prefs" => l(t("my account"), "user/edit"), "%admin-user" => l(t("administer » accounts » users"), "admin/user"), "%da-devel" => "<a href=\"http://www.drupal.org/node/view/316\">". t("Drupal documentation") ."</a>", "%xml" => "<a href=\"http://www.xmlrpc.org\">XML-RPC</a>", "%http-post" => "<a href=\"http://www.w3.org/Protocols/\">HTTP POST</a>", "%soap" => "<a href=\"http://www.soapware.org\">SOAP</a>", "%dis-mod" => l(t("disable"), "admin/system/modules"), "%blogger" => "<a href=\"http://www.blogger.com\">Blogger</a>", "%blogger-source" => "<a href=\"http://cvs.drupal.org/viewcvs.cgi/contributions/modules/authentication/Bloggar/?cvsroot=contrib\">". t("Bloggar source") ."</a>", "%contrib-cvs" => "<a href=\"http://cvs.drupal.org/veiwcvs/contributions/?cvsroot=contrib\">". t("Drupal contributions CVS repository") ."</a>", "%blogger-api" => "<a href=\"http://plant.blogger.com/API\">". t("Blogger XML-RPC Application Programmers Interface (API)") ."</a>", "%cvs-readme" => "<a href=\"http://cvs.drupal.org/viewcvs.cgi/contributions/README?rev=HEAD&cvsroot=contrib&content-type=text/vnd.viewcvs-markup\">the CVS README file</a>", "%drupal-lists" => "<a href=\"http://drupal.org/node/view/332\">drupal-devel and drupal-support mailing lists</a>", "%drupal-org" => "<a href=\"http://www.drupal.org\">Drupal.org</a>", "%registration" => l(t("registration"), "user/register"), "%user-acct" => l(t("user account view/edit"), "user"), "%user-admin" => l(t("administer users"), "admin/user"), "%profile-mod" => "<a href=\"http://cvs.drupal.org/viewcvs/drupal/modules/profile.module\">profile.module</a>")); + + foreach (module_list() as $module) { + if (module_hook($module, "auth")) { + $output = strtr($output, array("%module-list" => "<h4>". module_invoke($module, "info", "name") ."</h4>\n%module-list")); + $output = strtr($output, array("%module-list" => module_invoke($module, "help", "user/help") . "\n%module-list")); + } + } + $output = strtr($output, array("%module-list" => "")); + break; + } + return $output; } diff --git a/modules/user/user.module b/modules/user/user.module index 221901fd7..4c8daaa12 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -4,12 +4,6 @@ session_set_save_handler("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc"); session_start(); -function user_system($field){ - $system["description"] = t("Enables the user registration and login system."); - $system["admin_help"] = t("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."); - return $system[$field]; -} - /*** Session functions *****************************************************/ function sess_open($save_path, $session_name) { @@ -484,11 +478,11 @@ function user_block($op = "list", $delta = 0) { } function theme_user_list($items, $title = NULL) { - return theme("theme_item_list",$items, $title); + return theme("theme_item_list", $items, $title); } function theme_menu_list($items, $title = NULL) { - return theme("theme_item_list",$items, $title); + return theme("theme_item_list", $items, $title); } function user_link($type) { @@ -521,7 +515,7 @@ function user_link($type) { $i = 2; foreach (user_roles(1) as $key => $value) { - menu("admin/user/account/". $i++, t("users with role '%role'", array("%role" => $value)), "user_admin", NULL, 4); + menu("admin/user/account/$i", t("users with role '%role'", array("%role" => $value)), "user_admin", user_help("admin/user/account/".$i++), 4); } } } @@ -583,7 +577,7 @@ function user_set_authmaps($account, $authmaps) { function user_auth_help_links() { $links = array(); foreach (module_list() as $module) { - if (module_hook($module, "auth_help")) { + if (module_hook($module, "auth")) { $links[] = l(module_invoke($module, "info", "name"), "user/help#$module"); } } @@ -946,7 +940,7 @@ function user_register($edit = array()) { $affiliates = user_auth_help_links(); if (count($affiliates) > 0) { $affiliates = implode(", ", $affiliates); - $output .= "<p>" . t("Note: If you have an account with one of our affiliates (%s), you may ". l("login now", "user/login") ." instead of registering.", array("%s" => $affiliates)) ."</p>"; + $output .= "<p>". t("Note: If you have an account with one of our affiliates (%s), you may ". l("login now", "user/login") ." instead of registering.", array("%s" => $affiliates)) ."</p>"; } $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64, t("A password and instructions will be sent to this e-mail address, so make sure it is accurate.")); @@ -970,7 +964,7 @@ function user_delete() { $edit = $_POST["edit"]; if ($edit["confirm"]) { - watchdog("user","$user->name deactivated her own account."); + watchdog("user", "$user->name deactivated her own account."); db_query("UPDATE {users} SET mail = 'deleted', status = '0' WHERE uid = %d", $user->uid); $output .= t("Your account has been deactivated."); } @@ -1072,7 +1066,7 @@ function user_edit($edit = array()) { $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 55, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 55, 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.")); - $output .= implode("\n", module_invoke_all ("user", "edit_form", $edit, $user)); + $output .= implode("\n", module_invoke_all("user", "edit_form", $edit, $user)); $output .= form_item(t("Password"), "<input type=\"password\" name=\"edit[pass1]\" size=\"12\" maxlength=\"24\" /> <input type=\"password\" name=\"edit[pass2]\" size=\"12\" maxlength=\"24\" />", t("Enter your new password twice if you want to change your current password or leave it blank if you are happy with your current password.")); $output .= form_submit(t("Save user information")); @@ -1201,7 +1195,7 @@ function user_page() { break; case "help": theme("header"); - theme("box", t("Distributed authentication"), user_help_users_da()); + theme("box", t("Distributed authentication"), user_help("user/help")); theme("footer"); break; default: @@ -1218,7 +1212,7 @@ function _user_mail_text($message) { return "Account details for %username at %site"; case "welcome_body": - return t("%username,\n\nThank you for registering at %site. You may now log in to ". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at ". url("user/edit") ."\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"); + return t("%username,\n\nThank you for registering at %site. You may now log in to ". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at ". url("user/edit") ."\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"); case "welcome_approval_subject": return "Account details for %username at %site (pending admin approval)"; @@ -1241,17 +1235,17 @@ function user_settings() { $output .= form_textarea(t("User registration guidelines"), "user_registration_help", variable_get("user_registration_help", ""), 70, 4, t("This text is displayed at the top of the user registration form. It's useful for helping or instructing your users.")); - $output .= form_textfield(t("Subject of welcome e-mail"), "user_mail_welcome_subject", variable_get("user_mail_welcome_subject", _user_mail_text("welcome_subject")), 70, 180, 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"); + $output .= form_textfield(t("Subject of welcome e-mail"), "user_mail_welcome_subject", variable_get("user_mail_welcome_subject", _user_mail_text("welcome_subject")), 70, 180, 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"); - $output .= form_textarea(t("Body of welcome e-mail"), "user_mail_welcome_body", variable_get("user_mail_welcome_body", _user_mail_text("welcome_body")), 70, 10, 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"); + $output .= form_textarea(t("Body of welcome e-mail"), "user_mail_welcome_body", variable_get("user_mail_welcome_body", _user_mail_text("welcome_body")), 70, 10, 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"); - $output .= form_textfield(t("Subject of welcome e-mail (awaiting admin approval)"), "user_mail_approval_subject", variable_get("user_mail_approval_subject", _user_mail_text("welcome_approval_subject")), 70, 180, 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"); + $output .= form_textfield(t("Subject of welcome e-mail (awaiting admin approval)"), "user_mail_approval_subject", variable_get("user_mail_approval_subject", _user_mail_text("welcome_approval_subject")), 70, 180, 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"); - $output .= form_textarea(t("Body of welcome e-mail (awaiting admin approval)"), "user_mail_approval_body", variable_get("user_mail_approval_body", _user_mail_text("welcome_approval_body")), 70, 10, 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"); + $output .= form_textarea(t("Body of welcome e-mail (awaiting admin approval)"), "user_mail_approval_body", variable_get("user_mail_approval_body", _user_mail_text("welcome_approval_body")), 70, 10, 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"); - $output .= form_textfield(t("Subject of password recovery e-mail"), "user_mail_pass_subject", variable_get("user_mail_pass_subject", _user_mail_text("pass_subject")), 70, 180, t("Customize the Subject of your forgotten password e-mail.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto, %date"); + $output .= form_textfield(t("Subject of password recovery e-mail"), "user_mail_pass_subject", variable_get("user_mail_pass_subject", _user_mail_text("pass_subject")), 70, 180, t("Customize the Subject of your forgotten password e-mail.") ." ". t("Available variables are:") ." ". "%username, %site, %password, %uri, %uri_brief, %mailto, %date"); - $output .= form_textarea(t("Body of password recovery e-mail"), "user_mail_pass_body", variable_get("user_mail_pass_body", _user_mail_text("pass_body")), 70, 10, t("Customize the body of the forgotten password e-mail.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto"); + $output .= form_textarea(t("Body of password recovery e-mail"), "user_mail_pass_body", variable_get("user_mail_pass_body", _user_mail_text("pass_body")), 70, 10, t("Customize the body of the forgotten password e-mail.") ." ". t("Available variables are:") ." ". "%username, %site, %password, %uri, %uri_brief, %mailto"); return $output; } @@ -1309,11 +1303,11 @@ function user_admin_access($edit = array()) { } if ($type == "mail") { - $output .= "<h3>" . t("E-mail rules") . "</h3>"; + $output .= "<h3>". t("E-mail rules") ."</h3>"; } if ($type == "user") { - $output .= "<h3>" . t("Username rules") . "</h3>"; + $output .= "<h3>". t("Username rules") ."</h3>"; } if ($op == t("Add rule")) { @@ -1345,20 +1339,20 @@ function user_admin_access($edit = array()) { $rows[] = array(t("Deny"), $rule->mask, l(t("delete rule"), "admin/user/access/$type/$rule->aid")); } - $rows[] = array("<select name=\"edit[status]\"><option value=\"1\">". t("Allow") ."</option><option value=\"0\">". t("Deny") ."</option></select>", "<input size=\"32\" maxlength=\"64\" name=\"edit[mask]\" />", "<input type=\"submit\" name=\"op\" value=\"" . t("Add rule") . "\" />"); + $rows[] = array("<select name=\"edit[status]\"><option value=\"1\">". t("Allow") ."</option><option value=\"0\">". t("Deny") ."</option></select>", "<input size=\"32\" maxlength=\"64\" name=\"edit[mask]\" />", "<input type=\"submit\" name=\"op\" value=\"". t("Add rule") ."\" />"); $output .= table($header, $rows); - $output .= "<p><small>%: " . t("Matches any number of characters, even zero characters") . ".<br />_: " . t("Matches exactly one character.") . "</small></p>"; + $output .= "<p><small>%: ". t("Matches any number of characters, even zero characters") .".<br />_: ". t("Matches exactly one character.") ."</small></p>"; if ($type != "user") { - $output .= "<h3>" . t("Check e-mail address") . "</h3>"; + $output .= "<h3>". t("Check e-mail address") ."</h3>"; } else { - $output .= "<h3>" . t("Check username") . "</h3>"; + $output .= "<h3>". t("Check username") ."</h3>"; } - $output .= "$message<input type=\"text\" size=\"32\" maxlength=\"64\" name=\"edit[test]\" value=\"". $edit["test"] ."\" /><input type=\"submit\" name=\"op\" value=\"" . t("Check") . "\" />"; + $output .= "$message<input type=\"text\" size=\"32\" maxlength=\"64\" name=\"edit[test]\" value=\"". $edit["test"] ."\" /><input type=\"submit\" name=\"op\" value=\"". t("Check") ."\" />"; return form($output); } @@ -1697,125 +1691,115 @@ function user_admin() { return $output; } } -// this help is for end users -function user_help_users_da() { - $site = "<i>". variable_get("site_name", "this website"). "</i>"; - - $output = " - <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 %s, you do not have to fill out a registration form - if you are already a member of "; - - $output .= implode(", ", user_auth_help_links()); - $output .= ". This capability is called <i>Distributed - Authentication</i>, and is unique to <a href=\"http://www.drupal.org\">Drupal</a>, - the software which powers %s.</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 %s. 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=\"http://www.delphiforums.com\">Delphi Forums</a>. Drupal informs Joe - on registration and login screens that he may login with his Delphi ID instead - of registering with %s. Joe likes that idea, and logs in with a username - of joe@remote.delphiforums.com and his usual Delphi password. Drupal then contacts - the <i>remote.delphiforums.com</i> server behind the scenes (usually using <a href=\"http://www.xmlrpc.com\">XML-RPC</a>, - <a href=\"http://www.w3.org/Protocols/\">HTTP POST</a>, or <a href=\"http://www.soapware.org\">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 %s in the same manner, and he will always be logged into the - same account.</p>"; - - $output = strtr($output, array("%s" => $site)); - - 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, "auth_help"); - } - } - - return $output; -} - // the following functions comprise help for admins and developers function user_help($section = "admin/user/help") { + $output = ""; switch ($section) { - case "admin/user/help": - $output = user_help_admin(); - $output .= user_help_admin_da(); - $output .= user_help_devel_da(); - $output .= user_help_devel_userhook(); - return t($output); - case "admin/user": - return t("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.<br />Click on either the \"username\" or \"edit account\" to edit a user's information."); - case "admin/user/account": - return t("This page allows you to review and edit any user's profile. To edit a profile click on either the \"username\" or \"edit account\"."); - case "admin/user/account/create": - return t("This web page allows the administrators to register a new users by hand.<br />Note:<ul><li>You cannot have a user where either the e-mail address or the username match another user in the system.</li></ul>"); - case "admin/user/account/0": - return t("This page allows you to review and edit an active user's profile. To edit a profile click on either the \"username\" or \"edit account\"."); - case "admin/user/account/1": - return t("This page allows you to review and edit a new user's profile. To edit a profile click on either the \"username\" or \"edit account\"."); - case "admin/user/account/2": - return t("This page allows you to review and edit a blocked user's profile. To edit a profile click on either the \"username\" or \"edit account\"."); - case "admin/user/access": - return t("Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on <a href=\"%e-mail\">e-mail rules</a>, for the username mask click on <a href=\"%username\">username rules</a>.", array("%e-mail" => url("admin/user/access/mail"), "%username" => url("admin/user/access/user"))); - case "admin/user/access/mail": - return t("Setup and test the e-mail access rules. The access function checks if you match a deny and <b>not</b> an allow. If you match <b>only</b> a deny then it is denied. Any other case, such as both a deny and an allow pattern matching, allows the pattern.<br />Notes: <ul><li>To delete a rule click on \"delete rule\".</li><li>The order of the rules does <b>not</b> matter.</li></ul>"); - case "admin/user/access/user": - return t("Setup and test the Username access rules. The access function checks if you match a deny and <b>not</b> an allow. If you do then it is denied. Any other case, such as a deny pattern and an allow pattern, allows the pattern.<br />Notes: <ul><li>To delete a rule click on \"delete rule\".</li><li>The order of the rules does <b>not</b> matter.</li></ul>"); - case "admin/user/permission": - return t("In this area you will define the <b>permissions</b> for each user role (role names are defined on the <a href=\"%role\">user roles page</a>). Each permission describes a fine-grained logical operation, such as being able to access the administration pages, or adding/modifying a user account. You could say a permission represents access granted to a user to perform a set of operations.", array("%role" => url("admin/user/role"))); - case "admin/user/role": - return t("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=\"%permission\">user permissions</a>. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <b>names</b> of the various roles. To delete a role choose \"edit role\"<br />By default, Drupal comes with two user roles: <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 assigned automatically to authenticated users. Most registered users will belong to this user role unless specified otherwise.</li></ul>", array("%permission" => url("admin/user/permission"))); - case "admin/user/search": - return t("Enter a simple pattern ( '*' may be user as a wildcard match) to search for a username. For example, one may search for 'br' and Drupal might return 'brian', 'brad', and 'brenda'."); - } -} + case 'admin/user': + $output .= t("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.<br />Click on either the \"username\" or \"edit account\" to edit a user's information."); + break; + case 'admin/user/account/create': + $output .= t("This web page allows the administrators to register a new users by hand.<br />Note:<ul><li>You cannot have a user where either the e-mail address or the username match another user in the system.</li></ul>"); + break; + case (preg_match("/^admin\/user\/account.*/i", $section) ? $section : !$section): + $output .= t("This page allows you to review and edit %role-name. To edit a profile click on either the \"username\" or \"edit account\"."); -function user_help_admin() { - $output .= "<h3>Introduction</h3><p>Drupal offers a powerful access system that allows users to register, login, logout, maintain user profiles, etc. By using \"". l ("roles", "admin/user/role") ."\" you can setup fine grained ". l("permissions", "admin/user/permission") ." allowing each role to do only what you want them to. Each user is assigned to a role. By default there are two roles \"anonymous\" - a user who has not logged in, and \"authorized\" a user who has signed up and who has been authorized. As anonymous users, participants suffer numerous disadvantages, for example they cannot sign their names to nodes, and their moderated posts beginning at a lower score.</p>"; - $output .= "<p>In contrast, those with a user account can use their own name or handle and are granted various privileges: the most important is probably the ability to moderate new submissions, to rate comments, and to fine-tune the site to their personal liking, with saved personal settings. Drupal themes make fine tuning quite a pleasure.</p>"; - $output .= "<p>Registered users need to authenticate by supplying either a local username and password, or a remote username and password such as a ". l("jabber", "www.jabber.org") .", ". l("Delphi", "www.delphiforums.com") .", or one from another ". l("Drupal", "www.drupal.org") ." website. See ". l("distributed authentication", "#da") ." for more information on this innovative feature."; - $output .= "The local username and password, hashed with Message Digest 5 (MD5), are stored in your database. When you enter a password it is also hashed with MD5 and compaired with what is in the database. If the hashes match, the username and password are correct. Once a user authenticated session is started, and until that session is over, the user won't have to re-authenticate. To keep track of the individual sessions, Drupal relies on ". l("PHP's session support", "www.php.net/manual/en/ref.session.php") .". 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's side. When a visitor accesses your site, Drupal will check whether a specific session ID has been sent with the request. If this is the case, the prior saved environment is recreated.</p>"; - $output .= "<h3>User preferences and profiles</h3><p>Each Drupal user has a profile, and a set of preferences which may be edited by clicking on the ". l("user account", "user") ." link. Of course, a user must be logged into reach those pages. There, users will find a page for changing their preferred time zone, language, username, e-mail address, password, theme, signature, homepage, and ". l("distributed authentication", "#da") ." names. Changes made here take effect immediately. Also, administrators may make profile and preferences changes in the ". l("Admin Center", "admin/user") ." on behalf of their users.</p>"; - $output .= "<p>Module developers are provided several hooks for adding custom fields to the user view/edit pages. These hooks are described in the Developer section of the ". l("Drupal documentation", "drupal.org/node/view/316") .". For an example, see the <code>jabber_user()</code> function in <i>/modules/jabber.module</i>.</p>"; - return $output; -} + $role = substr(strrchr($section, "/"), 1); -function user_help_admin_da() { + if ($role == "account") { + $replace = t("any user's profile"); + } + else if ($role == "1") { + $replace = t("a blocked user's profile"); + } + else { + $output = strtr($output, array("%role-name" => t("a user with the '%role-name' role"))); + $role_names = user_roles(1); + $replace = $role_names[$role]; + } + $output = strtr($output, array("%role-name" => $replace)); + break; + case 'admin/user/access': + $output .= t("Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on %e-mail, for the username mask click on %username.", array("%e-mail" => l(t("e-mail rules"), "admin/user/access/mail"), "%username" => l(t("username rules"), "admin/user/access/user"))); + break; + case 'admin/user/access/mail': + $output .= t("Setup and test the e-mail access rules. The access function checks if you match a deny and <b>not</b> an allow. If you match <b>only</b> a deny then it is denied. Any other case, such as both a deny and an allow pattern matching, allows the pattern.<br />Notes: <ul><li>To delete a rule click on \"delete rule\".</li><li>The order of the rules does <b>not</b> matter.</li></ul>"); + break; + case 'admin/user/access/user': + $output .= t("Setup and test the Username access rules. The access function checks if you match a deny and <b>not</b> an allow. If you do then it is denied. Any other case, such as a deny pattern and an allow pattern, allows the pattern.<br />Notes: <ul><li>To delete a rule click on \"delete rule\".</li><li>The order of the rules does <b>not</b> matter.</li></ul>"); + break; + case 'admin/user/permission': + $output .= t("In this area you will define the <b>permissions</b> for each user role (role names are defined on the %role). Each permission describes a fine-grained logical operation, such as being able to access the administration pages, or adding/modifying a user account. You could say a permission represents access granted to a user to perform a set of operations.", array("%role" => l(t("user roles page"), "admin/user/role"))); + break; + case 'admin/user/role': + $output .= "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 %permission. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <b>names</b> of the various roles. To delete a role choose \"edit role\"<br />By default, Drupal comes with two user roles:"; + $output .= "<ul>"; + $output .= "<li>Anonymous user: this role is used for users that don't have a user account or that are not authenticated.</li>"; + $output .= "<li>Authenticated user: this role is assigned automatically to authenticated users. Most registered users will belong to this user role unless specified otherwise.</li>"; + $output .= "</ul>"; + $output = t($output, array("%permission" => l(t("user permissions"), "admin/user/permission"))); + case 'admin/user/search': + $output .= t("Enter a simple pattern ( '*' may be user as a wildcard match) to search for a username. For example, one may search for 'br' and Drupal might return 'brian', 'brad', and 'brenda'."); + break; + case 'admin/system/modules#description': + $output .= t("Enables the user registration and login system."); + break; + case 'admin/system/modules/user': + $output .= t("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."); + break; + case 'user/help': + $site = variable_get("site_name", "this website"); - $output .= "<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. The reg form provides helpful information to the website owner, but not much value for the user. The value for the end user is usually the ability to post a messages or receive personalized news, etc. Distributed authentication (DA) gives the user what they want without having to fill out the reg form. Removing this obstacle yields more registered and active users for the website.</p>"; - $output .= "<p>DA enables a new user to input a username and password into the login box and immediately be recognized, even if that user never registered on your site. This works because Drupal knows how to communicate with external registration databases. For example, lets say that your new user 'Joe' is already a registered member of Delphi Forums. If your Drupal has delphi.module installed, then Drupal will inform Joe on the registration and login screens that he may login with his Delphi ID instead of registering with your Drupal instance. Joe likes that idea, and logs in with a username of joe@remote.delphiforums.com and his usual Delphi password. Drupal then communicates with remote.delphiforums.com (usually using ". l("XML-RPC","www.xmlrpc.com") ." ". l("HTTP POST", "www.w3.org/Protocols/") .", or ". l("SOAP", "www.soapware.org") .") behind the scenes and asks "is this password for username=joe?" If Delphi replies yes, then Drupal will create a new local account for joe and log joe into it. Joe may keep on logging into your Drupal instance in the same manner, and he will be logged into the same joe@remote.delphiforums.com account.</p>"; - $output .= "<p>One key element of DA is the 'authmap' table, which maps a user's authname (e.g. joe@remote.delphiforums.com) to his local UID (i.e. universal identification number). This map is checked whenever a user successfully logs into an external authentication source. Once Drupal knows that the current user is definately joe@remote.delphiforums.com (because Delphi says so), he looks up Joe's UID and logs Joe into that account.</p>"; - $output .= "<p>To disable distributed authentication, simply ". l("disable", "admin/system/modules") ." or remove all DA modules. For a virgin install, that means removing/disabling <i>jabber.module</i> and <i>drupal.module</i></p>"; - $output .= "<p>Drupal is setup so that it is very easy to add support for any external authentication source. You currently have the following authentication modules installed ...</p>"; + $output .= "<h3>Distributed authentication<a id=\"da\"></a></h3>"; + $output .= "<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 <i>Distributed Authentication</i>, and is unique to %drupal, the software which powers %site.</p>"; + $output .= "<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 %delphi-forums. 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 <i>remote.delphiforums.com</i> server behind the scenes (usually using %xml, %http-post, or %soap) 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>"; - foreach (module_list() as $module) { - if (module_hook($module, "auth")) { - $output .= "<h4>" . module_invoke($module, "info", "name") . "</h4>"; - $output .= module_invoke($module, "auth_help"); - } - } - return $output; -} + $output = t($output, array("%help-links" => (implode(", ", user_auth_help_links())), "%site" => "<i>$site</i>", "%drupal" => "<a href=\"http://www.drupal.org\">Drupal</a>", "%delphi-forums" => "<a href=\"http://www.delphiforums.com\">Delphi Forums</a>", "%xml" => "<a href=\"http://www.xmlrpc.com\">XML-RPC</a>", "%http-post" => "<a href=\"http://www.w3.org/Protocols/\">HTTP POST</a>", "%soap" => "<a href=\"http://www.soapware.org\">SOAP</a>")); -function user_help_devel_da() { - $output .= "<h3>Writing distributed authentication modules</h3><p>Drupal is specifically architected to enable easy authoring of new authentication modules. I'll deconstruct the ". l("Blogger", "www.blogger.com") ." authentication module, and hopefully provide all the details you'll need to write your own auth module. If you want to download the full text of this module, visit the ". l("Blogger source", "cvs.drupal.org/viewcvs.cgi/contributions/modules/authentication/Blogger/?cvsroot=contrib") ." in the ". l("Drupal contributions CVS repository", "cvs.drupal.org/viewcvs/contributions/?cvsroot=contrib") .".</p>"; - $output .= "<h4>Code review</h4><pre><?php</pre><p>The first line of every Drupal module, including the authentication modules, is the same. It is the standard processing instruction for any PHP file. Authentication modules are always written in PHP, although they typically interact with systems written in many different programming languages and operating systems languages.</p>"; - $output .= "<pre>function blogger_info(\$field = NULL) { + 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"); + } + } + break; + case 'admin/user/help': + + // Start of user_help_admin + $output .= "<h3>Introduction</h3><p>Drupal offers a powerful access system that allows users to register, login, logout, maintain user profiles, etc. By using \"%user-role\" you can setup fine grained %user-permission allowing each role to do only what you want them to. Each user is assigned to a role. By default there are two roles \"anonymous\" - a user who has not logged in, and \"authorized\" a user who has signed up and who has been authorized. As anonymous users, participants suffer numerous disadvantages, for example they cannot sign their names to nodes, and their moderated posts beginning at a lower score.</p>"; + $output .= "<p>In contrast, those with a user account can use their own name or handle and are granted various privileges: the most important is probably the ability to moderate new submissions, to rate comments, and to fine-tune the site to their personal liking, with saved personal settings. Drupal themes make fine tuning quite a pleasure.</p>"; + $output .= "<p>Registered users need to authenticate by supplying either a local username and password, or a remote username and password such as a %jabber, %delphiforums, or one from another %drupal website. See %da-auth for more information on this innovative feature."; + $output .= "The local username and password, hashed with Message Digest 5 (MD5), are stored in your database. When you enter a password it is also hashed with MD5 and compaired with what is in the database. If the hashes match, the username and password are correct. Once a user authenticated session is started, and until that session is over, the user won't have to re-authenticate. To keep track of the individual sessions, Drupal relies on %php-sess. 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. When a visitor accesses your site, Drupal will check whether a specific session ID has been sent with the request. If this is the case, the prior saved environment is recreated.</p>"; + $output .= "<h3>User preferences and profiles</h3><p>Each Drupal user has a profile, and a set of preferences which may be edited by clicking on the %user-prefs link. Of course, a user must be logged into reach those pages. There, users will find a page for changing their preferred time zone, language, username, e-mail address, password, theme, signature, homepage, and %da-auth names. Changes made here take effect immediately. Also, administrators may make profile and preferences changes in %admin-user on behalf of their users.</p>"; + $output .= "<p>Module developers are provided several hooks for adding custom fields to the user view/edit pages. These hooks are described in the Developer section of the %da-devel. For an example, see the <code>jabber_user()</code> function in <i>/modules/jabber.module</i>.</p>"; + //end of user_help_admin + + //start of user_help_admin_da + $output .= "<h3>Distributed authentication<a id=\"da\"></a></h3>"; + $output .= "<p>One of the more tedious moments in visiting a new website is filling out the registration form. The reg form provides helpful information to the website owner, but not much value for the user. The value for the end user is usually the ability to post a messages or receive personalized news, etc. Distributed authentication (DA) gives the user what they want without having to fill out the reg form. Removing this obstacle yields more registered and active users for the website.</p>"; + $output .= "<p>DA enables a new user to input a username and password into the login box and immediately be recognized, even if that user never registered on your site. This works because Drupal knows how to communicate with external registration databases. For example, lets say that your new user 'Joe' is already a registered member of Delphi Forums. If your Drupal has delphi.module installed, then Drupal will inform Joe on the registration and login screens that he may login with his Delphi ID instead of registering with your Drupal instance. Joe likes that idea, and logs in with a username of joe@remote.delphiforums.com and his usual Delphi password. Drupal then communicates with remote.delphiforums.com (usually using %xml, %http-post, or %soap) behind the scenes and asks "is this password for username=joe?" If Delphi replies yes, then Drupal will create a new local account for joe and log joe into it. Joe may keep on logging into your Drupal instance in the same manner, and he will be logged into the same joe@remote.delphiforums.com account.</p>"; + $output .= "<p>One key element of DA is the 'authmap' table, which maps a user's authname (e.g. joe@remote.delphiforums.com) to his local UID (i.e. user identification number). This map is checked whenever a user successfully logs into an external authentication source. Once Drupal knows that the current user is definately joe@remote.delphiforums.com (because Delphi says so), he looks up Joe's UID and logs Joe into that account.</p>"; + $output .= "<p>To disable distributed authentication, simply %dis-mod or remove all DA modules. For a virgin install, that means removing/disabling <i>jabber.module</i> and <i>drupal.module</i></p>"; + $output .= "<p>Drupal is setup so that it is very easy to add support for any external authentication source. You currently have the following authentication modules installed ...</p>"; + $output .= "%module-list"; + // end of user_help_admin_da + + // start of user_help_devel_da + $output .= "<h3>Writing distributed authentication modules</h3><p>Drupal is specifically architected to enable easy authoring of new authentication modules. I'll deconstruct the %blogger authentication module, and hopefully provide all the details you'll need to write your own auth module. If you want to download the full text of this module, visit the %blogger-source in the %contrib-cvs.</p>"; + $output .= "<h4>Code review</h4>"; + $output .= "<pre><?php</pre><p>The first line of every Drupal module, including the authentication modules, is the same. It is the standard processing instruction for any PHP file. Authentication modules are always written in PHP, although they typically interact with systems written in many different programming languages and operating systems languages.</p>"; + $output .= "<pre>function blogger_info(\$field = NULL) { \$info[\"name\"] = \"Blogger\"; \$info[\"protocol\"] = \"XML-RPC\"; - \$info[\"link\"] = \"<a href=\\\"module.php?mod=user&op=sa_help#blogger\\\">Blogger</a>\"; +// \$info[\"link\"] = \"<a href=\\\"module.php\?mod=user\&op=sa_help\#blogger\\\">Blogger</a>\"; \$info[\"maintainer\"] = \"Moshe Weitzman\"; \$info[\"maintaineremail\"] = \"weitzman at tejasa.com\"; if (\$field) return \$info[\$field]; else return \$info; }</pre>"; - $output .= "<p>The <i>_info</i> function is always the first function defined in your module. This function populates an array called <i>\$info</i> with various pieces of data. Some of this data is used by Drupal ("name", "link"), and some of it just informs the users of your module. Simply copy the <i>blogger_info</i> function in your module - but wherever it says <i>blogger</i> here, substitute your own module name.</p>"; - $output .= "<pre>function blogger_auth(\$name, \$pass, \$server) { + $output .= "<p>The <i>_info</i> function is always the first function defined in your module. This function populates an array called <i>\$info</i> with various pieces of data. Some of this data is used by Drupal ("name", "link"), and some of it just informs the users of your module. Simply copy the <i>blogger_info</i> function in your module - but wherever it says <i>blogger</i> here, substitute your own module name.</p>"; + $output .= "<pre>function blogger_auth(\$name, \$pass, \$server) { // user did not present a Blogger ID so don't bother trying. if (\$server !== "blogger.com") { return 0; @@ -1844,11 +1828,11 @@ function user_help_devel_da() { return 0; } }</pre>"; - $output .= "<p>The <i>_auth</i> function is the heart of any authentication module. This function is called whenever a user is attempting to login using your authentication module. For successful authentications, this function returns TRUE. Otherwise, it returns FALSE. This function always accepts 3 parameters, as shown above. These parameters are passed by the user system (user.module). The user system parses the username as typed by the user into 2 substrings - \$name and \$server. The parsing rules are:</p>"; - $output .= "<table border=\"0\" cellspacing=\"4\" cellpadding=\"4\" style=\"margin: auto; width: 80%;\"><tr><th colspan=\"2\" style=\"text-align: left;\">_auth function parameters</th></tr><tr><th>\$name</th><td>The substring before the final <i>'@'</i> character in the username field</td></tr><tr><th>\$pass</th><td>The whole string submitted by the user in the password field</td></tr><tr><th>\$server</th><td>The substring after the final <i>'@'</i> symbol in the username field</td></tr></table>"; - $output .= "<p>So now lets use that \$name, \$pass, and \$server which was passed to our <i>_auth</i> function. Blogger authenticates users via ". l("XML-RPC", "www.xmlrpc.org") .". Your module may authenticate using a different technique. Drupal doesn't reallly care how your module communicates with its registration source. It just <b>trusts</b> the module.</p>"; - $output .= "<p>The lines above illustrate a typical ". l("XML-RPC", "www.xmlrpc.org") ." method call. Here we build up a message and send it to Blogger, storing the response in a variable called <i>\$response</i>. The message we pass conforms to the published ". l("Blogger XML-RPC Application Programmers Interface (API)", "plant.blogger.com/API") .". Your module will no doubt implement a different API. One peculiarity of this module is that we don't actually use the $server parameter. Blogger only accepts authentication at <i>plant.blogger.com</i>, so we hard-code that value into the <i>xmlrpc_client()</i> function. A more typical example might be the jabber module, which uses the <i>\$server</i> parameter to determine where to send the authentication request. Also of note is the '5' parameter in the <i>\$client->send\(\)</i> call. This is a timeout value in seconds. All authentication modules should implement a timeout on their external calls. This makes sure to return control to the user.module if your registration database has become inoperable or unreachable.</p>"; - $output .= "<pre> + $output .= "<p>The <i>_auth</i> function is the heart of any authentication module. This function is called whenever a user is attempting to login using your authentication module. For successful authentications, this function returns TRUE. Otherwise, it returns FALSE. This function always accepts 3 parameters, as shown above. These parameters are passed by the user system (user.module). The user system parses the username as typed by the user into 2 substrings - \$name and \$server. The parsing rules are:</p>"; + $output .= "<table border=\"0\" cellspacing=\"4\" cellpadding=\"4\" style=\"margin: auto; width: 80%;\"><tr><th colspan=\"2\" style=\"text-align: left;\">_auth function parameters</th></tr><tr><th>\$name</th><td>The substring before the final <i>'@'</i> character in the username field</td></tr><tr><th>\$pass</th><td>The whole string submitted by the user in the password field</td></tr><tr><th>\$server</th><td>The substring after the final <i>'@'</i> symbol in the username field</td></tr></table>"; + $output .= "<p>So now lets use that \$name, \$pass, and \$server which was passed to our <i>_auth</i> function. Blogger authenticates users via %xml. Your module may authenticate using a different technique. Drupal doesn't reallly care how your module communicates with its registration source. It just <b>trusts</b> the module.</p>"; + $output .= "<p>The lines above illustrate a typical %xml method call. Here we build up a message and send it to Blogger, storing the response in a variable called <i>\$response</i>. The message we pass conforms to the published %blogger-api. Your module will no doubt implement a different API. One peculiarity of this module is that we don't actually use the \$server parameter. Blogger only accepts authentication at <i>plant.blogger.com</i>, so we hard-code that value into the <i>xmlrpc_client()</i> function. A more typical example might be the jabber module, which uses the <i>\$server</i> parameter to determine where to send the authentication request. Also of note is the '5'th parameter in the <i>\$client->send\(\)</i> call. This is a timeout value in seconds. All authentication modules should implement a timeout on their external calls. This makes sure to return control to the user.module if your registration database has become inoperable or unreachable.</p>"; + $output .= "<pre> if (\$result && !stristr(\$result->serialize(), "fault")) { // watchdog(\"user\", \"Success Blogger Auth. Response: \" . \$result->serialize()); return 1; @@ -1862,36 +1846,41 @@ function user_help_devel_da() { return 0; } </pre>"; - $output .= "<p>This second half of the <i>_auth</i> function examines the <i>\$response</i> from plant.blogger.com and returns a TRUE (1) or FALSE (0) as appropriate. This is a critical decision, so be sure that you have good logic here, and perform sufficient testing for all cases. In the case of Blogger, we search for the string 'fault' in the response. If that string is present, or there is no repsonse, our function returns FALSE. Otherwise, Blogger has returned valid data to our method request and we return TRUE. Note: Everything starting with \"//\" is a comment and is not executed.</p>"; - $output .= "<pre>function blogger_page() { + $output .= "<p>This second half of the <i>_auth</i> function examines the <i>\$response</i> from plant.blogger.com and returns a TRUE (1) or FALSE (0) as appropriate. This is a critical decision, so be sure that you have good logic here, and perform sufficient testing for all cases. In the case of Blogger, we search for the string 'fault' in the response. If that string is present, or there is no repsonse, our function returns FALSE. Otherwise, Blogger has returned valid data to our method request and we return TRUE. Note: Everything starting with \"//\" is a comment and is not executed.</p>"; + $output .= "<pre>function blogger_page() { theme("header"); - theme("box", "Blogger", blogger_auth_help()); + theme("box", "Blogger", blogger_help(\"user/help\")); theme("footer"); }</pre>"; - $output .= "<p>The _page function is not currently used, but it might be in the future. For now, just copy what you see here, substituting your module name for <i>blogger</i>.</p>"; - $output .= "<code>function blogger_auth_help() {<br /> - \$site = variable_get("site_name", "this web site");<br /> - \$html_output = "<blockquote> - <p>You may login to <i>%s</i> using a <b>Blogger ID</b> and password. A Blogger ID consists of your Blogger username followed by <i>@blogger.com</i>. So a valid blogger ID is mwlily@blogger.com. If you are a Blogger member, go ahead and login now.</p> - <p>Blogger offers you instant communication power by letting you post your thoughts to the web whenever the urge strikes. - Blogger will publish to your current web site or help you create one. <a href=\"http://www.blogger.com/about.pyra\">Learn more about it</a>.";</blockquote> - return sprintf(t(\$html_output), \$site);<br /> -}</code>"; - $output .= "<p>The <i>_auth_help</i> function is prominently linked within Drupal, so you'll want to write the best possible user help here. You'll want to tell users what a proper username looks like and you may also want to advertise a bit about your service at the end. Note that your help text is passed through a t() function in the last line. This is Drupal's localization function. Translators may localize your help text just like any other text in Drupal.</p>"; - $output .= "<h4>Publishing your module</h4><p>Once you've written and tested your authentication module, you'll usually want to share it with the world. The best way to do this is to add the module to the ". l("Drupal contributions CVS repository", "cvs.drupal.org/viewcvs.cgi/contributions/modules/authentication?cvsroot=contrib") .". You'll need to request priveleges to this repository - see ". l("the README file", "cvs.drupal.org/viewcvs.cgi/contributions/README?rev=HEAD&cvsroot=contrib&content-type=text/vnd.viewcvs-markup") ." for the details. Then you should announce your contribution on the ". l("drupal-devel and drupal-support mailing lists", "drupal.org/node/view/322") .". You might also want to post a story on ". l("Drupal.org", "www.drupal.org") .".</p>"; - return $output; -} - -function user_help_devel_userhook() { - - $output .= "<h3><a id=\"userhook\">module_user()</a></h3><p>The <b>_user()</b> hook provides a mechanism for inserting text and form fields into the ". l("registration","user/register") .", ". l("user account view/edit", "user") .", and ". l("administer users", "admin/user") ." pages. This is useful if you want to add a custom field for your particular community. This is best illustrated by the ". l("profile.module", "cvs.drupal.org/viewcvs/drupal/modules/profile.module") .". The profile.module is meant to be customized for your needs. Please download it and hack away until it does what you need.</p>"; - - $output .= "<p>Consider this simpler example from a fictional recipe community web site called Julia's Kitchen. Julia customizes her Drupal powered site by creating a new file called <i>julia.module</i>. That file does the following:<ul><li>new members must agree to Julia's Privacy Policy on the reg page.</li><li>members may list their favorite ingredients on their public user profile page</li></ul></p>"; - - $output .= "<p>Julia achieves this with the following code. The comments below should help you understand what is going on.</p>"; - - $output .= "<pre> + $output .= "<p>The _page function is not currently used, but it might be in the future. For now, just copy what you see here, substituting your module name for <i>blogger</i>.</p>"; + $output .= "<pre><code>function blogger_help(\$section) { + \$output = ""; + + switch (\$section) { + case 'user/help': + \$site = variable_get("site_name", "this web site");<br /> + \$output .= "<p>You may login to %site using a <b>Blogger ID</b> and password. A Blogger ID consists of your Blogger username followed by <i>@blogger.com</i>. So a valid blogger ID is <i>mwlily</i>@<b>blogger.com</b>. If you are a Blogger member, go ahead and login now.</p>"; + \$output .= "<p>Blogger offers you instant communication power by letting you post your thoughts to the web whenever the urge strikes. Blogger will publish to your current web site or help you create one. <a href=\"http://www.blogger.com/about.pyra\">Learn more about it</a>."; + \$output = t(\$output, array(\"%site\" => \"<i>\$site</i>\")); + } + + return output; +}</code></pre>"; + $output .= "<p>The <i>_help</i> function is prominently linked within Drupal, so you'll want to write the best possible user help here. You'll want to tell users what a proper username looks like and you may also want to advertise a bit about your service at the end. Note that your help text is passed through a t() function in the last line. This is Drupal's localization function. Translators may localize your help text just like any other text in Drupal.</p>"; + $output .= "<h4>Publishing your module</h4><p>Once you've written and tested your authentication module, you'll usually want to share it with the world. The best way to do this is to add the module to the %contrib-cvs. You'll need to request priveleges to this repository - see %csv-readme for the details. Then you should announce your contribution on the %drupal-lists. You might also want to post a story on %drupal-org.</p>"; + // end of user_help_devel_da + + // start of user_help_devel_userhook + $output .= "<h3><a id=\"userhook\">module_user()</a></h3><p>The <b>_user()</b> hook provides a mechanism for inserting text and form fields into the %registrtion, %user-acct, and %user-admin pages. This is useful if you want to add a custom field for your particular community. This is best illustrated by the %profile-mod. The profile.module is meant to be customized for your needs. Please download it and hack away until it does what you need.</p>"; + + $output .= "<p>Consider this simpler example from a fictional recipe community web site called Julia's Kitchen. Julia customizes her Drupal powered site by creating a new file called <i>julia.module</i>. That file does the following:<ul>"; + $output .= "<li>new members must agree to Julia's Privacy Policy on the reg page.</li>"; + $output .= "<li>members may list their favorite ingredients on their public user profile page</li>"; + $output .= "</ul></p>"; + $output .= "<p>Julia achieves this with the following code. The comments below should help you understand what is going on.</p>"; + + $output .= "<pre> function julia_user(\$type, \$edit, &\$user) { // What type of registration action are we taking? switch (\$type) { @@ -1929,6 +1918,19 @@ function julia_user(\$type, \$edit, &\$user) { } } </pre>"; + // end of user_help_devel_userhook + $output = t($output, array("%user-role" => l(t("roles"), "admin/user/role"), "%user-permission" => l(t("permission"), "admin/user/permission"), "%jabber" => "<a href=\"http://www.jabber.org\">jabber</a>", "%delphiforums" => "<a href=\"http://www.delphiforums.com/\">Delphi Forums</a>", "%drupal" => "<a href=http:\"http://www.drupal.org/\">Drupal</a>", "%da-auth" => l(t("distributed authentication"), "/user/help/#da"), "%php-sess" => "<a href=\"http://www.php.net/manual/en/ref.session.php\">". t("PHP's session support") ."</a>", "%user-prefs" => l(t("my account"), "user/edit"), "%admin-user" => l(t("administer » accounts » users"), "admin/user"), "%da-devel" => "<a href=\"http://www.drupal.org/node/view/316\">". t("Drupal documentation") ."</a>", "%xml" => "<a href=\"http://www.xmlrpc.org\">XML-RPC</a>", "%http-post" => "<a href=\"http://www.w3.org/Protocols/\">HTTP POST</a>", "%soap" => "<a href=\"http://www.soapware.org\">SOAP</a>", "%dis-mod" => l(t("disable"), "admin/system/modules"), "%blogger" => "<a href=\"http://www.blogger.com\">Blogger</a>", "%blogger-source" => "<a href=\"http://cvs.drupal.org/viewcvs.cgi/contributions/modules/authentication/Bloggar/?cvsroot=contrib\">". t("Bloggar source") ."</a>", "%contrib-cvs" => "<a href=\"http://cvs.drupal.org/veiwcvs/contributions/?cvsroot=contrib\">". t("Drupal contributions CVS repository") ."</a>", "%blogger-api" => "<a href=\"http://plant.blogger.com/API\">". t("Blogger XML-RPC Application Programmers Interface (API)") ."</a>", "%cvs-readme" => "<a href=\"http://cvs.drupal.org/viewcvs.cgi/contributions/README?rev=HEAD&cvsroot=contrib&content-type=text/vnd.viewcvs-markup\">the CVS README file</a>", "%drupal-lists" => "<a href=\"http://drupal.org/node/view/332\">drupal-devel and drupal-support mailing lists</a>", "%drupal-org" => "<a href=\"http://www.drupal.org\">Drupal.org</a>", "%registration" => l(t("registration"), "user/register"), "%user-acct" => l(t("user account view/edit"), "user"), "%user-admin" => l(t("administer users"), "admin/user"), "%profile-mod" => "<a href=\"http://cvs.drupal.org/viewcvs/drupal/modules/profile.module\">profile.module</a>")); + + foreach (module_list() as $module) { + if (module_hook($module, "auth")) { + $output = strtr($output, array("%module-list" => "<h4>". module_invoke($module, "info", "name") ."</h4>\n%module-list")); + $output = strtr($output, array("%module-list" => module_invoke($module, "help", "user/help") . "\n%module-list")); + } + } + $output = strtr($output, array("%module-list" => "")); + break; + } + return $output; } diff --git a/modules/watchdog.module b/modules/watchdog.module index 38608c659..0d96ef51c 100644 --- a/modules/watchdog.module +++ b/modules/watchdog.module @@ -5,41 +5,42 @@ function watchdog_help($section = "admin/help") { $output = ""; switch ($section) { - case "admin/help": - case "admin/watchdog/help": - $output .= "<p>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 ". l("check the Watchdog report", "admin/watchdog") ." on a regular basis as it is often the only way to tell what is going on.</p>"; - $output .= "<p>To ease administration, the watchdog will automatically discard old log entries, ". l("as configured", "admin/system/modules/watchdog") .". Needs \"cron.php\" to discard the entries.</p>"; + case 'admin/help': + case 'admin/watchdog/help': + $output .= "<p>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 %watchdog on a regular basis as it is often the only way to tell what is going on.</p>"; + $output .= "<p>To ease administration, the watchdog will automatically discard old log entries, %log-entry. Needs \"cron.php\" to discard the entries.</p>"; + $output = t($output, array("%watchdog" => l(t("check the Watchdog report"), "admin/watchdog"), "%log-entry" => l(t("as configured"), "admin/system/modules/watchdog"))); break; - case "admin/watchdog": - $output = "The watchdog module monitors your web site, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains 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."; + case 'admin/watchdog': + $output = t("The watchdog module monitors your web site, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains 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."); break; - case "admin/watchdog/user": - $output = "Watchdog events that have to do with users."; + case 'admin/watchdog/user': + $output = t("Watchdog events that have to do with users."); break; - case "admin/watchdog/regular": - $output = "Watchdog events that are \"normal\" and have no other classification."; + case 'admin/watchdog/regular': + $output = t("Watchdog events that are \"normal\" and have no other classification."); break; - case "admin/watchdog/httpd": - $output = "Watchdog events that are from the web server."; + case 'admin/watchdog/httpd': + $output = t("Watchdog events that are from the web server."); break; - case "admin/watchdog/special": - $output = "Watchdog events about adding, changing, and moderating nodes and comments."; + case 'admin/watchdog/special': + $output = t("Watchdog events about adding, changing, and moderating nodes and comments."); break; - case "admin/watchdog/error": - $output = "Watchdog general error events, such as invalid login, permission denied, and database errors."; + case 'admin/watchdog/error': + $output = t("Watchdog general error events, such as invalid login, permission denied, and database errors."); break; - case "admin/watchdog/warning": - $output = "Watchdog warning events. These events don't stop Drupal from running, but are things you should no to correct."; + case 'admin/watchdog/warning': + $output = t("Watchdog warning events. These events don't stop Drupal from running, but are things you should no to correct."); + break; + case 'admin/system/modules#description': + $output = t("Logs and records system events."); + break; + case 'admin/system/modules/watchdog': + $output = t("Watchdog logs your system events. To see these logs go to %watchdog. Since these logs can grow out of control if kept around forever, below set how long an item should be kept in the log.<br />Note:<ul><li>To discard entries as set below you must run \"cron.php\" regularly.</li></ul>", array("%watchdog" => l(t("Site monitoring"), "admin/watchdog"))); break; } - return t($output); -} - -function watchdog_system($field){ - $system["description"] = t("Logs and records system events."); - $system["admin_help"] = t("Watchdog logs your system events. To see these logs go to <a href=\"%watchdog\">Site monitoring</a>. Since these logs can grow out of control if kept around forever, below set how long an item should be kept in the log.<br />Note:<ul><li>To discard entries as set below you must run \"cron.php\" regularly.</li></ul>", array("%watchdog" => url("admin/watchdog"))); - return $system[$field]; + return $output; } function watchdog_perm() { diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module index 38608c659..0d96ef51c 100644 --- a/modules/watchdog/watchdog.module +++ b/modules/watchdog/watchdog.module @@ -5,41 +5,42 @@ function watchdog_help($section = "admin/help") { $output = ""; switch ($section) { - case "admin/help": - case "admin/watchdog/help": - $output .= "<p>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 ". l("check the Watchdog report", "admin/watchdog") ." on a regular basis as it is often the only way to tell what is going on.</p>"; - $output .= "<p>To ease administration, the watchdog will automatically discard old log entries, ". l("as configured", "admin/system/modules/watchdog") .". Needs \"cron.php\" to discard the entries.</p>"; + case 'admin/help': + case 'admin/watchdog/help': + $output .= "<p>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 %watchdog on a regular basis as it is often the only way to tell what is going on.</p>"; + $output .= "<p>To ease administration, the watchdog will automatically discard old log entries, %log-entry. Needs \"cron.php\" to discard the entries.</p>"; + $output = t($output, array("%watchdog" => l(t("check the Watchdog report"), "admin/watchdog"), "%log-entry" => l(t("as configured"), "admin/system/modules/watchdog"))); break; - case "admin/watchdog": - $output = "The watchdog module monitors your web site, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains 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."; + case 'admin/watchdog': + $output = t("The watchdog module monitors your web site, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains 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."); break; - case "admin/watchdog/user": - $output = "Watchdog events that have to do with users."; + case 'admin/watchdog/user': + $output = t("Watchdog events that have to do with users."); break; - case "admin/watchdog/regular": - $output = "Watchdog events that are \"normal\" and have no other classification."; + case 'admin/watchdog/regular': + $output = t("Watchdog events that are \"normal\" and have no other classification."); break; - case "admin/watchdog/httpd": - $output = "Watchdog events that are from the web server."; + case 'admin/watchdog/httpd': + $output = t("Watchdog events that are from the web server."); break; - case "admin/watchdog/special": - $output = "Watchdog events about adding, changing, and moderating nodes and comments."; + case 'admin/watchdog/special': + $output = t("Watchdog events about adding, changing, and moderating nodes and comments."); break; - case "admin/watchdog/error": - $output = "Watchdog general error events, such as invalid login, permission denied, and database errors."; + case 'admin/watchdog/error': + $output = t("Watchdog general error events, such as invalid login, permission denied, and database errors."); break; - case "admin/watchdog/warning": - $output = "Watchdog warning events. These events don't stop Drupal from running, but are things you should no to correct."; + case 'admin/watchdog/warning': + $output = t("Watchdog warning events. These events don't stop Drupal from running, but are things you should no to correct."); + break; + case 'admin/system/modules#description': + $output = t("Logs and records system events."); + break; + case 'admin/system/modules/watchdog': + $output = t("Watchdog logs your system events. To see these logs go to %watchdog. Since these logs can grow out of control if kept around forever, below set how long an item should be kept in the log.<br />Note:<ul><li>To discard entries as set below you must run \"cron.php\" regularly.</li></ul>", array("%watchdog" => l(t("Site monitoring"), "admin/watchdog"))); break; } - return t($output); -} - -function watchdog_system($field){ - $system["description"] = t("Logs and records system events."); - $system["admin_help"] = t("Watchdog logs your system events. To see these logs go to <a href=\"%watchdog\">Site monitoring</a>. Since these logs can grow out of control if kept around forever, below set how long an item should be kept in the log.<br />Note:<ul><li>To discard entries as set below you must run \"cron.php\" regularly.</li></ul>", array("%watchdog" => url("admin/watchdog"))); - return $system[$field]; + return $output; } function watchdog_perm() { |