Beispiel #1
0
    $limit = 10;
}
$offset = $Params['Offset'];
if (!is_numeric($offset)) {
    $offset = 0;
}
if ($ViewMode != 'all' && $ViewMode != 'invalid' && $ViewMode != 'valid') {
    $ViewMode = 'all';
}
if ($Module->isCurrentAction('SetValid')) {
    $urlSelection = $Module->actionParameter('URLSelection');
    eZURL::setIsValid($urlSelection, true);
} else {
    if ($Module->isCurrentAction('SetInvalid')) {
        $urlSelection = $Module->actionParameter('URLSelection');
        eZURL::setIsValid($urlSelection, false);
    }
}
if ($ViewMode == 'all') {
    $listParameters = array('is_valid' => null, 'offset' => $offset, 'limit' => $limit, 'only_published' => true);
    $countParameters = array('only_published' => true);
} elseif ($ViewMode == 'valid') {
    $listParameters = array('is_valid' => true, 'offset' => $offset, 'limit' => $limit, 'only_published' => true);
    $countParameters = array('is_valid' => true, 'only_published' => true);
} elseif ($ViewMode == 'invalid') {
    $listParameters = array('is_valid' => false, 'offset' => $offset, 'limit' => $limit, 'only_published' => true);
    $countParameters = array('is_valid' => false, 'only_published' => true);
}
$list = eZURL::fetchList($listParameters);
$listCount = eZURL::fetchListCount($countParameters);
$viewParameters = array('offset' => $offset, 'limit' => $limit);
        $translateResult = eZURLAliasML::translate($url);
        if (!$translateResult) {
            $isInternal = false;
            // Check if it is a valid internal link.
            foreach ($siteURLs as $siteURL) {
                $siteURL = preg_replace("/\\/\$/e", "", $siteURL);
                $fp = @fopen($siteURL . "/" . $url, "r");
                if (!$fp) {
                    // do nothing
                } else {
                    $isInternal = true;
                    fclose($fp);
                }
            }
            $translateResult = $isInternal;
        }
        if ($translateResult) {
            if (!$isValid) {
                eZURL::setIsValid($linkID, true);
            }
            $cli->output($cli->stylize('success', "valid"));
        } else {
            if ($isValid) {
                eZURL::setIsValid($linkID, false);
            }
            $cli->output($cli->stylize('warning', "invalid"));
        }
    }
    eZURL::setLastChecked($linkID);
}
$cli->output("All links have been checked!");