Skip to content

Commit eb8ccf4

Browse files
author
Sam Tuke
authored
Merge branch 'master' into phplist4-restapi
2 parents c2ff273 + 30f4b86 commit eb8ccf4

File tree

7 files changed

+175
-83
lines changed

7 files changed

+175
-83
lines changed

public_html/lists/admin/defaultconfig.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,12 @@
9898
'allowempty' => true,
9999
'category' => 'general',
100100
),
101-
102-
// how often to check for new versions of PHPlist
103-
'check_new_version' => array(
104-
'value' => '7',
105-
'description' => s('How often do you want to check for a new version of phplist (days)'),
106-
'type' => 'integer',
107-
'min' => 1,
108-
'max' => 180,
109-
'category' => 'security',
101+
'rc_notification' => array(
102+
'value' => 0,
103+
'description' => s('Show notification for Release Candidates'),
104+
'type' => 'boolean',
105+
'allowempty' => true,
106+
'category' => 'system',
110107
),
111108

112109
//# remote processing secret
@@ -543,7 +540,7 @@
543540
'value' =>
544541
'You have requested your personal location to update your details in our newsletter database.
545542
The location is below. Please make sure that you use the full line as mentioned below.
546-
Sometimes email programmes can wrap the line into multiple lines.
543+
Sometimes email programs wrap the link over multiple lines.
547544
548545
Your personal location is:
549546
[PREFERENCESURL]

public_html/lists/admin/home.php

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -29,53 +29,6 @@
2929
//# trigger this somewhere else?
3030
refreshTlds();
3131

32-
// check for latest version
33-
$checkinterval = sprintf('%d', getConfig('check_new_version'));
34-
if (empty($checkinterval)) {
35-
$checkinterval = 7;
36-
}
37-
38-
$showUpdateAvail = !empty($_GET['showupdate']); //# just to check the design
39-
$thisversion = VERSION;
40-
$thisversion = preg_replace("/[^\.\d]/", '', $thisversion);
41-
$latestversion = getConfig('updateavailable');
42-
$showUpdateAvail = $showUpdateAvail || (!empty($latestversion) && !versionCompare($thisversion, $latestversion));
43-
44-
if (!$showUpdateAvail && $checkinterval) {
45-
46-
//#https://mantis.phplist.com/view.php?id=16815
47-
$query = sprintf('select date_add(value, interval %d day) < now() as needscheck from %s where item = "updatelastcheck"',
48-
$checkinterval, $tables['config']);
49-
$needscheck = Sql_Fetch_Row_Query($query);
50-
if ($needscheck[0] != '0') {
51-
@ini_set('user_agent', NAME.' (phplist version '.VERSION.')');
52-
@ini_set('default_socket_timeout', 5);
53-
if ($fp = @fopen('https://www.phplist.com/files/LATESTVERSION', 'r')) {
54-
$latestversion = fgets($fp);
55-
$latestversion = preg_replace("/[^\.\d]/", '', $latestversion);
56-
@fclose($fp);
57-
if (!versionCompare($thisversion, $latestversion)) {
58-
//# remember this, so we can remind about the update, without the need to check the phplist site
59-
//# hmmm, this causes it to be "stuck" on the last version checked
60-
SaveConfig('updateavailable', $latestversion, 0, true);
61-
$showUpdateAvail = true;
62-
}
63-
}
64-
SaveConfig('updatelastcheck', date('Y-m-d H:i:s', time()), 0, true);
65-
}
66-
}
67-
68-
if ($showUpdateAvail) {
69-
echo '<div class="newversion note">';
70-
echo s('A new version of phpList is available!');
71-
echo '<br/>';
72-
echo '<br/>'.s('The new version may have fixed security issues,<br/>so it is recommended to upgrade as soon as possible');
73-
echo '<br/>'.s('Your version').': <b>'.$thisversion.'</b>';
74-
echo '<br/>'.s('Latest version').': <b>'.$latestversion.'</b><br/> ';
75-
echo '<a href="https://www.phplist.com/latestchanges?utm_source=pl'.$thisversion.'&amp;utm_medium=updatenews&amp;utm_campaign=phpList" title="'.s('Read what has changed in the new version').'" target="_blank">'.$GLOBALS['I18N']->get('View what has changed').'</a>&nbsp;&nbsp;';
76-
echo '<a href="https://www.phplist.com/download?utm_source=pl'.$thisversion.'&amp;utm_medium=updatedownload&amp;utm_campaign=phpList" title="'.s('Download the new version').'" target="_blank">'.$GLOBALS['I18N']->get('Download').'</a></div>';
77-
}
78-
7932
echo '<div class="accordion">';
8033

8134
$some = 0;

public_html/lists/admin/index.php

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,38 @@ function mb_strtolower($string)
519519
if (TEST) {
520520
echo Info($GLOBALS['I18N']->get('Running in testmode, no emails will be sent. Check your config file.'));
521521
}
522-
$updaterdir = __DIR__ . '/../updater';
523-
if(file_exists($updaterdir) && ALLOW_UPDATER){
524-
echo Info(s('Try automatic updater').' <a href="?page=redirecttoupdater" title="'.s('automatic updater').'">'.s('here').'</a>'.' ('.s('beta').')');
522+
523+
if (!strpos(VERSION, 'dev')){
524+
525+
$updaterdir = __DIR__ . '/../updater';
526+
527+
include 'updateLib.php';
528+
529+
if (showUpdateNotification()) {
530+
try {
531+
532+
$updateNotif = checkForUpdate('init.php');
533+
534+
} catch (Exception $e) {
535+
536+
echo s('Error: '), $e->getMessage(), "\n";
537+
538+
}
539+
540+
$moreInfo = '<a href="https://www.phplist.com/download?utm_source=pl' . VERSION . '&amp;utm_medium=updatedownload&amp;utm_campaign=phpList" title="' . s('Download the new version') . '" target="_blank">' . s('Download the new version') . '</a>';
541+
542+
if (file_exists($updaterdir) && ALLOW_UPDATER) {
543+
544+
$moreInfo .= s(' or update') . ' <a href="?page=redirecttoupdater" title="' . s('automatic updater') . '">' . s('here.') . '</a>';
545+
}
546+
547+
if ($updateNotif !== '') {
548+
549+
Info($updateNotif . '' . $moreInfo);
550+
}
551+
}
525552
}
553+
526554
if (version_compare(PHP_VERSION, '5.3.3', '<') && WARN_ABOUT_PHP_SETTINGS) {
527555
Error(s('Your PHP version is out of date. phpList requires PHP version 5.3.3 or higher.'));
528556
}

public_html/lists/admin/initialise.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@ function output($message)
182182
output( s('Setting default configuration').'<br/>');
183183
// mark the database to be our current version
184184
SaveConfig('version', VERSION, 0);
185-
// mark now to be the last time we checked for an update
186-
SaveConfig('updatelastcheck', date('Y-m-d H:i:s', time()), 0, true);
187185
SaveConfig('admin_address', $adminemail, 1);
188186
SaveConfig('message_from_name', strip_tags($_REQUEST['adminname']), 1);
189187
SaveConfig('campaignfrom_default', "$adminemail ".strip_tags($_REQUEST['adminname']));
@@ -194,6 +192,7 @@ function output($message)
194192
SaveConfig('message_from_name', strip_tags($_REQUEST['adminname']));
195193
SaveConfig('message_replyto_address', $adminemail);
196194
SaveConfig('secret', bin2hex(random_bytes(20)));
195+
SaveConfig('lastcheckupdate', date('m/d/Y h:i:s', time()), 0, true);
197196

198197
if (!empty($_REQUEST['orgname'])) {
199198
SaveConfig('organisation_name', strip_tags($_REQUEST['orgname']), 1);
@@ -250,4 +249,4 @@ function output($message)
250249
s('Upgrade')).' '.s('instead?').'</li>
251250
<li>' .PageLinkButton('initialise', s('Force Initialisation'),
252251
'force=yes').' '.s('(will erase all data!)').' '."</li></ul></div>\n";
253-
}
252+
}

public_html/lists/admin/js/phplistapp.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function openHelpDialog(url) {
110110
var destpage = urlParameter('page', url);
111111
url = url.replace(/page=/, 'origpage=');
112112
$("#dialog").load(url + '&ajaxed=true&page=pageaction&action=' + destpage);
113-
$(".ui-widget-overlay").on('click', function () {
113+
$(".ui-widget-overlay").on("click",function () {
114114
$("#dialog").dialog('close');
115115
});
116116
}
@@ -133,7 +133,7 @@ function totalSentUpdate(msgid) {
133133
}
134134

135135
$(document).ready(function () {
136-
$(".note .hide").on('click',function () {
136+
$(".note .hide").on("click",function () {
137137
$(this).parents('.note').hide();
138138
});
139139

@@ -143,7 +143,7 @@ $(document).ready(function () {
143143
}
144144
});
145145

146-
$("a.ajaxable").on('click',function () {
146+
$("a.ajaxable").on("click",function () {
147147
var url = this.href;
148148
var thispage = urlParameter('page', window.location.href);
149149
if (thispage == "") {
@@ -161,7 +161,7 @@ $(document).ready(function () {
161161
return false;
162162
});
163163

164-
$("input:checkbox.checkallcheckboxes").on('click',function () {
164+
$("input:checkbox.checkallcheckboxes").on("click",function () {
165165
if (this.checked) {
166166
$("input[type=checkbox]:not(:checked)").each(function () {
167167
this.checked = true;
@@ -193,12 +193,12 @@ $(document).ready(function () {
193193
e.preventDefault();
194194
});
195195

196-
$(".closedialog").on('click',function () {
196+
$(".closedialog").on("click",function () {
197197
$("#dialog").dialog('close');
198198
});
199199

200200
//dropbuttons
201-
$("div.dropButton img.arrow").on('click',function () {
201+
$("div.dropButton img.arrow").on("click",function () {
202202
submenu = $(this).parent().parent().find("div.submenu");
203203
if (submenu.css('display') == "block") {
204204
submenu.hide();
@@ -239,47 +239,47 @@ $(document).ready(function () {
239239
$(".tabbed1").tabs();
240240
}
241241

242-
$("#subjectinput").trigger("focus",function () {
242+
$("#subjectinput").on("focus",function () {
243243
if (this.value == '(no subject)') {
244244
this.value = "";
245245
}
246246
})
247-
$("#subjectinput").on('blur',function () {
247+
$("#subjectinput").on("blur",function () {
248248
if (this.value == "") {
249249
this.value = "(no subject)";
250250
return;
251251
}
252252
});
253-
$("#campaigntitleinput").trigger("focus",function () {
253+
$("#campaigntitleinput").on("focus",function () {
254254
if (this.value == '(no title)') {
255255
this.value = "";
256256
}
257257
})
258-
$("#campaigntitleinput").on('blur',function () {
258+
$("#campaigntitleinput").on("blur",function () {
259259
if (this.value == "") {
260260
this.value = "(no title)";
261261
return;
262262
}
263263
});
264-
$("#remoteurlinput").trigger("focus",function () {
264+
$("#remoteurlinput").on("focus",function () {
265265
if (this.value == 'e.g. https://www.phplist.com/testcampaign.html') {
266266
this.value = "";
267267
}
268268
})
269-
$("#remoteurlinput").on('blur',function () {
269+
$("#remoteurlinput").on("blur",function () {
270270
if (this.value == "") {
271271
this.value = "e.g. https://www.phplist.com/testcampaign.html";
272272
return;
273273
}
274274
$("#remoteurlstatus").html(busyImage);
275275
$("#remoteurlstatus").load("./?page=pageaction&action=checkurl&ajaxed=true&url=" + this.value);
276276
});
277-
$("#filtertext").trigger("focus",function () {
277+
$("#filtertext").on("focus",function () {
278278
if (this.value == ' --- filter --- ') {
279279
this.value = "";
280280
}
281281
})
282-
$("#filtertext").on('blur',function () {
282+
$("#filtertext").on("blur",function () {
283283
if (this.value == "") {
284284
this.value = " --- filter --- ";
285285
return;
@@ -298,7 +298,7 @@ $(document).ready(function () {
298298

299299

300300

301-
$("a.savechanges").on('click',function () {
301+
$("a.savechanges").on("click",function () {
302302
if (changed) {
303303
document.sendmessageform.followupto.value = this.href;
304304
document.location.hash = ""
@@ -404,12 +404,12 @@ $(document).ready(function () {
404404
});
405405
});
406406

407-
$("#processexport").on('click',function () {
407+
$("#processexport").on("click",function () {
408408
// for export, refresh underlying page, to get a new security token
409409
setTimeout("refreshExport()", 10000);
410410
})
411411

412-
$("#selectallcheckbox").on('click',function () {
412+
$("#selectallcheckbox").on("click",function () {
413413
$(':checkbox').prop('checked', this.checked);
414414
})
415415

@@ -422,14 +422,14 @@ $(document).ready(function () {
422422
// $("#processqueueoutput").html('Processing queue, please wait<script type="text/javascript">alert(document.location)</script>');
423423
$("#spinner").html(busyImage);
424424

425-
$("#stopqueue").on('click', function () {
425+
$("#stopqueue").on("click",function () {
426426
$("#processqueueoutput").html('Processing cancelled');
427427
$("#spinner").html('&nbsp;');
428428
$("#stopqueue").hide();
429429
$("#resumequeue").show();
430430
});
431431

432-
$(".updatepluginbutton").on('click',function () {
432+
$(".updatepluginbutton").on("click",function () {
433433
if (!confirm("Are you sure you want to update this plugin? \nphpList does not currently check on compatibility of the update.\nThis will just fetch the latest version.\nPlease verify before upgrading.")) {
434434
return false;
435435
}

0 commit comments

Comments
 (0)