/[drupal]/contributions/modules/seo_checklist/seochecklist.module
ViewVC logotype

Diff of /contributions/modules/seo_checklist/seochecklist.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.7, Thu Oct 22 23:58:31 2009 UTC revision 1.1.2.8, Fri Oct 23 00:00:27 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: seochecklist.module,v 1.1.2.6 2009/10/22 23:00:08 davereid Exp $  // $Id: seochecklist.module,v 1.1.2.7 2009/10/22 23:58:31 davereid Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 50  function seochecklist_admin_settings() { Line 50  function seochecklist_admin_settings() {
50      '#type' => 'submit',      '#type' => 'submit',
51      '#value' => t('Save'),      '#value' => t('Save'),
52    );    );
   $form['check_existing'] = array(  
     '#type' => 'submit',  
     '#value' => t('Check for already installed modules'),  
   );  
53    
54    // Fetch modules and groups from database.    // Fetch modules and groups from database.
55    $query = "SELECT id, name, description FROM {seo_group} ORDER BY id";    $query = "SELECT id, name, description FROM {seo_group} ORDER BY id";
# Line 144  function seochecklist_admin_settings() { Line 140  function seochecklist_admin_settings() {
140  function seochecklist_admin_settings_submit($form_id, $form_values) {  function seochecklist_admin_settings_submit($form_id, $form_values) {
141    global $user;    global $user;
142    
143    // Saving checked modules.    foreach ($form_values as $key => $value) {
144    if ($form_values['op'] == t('Save')) {      if (preg_match('/seochecklist_nodetypes/', $key)) {
145      foreach ($form_values as $key => $value) {        $key = explode('_', $key);
146        if (preg_match('/seochecklist_nodetypes/', $key)) {        $key = $key[2];
147          $key = explode('_', $key);        $current = (bool) db_result(db_query("SELECT completed FROM {seo_checklist} WHERE id = %d", $key));
148          $key = $key[2];        if ($current != $value) {
149          $current = (bool) db_result(db_query("SELECT completed FROM {seo_checklist} WHERE id = %d", $key));          // If the checkbox changed states, update the record.
150          if ($current != $value) {          db_query("UPDATE {seo_checklist} SET completed = %d, uid = %d WHERE id = %d", ($value ? time() : 0), $user->uid, $key);
           // If the checkbox changed states, update the record.  
           db_query("UPDATE {seo_checklist} SET completed = %d, uid = %d WHERE id = %d", ($value ? time() : 0), $user->uid, $key);  
         }  
151        }        }
152      }      }
   
     // Special values not in database.  
     variable_set('seo_checklist_link', $form_values['seo_checklist_link']);  
     variable_set('seo_checklist_thanks', $form_values['seo_checklist_thanks']);  
     variable_set('seo_checklist_podcast', $form_values['seo_checklist_podcast']);  
153    }    }
154    
155    // Check for already installed modules.    // Special values not in database.
156    if ($form_values['op'] == t('Check for already installed modules')) {    variable_set('seo_checklist_link', $form_values['seo_checklist_link']);
157      $query = db_query("SELECT id, module FROM {seo_checklist} WHERE module <> '' AND completed = 0");    variable_set('seo_checklist_thanks', $form_values['seo_checklist_thanks']);
158      while ($task = db_fetch_object($query)) {    variable_set('seo_checklist_podcast', $form_values['seo_checklist_podcast']);
       if (module_exists($task->module)) {  
         db_query("UPDATE {seo_checklist} SET completed = %d WHERE id = %d", time(), $task->id);  
       }  
     }  
   }  
159  }  }
160    
161  /**  /**

Legend:
Removed from v.1.1.2.7  
changed lines
  Added in v.1.1.2.8

  ViewVC Help
Powered by ViewVC 1.1.2