Skip to content

Commit 941cdbd

Browse files
committed
Merge branch 'master' into master-michiel
2 parents 7baacc2 + 386bac6 commit 941cdbd

32 files changed

+337
-224
lines changed

.github/workflows/build-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
uses: actions/cache@v2
4444
with:
4545
path: /tmp/composer-cache
46-
key: ${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
46+
key: ${{ matrix.php-version }}-${{ env.RELEASE_VERSION }}-${{ hashFiles('**/composer.lock') }}
4747

4848
- name: Install dependencies
4949
uses: php-actions/composer@v5

.github/workflows/main.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ jobs:
3030
sudo apt update
3131
sudo apt install rsync
3232
33-
- name: Cache Composer dependencies
34-
uses: actions/cache@v2
35-
with:
36-
path: /tmp/composer-cache
37-
key: ${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
33+
# - name: Cache Composer dependencies
34+
# uses: actions/cache@v2
35+
# with:
36+
# path: /tmp/composer-cache
37+
# key: ${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
3838

3939
- name: Install dependencies
4040
uses: php-actions/composer@v6
@@ -88,10 +88,21 @@ jobs:
8888
firefox -v
8989
vendor/bin/behat -V
9090
91-
- name: Run BDD Tests
91+
- name: Run BDD Tests UI
9292
run: |
9393
cd $GITHUB_WORKSPACE/tests
94-
../vendor/bin/behat -p chrome --stop-on-failure --tags=@initialise
94+
../vendor/bin/behat -p chrome -f progress --stop-on-failure --tags=@initialise
95+
../vendor/bin/behat -p chrome -f progress --tags="~@initialise && ~@wip"
96+
97+
- name: Run BDD Tests CLI
98+
run: |
99+
cd $GITHUB_WORKSPACE
100+
101+
export ADMIN_PASSWORD=Mypassword123+
102+
export ORGANISATION_NAME="phpList"
103+
export ADMIN_NAME="phpList Administrator"
104+
php public_html/lists/admin/index.php -c $GITHUB_WORKSPACE/public_html/lists/config/config.php -p initialise -f
105+
cd $GITHUB_WORKSPACE/tests
95106
../vendor/bin/behat -p chrome --tags="~@initialise && ~@wip"
96107
97108
- name: Upload the screenshots

VERSION

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# file that keeps track of the latest tag in cvs and the corresponding version
22
# this automates publishing a new version, when it's tagged
33
# if you don't understand this, don't worry. You don't need this file
4-
VERSION=3.6.4
5-
DEVVERSION=3.6.5-RC1
4+
VERSION=3.6.6-RC2

composer.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public_html/lists/admin/actions/processqueue.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ function processQueueOutput($message, $logit = 1, $target = 'summary')
427427

428428
return;
429429
} else {
430-
$infostring = '['.date('D j M Y H:i', time()).'] ['.$_SERVER['REMOTE_ADDR'].']';
430+
$infostring = '['.date('D j M Y H:i', time()).'] ['.getClientIP().']';
431431
//print "$infostring $message<br/>\n";
432432
$lines = explode("\n", $message);
433433
foreach ($lines as $line) {
@@ -627,8 +627,10 @@ function sendEmailTest($messageid, $email)
627627
." where status not in ('draft', 'sent', 'prepared', 'suspended')"
628628
.' and embargo > now()'
629629
.' order by embargo asc limit 1');
630-
$counters['status'] = 'embargo';
631-
$counters['delaysend'] = $future['waittime'];
630+
if ($future) {
631+
$counters['status'] = 'embargo';
632+
$counters['delaysend'] = $future['waittime'];
633+
}
632634
}
633635

634636
$script_stage = 2; // we know the messages to process

public_html/lists/admin/class.phplistmailer.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ public function __construct($messageid, $email, $inBlast = true, $exceptions = f
8686
# logEvent('Sending email via PHPMAILERSUBSCRIBEHOST '.PHPMAILERSUBSCRIBEHOST);
8787
$this->Host = PHPMAILERSUBSCRIBEHOST;
8888
$this->Port = PHPMAILERSUBSCRIBEPORT;
89+
if (isset($GLOBALS['phpmailer_smtpuser']) && $GLOBALS['phpmailer_smtpuser'] != ''
90+
&& isset($GLOBALS['phpmailer_smtppassword']) && $GLOBALS['phpmailer_smtppassword']
91+
) {
92+
$this->Username = $GLOBALS['phpmailer_smtpuser'];
93+
$this->Password = $GLOBALS['phpmailer_smtppassword'];
94+
$this->SMTPAuth = true;
95+
}
8996
$this->Mailer = 'smtp';
9097
} elseif ($this->inBlast && defined('PHPMAILERBLASTHOST') && defined('PHPMAILERBLASTPORT') && PHPMAILERBLASTHOST != '') {
9198
$this->Host = PHPMAILERBLASTHOST;
@@ -178,7 +185,7 @@ public function __construct($messageid, $email, $inBlast = true, $exceptions = f
178185
// $this->addCustomHeader("Return-Receipt-To: ".$GLOBALS["message_envelope"]);
179186
}
180187
//# when the email is generated from a webpage (quite possible :-) add a "received line" to identify the origin
181-
if (!empty($_SERVER['REMOTE_ADDR'])) {
188+
if (!empty(getClientIP())) {
182189
$this->add_timestamp();
183190
}
184191
$this->messageid = $messageid;
@@ -200,7 +207,7 @@ public function add_timestamp()
200207
//0013076:
201208
// Add a line like Received: from [10.1.2.3] by website.example.com with HTTP; 01 Jan 2003 12:34:56 -0000
202209
// more info: http://www.spamcop.net/fom-serve/cache/369.html
203-
$ip_address = $_SERVER['REMOTE_ADDR'];
210+
$ip_address = getClientIP();
204211
if (!empty($_SERVER['REMOTE_HOST'])) {
205212
$ip_domain = $_SERVER['REMOTE_HOST'];
206213
} else {

public_html/lists/admin/connect.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555

5656
// identify pages that can be run on commandline
5757
$commandline_pages = array(
58+
'initialise',
5859
'dbcheck',
5960
'send',
6061
'processqueue',
@@ -1793,6 +1794,9 @@ function monthName($month, $short = 0)
17931794
*/
17941795
function formatDate($date, $short = 0)
17951796
{
1797+
if ($date == '') {
1798+
return '';
1799+
}
17961800
$format = getConfig('date_format');
17971801
$year = substr($date, 0, 4);
17981802
$month = substr($date, 5, 2);

public_html/lists/admin/editlist.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@
135135
?>
136136

137137
<?php echo formStart(' class="editlistSave" ') ?>
138-
<input type="hidden" name="id" value="<?php echo $id ?>"/>
138+
<?php if ($id): ?>
139+
<div class="label"><label><?php echo s('List ID'); ?>:</label><?php echo $id ?></div>
140+
<?php endif;?>
139141
<div class="label"><label for="listname"><?php echo s('List name'); ?>:</label></div>
140142
<div class="field"><input type="text" name="listname"
141143
value="<?php echo htmlspecialchars(stripslashes($list['name'])) ?>"/></div>
@@ -191,7 +193,6 @@
191193
}
192194

193195
?>
194-
<form>
195196
<label for="description"><?php echo s('List Description'); ?></label>
196197
<div class="field"><textarea name="description" cols="35" rows="5">
197198
<?php echo htmlspecialchars(stripslashes($list['description'])) ?></textarea></div>

public_html/lists/admin/inc/netlib.php

Lines changed: 0 additions & 53 deletions
This file was deleted.

public_html/lists/admin/inc/userlib.php

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function deleteUserBlacklistRecords($id)
129129
function deleteUserRecordsLeaveBlacklistRecords($id)
130130
{
131131
global $tables;
132-
132+
133133
Sql_Query('delete from '.$tables['linktrack_uml_click'].' where userid = '.$id);
134134
Sql_Query('delete from '.$tables['listuser'].' where userid = '.$id);
135135
Sql_Query('delete from '.$tables['usermessage'].' where userid = '.$id);
@@ -156,7 +156,7 @@ function deleteUserLeaveBlacklist($id)
156156
*/
157157
function deleteUserIncludeBlacklist($id)
158158
{
159-
// Note: deleteUserBlacklistRecords() must be executed first, else the ID
159+
// Note: deleteUserBlacklistRecords() must be executed first, else the ID
160160
// to email lookup fails due to the missing record
161161
deleteUserBlacklistRecords($id);
162162
deleteUserRecordsLeaveBlacklistRecords($id);
@@ -206,7 +206,7 @@ function addNewUser($email, $password = '')
206206
entered = now(),modified = now(),password = "%s",
207207
passwordchanged = now(),disabled = 0,
208208
uniqid = "%s",htmlemail = 1, uuid = "%s"
209-
', $GLOBALS['tables']['user'], $email, $blacklist, $passwordEnc, getUniqid(), (string) uuid::generate(4)));
209+
', $GLOBALS['tables']['user'], sql_escape($email), $blacklist, $passwordEnc, getUniqid(), (string) uuid::generate(4)));
210210

211211
$id = Sql_Insert_Id();
212212

@@ -312,8 +312,8 @@ function AttributeValue($table, $value)
312312
function getUserEmail($id)
313313
{
314314
global $tables;
315-
316-
$userid = Sql_Fetch_Row_Query("select email from {$tables['user']} where id = \"$id\"");
315+
316+
$userid = Sql_Fetch_Row_Query("select email from {$tables['user']} where id = \"$id\"");
317317
return $userid[0];
318318
}
319319

@@ -416,7 +416,7 @@ function UserAttributeValue($user = 0, $attribute = 0)
416416
case 'checkboxgroup':
417417
// print "select value from $user_att_table where userid = $user and attributeid = $attribute";
418418
$val_ids = Sql_Fetch_Row_Query("select value from $user_att_table where userid = $user and attributeid = $attribute");
419-
if ($val_ids[0]) {
419+
if ($val_ids && $val_ids[0]) {
420420
// print '<br/>1 <b>'.$val_ids[0].'</b>';
421421
if (function_exists('cleancommalist')) {
422422
$val_ids[0] = cleanCommaList($val_ids[0]);
@@ -457,13 +457,13 @@ function UserAttributeValue($user = 0, $attribute = 0)
457457
$table_prefix".'listattr_'.$att['tablename'].".id = $user_att_table".".value and
458458
$user_att_table".'.attributeid = '.$attribute);
459459
$row = Sql_Fetch_row($res);
460-
$value = $row[0];
460+
$value = $row ? $row[0] : '';
461461
break;
462462
default:
463463
$res = Sql_Query(sprintf('select value from %s where
464464
userid = %d and attributeid = %d', $user_att_table, $user, $attribute));
465465
$row = Sql_Fetch_row($res);
466-
$value = $row[0];
466+
$value = $row ? $row[0] : '';
467467
}
468468

469469
return stripslashes($value);
@@ -588,7 +588,7 @@ function addEmailToBlackList($email, $reason = '', $date = '')
588588
Sql_Query(sprintf('insert ignore into %s (email,name,data) values("%s","%s","%s")',
589589
$GLOBALS['tables']['user_blacklist_data'], sql_escape($email),
590590
'reason', addslashes($reason)));
591-
foreach (array('REMOTE_ADDR') as $item) { // @@@do we want to know more?
591+
foreach (array('REMOTE_ADDR','HTTP_X_FORWARDED_FOR') as $item) { // @@@do we want to know more?
592592
if (isset($_SERVER[$item])) {
593593
Sql_Query(sprintf('insert ignore into %s (email,name,data) values("%s","%s","%s")',
594594
$GLOBALS['tables']['user_blacklist_data'], addslashes($email),
@@ -829,7 +829,7 @@ function addUserHistory($email, $msg, $detail)
829829
}
830830
}
831831
} else {
832-
$default = array('HTTP_USER_AGENT', 'HTTP_REFERER', 'REMOTE_ADDR', 'REQUEST_URI');
832+
$default = array('HTTP_USER_AGENT', 'HTTP_REFERER', 'REMOTE_ADDR', 'REQUEST_URI','HTTP_X_FORWARDED_FOR');
833833
foreach ($sysarrays as $key => $val) {
834834
if (in_array($key, $default)) {
835835
$sysinfo .= "\n".strip_tags($key).' = '.htmlspecialchars($val);
@@ -839,13 +839,8 @@ function addUserHistory($email, $msg, $detail)
839839

840840
$userid = Sql_Fetch_Row_Query("select id from $user_table where email = \"$email\"");
841841
if ($userid[0]) {
842-
if (isset($_SERVER['REMOTE_ADDR'])) {
843-
$ip = $_SERVER['REMOTE_ADDR'];
844-
} else {
845-
$ip = '';
846-
}
847842
Sql_Query(sprintf('insert into %s (ip,userid,date,summary,detail,systeminfo)
848-
values("%s",%d,now(),"%s","%s","%s")', $user_his_table, $ip, $userid[0], sql_escape($msg),
843+
values("%s",%d,now(),"%s","%s","%s")', $user_his_table, getClientIP(), $userid[0], sql_escape($msg),
849844
sql_escape(htmlspecialchars($detail)), sql_escape($sysinfo)));
850845
}
851846
}

0 commit comments

Comments
 (0)