/[drupal]/contributions/modules/swekey/swekey.module
ViewVC logotype

Diff of /contributions/modules/swekey/swekey.module

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

revision 1.11 by swekey, Wed Feb 11 17:29:31 2009 UTC revision 1.12 by swekey, Mon Feb 16 12:44:39 2009 UTC
# Line 117  function swekey_config() { Line 117  function swekey_config() {
117      '#description' => t("A brand is a 8 chars hexadecimal upper case value. Brands are comma separated.<br>If you don't known what to put here, keep these field empty."),      '#description' => t("A brand is a 8 chars hexadecimal upper case value. Brands are comma separated.<br>If you don't known what to put here, keep these field empty."),
118    );    );
119    
120      $form['swekey_promo'] = array(
121        '#type' => 'textfield',
122        '#title' => t('Swekey Logo Link'),
123        '#default_value' => variable_get('swekey_promo', ''),
124        '#size' => 80,
125        '#description' => t("This is the web page linked to the swekey logo next to the user name field of the login form.<br>If you don't known what to put here, keep these field empty."),
126      );
127    
128    return system_settings_form($form);    return system_settings_form($form);
129  }  }
130    
# Line 203  function swekey_user($type, &$edit, &$io Line 211  function swekey_user($type, &$edit, &$io
211    
212    
213  /**  /**
214   * Implementation of hook_form_alter : adds OpenID login to the login forms.   * Returns the script used fo the login page.
215   */   */
216  function swekey_form_alter(&$form, $form_state, $form_id) {  function Swekey_GetLoginIntegrationScript() {
   global $_swekey_login_footer;  
   if ($form_id == 'user_login_block' || $form_id == 'user_login') {  
217      $params = array();      $params = array();
218      $params['promo'] = 'drupal';  
219          $params['brands'] = variable_get('swekey_brands', '');      $promo = variable_get('swekey_promo', '');
220        if (empty($promo))
221                $params['promo'] = 'drupal';
222        else if (strpos($promo, ":") === FALSE)
223                    $params['promo'] = $promo;
224            else
225                    $params['swekey_promo_url'] = $promo;
226    
227        $params['brands'] = variable_get('swekey_brands', '');
228      $params['swekey_url'] = base_path().drupal_get_path('module', 'swekey').'/';      $params['swekey_url'] = base_path().drupal_get_path('module', 'swekey').'/';
229      $params['authframe_url'] = $params['swekey_url'] .'authframe.php?use_file=1';      $params['authframe_url'] = $params['swekey_url'] .'authframe.php?use_file=1';
230          $params['authframe_url'] .='&check_server='.urlencode(variable_get('swekey_check_Server', ''));          $params['authframe_url'] .='&check_server='.urlencode(variable_get('swekey_check_Server', ''));
# Line 228  function swekey_form_alter(&$form, $form Line 242  function swekey_form_alter(&$form, $form
242    
243          $sweekeypath = drupal_get_path('module', 'swekey');          $sweekeypath = drupal_get_path('module', 'swekey');
244          require_once($sweekeypath.'/swekey_integrate.inc.php');          require_once($sweekeypath.'/swekey_integrate.inc.php');
245      $_swekey_login_footer = Swekey_GetIntegrationScript($params);      return Swekey_GetIntegrationScript($params);
246    }  }
247    
248    
249    /**
250     * Implementation of hook_form_alter : generate the login script if login form was detected.
251     */
252    function swekey_form_alter(&$form, $form_state, $form_id) {
253      global $_swekey_login_footer;
254      if ($form_id == 'user_login_block' || $form_id == 'user_login')
255        $_swekey_login_footer = Swekey_GetLoginIntegrationScript();
256    else    else
257      $_swekey_login_footer = '';      $_swekey_login_footer = '';
258  }  }
259    
260    
261  /**  /**
262   * Implementation of hook_footer.   * Implementation of hook_footer.
263   */   */
# Line 243  function swekey_footer($main = 0) { Line 267  function swekey_footer($main = 0) {
267      global $user;      global $user;
268      if ($user->uid > 0) { // we are logged      if ($user->uid > 0) { // we are logged
269          $params = array();          $params = array();
         $params['promo'] = 'drupal';  
270          $params['brands'] = variable_get('swekey_brands', '');          $params['brands'] = variable_get('swekey_brands', '');
271          $params['swekey_url'] = base_path().drupal_get_path('module', 'swekey') .'/';          $params['swekey_url'] = base_path().drupal_get_path('module', 'swekey') .'/';
272          $params['logout_url'] = '?q=logout';          $params['logout_url'] = '?q=logout';
# Line 261  function swekey_footer($main = 0) { Line 284  function swekey_footer($main = 0) {
284                  require_once($sweekeypath.'/swekey_integrate.inc.php');                  require_once($sweekeypath.'/swekey_integrate.inc.php');
285          return Swekey_GetIntegrationScript($params);          return Swekey_GetIntegrationScript($params);
286      }      }
287        else {
288                    return Swekey_GetLoginIntegrationScript();
289        }
290    }    }
291    else {    else {
292      $res = $_swekey_login_footer;      $res = $_swekey_login_footer;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.3