]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '1.0.x' into testing
authorEvan Prodromou <evan@status.net>
Mon, 20 Jun 2011 13:13:42 +0000 (09:13 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 20 Jun 2011 13:13:42 +0000 (09:13 -0400)
classes/Status_network.php
classes/Status_network_tag.php
lib/mail.php
plugins/DomainStatusNetwork/DomainStatusNetworkPlugin.php
plugins/DomainStatusNetwork/lib/freeemail.php [new file with mode: 0644]
plugins/EmailSummary/sendemailsummary.php
plugins/EmailSummary/useremailsummaryhandler.php

index c3acacf595c029c232f9cf16dbbd2d1e51da3765..b7a7e1c0a7de0ae09a7a8cabaede07c0041fff2f 100644 (file)
@@ -56,8 +56,9 @@ class Status_network extends Safe_DataObject
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
-    static $cache = null;
-    static $cacheInitialized = false;
+    // XXX: made public so Status_network_tag can eff with it
+    public static $cache = null;
+    public static $cacheInitialized = false;
     static $base = null;
     static $wildcard = null;
 
@@ -91,12 +92,18 @@ class Status_network extends Safe_DataObject
             // or a single-process script which is switching
             // configurations.
             $persist = php_sapi_name() != 'cli' || self::$cacheInitialized;
-            if (is_array($servers)) {
-                foreach($servers as $server) {
-                    self::$cache->addServer($server, 11211, $persist);
+            if (!is_array($servers)) {
+                $servers = array($servers);
+            } 
+            foreach($servers as $server) {
+                $parts = explode(':', $server);
+                $server = $parts[0];
+                if (count($parts) > 1) {
+                    $port = $parts[1];
+                } else {
+                    $port = 11211;
                 }
-            } else {
-                self::$cache->addServer($servers, 11211, $persist);
+                self::$cache->addServer($server, $port, $persist);
             }
             self::$cacheInitialized = true;
         }
index 00ff0d85200c8938421b4e9c818fe7455f75f673..4a7c3b51ff15311a903f1ce4d303d80a32e4defa 100644 (file)
@@ -111,8 +111,10 @@ class Status_network_tag extends Safe_DataObject
     function decache()
     {
         $key = 'status_network_tags:' . $this->site_id;
-        if (Status_network::$cache) {
-            Status_network::$cache->delete($key);
+        if (Status_network::$cache || Status_network::$cacheInitialized) {
+            // FIXME: this was causing errors, so I'm hiding them.
+            // I'm a big chicken and lazy.
+            @Status_network::$cache->delete($key);
         }
     }
 
index 6c6450ab50b49001015cb22bae83754731bac4a4..776447cd5bf57eed438086ec83b9dccf506ce5df 100644 (file)
@@ -447,7 +447,8 @@ function mail_broadcast_notice_sms($notice)
                    __FILE__);
         $success = mail_send_sms_notice_address($notice,
                                                 $user->smsemail,
-                                                $user->incomingemail);
+                                                $user->incomingemail,
+                                                $user->nickname);
         if (!$success) {
             // XXX: Not sure, but I think that's the right thing to do
             common_log(LOG_WARNING,
@@ -480,7 +481,8 @@ function mail_send_sms_notice($notice, $user)
 {
     return mail_send_sms_notice_address($notice,
                                         $user->smsemail,
-                                        $user->incomingemail);
+                                        $user->incomingemail,
+                                        $user->nickname);
 }
 
 /**
@@ -492,10 +494,11 @@ function mail_send_sms_notice($notice, $user)
  * @param Notice $notice        notice to send
  * @param string $smsemail      email address to send to
  * @param string $incomingemail email address to set as 'from'
+ * @param string $nickname      nickname to add to beginning
  *
  * @return boolean success flag
  */
-function mail_send_sms_notice_address($notice, $smsemail, $incomingemail)
+function mail_send_sms_notice_address($notice, $smsemail, $incomingemail, $nickname)
 {
     $to = $nickname . ' <' . $smsemail . '>';
 
index e11cb082d6dc0a470b8c94428df25fc3f215bee7..10208cfbe7376d4263fc6df5de8ea0e2ecaa5eaa 100644 (file)
@@ -103,9 +103,8 @@ class DomainStatusNetworkPlugin extends Plugin
             include_once $dir . '/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
             return false;
         case 'DomainStatusNetworkInstaller':
-            include_once $dir . '/lib/' . strtolower($cls) . '.php';
-            return false;
         case 'GlobalApiAction':
+        case 'FreeEmail':
             include_once $dir . '/lib/' . strtolower($cls) . '.php';
             return false;
         default:
@@ -245,6 +244,10 @@ class DomainStatusNetworkPlugin extends Plugin
     {
         $domain = self::toDomain($email);
 
+        if (FreeEmail::isFree($domain)) {
+            throw new ClientException(_("Use your work email."));
+        }
+
         $sn = self::siteForDomain($domain);
 
         if (empty($sn)) {
diff --git a/plugins/DomainStatusNetwork/lib/freeemail.php b/plugins/DomainStatusNetwork/lib/freeemail.php
new file mode 100644 (file)
index 0000000..fe3cc5a
--- /dev/null
@@ -0,0 +1,474 @@
+<?php
+
+class FreeEmail {
+
+    static $domains =
+        array('111mail.com',
+              '123iran.com',
+              '1-usa.com',
+              '2die4.com',
+              '37.com',
+              '420email.com',
+              '4degreez.com',
+              '4-music-today.com',
+              '5.am',
+              '5005.lv',
+              '8.am',
+              'a.org.ua',
+              'abha.cc',
+              'accountant.com',
+              'actingbiz.com',
+              'adexec.com',
+              'africamail.com',
+              'agadir.cc',
+              'ahsa.ws',
+              'ajman.cc',
+              'ajman.us',
+              'ajman.ws',
+              'albaha.cc',
+              'alex4all.com',
+              'alexandria.cc',
+              'algerie.cc',
+              'allergist.com',
+              'allhiphop.com',
+              'alriyadh.cc',
+              'alumnidirector.com',
+              'amman.cc',
+              'anatomicrock.com',
+              'animeone.com',
+              'anjungcafe.com',
+              'aqaba.cc',
+              'arar.ws',
+              'archaeologist.com',
+              'arcticmail.com',
+              'artlover.com',
+              'asia.com',
+              'asiancutes.com',
+              'aswan.cc',
+              'a-teens.net',
+              'ausi.com',
+              'australiamail.com',
+              'autoindia.com',
+              'autopm.com',
+              'baalbeck.cc',
+              'bahraini.cc',
+              'banha.cc',
+              'barriolife.com',
+              'b-boy.com',
+              'beautifulboy.com',
+              'berlin.com',
+              'bgay.com',
+              'bicycledata.com',
+              'bicycling.com',
+              'bigheavyworld.com',
+              'bigmailbox.net',
+              'bikerheaven.net',
+              'bikerider.com',
+              'bikermail.com',
+              'billssite.com',
+              'bizerte.cc',
+              'bk.ru',
+              'blackandchristian.com',
+              'blackcity.net',
+              'blackvault.com',
+              'blida.info',
+              'bmx.lv',
+              'bmxtrix.com',
+              'boarderzone.com',
+              'boatnerd.com',
+              'bolbox.com',
+              'bongmail.com',
+              'bowl.com',
+              'buraydah.cc',
+              'butch-femme.org',
+              'byke.com',
+              'calle22.com',
+              'cameroon.cc',
+              'cannabismail.com',
+              'catlover.com',
+              'catlovers.com',
+              'certifiedbitches.com',
+              'championboxing.com',
+              'chatway.com',
+              'cheerful.com',
+              'chemist.com',
+              'chillymail.com',
+              'classprod.com',
+              'classycouples.com',
+              'clerk.com',
+              'cliffhanger.com',
+              'columnist.com',
+              'comic.com',
+              'company.org.ua',
+              'congiu.net',
+              'consultant.com',
+              'coolmail.ru',
+              'coolshit.com',
+              'corpusmail.com',
+              'counsellor.com',
+              'cutey.com',
+              'cyberunlimited.org',
+              'cycledata.com',
+              'darkfear.com',
+              'darkforces.com',
+              'deliveryman.com',
+              'dhahran.cc',
+              'dhofar.cc',
+              'dino.lv',
+              'diplomats.com',
+              'dirtythird.com',
+              'djibouti.cc',
+              'doctor.com',
+              'doglover.com',
+              'dominican.cc',
+              'dopefiends.com',
+              'dr.com',
+              'draac.com',
+              'drakmail.net',
+              'dr-dre.com',
+              'dreamstop.com',
+              'dublin.com',
+              'earthling.net',
+              'earthling.net',
+              'eclub.lv',
+              'egypt.net',
+              'e-mail.am',
+              'email.com',
+              'e-mail.ru',
+              'emailfast.com',
+              'emails.ru',
+              'e-mails.ru',
+              'eminemfans .com',
+              'envirocitizen.com',
+              'eritrea.cc',
+              'eritrea.cc',
+              'escapeartist.com',
+              'europe.com',
+              'execs.com',
+              'ezsweeps.com',
+              'falasteen.cc',
+              'famous.as',
+              'farts.com',
+              'feelingnaughty.com',
+              'financier.com',
+              'firemyst.com',
+              'fit.lv',
+              'freeonline.com',
+              'fromru.com',
+              'front.ru',
+              'fudge.com',
+              'fujairah.cc',
+              'fujairah.us',
+              'fujairah.ws',
+              'funkytimes.com',
+              'gabes.cc',
+              'gafsa.cc',
+              'gala.net',
+              'gamerssolution.com',
+              'gardener.com',
+              'gawab.com',
+              'gazabo.net',
+              'geologist.com',
+              'giza.cc',
+              'glittergrrrls.com',
+              'gmail.com',
+              'goatrance.com',
+              'goddess.com',
+              'gohip.com',
+              'goldenmail.ru',
+              'goldmail.ru',
+              'gospelcity.com',
+              'gothicgirl.com',
+              'gotomy.com',
+              'grapemail.net',
+              'graphic-designer.com',
+              'greatautos.org',
+              'guinea.cc',
+              'guinea.cc',
+              'guy.com',
+              'hacker.am',
+              'hairdresser.net',
+              'haitisurf.com',
+              'hamra.cc',
+              'happyhippo.com',
+              'hasakah.com',
+              'hateinthebox.com',
+              'hebron.tv',
+              'hip hopmail.com',
+              'homs.cc',
+              'hotbox.ru',
+              'hotmail.com',
+              'hotmail.ru',
+              'hot-shot.com',
+              'houseofhorrors.com',
+              'hugkiss.com',
+              'hullnumber.com',
+              'human.lv',
+              'ibra.cc',
+              'idunno4recipes.com',
+              'ihatenetscape.com',
+              'iname.com',
+              'inbox.ru',
+              'inorbit.com',
+              'insurer.com',
+              'intimatefire.com',
+              'iphon.biz',
+              'irbid.ws',
+              'irow.com',
+              'ismailia.cc',
+              'jadida.cc',
+              'jadida.org',
+              'japan.com',
+              'jazzemail.com',
+              'jerash.cc',
+              'jizan.cc',
+              'jouf.cc',
+              'journalist.com',
+              'juanitabynum.com',
+              'kairouan.cc',
+              'kanoodle.com',
+              'karak.cc',
+              'khaimah.cc',
+              'khartoum.cc',
+              'khobar.cc',
+              'kickboxing.com',
+              'kidrock.com',
+              'kinkyemail.com',
+              'kool-things.com',
+              'krovatka.net',
+              'kuwaiti.tv',
+              'kyrgyzstan.cc',
+              'land.ru',
+              'latakia.cc',
+              'latchess.com',
+              'latinabarbie.com',
+              'latinogreeks.com',
+              'lawyer.com',
+              'lebanese.cc',
+              'leesville.com',
+              'legislator.com',
+              'list.ru',
+              'live.com',
+              'lobbyist.com',
+              'london.com',
+              'loveable.com',
+              'loveemail.com',
+              'loveis.lv',
+              'lovers-mail.com',
+              'lowrider.com',
+              'lubnan.cc',
+              'lubnan.ws',
+              'lucky7lotto.net',
+              'lv-inter.net',
+              'mad.scientist.com',
+              'madeniggaz.net',
+              'madinah.cc',
+              'madrid.com',
+              'maghreb.cc',
+              'mail.com',
+              'mail.ru',
+              'mail15.com',
+              'mail333.com',
+              'mailbomb.com',
+              'manama.cc',
+              'mansoura.tv',
+              'marillion.net',
+              'marrakesh.cc',
+              'mascara.ws',
+              'megarave.com',
+              'meknes.cc',
+              'mesra.net',
+              'mindless.com',
+              'minister.com',
+              'mofa.com',
+              'moscowmail.com',
+              'motley.com',
+              'munich.com',
+              'muscat.tv',
+              'muscat.ws',
+              'music.com',
+              'musician.net',
+              'musician.org',
+              'musicsites.com',
+              'myself.com',
+              'nabeul.cc',
+              'nabeul.info',
+              'nablus.cc',
+              'nador.cc',
+              'najaf.cc',
+              'narod.ru',
+              'netbroadcaster.com',
+              'netfingers.com',
+              'net-surf.com',
+              'nettaxi.com',
+              'newmail.ru',
+              'ni cedriveway.com',
+              'nightmail.ru',
+              'nm.ru',
+              'nocharge.com',
+              'nycmail.com',
+              'omani.ws',
+              'omdurman.cc',
+              'operationivy.com',
+              'optician.com',
+              'oran.cc',
+              'oued.info',
+              'oued.org',
+              'oujda.biz',
+              'oujda.cc',
+              'paidoffers.net',
+              'pakistani.ws',
+              'palmyra.cc',
+              'palmyra.ws',
+              'pcbee.com',
+              'pediatrician.com',
+              'persian.com',
+              'petrofind.com',
+              'phunkybitches.com',
+              'pikaguam.com',
+              'pinkcity.net',
+              'pisem.net',
+              'pitbullmail.com',
+              'planetsmeg.com',
+              'playful.com',
+              'pochta.ru',
+              'pochtamt.ru',
+              'poetic.com',
+              'pookmail.com',
+              'poop.com',
+              'poormail.com',
+              'pop3.ru',
+              'popstar.com',
+              'portsaid.cc',
+              'post.com',
+              'potsmokersnet.com',
+              'presidency.com',
+              'priest.com',
+              'primetap.com',
+              'programmer.net',
+              'project420.com',
+              'prolife.net',
+              'publicist.com',
+              'puertoricowow.com',
+              'puppetweb.com',
+              'qassem.cc',
+              'quds.cc',
+              'rabat.cc',
+              'rafah.cc',
+              'ramallah.cc',
+              'rambler.ru',
+              'rapstar.com',
+              'rapworld.com',
+              'rastamall.com',
+              'ratedx.net',
+              'ravermail.com',
+              'rbcmail.ru',
+              'realtyagent.com',
+              'rediffmail.com',
+              'registerednurses.com',
+              'relapsecult.com',
+              'remixer.com',
+              'repairman.com',
+              'representative.com',
+              'rescueteam.com',
+              'rockeros.com',
+              'romance106fm.com',
+              'rome.com',
+              'sa veourplanet.org',
+              'safat.biz',
+              'safat.info',
+              'safat.us',
+              'safat.ws',
+              'saintly.com',
+              'salalah.cc',
+              'salmiya.biz',
+              'samerica.com',
+              'sanaa.cc',
+              'sanfranmail.com',
+              'scientist.com',
+              'seductive.com',
+              'seeb.cc',
+              'sexriga.lv',
+              'sfax.ws',
+              'sharm.cc',
+              'sinai.cc',
+              'singalongcenter.com',
+              'singapore.com',
+              'siria.cc',
+              'sketchyfriends.com',
+              'slayerized.com',
+              'smartstocks.com',
+              'smtp.ru',
+              'sociologist.com',
+              'sok.lv',
+              'soon.com',
+              'soulja-beatz.org',
+              'sousse.cc',
+              'spam.lv',
+              'specialoperations.com',
+              'speedymail.net',
+              'spells.com',
+              'streetracing.com',
+              'subspacemail.com',
+              'sudanese.cc',
+              'suez.cc',
+              'sugarray.com',
+              'superbikeclub.com',
+              'superintendents.net',
+              'supermail.ru',
+              'surfguiden.com',
+              'sweetwishes.com',
+              'tabouk.cc',
+              'tajikistan.cc',
+              'tangiers.cc',
+              'tanta.cc',
+              'tattoodesign.com',
+              'tayef.cc',
+              'teamster.net',
+              'techie.com',
+              'technologist.com',
+              'teenchatnow.com',
+              'tetouan.cc',
+              'the5thquarter.com',
+              'theblackmarket.com',
+              'timor.cc',
+              'tokyo.com',
+              'tombstone.ws',
+              'troamail.org',
+              'tunisian.cc',
+              'tunisian.cc',
+              'tut.by',
+              'tx.am',
+              'u2tours.com',
+              'ua.fm',
+              'uaix.info',
+              'umpire.com',
+              'urdun.cc',
+              'usa.com',
+              'vipmail.ru',
+              'vitalogy.org',
+              'whatisthis.com',
+              'whoever.com',
+              'winning.com',
+              'witty.com',
+              'wrestlezone.com',
+              'writeme.com',
+              'yahoo.ca',
+              'yahoo.com',
+              'yanbo.cc',
+              'yandex.ru',
+              'yepmail.com',
+              'yemeni.cc',
+              'yogaelements.com',
+              'yours.com',
+              'yunus.cc',
+              'zabor.lv',
+              'zagazig.cc',
+              'zambia.cc',
+              'zarqa.cc',
+              'zerogravityclub.com');
+
+    static function isFree($domain) {
+        return in_array($domain, self::$domains);
+    }
+}
\ No newline at end of file
index aad79c736046e05fcd43d390afeec24191913e5e..01c11a210a009c6edbba4cf2a752c6966ca0db48 100644 (file)
@@ -1,22 +1,21 @@
-#!/usr/bin/env php
-   <?php
-   /*
-    * StatusNet - a distributed open-source microblogging tool
-    * Copyright (C) 2010, StatusNet, Inc.
-    *
-    * This program is free software: you can redistribute it and/or modify
-    * it under the terms of the GNU Affero General Public License as published by
-    * the Free Software Foundation, either version 3 of the License, or
-    * (at your option) any later version.
-    *
-    * This program is distributed in the hope that it will be useful,
-    * but WITHOUT ANY WARRANTY; without even the implied warranty of
-    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    * GNU Affero General Public License for more details.
-    *
-    * You should have received a copy of the GNU Affero General Public License
-    * along with this program.  If not, see <http://www.gnu.org/licenses/>.
-    */
+<?php
+/*
+ * StatusNet - a distributed open-source microblogging tool
+ * Copyright (C) 2010, StatusNet, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
 
 define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
 
@@ -44,7 +43,7 @@ if (have_option('u', 'universe')) {
             StatusNet::init($server);
             // Different queue manager, maybe!
             $qm = QueueManager::get();
-            $qm->enqueue(null, 'sitesum');
+            $qm->enqueue(1, 'sitesum');
         }
     }
 } else {
@@ -54,6 +53,6 @@ if (have_option('u', 'universe')) {
         $user = getUser();
         $qm->enqueue($user->id, 'usersum');
     } catch (NoUserArgumentException $nuae) {
-        $qm->enqueue(null, 'sitesum');
+        $qm->enqueue(1, 'sitesum');
     }
 }
index 2cdacd40b1ae2c23413eefcd0a1498a876cbf046..f03e8a1dcdfddca3a50b4f3f5db5d35aab14136c 100644 (file)
@@ -57,7 +57,7 @@ class UserEmailSummaryHandler extends QueueHandler
      */
     function transport()
     {
-        return 'sitesum';
+        return 'usersum';
     }
 
     /**
@@ -120,7 +120,7 @@ class UserEmailSummaryHandler extends QueueHandler
             $new_top = $notice->_items[0]->id;
         }
 
-        $out = new XMLStringer();
+        $out = new XMLStringer(true);
 
         $out->elementStart('div', array('width' => '100%',
                                         'style' => 'background-color: #ffffff; border: 4px solid #4c609a; padding: 10px;'));
@@ -206,8 +206,13 @@ class UserEmailSummaryHandler extends QueueHandler
 
         // FIXME: do something for people who don't like HTML email
 
+        $subject = sprintf(_m('Your latest updates from %s'), common_config('site', 'name'));
+
         // TRANS: Subject for e-mail.
-        mail_to_user($user, _m('Updates from your network'), $body,
+
+        mail_to_user($user,
+                     $subject,
+                     $body,
                      array('Content-Type' => 'text/html; charset=UTF-8'));
 
         if (empty($ess)) {