[geeklog-cvs] Geeklog-1.x/public_html/admin mail.php,1.32,1.33

Blaine Lang blaine at qs1489.pair.com
Sat Jun 9 16:43:43 EDT 2007


Update of /cvsroot/geeklog/Geeklog-1.x/public_html/admin
In directory qs1489.pair.com:/tmp/cvs-serv25248/public_html/admin

Modified Files:
	mail.php 
Log Message:
Mail to a group will now check for sub-groups so all users including those in sub-groups will be sent the email.
Added function USER_getChildGroups to system/lib-user.php

Index: mail.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/admin/mail.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** mail.php	26 Feb 2006 18:12:10 -0000	1.32
--- mail.php	9 Jun 2007 20:43:41 -0000	1.33
***************
*** 122,125 ****
--- 122,127 ----
  {
      global $_CONF, $_TABLES, $LANG31;
+     
+     require_once($_CONF['path_system'] . 'lib-user.php');
  
      $retval = '';
***************
*** 149,163 ****
          $html = false;
      }
  
      // and now mail it
      if (isset ($vars['overstyr'])) {
!         $sql = "SELECT username,fullname,email FROM {$_TABLES['users']},{$_TABLES['group_assignments']} WHERE uid > 1";
          $sql .= " AND {$_TABLES['users']}.status = 3 AND ((email is not null) and (email != ''))";
!         $sql .= " AND {$_TABLES['users']}.uid = ug_uid AND ug_main_grp_id = {$vars['to_group']}";
      } else {
!         $sql = "SELECT username,fullname,email,emailfromadmin FROM {$_TABLES['users']},{$_TABLES['userprefs']},{$_TABLES['group_assignments']} WHERE {$_TABLES['users']}.uid > 1";
          $sql .= " AND {$_TABLES['users']}.status = 3 AND ((email is not null) and (email != ''))";
          $sql .= " AND {$_TABLES['users']}.uid = {$_TABLES['userprefs']}.uid AND emailfromadmin = 1";
!         $sql .= " AND ug_uid = {$_TABLES['users']}.uid AND ug_main_grp_id = {$vars['to_group']}";
      }
  
--- 151,167 ----
          $html = false;
      }
+     
+     $groupList = implode (',', USER_getChildGroups($vars['to_group']));
  
      // and now mail it
      if (isset ($vars['overstyr'])) {
!         $sql = "SELECT DISTINCT username,fullname,email FROM {$_TABLES['users']},{$_TABLES['group_assignments']} WHERE uid > 1";
          $sql .= " AND {$_TABLES['users']}.status = 3 AND ((email is not null) and (email != ''))";
!         $sql .= " AND {$_TABLES['users']}.uid = ug_uid AND ug_main_grp_id in  IN ({$groupList})";
      } else {
!         $sql = "SELECT DISTINCT username,fullname,email,emailfromadmin FROM {$_TABLES['users']},{$_TABLES['userprefs']},{$_TABLES['group_assignments']} WHERE {$_TABLES['users']}.uid > 1";
          $sql .= " AND {$_TABLES['users']}.status = 3 AND ((email is not null) and (email != ''))";
          $sql .= " AND {$_TABLES['users']}.uid = {$_TABLES['userprefs']}.uid AND emailfromadmin = 1";
!         $sql .= " AND ug_uid = {$_TABLES['users']}.uid AND ug_main_grp_id  IN ({$groupList})";
      }
  




More information about the geeklog-cvs mailing list