? civicrm.php ? massmailer_without_cli.patch Index: engines/phplist/config.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/massmailer/engines/phplist/config.php,v retrieving revision 1.12 diff -u -p -r1.12 config.php --- engines/phplist/config.php 11 Nov 2005 02:23:40 -0000 1.12 +++ engines/phplist/config.php 29 Mar 2006 01:35:37 -0000 @@ -74,18 +74,19 @@ $usertable_prefix = $db_info['prefix']." // 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 .inc files in the texts directory @@ -109,7 +110,7 @@ define ("WARN_ABOUT_PHP_SETTINGS",1); # 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 Index: engines/phplist/phplist.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/massmailer/engines/phplist/phplist.module,v retrieving revision 1.32 diff -u -p -r1.32 phplist.module --- engines/phplist/phplist.module 24 Mar 2006 01:33:53 -0000 1.32 +++ engines/phplist/phplist.module 29 Mar 2006 01:35:38 -0000 @@ -780,7 +780,7 @@ function phplist_send_mail($lids, $mid, 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 +799,9 @@ function phplist_send_mail($lids, $mid, */ 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 +846,31 @@ function phplist_process_queue() { } } - return '
'.shell_exec('env -i modules/massmailer/engines/phplist/bin/phplist -p processqueue -c ../../config.php -d '. $_SERVER['PHP_SELF'] .' -h '. $_SERVER['HTTP_HOST']).'
'; + if(!isset($_GET['confirm'])) { + + $output .= t('Click here to continue to send.',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('',"",curl_exec($ch)); + exit; + } + /** * Returns contact emails from a CiviCRM group. *