getGroups(); function synchronize(){ global $xoopsDB, $groups,$member_handler; $group_exist2=array(); foreach ($groups as $gr){ $group_exist2[$gr->getVar('groupid')] = FALSE; } $result = $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("xcgal_usergroups")." WHERE 1 ORDER BY group_id"); while($myrow = $xoopsDB->fetchArray($result)) { $group_exist1 = FALSE; //var_dump($myrow['xgroupid']); foreach ($groups as $group){ if ($myrow['xgroupid'] == $group->getVar('groupid')){ if ($myrow['group_name']!= $group->getVar('name')){ $xoopsDB->query("UPDATE ".$xoopsDB->prefix("xcgal_usergroups")." SET group_name = '".$group->getVar('name')."' WHERE xgroupid = '".(int)$myrow['xgroupid']."'"); } $group_exist1 = TRUE; $group_exist2[$group->getVar('groupid')] = TRUE; } } if (!$group_exist1){ $xoopsDB->query("DELETE FROM ".$xoopsDB->prefix("xcgal_usergroups")." WHERE xgroupid = '".(int)$myrow['xgroupid']."'"); } } // for ($i = 0; $i < count($group_exist2); $i++) { foreach($group_exist2 as $key=>$value){ if (!$value){ $group = &$member_handler->getGroup($key); $result=$xoopsDB->query("INSERT INTO ".$xoopsDB->prefix("xcgal_usergroups")." VALUES (".$key.", '".$group->getVar('name')."', 1024, 0, 1, 1, 1, 1,1,1, 1, ".$key.")"); } } } function display_group_list() { global $xoopsDB, $tdstyle,$buffer,$groups; $count = count($groups); $result = $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("xcgal_usergroups")." WHERE 1 ORDER BY group_id"); if (!$xoopsDB->getRowsNum($result)) { //print_r($groups); for ($i = 0; $i < $count; $i++) { $id = $groups[$i]->getVar('groupid'); if (XOOPS_GROUP_ADMIN == $id ){ $result=$xoopsDB->queryF("INSERT INTO ".$xoopsDB->prefix("xcgal_usergroups")." VALUES (1, '".$groups[$i]->getVar('name')."', 0, 1, 1, 1, 1, 1, 1, 0, 0,1)"); } elseif (XOOPS_GROUP_USERS == $id){ $result=$xoopsDB->queryF("INSERT INTO ".$xoopsDB->prefix("xcgal_usergroups")." VALUES (2, '".$groups[$i]->getVar('name')."', 1024, 0, 1, 1, 1, 1, 1,1,0, 2)"); } elseif (XOOPS_GROUP_ANONYMOUS == $id) { $result=$xoopsDB->queryF("INSERT INTO ".$xoopsDB->prefix("xcgal_usergroups")." VALUES (3, '".$groups[$i]->getVar('name')."', 0, 0, 0, 0, 1, 0, 0 ,1,1,3)"); } else { $result=$xoopsDB->queryF("INSERT INTO ".$xoopsDB->prefix("xcgal_usergroups")." VALUES (".$id.", '".$groups[$i]->getVar('name')."', 1024, 0, 1, 1, 1, 1,1,1, 1, ".$id.")"); } } redirect_header('groupmgr.php',2,_AM_GRPMGR_EMPTY); exit; } $field_list = array('can_rate_pictures', 'can_send_ecards', 'can_post_comments', 'can_upload_pictures', 'pub_upl_need_approval', 'can_create_albums', 'priv_upl_need_approval'); $tdstyle ="even"; echo $buffer; while($group=$xoopsDB->fetchArray($result)){ $group['group_name'] = $group['group_name']; if ($tdstyle== "even") $tdstyle = "odd"; else $tdstyle = "even"; echo <<< EOT
"._AM_GRPMGR_MANAGE." | ||||||||
---|---|---|---|---|---|---|---|---|
"._AM_GRPMGR_NAME." | "._AM_GRPMGR_QUOTA." | "._AM_GRPMGR_RATE." | "._AM_GRPMGR_SENDCARD." | "._AM_GRPMGR_COM." | "._AM_GRPMGR_UPLOAD." | "._AM_GRPMGR_PUB_APPR." | "._AM_GRPMGR_PRIVATE." | "._AM_GRPMGR_PRIV_APPR." |