Exemple #1
0
 function sendToGroup($email, $group, $force2Send = false)
 {
     $db = oseDB::instance();
     $version = oseHTML::getJoomlaVersion();
     if (is_array($group)) {
         $group = implode(',', $group);
     }
     $where = array();
     if (!$force2Send) {
         $where[] = "`sendEmail` =1";
     }
     if ($version == '1.5') {
         $where[] = "`gid` IN ( {$group} )";
         $where = oseDB::implodeWhere($where);
         $query = " SELECT * FROM `#__users` AS u " . $where;
     } else {
         $where[] = "g.group_id IN ( {$group} )";
         $where = oseDB::implodeWhere($where);
         $query = " SELECT u.* FROM `#__users` AS u " . " INNER JOIN `#__user_usergroup_map` AS g ON g.user_id = u.id" . $where;
     }
     $db->setQuery($query);
     $objs = oseDB::loadList('obj');
     foreach ($objs as $obj) {
         self::sendEmail($email, $obj->email);
     }
     return true;
 }
Exemple #2
0
 public static function getAdminGroup($app)
 {
     $config = self::load($app, '', 'obj');
     if (oseGetValue($config, 'admin_group', false) != false) {
         $mode = oseJson::decode($item->value);
     } else {
         $version = oseHTML::getJoomlaVersion();
         if ($version >= '1.6') {
             $db = JFactory::getDBO();
             $db->setQuery("SELECT id FROM #__usergroups");
             $groups = $db->loadObjectList();
             $admin_groups = array();
             foreach ($groups as $group) {
                 if (JAccess::checkGroup($group->id, 'core.login.admin')) {
                     $admin_groups[] = $group->id;
                 } elseif (JAccess::checkGroup($group->id, 'core.admin')) {
                     $admin_groups[] = $group->id;
                 }
             }
             $admin_groups = array_unique($admin_groups);
             return $admin_groups;
         } else {
             $mode = '[24,25]';
             $mode = oseJson::decode($mode);
         }
     }
     return $mode;
 }