Ejemplo n.º 1
0
/**
 * Validate if the provided secret is correct
 *
 * @param int    $entity_guid guid of the newsletter entity
 * @param string $secret      secret code to be validated
 *
 * @return boolean
 */
function newsletter_validate_commandline_secret($entity_guid, $secret)
{
    $entity_guid = sanitise_int($entity_guid, false);
    if (empty($entity_guid) || empty($secret)) {
        return false;
    }
    $correct_secret = newsletter_generate_commanline_secret($entity_guid);
    if (!empty($correct_secret) && $correct_secret === $secret) {
        return true;
    }
    return false;
}
Ejemplo n.º 2
0
/**
 * Validate if the provided secret is correct
 *
 * @param int    $entity_guid guid of the newsletter entity
 * @param string $secret      secret code to be validated
 *
 * @return boolean
 */
function newsletter_validate_commandline_secret($entity_guid, $secret)
{
    $result = false;
    $entity_guid = sanitise_int($entity_guid, false);
    if (!empty($entity_guid) && !empty($secret)) {
        $correct_secret = newsletter_generate_commanline_secret($entity_guid);
        if (!empty($correct_secret) && $correct_secret === $secret) {
            $result = true;
        }
    }
    return $result;
}
Ejemplo n.º 3
0
 /**
  * Returns the url to the newsletter
  *
  * @return string url to the newsletter
  * @see ElggEntity::getURL()
  */
 public function getURL()
 {
     return elgg_normalize_url('newsletter/view/' . $this->getGUID() . '/' . newsletter_generate_commanline_secret($this->getGUID()));
 }