Index: xmlsitemap.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap.info,v retrieving revision 1.1 diff -u -p -r1.1 xmlsitemap.info --- xmlsitemap.info 9 Nov 2007 17:56:04 -0000 1.1 +++ xmlsitemap.info 18 May 2008 06:23:46 -0000 @@ -2,4 +2,4 @@ name = XML Sitemap description = Creates an XML site map in accordance with the sitemaps.org specification. package = XML Sitemap - +core = 6.x Index: xmlsitemap.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap.install,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 xmlsitemap.install --- xmlsitemap.install 11 Dec 2007 22:57:38 -0000 1.1.2.3 +++ xmlsitemap.install 18 May 2008 06:23:46 -0000 @@ -2,33 +2,73 @@ // $Id: xmlsitemap.install,v 1.1.2.3 2007/12/11 22:57:38 darrenoh Exp $ /** + * Implementation of hook_schema(). + */ +function xmlsitemap_schema() { + $schema['xmlsitemap_additional'] = array( + 'description' => t('The base table for xmlsitemap.'), + 'fields' => array( + 'path' => array( + 'description' => t('The path of this node.'), + 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + 'default' => '', + ), + 'pid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'default' => 0, + ), + 'last_changed' => array( + 'description' => t('Keeps track of new changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'previously_changed' => array( + 'description' => t('Keeps track of old changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'priority' => array( + 'description' => t('Stores the index value.'), + 'type' => 'float', + 'not null' => FALSE, + ), + ), + 'indexes' => array( + 'pid' => array('pid'), + ), + 'primary key' => array('path'), + ); + + return $schema; +} + +/** * Implementation of hook_install(). */ function xmlsitemap_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - db_query("CREATE TABLE {xmlsitemap_additional} ( - path varchar(128) NOT NULL default '', - pid int, - last_changed int(11), - previously_changed int(11), - priority float, - PRIMARY KEY (path) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - break; - case 'pgsql': - db_query("CREATE TABLE {xmlsitemap_additional} ( - path varchar(128) NOT NULL default '', - pid integer, - last_changed integer, - previously_changed integer, - priority real, - PRIMARY KEY (path) - );"); - break; - } + // Create my tables. db_query("DELETE FROM {url_alias} WHERE dst LIKE 'sitemap%.xml'"); + drupal_install_schema('xmlsitemap'); +} + +/** + * Implementation of hook_uninstall(). + */ +function xmlsitemap_uninstall() { + // Drop my tables. + $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_%'"); + while ($variable = db_fetch_object($settings)) { + variable_del($variable->name); + } + drupal_uninstall_schema('xmlsitemap'); } /** @@ -112,15 +152,3 @@ function xmlsitemap_disable() { rmdir($path); } } - -/** - * Implementation of hook_uninstall(). - */ -function xmlsitemap_uninstall() { - db_query("DROP TABLE {xmlsitemap_additional}"); - $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_%'"); - while ($variable = db_fetch_object($settings)) { - variable_del($variable->name); - } -} - Index: xmlsitemap.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap.module,v retrieving revision 1.1.2.17 diff -u -p -r1.1.2.17 xmlsitemap.module --- xmlsitemap.module 15 May 2008 04:06:27 -0000 1.1.2.17 +++ xmlsitemap.module 18 May 2008 06:23:47 -0000 @@ -8,8 +8,8 @@ /** * Implementation of hook_help(). */ -function xmlsitemap_help($section) { - switch ($section) { +function xmlsitemap_help($path, $arg) { + switch ($path) { case 'admin/settings/xmlsitemap': case 'admin/settings/xmlsitemap/settings': return t('Configure the site map. Your site map is at !url.', array('!url' => ''. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE) .'')); @@ -23,64 +23,58 @@ function xmlsitemap_help($section) { /** * Implementation of hook_menu(). */ -function xmlsitemap_menu($may_cache) { +function xmlsitemap_menu() { $items = array(); - $access_config = user_access('administer site configuration'); - $access_content = user_access('access content'); - if ($may_cache) { - $items[] = array( - 'path' => 'admin/settings/xmlsitemap', - 'title' => t('XML Sitemap'), - 'description' => t('Configure site map.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('xmlsitemap_settings_sitemap'), - 'access' => $access_config, - ); - $items[] = array( - 'path' => 'admin/settings/xmlsitemap/settings', - 'title' => t('Site map'), - 'description' => t('Configure site map.'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -1, - ); - $items[] = array( - 'path' => 'admin/settings/xmlsitemap/engines', - 'title' => t('Search engines'), - 'description' => t('Configure search engines.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('xmlsitemap_settings_engines'), - 'type' => MENU_LOCAL_TASK, - ); - $items[] = array( - 'path' => 'admin/settings/xmlsitemap/additional', - 'title' => t('Additional'), - 'description' => t('Configure additional links.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('xmlsitemap_settings_additional'), - 'type' => MENU_LOCAL_TASK, - 'weight' => 1, - ); - $items[] = array( - 'path' => 'sitemap.xml', - 'title' => t('Site map index'), - 'callback' => '_xmlsitemap_output', + $access_config = array('administer site configuration'); + $access_content = array('access content'); + $items['admin/settings/xmlsitemap'] = array( + 'title' => 'XML Sitemap', + 'description' => 'Configure site map.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('xmlsitemap_settings_sitemap'), + 'access arguments' => $access_config, + ); + $items['admin/settings/xmlsitemap/settings'] = array( + 'title' => 'Site map', + 'description' => 'Configure site map.', + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => -1, + ); + $items['admin/settings/xmlsitemap/engines'] = array( + 'title' => 'Search engines', + 'description' => 'Configure search engines.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('xmlsitemap_settings_engines'), + 'type' => MENU_LOCAL_TASK, + 'access arguments' => $access_config, + ); + $items['admin/settings/xmlsitemap/additional'] = array( + 'title' => 'Additional', + 'description' => 'Configure additional links.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('xmlsitemap_settings_additional'), + 'type' => MENU_LOCAL_TASK, + 'weight' => 1, + 'access arguments' => $access_config, + + ); + $items['sitemap.xml'] = array( + 'title' => 'Site map index', + 'page callback' => '_xmlsitemap_output', + 'type' => MENU_CALLBACK, + 'access arguments' => $access_content + ); + $chunk_count = variable_get('xmlsitemap_chunk_count', 0); + for ($chunk = 0; $chunk < $chunk_count; ++$chunk) { + $items["sitemap$chunk.xml"] = array( + 'title' => 'Site map !number', array('!number' => $chunk), + 'page callback' => '_xmlsitemap_output', + 'page arguments' => array($chunk), 'type' => MENU_CALLBACK, - 'access' => $access_content, + 'access arguments' => $access_content ); } - else { - $chunk_count = variable_get('xmlsitemap_chunk_count', 0); - for ($chunk = 0; $chunk < $chunk_count; ++$chunk) { - $items[] = array( - 'path' => "sitemap$chunk.xml", - 'title' => t('Site map !number', array('!number' => $chunk)), - 'callback' => '_xmlsitemap_output', - 'callback arguments' => array($chunk), - 'type' => MENU_CALLBACK, - 'access' => $access_content, - ); - } - } + return $items; } @@ -111,8 +105,8 @@ function xmlsitemap_settings_sitemap() { /** * Validate site map settings form. */ -function xmlsitemap_settings_sitemap_validate($form_id, $form_values) { - if ($form_values['xmlsitemap_chunk_size'] > 50000) { +function xmlsitemap_settings_sitemap_validate($form, &$form_state) { + if ($form_state['values']['xmlsitemap_chunk_size'] > 50000) { form_set_error('xmlsitemap_chunk_size', t('Cannot send more than 50,000 links at one time.')); } } @@ -120,8 +114,8 @@ function xmlsitemap_settings_sitemap_val /** * Submit site map settings form. */ -function xmlsitemap_settings_sitemap_submit($form_id, $form_values) { - system_settings_form_submit($form_id, $form_values); +function xmlsitemap_settings_sitemap_submit($form, &$form_state) { + system_settings_form_submit($form, $form_state); xmlsitemap_update_sitemap(); } @@ -159,12 +153,12 @@ function xmlsitemap_settings_engines() { /** * Submit search engine settings form. */ -function xmlsitemap_settings_engines_submit($form_id, $form_values) { - if ($form_values['xmlsitemap_root']) { - $form_values['xmlsitemap_submit'] = FALSE; - $form_values['xmlsitemap_log_access'] = FALSE; +function xmlsitemap_settings_engines_submit($form, &$form_state) { + if ($form_state['values']['xmlsitemap_root']) { + $form_state['values']['xmlsitemap_submit'] = FALSE; + $form_state['values']['xmlsitemap_log_access'] = FALSE; } - system_settings_form_submit($form_id, $form_values); + system_settings_form_submit($form, $form_state); } /** @@ -210,6 +204,15 @@ function xmlsitemap_settings_additional( } /** + * Implementation of hook_theme(). + */ +function xmlsitemap_theme() { + return array( + 'xmlsitemap_settings_additional' => array('form'), + ); +} + +/** * Theme additional links form. * @ingroup themeable */ @@ -232,56 +235,57 @@ function theme_xmlsitemap_settings_addit return $output; } + /** * Submit additional links form. */ -function xmlsitemap_settings_additional_submit($form_id, $form_values) { +function xmlsitemap_settings_additional_submit($form, &$form_state) { $update = FALSE; - if ($form_values['op'] == t('Save configuration')) { - if ($form_values['xmlsitemap_additional_links_priority'] != variable_get('xmlsitemap_additional_links_priority', 0.1)) { + if ($form_state['values']['op'] == t('Save configuration')) { + if ($form_state['values']['xmlsitemap_additional_links_priority'] != variable_get('xmlsitemap_additional_links_priority', 0.1)) { $update = TRUE; } - if (!empty($form_values['delete'])) { - foreach ($form_values['delete'] as $id => $delete) { - if ($delete || $form_values['path'][$id] == trim($form_values['link']['new'])) { - db_query("DELETE FROM {xmlsitemap_additional} WHERE path = '%s'", $form_values['path'][$id]); - unset($form_values['priority'][$id]); + if (!empty($form_state['values']['delete'])) { + foreach ($form_state['values']['delete'] as $id => $delete) { + if ($delete || $form_state['values']['path'][$id] == trim($form_state['values']['link']['new'])) { + db_query("DELETE FROM {xmlsitemap_additional} WHERE path = '%s'", $form_state['values']['path'][$id]); + unset($form_state['values']['priority'][$id]); $update = TRUE; } } - unset($form_values['delete']); + unset($form_state['values']['delete']); } - $path = trim($form_values['link']['new']); + $path = trim($form_state['values']['link']['new']); $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", $path)); if (!empty($path)) { db_query(" INSERT INTO {xmlsitemap_additional} (path, pid, last_changed, priority) VALUES ('%s', %s, %d, %s) - ", $path, empty($pid) ? 'NULL' : $pid, time(), $form_values['priority']['new']); - unset($form_values['link'], $form_values['priority']['new']); + ", $path, empty($pid) ? 'NULL' : $pid, time(), $form_state['values']['priority']['new']); + unset($form_state['values']['link'], $form_state['values']['priority']['new']); $update = TRUE; } - if (!empty($form_values['priority'])) { - foreach ($form_values['priority'] as $id => $priority) { - if ($priority != $form_values['old_priority'][$id]) { - $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", $form_values['path'][$id])); + if (!empty($form_state['values']['priority'])) { + foreach ($form_state['values']['priority'] as $id => $priority) { + if ($priority != $form_state['values']['old_priority'][$id]) { + $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", $form_state['values']['path'][$id])); db_query(" UPDATE {xmlsitemap_additional} SET pid = %s, previously_changed = last_changed, last_changed = %d, priority = %s WHERE path = '%s' - ", empty($pid) ? 'NULL' : $pid, time(), $priority, $form_values['path'][$id]); + ", empty($pid) ? 'NULL' : $pid, time(), $priority, $form_state['values']['path'][$id]); $update = TRUE; } } - unset($form_values['path'], $form_values['priority'], $form_values['old_priority']); + unset($form_state['values']['path'], $form_state['values']['priority'], $form_state['values']['old_priority']); } } elseif (variable_get('xmlsitemap_additional_links_priority', 0.1) != 0.1) { - if (in_array('NULL', $form_values['old_priority'])) { + if (in_array('NULL', $form_state['values']['old_priority'])) { $update = TRUE; } - unset($form_values['delete'], $form_values['path'], $form_values['link'], $form_values['old_priority'], $form_values['priority']); + unset($form_state['values']['delete'], $form_state['values']['path'], $form_state['values']['link'], $form_state['values']['old_priority'], $form_state['values']['priority']); } - system_settings_form_submit($form_id, $form_values); + system_settings_form_submit($form, $form_state); if ($update) { xmlsitemap_update_sitemap(); } @@ -357,12 +361,16 @@ function _xmlsitemap_output($chunk = NUL } if (variable_get('xmlsitemap_log_access', FALSE)) { $message = array_shift(module_invoke_all('xmlsitemap_engines', 'access', $type)); - $message = isset($message) ? $message : t('!sitemap downloaded by @user-agent at @address.', array( - '!sitemap' => $type, - '@user-agent' => $_SERVER['HTTP_USER_AGENT'], - '@address' => $_SERVER['REMOTE_ADDR'], - )); - watchdog('xmlsitemap', $message); + if (isset($message)) { + watchdog('xmlsitemap', $message); + } + else { + watchdog('xmlsitemap', '!sitemap downloaded by @user-agent at @address.', array( + '!sitemap' => $type, + '@user-agent' => $_SERVER['HTTP_USER_AGENT'], + '@address' => ip_address(), + )); + } } } else { @@ -715,9 +723,11 @@ function xmlsitemap_url($path = NULL, $a $script = isset($script) ? $script : strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === FALSE ? 'index.php' : ''; $clean_url = isset($clean_url) ? $clean_url : variable_get('clean_url', FALSE); $base = ($absolute ? $base_url .'/' : base_path()); + if (!empty($path) && $path != '') { $path = _xmlsitemap_get_path_alias($path, $alias); $path = drupal_urlencode($path); + if (!$clean_url) { if (isset($query)) { return $base . $script .'?q='. $path .'&'. $query . $fragment; @@ -756,8 +766,8 @@ function _xmlsitemap_get_path_alias($pat if (!empty($alias)) { $result = $alias; } - if (function_exists('custom_url_rewrite')) { - $result = custom_url_rewrite('alias', $result, $path); + if (function_exists('custom_url_rewrite_outbound')) { + $result = custom_url_rewrite_outbound($result, $customarray = array(alias => $alias), $path); } if (module_exists('i18n')) { i18n_get_lang_prefix($result, TRUE); Index: docs/xmlsitemap.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/docs/xmlsitemap.php,v retrieving revision 1.2.2.2 diff -u -p -r1.2.2.2 xmlsitemap.php --- docs/xmlsitemap.php 6 Dec 2007 17:22:20 -0000 1.2.2.2 +++ docs/xmlsitemap.php 18 May 2008 06:23:47 -0000 @@ -173,10 +173,10 @@ function hook_xmlsitemap_engines($op, $t if (variable_get('xmlsitemap_engines_google_submit', TRUE)) { $result = drupal_http_request(variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE))); if ($result->code == 200) { - watchdog('xmlsitemap', t('Sitemap successfully submitted to Google.')); + watchdog('xmlsitemap', 'Sitemap successfully submitted to Google.'); } else { - watchdog('xmlsitemap', t('Error occurred submitting sitemap to Google: @code', array('@code' => $result->code)), WATCHDOG_ERROR); + watchdog('xmlsitemap', 'Error occurred submitting sitemap to Google: @code', array('@code' => $result->code), WATCHDOG_ERROR); } } break; Index: xmlsitemap_engines/xmlsitemap_engines.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.info,v retrieving revision 1.1 diff -u -p -r1.1 xmlsitemap_engines.info --- xmlsitemap_engines/xmlsitemap_engines.info 9 Nov 2007 17:56:05 -0000 1.1 +++ xmlsitemap_engines/xmlsitemap_engines.info 18 May 2008 06:23:47 -0000 @@ -2,5 +2,5 @@ name = XML Sitemap: Engines description = Submits site map to search engines. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = "6.x" Index: xmlsitemap_engines/xmlsitemap_engines.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module,v retrieving revision 1.1.2.5 diff -u -p -r1.1.2.5 xmlsitemap_engines.module --- xmlsitemap_engines/xmlsitemap_engines.module 8 May 2008 20:02:45 -0000 1.1.2.5 +++ xmlsitemap_engines/xmlsitemap_engines.module 18 May 2008 06:23:47 -0000 @@ -64,10 +64,10 @@ function _xmlsitemap_engines_google($op, if (variable_get('xmlsitemap_engines_google_submit', FALSE)) { $result = drupal_http_request(variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE))); if ($result->code == 200) { - watchdog('xmlsitemap', t('Sitemap successfully submitted to Google.')); + watchdog('xmlsitemap', 'Sitemap successfully submitted to Google.'); } else { - watchdog('xmlsitemap', t('Error occurred submitting sitemap to Google: @code', array('@code' => $result->code)), WATCHDOG_ERROR); + watchdog('xmlsitemap', 'Error occurred submitting sitemap to Google: @code', array('@code' => $result->code), WATCHDOG_ERROR); } } break; @@ -116,10 +116,10 @@ function _xmlsitemap_engines_yahoo($op) if (variable_get('xmlsitemap_engines_yahoo_submit', FALSE)) { $result = drupal_http_request(variable_get('xmlsitemap_engines_yahoo_url', 'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE))); if ($result->code == 200) { - watchdog('xmlsitemap', t('Site map successfully submitted to Yahoo!.')); + watchdog('xmlsitemap', 'Site map successfully submitted to Yahoo!.'); } else { - watchdog('xmlsitemap', t('Error occurred submitting site map to Yahoo!: @code', array('@code' => $result->code)), WATCHDOG_ERROR); + watchdog('xmlsitemap', 'Error occurred submitting site map to Yahoo!: @code', array('@code' => $result->code), WATCHDOG_ERROR); } } break; @@ -154,10 +154,10 @@ function _xmlsitemap_engines_ask($op) { if (variable_get('xmlsitemap_engines_ask_submit', FALSE)) { $result = drupal_http_request(variable_get('xmlsitemap_engines_ask_url', 'http://submissions.ask.com/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE))); if ($result->code == 200) { - watchdog('xmlsitemap', t('Site map successfully submitted to Ask.com.')); + watchdog('xmlsitemap', 'Site map successfully submitted to Ask.com.'); } else { - watchdog('xmlsitemap', t('Error occurred submitting site map to Ask.com: @code', array('@code' => $result->code)), WATCHDOG_ERROR); + watchdog('xmlsitemap', 'Error occurred submitting site map to Ask.com: @code', array('@code' => $result->code), WATCHDOG_ERROR); } } break; @@ -204,10 +204,10 @@ function _xmlsitemap_engines_live($op) { if (variable_get('xmlsitemap_engines_live_submit', FALSE)) { $result = drupal_http_request(variable_get('xmlsitemap_engines_live_url', 'http://webmaster.live.com/ping.aspx?siteMap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE))); if ($result->code == 200) { - watchdog('xmlsitemap', t('Site map successfully submitted to Windows Live.')); + watchdog('xmlsitemap', 'Site map successfully submitted to Windows Live.'); } else { - watchdog('xmlsitemap', t('Error occurred submitting site map to Windows Live: @code', array('@code' => $result->code)), WATCHDOG_ERROR); + watchdog('xmlsitemap', 'Error occurred submitting site map to Windows Live: @code', array('@code' => $result->code), WATCHDOG_ERROR); } } break; @@ -217,41 +217,37 @@ function _xmlsitemap_engines_live($op) { /** * Implementation of hook_menu(). */ -function xmlsitemap_engines_menu($may_cache) { +function xmlsitemap_engines_menu() { $items = array(); - $access_content = user_access('access content'); - if ($may_cache) { - if ($verify = variable_get('xmlsitemap_engines_google_verify', '')) { - $items[] = array( - 'path' => $verify, - 'title' => t('Google verification page'), - 'callback' => '_xmlsitemap_engines_verify', - 'callback arguments' => array('google'), - 'type' => MENU_CALLBACK, - 'access' => $access_content, - ); - } - if (($verify = variable_get('xmlsitemap_engines_yahoo_verify', '')) != '') { - $items[] = array( - 'path' => $verify, - 'title' => t('Yahoo! verification page'), - 'callback' => '_xmlsitemap_engines_verify', - 'callback arguments' => array('yahoo'), - 'type' => MENU_CALLBACK, - 'access' => $access_content, - ); - } - if (($verify = variable_get('xmlsitemap_engines_live_verify', 'LiveSearchSiteAuth.xml')) != '') { - $items[] = array( - 'path' => $verify, - 'title' => t('Windows Live verification page'), - 'callback' => '_xmlsitemap_engines_verify', - 'callback arguments' => array('live'), - 'type' => MENU_CALLBACK, - 'access' => $access_content, - ); - } + $access_content = array('access content'); + if ($verify = variable_get('xmlsitemap_engines_google_verify', '')) { + $items[$verify] = array( + 'title' => 'Google verification page', + 'page callback' => '_xmlsitemap_engines_verify', + 'page arguments' => array('google'), + 'type' => MENU_CALLBACK, + 'access arguments' => $access_content, + ); + } + if (($verify = variable_get('xmlsitemap_engines_yahoo_verify', '')) != '') { + $items[$verify] = array( + 'title' => 'Yahoo! verification page', + 'page callback' => '_xmlsitemap_engines_verify', + 'page arguments' => array('yahoo'), + 'type' => MENU_CALLBACK, + 'access arguments' => $access_content, + ); + } + if (($verify = variable_get('xmlsitemap_engines_live_verify', 'LiveSearchSiteAuth.xml')) != '') { + $items[$verify] = array( + 'title' => 'Windows Live verification page', + 'page callback' => '_xmlsitemap_engines_verify', + 'page arguments' => array('live'), + 'type' => MENU_CALLBACK, + 'access arguments' => $access_content, + ); } + return $items; } Index: xmlsitemap_node/xmlsitemap_node.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.info,v retrieving revision 1.1 diff -u -p -r1.1 xmlsitemap_node.info --- xmlsitemap_node/xmlsitemap_node.info 9 Nov 2007 17:56:05 -0000 1.1 +++ xmlsitemap_node/xmlsitemap_node.info 18 May 2008 06:23:47 -0000 @@ -2,5 +2,5 @@ name = XML Sitemap: Node description = Adds nodes to the site map. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = "6.x" Index: xmlsitemap_node/xmlsitemap_node.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.install,v retrieving revision 1.1.2.17 diff -u -p -r1.1.2.17 xmlsitemap_node.install --- xmlsitemap_node/xmlsitemap_node.install 13 May 2008 17:51:17 -0000 1.1.2.17 +++ xmlsitemap_node/xmlsitemap_node.install 18 May 2008 06:23:47 -0000 @@ -21,37 +21,76 @@ function xmlsitemap_node_requirements($p * Implementation of hook_install(). */ function xmlsitemap_node_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - db_query("CREATE TABLE {xmlsitemap_node} ( - nid int, - pid int, - last_changed int(11), - previously_changed int(11), - last_comment int(11), - previous_comment int(11), - priority_override float, - PRIMARY KEY (nid) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - break; - case 'pgsql': - db_query("CREATE TABLE {xmlsitemap_node} ( - nid integer, - pid integer, - last_changed integer, - previously_changed integer, - last_comment integer, - previous_comment integer, - priority_override real, - PRIMARY KEY (nid) - );"); - break; - } + drupal_install_schema('xmlsitemap_node'); _xmlsitemap_node_gsitemap_replace(); } /** + * Implementation of hook_schema(). + */ +function xmlsitemap_node_schema() { + $schema['xmlsitemap_node'] = array( + 'description' => t('The base table for xmlsitemap.'), + 'fields' => array( + 'nid' => array( + 'description' => t('The path of this node.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'pid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => FALSE, + 'default' => 0, + ), + 'last_changed' => array( + 'description' => t('Keeps track of new changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'previously_changed' => array( + 'description' => t('Keeps track of old changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'last_comment' => array( + 'description' => t('Link to last comment.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'previous_comment' => array( + 'description' => t('Link to previous comment.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => FALSE, + 'default' => 0, + ), + 'priority_override' => array( + 'description' => t('Stores the index value.'), + 'type' => 'float', + 'not null' => FALSE, + ), + ), + 'indexes' => array( + 'pid' => array('pid'), + ), + 'primary key' => array('nid'), + ); + + return $schema; +} + + +/** * Transfer data from Google Sitemap if it is installed. */ function _xmlsitemap_node_gsitemap_replace() { @@ -181,7 +220,7 @@ function xmlsitemap_node_disable() { * Implementation of hook_uninstall(). */ function xmlsitemap_node_uninstall() { - db_query("DROP TABLE {xmlsitemap_node}"); + drupal_uninstall_schema('xmlsitemap_node'); $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_node\_%'"); while ($variable = db_fetch_array($settings)) { variable_del($variable->name); Index: xmlsitemap_node/xmlsitemap_node.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module,v retrieving revision 1.1.2.22 diff -u -p -r1.1.2.22 xmlsitemap_node.module --- xmlsitemap_node/xmlsitemap_node.module 15 May 2008 04:06:28 -0000 1.1.2.22 +++ xmlsitemap_node/xmlsitemap_node.module 18 May 2008 06:23:48 -0000 @@ -162,7 +162,7 @@ function xmlsitemap_node_perm() { /** * Implementation of hook_form_alter(). */ -function xmlsitemap_node_form_alter($form_id, &$form) { +function xmlsitemap_node_form_alter(&$form, &$form_state, $form_id) { switch ($form_id) { case $form['type']['#value'] .'_node_form': if (isset($form['type'])) { @@ -207,7 +207,7 @@ function xmlsitemap_node_form_alter($for '#description' => t('This number will be added to the priority of this content type.'), ); $form['xmlsitemap_old_priority'] = array('#type' => 'value', '#value' => variable_get("xmlsitemap_node_type_priority_{$form['#node_type']->type}", 0.5)); - $form['#submit']['_xmlsitemap_node_submit'] = array(); + $form['#submit'][] = '_xmlsitemap_node_submit'; $form['submit']['#weight'] = 1; $form['reset']['#weight'] = 1; } @@ -335,13 +335,13 @@ function xmlsitemap_node_comment($commen * Add submit actions to forms. * @return None */ -function _xmlsitemap_node_submit($form_id, $form_values) { +function _xmlsitemap_node_submit($form, &$form_state) { switch ($form_id) { case 'node_type_form': - $op = isset($form_values['op']) ? $form_values['op'] : ''; - $type = isset($form_values['old_type']) ? $form_values['old_type'] : trim($form_values['type']); - $priority = $form_values['xmlsitemap_node_type_priority']; - $old_priority = $form_values['xmlsitemap_old_priority']; + $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : ''; + $type = isset($form_state['values']['old_type']) ? $form_state['values']['old_type'] : trim($form_state['values']['type']); + $priority = $form_state['values']['xmlsitemap_node_type_priority']; + $old_priority = $form_state['values']['xmlsitemap_old_priority']; if ($op == t('Save content type') && $priority != $old_priority || $op == t('Reset to defaults') && $old_priority != 0.1) { xmlsitemap_update_sitemap(); } @@ -457,6 +457,20 @@ function xmlsitemap_node_views_query_alt } /** + * Register theming functions + */ +function xmlsitemap_node_theme() { + return array( + 'xmlsitemap_node_view_sitemap' => array( + arguments => array('view', 'nodes', 'type'), + ), + 'xmlsitemap_node_view_news' => array( + arguments => array('view', 'nodes', 'type'), + ), + ); +} + +/** * Display the nodes of a view as an XML site map. */ function theme_xmlsitemap_node_view_sitemap($view, $nodes, $type) { Index: xmlsitemap_term/xmlsitemap_term.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_term/xmlsitemap_term.info,v retrieving revision 1.1 diff -u -p -r1.1 xmlsitemap_term.info --- xmlsitemap_term/xmlsitemap_term.info 9 Nov 2007 17:56:05 -0000 1.1 +++ xmlsitemap_term/xmlsitemap_term.info 18 May 2008 06:23:48 -0000 @@ -2,5 +2,5 @@ name = XML Sitemap: Term description = Adds taxonomy terms to the site map. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = "6.x" Index: xmlsitemap_term/xmlsitemap_term.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_term/xmlsitemap_term.install,v retrieving revision 1.1.2.7 diff -u -p -r1.1.2.7 xmlsitemap_term.install --- xmlsitemap_term/xmlsitemap_term.install 13 May 2008 17:39:18 -0000 1.1.2.7 +++ xmlsitemap_term/xmlsitemap_term.install 18 May 2008 06:23:48 -0000 @@ -18,32 +18,53 @@ function xmlsitemap_term_requirements($p } /** - * Implementation of hook_install(). + * Implementation of hook_schema(). */ -function xmlsitemap_term_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - db_query("CREATE TABLE {xmlsitemap_term} ( - tid int, - pid int, - last_changed int(11), - previously_changed int(11), - priority_override float, - PRIMARY KEY (tid) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - break; - case 'pgsql': - db_query("CREATE TABLE {xmlsitemap_term} ( - tid integer, - pid integer, - last_changed integer, - previously_changed integer, - priority_override real, - PRIMARY KEY (tid) - );"); - break; - } +function xmlsitemap_term_schema() { + $schema['xmlsitemap_term'] = array( + 'description' => t('The base table for xmlsitemap.'), + 'fields' => array( + 'tid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'pid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'last_changed' => array( + 'description' => t('Keeps track of new changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'previously_changed' => array( + 'description' => t('Keeps track of old changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'priority_override' => array( + 'description' => t('Stores the index value.'), + 'type' => 'float', + 'not null' => FALSE, + ), + ), + 'indexes' => array( + 'pid' => array('pid'), + ), + 'primary key' => array('tid'), + ); + + return $schema; } /** @@ -93,15 +114,23 @@ function xmlsitemap_term_disable() { xmlsitemap_update_sitemap(); } + +/** + * Implementation of hook_uninstall(). + */ +function xmlsitemap_term_install() { + drupal_install_schema('xmlsitemap_term'); +} + /** * Implementation of hook_uninstall(). */ function xmlsitemap_term_uninstall() { - db_query("DROP TABLE {xmlsitemap_term}"); $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_term\_%'"); while ($variable = db_fetch_object($settings)) { variable_del($variable->name); } + drupal_uninstall_schema('xmlsitemap_term'); } /** Index: xmlsitemap_term/xmlsitemap_term.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_term/xmlsitemap_term.module,v retrieving revision 1.1.2.13 diff -u -p -r1.1.2.13 xmlsitemap_term.module --- xmlsitemap_term/xmlsitemap_term.module 15 May 2008 04:06:28 -0000 1.1.2.13 +++ xmlsitemap_term/xmlsitemap_term.module 18 May 2008 06:23:48 -0000 @@ -130,7 +130,7 @@ function xmlsitemap_term_perm() { /** * Implementation of hook_form_alter(). */ -function xmlsitemap_term_form_alter($form_id, &$form) { +function xmlsitemap_term_form_alter(&$form, &$form_state, $form_id) { switch ($form_id) { case 'taxonomy_form_term': $priority = db_result(db_query("SELECT priority_override FROM {xmlsitemap_term} WHERE tid = %d", $form['tid']['#value'])); Index: xmlsitemap_user/xmlsitemap_user.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_user/xmlsitemap_user.info,v retrieving revision 1.1 diff -u -p -r1.1 xmlsitemap_user.info --- xmlsitemap_user/xmlsitemap_user.info 9 Nov 2007 17:56:05 -0000 1.1 +++ xmlsitemap_user/xmlsitemap_user.info 18 May 2008 06:23:48 -0000 @@ -2,5 +2,5 @@ name = XML Sitemap: User description = Adds user profiles to the site map. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = "6.x" Index: xmlsitemap_user/xmlsitemap_user.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_user/xmlsitemap_user.install,v retrieving revision 1.1.2.8 diff -u -p -r1.1.2.8 xmlsitemap_user.install --- xmlsitemap_user/xmlsitemap_user.install 13 May 2008 17:39:18 -0000 1.1.2.8 +++ xmlsitemap_user/xmlsitemap_user.install 18 May 2008 06:23:48 -0000 @@ -18,42 +18,76 @@ function xmlsitemap_user_requirements($p } /** - * Implementation of hook_install(). + * Implementation of hook_schema(). */ -function xmlsitemap_user_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - db_query("CREATE TABLE {xmlsitemap_user} ( - uid int, - pid int, - last_changed int(11), - previously_changed int(11), - priority_override float, - PRIMARY KEY (uid) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - db_query("CREATE TABLE {xmlsitemap_user_role} ( - rid int, - priority float NOT NULL DEFAULT 0, - PRIMARY KEY (rid) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - break; - case 'pgsql': - db_query("CREATE TABLE {xmlsitemap_user} ( - uid integer, - pid integer, - last_changed integer, - previously_changed integer, - priority_override real, - PRIMARY KEY (uid) - );"); - db_query("CREATE TABLE {xmlsitemap_user_role} ( - rid integer, - priority real NOT NULL DEFAULT 0, - PRIMARY KEY (rid) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - break; - } +function xmlsitemap_user_schema() { + $schema['xmlsitemap_user'] = array( + 'description' => t('The base table for xmlsitemap.'), + 'fields' => array( + 'uid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'pid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'last_changed' => array( + 'description' => t('Keeps track of new changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'previously_changed' => array( + 'description' => t('Keeps track of old changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'priority_override' => array( + 'description' => t('Stores the index value.'), + 'type' => 'float', + 'not null' => FALSE, + ), + ), + 'indexes' => array( + 'pid' => array('pid'), + ), + 'primary key' => array('uid'), + ); + + $schema['xmlsitemap_user_role'] = array( + 'description' => t('The base table for xmlsitemap.'), + 'fields' => array( + 'rid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'priority' => array( + 'description' => t('Stores the index value.'), + 'type' => 'float', + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'indexes' => array( + 'pid' => array('rid'), + ), + 'primary key' => array('rid'), + ); + + return $schema; } /** @@ -106,11 +140,17 @@ function xmlsitemap_user_disable() { } /** + * Implementation of hook_install(). + */ +function xmlsitemap_user_install() { + drupal_install_schema('xmlsitemap_user'); +} + +/** * Implementation of hook_uninstall(). */ function xmlsitemap_user_uninstall() { - db_query("DROP TABLE {xmlsitemap_user}"); - db_query("DROP TABLE {xmlsitemap_user_role}"); + drupal_uninstall_schema('xmlsitemap_user'); } /** Index: xmlsitemap_user/xmlsitemap_user.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_user/xmlsitemap_user.module,v retrieving revision 1.1.2.15 diff -u -p -r1.1.2.15 xmlsitemap_user.module --- xmlsitemap_user/xmlsitemap_user.module 15 May 2008 04:06:28 -0000 1.1.2.15 +++ xmlsitemap_user/xmlsitemap_user.module 18 May 2008 06:23:48 -0000 @@ -91,7 +91,7 @@ function _xmlsitemap_user_priority($user /** * Implementation of hook_form_alter(). */ -function xmlsitemap_user_form_alter($form_id, &$form) { +function xmlsitemap_user_form_alter(&$form, &$form_state, $form_id) { switch ($form_id) { case 'user_admin_settings': $form['xmlsitemap'] = array( @@ -108,7 +108,7 @@ function xmlsitemap_user_form_alter($for '#description' => t('Choose the default priority for users who have only the authenticated user role.'), ); $form['buttons']['#weight'] = 1; - $form['#submit']['_xmlsitemap_user_submit'] = array(); + $form['#submit'][] = '_xmlsitemap_user_submit'; break; case 'user_admin_role': $form['xmlsitemap_user_role_priority'] = array( @@ -120,7 +120,7 @@ function xmlsitemap_user_form_alter($for ); $form['submit']['#weight'] = 1; $form['delete']['#weight'] = 1; - $form['#submit']['_xmlsitemap_user_submit'] = array(); + $form['#submit'][] = '_xmlsitemap_user_submit'; break; } } @@ -129,23 +129,23 @@ function xmlsitemap_user_form_alter($for * Add submit actions to forms. * @return None */ -function _xmlsitemap_user_submit($form_id, $form_values) { - switch ($form_id) { +function _xmlsitemap_user_submit($form, &$form_state) { + switch ($form_state['values']['form_id']) { case 'user_admin_settings': - if ($form_values['xmlsitemap_user_default_priority'] != $form_values['xmlsitemap_user_old_default_priority']) { + if ($form_state['values']['xmlsitemap_user_default_priority'] != $form_state['values']['xmlsitemap_user_old_default_priority']) { xmlsitemap_update_sitemap(); } break; case 'user_admin_role': - $priority = db_result(db_query("SELECT priority FROM {xmlsitemap_user_role} WHERE rid = %d", $form_values['rid'])); - if ($form_values['op'] == t('Delete role')) { - db_query("DELETE FROM {xmlsitemap_user_role} WHERE rid = %d", $form_values['rid']); + $priority = db_result(db_query("SELECT priority FROM {xmlsitemap_user_role} WHERE rid = %d", $form_state['values']['rid'])); + if ($form_state['values']['op'] == t('Delete role')) { + db_query("DELETE FROM {xmlsitemap_user_role} WHERE rid = %d", $form_state['values']['rid']); if ($priority > 0 || $priority < 0) { xmlsitemap_update_sitemap(); } } - elseif ($form_values['xmlsitemap_user_role_priority'] != $priority) { - db_query("UPDATE {xmlsitemap_user_role} SET priority = %f WHERE rid = %d", $form_values['xmlsitemap_user_role_priority'], $form_values['rid']); + elseif ($form_state['values']['xmlsitemap_user_role_priority'] != $priority) { + db_query("UPDATE {xmlsitemap_user_role} SET priority = %f WHERE rid = %d", $form_state['values']['xmlsitemap_user_role_priority'], $form_state['values']['rid']); xmlsitemap_update_sitemap(); } break; @@ -193,7 +193,7 @@ function xmlsitemap_user_user($op, &$edi } return $form; case 'insert': - $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", "user/$account->uid")); + $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", "user/". $account->uid)); $pid = empty($pid) ? 'NULL' : $pid; if (isset($edit['xmlsitemap_user_priority'])) { $priority = $edit['xmlsitemap_user_priority']; @@ -209,7 +209,7 @@ function xmlsitemap_user_user($op, &$edi xmlsitemap_update_sitemap(); break; case 'update': - $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", "user/$account->uid")); + $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", "user/". $account->uid)); $pid = empty($pid) ? 'NULL' : $pid; if (isset($edit['xmlsitemap_user_priority'])) { $priority = $edit['xmlsitemap_user_priority'];