Index: og_user_roles.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_user_roles/og_user_roles.module,v
retrieving revision 1.5
diff -u -p -r1.5 og_user_roles.module
--- og_user_roles.module	23 May 2009 04:27:50 -0000	1.5
+++ og_user_roles.module	23 May 2009 04:36:26 -0000
@@ -75,7 +75,7 @@ function og_user_roles_admin_settings() 
 
   // If no assignable roles, advise user to add some.
   // Modification as per: http://drupal.org/node/167373
-  if (!count($roles)) {
+  if (empty($roles)) {
     $form['og_user_roles'] = array(
       '#value' => '<p>' . t('No assignable roles were found. Please create at least one role under !roles.', array('!roles' => l(t('Administer >> User management >> Roles'), 'admin/user/roles'))) . '</p>',
     );
@@ -530,7 +530,7 @@ function og_user_roles_multinode() {
  * Multinode access UI.
  */
 function theme_og_user_roles_multinode($form) {
-  $output .= '<div id="og-roles-multinode-form">';
+  $output = '<div id="og-roles-multinode-form">';
   $output .= '<div id="desc">' . t('Here you can configure multinode access.  You can only modify values here if TAC/OG Integration is ON. If you turn TAC/OG Integration ON, then later wish to turn it off, you must first UNCHECK all items here (otherwise, multinode access will continue).') . '</div>';
 
   $header = array(t(''), t('Realm'), t('Group'), t('Logic'), t('Weight'), t('Check'));
@@ -1958,7 +1958,7 @@ function og_user_roles_user($op, &$edit,
   }
 
   // Add the group roles to user's account display
-  if ($op == 'view') {
+  if ($op == 'view' && module_exists('views')) {
     $uid   = $user->uid;
     $view  = views_get_view('OGURRoles');
     $args  = array($uid);
@@ -2392,10 +2392,10 @@ function og_user_roles_all_roles($user) 
   $ogroles        = array();
   $x1             = 0;
   // Need to use the referrer to get OG group in some cases;
-  $ref       = $_SERVER['HTTP_REFERER'];
+  $ref       = referer_uri();
   $ref_url   = parse_url($ref);
   $ref_path  = $ref_url['path'];
-  $ref_query = $ref_url['query'];
+  $ref_query = (isset($ref_url['query']) ? $ref_url['query'] : '');
   $ref_arg   = explode('/', $ref_path);
 
   //
@@ -2406,7 +2406,7 @@ function og_user_roles_all_roles($user) 
   drupal_load('module', 'og');
 
   $group_node = og_get_group_context();
-  $gid02      = $group_node->nid;
+  $gid02      = (isset($group_node->nid) ? $group_node->nid : NULL);
   $gid        = $gid02;
   if ($gid02 === NULL) {
     $gid = 0;
@@ -3630,7 +3630,7 @@ function og_user_roles_form_alter(&$form
   // the user has the 'auto assign group roles' permission, and we allow group admins
   // to set default group roles, then print the 'basicgrouprole' form on the
   // group edit form.
-  if (arg(0) == 'node' && ($_SESSION['og_last'] == arg(1)) && arg(2) == 'edit' && user_access('auto assign group roles') && variable_get('og_user_roles_assign_basicgrouprole_gid', 0) == 1) {
+  if (arg(0) == 'node' && (isset($_SESSION['og_last']) && $_SESSION['og_last'] == arg(1)) && arg(2) == 'edit' && user_access('auto assign group roles') && variable_get('og_user_roles_assign_basicgrouprole_gid', 0) == 1) {
     $gid = arg(1);
 
     // First, we need to get a list of all og-enabled node types
@@ -3673,7 +3673,7 @@ function og_user_roles_form_alter(&$form
   }
 
   // If this is a group node edit (use og_last to determine if this is a group node)
-  if (arg(0) == 'node' && ($_SESSION['og_last'] == arg(1)) && arg(2) == 'edit') {
+  if (arg(0) == 'node' && (isset($_SESSION['og_last']) && $_SESSION['og_last'] == arg(1)) && arg(2) == 'edit') {
     $gid = arg(1);
 
     // First, we need to get a list of all og-enabled node types
@@ -3921,7 +3921,7 @@ function og_user_roles_determine_context
   // a node object containing the 'active' group for this request
   $group_node = NULL;
 
-  $type = $_GET['type'];
+  $type = (isset($_GET['type']) ? $_GET['type'] : NULL);
 
   if (arg(0) == 'og' && is_numeric(arg(2))) {
     $group_node = og_set_theme(arg(2));
