function buildacls_fromgroup($gpid, $ACLS) { $q = new mysql(); $sql = "SELECT * FROM meta_webfilters_acls WHERE metagroup={$gpid} AND enabled=1 ORDER BY xORDER"; $results = $q->QUERY_SQL($sql, "metaclient"); $mysql_num_rows = mysql_num_rows($results); if ($mysql_num_rows == 0) { echo "Group ID:{$gpid} -> no acls...\n"; return; } $IpClass = new IP(); $aclsGroups = new squid_acls_groups(); $aclsGroups->AsMeta = true; $unix = new unix(); while ($ligne = mysql_fetch_assoc($results)) { $aclname = $ligne["aclname"]; $httpaccess = $ligne["httpaccess"]; $httpaccess_data = $ligne["httpaccess_data"]; $reverse = false; $ID = $ligne["ID"]; $valueToAdd = null; if ($httpaccess == "deny_access_except") { $reverse = true; } echo "aclname[{$ID}]: {$aclname}/{$httpaccess}\n"; if (isset($GLOBALS["ACLRULEXEC"][$ID])) { echo "aclname[{$ID}]: Already executed, skip\n"; continue; } $Groups = $aclsGroups->buildacls_bytype_items($ID, $reverse); if (count($Groups) == 0) { echo "aclname[{$ID}]: no group, skip...\n"; continue; } $GLOBALS["ACLRULEXEC"][$ID] = true; $firstToken = getFirstToken($httpaccess, $httpaccess_data, $ID); $ACLS[] = "{$firstToken} {$valueToAdd}" . @implode(" ", $Groups); } return $ACLS; }
$lastSpaceOffset = strrpos($chunk, ' '); $chunk = substr($chunk, 0, $lastSpaceOffset); $tree[$key] = trim($chunk); } } if (in_array(getLastToken($chunk), $languageCodeWords)) { $lastSpaceOffset = strrpos($chunk, ' '); $chunk = substr($chunk, 0, $lastSpaceOffset); $tree[$key] = trim($chunk); } } foreach ($tree as $key => $chunk) { if (in_array(getFirstToken($chunk), $deleteFrench) || in_array(getFirstToken($chunk), $deleteEnglish) || in_array(getFirstToken($chunk), $deleteSpanish)) { $explode = explode(' ', $chunk, 2); $tree[$key] = trim($explode[1]); if (in_array(getFirstToken($chunk), $deleteFrench) || in_array(getFirstToken($chunk), $deleteEnglish) || in_array(getFirstToken($chunk), $deleteSpanish)) { $explode = explode(' ', $chunk, 2); $tree[$key] = trim($explode[1]); } } } $tree = array_values($tree); foreach ($tree as $key => $chunk) { if (!isAlphanumericWords($chunk) || is_numeric($chunk) || wordCountAccordingMicrosoftWordApproach($chunk) <= 3) { unset($tree[$key]); } } $tree = array_values($tree); $content = ''; foreach ($tree as $chunk) { $content .= $chunk . chr(10);