? auth/services_keyauth/comments.txt
Index: services.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/Attic/services.info,v
retrieving revision 1.5.2.2
diff -u -r1.5.2.2 services.info
--- services.info	5 Oct 2008 00:33:02 -0000	1.5.2.2
+++ services.info	19 Oct 2009 22:06:06 -0000
@@ -1,6 +1,10 @@
 ; $Id: services.info,v 1.5.2.2 2008/10/05 00:33:02 marcingy Exp $
 name = Services
 description = Provide an API for creating web services.
+files[] = services.module
+files[] = services_admin_browse.inc
+files[] = services.resource-translation.inc
+files[] = services.install
 package = Services
-core = 6.x
-php = 5.x 
\ No newline at end of file
+core = 7.x
+php = 5.x
\ No newline at end of file
Index: services.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/Attic/services.install,v
retrieving revision 1.3.2.21
diff -u -r1.3.2.21 services.install
--- services.install	26 May 2009 02:55:14 -0000	1.3.2.21
+++ services.install	19 Oct 2009 22:31:54 -0000
@@ -7,21 +7,21 @@
  */
 
 /**
- * Implementation of hook_schema().
+ * Implements hook_schema().
  */
 function services_schema() {
   return array();
 }
 
 /**
- * Implementation of hook_install().
+ * Implements hook_install().
  */
 function services_install() {
   drupal_install_schema('services');
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function services_uninstall() {
   drupal_uninstall_schema('services');
@@ -42,7 +42,7 @@
 }
 
 /**
- * Implementation of hook_update().
+ * Implements hook_update().
  *
  * Create the nonce table
  */
Index: services.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/Attic/services.module,v
retrieving revision 1.8.2.88.2.8
diff -u -r1.8.2.88.2.8 services.module
--- services.module	15 Oct 2009 03:59:55 -0000	1.8.2.88.2.8
+++ services.module	20 Oct 2009 03:16:59 -0000
@@ -6,33 +6,36 @@
  *  Provides a generic by powerful API for web services.
  */
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function services_help($path, $arg) {
   switch ($path) {
     case 'admin/help#services':
-      return '<p>'. t('Visit the <a href="@handbook_url">Services Handbook</a> for help and information.', array('@handbook_url' => 'http://drupal.org/node/109782')) .'</p>';
-
+      return '<p>' . t('Visit the <a href="@handbook_url">Services Handbook</a> for help and information.', array('@handbook_url' => 'http://drupal.org/node/109782')) . '</p>';
     case 'admin/build/services':
     case 'admin/build/services/browse':
-      $output = '<p>'. t('Services are collections of methods available to remote applications. They are defined in modules, and may be accessed in a number of ways through server modules. Visit the <a href="@handbook_url">Services Handbook</a> for help and information.', array('@handbook_url' => 'http://drupal.org/node/109782')) .'</p>';
-      $output .= '<p>'. t('All enabled services and methods are shown. Click on any method to view information or test.') .'</p>';      return $output;
-
+      $output = '<p>' . t('Services are collections of methods available to remote applications. They are defined in modules, and may be accessed in a number of ways through server modules. Visit the <a href="@handbook_url">Services Handbook</a> for help and information.', array('@handbook_url' => 'http://drupal.org/node/109782')) . '</p>';
+      $output .= '<p>' . t('All enabled services and methods are shown. Click on any method to view information or test.') . '</p>';
+      return $output;
     case 'admin/build/services/keys':
       return t('An API key is required to allow an application to access Drupal remotely.');
-
   }
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_permission().
  */
-function services_perm() {
-  return array('administer services');
+function services_permission() {
+  return array(
+    'administer services' => array(
+      'title' => 'Administer Services',
+      'description' => 'Perform maintenance tasks for Services module',
+    )
+  );
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function services_menu() {
   $items['admin/build/services'] = array(
@@ -100,7 +103,7 @@
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function services_theme() {
   return array(
@@ -137,16 +140,16 @@
  */
 function services_crossdomain_xml() {
   global $base_url;
-  $output = '<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">'."\n";
-  $output .= '<cross-domain-policy>'."\n";
-  $output .= '  <allow-access-from domain="'. check_plain($_SERVER['HTTP_HOST']) .'" />'."\n";
-  $output .= '  <allow-access-from domain="*.'. check_plain($_SERVER['HTTP_HOST']) .'" />'."\n";
+  $output = '<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">' . "\n";
+  $output .= '<cross-domain-policy>' . "\n";
+  $output .= '  <allow-access-from domain="' . check_plain($_SERVER['HTTP_HOST']) . '" />' . "\n";
+  $output .= '  <allow-access-from domain="*.' . check_plain($_SERVER['HTTP_HOST']) . '" />' . "\n";
   $keys = services_get_keys();
 
   foreach ($keys as $key) {
     if (!empty($key->domain)) {
-      $output .= '  <allow-access-from domain="'. check_plain($key->domain) .'" />'."\n";
-      $output .= '  <allow-access-from domain="*.'. check_plain($key->domain) .'" />'."\n";
+      $output .= '  <allow-access-from domain="' . check_plain($key->domain) . '" />' . "\n";
+      $output .= '  <allow-access-from domain="*.' . check_plain($key->domain) . '" />' . "\n";
     }
   }
 
@@ -156,11 +159,11 @@
 }
 
 function services_xml_output($xml) {
-  $xml = '<?xml version="1.0"?>'."\n". $xml;
+  $xml = '<?xml version="1.0"?>' . "\n" . $xml;
   header('Connection: close');
-  header('Content-Length: '. drupal_strlen($xml));
+  header('Content-Length: ' . drupal_strlen($xml));
   header('Content-Type: text/xml');
-  header('Date: '. date('r'));
+  header('Date: ' . date('r'));
   echo $xml;
   exit;
 }
@@ -436,7 +439,7 @@
   }
 }
 
-function services_form_alter(&$form, $form_state, $form_id) {
+function services_form_alter(&$form, &$form_state, $form_id) {
   if ($form_id == 'system_modules') {
     // Add our own submit hook to clear cache
     $form['#submit'][] = 'services_system_modules_submit';
@@ -460,7 +463,7 @@
   $path = join($name, '/');
   $resource['#name'] = $path;
 
-  $keys = array('#retrieve','#create','#update','#delete');
+  $keys = array('#retrieve', '#create', '#update', '#delete');
   foreach ($keys as $key) {
     if (isset($resource[$key])) {
       $controllers[$path . '/' . $key] = &$resource[$key];
@@ -576,7 +579,7 @@
 
         // Translate all resources
         foreach ($resources as $name => $def) {
-          foreach(_services_resource_as_services($def) as $method) {
+          foreach (_services_resource_as_services($def) as $method) {
             $methods[] = $method;
           }
         }
@@ -632,6 +635,7 @@
 
 /**
  * Backup current session data and import user session.
+ * @TODO this function needs to be looked at much closely to use drupals new session handling stuff
  */
 function services_session_load($sessid) {
   global $user;
@@ -670,6 +674,7 @@
 
 /**
  * Revert to previously backuped session.
+ * @TODO this function needs to be looked at much closely to use drupals new session handling stuff
  */
 function services_session_unload($backup) {
   global $user;
@@ -702,4 +707,4 @@
  */
 function services_access_menu() {
   return TRUE;
-} 
\ No newline at end of file
+}
\ No newline at end of file
Index: services.resource-translation.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/Attic/services.resource-translation.inc,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 services.resource-translation.inc
--- services.resource-translation.inc	5 Sep 2009 13:57:58 -0000	1.1.2.1
+++ services.resource-translation.inc	19 Oct 2009 22:32:44 -0000
@@ -1,6 +1,10 @@
 <?php
 // $Id: services.resource-translation.inc,v 1.1.2.1 2009/09/05 13:57:58 marcingy Exp $
-
+/**
+ * @author Services Dev Team
+ * @file
+ *  Provides a CRUD functions for services.
+ */
 function _services_resource_as_services($resource) {
   static $controllers = array(
     '#create' => 'create',
@@ -60,7 +64,7 @@
     $controller = $service;
     $controller['#args'] = array();
 
-    foreach($service['#args'] as $arg) {
+    foreach ($service['#args'] as $arg) {
       $arg['#source'] = array(
         'data' => $arg['#name'],
       );
Index: services_admin_browse.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/Attic/services_admin_browse.inc,v
retrieving revision 1.5.2.45.2.2
diff -u -r1.5.2.45.2.2 services_admin_browse.inc
--- services_admin_browse.inc	5 Sep 2009 13:57:58 -0000	1.5.2.45.2.2
+++ services_admin_browse.inc	20 Oct 2009 04:37:47 -0000
@@ -14,24 +14,23 @@
 
   // Show enable server modules
   $servers = module_implements('server_info');
-  $output = '<h2>'. t('Servers') .'</h2>';
+  $output = '<h2>' . t('Servers') . '</h2>';
 
   if (!empty($servers)) {
     $output .= '<ul>';
     foreach ($servers as $module) {
       $info = module_invoke($module, 'server_info');
       $name = $info['#name'];
-      $path = 'services/'. $info['#path'];
-      $output .= '<li class="leaf">'. l($name .' - /'. $path, $path) .'</li>';
+      $path = 'services/' . $info['#path'];
+      $output .= '<li class="leaf">' . l($name . ' - /' . $path, $path) . '</li>';
     }
     $output .= '</ul>';
   }
   else {
-    $output .= '<p>'. t('You must enable at least one server module to be able to connect remotely. Visit the <a href="@url">modules</a> page to enable server modules.', array('@url' => url('admin/build/modules'))) .'</p>';
+    $output .= '<p>' . t('You must enable at least one server module to be able to connect remotely. Visit the <a href="@url">modules</a> page to enable server modules.', array('@url' => url('admin/build/modules'))) . '</p>';
   }
 
-
-  $output .= '<h2>'. t('Services') .'</h2>';
+  $output .= '<h2>' . t('Services') . '</h2>';
 
   // group namespaces
   $services = array();
@@ -42,10 +41,10 @@
 
   if (count($services)) {
     foreach ($services as $namespace => $methods) {
-      $output .= '<h3>'. $namespace .'</h3>';
+      $output .= '<h3>' . $namespace . '</h3>';
       $output .= '<ul>';
       foreach ($methods as $method) {
-        $output .= '<li class="leaf">'. l($method['#method'], 'admin/build/services/browse/'. $method['#method']) .'</li>';
+        $output .= '<li class="leaf">' . l($method['#method'], 'admin/build/services/browse/' . $method['#method']) . '</li>';
       }
       $output .= '</ul>';
     }
@@ -62,31 +61,32 @@
 
   $output = '';
 
-  $output .= '<h3>'. $method['#method'] .'</h3>';
-  $output .= '<p>'. $method['#help'] .'</p>';
+  $output .= '<h3>' . $method['#method'] . '</h3>';
+  $output .= '<p>' . $method['#help'] . '</p>';
 
   // List arguments.
-  $output .= '<h3>'. t('Arguments') .' ('. count($method['#args']) .')</h3>';
+  $output .= '<h3>' . t('Arguments') . ' (' . count($method['#args']) . ')</h3>';
   $output .= '<dl id="service-browser-arguments">';
   $count = 0;
   foreach ($method['#args'] as $arg) {
     $count++;
-    $output .= '<dt><em class="type">'. $arg['#type'] .'</em><strong class="name">'.
-      $arg['#name'] .'</strong> ('. (($arg['#optional']) ? t('optional') : t('required')) .')</dt>';
-    $output .= '<dd>'. $arg['#description'] .'</dd>';
+    $output .= '<dt><em class="type">' . $arg['#type'] . '</em><strong class="name">' .
+      $arg['#name'] . '</strong> (' . (($arg['#optional']) ? t('optional') : t('required')) . ')</dt>';
+    $output .= '<dd>' . $arg['#description'] . '</dd>';
   }
 
   $output .= '</dl>';
 
   // Allow testing of methods
-  $output .= '<h3>'. t('Call method') .'</h3>';
-  $output .= drupal_get_form('services_admin_browse_test');
+  $output .= '<h3>' . t('Call method') . '</h3>';
+  // @TODO this is a hack we should be trying to return a structure array if it is possible - this is just to fix existing behaviour
+  $output .= drupal_render(drupal_get_form('services_admin_browse_test'));
 
   // Display results
   if ($_services_admin_browse_test_submit_result) {
     $output .= '<div id="output">';
-    $output .= '<h3>'. t('Result') .'</h3>';
-    $output .= '<code>'. $_services_admin_browse_test_submit_result .'</code>';
+    $output .= '<h3>' . t('Result') . '</h3>';
+    $output .= '<code>' . $_services_admin_browse_test_submit_result . '</code>';
     $output .= '</div>';
   }
 
@@ -101,21 +101,21 @@
   $form['format'] = array('#tree' => TRUE);
 
   foreach ($method['#args'] as $key => $arg) {
-    $form['name'][$key]         = array(
+    $form['name'][$key] = array(
       '#value' => $arg['#name']
     );
-    $form['optional'][$key]     = array(
+    $form['optional'][$key] = array(
       '#value' => ($arg['#optional']) ? t('optional') : t('required')
     );
 
     if (isset($arg['#size']) && $arg['#size'] == 'big') {
       $form['arg'][$key] = array(
-        '#type'           => 'textarea'
+        '#type' => 'textarea'
       );
     }
     else {
       $form['arg'][$key] = array(
-        '#type'           => 'textfield'
+        '#type' => 'textfield'
       );
     }
 
@@ -145,8 +145,8 @@
   services_auth_invoke('alter_browse_form', $form, $method);
 
   $form['submit'] = array(
-    '#type'           => 'submit',
-    '#value'          => t('Call method')
+    '#type' => 'submit',
+    '#value' => t('Call method')
   );
 
   $form['#redirect'] = FALSE;
@@ -160,7 +160,7 @@
   // Allow the authorization module to handle submitted values.
   services_auth_invoke('alter_browse_form_submit', $method, $args);
   $result = services_method_call($method['#method'], $args, TRUE);
-  $_services_admin_browse_test_submit_result = '<pre>'. htmlspecialchars(print_r($result, TRUE)) .'</pre>';
+  $_services_admin_browse_test_submit_result = '<pre>' . htmlspecialchars(print_r($result, TRUE)) . '</pre>';
 }
 
 function services_admin_browse_test_unserialize_args($values, $formats) {
@@ -269,10 +269,10 @@
       '#options' => $auth_options,
       '#required' => FALSE,
       '#default_value' => variable_get('services_auth_module', ''),
-      '#ahah' => array(
+      '#ajax' => array(
+        'callback' => '_services_ahah_security_options',
         'path' => 'admin/services/ahah/security-options',
         'wrapper' => 'security-module-options',
-        'method' => 'replace',
       ),
     );
 
@@ -281,10 +281,6 @@
     $form['security']['options'] = array(
       '#prefix' => '<div id="security-module-options">',
       '#suffix' => '</div>',
-      'settings' => array(
-        '#value' => sprintf('<div class="description">%s</div>',
-          t('Select a authorization module to configure security')),
-      ),
     );
     // Get the configuration form for the authorization module
     $settings = services_auth_invoke('security_settings');
@@ -314,16 +310,17 @@
 
 function services_admin_settings_submit($form, $form_state) {
   // Update the services oauth module variable *if needed*.
+  
   $old_auth = variable_get('services_auth_module', '');
   $new_auth = $form_state['values']['auth_module'];
   if ($old_auth != $new_auth) {
     variable_set('services_auth_module', $new_auth);
     // Rebuild menu so that security-related menu items can be conditionally created.
     menu_rebuild();
-    drupal_set_message('Changed authentication method');
+    drupal_set_message(t('Changed authentication method'));
   }
   else {
-    drupal_set_message('Updated authentication settings');
+    drupal_set_message(t('Updated authentication settings'));
   }
 
   // Allow the authorization module to handle submitted values.
@@ -336,32 +333,12 @@
 /**
  * Callback for the security configuration form ahah.
  */
-function _services_ahah_security_options() {
-  $cached_form_state = array();
-  $cached_form = form_get_cache($_POST['form_build_id'], $cached_form_state);
-
+function _services_ahah_security_options($form, &$form_state) {
   if (!empty($_POST['auth_module'])) {
     $settings = services_auth_invoke_custom($_POST['auth_module'], 'security_settings');
   }
-
-  if (is_array($settings)) {
-    $cached_form['security']['options']['settings'] = $settings;
-  }
-  else {
-    unset($cached_form['security']['options']['settings']);
-  }
-
-  form_set_cache($_POST['form_build_id'], $cached_form, $cached_form_state);
-
-  $form_state = array('submitted' => FALSE);
-  $options = $cached_form['security']['options'];
-  unset($options['#prefix'], $options['#suffix']);
-  $options = form_builder('_services_ahah_security_options', $options, $form_state);
-  $output = drupal_render($options);
-
-  print drupal_to_js(array(
-    'status' => TRUE,
-    'data' => $output,
-  ));
-  exit;
-}
\ No newline at end of file
+  
+  $settings['security']['options']['#prefix'] = '<div id="security-module-options">';
+  $settings['security']['options']['#sufix'] = '</div>';
+  return drupal_render($settings);
+}
Index: auth/services_keyauth/services_keyauth.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/auth/services_keyauth/Attic/services_keyauth.admin.inc,v
retrieving revision 1.1.2.2.2.2
diff -u -r1.1.2.2.2.2 services_keyauth.admin.inc
--- auth/services_keyauth/services_keyauth.admin.inc	8 Aug 2009 02:55:05 -0000	1.1.2.2.2.2
+++ auth/services_keyauth/services_keyauth.admin.inc	20 Oct 2009 00:20:11 -0000
@@ -22,10 +22,10 @@
     $operations = array();
 
     // Set the edit column.
-    $operations[] = array('data' => l(t('edit'), 'admin/build/services/keys/'. $kid));
+    $operations[] = array('data' => l(t('edit'), 'admin/build/services/keys/' . $kid));
 
     // Set the delete column.
-    $operations[] = array('data' => l(t('delete'), 'admin/build/services/keys/'. $kid .'/delete'));
+    $operations[] = array('data' => l(t('delete'), 'admin/build/services/keys/' . $kid .'/delete'));
 
     foreach ($operations as $operation) {
       $row[] = $operation;
@@ -33,17 +33,16 @@
     $rows[] = $row;
   }
 
-  if (empty($rows)) {
+  if (!count($rows)) {
     $rows[] = array(array('data' => t('No API keys created.'), 'colspan' => '5', 'class' => 'message'));
   }
 
-  return theme('table', $header, $rows);
+  return theme('table', array('header' => $header, 'rows' => $rows));
 }
 
 function services_keyauth_admin_keys_form() {
   $kid = arg(4);
-
-  $key = db_fetch_object(db_query("SELECT * FROM {services_keys} WHERE kid = '%s'", $kid));
+  $key = db_query("SELECT * FROM {services_keys} WHERE kid = :key", array(':key' => $kid))->fetchObject();
 
   $key_kid = isset($key->kid) ? $key->kid : '';
   $key_title = isset($key->title) ? $key->title : '';
@@ -57,10 +56,10 @@
     $form['key'] = array(
       '#type'           => 'markup',
       '#title'          => t('Key'),
-      '#value'          => '<strong>'. t('API Key') .':</strong> '. $key_kid,
+      '#value'          => '<strong>'. t('API Key') . ':</strong> ' . $key_kid,
     );
-    $result = db_query("SELECT method FROM {services_key_permissions} WHERE kid = '%s'", $key->kid);
-    while ($kid = db_fetch_object($result)) {
+    $result = db_query("SELECT method FROM {services_key_permissions} WHERE kid = :key", array(':key' => $kid));
+    while ($kid = $result->fetchObject()) {
       $accessible_methods[] = $kid->method;
     }
   }
@@ -80,6 +79,9 @@
   );
   
   $methods = services_get_all();
+
+  $form_methods = array();
+
   foreach ($methods as $method) {
     $form_methods[$method['#method']] = $method['#method'];
   }
@@ -93,8 +95,8 @@
   );
 
   $form['submit'] = array(
-    '#type'           => 'submit',
-    '#value'          => $key_title != '' ? t('Save key') : t('Create key'),
+    '#type' => 'submit',
+    '#value' => $key_title != '' ? t('Save key') : t('Create key'),
   );
 
   return $form;
@@ -107,36 +109,57 @@
 }
 
 function services_keyauth_admin_keys_save(&$key) {
-  $is_existing = FALSE;
   $key['kid'] = !empty($key['kid']) ? $key['kid'] : md5(uniqid(mt_rand(), TRUE));
-  $is_existing =  db_result(db_query("SELECT count(*) FROM {services_keys}
-    WHERE kid = '%s'", $key['kid']));
 
+  $is_existing = (bool) db_query_range("SELECT 1 FROM {services_keys} WHERE kid = :kid", 0, 1, array(':kid' => $key['kid']))->fetchField();
   if ($is_existing) {
-    db_query("UPDATE {services_keys} SET title = '%s', domain = '%s'
-      WHERE kid = '%s'", $key['title'], $key['domain'], $key['kid']);
-    db_query("DELETE FROM {services_key_permissions} WHERE kid = '%s'", $key['kid']);
+    db_update('services_keys')
+      ->fields(array(
+        'title' => $key['title'],
+        'domain' => $key['domain'],
+      ))
+      ->condition('kid', $key['kid'], '=')
+      ->execute();
+    db_delete('services_key_permissions')
+      ->condition('kid', $key['kid'])
+      ->execute();
     $return = SAVED_UPDATED;
   }
   else {
-    db_query("INSERT INTO {services_keys} (kid, title, domain)
-      VALUES ('%s', '%s', '%s')", $key['kid'], $key['title'], $key['domain']);
+    db_insert('services_keys')
+        ->fields(array('kid', 'title', 'domain'))
+        ->values(array(
+          'kid' => $key['kid'],
+          'title' => $key['title'],
+          'domain' => $key['domain'],
+        ))
+        ->execute();
     $return = SAVED_NEW;
   }
   foreach ($key['method_access'] as $method => $value) {
     if ($value) {
-      db_query("INSERT INTO {services_key_permissions} (kid, method) VALUES ('%s', '%s')", $key['kid'], $value);
+      db_insert('services_key_permissions')
+        ->fields(array('kid', 'method'))
+        ->values(array(
+          'kid' => $key['kid'],
+          'method' => $value,
+        ))
+        ->execute();
     }
   }
   return $return; 
 }
 
 function services_keyauth_admin_keys_delete($kid) {
-  db_query("DELETE FROM {services_keys} WHERE kid = '%s'", $kid);
+  db_delete('services_keys')
+      ->condition('kid', $kid)
+      ->execute();
 }
 
-function services_keyauth_admin_keys_delete_confirm(&$form_state, $kid = 0) {
-  $key = db_fetch_object(db_query("SELECT * FROM {services_keys} WHERE kid = '%s'", $kid));
+function services_keyauth_admin_keys_delete_confirm() {
+  $kid = arg(4);
+  
+  $key = db_query("SELECT * FROM {services_keys} WHERE kid = :kid", array(':kid' => $kid))->fetchObject();
 
   $form['kid'] = array('#type' => 'value', '#value' => $key->kid);
 
@@ -151,7 +174,7 @@
 function services_keyauth_admin_keys_delete_confirm_submit($form, &$form_state) {
   services_keyauth_admin_keys_delete($form_state['values']['kid']);
 
-  $t_args = array('%key' => $form_state['kid']);
+  $t_args = array('%key' => $form_state['values']['kid']);
   drupal_set_message(t('The key %key has been deleted.', $t_args));
   watchdog('menu', 'Deleted key %key.', $t_args, WATCHDOG_NOTICE);
 
Index: auth/services_keyauth/services_keyauth.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/auth/services_keyauth/Attic/services_keyauth.inc,v
retrieving revision 1.1.2.8.2.4
diff -u -r1.1.2.8.2.4 services_keyauth.inc
--- auth/services_keyauth/services_keyauth.inc	15 Oct 2009 02:59:56 -0000	1.1.2.8.2.4
+++ auth/services_keyauth/services_keyauth.inc	20 Oct 2009 04:37:38 -0000
@@ -7,13 +7,13 @@
  */
 
 function _services_keyauth_security_settings() {
-  $form['services_use_key'] = array(
+  $form['security']['options']['services_use_key'] = array(
     '#type'           => 'checkbox',
     '#title'          => t('Use keys'),
     '#default_value'  => variable_get('services_use_key', TRUE),
     '#description'    => t('When enabled all method calls need to provide a validation token to autheciate themselves with the server.'),
   );
-  $form['services_key_expiry'] = array(
+  $form['security']['options']['services_key_expiry'] = array(
     '#type'           => 'textfield',
     '#prefix'         => "<div id='services-key-expiry'>",
     '#suffix'         => "</div>",
@@ -21,7 +21,7 @@
     '#default_value'  => variable_get('services_key_expiry', 30),
     '#description'    => t('The time frame for which the token will be valid. Default is 30 secs'),
   );
-  $form['services_use_sessid'] = array(
+  $form['security']['options']['services_use_sessid'] = array(
     '#type'           => 'checkbox',
     '#title'          => t('Use sessid'),
     '#default_value'  => variable_get('services_use_sessid', TRUE),
@@ -31,15 +31,17 @@
 }
 
 function _services_keyauth_security_settings_validate($form_state) {
-  if (!preg_match('/^\d+$/', $form_state['values']['services_key_expiry'])) {
+  if (isset($form_state['input']['services_key_expiry']) && !preg_match('/^\d+$/', $form_state['input']['services_key_expiry'])) {
     form_set_error('services_key_expiry', t('The token expiry time must specified in whole seconds as a number'));
   }
 }
 
 function _services_keyauth_security_settings_submit($form_state) {
   // Store all values from "our" form as variables.
-  foreach (_services_keyauth_security_settings() as $key => $field) {
-    variable_set($key, $form_state['values'][$key]);
+  $options = _services_keyauth_security_settings();
+  foreach ($options['security']['options'] as $key => $field) {
+    $value = isset($form_state['input'][$key]) ? $form_state['input'][$key] : 0;
+    variable_set($key, $value);
   }
 }
 
@@ -93,7 +95,7 @@
         $method['#key'] = TRUE;
         $method['#auth'] = TRUE;
     }
-    
+
     if ($method['#auth'] && variable_get('services_use_sessid', TRUE)) {
       array_unshift($method['#args'], $arg_sessid);
     }
@@ -116,8 +118,8 @@
           '#title'          => 'Hash',
           '#type'           => 'textfield',
           '#value'          => t('Gets generated after form submission'),
-          '#disabled'       => TRUE
-         );
+          '#disabled'       => TRUE,
+        );
         break;
       case 'sessid':
         $form['arg'][$key]['#default_value']  = session_id();
@@ -130,8 +132,8 @@
            '#title'          => 'Timestamp',
            '#type'           => 'textfield',
            '#value'          => t('Gets generated after form submission'),
-           '#disabled'       => TRUE
-         );
+           '#disabled'       => TRUE,
+        );
         break;
       case 'nonce':
         $form['arg'][$key]['#default_value'] = user_password();
@@ -149,30 +151,35 @@
 
     $expiry_time = $timestamp + variable_get('services_key_expiry', 30);
 
-    if ($expiry_time < time()) {
+    if ($expiry_time < REQUEST_TIME) {
       return services_error(t('Token has expired.'), 401);
     }
+    $has_rows = (bool) db_query_range("SELECT 1 FROM {services_timestamp_nonce} WHERE domain = :domain AND nonce = :nonce", 0, 1, array(':domain' => $domain, ':nonce' => $nonce))->fetchField();
 
     // Still in time but has it been used before
-    if (db_result(db_query("SELECT count(*) FROM {services_timestamp_nonce}
-        WHERE domain = '%s' AND nonce = '%s'",
-        $domain, $nonce))) {
+    if ($has_rows) {
       return services_error(t('Token has been used previously for a request. Re-try with another nonce key.', 401));
     }
     else{
-      db_query("INSERT INTO {services_timestamp_nonce} (domain, timestamp, nonce)
-        VALUES ('%s', %d, '%s')", $domain, $timestamp, $nonce);
+      db_insert('services_timestamp_nonce')
+        ->fields(array('domain', 'timestamp', 'nonce'))
+        ->values(array(
+          'domain' => $domain,
+          'timestamp' => $timestamp,
+          'nonce' => $nonce,
+        ))
+        ->execute();
     }
 
-    $api_key = db_result(db_query("SELECT kid FROM {services_keys} WHERE domain = '%s'", $domain));
+    $api_key = db_query("SELECT kid FROM {services_keys} WHERE domain = :key", array(':key' => $domain))->fetchField('kid');
 
     //if (!services_keyauth_validate_key($api_key, $timestamp, $domain, $nonce, $method_name, $hash_parameters, $hash)) {
     if ($hash != services_get_hash($timestamp, $domain, $nonce, $method, $args)) {
       return services_error(t('Invalid API key.'), 401);
     }
     
-    if (!db_result(db_query("SELECT COUNT(*) FROM {services_key_permissions} 
-        WHERE kid = '%s' AND method = '%s'", $api_key, $method_name))) {
+    $has_rows = (bool) db_query_range("SELECT 1 FROM {services_key_permissions} WHERE kid = :kid AND method = :method", 0, 1, array(':kid' => $api_key, ':method' => $method_name))->fetchField();
+    if (!$has_rows) {
       return services_error(t('Access denied.'), 401);
     }
   }
@@ -191,7 +198,7 @@
 function _services_keyauth_alter_browse_form_submit($method, &$args) {
   if ($method['#key'] && variable_get('services_use_key', TRUE)) {
     $args_stripped = $args;
-  
+
     for ($i = 1; $i <= 4; $i++) {
       array_shift($args_stripped);
     }
Index: auth/services_keyauth/services_keyauth.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/auth/services_keyauth/Attic/services_keyauth.info,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 services_keyauth.info
--- auth/services_keyauth/services_keyauth.info	18 May 2009 00:19:40 -0000	1.1.2.1
+++ auth/services_keyauth/services_keyauth.info	19 Oct 2009 23:07:20 -0000
@@ -1,6 +1,9 @@
 ; $Id: services_keyauth.info,v 1.1.2.1 2009/05/18 00:19:40 marcingy Exp $
 name = Key Authentication
 description = Provides key authentication for the services module
+files[] = services_keyauth.module
+files[] = services_keyauth.inc
+files[] = services_keyauth.admin.inc
 package = Services - authentication
 dependencies[] = services
-core = 6.x
\ No newline at end of file
+core = 7.x
\ No newline at end of file
Index: auth/services_keyauth/services_keyauth.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/auth/services_keyauth/Attic/services_keyauth.install,v
retrieving revision 1.1.2.4.2.2
diff -u -r1.1.2.4.2.2 services_keyauth.install
--- auth/services_keyauth/services_keyauth.install	20 Jun 2009 19:48:42 -0000	1.1.2.4.2.2
+++ auth/services_keyauth/services_keyauth.install	19 Oct 2009 23:36:16 -0000
@@ -6,7 +6,7 @@
  *   Install, uninstall and update the module.
  */
 /**
- * Implementation of hook_schema().
+ * Implements hook_schema().
  */
 function services_keyauth_schema() {
   $schema['services_keys'] = array(
@@ -67,17 +67,17 @@
     ),
   );
   $schema['services_key_permissions'] = array(
-    'description' => t('Stores services method\'s access rights on a per API key basis.'),
+    'description' => 'Stores services method\'s access rights on a per API key basis.',
     'fields' => array(
       'kid' => array(
-        'description' => t('The service key ID.'),
+        'description' => 'The service key ID.',
         'type'        => 'char',
         'length'      => 32,
         'not null'    => TRUE,
         'default'     => '',
       ),
       'method' => array(
-        'description' => t('Name of service method.'),
+        'description' => 'Name of service method.',
         'type'        => 'varchar',
         'length'      => 255,
         'not null'    => TRUE,
@@ -88,24 +88,24 @@
       'api_key'       => array('kid'),
       'method'        => array('method'),
     ),
-    'unique key' => array('key_method' => array('kid','method')),
+    'unique key' => array('key_method' => array('kid', 'method')),
   );
   return $schema;
 }
 
-function _services_key_auth_permissions (&$update) {
+function _services_key_auth_permissions() {
   $schema['services_key_permissions'] = array(
-    'description' => t('Stores services method\'s access rights on a per API key basis.'),
+    'description' => 'Stores services method\'s access rights on a per API key basis.',
     'fields' => array(
       'kid' => array(
-        'description' => t('The service key ID.'),
+        'description' => 'The service key ID.',
         'type'        => 'char',
         'length'      => 32,
         'not null'    => TRUE,
         'default'     => '',
       ),
       'method' => array(
-        'description' => t('Name of service method.'),
+        'description' => 'Name of service method.',
         'type'        => 'varchar',
         'length'      => 255,
         'not null'    => TRUE,
@@ -116,15 +116,13 @@
       'api_key'       => array('kid'),
       'method'        => array('method'),
     ),
-    'unique key' => array('key_method' => array('kid','method')),
+    'unique key' => array('key_method' => array('kid', 'method')),
   );
-  db_create_table($update, 'services_key_permissions', $schema['services_key_permissions']);
-
-  return $update;
+  db_create_table('services_key_permissions', $schema['services_key_permissions']);
 }
 
 /**
- * Implementation of hook_install().
+ * Implements hook_install().
  */
 function services_keyauth_install() {
   // Legacy tables exist so we just create the new table.
@@ -133,12 +131,12 @@
   }
   else{
     $update = array();
-    _services_key_auth_permissions($update);
+    _services_key_auth_permissions();
   }
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function services_keyauth_uninstall() {
   drupal_uninstall_schema('services_keyauth');
@@ -149,39 +147,31 @@
 
 function services_keyauth_update_6001() {
   $update = array();
-  _services_key_auth_permissions($update);
+  _services_key_auth_permissions();
   return $update;
 }
 
 function services_keyauth_update_6002() {
-  $update = array();
-  db_drop_primary_key($update, 'services_timestamp_nonce');
-  db_add_index($update, 'services_timestamp_nonce', 'nonce', array('nonce'));
-  return $update;
+  db_drop_primary_key('services_timestamp_nonce');
+  db_add_index('services_timestamp_nonce', 'nonce', array('nonce'));
 }
 
 function services_keyauth_update_6003() {
-  $update = array();
-  db_drop_index($update, 'services_timestamp_nonce', 'timestamp');
-  db_change_field($update, 'services_timestamp_nonce', 'timestamp', 'timestamp', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
-  db_add_index($update, 'services_timestamp_nonce', 'timestamp', array('timestamp'));
-  return $update;
+  db_drop_index('services_timestamp_nonce', 'timestamp');
+  db_change_field('services_timestamp_nonce', 'timestamp', 'timestamp', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
+  db_add_index('services_timestamp_nonce', 'timestamp', array('timestamp'));
 }
 
 /*
  * Update to ensure that new menu options are loaded.
  */
 function services_keyauth_update_6004() {
-  $update = array();
-  return $update;
 }
 
 function services_keyauth_update_6005() {
-  $update = array();
-  
+
   // A table might fail to exist in certain circumstances due to an issue with the install.
   if (!db_table_exists('services_key_permissions')) {
-    _services_key_auth_permissions($update);
+    _services_key_auth_permissions();
   }
-  return $update;
 }
\ No newline at end of file
Index: auth/services_keyauth/services_keyauth.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/auth/services_keyauth/Attic/services_keyauth.module,v
retrieving revision 1.1.2.6.2.2
diff -u -r1.1.2.6.2.2 services_keyauth.module
--- auth/services_keyauth/services_keyauth.module	28 Jun 2009 22:33:08 -0000	1.1.2.6.2.2
+++ auth/services_keyauth/services_keyauth.module	20 Oct 2009 02:58:13 -0000
@@ -6,27 +6,27 @@
  *  Provides a key based validation system.
  */
 /**
- * Implementation of hook_cron().
+ * Implements hook_cron().
  *
  * Clear down old values from the nonce table.
  */
 function services_keyauth_cron() {
-  $expiry_time = time() - variable_get('services_key_expiry', 30);
-  db_query("DELETE FROM {services_timestamp_nonce}
-    WHERE timestamp < '%s'", $expiry_time);
+  $expiry_time = REQUEST_TIME - variable_get('services_key_expiry', 30);
+  db_delete('services_timestamp_nonce')
+    ->condition('timestamp', $expiry_time)
+    ->execute();
 }
 
 /**
- * This function is called to determine whether the current user has 
+ * This function is called to determine whether the current user has
  * access to a keys configuration.
- * 
  */
 function services_keyauth_access() {
-  return user_access('administer services') && variable_get('services_use_key', TRUE);
+  return user_access('administer services') && variable_get('services_use_key', FALSE);
 }
 
 /**
- * Implementation of hook_authentication_info().
+ * Implements hook_authentication_info().
  *
  * @return array
  *  The configuration array for the authentication scheme
@@ -47,7 +47,7 @@
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function services_keyauth_menu() {
   $items = array();
@@ -71,7 +71,7 @@
   $items['admin/build/services/keys/%/delete'] = array(
     'access arguments'  => array('administer services'),
     'page callback'     => 'drupal_get_form',
-    'page arguments'    => array('services_keyauth_admin_keys_delete_confirm', 4),
+    'page arguments'    => array('services_keyauth_admin_keys_delete_confirm'),
     'file'              => 'services_keyauth.admin.inc',
     'type'              => MENU_CALLBACK,
   );
@@ -98,7 +98,7 @@
   foreach ($method['#args'] as $key => $arg) {
     if ($arg['#signed'] == TRUE) {
       if (is_numeric($args[$key]) || !empty($args[$key])) {
-        if (is_array($args[$key]) || is_object($args[$key])){
+        if (is_array($args[$key]) || is_object($args[$key])) {
           $hash_parameters[] = serialize($args[$key]);
         }
         else{
@@ -110,7 +110,8 @@
       }
     }
   }
-  $api_key = db_result(db_query("SELECT kid FROM {services_keys} WHERE domain = '%s'", $domain));
+
+  $api_key = db_query("SELECT kid FROM {services_keys} WHERE domain = :key", array(':key' => $domain))->fetchField('kid');
   return hash_hmac("sha256", implode(';', $hash_parameters), $api_key);
 }
 
@@ -128,17 +129,9 @@
   if (!$keys) {
     $keys = array();
     $result = db_query("SELECT * FROM {services_keys}");
-    while ($key = db_fetch_object($result)) {
+    while ($key = $result->fetchObject()) {
       $keys[$key->kid] = $key;
     }
   }
   return $keys;
-}
-
-function service_keyauth_disable() {
-  cache_clear_all('services:methods', 'cache');
-}
-
-function service_keyauth_enable() {
-  cache_clear_all('services:methods', 'cache');
 }
\ No newline at end of file
Index: servers/xmlrpc_server/xmlrpc_server.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/servers/xmlrpc_server/Attic/xmlrpc_server.info,v
retrieving revision 1.5.2.1
diff -u -r1.5.2.1 xmlrpc_server.info
--- servers/xmlrpc_server/xmlrpc_server.info	6 Sep 2008 04:13:07 -0000	1.5.2.1
+++ servers/xmlrpc_server/xmlrpc_server.info	19 Oct 2009 23:07:36 -0000
@@ -1,6 +1,8 @@
 ; $Id: xmlrpc_server.info,v 1.5.2.1 2008/09/06 04:13:07 marcingy Exp $
 name = XMLRPC Server
 description = Provides an XMLRPC server.
+files[] = xmlrpc_server.module
 package = Services - servers
 dependencies[] = services
-core = 6.x
\ No newline at end of file
+core = 7.x
+php = 5.x
\ No newline at end of file
Index: servers/xmlrpc_server/xmlrpc_server.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/servers/xmlrpc_server/Attic/xmlrpc_server.module,v
retrieving revision 1.6.2.14.2.2
diff -u -r1.6.2.14.2.2 xmlrpc_server.module
--- servers/xmlrpc_server/xmlrpc_server.module	13 Jun 2009 22:43:44 -0000	1.6.2.14.2.2
+++ servers/xmlrpc_server/xmlrpc_server.module	19 Oct 2009 23:07:33 -0000
@@ -7,7 +7,7 @@
  */
 
 /**
- * Implementation of hook_server_info().
+ * Implements hook_server_info().
  */
 function xmlrpc_server_server_info() {
   return array(
@@ -16,9 +16,12 @@
   );
 }
 
+/**
+ * Implements hook_server_server().
+ */
 function xmlrpc_server_server() {
-  require_once './includes/xmlrpc.inc';
-  require_once './includes/xmlrpcs.inc';
+  require_once DRUPAL_ROOT . '/' . 'includes/xmlrpc.inc';
+  require_once DRUPAL_ROOT . '/' . 'includes/xmlrpcs.inc';
   return xmlrpc_server(xmlrpc_server_xmlrpc());
 }
 
