Resources/contao/models/C4gActivationkeyModel.php
public static function generateActivationLinkFromKey($key,$keyAction='')
	{
		// check if key exists
		if (empty( $key )) {
			return false;
		}

		// get action for this key
        if (!$keyAction) {
            $keyAction = C4gActivationkeyModel::getActionForKey($key);
        }


		$keyAction = explode(':', $keyAction);

		// find an appropriate activationpage
		//
		// try to find a page with a specific handler for the key-action
        $db = \Database::getInstance();
        $objActivationPages = $db->prepare("SELECT * FROM tl_content WHERE type=? AND c4g_activationpage_action_handler=?")
            ->execute('c4g_activationpage', $keyAction[0]);

        if (!$objActivationPages) {
            // if no page was found, try to find pages with automatic-handlers
            $db = \Database::getInstance();
            $objActivationPages = $db->prepare("SELECT * FROM tl_content WHERE type=? AND c4g_activationpage_action_handler=?")
                ->execute('c4g_activationpage', '');

            // if still no page is found, the function failed
            if (!$objActivationPages) {
                return false;
            }
        }

		// use the first page (even if more pages are found)
		$objActivationPages->next();

		// get the article for this content-element
		$objArticle = \ArticleModel::findByPk( $objActivationPages->pid );
		if ($objArticle) {
			// if found, find the Page, where this article is nested
			$objPage = \PageModel::findByPk( $objArticle->pid );
			if ($objPage) {
				// if found build the desired URL (base + page-url + key)
				return \Environment::get('base') . \Controller::generateFrontendUrl( $objPage->row() ) . '?key=' . $key;
			}
		}

		// article or page not found
		return false;
	}
public static function generateActivationLinkFromKey($key,$keyAction='')
	{
		// check if key exists
		if (empty( $key )) {
			return false;
		}

		// get action for this key
        if (!$keyAction) {
            $keyAction = C4gActivationkeyModel::getActionForKey($key);
        }


		$keyAction = explode(':', $keyAction);

		// find an appropriate activationpage
		//
		// try to find a page with a specific handler for the key-action
        $db = \Database::getInstance();
        $objActivationPages = $db->prepare("SELECT * FROM tl_content WHERE type=? AND c4g_activationpage_action_handler=?")
            ->execute('c4g_activationpage', $keyAction[0]);

        if (!$objActivationPages) {
            // if no page was found, try to find pages with automatic-handlers
            $db = \Database::getInstance();
            $objActivationPages = $db->prepare("SELECT * FROM tl_content WHERE type=? AND c4g_activationpage_action_handler=?")
                ->execute('c4g_activationpage', '');

            // if still no page is found, the function failed
            if (!$objActivationPages) {
                return false;
            }
        }

		// use the first page (even if more pages are found)
		$objActivationPages->next();

		// get the article for this content-element
		$objArticle = \ArticleModel::findByPk( $objActivationPages->pid );
		if ($objArticle) {
			// if found, find the Page, where this article is nested
			$objPage = \PageModel::findByPk( $objArticle->pid );
			if ($objPage) {
				// if found build the desired URL (base + page-url + key)
				return \Environment::get('base') . \Controller::generateFrontendUrl( $objPage->row() ) . '?key=' . $key;
			}
		}

		// article or page not found
		return false;
	}
generates an activationlink from geiven key
@param  string $key
@return string