Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
2471 commits
Select commit Hold shift + click to select a range
e18c046
replace deprecated method
tom2tom Feb 21, 2026
d1624a2
add comment
tom2tom Feb 21, 2026
f91b1dd
conform methods' return-value
tom2tom Feb 21, 2026
216e36b
use splat operator
tom2tom Feb 21, 2026
6d823a2
export more functionality
tom2tom Feb 21, 2026
b0a5e01
update API text
tom2tom Feb 21, 2026
8b8e227
use cms_siteprefs for caching parameters
tom2tom Feb 21, 2026
3db671d
bump version
tom2tom Apr 7, 2026
abad63a
enhanced design-I/O
tom2tom Apr 7, 2026
0c456e7
correct (C) year
tom2tom Apr 7, 2026
9bd3739
consolidate image storage
tom2tom Apr 7, 2026
b42dc4f
extra details
tom2tom Apr 7, 2026
8b4f6e8
new & revised strings
tom2tom Apr 7, 2026
141f1dd
extra preferences, permissions,folders
tom2tom Apr 7, 2026
4290ec8
bump php min-version
tom2tom Apr 7, 2026
7c1855b
extra details
tom2tom Apr 7, 2026
716d251
revise TMPDIR processing
tom2tom Apr 7, 2026
681c6e0
change Smarty version
tom2tom Apr 7, 2026
ade038d
improve error handling
tom2tom Apr 7, 2026
bb05727
default port null instead of 0
tom2tom Apr 7, 2026
dd1312c
migrate async operations to core
tom2tom Apr 7, 2026
cec9cfe
use hooks to accumulate page header-content and/or footer-content
tom2tom Apr 7, 2026
6ac5b44
extra detail
tom2tom Apr 8, 2026
a0fdef1
extra strings
tom2tom Apr 8, 2026
6c39555
extra and corrected strings
tom2tom Apr 8, 2026
77a8747
corrected strings
tom2tom Apr 8, 2026
ac135b2
corrected and reformatted strings
tom2tom Apr 8, 2026
b946b9c
omit moved file
tom2tom Apr 8, 2026
fadd27c
omit string
tom2tom Apr 8, 2026
0b30f8a
new & revised strings
tom2tom Apr 8, 2026
9bf9d42
corrected html
tom2tom Apr 8, 2026
d026011
revised string
tom2tom Apr 8, 2026
8ab1279
correct url
tom2tom Apr 8, 2026
b9b6b25
bump min version
tom2tom Apr 8, 2026
a8f58df
new version
tom2tom Apr 8, 2026
b148e35
new version
tom2tom Apr 8, 2026
f558205
support Smarty resource theme_file_tpl
tom2tom Apr 8, 2026
4689628
moved file
tom2tom Apr 8, 2026
9893439
moved file
tom2tom Apr 8, 2026
a719d13
add sequence-table for unique counter
tom2tom Apr 8, 2026
2744623
rename datetime fields
tom2tom Apr 8, 2026
6abd562
drop counter table
tom2tom Apr 8, 2026
7fd96ba
ignore irrelevant return-value
tom2tom Apr 8, 2026
14718d7
add class-alias comment
tom2tom Apr 8, 2026
d92c803
add folders, permission, modify tables
tom2tom Apr 8, 2026
d534dd8
rename simplex folder
tom2tom Apr 8, 2026
2a792d9
add jobs tables
tom2tom Apr 8, 2026
d1f687e
add design-properties
tom2tom Apr 8, 2026
c9530ac
add function is_absolute_path()
tom2tom Apr 8, 2026
d7d4d3c
name numeric-suffix choices start from 2
tom2tom Apr 8, 2026
0dadd14
extra properties: version, requires to support version-control
tom2tom Apr 8, 2026
a877681
send LoginPre event earlier
tom2tom Apr 8, 2026
4fd32cc
don't use global Smarty for template generation
tom2tom Apr 8, 2026
d2690a5
reformat recorded content
tom2tom Apr 8, 2026
dcacad8
don't use global Smarty for template generation
tom2tom Apr 8, 2026
9fed365
check value before preg_match()
tom2tom Apr 8, 2026
6c76062
adjust logic
tom2tom Apr 8, 2026
6e93b6b
omit irrelevant content
tom2tom Apr 8, 2026
e4c2f88
correct classpath
tom2tom Apr 8, 2026
dd0e64b
add classes
tom2tom Apr 8, 2026
3940497
use renamed class ProfilesCache
tom2tom Apr 8, 2026
081e5db
use is_absolute_path()
tom2tom Apr 8, 2026
ef31717
abandon irrelevant 'immutable' behaviour
tom2tom Apr 8, 2026
5fc8612
work with mutable/normal Profile class
tom2tom Apr 8, 2026
9b596ab
script outside <div/>
tom2tom Apr 8, 2026
2111626
adjust _DisplayErrorPage() API
tom2tom Apr 8, 2026
152c591
correct php syntax
tom2tom Apr 8, 2026
843ba31
<em/> instead of <i/>
tom2tom Apr 8, 2026
eb91580
bump min PHP version
tom2tom Apr 8, 2026
9c27fa5
update valid-name regex
tom2tom Apr 8, 2026
c7b95c8
tailor default page-length
tom2tom Apr 8, 2026
335b27a
remove related user-preferences
tom2tom Apr 8, 2026
2362b01
update related user-preference values
tom2tom Apr 8, 2026
ba9846b
adjust related user-preference values if needed
tom2tom Apr 8, 2026
c4202d0
conform path-usage
tom2tom Apr 8, 2026
2bb4c3b
housekeeping
tom2tom Apr 8, 2026
163b926
record time of setting user's cwd preference
tom2tom Apr 8, 2026
9d87f40
add UI string
tom2tom Apr 8, 2026
3e6b3bb
updated version
tom2tom Apr 8, 2026
315daed
default storage folder matches module-name
tom2tom Apr 8, 2026
3aafc87
correct php syntax
tom2tom Apr 8, 2026
b39e256
add jobs counter
tom2tom Apr 8, 2026
0df749c
conform fake-button classes
tom2tom Apr 8, 2026
e510602
new version
tom2tom Apr 8, 2026
3e20a58
add design-requires
tom2tom Apr 8, 2026
d367d8e
add method munge_name_to_dir()
tom2tom Apr 8, 2026
c591c00
ignore irrelevant return-value
tom2tom Apr 8, 2026
32a03a6
ignore irrelevant return-value
tom2tom Apr 8, 2026
e1bc52c
collect head-text via hook
tom2tom Apr 8, 2026
d3b0bf1
don't use global Smarty for template generation
tom2tom Apr 8, 2026
29f8ea8
ignore irrelevant return-value
tom2tom Apr 8, 2026
2ce1d15
grammar
tom2tom Apr 8, 2026
c6f7470
consistent nesting of header-element levels
tom2tom Apr 8, 2026
95ccd91
migrate async operations to core
tom2tom Apr 8, 2026
98e01cc
rename theme folder
tom2tom Apr 10, 2026
7dffabe
replace deprecated method
tom2tom Apr 11, 2026
8b8a2a2
direct interactions with database
tom2tom Apr 12, 2026
ac657bb
housekeeping
tom2tom Apr 12, 2026
a86a70f
obfuscate sensitive data after use
tom2tom Apr 12, 2026
3f91feb
Smarty resource classes rename and change namespace
tom2tom Apr 12, 2026
48f4769
correct license url
tom2tom Apr 12, 2026
659f7a7
new version
tom2tom Apr 12, 2026
9b2c410
add class cms_helpicon
tom2tom Apr 12, 2026
32b3e19
rename variable
tom2tom Apr 12, 2026
d9621ff
use renamed variable
tom2tom Apr 12, 2026
8042afb
export class to distinct file
tom2tom Apr 12, 2026
f23b7eb
support design-export properties tailoring
tom2tom Apr 12, 2026
0f9ce5f
message not tab-related
tom2tom Apr 12, 2026
8265177
whitespace
tom2tom Apr 12, 2026
8342e90
align some columns
tom2tom Apr 12, 2026
a57755e
cleanup log entry
tom2tom Apr 12, 2026
e1b5cc4
add jobslist menu item
tom2tom Apr 12, 2026
b971e46
use renamed variables
tom2tom Apr 12, 2026
a31582c
update API text
tom2tom Apr 12, 2026
eae194e
simplify translated-string retrieval
tom2tom Apr 12, 2026
0658649
simplify translated-string retrieval
tom2tom Apr 12, 2026
3a6e49a
add {}
tom2tom Apr 12, 2026
6c271a9
use checkboxes for binary choices
tom2tom Apr 12, 2026
a3e7ea2
replace substr in js
tom2tom Apr 12, 2026
b88a72c
bump version
tom2tom Apr 12, 2026
455d98f
add TODO comment
tom2tom Apr 12, 2026
68a7173
housekeeping
tom2tom Apr 12, 2026
06cb84e
renamed variable
tom2tom Apr 12, 2026
1c9a913
use mutable profiles
tom2tom Apr 12, 2026
1eaebd2
use mutable profiles
tom2tom Apr 12, 2026
4253ba3
use mutable profiles
tom2tom Apr 12, 2026
dc4e9a6
use revised cache
tom2tom Apr 12, 2026
6534934
revised lang key
tom2tom Apr 12, 2026
6bdcf64
support profile copying
tom2tom Apr 12, 2026
15837f3
use revised variable
tom2tom Apr 12, 2026
195ebd8
renamed template-variable
tom2tom Apr 12, 2026
78a1b5f
edit all profile-properties
tom2tom Apr 12, 2026
a0da231
use template-object to generate display
tom2tom Apr 12, 2026
cd481d0
renamed variable
tom2tom Apr 12, 2026
0c226d4
support CMSAsset namespace
tom2tom Apr 12, 2026
519864b
omit irrelevant return-value
tom2tom Apr 12, 2026
cc5625a
force-include JobCheck class
tom2tom Apr 12, 2026
930a031
housekeeping
tom2tom Apr 12, 2026
e4dd99a
replace template-vars assignGlobal
tom2tom Apr 12, 2026
c89c31a
process design-related files
tom2tom Apr 12, 2026
9969787
support extra properties
tom2tom Apr 12, 2026
8271008
enable processing design-related files
tom2tom Apr 12, 2026
0efdc99
add layout styling
tom2tom Apr 12, 2026
1b1c3e4
omit css link
tom2tom Apr 12, 2026
a1fb8f1
use revised API
tom2tom Apr 12, 2026
85d5451
hardcode whitespace
tom2tom Apr 12, 2026
85ac024
use mutable profile
tom2tom Apr 12, 2026
ef661a1
use mutable profile
tom2tom Apr 12, 2026
ed49c79
omit redundant field-parameters
tom2tom Apr 12, 2026
cb6497f
rename variable
tom2tom Apr 12, 2026
560c877
import class properties to method vars
tom2tom Apr 12, 2026
b652e27
support array-valued parameters
tom2tom Apr 12, 2026
bf868a1
default constructor parameter to empty array
tom2tom Apr 12, 2026
fcace1b
CmsJobManager not a core module
tom2tom Apr 12, 2026
c7e361e
omit strict comparisons
tom2tom Apr 12, 2026
a0a87fa
rename variable
tom2tom Apr 12, 2026
400ac9c
use theme_file_tpl resource
tom2tom Apr 12, 2026
61cbf8f
also remove News-related user-preferences
tom2tom Apr 12, 2026
62301c8
remove redundant preferences
tom2tom Apr 12, 2026
b6c59de
add id attribute for dropdowns
tom2tom Apr 12, 2026
5ef1c9a
bump version
tom2tom Apr 12, 2026
cc8257d
various housekeeping
tom2tom Apr 12, 2026
145fb3a
housekeeping
tom2tom Apr 12, 2026
272125c
substantial re-work
tom2tom Apr 12, 2026
588acdb
omit explicit force-require
tom2tom Apr 12, 2026
db7ec82
replace user-preference methods
tom2tom Apr 12, 2026
6062d96
omit explicit force-require
tom2tom Apr 12, 2026
a3a583e
replace methods
tom2tom Apr 12, 2026
fc68478
typo
tom2tom Apr 12, 2026
88849b5
omit unused variable
tom2tom Apr 12, 2026
69ac929
remove all unused preferences
tom2tom Apr 12, 2026
bce349b
remove all related preferences
tom2tom Apr 12, 2026
1cc302b
revised string
tom2tom Apr 12, 2026
c8edb51
use renamed variables
tom2tom Apr 12, 2026
aa5df4a
add function cms_lang()
tom2tom Apr 12, 2026
e0d2e12
replace substr usage
tom2tom Apr 12, 2026
c157452
use renamed variables
tom2tom Apr 12, 2026
becb7ed
use mutable profile
tom2tom Apr 12, 2026
afaf29c
support 'minify' parameter as alias for 'min'
tom2tom Apr 12, 2026
a1fd047
extra detail
tom2tom Apr 12, 2026
30af8a2
add comment
tom2tom Apr 12, 2026
1b756ae
extra detail
tom2tom Apr 14, 2026
03a9e46
omit unused action
tom2tom Apr 14, 2026
9bd8e8b
get_help_tag() supports extra parameters
tom2tom Apr 14, 2026
d95d2ff
support callable event-handlers
tom2tom Apr 14, 2026
e43077c
conform classname format
tom2tom Apr 17, 2026
c03bf84
new version
tom2tom Apr 17, 2026
be0d317
no need for classfile-names including '.inc'
tom2tom Apr 17, 2026
13894f9
revise url-existence check
tom2tom Apr 17, 2026
11e8cb0
add method http_message()
tom2tom Apr 17, 2026
6c03156
housekeeping
tom2tom Apr 17, 2026
cf0971f
housekeeping
tom2tom Apr 17, 2026
1382b94
typo
tom2tom Apr 17, 2026
3f86692
use renamed classfile
tom2tom Apr 17, 2026
9c20e8e
conform classfile name format
tom2tom Apr 17, 2026
401f97f
update API text
tom2tom Apr 17, 2026
b793f1b
change to GPL3
tom2tom Apr 17, 2026
26bd15f
rename variable
tom2tom Apr 17, 2026
ac3075d
use renamed classfile
tom2tom Apr 17, 2026
cbce458
correct error class
tom2tom Apr 17, 2026
f6fafcd
specify used consts
tom2tom Apr 17, 2026
3ac5e72
add method isTrustedFile()
tom2tom Apr 18, 2026
f6143f2
change variable type
tom2tom Apr 18, 2026
10f7e8f
revise comment
tom2tom Apr 18, 2026
072ece1
update API text
tom2tom Apr 18, 2026
ec23e83
housekeeping
tom2tom Apr 18, 2026
717413a
revise comment
tom2tom Apr 18, 2026
3f03e47
new & revised strings
tom2tom Apr 18, 2026
8d25ee3
no design-editing here
tom2tom Apr 18, 2026
2553db9
revise fetch()
tom2tom Apr 18, 2026
5ab38f8
update js
tom2tom Apr 18, 2026
8a06648
use renamed variables
tom2tom Apr 18, 2026
e5e4f13
use renamed variables
tom2tom Apr 18, 2026
b69aeb4
use renamed variables
tom2tom Apr 18, 2026
66381ea
support id and title attributes
tom2tom Apr 18, 2026
442800f
disable Smarty caching in accord with module property
tom2tom Apr 18, 2026
6d08001
register namespaced resource-classes
tom2tom Apr 18, 2026
28047b9
no design-editing here
tom2tom Apr 18, 2026
57e3c2e
revise error strings
tom2tom Apr 18, 2026
929f8d5
housekeeping
tom2tom Apr 18, 2026
b6907f2
housekeeping
tom2tom Apr 18, 2026
26859b9
support background-jobs clearance
tom2tom Apr 18, 2026
813c8ec
use renamed field
tom2tom Apr 18, 2026
9089585
housekeeping
tom2tom Apr 18, 2026
9462352
correct element ids
tom2tom Apr 18, 2026
0cb18b0
use renamed class
tom2tom Apr 18, 2026
04f97a1
use renamed class
tom2tom Apr 18, 2026
3d14a17
housekeeping
tom2tom Apr 18, 2026
0d915c8
re-arrange tabs
tom2tom Apr 18, 2026
50c5e49
add array type-declarations
tom2tom Apr 18, 2026
4156fc1
display no. of cached files
tom2tom Apr 18, 2026
248209e
use event-handler type
tom2tom Apr 18, 2026
12dea3f
update API text
tom2tom Apr 18, 2026
0560b46
ordinary (mutable) class
tom2tom Apr 18, 2026
f1f03a2
update licence url
tom2tom Apr 18, 2026
ae8a457
rationalise <h/> elements hierarchy
tom2tom Apr 18, 2026
72a24d8
whitespace
tom2tom Apr 18, 2026
8898fdf
renamed variables and url-parameters
tom2tom Apr 18, 2026
5fbdd6c
renamed variables and url-parameters
tom2tom Apr 18, 2026
3d40e32
correct label-associations
tom2tom Apr 18, 2026
d772192
revise label-associations
tom2tom Apr 18, 2026
23aa8bf
use event-handler types
tom2tom Apr 18, 2026
7376f6f
support jobs-related settings
tom2tom Apr 18, 2026
1bf0f7c
by default, enable Smarty caching
tom2tom Apr 18, 2026
ec7f316
support sorting by media-property
tom2tom Apr 18, 2026
a5e1f61
renamed variables
tom2tom Apr 18, 2026
cd2a85e
renamed variables
tom2tom Apr 18, 2026
f36dcdd
new version
tom2tom Apr 18, 2026
fed518c
omit unused translation
tom2tom Apr 18, 2026
701674f
Preserve HTML in sitedownmessage when WYSIWYG is active
Koalink Apr 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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**.
158 changes: 80 additions & 78 deletions admin/addbookmark.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#Visit our homepage at: http://www.cmsmadesimple.org
#CMS Made Simple admin console script
#(c) 2004 CMS Made Simple Foundation Inc <foundation@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
Expand All @@ -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 '<div class="pageerrorcontainer"><p class="pageerror">'.$error.'</p></div>';
}
?>

<div class="pagecontainer">
<div class="pageoverflow">
<?php echo $themeObject->ShowHeader('addbookmark'); ?>
<form method="post" action="addbookmark.php<?php echo $urlext?>">
<div>
<input type="hidden" name="<?php echo CMS_SECURE_PARAM_NAME ?>" value="<?php echo $_SESSION[CMS_USER_KEY] ?>" />
</div>
<div class="pageoverflow">
<p class="pagetext"><?php echo lang('title')?>:</p>
<p class="pageinput"><input type="text" name="title" maxlength="255" value="<?php echo $title?>" /></p>
</div>
<div class="pageoverflow">
<p class="pagetext"><?php echo lang('url')?>:</p>
<p class="pageinput"><input type="text" name="url" size="50" maxlength="255" value="<?php echo $url ?>" class="standard" /></p>
</div>
<div class="pageoverflow">
<p class="pagetext">&nbsp;</p>
<p class="pageinput">
<input type="hidden" name="addbookmark" value="true" />
<input type="submit" value="<?php echo lang('submit')?>" class="pagebutton" />
<input type="submit" name="cancel" value="<?php echo lang('cancel')?>" class="pagebutton" />
</p>
</div>
</form>
</div>
</div>
require_once 'header.php';
$themeObject->set_value('pagetitle', 'addbookmark');

<?php
include_once("footer.php");
$tpl = $smarty->createTemplate('admin_tpl:addbookmark.tpl', null, null, $smarty, false);
$tpl->assign('error', $error);
$tpl->assign('securename', CMS_SECURE_PARAM_NAME); // see also $smarty-assigned var $secureparam
$tpl->assign('secureval', $_SESSION[CMS_USER_KEY]);
$tpl->assign('title', $title);
$tpl->assign('url', $url);
$tpl->display();

?>
require_once 'footer.php';
138 changes: 50 additions & 88 deletions admin/addgroup.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#Visit our homepage at: http://www.cmsmadesimple.org
#CMS Made Simple admin console script
#(c) 2004 CMS Made Simple Foundation Inc <foundation@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
Expand All @@ -16,106 +15,69 @@
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#$Id: addgroup.php 12671 2021-12-13 03:05:01Z tomphantoo $
#$Id$

$CMS_ADMIN_PAGE=1;
use CMSMS\HookManager;

require_once("../lib/include.php");
require_once("../lib/classes/class.group.inc.php");
$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY];
$CMS_ADMIN_PAGE = 1;

require_once '../lib/include.php';
check_login();
$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY];

$error = "";

$group= "";
if (isset($_POST["group"])) $group = cleanValue($_POST["group"]);

$description= "";
if (isset($_POST["description"])) $description = cleanValue($_POST["description"]);

$active = 1;
if (!isset($_POST["active"]) && isset($_POST["addgroup"])) $active = 0;

if (isset($_POST["cancel"])) {
redirect("listgroups.php".$urlext);
return;
if (isset($_POST['cancel'])) {
redirect('listgroups.php'.$urlext);
}

$userid = get_userid();
$access = check_permission($userid, 'Manage Groups');
if (!$access) {
exit(lang('no_permission')); //TODO throw if can be caught
}

if ($access) {
if (isset($_POST["addgroup"])) {
try {
if ($group == '') throw new \CmsInvalidDataException(lang('nofieldgiven', lang('groupname')));

$groupobj = new Group();
$groupobj->name = $group;
$groupobj->description = $description;
$groupobj->active = $active;
$error = '';
$group = (isset($_POST['group'])) ? cleanValue($_POST['group']) : '';
$description = (isset($_POST['description'])) ? cleanValue($_POST['description']) : '';
$active = (isset($_POST['addgroup']) && empty($_POST['active'])) ? 0 : 1;

\CMSMS\HookManager::do_hook('Core::AddGroupPre', [ 'group'=>&$groupobj ] );
if (isset($_POST['addgroup'])) {
try {
if ($group == '') throw new CmsInvalidDataException(lang('nofieldgiven', lang('groupname')));

$result = $groupobj->save();
if( !$result ) throw new \RuntimeException(lang('errorinsertinggroup'));
require_once '../lib/classes/class.Group.php'; //don't bother autoloading
$groupobj = new Group();
$groupobj->name = $group;
$groupobj->description = $description;
$groupobj->active = $active;

\CMSMS\HookManager::do_hook('Core::AddGroupPost', [ 'group'=>&$groupobj ] );
// put mention into the admin log
audit($groupobj->id, 'Admin User Group: '.$groupobj->name, 'Added');
redirect("listgroups.php".$urlext);
return;
}
catch( \Exception $e ) {
$error .= '<li>'.$e->GetMessage().'</li>';
}
}
}
HookManager::do_hook('Core::AddGroupPre', ['group'=>$groupobj]);

include_once("header.php");
$result = $groupobj->save();
if( !$result ) throw new RuntimeException(lang('errorinsertinggroup'));

if (!$access) {
echo "<div class=\"pageerrorcontainer\"><p class=\"pageerror\">".lang('noaccessto', array(lang('addgroup')))."</p></div>";
}
else {
if ($error != "") {
echo "<div class=\"pageerrorcontainer\"><ul class=\"pageerror\">".$error."</ul></div>";
HookManager::do_hook('Core::AddGroupPost', ['group'=>$groupobj]);
// put mention into the admin log
audit($groupobj->id, 'Admin users group', "Added: $groupobj->name");
redirect('listgroups.php'.$urlext);
// return;
}
catch( Exception $e ) {
$error .= '<li>'.$e->GetMessage().'</li>';
}
?>

<div class="pagecontainer">
<?php echo $themeObject->ShowHeader('addgroup'); ?>
<form method="post" action="addgroup.php">
<div>
<input type="hidden" name="<?php echo CMS_SECURE_PARAM_NAME ?>" value="<?php echo $_SESSION[CMS_USER_KEY] ?>" />
</div>
<div class="pagewarning"><?php echo lang('warn_addgroup'); ?></div>
<div class="pageoverflow">
<p class="pagetext"><label for="groupname">*<?php echo lang('name')?>:</label></p>
<p class="pageinput"><input type="text" id="groupname" name="group" maxlength="255" value="<?php echo $group?>" /></p>
</div>
<div class="pageoverflow">
<p class="pagetext"><label for="description"><?php echo lang('description')?>:</label></p>
<p class="pageinput"><input type="text" id="description" name="description" maxlength="255" size="80" value="<?php echo $description?>" /></p>
</div>
<div class="pageoverflow">
<p class="pagetext"><label for="active"><?php echo lang('active')?>:</label></p>
<p class="pageinput"><input class="pagecheckbox" type="checkbox" id="active" name="active" <?php echo ($active == 1?"checked=\"checked\"":"")?> /></p>
</div>
<div class="pageoverflow">
<p class="pagetext">&nbsp;</p>
<p class="pageinput">
<input type="hidden" name="addgroup" value="true" />
<input type="submit" value="<?php echo lang('submit')?>" class="pagebutton" />
<input type="submit" name="cancel" value="<?php echo lang('cancel')?>" class="pagebutton" />
</p>
</div>
</form>
</div>

<?php
}

include_once("footer.php");

?>
require_once 'header.php';
$themeObject->set_value('pagetitle', 'addgroup');

$tpl = $smarty->createTemplate('admin_tpl:addgroup.tpl', null, null, $smarty, false);
// see also $smarty-assigned var $secureparam
$tpl->assign('securename', CMS_SECURE_PARAM_NAME)
->assign('secureval', $_SESSION[CMS_USER_KEY])
->assign('access', $access)
->assign('active', (bool)$active)
->assign('error', $error)
->assign('group', $group)
->assign('description', $description);
$tpl->display();

require_once 'footer.php';
Loading