? cleanup.patch
Index: linode.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linode/linode.admin.inc,v
retrieving revision 1.1
diff -u -p -r1.1 linode.admin.inc
--- linode.admin.inc	5 Sep 2009 04:00:24 -0000	1.1
+++ linode.admin.inc	9 Sep 2009 13:40:07 -0000
@@ -1,22 +1,24 @@
 <?php
 
-
+/**
+ * Menu callback, display an overview of tasks for this module.
+ */
 function linode_manager_overview() {
   $content = menu_get_item('admin/linode');
   $content = system_admin_menu_block($content);
   $output = theme('admin_block_content', $content);
   return $output;
-
 }
+
 /**
  * list, create, delete accounts
- **/
-function manage_linode_accounts($callback_arg = '') {
+ */
+function linode_manage_linode_accounts($callback_arg = '') {
   $op = isset($_POST['op']) ? $_POST['op'] : $callback_arg;
   switch($op) {
     case t('Register new linode manager') :
     case 'create':
-      $output = drupal_get_form('new_linode_manager_form');
+      $output = drupal_get_form('linode_new_linode_manager_form');
       break;
     default:
       // delete handler need to be placed here. user.admin.inc line 18
@@ -25,11 +27,11 @@ function manage_linode_accounts($callbac
   return $output;
 }
 
-function linodes_manager_overview($callback_arg = '') {
+function linode_manager_overview($callback_arg = '') {
   $op = $callback_arg;
   switch($op) {
     case 'linodes' :
-      $output = linodes_accounts_overview();
+      $output = linode_accounts_overview();
       break;
     case 'dns':
       $output = '';
@@ -39,8 +41,9 @@ function linodes_manager_overview($callb
   }
   return $output;
 }
+
 function linode_api_fetch_keys() {
-  $query = "SELECT id, name, api_key FROM linode_accounts ";
+  $query = "SELECT id, name, api_key FROM {linode_accounts}";
   $result = db_query($query);
   $keys = array();
   while($row = db_fetch_object($result) ) {
@@ -48,14 +51,16 @@ function linode_api_fetch_keys() {
   }
   return $keys;
 }
+
 function linode_api_linode_list($api_key) {
   $request['api_key'] = $api_key;
   $request['api_responseFormat'] = 'json';
   $request['api_action'] = 'linode.list';
-  $responce = linode_send_request($request, TRUE);
-  return $responce;
+  $response = linode_send_request($request, TRUE);
+  return $response;
 }
-function linodes_accounts_overview() {
+
+function linode_accounts_overview() {
   $output = '';
   $header = array(
     'Linode',
@@ -68,15 +73,16 @@ function linodes_accounts_overview() {
   $rows = array();
   foreach($keys as $api_key => $name) {
     $linodes = linode_api_linode_list($api_key);
-    $rows[] = array(array('data' => $name, 'colspan' => '5')); // Insert account name as a separator
+    // Insert account name as a separator.
+    $rows[] = array(array('data' => $name, 'colspan' => '5'));
     foreach($linodes->DATA as $linode) {
       //drupal_set_message('<pre>'. print_r($linodes, 1) . '</pre>');
       $row = array();
       $row[] = l($linode->LABEL, 'https://www.linode.com/members/linode/su.cfm?LinodeID='. $linode->LINODEID);
-      $row[] = $linode->STATUS? 'Running': 'Down';
-      $row[] = 'Linode '. $linode->TOTALRAM;
+      $row[] = $linode->STATUS ? 'Running': 'Down';
+      $row[] = 'Linode ' . $linode->TOTALRAM;
       $row[] = $linode->TOTALHD/1024 . 'GB';
-      $row[] = $linode->TOTALXFER.'GB';
+      $row[] = $linode->TOTALXFER . 'GB';
       $rows[] = $row;
     }
   }
@@ -88,8 +94,8 @@ function linodes_accounts_overview() {
 
 /**
  * @todo: Add "weight" so managers may give sorting to accounts
- **/
-function new_linode_manager_form($form_state) {
+ */
+function linode_new_linode_manager_form($form_state) {
   //drupal_set_message('<pre>'. print_r(func_get_args(), 1) . '</pre>');
 
   $form = array();
@@ -111,20 +117,24 @@ function new_linode_manager_form($form_s
   );
   return $form;
 }
-function new_linode_manager_form_validate($form, &$form_state) {
+
+function linode_new_linode_manager_form_validate($form, &$form_state) {
   $values = $form_state['values'];
+
+  // This is a dummy test to verify that API works.
   $request['api_key'] = $values['api_key'];
   $request['api_responseFormat'] = 'json';
-  $request['api_action'] = 'test.echo'; // This is a dummy test
-  $request['test'] = 'success';         // we simply request output of a string to verify that API works
+  $request['api_action'] = 'test.echo'; 
+  $request['test'] = 'success';
 
-  $responce = linode_send_request($request);
-  foreach($responce->ERRORARRAY as $index => $error ) { // If we have errors, lets print them all
+  $response = linode_send_request($request);
+  // If we have errors, lets print them all.
+  foreach($response->ERRORARRAY as $index => $error ) {
     form_set_error('api_key', $error->ERRORMESSAGE);
   }
 }
 
-function new_linode_manager_form_submit($form, &$form_state) {
+function linode_new_linode_manager_form_submit($form, &$form_state) {
   $account = array(
     'name' => $form_state['values']['name'],
     'api_key' => $form_state['values']['api_key'],
@@ -135,6 +145,7 @@ function new_linode_manager_form_submit(
   drupal_write_record('linode_accounts', $account);
   $form_state['redirect'] = 'admin/linode/api-keys';
 }
+
 function linode_send_request($request = array(), $debug = FALSE){
   $curl_handler = curl_init();
 
@@ -145,24 +156,26 @@ function linode_send_request($request = 
   curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false);
   curl_setopt($curl_handler, CURLOPT_USERAGENT, 'PHP Linode/0.1');
 
-  $responce = curl_exec($curl_handler);
-  $responce = json_decode($responce);
-  if ( $debug ) {
-    linode_send_request_debug($responce);
+  $response = curl_exec($curl_handler);
+  $response = json_decode($response);
+  if ($debug) {
+    linode_send_request_debug($response);
   }
-  return $responce;
+  return $response;
 }
-function linode_send_request_debug($responce) {
-  foreach($responce->ERRORARRAY as $error ) {
+
+function linode_send_request_debug($response) {
+  foreach ($response->ERRORARRAY as $error) {
     drupal_set_message($error->ERRORMESSAGE, 'error');
   }
 }
+
 /**
  * Lists all existing linode manager accounts
  */
 function linode_manager_accounts() {
   $form = array();
-  $query = "SELECT id, name, api_key FROM linode_accounts";
+  $query = "SELECT id, name, api_key FROM {linode_accounts}";
   $result = db_query($query);
   $accounts = array();
   while($row = db_fetch_array($result)) {
Index: linode.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linode/linode.module,v
retrieving revision 1.1
diff -u -p -r1.1 linode.module
--- linode.module	5 Sep 2009 04:00:24 -0000	1.1
+++ linode.module	9 Sep 2009 13:40:07 -0000
@@ -1,11 +1,17 @@
 <?php
 
+/**
+ * Implementation of hook_perm().
+ */
 function linode_perm() {
   return array(
     'administer linode manager',
-
   );
 }
+
+/**
+ * Implementation of hook_menu().
+ */
 function linode_menu() {
   $items = array();
   $items['admin/linode'] = array(
@@ -18,7 +24,7 @@ function linode_menu() {
   $items['admin/linode/api-keys'] = array(
     'title' => 'Linode accounts',
     'description' => 'Create new and/or manage existing linode accounts and corresponding API keys',
-    'page callback' => 'manage_linode_accounts',
+    'page callback' => 'linode_manage_linode_accounts',
     'page arguments' => array('list'),
     'access arguments' => array('administer linode manager'),
     'file' => 'linode.admin.inc',
@@ -40,7 +46,7 @@ function linode_menu() {
   $items['admin/linode/manage-linodes'] = array(
     'title' => 'Manage Linodes',
     'description' => 'Overview and manage existing linodes',
-    'page callback' => 'linodes_manager_overview',
+    'page callback' => 'linode_manager_overview',
     'page arguments' => array('linodes'),
     'access arguments' => array('administer linode manager'),
     'file' => 'linode.admin.inc',
