Index: ../xmlsitemap/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/xmlsitemap.info 9 Nov 2007 17:56:04 -0000 1.1 +++ ../xmlsitemap/xmlsitemap.info 10 Mar 2008 18:49:16 -0000 @@ -2,4 +2,5 @@ name = XML Sitemap description = Creates an XML site map in accordance with the sitemaps.org specification. package = XML Sitemap - +core = 6.x +version = 6.x-1.x-dev Index: ../xmlsitemap/xmlsitemap.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap.install,v retrieving revision 1.4 diff -u -p -r1.4 xmlsitemap.install --- ../xmlsitemap/xmlsitemap.install 11 Dec 2007 22:57:45 -0000 1.4 +++ ../xmlsitemap/xmlsitemap.install 10 Mar 2008 18:49:16 -0000 @@ -2,33 +2,74 @@ // $Id: xmlsitemap.install,v 1.4 2007/12/11 22:57:45 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, + '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' => 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'); } /** @@ -66,15 +107,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/xmlsitemap.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap.module,v retrieving revision 1.16 diff -u -p -r1.16 xmlsitemap.module --- ../xmlsitemap/xmlsitemap.module 18 Dec 2007 22:54:51 -0000 1.16 +++ ../xmlsitemap/xmlsitemap.module 10 Mar 2008 18:49:16 -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,55 @@ 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, + ); + $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, + ); + $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; } @@ -95,7 +86,6 @@ function xmlsitemap_settings_sitemap() { '#size' => 10, '#maxlength' => 5, '#description' => t('This is the number of links to include in one site map. Values can range between 1 and 50,000. If the total number of links exceeds the chunk size, multiple site maps will be generated.'), - '#weight' => -1, ); $form['xmlsitemap_front_page_priority'] = array( '#type' => 'select', @@ -103,7 +93,6 @@ function xmlsitemap_settings_sitemap() { '#default_value' => variable_get('xmlsitemap_front_page_priority', 1), '#options' => xmlsitemap_priority_options(), '#description' => t('This is the absolute priority for the front page.'), - '#weight' => -1, ); return system_settings_form($form); } @@ -111,8 +100,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 +109,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['values']); xmlsitemap_update_sitemap(); } @@ -159,12 +148,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 +199,16 @@ function xmlsitemap_settings_additional( } /** + * Implementation of hook_theme(). + */ +function xmlsitemap_theme() { + return array( + 'xmlsitemap_settings_additional' => array( + ), + ); +} + +/** * Theme additional links form. * @ingroup themeable */ @@ -232,56 +231,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(); } @@ -360,7 +360,7 @@ function _xmlsitemap_output($chunk = NUL $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'], + '@address' => ip_address(), )); watchdog('xmlsitemap', $message); } @@ -616,7 +616,7 @@ function xmlsitemap_xmlsitemap_links($ty function _xmlsitemap_additional_links() { $links = array(); $result = db_query(" - SELECT xa.*, ua.dst AS alias FROM {xmlsitemap_additional} xa + SELECT xa.*, ua.dst alias FROM {xmlsitemap_additional} xa LEFT JOIN {url_alias} ua ON xa.pid = ua.pid "); while ($link = db_fetch_object($result)) { @@ -706,9 +706,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; @@ -750,9 +752,9 @@ function _xmlsitemap_get_path_alias($pat if (function_exists('custom_url_rewrite')) { $result = custom_url_rewrite('alias', $result, $path); } - if (module_exists('i18n')) { - i18n_get_lang_prefix($result, TRUE); - } +# if (module_exists('i18n')) { +# i18n_get_lang_prefix($result, TRUE); +# } return $result; } Index: ../xmlsitemap/docs/xmlsitemap.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/docs/xmlsitemap.php,v retrieving revision 1.4 diff -u -p -r1.4 xmlsitemap.php --- ../xmlsitemap/docs/xmlsitemap.php 6 Dec 2007 17:41:14 -0000 1.4 +++ ../xmlsitemap/docs/xmlsitemap.php 10 Mar 2008 18:49:16 -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/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/xmlsitemap_engines/xmlsitemap_engines.info 9 Nov 2007 17:56:05 -0000 1.1 +++ ../xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.info 10 Mar 2008 18:49:16 -0000 @@ -2,5 +2,6 @@ name = XML Sitemap: Engines description = Submits site map to search engines. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = 6.x +version = 6.x-1.x-dev Index: ../xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module,v retrieving revision 1.4 diff -u -p -r1.4 xmlsitemap_engines.module --- ../xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module 13 Dec 2007 02:48:02 -0000 1.4 +++ ../xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module 10 Mar 2008 18:49:16 -0000 @@ -38,36 +38,36 @@ function _xmlsitemap_engines_google($op, case 'form': $form['google'] = array( '#type' => 'fieldset', - '#title' => t('Google'), + '#title' => 'Google', '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['google']['xmlsitemap_engines_google_submit'] = array( '#type' => 'checkbox', - '#title' => t('Submit site map to Google.'), + '#title' => 'Submit site map to Google.', '#default_value' => variable_get('xmlsitemap_engines_google_submit', FALSE), ); $form['google']['xmlsitemap_engines_google_url'] = array( '#type' => 'textfield', - '#title' => t('Submission URL'), + '#title' => 'Submission URL', '#default_value' => 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)), - '#description' => t('The URL to submit the site map to.'), + '#description' => 'The URL to submit the site map to.', ); $form['google']['xmlsitemap_engines_google_verify'] = array( '#type' => 'textfield', - '#title' => t('Verification link'), + '#title' => 'Verification link', '#default_value' => variable_get('xmlsitemap_engines_google_verify', ''), - '#description' => t('In order to show statistics, Google will ask you to verify that you control this site by creating a file with a certain name. Enter that name here and the XML Sitemap module will create a path to that file name. This will only work if you have clean URLs enabled.'), + '#description' => 'In order to show statistics, Google will ask you to verify that you control this site by creating a file with a certain name. Enter that name here and the XML Sitemap module will create a path to that file name. This will only work if you have clean URLs enabled.', ); return $form; case 'ping': 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; @@ -84,42 +84,42 @@ function _xmlsitemap_engines_yahoo($op) case 'form': $form['yahoo'] = array( '#type' => 'fieldset', - '#title' => t('Yahoo!'), + '#title' => 'Yahoo!', '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['yahoo']['xmlsitemap_engines_yahoo_submit'] = array( '#type' => 'checkbox', - '#title' => t('Submit site map to Yahoo!.'), + '#title' => 'Submit site map to Yahoo!.', '#default_value' => variable_get('xmlsitemap_engines_yahoo_submit', FALSE), ); $form['yahoo']['xmlsitemap_engines_yahoo_url'] = array( '#type' => 'textfield', - '#title' => t('Submission URL'), + '#title' => 'Submission URL', '#default_value' => 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)), - '#description' => t('The URL to submit the site map to.'), + '#description' => 'The URL to submit the site map to.', ); $form['yahoo']['xmlsitemap_engines_yahoo_verify'] = array( '#type' => 'textfield', - '#title' => t('Verification link'), + '#title' => 'Verification link', '#default_value' => variable_get('xmlsitemap_engines_yahoo_verify', ''), - '#description' => t('Before allowing you to view additional information, Yahoo! will ask you to verify that you control this site by creating a file with a certain name. Enter that name here, and XML Sitemap will create a path to that file name. This will only work if you have clean URLs enabled.'), + '#description' => 'Before allowing you to view additional information, Yahoo! will ask you to verify that you control this site by creating a file with a certain name. Enter that name here, and XML Sitemap will create a path to that file name. This will only work if you have clean URLs enabled.', ); $form['yahoo']['xmlsitemap_engines_yahoo_verify_string'] = array( '#type' => 'textfield', - '#title' => t('Authentication key'), + '#title' => 'Authentication key', '#default_value' => variable_get('xmlsitemap_engines_yahoo_verify_string', ''), - '#description' => t('Yahoo! will ask you to put an authentication key in the verification file.'), + '#description' => 'Yahoo! will ask you to put an authentication key in the verification file.', ); return $form; case 'ping': 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; @@ -134,30 +134,30 @@ function _xmlsitemap_engines_ask($op) { case 'form': $form['ask'] = array( '#type' => 'fieldset', - '#title' => t('Ask.com'), + '#title' => 'Ask.com', '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['ask']['xmlsitemap_engines_ask_submit'] = array( '#type' => 'checkbox', - '#title' => t('Submit site map to Ask.com.'), + '#title' => 'Submit site map to Ask.com.', '#default_value' => variable_get('xmlsitemap_engines_ask_submit', FALSE), ); $form['ask']['xmlsitemap_engines_ask_url'] = array( '#type' => 'textfield', - '#title' => t('Submission URL'), + '#title' => 'Submission URL', '#default_value' => 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)), - '#description' => t('The URL to submit the site map to.'), + '#description' => 'The URL to submit the site map to.', ); return $form; case 'ping': 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; @@ -172,42 +172,42 @@ function _xmlsitemap_engines_live($op) { case 'form': $form['live'] = array( '#type' => 'fieldset', - '#title' => t('Windows Live'), + '#title' => 'Windows Live', '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['live']['xmlsitemap_engines_live_submit'] = array( '#type' => 'checkbox', - '#title' => t('Submit site map to Windows Live.'), + '#title' => 'Submit site map to Windows Live.', '#default_value' => variable_get('xmlsitemap_engines_live_submit', FALSE), ); $form['live']['xmlsitemap_engines_live_url'] = array( '#type' => 'textfield', - '#title' => t('Submission URL'), + '#title' => 'Submission URL', '#default_value' => 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)), - '#description' => t('The URL to submit the site map to.'), + '#description' => 'The URL to submit the site map to.', ); $form['live']['xmlsitemap_engines_live_verify'] = array( '#type' => 'textfield', - '#title' => t('Authentication file'), + '#title' => 'Authentication file', '#default_value' => variable_get('xmlsitemap_engines_live_verify', 'LiveSearchSiteAuth.xml'), - '#description' => t('Before allowing you to view additional information, Windows Live will ask you to verify that you control this site by creating a file with a certain name. Enter that name here, and XML Sitemap will create a path to that file name. This will only work if you have clean URLs enabled.'), + '#description' => 'Before allowing you to view additional information, Windows Live will ask you to verify that you control this site by creating a file with a certain name. Enter that name here, and XML Sitemap will create a path to that file name. This will only work if you have clean URLs enabled.', ); $form['live']['xmlsitemap_engines_live_verify_string'] = array( '#type' => 'textfield', - '#title' => t('Authentication tag'), + '#title' => 'Authentication tag', '#default_value' => variable_get('xmlsitemap_engines_live_verify_string', ''), - '#description' => t('Windows Live will give you an authentication tag.'), + '#description' => 'Windows Live will give you an authentication tag.', ); return $form; case 'ping': 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/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/xmlsitemap_node/xmlsitemap_node.info 9 Nov 2007 17:56:05 -0000 1.1 +++ ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.info 10 Mar 2008 18:49:16 -0000 @@ -2,5 +2,6 @@ name = XML Sitemap: Node description = Adds nodes to the site map. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = 6.x +version = 6.x-1.x-dev Index: ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.install,v retrieving revision 1.7 diff -u -p -r1.7 xmlsitemap_node.install --- ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.install 8 Jan 2008 05:13:35 -0000 1.7 +++ ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.install 10 Mar 2008 18:49:16 -0000 @@ -2,36 +2,87 @@ // $Id: xmlsitemap_node.install,v 1.7 2008/01/08 05:13:35 darrenoh Exp $ /** + * 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; +} + +/** * 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; +function xmlsitemap_node_install() { + // Create my tables. + drupal_install_schema('xmlsitemap_node'); +} + +/** + * Implementation of hook_uninstall(). + */ +function xmlsitemap_node_uninstall() { + // Drop my tables. + $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_node\_%'"); + while ($variable = db_fetch_array($settings)) { + variable_del($variable->name); } + drupal_uninstall_schema('xmlsitemap_node'); } /** @@ -98,15 +149,3 @@ function _xmlsitemap_node_insert_query() function xmlsitemap_node_disable() { xmlsitemap_update_sitemap(); } - -/** - * Implementation of hook_uninstall(). - */ -function xmlsitemap_node_uninstall() { - db_query("DROP TABLE {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/xmlsitemap_node/xmlsitemap_node.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module,v retrieving revision 1.17 diff -u -p -r1.17 xmlsitemap_node.module --- ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.module 8 Jan 2008 05:13:35 -0000 1.17 +++ ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.module 10 Mar 2008 18:49:16 -0000 @@ -51,13 +51,13 @@ function _xmlsitemap_node_links($exclude $links = array(); if (module_exists('comment')) { $sql = " - SELECT n.nid, n.type, n.promote, s.comment_count, n.changed, xn.previously_changed, s.last_comment_timestamp, xn.previous_comment, xn.priority_override, ua.dst AS alias + SELECT n.nid, n.type, n.promote, s.comment_count, n.changed, xn.previously_changed, s.last_comment_timestamp, xn.previous_comment, xn.priority_override, ua.dst alias FROM {node} n LEFT JOIN {node_comment_statistics} s ON s.nid = n.nid"; } else { $sql = " - SELECT n.nid, n.type, n.promote, n.changed, xn.previously_changed, xn.priority_override, ua.dst AS alias + SELECT n.nid, n.type, n.promote, n.changed, xn.previously_changed, xn.priority_override, ua.dst alias FROM {node} n"; } $sql .= " @@ -161,7 +161,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'])) { @@ -206,7 +206,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.1)); - $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($op, $c * 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(); } Index: ../xmlsitemap/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/xmlsitemap_term/xmlsitemap_term.info 9 Nov 2007 17:56:05 -0000 1.1 +++ ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.info 10 Mar 2008 18:49:16 -0000 @@ -2,5 +2,6 @@ name = XML Sitemap: Term description = Adds taxonomy terms to the site map. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = 6.x +version = 6.x-1.x-dev Index: ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_term/xmlsitemap_term.install,v retrieving revision 1.3 diff -u -p -r1.3 xmlsitemap_term.install --- ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.install 6 Dec 2007 17:41:15 -0000 1.3 +++ ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.install 10 Mar 2008 18:49:16 -0000 @@ -2,32 +2,53 @@ // $Id: xmlsitemap_term.install,v 1.3 2007/12/06 17:41:15 darrenoh Exp $ /** - * 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; } /** @@ -67,14 +88,22 @@ 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/xmlsitemap_term/xmlsitemap_term.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_term/xmlsitemap_term.module,v retrieving revision 1.10 diff -u -p -r1.10 xmlsitemap_term.module --- ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.module 13 Dec 2007 02:18:30 -0000 1.10 +++ ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.module 10 Mar 2008 18:49:17 -0000 @@ -51,7 +51,7 @@ function _xmlsitemap_term_excludes() { function _xmlsitemap_term_links($excludes = array()) { $links = array(); $result = db_query(db_rewrite_sql(" - SELECT td.*, v.module, xt.last_changed, xt.previously_changed, xt.priority_override, ua.dst AS alias + SELECT td.*, v.module, xt.last_changed, xt.previously_changed, xt.priority_override, ua.dst alias FROM {term_data} td LEFT JOIN {vocabulary} v ON v.vid = td.vid LEFT JOIN {xmlsitemap_term} xt ON xt.tid = td.tid @@ -129,7 +129,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/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/xmlsitemap_user/xmlsitemap_user.info 9 Nov 2007 17:56:05 -0000 1.1 +++ ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.info 10 Mar 2008 18:49:17 -0000 @@ -2,5 +2,6 @@ name = XML Sitemap: User description = Adds user profiles to the site map. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = 6.x +version = 6.x-1.x-dev Index: ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_user/xmlsitemap_user.install,v retrieving revision 1.4 diff -u -p -r1.4 xmlsitemap_user.install --- ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.install 6 Dec 2007 17:41:15 -0000 1.4 +++ ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.install 10 Mar 2008 18:49:17 -0000 @@ -2,42 +2,76 @@ // $Id: xmlsitemap_user.install,v 1.4 2007/12/06 17:41:15 darrenoh Exp $ /** - * 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; } /** @@ -84,10 +118,16 @@ 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/xmlsitemap_user/xmlsitemap_user.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_user/xmlsitemap_user.module,v retrieving revision 1.11 diff -u -p -r1.11 xmlsitemap_user.module --- ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.module 10 Dec 2007 03:15:19 -0000 1.11 +++ ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.module 10 Mar 2008 18:49:17 -0000 @@ -32,7 +32,7 @@ function xmlsitemap_user_xmlsitemap_link function _xmlsitemap_user_links() { $links = array(); $result = db_query(" - SELECT u.uid, xu.last_changed, xu.previously_changed, xu.priority_override, SUM(xur.priority) as priority, ua.dst AS alias + SELECT u.uid, xu.last_changed, xu.previously_changed, xu.priority_override, SUM(xur.priority) as priority, ua.dst alias FROM {users} u LEFT JOIN {users_roles} ur ON ur.uid = u.uid LEFT JOIN {xmlsitemap_user_role} xur ON xur.rid = ur.rid @@ -90,7 +90,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( @@ -107,7 +107,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( @@ -119,7 +119,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; } } @@ -128,23 +128,23 @@ function xmlsitemap_user_form_alter($for * Add submit actions to forms. * @return None */ -function _xmlsitemap_user_submit($form_id, $form_values) { +function _xmlsitemap_user_submit(&$form, &$form_state, $form_id) { switch ($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; @@ -174,7 +174,7 @@ function xmlsitemap_user_user($op, &$edi ); $options = xmlsitemap_priority_options('both'); $default = db_fetch_object(db_query(" - SELECT MIN(priority) AS min, SUM(priority) AS sum FROM {xmlsitemap_user_role} + SELECT MIN(priority) min, SUM(priority) sum FROM {xmlsitemap_user_role} WHERE rid IN (". implode(', ', array_keys($account->roles)) .") ")); $default = $default->min < 0 ? -1 : min($default->sum, 0.9);