? modules/massmailer/engines/phplist/config.php.gz
? modules/massmailer/engines/phplist/phplist.module.gz
Index: modules/massmailer/engines/phplist/config.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/massmailer/engines/phplist/config.php,v
retrieving revision 1.12
diff -u -r1.12 config.php
--- modules/massmailer/engines/phplist/config.php	11 Nov 2005 02:23:40 -0000	1.12
+++ modules/massmailer/engines/phplist/config.php	28 Mar 2006 23:42:37 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: config.php,v 1.12 2005/11/11 02:23:40 killes Exp $
+// $Id: config.php,v 1.7.2.3 2005/10/24 00:46:33 killes Exp $
 /*
  * this function was copied from bootstrap.inc,v 1.32.2.3 2004/12/01 12:09:56 dries Exp $
  * it has been modified to collect the server information from the exec call instead of the $_SERVER global
@@ -58,7 +58,7 @@
 $db_info = drupal_database_init();
 
 if (isset($db_info['port'])) {
-  $database_host = $db_info['host'] . ':' . $db_info['port'];
+  $database_host = $db_info['host'] .':'. $db_info['port'];
 }
 else {
   $database_host = $db_info['host'];
@@ -74,18 +74,19 @@
 // set this to 1 to only simulate message sending, will not actually send emails.
 define ("TEST",0);
 
+# set this to 1 if you want PHPlist to deal with login for the administrative
+# section of the system
+# you will be able to add administrators who control their own lists
+# default login is "admin" with password "phplist"
+#
+$require_login = 1;
+
 // increase reporting verbosity, apparently this can crash some browsers with large email batches
 define ("VERBOSE",0);
 
-// Drupal sends mails in 8bit mode
-define('TEXTEMAIL_ENCODING','8bit');
-
-// We use PHPmailer for sending.
-define("PHPMAILER",1);
-
 // these are relative to the document root as you can see, if changed nothing will work. Enjoy!
-$pageroot = '/modules/massmailer/engines/phplist/phplist/lists';
-$adminpages = '/modules/massmailer/engines/phplist/phplist/lists/admin';
+$pageroot = '/modules/massmailer/engines/phplist/phplist/';
+$adminpages = '/modules/massmailer/engines/phplist/phplist/admin';
 
 # select the language module to use
 # Look for <country>.inc files in the texts directory
@@ -109,7 +110,7 @@
 # have to make sure that you run the queue from the commandline
 # check README.commandline how to do this
 // not sure if this is necessarry, but I suppose it can't hurt
-define ("MANUALLY_PROCESS_QUEUE",0);
+define ("MANUALLY_PROCESS_QUEUE",1);
 
 # if you want to use \r\n for formatting messages set the 0 to 1
 # see also http://www.securityfocus.com/archive/1/255910
@@ -215,79 +216,61 @@
 
 if (file_exists($database_module)) {
   include $database_module;
-}
-else if (file_exists("admin/$database_module")) {
+} elseif (file_exists("admin/$database_module")) {
   include "admin/$database_module";
-}
-else if (file_exists("../$database_module")) { # help is one level up
+} elseif (file_exists("../$database_module")) { # help is one level up
   include "../$database_module";
-}
-else {
+} else {
 	print "Cannot load $database_module, exit";
 	exit;
 }
 if (file_exists("../texts/english.inc")) { # first load english and then the translation
   include "../texts/english.inc";
-}
-else if(file_exists("texts/english.inc")) {
+} elseif(file_exists("texts/english.inc")) {
   include "texts/english.inc";
-}
-else if (file_exists("../../texts/english.inc")) {
+} elseif (file_exists("../../texts/english.inc")) {
   include "../../texts/english.inc";
-}
-else {
+} else {
 	print "Cannot load english.inc, exit;";
 	exit;
 }
 if (file_exists("../texts/$language_module")) {
   include "../texts/$language_module";
-}
-else if (file_exists("texts/$language_module")) {
+} elseif (file_exists("texts/$language_module")) {
   include "texts/$language_module";
-}
-else if (file_exists("../../texts/$language_module")) {
+} elseif (file_exists("../../texts/$language_module")) {
   include "../../texts/$language_module";
-}
-else {
+} else {
 	print "Cannot load $language_module, exit";
 	exit;
 }
 if (file_exists("defaultconfig.inc")) {
   include "defaultconfig.inc";
-}
-else if (file_exists("admin/defaultconfig.inc")) {
+} elseif (file_exists("admin/defaultconfig.inc")) {
   include "admin/defaultconfig.inc";
-}
-else if (file_exists("../defaultconfig.inc")) {
+} elseif (file_exists("../defaultconfig.inc")) {
   include "../defaultconfig.inc";
-}
-else {
+} else {
   print "cannot load defaultconfig, exit";
 	exit;
 }
 if (file_exists("connect.php")) {
   include "connect.php";
-}
-else if (file_exists("admin/connect.php")) {
+} elseif (file_exists("admin/connect.php")) {
   include "admin/connect.php";
-}
-else if (file_exists("../connect.php")) {
+} elseif (file_exists("../connect.php")) {
   include "../connect.php";
-}
-else {
+} else {
 	print "Cannot load libraries connect, exit";
 	exit;
 }
 if (file_exists("languages.php")) {
   include "languages.php";
-}
-else if (file_exists("admin/languages.php")) {
+} elseif (file_exists("admin/languages.php")) {
   include "admin/languages.php";
-}
-else if (file_exists("../languages.php")) {
+} elseif (file_exists("../languages.php")) {
   include "../languages.php";
-}
-else {
+} else {
 	print "Cannot load language libraries, exit";
 	exit;
 }#ob_start(); # useful to be able to redirect after outputting
Index: modules/massmailer/engines/phplist/phplist.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/massmailer/engines/phplist/phplist.module,v
retrieving revision 1.32
diff -u -r1.32 phplist.module
--- modules/massmailer/engines/phplist/phplist.module	24 Mar 2006 01:33:53 -0000	1.32
+++ modules/massmailer/engines/phplist/phplist.module	28 Mar 2006 15:43:10 -0000
@@ -1,5 +1,5 @@
 <?php
-/* $Id: phplist.module,v 1.32 2006/03/24 01:33:53 killes Exp $ */
+/* $Id: phplist.module,v 1.31 2006/03/18 02:28:42 killes Exp $ */
 
 /**
  * @module phplist
@@ -315,6 +315,7 @@
         $group = array('id' => $gid);
         $group = crm_get_groups($group);
         $group_contact = array($contact);
+// var_dump($group_contact);
         crm_delete_group_contacts($group[0], $group_contact);
       }
       db_set_active();
@@ -621,25 +622,6 @@
  * @return boolean true if successful.
  */
 function phplist_remove_civicrm_group($lid, $gid) {
-  if (module_exist('civicrm')) {
-    civicrm_initialize(TRUE);
-    db_set_active('civicrm');
-    $group = array('id' => $gid);
-    $group = crm_get_groups($group);
-    $contacts = crm_get_group_contacts($group[0]);
-    db_set_active();
-    $addresses = array();
-    foreach ($contacts as $contact) {
-      $addresses[] = $contact->email;
-    }
-    if (count($addresses)) {
-      $result = db_query("SELECT id FROM {phplist_user_user} WHERE email IN (%s)", implode("','", $addresses));
-      while ($id = db_result($result)) {
-        db_query('DELETE FROM {phplist_listuser} WHERE userid = %d AND listid = %d', $id, $lid);
-      }
-    }
-    
-  }
   return db_query('DELETE FROM {phplist_civicrm_groups} WHERE lid = %d AND gid = %d', $lid, $gid);
 }
 
@@ -780,7 +762,7 @@
   else {
     $id = db_next_id('phplist_message');
     $msg = ($body_header ? $body_header ."\n\n" : '') . $body . ($footer ? "\n\n-- \n". $footer : '');
-    db_query('INSERT INTO {phplist_message} (id, subject, fromfield, message, footer, embargo, owner, entered, modified, status, htmlformatted, sendformat) VALUES (%d, \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'submitted\', %d, \'%s\')', $id, mime_header_encode($subject), $from, $msg, $footer, $embargo, $user->uid, date('Y-m-d'), date('YmdHis'), $message_type, $sendformat);
+    // db_query('INSERT INTO {phplist_message} (id, subject, fromfield, message, footer, embargo, owner, entered, modified, status, htmlformatted, sendformat) VALUES (%d, \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'submitted\', %d, \'%s\')', $id, mime_header_encode($subject), $from, $msg, $footer, $embargo, $user->uid, date('Y-m-d'), date('YmdHis'), $message_type, $sendformat);
   }
 
   db_query('DELETE FROM {phplist_listmessage} WHERE messageid=%d', $id);
@@ -799,7 +781,9 @@
  */
 function phplist_process_queue() {
 
-  if (module_exist('civicrm')) {
+	global $base_url;
+
+	if (module_exist('civicrm')) {
     civicrm_initialize(TRUE);
     $messages = db_query("SELECT m.id as mid FROM {phplist_message} m WHERE m.status = 'submitted' AND m.embargo <= '%s' ORDER BY m.embargo", date('Y-m-d H:i:s'));
 
@@ -844,9 +828,31 @@
     }
   }
 
-  return '<pre>'.shell_exec('env -i modules/massmailer/engines/phplist/bin/phplist -p processqueue -c ../../config.php -d '. $_SERVER['PHP_SELF'] .' -h '. $_SERVER['HTTP_HOST']).'</pre>';
+	if(!isset($_GET['confirm'])) {
+
+		$output .= t('<a href="%url-sendconfirm">Click here to continue to send</a>.',array('url-status', 'admin/massmailer/message','%url-sendconfirm'=>'admin/massmailer/queue?confirm=1'));
+
+		return $output;
+	}
+
+	$phplist_admin = db_fetch_object(db_query("SELECT password FROM {phplist_admin} WHERE loginname='admin'"));
+	if($phplist_admin->password) $postdata = array( 'login' => 'admin', 'password' => $phplist_admin->password );
+	else {
+		drupal_set_message('Process queue authentication failure');
+		return;
+	}
+   
+	$ch = curl_init();
+	curl_setopt($ch, CURLOPT_URL, $base_url.'/modules/massmailer/engines/phplist/phplist/admin/?page=processqueue' );
+	curl_setopt($ch, CURLOPT_POST, 1 );
+	curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+	echo str_replace('<head>',"<head><base href=\"$base_url/modules/massmailer/engines/phplist/phplist/admin/\">",curl_exec($ch));
+	exit;
+
 }
 
+
 /**
 * Returns contact emails from a CiviCRM group.
 *
