Ejemplo n.º 1
0
  return $used_tags;
}

//- Setup stuff -------------------------------------------------------------\\

// setup commsy-environment
include_once('classes/cs_environment.php');
$environment = new cs_environment();

$translator = $environment->getTranslationObject();
$message = $translator->getCompleteMessageArray();
$num_all = count($message);

$num_whitelisted = 0;
foreach ($message as $key => $value) {
  if (isWhitelisted($key)) {
    $num_whitelisted++;
    if ($mode == 'show_whitelist') {
      $whitelist_results[] = $key;
    }
  }
}

//- Operations --------------------------------------------------------------\\
if ($mode == 'delete') {
  if (isset($_POST['really_delete']) and $_POST['really_delete']) {
    include_once('classes/cs_language.php');
    $lang = new cs_language('', $message);

    foreach ($_POST['orphans'] as $TagID) {
      $lang->deleteMessage($TagID);
Ejemplo n.º 2
0
    $endpointWhitelist = ['https://jmt17.google.com/gcm/demo-webpush-00/', 'https://updates.push.services.mozilla.com/push/'];
    $filtered = array_filter($endpointWhitelist, function ($entry) use($endpoint) {
        return substr($endpoint, 0, strlen($entry)) == $entry;
    });
    return !!count($filtered);
}
// -----------------------------------------------------------------------------
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
    fatalError('405 Method Not Allowed', 'Only POST requests may be made to this tool.');
}
if (!array_key_exists(toHeaderName('X-Endpoint'), $_SERVER)) {
    fatalError('400 Bad Request', 'The X-Endpoint HTTP header must be set.');
}
$endpoint = $_SERVER[toHeaderName('X-Endpoint')];
$headers = [];
if (!isWhitelisted($endpoint)) {
    fatalError('403 Forbidden', 'The endpoint has not been whitelisted. Send a PR?');
}
$optionalHeaders = ['Content-Encoding', 'Encryption', 'Crypto-Key'];
foreach ($optionalHeaders as $header) {
    $key = toHeaderName($header);
    if (array_key_exists($key, $_SERVER)) {
        $headers[$header] = $_SERVER[$key];
    }
}
if (strpos($endpoint, 'google') !== false) {
    $headers['Authorization'] = 'key=AIzaSyDR_72jXd9RJKrSyGcuZvn_gCi9-HSeCrM';
    // TODO(peter): Work with the GCM team to fix this.
    unset($headers['Content-Encoding']);
}
$rawData = file_get_contents('php://input');
Ejemplo n.º 3
0
//Check to make sure some things are still updated.  Remove outdated entries.
$i = 0;
foreach ($pagebuffer as $id => $page) {
    $i++;
    if (empty($page['urls']) || !isset($page['urls'])) {
        unset($pagebuffer[$id]);
        continue;
    }
    //check if it has been whitelisted/deblacklisted during the database scan and make sure it isn't catching itself.
    $pagedata = $site->initPage(null, $id)->get_text();
    preg_match('/\\{\\{Blacklisted\\-links\\|(1\\=)?(\\n)?((.(\\n)?)*?)\\|bot\\=Cyberbot II(\\|invisible=(.*?))?\\}\\}(\\n)?/i', $pagedata, $template);
    if (isset($template[0])) {
        $pagedata = str_replace($template[0], "", $pagedata);
    }
    foreach ($page['urls'] as $id2 => $url) {
        if (($pagebuffer[$id]['rules'][$id2] = findRule($url)) === false || isWhitelisted($url) || strpos($pagedata, $url) === false) {
            unset($pagebuffer[$id]['urls'][$id2]);
        }
    }
    if (isset($pagebuffer[$id]['object'])) {
        unset($pagebuffer[$id]['object']);
    }
    if (empty($pagebuffer[$id]['urls']) || !isset($pagebuffer[$id]['urls'])) {
        unset($pagebuffer[$id]);
    }
    $completed = $i / $count * 100;
    $completedin = (time() - $starttime) * 100 / $completed - (time() - $starttime);
    $completedby = time() + $completedin;
    $status = array('status' => 'process', 'bladd' => $a, 'bldeleted' => $d, 'blexception' => $e, 'scanprogress' => round($completed, 3) . "% ({$i} of {$count})", 'scantype' => 'x', 'scaneta' => round($completedby, 0));
    updateStatus();
}