function CheckWhitelist(&$gallery) { global $DB, $WL_CACHE; $found = FALSE; $options = array('allow_redirect' => 0, 'allow_norecip' => 0, 'allow_autoapprove' => 0, 'allow_noconfirm' => 0, 'allow_blacklist' => 0); $checks = array('email' => array($gallery['email']), 'url' => array($gallery['gallery_url']), 'domain_ip' => array(GetIpFromUrl($gallery['gallery_url'])), 'submit_ip' => array($_SERVER['REMOTE_ADDR']), 'dns' => GetNameServers($gallery['gallery_url'])); if (!is_array($WL_CACHE)) { $WL_CACHE = array(); $result = $DB->Query('SELECT * FROM `tx_whitelist`'); while ($item = $DB->NextRow($result)) { $WL_CACHE[] = $item; } $DB->Free($result); } foreach ($WL_CACHE as $item) { $to_check = $checks[$item['type']]; if (!$item['regex']) { $item['value'] = preg_quote($item['value'], '~'); } else { $item['value'] = preg_replace("%(?<!\\\\)~%", '\\~', $item['value']); } if (is_array($to_check)) { foreach ($to_check as $check_item) { if (empty($check_item)) { continue; } if (preg_match("~{$item['value']}~i", $check_item, $matches)) { $found = TRUE; $options['allow_redirect'] |= $item['allow_redirect']; $options['allow_norecip'] |= $item['allow_norecip']; $options['allow_autoapprove'] |= $item['allow_autoapprove']; $options['allow_noconfirm'] |= $item['allow_noconfirm']; $options['allow_blacklist'] |= $item['allow_blacklist']; } } } } if ($found) { return $options; } else { return FALSE; } }
function CheckBlacklistAccount(&$account, $full_check = FALSE) { $checks = array('email' => array($account['email']), 'url' => array($account['site_url']), 'domain_ip' => array(GetIpFromUrl($account['gallery_url'])), 'submit_ip' => array($_SERVER['REMOTE_ADDR']), 'word' => array($account['title'], $account['description'], $account['keywords']), 'html' => array($account['html']), 'headers' => array($account['headers']), 'dns' => GetNameServers($account['site_url'])); return CheckBlacklistGeneric($checks, $full_check); }
</td> </tr> <tr> <td class="bold" align="right"> Submitter IP </td> <td colspan="2"> <input type="text" name="bl_submitip" id="bl_submitip" size="30" value="<?php echo $gallery['submit_ip']; ?> "> <img src="images/x.png" border="0" alt="Clear" title="Clear" class="function click" onclick="$('#bl_submitip').val('');"> </td> </tr> <?php $nameservers = GetNameServers($gallery['gallery_url']); if (count($nameservers) > 0) { ?> <tr> <td class="bold" align="right"> DNS Server </td> <td colspan="2"> <input type="text" name="bl_dns" id="bl_dns" size="30" value="<?php echo $nameservers[0]; ?> "> <img src="images/x.png" border="0" alt="Clear" title="Clear" class="function click" onclick="$('#bl_dns').val('');"> </td> </tr> <?php
function txShGalleryBlacklist() { global $DB, $C; VerifyPrivileges(P_GALLERY_REMOVE); $gallery = $DB->Row('SELECT * FROM `tx_galleries` WHERE `gallery_id`=?', array($_REQUEST['gallery_id'])); $_REQUEST = array_merge($_REQUEST, $gallery); $_REQUEST['dns'] = GetNameServers($_REQUEST['gallery_url']); ArrayHSC($_REQUEST); include_once 'includes/galleries-blacklist.php'; }