newsletter is roughly standalone
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Fri, 3 Dec 2004 12:05:27 +0000 (12:05 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:26:26 +0000 (23:26 +0200)
* Newsletter: roughly standalone.  (see #242)

git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-28

17 files changed:
ChangeLog
bin/connect.db.inc.php [new file with mode: 0644]
bin/cron/connect.db.inc.php [changed from file to symlink]
bin/newsletter.send.php [moved from bin/cron/send_nl.php with 98% similarity]
hooks/core/newsletter.inc.php [new file with mode: 0644]
htdocs/login.php
include/.arch-inventory
include/conf.d/newsletter.menu.inc.php [new file with mode: 0644]
include/conf.d/tmp.menu.inc.php
include/user.func.inc.php
include/xorg.globals.inc.php.in [new file with mode: 0644]
install.d/STATE
install.d/lists/files
install.d/newsletter/README [new file with mode: 0644]
install.d/newsletter/files
install.d/newsletter/install.sql [new file with mode: 0644]
install.d/newsletter/uninstall.sql [new file with mode: 0644]

index f7758b3..1218788 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,8 @@ New :
                - New skin : openweb.                                                                                           -MC
                - No more annoying submit button, onclick is used to submit.            -MC
                - This is the first autonom module of the site !                                        -MC
+       
+       * WebRedirect (was: Carva) : now standalone.                                                    -MC
 
 Bug/Wish :
 
diff --git a/bin/connect.db.inc.php b/bin/connect.db.inc.php
new file mode 100644 (file)
index 0000000..d66790f
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 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 General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************/
+
+ini_set("include_path","/usr/share/php/diogenes:/usr/share/php:../include:../../include");
+
+require("xorg.inc.php");
+require("xorg.misc.inc.php");
+$globals->dbconnect();
+
+?>
deleted file mode 100644 (file)
index 606388ef9435c6db66f3122b0093e3f4b4e3dcc5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 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 General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-ini_set("include_path","/usr/share/php/diogenes:/usr/share/php:../../include");
-
-require("xorg.inc.php");
-require("xorg.misc.inc.php");
-$globals->dbconnect();
-
-?>
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..55b7297113b8aa90cb3a11cd7ba5276521e2bc95
--- /dev/null
@@ -0,0 +1 @@
+../connect.db.inc.php
\ No newline at end of file
similarity index 98%
rename from bin/cron/send_nl.php
rename to bin/newsletter.send.php
index c90ebcc..6273c5f 100755 (executable)
@@ -21,7 +21,7 @@
  ***************************************************************************/
 
 require('./connect.db.inc.php');
-require("../../include/newsletter.inc.php");
+require("newsletter.inc.php");
 
 function query ($sql) {
     mysql_query($sql);
diff --git a/hooks/core/newsletter.inc.php b/hooks/core/newsletter.inc.php
new file mode 100644 (file)
index 0000000..9e9676e
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 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 General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************/
+
+// {{{ function newsletter_subscirbe()
+
+function &newsletter_subscribe($forlife, $uid, $promo, $password, &$result)
+{
+    global $globals;
+    require_once('newsletter.inc.php');
+    subscribe_nl();
+    
+    return ($result = true);
+}
+
+// }}}
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+?>
index ea026f6..90b3efd 100644 (file)
@@ -50,10 +50,6 @@ mysql_free_result($res);
 
 // affichage de la boîte avec quelques liens
 
-$res = $globals->db->query("SELECT id FROM newsletter ORDER BY date DESC");
-list($nb) = mysql_fetch_row($res);
-mysql_free_result($res);
-
 require_once('login.conf.php') ;
 $pub_nbElem = $pub_nbLig * $pub_nbCol ;
 if (count($pub_tjs) <= $pub_nbElem)
index e3c1067..a0b4a85 100644 (file)
@@ -1 +1 @@
-precious ^xorg.globals.inc.php
+precious ^xorg.globals.inc.php$
diff --git a/include/conf.d/newsletter.menu.inc.php b/include/conf.d/newsletter.menu.inc.php
new file mode 100644 (file)
index 0000000..a17c214
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+$this->addPrivateEntry(XOM_INFOS,    00, 'Lettres mensuelles',    'newsletter/');
+?>
index adb1840..9608eca 100644 (file)
@@ -18,7 +18,6 @@ $this->addPrivateEntry(XOM_GROUPS,   20, 'Conseil Pro.',          'referent.php'
 $this->addPrivateEntry(XOM_GROUPS,   30, 'Groupes X',             'http://www.polytechnique.net/plan.php');
 $this->addPrivateEntry(XOM_GROUPS,   40, 'Web Polytechnicien',    'http://www.polytechnique.net/');
 
-$this->addPrivateEntry(XOM_INFOS,    00, 'Lettres mensuelles',    'newsletter/');
 $this->addPrivateEntry(XOM_INFOS,    10, 'Documentations',        'docs/');
 $this->addPrivateEntry(XOM_INFOS,    20, 'Nous contacter',        'docs/contacts.php');
 $this->addPrivateEntry(XOM_INFOS,    30, 'Emploi',                'http://www.manageurs.com/');
index 8a0f916..df8905b 100644 (file)
@@ -77,12 +77,10 @@ function user_clear_all_subs($user_id, $really_del=true)
 function inscription_listes_base($uid,$pass,$promo)
 {
     require_once('xml-rpc-client.inc.php');
-    require_once('newsletter.inc.php');
     global $globals;
     // récupération de l'id de la liste promo
     $client = new xmlrpc_client("http://$uid:$pass@localhost:4949/polytechnique.org");
     $client->subscribe("promo$promo");
-    subscribe_nl();
 }
 
 // }}}
diff --git a/include/xorg.globals.inc.php.in b/include/xorg.globals.inc.php.in
new file mode 100644 (file)
index 0000000..94ae3c6
--- /dev/null
@@ -0,0 +1,94 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 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 General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************/
+
+require_once("diogenes.core.globals.inc.php");
+require_once("diogenes.database.inc.php");
+
+// {{{ class XorgGlobals
+
+class XorgGlobals extends DiogenesCoreGlobals
+{
+    var $page    = 'XorgPage';
+    var $session = 'XorgSession';
+    var $menu;
+
+    /** The x.org version */
+    var $version = "@VERSION@";
+    var $debug   = false;
+
+    /** db params */
+    var $dbdb               = 'x4dat';
+    var $dbhost             = 'localhost';
+    var $dbuser             = 'x4dat';
+    var $dbpwd              = 'x4dat';
+    
+    var $table_auth         = 'auth_user_md5';
+    var $table_log_actions  = 'logger.actions';
+    var $table_log_sessions = 'logger.sessions';
+    var $table_log_events   = 'logger.events';
+
+    /** logger */
+    var $tauth  = array('native'=>"auth_user_md5");
+    var $tlabel = array('native'=>"X.Org");
+
+    /** paths */
+    var $baseurl   = "http://localhost/xorg";
+    var $spoolroot = "/var/spool/xorg";
+    var $root      = null;
+
+    function XorgGlobals() {
+        $this->root = dirname(dirname(__FILE__));
+
+        foreach(glob($this->root.'/include/conf.d/*.globals.inc.php') as $inc) {
+            require_once($inc);
+        }
+        
+        $array = parse_ini_file($this->root.'/configs/platal.conf', true);
+        if (!is_array($array)) {
+            return;
+        }
+
+        foreach ($array as $cat=>$conf) {
+            $c = strtolower($cat);
+            foreach ($conf as $key=>$val) {
+                if ($c == 'core' && isset($this->$key)) {
+                    $this->$key=$val;
+                } else {
+                    $this->$c->$key = $val;
+                }
+            }
+        }
+        
+        $this->menu = new XOrgMenu($this->root.'/include/conf.d/');
+
+        session_start();
+
+        $this->dbconnect();
+        if ($this->debug) {
+            $this->db->trace_on();
+        }
+    }
+}
+
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+?>
index e87c17e..931ac9f 100644 (file)
@@ -15,6 +15,11 @@ banana
     quite good shape.
     converting banana into templates would be great though
 
+newsletter
+
+    it's mixed into the lists module ...
+    we have to repair this, and all will be OK
+
 
 IN PROGRESS
 -----------
@@ -30,7 +35,6 @@ mail
 marketing
 money
 news
-newsletter
 platal
 platal-dev
 profile
index 33d80c3..981f4f5 100644 (file)
@@ -1,24 +1,38 @@
+bin/mailman/foreach_template.py
+bin/mailman/mailman-rpc.py
+bin/mailman/mhonarc_by_month.pl
+bin/mailman/mhonarc_pipe.sh
 htdocs/admin/lists.php
+htdocs/images/lists_date.png
+htdocs/images/lists_firstia.png
+htdocs/images/lists_first.png
+htdocs/images/lists_lastia.png
+htdocs/images/lists_last.png
+htdocs/images/lists_nextia.png
+htdocs/images/lists_next.png
+htdocs/images/lists_previa.png
+htdocs/images/lists_prev.png
+htdocs/images/lists_thread.png
 htdocs/listes/admin.php
+htdocs/listes/archives.php
 htdocs/listes/check.php
 htdocs/listes/create.php
+htdocs/listes/delete.php
 htdocs/listes/index.php
 htdocs/listes/members.php
 htdocs/listes/moderate.php
 htdocs/listes/options.php
 htdocs/listes/soptions.php
 htdocs/listes/trombi.php
-htdocs/listes/delete.php
-htdocs/listes/archives.php
 include/validations/listes.inc.php
-bin/mailman/foreach_template.py
-bin/mailman/mailman-rpc.py
 templates/admin/lists.tpl
 templates/include/form.valid.listes.tpl
 templates/include/form.valid.ml.tpl
 templates/listes/admin.tpl
+templates/listes/archives.tpl
 templates/listes/check.tpl
 templates/listes/create.tpl
+templates/listes/delete.tpl
 templates/listes/header_listes.tpl
 templates/listes/index.tpl
 templates/listes/listes.inc.tpl
@@ -29,17 +43,5 @@ templates/listes/moderate.tpl
 templates/listes/options.tpl
 templates/listes/soptions.tpl
 templates/listes/trombi.tpl
-templates/listes/delete.tpl
-templates/listes/archives.tpl
 templates/mails/listes.promo.tpl
 templates/mails/valid.liste.tpl
-htdocs/images/lists_date.png
-htdocs/images/lists_firstia.png
-htdocs/images/lists_first.png
-htdocs/images/lists_lastia.png
-htdocs/images/lists_last.png
-htdocs/images/lists_nextia.png
-htdocs/images/lists_next.png
-htdocs/images/lists_previa.png
-htdocs/images/lists_prev.png
-htdocs/images/lists_thread.png
diff --git a/install.d/newsletter/README b/install.d/newsletter/README
new file mode 100644 (file)
index 0000000..b828bf3
--- /dev/null
@@ -0,0 +1,24 @@
+
+  Notes for the newsletter module for plat/al
+
+
+CONFIG OPTIONS
+--------------
+
+  All settings of the module are shown here with their default and meaning
+
+  N/A
+
+
+BUGS
+----
+
+  http://trackers.polytechnique.org/index.php?cat=14
+
+
+DEPENDS
+-------
+
+  platal
+
+
index 0983963..a2b85eb 100644 (file)
@@ -1,3 +1,5 @@
+bin/newsletter.send.php
+hooks/core/newsletter.inc.php
 htdocs/admin/newsletter_cats.php
 htdocs/admin/newsletter_edit.php
 htdocs/admin/newsletter.php
@@ -5,8 +7,8 @@ htdocs/css/nl.css
 htdocs/newsletter/index.php
 htdocs/newsletter/show.php
 htdocs/newsletter/submit.php
+include/conf.d/newsletter.menu.inc.php
 include/newsletter.inc.php
-bin/cron/send_nl.php
 templates/admin/newsletter_edit.tpl
 templates/admin/newsletter.tpl
 templates/newsletter/head.tpl
diff --git a/install.d/newsletter/install.sql b/install.d/newsletter/install.sql
new file mode 100644 (file)
index 0000000..2b03767
--- /dev/null
@@ -0,0 +1,58 @@
+insert into admin_h2 VALUES (2,6,'Newsletter',30);
+
+INSERT INTO admin_a VALUES (6,'Liste','admin/newsletter.php',0);
+INSERT INTO admin_a VALUES (6,'Catégories','admin/newsletter_cats.php',10);
+INSERT INTO admin_a VALUES (6,'Adresses en panne','admin/newsletter_pattecassee.php',20);
+
+--
+-- Table structure for table `newsletter`
+--
+
+CREATE TABLE `newsletter` (
+  `id` int(11) NOT NULL auto_increment,
+  `date` date NOT NULL default '0000-00-00',
+  `titre` varchar(255) NOT NULL default '',
+  `bits` enum('sent','new') NOT NULL default 'new',
+  `head` mediumtext NOT NULL,
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM COMMENT='liste des NL envoyes';
+
+--
+-- Table structure for table `newsletter_art`
+--
+
+CREATE TABLE `newsletter_art` (
+  `id` int(10) unsigned NOT NULL default '0',
+  `aid` smallint(5) unsigned NOT NULL default '0',
+  `cid` smallint(5) unsigned NOT NULL default '0',
+  `pos` tinyint(3) unsigned NOT NULL default '0',
+  `title` mediumtext NOT NULL,
+  `body` mediumtext NOT NULL,
+  `append` mediumtext NOT NULL,
+  PRIMARY KEY  (`id`,`aid`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `newsletter_cat`
+--
+
+CREATE TABLE `newsletter_cat` (
+  `cid` tinyint(3) unsigned NOT NULL auto_increment,
+  `pos` tinyint(3) unsigned NOT NULL default '0',
+  `titre` varchar(128) NOT NULL default '',
+  PRIMARY KEY  (`cid`),
+  KEY `pos` (`pos`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `newsletter_ins`
+--
+
+CREATE TABLE `newsletter_ins` (
+  `user_id` smallint(4) unsigned NOT NULL default '0',
+  `last` int(11) NOT NULL default '0',
+  `pref` enum('text','html') NOT NULL default 'html',
+  PRIMARY KEY  (`user_id`),
+  KEY `last` (`last`)
+) TYPE=MyISAM COMMENT='liste des abonnés à la newsletter';
+
diff --git a/install.d/newsletter/uninstall.sql b/install.d/newsletter/uninstall.sql
new file mode 100644 (file)
index 0000000..9a44be9
--- /dev/null
@@ -0,0 +1,8 @@
+
+delete from admin_h2 where h2id=6;
+delete from admin_a  where h2id=6;
+
+drop TABLE newsletter;
+drop TABLE newsletter_art;
+drop TABLE newsletter_cat;
+drop TABLE newsletter_ins;