diff --git a/.gitignore b/.gitignore index 24ffbcc7..fcc03b96 100644 --- a/.gitignore +++ b/.gitignore @@ -10,15 +10,17 @@ moduleinfo.ini *OLD UNUSED* HIDE* -MANIFEST* +#MANIFEST* uploads/ #work in progress build.ini build_release.ini +create_langdiff.ini create_manifest.ini -create_manifest.ini.bak assets/resources/ -phar_installer/out/ +#phar_installer/out/* phar_installer/assets/install/uploadfiles/ #non-en translations -ext/ +**/lang/ext/*.php +**/lang/**/ext/*.php +.svn diff --git a/README.md b/README.md index 9172f5da..923a5621 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ # CMSMS22XDev -Development work on the CMSMS 2.2.x series +Here be no dragons. Merely an effective, good-looking, bugfixed, extensively-tested version of [CMS Made Simple](https://www.cmsmadesimple.org) version 2.2. + +Suitable for PHP's 7.1 to 8.5. + +Formerly destined to become a CMSMS 2.2 micro-release. + +The one that got away. Anyone interested, put a line in the water and reel this one in. + +Installers are available [here](https://www.dropbox.com/scl/fo/e1v1s5n8ng4c4cxhycm8y/h?rlkey=wbp3d4v1qb7vpq7k2a8w31q03&st=6vbso91j&dl=0). + +To be completely clear **this is not a CMSMS release, actual or official or any other status**. diff --git a/admin/addbookmark.php b/admin/addbookmark.php index e6d278d0..9f243b8b 100644 --- a/admin/addbookmark.php +++ b/admin/addbookmark.php @@ -1,7 +1,6 @@ # #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 @@ -16,103 +15,106 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: addbookmark.php 12671 2021-12-13 03:05:01Z tomphantoo $ +#$Id$ -$CMS_ADMIN_PAGE=1; +$CMS_ADMIN_PAGE = 1; -require_once("../lib/include.php"); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +require_once '../lib/include.php'; +$secureparm = CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; check_login(); -$error = ""; +if (isset($_POST['cancel'])) { + redirect('listbookmarks.php?'.$secureparm); +} -$title= ""; -if (isset($_POST["title"])) $title = trim(cleanValue($_POST["title"])); -$url = ""; -if (isset($_POST["url"])) $url = trim(cleanValue($_POST["url"])); +$title = ''; +if (isset($_POST['title'])) { + $title = trim(cleanValue($_POST['title'])); +} +elseif (isset($_GET['title'])) { + // adding an admin url from the bookmarks popup + $tmp = trim($_GET['title']); //TODO support cleanValue() + $title = urldecode($tmp); +} -if (isset($_POST["cancel"])) { - redirect("listbookmarks.php".$urlext); - return; +$error = ''; +$url = ''; +if (isset($_POST['url'])) { + $url = trim(cleanValue($_POST['url'])); } +elseif (isset($_GET['ref'])) { + // adding an admin url + $tmp = trim(cleanValue($_GET['ref'])); + $url = base64_decode($tmp, true); +} +if ($url) { + $url = html_entity_decode($url); + $url = urldecode($url); + $url = str_replace('[ROOT_URL]', CMS_ROOT_URL, $url); + if (strpos($url, '[SECURITYTAG]') !== false) { // deprecated + $url = str_replace('[SECURITYTAG]', $secureparm, $url); // allow parsing + } -$userid = get_userid(); + $res = cms_utils::validate_url($url, '!'.CMSMS\FileType::TYPE_EXECUTABLE); + if ($res !== true) { + $error = $res; + unset($_POST['addbookmark']); + } -if (isset($_POST["addbookmark"])) - { - $validinfo = true; + // reinstate placeholder if any + $url = str_replace($secureparm, '[SECURITYTAG]', $url); + $config = cms_config::get_instance(); + if (startswith($url, $config['admin_url'])) { + //TODO somewhere apply a permission-check akin to admin menu generation + if (strpos($url, '[SECURITYTAG]') === false) { + unset($_POST['addbookmark']); + $error = lang('error_badfield', lang('url')); //repetition ok + } + } + elseif (strpos($url, '[SECURITYTAG]') !== false) { + unset($_POST['addbookmark']); + $error = lang('error_badfield', lang('url')); //repetition ok + } +} // url - if ( $title == "" ) - { - $error .= lang('nofieldgiven', array(lang('title'))); +if (isset($_POST['addbookmark'])) { + $validinfo = true; + if ($title == '') { + $error .= lang('nofieldgiven', lang('title')); $validinfo = false; - } - else if ( $url == "" ) - { - $error .= lang('nofieldgiven', array(lang('url'))); + } + elseif ($url == '') { + $error .= lang('nofieldgiven', lang('url')); // joined error string? $validinfo = false; - } + } - if ($validinfo) - { - $gCms = cmsms(); - $gCms->GetBookmarkOperations(); + if ($validinfo) { $markobj = new Bookmark(); $markobj->title = $title; - $markobj->url = $url; - $markobj->user_id=$userid; + $markobj->url = $url; // revert any encoding removed during parsing ? + $markobj->user_id = get_userid(); $result = $markobj->save(); - if ($result) - { - redirect("listbookmarks.php".$urlext); - return; - } - else - { + if ($result) { + redirect('listbookmarks.php?'.$secureparm); + } + else { $error .= lang('errorinsertingbookmark'); - } } } +} -include_once("header.php"); - -if ($error != "") - { - echo '
'.$error.'
".lang('noaccessto', array(lang('addgroup')))."
'.$error.'
$text
$text
".lang("module_name").":
\n"; - echo "".$modulename."
\n"; - echo "".lang("event_name").":
\n"; - echo "".$event."
\n"; - echo "".lang("event_description").":
\n"; - echo "".$description."
\n"; - echo "| ".lang('order')." | \n"; - echo "".lang('user_tag')." | \n"; - echo "".lang('module')." | \n"; - echo "\n"; - echo " | \n"; - echo " | \n"; - echo " | |||
|---|---|---|---|---|---|---|---|---|
| ".$onehandler['handler_order']." | \n"; - echo "".$onehandler['tag_name']." | \n"; - echo "".$onehandler['module_name']." | \n"; - if( $idx != 0 ) { - echo "$upImg | \n"; - } - else { - echo ""; - } - if( $idx + 1 != count($handlers) ) { - echo " | $downImg | \n"; - } - else { - echo ""; - } - if( $onehandler['removable'] == 1 ) { - echo " | $deleteImg | \n"; - } - else { - echo "\n"; - } - echo " |
| "; - echo " |
".lang('noaccessto', array(lang('editgroup')))."
" . lang('description') . ": " . $desctext . "
"; - if( $text == "" ) { - echo "No helptext available..."; + } + else { + $desctext = ''; + $text = 'No helptext available...'; + } } - else { - echo $text; + if( $text && strpos($text,'Parameters') !== false ) { + $text = str_replace('Parameters',lang('parameters'),$text); } + $handlers = Events::ListEventHandlers($originator,$event,true); //array, maybe empty - echo "'.lang('none').'
'; - } - else { - echo '| ".lang('originator')." | \n"; - echo "".lang('event')." | \n"; - echo "".lang('eventhandler')." | \n"; - echo "".lang('description')." | \n"; - echo "\n"; - echo " | \n"; - echo " | |
|---|---|---|---|---|---|---|
| ".lang('core')." | \n"; - } - else if ( ($objinstance = cms_utils::get_module($oneevent['originator'])) ) { - $desctext = $objinstance->GetEventDescription($oneevent['event_name']); - echo "".$objinstance->GetFriendlyName()." | \n"; - } - echo ""; -if ($access) -{ - echo ""; -} - echo $oneevent['event_name']; -if ($access) -{ - echo ""; -} - echo " | \n"; - echo ""; - if ($oneevent['usage_count'] > 0) - { - echo "". - $oneevent['usage_count'].""; - } - echo " | \n"; - echo "".$desctext." | \n"; - echo "".$infoImg." | \n"; -if ($access) -{ - echo "".$editImg." | \n"; -} - echo "