diff --git a/pages/home.php b/pages/home.php new file mode 100644 index 0000000..47b31db --- /dev/null +++ b/pages/home.php @@ -0,0 +1,197 @@ +get('Your database is out of date, please make sure to upgrade').'
'. + $GLOBALS['I18N']->get('Your version').' : '.$dbversion.'
'. + $GLOBALS['I18N']->get('phplist version').' : '.VERSION. + '
'.PageLink2('upgrade', $GLOBALS['I18N']->get('Upgrade')) + ); + $upgrade_required = 1; + } +} else { + Info($GLOBALS['I18N']->get('Database has not been initialised').'. '. + $GLOBALS['I18N']->get('go to').' '. + PageLink2('initialise&firstinstall=1', $GLOBALS['I18N']->get('Initialise Database')).' '. + $GLOBALS['I18N']->get('to continue'), 1); + $GLOBALS['firsttime'] = 1; + $_SESSION['firstinstall'] = 1; + + return; +} + +//# trigger this somewhere else? +refreshTlds(); + +// check for latest version +$checkinterval = sprintf('%d', getConfig('check_new_version')); +if (empty($checkinterval)) { + $checkinterval = 7; +} + +$showUpdateAvail = !empty($_GET['showupdate']); //# just to check the design +$thisversion = VERSION; +$thisversion = preg_replace("/[^\.\d]/", '', $thisversion); +$latestversion = getConfig('updateavailable'); +$showUpdateAvail = $showUpdateAvail || (!empty($latestversion) && !versionCompare($thisversion, $latestversion)); + +if (!$showUpdateAvail && $checkinterval) { + + //#https://mantis.phplist.com/view.php?id=16815 + $query = sprintf('select date_add(value, interval %d day) < now() as needscheck from %s where item = "updatelastcheck"', + $checkinterval, $tables['config']); + $needscheck = Sql_Fetch_Row_Query($query); + if ($needscheck[0] != '0') { + @ini_set('user_agent', NAME.' (phplist version '.VERSION.')'); + @ini_set('default_socket_timeout', 5); + if ($fp = @fopen('https://www.phplist.com/files/LATESTVERSION', 'r')) { + $latestversion = fgets($fp); + $latestversion = preg_replace("/[^\.\d]/", '', $latestversion); + @fclose($fp); + if (!versionCompare($thisversion, $latestversion)) { + //# remember this, so we can remind about the update, without the need to check the phplist site + //# hmmm, this causes it to be "stuck" on the last version checked + SaveConfig('updateavailable', $latestversion, 0, true); + $showUpdateAvail = true; + } + } + SaveConfig('updatelastcheck', date('Y-m-d H:i:s', time()), 0, true); + } +} + +if ($showUpdateAvail) { + echo '
'; + echo s('A new version of phpList is available!'); + echo '
'; + echo '
'.s('The new version may have fixed security issues,
so it is recommended to upgrade as soon as possible'); + echo '
'.s('Your version').': '.$thisversion.''; + echo '
'.s('Latest version').': '.$latestversion.'
'; + echo ''.$GLOBALS['I18N']->get('View what has changed').'  '; + echo ''.$GLOBALS['I18N']->get('Download').'
'; +} + + +if ($_SESSION['logindetails']['superuser']) { + $lastCampaignID = Sql_Fetch_Row_query(sprintf('select id from %s where sent is not null order by entered desc limit 1',$GLOBALS['tables']['message'])); +} else { + $lastCampaignID = Sql_Fetch_Row_query(sprintf('select msg.id from %s msg + join %s lm on lm.messageid = msg.id + join %s list on list.id = lm.listid + where sent is not null + and list.owner = %d + order by msg.entered desc limit 1', + $GLOBALS['tables']['message'],$GLOBALS['tables']['listmessage'],$GLOBALS['tables']['list'],$_SESSION['logindetails']['id'])); +} + +if ($_SESSION['logindetails']['superuser']) { + $lastcampaign = Sql_Fetch_Assoc_Query(sprintf('select msg.id as messageid,count(um.viewed) as views, count(um.status) as total, + subject,date_format(sent,"%%e %%M %%Y") as sent,bouncecount as bounced from %s um,%s msg + where um.messageid = msg.id and sent is not null and um.status = "sent" + group by msg.id order by msg.entered desc limit 1', + $GLOBALS['tables']['usermessage'], $GLOBALS['tables']['message'])); + $subscribercountreq = Sql_Fetch_Row_Query(sprintf('select count(*) from %s', $GLOBALS['tables']['user'])); + $subscribercount = $subscribercountreq[0]; +} else { + $lastcampaign = Sql_Fetch_Assoc_Query(sprintf('select msg.id as messageid,count(um.viewed) as views, count(um.status) as total, + subject,date_format(sent,"%%e %%b %%Y") as sent,bouncecount as bounced from + %s um join %s msg on um.messageid = msg.id + join %s lm on lm.messageid = msg.id + join %s list on list.id = lm.listid + where sent is not null and um.status = "sent" + and list.owner = %d + group by msg.id order by msg.sent desc limit 1', + $GLOBALS['tables']['usermessage'], $GLOBALS['tables']['message'], $GLOBALS['tables']['listmessage'],$GLOBALS['tables']['list'],$_SESSION['logindetails']['id'] )); + $subscribercountreq = Sql_Fetch_Row_Query(sprintf('select count(*) from %s user + left join %s listuser on user.id = listuser.userid + left join %s list on listuser.listid = list.id + where list.owner = %d', $GLOBALS['tables']['user'], $GLOBALS['tables']['listuser'], $GLOBALS['tables']['list'],$_SESSION['logindetails']['id'])); + $subscribercount = $subscribercountreq[0]; +} + +?> +
+ +
+

Getting Started

+
+ ' . s('Import Subscribers') . ' +
'; + } + if (!in_array('send', $GLOBALS['disallowpages'])) { + echo '' . s('Start or continue a campaign') . ' +
'; + } + if (!in_array('statsoverview', $GLOBALS['disallowpages'])) { // are we allowed to view stats + if (!empty($lastCampaignID)) { // are there any + echo '' . s('View Statistics') . ' +
'; + } else { + echo ' + ' . s('View Statistics') . ' + +
'; + } + } + ?> +
+
+ + +
+

Last Campaign Results

+
+ ' . s('There are currently no statistics available') . '

'; +} else { + ?> + +

+ + Subject: + + + + +

+ +

Messages sent on .

+

Viewed (%), and bounced (%).

+ + + +
+
+ +
+ +
+

+ +
+ +
+