Esempio n. 1
0
 /**
  * Returns true. Replace UNSUBSCRIBEURL with message and link to Special::Unsubscribe page
  */
 public static function ComposeMail($to, &$body, &$subject)
 {
     global $wgCityId;
     if (!$to instanceof MailAddress) {
         return true;
     }
     # to test MW 1.16
     $cityId = $wgCityId == 1927 ? $wgCityId : 177;
     $name = $to->name;
     $oTitle = GlobalTitle::newFromText('Unsubscribe', NS_SPECIAL, $cityId);
     if (!is_object($oTitle)) {
         return true;
     }
     $email = $to->address;
     $ts = time();
     # unsubscribe params
     $hash_url = Wikia::buildUserSecretKey($name, 'sha256');
     $url = $hash_url ? $oTitle->getFullURL(array('key' => $hash_url)) : '';
     $body = str_replace('$UNSUBSCRIBEURL', $url, $body);
     return true;
 }
 protected static function addParamsUser($wiki_id, $user_name, &$params)
 {
     $hash_url = Wikia::buildUserSecretKey($user_name, 'sha256');
     $unsubscribe_url = GlobalTitle::newFromText('Unsubscribe', NS_SPECIAL, $wiki_id)->getFullURL(array('key' => $hash_url));
     $params['$USERNAME'] = $user_name;
     $params['$UNSUBSCRIBEURL'] = $unsubscribe_url;
 }