Page 1 of 1
[SOLVED]{editpage} tag with https (and SSL issues generally)
Posted: Thu Nov 30, 2017 1:07 pm
by Charles Butcher
I have just set up my site (
https://stanhoe.org) for SSL and noticed that the {editpage} tag contains a hard-coded "http://" link. This is probably no big deal, since everything is set up to serve https only, but it was flagged up by the software I used to check that all SSL-related stuff is in order.
For now I have simply edited the {editpage} function, but clearly this isn't the best approach. Is there a better way?
Any other CMSms-specific advice on moving to SSL? So far everything looks good, but I've realised this business is more complicated than just getting a certificate. I still should probably add a "strict-transport-security" header.
Re: {editpage} tag with https (and SSL issues generally)
Posted: Thu Nov 30, 2017 2:58 pm
by Charles Butcher
Sorry, I meant to post this in Product Support, since it concerns a core tag. But I can't see how to delete it, so I'll leave it here.
Re: {editpage} tag with https (and SSL issues generally)
Posted: Sun Dec 03, 2017 7:12 pm
by DIGI3
Are you sure this is a core tag? What version of CMSMS are you using?
Re: {editpage} tag with https (and SSL issues generally)
Posted: Sun Dec 03, 2017 10:53 pm
by Charles Butcher
Probably it isn't, in which case I apologise for posting.
I'm using CMSms 2.2.4.
`function.editpage.php` is in `assets/plugins`; having only recently upgraded from v1.x I'm a bit confused about what goes where, but to judge from the other items in this directory it isn't a core module.
Doesn't seem to be in the Forge, though. Code below. It's quite useful.
Code: Select all
<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://www.cmsmadesimple.org
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
function smarty_function_editpage($params, &$template)
{
$smarty = $template->smarty;
$gCms = cmsms();
$config = $gCms->GetConfig();
global $EDIT_PAGE;
$sessionID = $_SESSION['_userkey_'];
$rootUrl = $_SERVER['HTTP_HOST'];
$contentID = $smarty->getTemplateVars('content_id');
$EDIT_PAGE = '<a href="https://' . $rootUrl .'/' . $config['admin_dir'] .
'/moduleinterface.php?mact=CMSContentManager,m1_,admin_editcontent,0&_sk_=' . $sessionID . '&m1_content_id=' . $contentID . '" target="_blank">' . 'edit</a>';
return $EDIT_PAGE;
}
function smarty_cms_help_function_editpage()
{
echo ('
<p>Use within page templates to generate an \'edit this page\' and \'x Logout\' link.</p>
<p>Simply paste the following where you want it to appear within the template:</p>
<code>{editpage}</code>
');
}
function smarty_cms_about_function_editpage()
{
?>
<p>Author: Gregory Prosser <greg[at]stickywicketdesigns.com></p>
<p>Version: 1.0</p>
<p>
Change History:<br/>
None
</p>
<p>Taking a poke at a first plugin for CMSMS. Inspired by the likes of WP with the 'edit this page' when while logged in and viewing the frontend.</p>
<?php
}
?>
Re: {editpage} tag with https (and SSL issues generally)
Posted: Mon Dec 04, 2017 12:26 am
by DIGI3
Yeah it's not core, but if it still works then no problem.
You might want to look at
http://dev.cmsmadesimple.org/projects/cgactionbar
A bit more robust tool, and actively maintained.
Re: {editpage} tag with https (and SSL issues generally)
Posted: Mon Dec 04, 2017 10:41 am
by Charles Butcher
Thanks for that! It's nice that CG Action Bar gives quick editing access to news items as well as pages.
I'd mark this as solved, but I can't see how to edit my original post. It has a "quote" button, but no "edit" button…