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.'

'; - } -?> - -
-
- ShowHeader('addbookmark'); ?> -
-
- -
-
-

:

-

-
-
-

:

-

-
-
-

 

-

- - - -

-
-
-
-
+require_once 'header.php'; +$themeObject->set_value('pagetitle', 'addbookmark'); -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'; diff --git a/admin/addgroup.php b/admin/addgroup.php index 0033883d..c8ecc1fc 100644 --- a/admin/addgroup.php +++ b/admin/addgroup.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,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 .= '
  • '.$e->GetMessage().'
  • '; - } - } -} + HookManager::do_hook('Core::AddGroupPre', ['group'=>$groupobj]); -include_once("header.php"); + $result = $groupobj->save(); + if( !$result ) throw new RuntimeException(lang('errorinsertinggroup')); -if (!$access) { - echo "

    ".lang('noaccessto', array(lang('addgroup')))."

    "; -} -else { - if ($error != "") { - echo "
    "; + 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 .= '
  • '.$e->GetMessage().'
  • '; } -?> - -
    - ShowHeader('addgroup'); ?> -
    -
    - -
    -
    -
    -

    -

    -
    -
    -

    -

    -
    -
    -

    -

    />

    -
    -
    -

     

    -

    - - - -

    -
    -
    -
    - - +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'; diff --git a/admin/adduser.php b/admin/adduser.php index 12412146..7c7df94b 100644 --- a/admin/adduser.php +++ b/admin/adduser.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,21 +15,27 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: adduser.php 12671 2021-12-13 03:05:01Z tomphantoo $ +#$Id$ + +use CMSMS\HookManager; $CMS_ADMIN_PAGE = 1; require_once ('../lib/include.php'); check_login(); -$userid = get_userid(); +$urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]; +if (isset($_POST['cancel'])) { + redirect('listusers.php' . $urlext); +} -if (!check_permission($userid, 'Manage Users')) die('Permission Denied'); +$userid = get_userid(); +if (!check_permission($userid, 'Manage Users')) { + exit(lang('no_permission')); //TODO throw if can be caught +} /*-------------------- * Variables ---------------------*/ - -$urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]; $gCms = cmsms(); $db = $gCms->GetDb(); $assign_group_perm = check_permission($userid, 'Manage Groups'); @@ -38,52 +43,87 @@ $error = ''; $adminaccess = 1; $active = 1; -$sel_groups = array(); -// Post data +$sel_groups = []; +// POST[] data +/* $user = isset($_POST["user"]) ? cleanValue($_POST["user"]) : ''; -$password = isset($_POST["password"]) ? trim($_POST["password"]) : ''; -$passwordagain = isset($_POST["passwordagain"]) ? trim($_POST["passwordagain"]) : ''; +$password = isset($_POST["password"]) ? $_POST["password"] : ''; +$passwordagain = isset($_POST["passwordagain"]) ? $_POST["passwordagain"] : ''; $firstname = isset($_POST["firstname"]) ? cleanValue($_POST["firstname"]) : ''; $lastname = isset($_POST["lastname"]) ? cleanValue($_POST["lastname"]) : ''; $email = isset($_POST["email"]) ? trim(strip_tags($_POST["email"])) : ''; -$copyusersettings = isset($_POST['copyusersettings']) ? (int)$_POST['copyusersettings'] : null; -$sel_groups = (isset($_POST['sel_groups']) && is_array($_POST['sel_groups'])) ? $_POST['sel_groups'] : $sel_groups; +*/ +$user = ''; +$password = ''; +$passwordagain = ''; +$firstname = ''; +$lastname = ''; +$email = ''; +foreach ($_POST as $key => $val) { + switch ($key) { + case 'user': //account + //scrub malicious/XSS & invalid content + $user = preg_replace('/[^a-zA-Z0-9._\- \x8c\x8e\x9c\x9e\x9f\xc0-\xd6\xd8-\xf6\xf8-\xff\pL\p{Nd}\p{Po}]/u', '', trim($val)); + break; + case 'firstname': + case 'lastname': + //scrub malicious/XSS & invalid + $$key = preg_replace(['/[\x00-\x1f\x7f]/', '/<[^>]*>/', '/(<|%3c)(\?|%3f)php.*$/i', '/(<|%3c)(\?|%3f)=?.*$/i'], ['', '', '', ''], trim($val)); //c.f. $sanitize_fn in include.php + break; + case 'password': + case 'passwordagain': + //scrub malicious/XSS & non-printables + $$key = preg_replace(['/[\x00-\x1f\x7f]/', '/(<|%3c)(\?|%3f)php.*$/i', '/(<|%3c)(\?|%3f)=?.*$/i'], ['', '', ''], $val); + break; + case 'email': + //TODO scrub XSS & invalid + //PHP's FILTER_VALIDATE_EMAIL mechanism is incomplete (per RFC5321) - see notes at https://www.php.net/manual/en/function.filter-var.php + $email = filter_var(trim($val), FILTER_SANITIZE_EMAIL); + } +} + +$copyusersettings = (isset($_POST['copyusersettings'])) ? (int)$_POST['copyusersettings'] : 0; +$adminaccess = (isset($_POST['adminaccess'])) ? 1 : 0; +$active = (isset($_POST['active'])) ? 1 : 0; +$sel_groups = (isset($_POST['sel_groups']) && is_array($_POST['sel_groups'])) ? $_POST['sel_groups'] : $sel_groups; /*-------------------- * Variables ---------------------*/ -if (isset($_POST["cancel"])) { - redirect('listusers.php' . $urlext); - return; -} - if (isset($_POST["submit"])) { - $active = !isset($_POST["active"]) ? 0 : 1; - $adminaccess = !isset($_POST["adminaccess"]) ? 0 : 1; $validinfo = true; - if ($user == "") { + // check for errors + if ($user == "") { //falsy ok? $validinfo = false; - $error .= "
  • " . lang('nofieldgiven', array(lang('username'))) . "
  • "; - } else if (!preg_match("/^[a-zA-Z0-9\._ ]+$/", $user)) { + $error .= "
  • " . lang('nofieldgiven', lang('username')) . "
  • "; + } elseif ($user != trim($_POST['user'])) { $validinfo = false; - $error .= "
  • " . lang('illegalcharacters', array(lang('username'))) . "
  • "; + $error .= "
  • " . lang('illegalcharacters', lang('username')) . "
  • "; } - if ($password == "") { + if ($password == "") { //falsy ok? + $validinfo = false; + $error .= "
  • " . lang('nofieldgiven', lang('password')) . "
  • "; + } elseif ($password != $_POST['password']) { $validinfo = false; - $error .= "
  • " . lang('nofieldgiven', array(lang('password'))) . "
  • "; - } else if ($password != $passwordagain) { + $error .= "
  • " . lang('illegalcharacters', lang('password')) . "
  • "; + } elseif ($password != $passwordagain) { // We don't want to see this if no password was given $validinfo = false; $error .= "
  • " . lang('nopasswordmatch') . "
  • "; } - if (!empty($email) && !is_email($email)) { - $validinfo = false; - $error .= '
  • ' . lang('invalidemail') . '
  • '; + if ($email) { + if ($email != trim($_POST['email'])) { + $validinfo = false; + $error .= '
  • ' . lang('invalidemail') . '
  • '; + } elseif (!is_email($email)) { + $validinfo = false; + $error .= '
  • ' . lang('invalidemail') . '
  • '; + } } if ($validinfo) { @@ -97,19 +137,19 @@ $newuser->adminaccess = $adminaccess; $newuser->SetPassword($password); - \CMSMS\HookManager::do_hook('Core::AddUserPre', [ 'user'=>&$newuser ] ); + HookManager::do_hook('Core::AddUserPre', [ 'user'=>$newuser ]); $result = $newuser->save(); if ($result) { - \CMSMS\HookManager::do_hook('Core::AddUserPost', [ 'user'=>&$newuser ] ); + HookManager::do_hook('Core::AddUserPost', [ 'user'=>$newuser ]); // set some default preferences, based on the user creating this user $adminid = get_userid(); $userid = $newuser->id; if ($copyusersettings > 0) { $prefs = cms_userprefs::get_all_for_user($copyusersettings); - if (is_array($prefs) && count($prefs)) { + if ($prefs && is_array($prefs)) { foreach ($prefs as $k => $v) { cms_userprefs::set_for_user($userid, $k, $v); } @@ -117,7 +157,7 @@ } else { cms_userprefs::set_for_user($userid, 'default_cms_language', cms_userprefs::get_for_user($adminid, 'default_cms_language')); cms_userprefs::set_for_user($userid, 'wysiwyg', cms_userprefs::get_for_user($adminid, 'wysiwyg')); - cms_userprefs::set_for_user($userid, 'admintheme', get_site_preference('logintheme', CmsAdminThemeBase::GetDefaultTheme())); + cms_userprefs::set_for_user($userid, 'admintheme', cms_siteprefs::get('logintheme', CmsAdminThemeBase::GetDefaultTheme())); cms_userprefs::set_for_user($userid, 'bookmarks', cms_userprefs::get_for_user($adminid, 'bookmarks')); cms_userprefs::set_for_user($userid, 'recent', cms_userprefs::get_for_user($adminid, 'recent')); } @@ -136,8 +176,8 @@ } // put mention into the admin log - audit($newuser->id, 'Admin Username: ' . $newuser->username, 'Added'); - redirect("listusers.php" . $urlext); + audit($newuser->id, 'Admin user', "Added: $newuser->username"); + redirect('listusers.php' . $urlext); } else { $error .= "
  • " . lang('errorinsertinguser') . "
  • "; } @@ -148,38 +188,33 @@ * Display view ---------------------*/ -include_once ('header.php'); - -if ($error != '') { - echo $themeObject->ShowErrors(''); -} +require_once 'header.php'; -$out = array(-1 => lang('none')); -$userlist = UserOperations::get_instance()->LoadUsers(); +$tpl = $smarty->createTemplate('admin_tpl:adduser.tpl', null, null, $smarty, false); -foreach ($userlist as $one) { - $out[$one->id] = $one->username; +if ($error) { + $themeObject->ShowErrors(''); } +$selector = UserOperations::get_instance()->GenerateDropdown(0, 'copyusersettings', [], [-1=>lang('none')]); if ($assign_group_perm) { $groups = GroupOperations::get_instance()->LoadGroups(); - $smarty->assign('groups', $groups); + $tpl->assign('groups', $groups); } -$smarty->assign('adminaccess', $adminaccess); -$smarty->assign('active', $active); -$smarty->assign('user', $user); -$smarty->assign('password', $password); -$smarty->assign('passwordagain', $passwordagain); -$smarty->assign('firstname', $firstname); -$smarty->assign('lastname', $lastname); -$smarty->assign('email', $email); -$smarty->assign('copyusersettings', $copyusersettings); -$smarty->assign('sel_groups', $sel_groups); -$smarty->assign('my_userid', get_userid()); -$smarty->assign('users', $out); - -$smarty->display('adduser.tpl'); - -include_once ('footer.php'); -?> +$tpl->assign('adminaccess', $adminaccess) + ->assign('active', $active) + ->assign('user', $user) + ->assign('password', $password) + ->assign('passwordagain', $passwordagain) + ->assign('firstname', $firstname) + ->assign('lastname', $lastname) + ->assign('email', $email) + ->assign('copyusersettings', $copyusersettings) + ->assign('sel_groups', $sel_groups) + ->assign('my_userid', $userid) + ->assign('userselect', $selector); + +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/adminlog.php b/admin/adminlog.php index 46969d1b..24222e14 100644 --- a/admin/adminlog.php +++ b/admin/adminlog.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,49 +15,52 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id:$ -$CMS_ADMIN_PAGE=1; +#$Id$ + +$CMS_ADMIN_PAGE = 1; $orig_memory = (function_exists('memory_get_usage')?memory_get_usage():0); -require_once("../lib/include.php"); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +require_once '../lib/include.php'; check_login(); -$gCms = \CmsApp::get_instance(); +$userid = get_userid(); +if( !check_permission($userid,'Modify Site Preferences') ) { + exit(lang('no_permission')); //TODO throw if can be caught +} + +$gCms = CmsApp::get_instance(); $db = $gCms->GetDb(); -$themeObject = \cms_utils::get_theme_object(); +$themeObject = cms_utils::get_theme_object(); -// get the total number of records. -$totalrows = $db->GetOne("SELECT count(timestamp) FROM ".CMS_DB_PREFIX."adminlog"); +// get the total number of records NOTE filtered records prob'ly less than this +$totalrows = $db->GetOne('SELECT COUNT(*) FROM '.CMS_DB_PREFIX.'adminlog'); -$smarty->assign("urlext",$urlext); +$access = check_permission($userid,'Clear Admin Log'); -$userid = get_userid(); -if (!check_permission($userid, 'Modify Site Preferences')) { - die('permission denied'); -} -$access = check_permission($userid, 'Clear Admin Log'); - -if (isset($_GET['clear']) && $access) { - $query = "DELETE FROM ".CMS_DB_PREFIX."adminlog"; +if( $access && isset($_GET['clear']) ) { + $query = 'DELETE FROM '.CMS_DB_PREFIX.'adminlog'; $db->Execute($query); unset($_SESSION['adminlog_page']); - echo $themeObject->ShowMessage(lang('adminlogcleared')); + unset($_REQUEST['page']); + $themeObject->ShowMessage(lang('adminlogcleared')); // put mention into the admin log - audit('', 'Admin Log', 'Cleared'); + audit('','Admin log','Cleared'); } +//TODO paging doesn't properly-handle filtering $page = ( isset($_SESSION['adminlog_page']) ) ? (int) $_SESSION['adminlog_page'] : 1; -if (isset($_REQUEST['page'])) { +if( isset($_REQUEST['page']) ) { $page = (int) $_REQUEST['page']; $_SESSION['adminlog_page'] = $page; } -$limit = 25; -$npages = ceil($totalrows / $limit); +$limit = 25; //aka page-length & db-query length +$npages = (int)ceil(($totalrows / $limit) - 0.001); //WRONG if filtered $page = max(1,min($npages,$page)); $from = ($page-1) * $limit; $orig_filter = new stdClass(); -$orig_filter->user = $orig_filter->action = $orig_filter->item_name = null; +$orig_filter->user = ''; +$orig_filter->action = ''; +$orig_filter->item_name = ''; if( !empty($_SESSION['adminlog_filter']) ) { $filter = $_SESSION['adminlog_filter']; } else { $filter = clone $orig_filter; } @@ -68,13 +70,13 @@ $filter->action = trim(cleanValue($_POST['filteraction'])); $filter->item_name = trim(cleanValue($_POST['filteritem'])); $_SESSION['adminlog_filter'] = $filter; - $page = 1; unset($_SESSION['adminlog_page']); + $page = 1; } else if( isset($_POST['filterreset']) ) { $filter = $orig_filter; unset($_SESSION['adminlog_filter']); - $page = 1; unset($_SESSION['adminlog_page']); + $page = 1; } $filter_applied = ($filter != $orig_filter); @@ -93,23 +95,23 @@ $where[] = 'item_name LIKE ?'; $parms[] = '%'.$filter->item_name.'%'; } -if( count($where) ) { +if( $where ) { $sql .= ' WHERE '.implode(' AND ',$where); } $sql .= ' ORDER BY timestamp DESC'; if( isset($_GET['download']) ) { - // we are downloading: honor the filters but skip paging - $result = $db->Execute($sql, $parms); - header('Content-type: text/plain'); + // when downloading, honor the filter but skip paging + $result = $db->Execute($sql,$parms); + header('Content-Type: text/plain'); header('Content-Disposition: attachment; filename="adminlog.txt"'); if( $result && $result->RecordCount() > 0 ) { - $dateformat = trim(cms_userprefs::get_for_user(get_userid(),'date_format_string','%x %X')); + $dateformat = trim(cms_userprefs::get_for_user($userid,'date_format_string','%x %X')); if( !$dateformat ) $dateformat = '%x %X'; while ($row = $result->FetchRow()) { echo locale_ftime($dateformat,$row['timestamp'])."|"; echo $row['username'] . "|"; - echo (((int)$row['item_id']==-1)?'':$row['item_id']) . "|"; + echo (((int)$row['item_id'] == -1) ? '' : $row['item_id']) . "|"; echo $row['item_name'] . "|"; echo $row['action']; echo "\n"; @@ -123,10 +125,13 @@ $result = $db->SelectLimit($sql,$limit,$from,$parms); // begin output -include_once("header.php"); -$smarty->assign("header",$themeObject->ShowHeader('adminlog')); -if ($result && $result->RecordCount() > 0) { +require_once 'header.php'; +$themeObject->set_value('pagetitle','adminlog'); + +$tpl = $smarty->createTemplate('admin_tpl:adminlog.tpl',null,null,$smarty,false); +if ($result && $result->RecordCount() > 0) { + //TODO paging doesn't properly-handle filtering $pagelist = array(); if( $npages < 20 ) { for( $i = 1; $i <= $npages; $i++ ) { @@ -160,52 +165,53 @@ sort($pagelist); $pagelist = array_combine($pagelist,$pagelist); } - $smarty->assign('page',$page); - $smarty->assign('pagelist',$pagelist); - $smarty->assign("downloadlink",$themeObject->DisplayImage('icons/system/attachment.gif', lang('download'),'','','systemicon')); - $smarty->assign("langdownload",lang("download")); - - $smarty->assign("languser",lang("user")); - $smarty->assign("langitemid",lang("itemid")); - $smarty->assign("langitemname",lang("itemname")); - $smarty->assign("langaction",lang("action")); - $smarty->assign("langdate",lang("date")); - - $loglines=array(); + $tpl->assign('page',$page); + $tpl->assign('pagelist',$pagelist); + $tpl->assign('downloadlink',$themeObject->DisplayImage('icons/system/attachment.gif',lang('download'),'','','systemicon')); + $tpl->assign('langdownload',lang('download')); + $tpl->assign('languser',lang('user')); + $tpl->assign('langitemid',lang('itemid')); + $tpl->assign('langitemname',lang('itemname')); + $tpl->assign('langaction',lang('action')); + $tpl->assign('langdate',lang('date')); + + $loglines = array(); while ($row = $result->FetchRow()) { - $one=array(); + $one = array(); $one['ip_addr'] = $row['ip_addr']; - $one["username"] = $row["username"]; - $one["itemid"] = ($row["item_id"]!=-1?$row["item_id"]:" "); - $one["itemname"] = cleanValue($row["item_name"]); - $one["action"] = cleanValue($row["action"]); - $one["date"] = $row['timestamp']; + $one['username'] = $row['username']; + $one['itemid'] = ($row['item_id'] != -1) ? $row['item_id']:' '; + $one['itemname'] = cleanValue($row['item_name']); + $one['action'] = cleanValue($row['action']); + $one['date'] = $row['timestamp']; - $loglines[]=$one; + $loglines[] = $one; } - $smarty->assign("loglines",$loglines); - $smarty->assign("logempty",false); + $tpl->assign('loglines',$loglines); + $tpl->assign('logempty',false); } else { - $smarty->assign("langlogempty",lang('adminlogempty')); - $smarty->assign("logempty",true); + $tpl->assign('langlogempty',lang('adminlogempty')); + $tpl->assign('logempty',true); } -$smarty->assign("clearicon",""); -if ($access && $result && $result->RecordCount() > 0) { - $smarty->assign("clearicon",$themeObject->DisplayImage('icons/system/delete.gif', lang('delete'),'','','systemicon')); - $smarty->assign("langclear",lang('clearadminlog')); +if( $access && $result && $result->RecordCount() > 0 ) { + $tpl->assign('clearicon',$themeObject->DisplayImage('icons/system/delete.gif',lang('delete'),'','','systemicon')); + $tpl->assign('langclear',lang('clear')); } - -$smarty->assign("sysmain_confirmclearlog",lang('sysmain_confirmclearlog')); -$smarty->assign("langfilteruser",lang("filteruser")); -$smarty->assign("langfilteraction",lang("filteraction")); -$smarty->assign("langfilterapply",lang("filterapply")); -$smarty->assign("langfilterreset",lang("filterreset")); -$smarty->assign('filter',$filter); -$smarty->assign('filter_applied',$filter_applied); -$smarty->assign('SECURE_PARAM_NAME',CMS_SECURE_PARAM_NAME); -$smarty->assign('CMS_USER_KEY',$_SESSION[CMS_USER_KEY]); -echo $smarty->fetch('adminlog.tpl'); - -include_once("footer.php"); +else { + $tpl->assign('clearicon',''); +} +if( $result ) $result->Close(); + +// see also $smarty-assigned var $secureparam +$tpl->assign('sysmain_confirmclearlog',lang('sysmain_confirmclearlog')) + ->assign('langfilteruser',lang('filteruser')) + ->assign('langfilteraction',lang('filteraction')) + ->assign('langfilterapply',lang('filterapply')) + ->assign('langfilterreset',lang('filterreset')) + ->assign('filter',$filter) + ->assign('filter_applied',$filter_applied); +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/ajax_alerts.php b/admin/ajax_alerts.php index 760d6a33..d65ca622 100644 --- a/admin/ajax_alerts.php +++ b/admin/ajax_alerts.php @@ -1,8 +1,6 @@ -#CMS - CMS Made Simple (CMSMS) -#CMSMS is copyright (c) 2004 by Ted Kulp. -#Visit our homepage at: http://www.cmsmadesimple.org +#CMS Made Simple admin console script +#(c) 2004 CMS Made Simple Foundation Inc # #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 @@ -10,22 +8,21 @@ #(at your option) any later version. # #This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANthe TY; without even the implied warranty of +#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 +#along with this program. If not, read the license online at: +#https://www.gnu.org/licenses/#LicenseURLs # -#$Id: moduleinterface.php 8558 2012-12-10 00:59:49Z calguy1000 $ +#$Id$ -$CMS_ADMIN_PAGE=1; -require_once("../lib/include.php"); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +$CMS_ADMIN_PAGE = 1; +require_once '../lib/include.php'; try { - $out = ''; $uid = get_userid(FALSE); - if( !$uid ) throw new \Exception('Permission Denied'); // should be a 403, but meh. + if( !$uid ) throw new Exception('Permission Denied'); // should be a 403, but meh. $op = cleanValue($_POST['op']); if( !$op ) $op = 'delete'; @@ -33,15 +30,15 @@ switch( $op ) { case 'delete': - $alert = \CMSMS\AdminAlerts\Alert::load_by_name($alert_name); + $alert = CMSMS\AdminAlerts\Alert::load_by_name($alert_name); $alert->delete(); break; default: - throw new \Exception('Unknown operation '.$op); + throw new Exception('Unknown operation '.$op); } - echo $out; + echo ''; } -catch( \Exception $e ) { +catch( Exception $e ) { // do 500 error. $handlers = ob_list_handlers(); for ($cnt = 0; $cnt < count($handlers); $cnt++) { ob_end_clean(); } @@ -51,8 +48,4 @@ echo $e->GetMessage(); } exit; - -# -# EOF -# ?> diff --git a/admin/ajax_content.php b/admin/ajax_content.php index f9fff979..50e1432d 100644 --- a/admin/ajax_content.php +++ b/admin/ajax_content.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 @@ -9,240 +8,225 @@ #(at your option) any later version. # #This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANthe TY; without even the implied warranty of +#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 # -#$Id: moduleinterface.php 8558 2012-12-10 00:59:49Z calguy1000 $ +#$Id$ -$CMS_ADMIN_PAGE=1; +$CMS_ADMIN_PAGE = 1; require_once("../lib/include.php"); $op = 'pageinfo'; -if( isset($_REQUEST['op']) ) $op = trim($_REQUEST['op']); -$gCms = \CmsApp::get_instance(); -$hm = $gCms->GetHierarchyManager(); +if( isset($_GET['op']) ) $op = trim($_GET['op']); +$gCms = CmsApp::get_instance(); $contentops = $gCms->GetContentOperations(); -$allow_all = (isset($_REQUEST['allow_all']) && cms_to_bool($_REQUEST['allow_all'])) ? 1 : 0; -$allow_all = 1; -$for_child = (isset($_REQUEST['for_child']) && cms_to_bool($_REQUEST['for_child'])) ? 1 : 0; -$allowcurrent = (isset($_REQUEST['allowcurrent']) && cms_to_bool($_REQUEST['allowcurrent'])) ? 1 : 0; -$current = (isset($_REQUEST['current']) ) ? (int) $_REQUEST['current'] : null; + +//in many contexts where a hierselector is initiated, $allow_all defaults to or is set to FALSE +$allow_all = TRUE; //in 2.2 to 2.2.18 this always applied, probably a workaround/bug +if( isset($_GET['allow_all']) && !cms_to_bool($_GET['allow_all']) ) $allow_all = FALSE; $display = 'title'; $mod = cms_utils::get_module('CMSContentManager'); if( $mod ) $display = CmsContentManagerUtils::get_pagenav_display(); +$ruid = get_userid(FALSE); try { - $ruid = get_userid(FALSE); - if( $ruid < 1 ) throw new \Exception('permissiondenied'); // should throw a 403 + if( $ruid < 1 ) throw new CmsError403Exception('permissiondenied'); $can_edit_any = check_permission($ruid,'Manage All Content') || check_permission($ruid,'Modify Any Page'); $out = []; - $error = ''; switch( $op ) { - case 'userlist': - case 'userpages': - $tmplist = $contentops->GetPageAccessForUser($ruid); - if( count($tmplist) ) { - $display = $pagelist = []; - foreach( $tmplist as $item ) { - // get all the parents +// case 'userlist': unused in cmsms.hierselector +/* case 'userpages': never initiated via cmsms.hierselector + // used when a selector was initiated with use_simple = true, ATM no such case across the CMSMS core + $tmplist = $contentops->GetPageAccessForUser($ruid); //ids of pages which the user may edit + if( $tmplist ) { + $pagelist = []; + foreach( $tmplist as $one ) { + // get all ancestors $parents = []; - $startnode = $node = $contentops->quickfind_node_by_id($item); + $node = $contentops->quickfind_node_by_id($one); while( $node && $node->get_tag('id') > 0 ) { $content = $node->getContent(FALSE); $rec = $content->ToData(); $rec['can_edit'] = $can_edit_any || $contentops->CheckPageAuthorship($ruid,$content->Id()); - $rec['display'] = strip_tags($rec['menu_text']); - if( $display == 'title' ) $rec['display'] = strip_tags($rec['content_name']); + $val = ( $display == 'title' ) ? $rec['content_name'] : $rec['menu_text']; + $rec['display'] = ( $val ) ? strip_tags($val) : lang('anonymous'); $rec['has_children'] = $node->has_children(); $parents[] = $rec; $node = $node->get_parent(); } - // start at root - // push items from list on the stack if they are root, or the previous item is in the opened array. + // accumulate unique ancestor items, starting from the root $parents = array_reverse($parents); for( $i = 0; $i < count($parents); $i++ ) { $content_id = $parents[$i]['content_id']; if( !in_array($content_id,$pagelist) ) { $pagelist[] = $content_id; - $display[] = $parents[$i]; + $out[] = $parents[$i]; } } unset($parents); } - usort($display,function($a,$b) { + if( count($out) > 1 ) { + usort($out,function($a,$b) { return strcmp($a['hierarchy'],$b['hierarchy']); }); - $out = $display; - unset($display); + } } break; - +*/ case 'here_up': - // given a page id, get all of the info for all of the parents, and their peers. - // as well as the info of my current children. - if( !isset($_REQUEST['page']) ) throw new \Exception('missingparams'); - - $children_to_data = function($node) use ($display,$allow_all,$for_child,$ruid,$contentops,$can_edit_any,$allowcurrent,$current) { - $children = $node->getChildren(false,$allow_all); - if( empty($children) ) return; + // given a page id, get all info for it, its peers, and all + // ancestors and their peers. + // used when a selector was initiated with use_simple = false or unspecified + if( !isset($_GET['page']) ) throw new CmsException('missingparams'); +// $for_child = isset($_GET['for_child']) && cms_to_bool($_GET['for_child']); // unused here TODO what is it intended to achieve in backend? + $allowcurrent = isset($_GET['allowcurrent']) && cms_to_bool($_GET['allowcurrent']); + $current = ( isset($_GET['current']) ) ? (int)$_GET['current'] : 0; + + $children_to_data = function($node) use ($contentops,$allow_all,$display,$ruid,$can_edit_any,/*$out,*$for_child,*/$allowcurrent,$current) { + $children = $node->getChildren(FALSE,$allow_all); //2nd arg distinguishes ACTIVE pages TODO is any inactive page ever selectable? + if( !$children ) return []; $child_info = []; foreach( $children as $child ) { $content = $child->getContent(FALSE); if( !is_object($content) ) continue; - if( !$allow_all && !$content->Active() ) continue; - if( !$allow_all && !$content->HasUsableLink() ) continue; if( !$allowcurrent && $current == $content->Id() ) continue; + if( !($allow_all || $content->Active()) || !$content->Navigable() ) continue; $rec = $content->ToData(); $rec['can_edit'] = $can_edit_any || $contentops->CheckPageAuthorship($ruid,$content->Id()); - $rec['display'] = strip_tags($rec['menu_text']); - if( $display == 'title' ) $rec['display'] = strip_tags($rec['content_name']); + $val = ( $display == 'title' ) ? $rec['content_name'] : $rec['menu_text']; + $rec['display'] = ( $val ) ? strip_tags($val) : lang('anonymous'); $rec['has_children'] = $child->has_children(); $child_info[] = $rec; } return $child_info; }; - $out = []; - $page = (int)$_REQUEST['page']; + $page = (int)$_GET['page']; if( $page < 1 ) $page = -1; - $node = null; -// $thiscontent = null; if( $page == -1 ) { - $node = $hm; // root + $node = $gCms->GetHierarchyManager(); // TODO process -1 as content-tree-root, OR as default page c.f. pageinfo op? } else { $node = $contentops->quickfind_node_by_id($page); } do { - $out[] = $children_to_data($node); // get children of current page. + $out[] = $children_to_data($node); // populate child-data of this node i.e. the node and its peers $node = $node->get_parent(); } while( $node ); - $out = array_reverse($out); + $out = array_reverse($out); //TODO any further filtering etc break; - case 'childrenof': - if( !isset($_REQUEST['page']) ) { - $error = 'missingparams'; +/* case 'childrenof': // unused in cmsms.hierselector + if( !isset($_GET['page']) ) { + throw new CmsException('missingparams'); } else { - $page = (int)$_REQUEST['page']; + $page = (int)$_GET['page']; if( $page < 1 ) $page = -1; - $node = null; if( $page == -1 ) { - $node = $hm; + $node = $gCms->GetHierarchyManager(); // TODO process -1 as content-tree-root, OR as default page c.f. pageinfo op? } else { $node = $contentops->quickfind_node_by_id($page); } if( $node ) { - $children = $node->getChildren(FALSE,$allow_all); - if( is_array($children) && count($children) ) { - $out = array(); + $children = $node->getChildren(FALSE,TRUE|FALSE|$allow_all TODO); + if( $children && is_array($children) ) { foreach( $children as $child ) { $content = $child->getContent(FALSE); if( !is_object($content) ) continue; - if( !$allow_all && !$content->Active() ) continue; - $res = $content->ToData(); - $rec['can_edit'] = check_permission($ruid,'Manage All Content') || $contentops->CheckPageAuthorship($ruid,$content->Id()); - $res['display'] = strip_tags($res['menu_text']); - if( $display == 'title' ) $res['display'] = strip_tags($res['content_name']); - $out[] = $res; + if( !($allow_all || $content->Active()) ) { //TODO is inactive ever selectable? + continue; + } + $rec = $content->ToData(); + $rec['can_edit'] = $can_edit_any || $contentops->CheckPageAuthorship($ruid,$content->Id()); + $val = ( $display == 'title' ) ? $rec['content_name'] : $rec['menu_text']; + $rec['display'] = ( $val ) ? strip_tags($val) : lang('anonymous'); + $out[] = $rec; } } } } break; - +*/ case 'pageinfo': - if( !isset($_REQUEST['page']) ) { - $error = 'missingparams'; + if( !isset($_GET['page']) ) { + throw new CmsException('missingparams'); } else { - $page = (int)$_REQUEST['page']; - if( $page < 1 ) { - $error = 'missingparams'; + $page = (int)$_GET['page']; // value < 1 treated as default page + // get the page info + $content = $contentops->LoadContentFromId($page); + if( !is_object($content) ) { + throw new CmsException('errorgettingcontent'); } else { - // get the page info. - $contentobj = $contentops->LoadContentFromId($page); - if( !is_object($contentobj) ) { - $error = 'errorgettingcontent'; - } - else { - $out = $contentobj->ToData(); - $out['display'] = $out['menu_text']; - if( $display == 'title' ) $out['display'] = $out['content_name']; - } + $out = $content->ToData(); + $val = ( $display == 'title' ) ? $out['content_name'] : $out['menu_text']; + $out['display'] = ( $val ) ? strip_tags($val) : lang('anonymous'); } } break; - case 'pagepeers': - if( !isset($_REQUEST['pages']) || !is_array($_REQUEST['pages']) ) { - $error = 'missingparams'; +/* case 'pagepeers': // unused in cmsms.hierselector + if( !isset($_GET['pages']) || !is_array($_GET['pages']) ) { // never set in cmsms.hierselector + throw new CmsException('missingparams'); } else { // clean up the data a bit $tmp = array(); - foreach( $_REQUEST['pages'] as $one ) { + foreach( $_GET['pages'] as $one ) { $one = (int)$one; - // discard negative values + // ignore negative values (clone in-the-making?) if( $one > 0 ) $tmp[] = $one; } $peers = array_unique($tmp); - $out = []; foreach( $peers as $one ) { - $node = $hm->find_by_tag('id',$one); + $node = $contentops->quickfind_node_by_id($one); if( !$node ) continue; // get the parent $parent_node = $node->get_parent(); - // and get it's children + // and get its children $out[$one] = []; - $children = $parent_node->getChildren(FALSE,$allow_all); + $children = $parent_node->getChildren(FALSE,TRUE|FALSE|$allow_all TODO); //TODO is inactive ever selectable? for( $i = 0, $n = count($children); $i < $n; $i++ ) { - $content_obj = $children[$i]->getContent(FALSE); - if( ! $content_obj->IsViewable() ) continue; + $content = $children[$i]->getContent(FALSE); + if( !$content->IsViewable() ) continue; $rec = []; - $rec['content_id'] = $content_obj->Id(); - $rec['id_hierarchy'] = $content_obj->IdHierarchy(); - $rec['wants_children'] = $content_obj->WantsChildren(); + $rec['content_id'] = $content->Id(); + $rec['id_hierarchy'] = $content->IdHierarchy(); + $rec['wants_children'] = $content->WantsChildren(); $rec['has_children'] = $children[$i]->has_children(); - $rec['display'] = ($display == 'title') ? $content_obj->Name() : $content_obj->MenuText(); + $val = ( $display == 'title' ) ? $content->Name() : $content->MenuText(); + $rec['display'] = ( $val ) ? strip_tags($val) : lang('anonymous'); $out[$one][] = $rec; } } } break; - +*/ default: - throw new \Exception('missingparam'); + throw new CmsException('missingparam'); } } -catch( \Exception $e ) { - $error = $e->GetMessage(); +catch( Exception $e ) { + $out = array('status'=>'error','message'=>$e->GetMessage()); + $error = TRUE; } -if( $error ) { - $out = array('status'=>'error','message'=>lang($error)); -} -else { +if( empty($error) ) { $out = array('status'=>'success','op'=>$op,'data'=>$out); } -header('Pragma: public'); -header('Expires: 0'); -header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); -header('Cache-Control: private',false); -header('Content-Type: application/json'); echo json_encode($out); exit; diff --git a/admin/ajax_help.php b/admin/ajax_help.php index 63114337..64193299 100644 --- a/admin/ajax_help.php +++ b/admin/ajax_help.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 @@ -9,18 +8,17 @@ #(at your option) any later version. # #This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANthe TY; without even the implied warranty of +#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 # -#$Id: moduleinterface.php 8558 2012-12-10 00:59:49Z calguy1000 $ +#$Id$ -$CMS_ADMIN_PAGE=1; +$CMS_ADMIN_PAGE = 1; require_once("../lib/include.php"); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; check_login(); $realm = 'admin'; diff --git a/admin/ajax_lock.php b/admin/ajax_lock.php index 561e28f3..2b36367f 100644 --- a/admin/ajax_lock.php +++ b/admin/ajax_lock.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 @@ -9,24 +8,24 @@ #(at your option) any later version. # #This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANthe TY; without even the implied warranty of +#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 # -#$Id: moduleinterface.php 8558 2012-12-10 00:59:49Z calguy1000 $ +#$Id$ $handlers = ob_list_handlers(); for ($cnt = 0; $cnt < count($handlers); $cnt++) { ob_end_clean(); } -$CMS_ADMIN_PAGE=1; +$CMS_ADMIN_PAGE = 1; require_once("../lib/include.php"); $ruid = get_userid(FALSE); if( !$ruid ) return; -$fh = fopen('php://input','r'); +$fh = fopen('php://input','r'); // TODO don't assume stream is enabled $txt = fread($fh,8192); $data = ''; if( $txt ) { @@ -38,10 +37,11 @@ $opt = get_parameter_value($data,'opt','setup'); $type = get_parameter_value($data,'type'); -$oid = get_parameter_value($data,'oid'); -$uid = get_parameter_value($data,'uid'); -$lock_id = get_parameter_value($data,'lock_id'); -$lifetime = (int) get_parameter_value($data,'lifetime',cms_siteprefs::get('lock_timeout',60)); +$oid = get_parameter_value($data,'oid',0); // might be 0 or -1 +$uid = get_parameter_value($data,'uid',0); +$lock_id = get_parameter_value($data,'lock_id',0); +$lifetime = get_parameter_value($data,'lifetime',-1); +if ($lifetime == -1) $lifetime = (int)cms_siteprefs::get('lock_timeout',60); $out = array(); $out['status'] = 'success'; @@ -65,46 +65,46 @@ case 'test': // alias for check case 'is_locked': // alias for check case 'check': - if( !$type ) throw new CmsInvalidDataException(lang('missingparams')); - if( $oid ) { - $out['lock_id'] = CmsLockOperations::is_locked($type,$oid) ? 1 : 0; - } - else { - $tmp = CmsLockOperations::get_locks($type); - if( $tmp && is_array($tmp) ) $out['lock_id'] = -1; - } - break; + if( !$type ) throw new CmsInvalidDataException(lang('missingparams')); + if( $oid != 0 ) { // TODO if $oid == -1? + $out['lock_id'] = CmsLockOperations::is_locked($type,$oid) ? 1 : 0; + } + else { + $tmp = CmsLockOperations::get_locks($type); // typed locks for all users + if( $tmp && is_array($tmp) ) $out['lock_id'] = -1; + } + break; case 'lock': - if( $lifetime < 1 ) break; // do not lock, basically a noop - if( !$type || !$oid || !$uid ) throw new CmsInvalidDataException(lang('missingparams')); - if( $uid != $ruid ) throw new CmsLockOwnerException(lang('CMSEX_L006')); + if( $lifetime < 1 ) break; // do not lock, basically a noop + if( !$type || $oid == 0 || $uid < 1 ) throw new CmsInvalidDataException(lang('missingparams')); // TODO if $oid == -1? + if( $uid != $ruid ) throw new CmsLockOwnerException(lang('CMSEX_L006')); - // see if we can get this lock... if we can, it's just a touch - try { - $lock = CmsLock::load($type,$oid,$uid); - } - catch( CmsNoLockException $e ) { - // lock doesn't exist, gotta create one. - $lock = new CmsLock($type,$oid,$lifetime); - } - $lock->save(); - $out['lock_id'] = $lock['id']; - $out['lock_expires'] = $lock['expires']; - // and we're done. - break; + // see if we can get this lock... if we can, it's just a touch + try { + $lock = CmsLock::load($type,$oid,$uid); + } + catch( CmsNoLockException $e ) { + // lock doesn't exist, gotta create one. + $lock = new CmsLock($type,$oid,$lifetime); + } + $lock->save(); + $out['lock_id'] = $lock['id']; + $out['lock_expires'] = $lock['expires']; + // and we're done. + break; case 'touch': - if( !$type || !$oid || !$uid || $lock_id < 1 ) throw new CmsInvalidDataException(lang('missingparams')); - if( $uid != $ruid ) throw new CmsLockOwnerException(lang('CMSEX_L006')); - $out['lock_expires'] = CmsLockOperations::touch($lock_id,$type,$oid); - break; + if( !$type || $oid == 0 || $uid < 1 || $lock_id < 1 ) throw new CmsInvalidDataException(lang('missingparams')); // TODO if $oid == -1? + if( $uid != $ruid ) throw new CmsLockOwnerException(lang('CMSEX_L006')); + $out['lock_expires'] = CmsLockOperations::touch($lock_id,$type,$oid); + break; case 'unlock': - if( !$type || !$oid || !$uid || $lock_id < 1 ) throw new CmsInvalidDataException(lang('missingparams')); - if( $uid != $ruid ) throw new CmsLockOwnerException(lang('CMSEX_L006')); - CmsLockOperations::delete($lock_id,$type,$oid); - break; + if( !$type || $oid == 0 || $uid < 1 || $lock_id < 1 ) throw new CmsInvalidDataException(lang('missingparams')); // TODO if oid == -1? + if( $uid != $ruid ) throw new CmsLockOwnerException(lang('CMSEX_L006')); + CmsLockOperations::delete($lock_id,$type,$oid); + break; } } catch( CmsNoLockException $e ) { diff --git a/admin/asyncprocess.php b/admin/asyncprocess.php new file mode 100644 index 00000000..b169dcca --- /dev/null +++ b/admin/asyncprocess.php @@ -0,0 +1,160 @@ + + +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, read the license online at: +https://www.gnu.org/licenses/old-licenses/gpl-2.0.html +*/ + +use CMSMS\JobOperations; + +while( ob_get_level() ) { + @ob_end_clean(); +} +ignore_user_abort(); +header('Connection: close'); +header('X-CMSMS: Processing'); +echo ' '; // single character +flush(); + +if( !isset($_REQUEST['cms_cron']) ) { + exit; +} + +global $DONT_LOAD_SMARTY; +$DONT_LOAD_SMARTY = 1; + +require_once '../lib/include.php'; + +$now = time(); +$last_run = (int)JobOperations::retrieve_timestamp(0,'last_processing'); +$gap = JobOperations::get_async_freq(); +if( $now < $last_run + $gap ) { + exit; // too soon +} +$current_job = null; // the intra-loop 'current' job, if any - used during error handling + +if( !function_exists('_cmsjobmgr_errorhandler') ) { + function _cms_jobmgr_joberrorhandler($job,$errmsg,$errfile,$errline) + { + debug_to_log('Fatal error occurred processing async jobs at: '.$errfile.':'.$errline); + debug_to_log('Msg: '.$errmsg); + if( is_object($job) ) { + // add the id to the cache of error-jobs + $fn = TMP_CACHE_LOCATION.DIRECTORY_SEPARATOR.JobOperations::ERRFILE; + $fh = fopen($fn,'a'); + fwrite($fh,$job->id."\n"); + fclose($fh); + } + } + function _cmsjobmgr_errorhandler() + { + global $current_job; + $err = error_get_last(); + if( is_null($err) ) return; + if( $err['type'] != E_ERROR ) return; + if( $current_job ) { + _cms_jobmgr_joberrorhandler($current_job,$err['message'],$err['file'],$err['line']); + } + } +} +register_shutdown_function('_cmsjobmgr_errorhandler'); + +$db = CmsApp::get_instance()->GetDb(); +$save_time = function($job_id,$stamp) use($db) +{ + $sql = 'UPDATE '.CMS_DB_PREFIX.JobOperations::RECORDTABLE.' SET start = ? WHERE id = ?'; + $db->Execute($sql,[$stamp,$job_id]); +}; + +$me = basename(__FILE__); +try { + + if( JobOperations::is_locked() ) { + if( JobOperations::lock_expired() ) { + debug_to_log($me.': Removing an expired lock (probably an error occurred)'); + audit('',$me,'Removing an expired lock. An error probably occurred during previous job-processing.'); + JobOperations::unlock(); + } + else { + debug_to_log($me.': Processing still locked (probably due to an error)... try again later'); + audit('',$me,'Processing is already occurring'); + exit; + } + } + JobOperations::lock(); // block parallel processing + + JobOperations::process_errors(); + JobOperations::clear_bad_jobs(); + + $config = cms_config::get_instance(); + $devreport = !empty($config['developer_mode']); + $time_limit = JobOperations::get_batch_timeout(); + $started_at = $now; + + set_time_limit($time_limit); + JobOperations::record_eligible_jobs(); + $jobs = JobOperations::get_jobs(); + + foreach( $jobs as $job ) { + // skip future-start jobs + if( (int)$job->start > $now ) { // OR allow a little slop ? + continue; + } + try { + $current_job = $job; + if( $job instanceof RegularJob ) { + $nextat = 1; // force a downstream test whether to execute now + } + else { + $nextat = JobOperations::calculate_next_start_time($job); + } + if( $nextat == 0 ) { + if ( $job->id > 0 ) { + $job->delete(); + } + } + elseif( $nextat <= time() + 1 ) { + $pst = $job->start; + $res = $job->execute($now); // updates start property to $now, errors property if needed + if( $job->start != $pst ) { + $job->save(); // record updated start, errors + if( $devreport ) { + audit('',$me,'Processed job '.$job->name); + } + } + } + $current_job = null; + } + catch (Exception $e) { + audit($job->id,$me,'An error occurred while processing job '.$job->name); + _cms_jobmgr_joberrorhandler($current_job,$e->GetMessage(),$e->GetFile(),$e->GetLine()); + $current_job = null; + } + $now = time(); // update for timeout-check + // make sure we have not timed out + if( $now - $time_limit >= $started_at ) { + break; + } + } +} +catch (Exception $e) { + debug_to_log('--Major async processing exception--'); + debug_to_log('exception '.$e->GetMessage()); + debug_to_log($e->GetTraceAsString()); +} +JobOperations::record_timestamp(0,'last_processing',$now); +JobOperations::unlock(); + +exit; diff --git a/admin/changegroupassign.php b/admin/changegroupassign.php index dd1fe585..85470d06 100644 --- a/admin/changegroupassign.php +++ b/admin/changegroupassign.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,41 +15,34 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: changegroupassign.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'; +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; check_login(); -$group_id= - 1; -if (isset($_POST["group_id"])) $group_id = $_POST["group_id"]; -else if (isset($_GET["group_id"])) $group_id = $_GET["group_id"]; -$submitted = -1; -if (isset($_POST["submitted"])) $submitted = $_POST["submitted"]; -else if (isset($_GET["submitted"])) $submitted = $_GET["submitted"]; - -$group_name=""; - -if (isset($_POST["cancel"])) { - redirect("changegroupassign.php".$urlext); -return; +if (isset($_POST['cancel'])) { + redirect('index.php'.$urlext.'§ion=usersgroups'); } -$userid = get_userid(); +$userid = get_userid(false); $access = check_permission($userid, 'Manage Groups'); if (!$access) { - die('Permission Denied'); - return; + exit(lang('no_permission')); //TODO throw if can be caught } + +$submitted = (isset($_REQUEST['submitted'])) ? (int)$_REQUEST['submitted'] : -1; +$group_id = (isset($_REQUEST['group_id'])) ? (int)$_REQUEST['group_id'] : -1; +$group_name = ''; $gCms = cmsms(); $userops = $gCms->GetUserOperations(); -$adminuser = ($userops->UserInGroup($userid,1) || $userid == 1); +$adminuser = $userops->IsSuperuser($userid); $message = ''; -include_once("header.php"); +require_once 'header.php'; $db = $gCms->GetDb(); @@ -58,44 +50,45 @@ $disp_group = $_POST['groupsel']; cms_userprefs::set_for_user($userid,'changegroupassign_group',$disp_group); } -$disp_group = cms_userprefs::get_for_user($userid,'changegroupassign_group',-1); +else { + $disp_group = cms_userprefs::get_for_user($userid,'changegroupassign_group',-1); +} // always display the group pulldown -$gCms = cmsms(); $groupops = $gCms->GetGroupOperations(); -$userops = $gCms->GetUserOperations(); $tmp = new stdClass(); $tmp->name = lang('all_groups'); -$tmp->id=-1; +$tmp->id = -1; $allgroups = array($tmp); $groups = array($tmp); $group_list = $groupops->LoadGroups(); foreach( $group_list as $onegroup ) { - if( $onegroup->id == 1 && $adminuser == false ) continue; + if( $onegroup->id == 1 && !$adminuser ) continue; $allgroups[] = $onegroup; if( $disp_group == -1 || $disp_group == $onegroup->id ) $groups[] = $onegroup; } -$smarty->assign('group_list',$groups); -$smarty->assign('allgroups',$allgroups); -// because it's easier in PHP than Javascript: +$tpl = $smarty->createTemplate('admin_tpl:changeusergroup.tpl',null,null,$smarty,false); +$tpl->assign('group_list',$groups); +$tpl->assign('allgroups',$allgroups); + $groupidlist = array(); foreach ($group_list as $thisGroup) { $groupidlist[] = $thisGroup->id; } -$smarty->assign('groupidlist',implode(',',$groupidlist)); +$tpl->assign('groupidlist',implode(',',$groupidlist)); if ($submitted == 1) { + $query = "DELETE FROM ".CMS_DB_PREFIX."user_groups WHERE group_id = ? AND user_id != ?"; + $iquery = "INSERT INTO ".CMS_DB_PREFIX. + "user_groups (group_id, user_id, create_date, modified_date) VALUES (?,?,NOW(),NOW())"; foreach($groups as $thisGroup) { if( $thisGroup->id <= 0 ) continue; // Send the ChangeGroupAssignPre event \CMSMS\HookManager::do_hook( 'Core::ChangeGroupAssignPre', [ 'group' => $thisGroup, 'users' => $userops->LoadUsersInGroup($thisGroup->id) ] ); - $query = "DELETE FROM ".CMS_DB_PREFIX."user_groups WHERE group_id = ? AND user_id != ?"; $result = $db->Execute($query, array($thisGroup->id,$userid)); - $iquery = "INSERT INTO ".CMS_DB_PREFIX. - "user_groups (group_id, user_id, create_date, modified_date) VALUES (?,?,NOW(),NOW())"; foreach ($_POST as $key=>$value) { if (strpos($key,"ug") == 0 && strpos($key,"ug") !== false) { @@ -107,17 +100,16 @@ \CMSMS\HookManager::do_hook( 'Core::ChangeGroupAssignPost', [ 'group' => $thisGroup, 'users' => $userops->LoadUsersInGroup($thisGroup->id) ] ); // put mention into the admin log - audit($group_id, 'Assignment Group ID: '.$group_id, 'Changed'); + audit($group_id, 'Assigned Group ID: '.$group_id, 'Changed'); //TODO nonsense } // put mention into the admin log - audit($userid, 'Assignment User ID: '.$userid, 'Changed'); + $usernm = get_username(false); + audit($userid, 'Admin user', "Changed group membership of $usernm"); $message = lang('assignmentchanged'); $gCms->clear_cached_files(); } - - $query = "SELECT u.user_id, u.username, ug.group_id FROM ". CMS_DB_PREFIX."users u LEFT JOIN ".CMS_DB_PREFIX. "user_groups ug ON u.user_id = ug.user_id ORDER BY u.username"; @@ -126,7 +118,7 @@ $user_struct = array(); while($result && $row = $result->FetchRow()) { if (isset($user_struct[$row['user_id']])) { - $str = &$user_struct[$row['user_id']]; + $str = &$user_struct[$row['user_id']]; // TODO reference relevance $str->group[$row['group_id']]=1; } else { @@ -138,29 +130,19 @@ $user_struct[$row['user_id']] = $thisUser; } } -$smarty->assign('users',$user_struct); - -if( $adminuser ) $smarty->assign('adminuser',1); -$smarty->assign('disp_group',$disp_group); -$smarty->assign('user_id',$userid); -$smarty->assign('cms_secure_param_name',CMS_SECURE_PARAM_NAME); -$smarty->assign('cms_user_key',$_SESSION[CMS_USER_KEY]); -$smarty->assign('form_start','
    '); -$smarty->assign('filter_action','changegroupassign.php'); -$smarty->assign('form_end','
    '); -$smarty->assign('apply',lang('apply')); -$smarty->assign('selectgroup',lang('selectgroup')); -$smarty->assign('title_user',lang('user')); -$smarty->assign('hidden',''); -$smarty->assign('submit',''); -$smarty->assign('cancel',''); - - -# begin output -if( !empty($message) ) echo $themeObject->ShowMessage($message); -echo '
    '; -echo $themeObject->ShowHeader('groupassignments',array($group_name)); -echo $smarty->fetch('changeusergroup.tpl'); -echo '
    '; - -include_once("footer.php"); +$tpl->assign('users',$user_struct); + +$themeObject->set_value('pagetitle','groupassignments'); +//$themeObject->set_value('extra_lang_params',[$group_name]); + +if( !empty($message) ) $themeObject->ShowMessage($message); + +if( $adminuser ) $tpl->assign('adminuser',1); +$tpl->assign('disp_group',$disp_group); +$tpl->assign('user_id',$userid); +// see also $smarty-assigned var $secureparam +$tpl->assign('securename',CMS_SECURE_PARAM_NAME); +$tpl->assign('secureval',$_SESSION[CMS_USER_KEY]); +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/changegroupperm.php b/admin/changegroupperm.php index 7cd963aa..f472341d 100644 --- a/admin/changegroupperm.php +++ b/admin/changegroupperm.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,42 +15,38 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: changegroupperm.php 11870 2019-02-22 17:41:01Z calguy1000 $ +#$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'; +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; check_login(); -$submitted= - 1; -if (isset($_POST["submitted"])) $submitted = $_POST["submitted"]; -else if (isset($_GET["submitted"])) $submitted = $_GET["submitted"]; - -if (isset($_POST["cancel"])) { - redirect("changegroupperm.php".$urlext); - return; +if (isset($_POST['cancel'])) { + redirect('index.php'.$urlext.'§ion=usersgroups'); } -$userid = get_userid(); +$userid = get_userid(false); $access = check_permission($userid, 'Manage Groups'); if (!$access) { - die('Permission Denied'); - return; + exit(lang('no_permission')); //TODO throw if can be caught } +$submitted = (isset($_REQUEST["submitted"])) ? (int)$_REQUEST["submitted"] : -1; + $gCms = cmsms(); $userops = $gCms->GetUserOperations(); -$adminuser = ($userops->UserInGroup($userid,1) || $userid == 1); +$adminuser = $userops->IsSuperuser($userid); $group_name = ''; $message = ''; -include_once("header.php"); +require_once 'header.php'; + $db = $gCms->GetDb(); -$smarty = $gCms->GetSmarty(); -$load_perms = function() use ($db) { +$load_perms = function() use($db) { $query = "SELECT p.permission_id, p.permission_source, p.permission_text, up.group_id FROM ". CMS_DB_PREFIX."permissions p LEFT JOIN ".CMS_DB_PREFIX. "group_perms up ON p.permission_id = up.permission_id ORDER BY p.permission_text"; @@ -59,35 +54,41 @@ $result = $db->Execute($query); // use hooks to localize permissions. - \CMSMS\HookManager::add_hook('localizeperm',function($perm_name){ + \CMSMS\HookManager::add_hook('localizeperm',function($perm_name) { $key = 'perm_'.str_replace(' ','_',$perm_name); if( \CmsLangOperations::lang_key_exists('admin',$key) ) return \CmsLangOperations::lang_from_realm('admin',$key); return $perm_name; },\CMSMS\HookManager::PRIORITY_HIGH); - \CMSMS\HookManager::add_hook('getperminfo',function($perm_name){ + \CMSMS\HookManager::add_hook('getperminfo',function($perm_name) { $key = 'permdesc_'.str_replace(' ','_',$perm_name); if( \CmsLangOperations::lang_key_exists('admin',$key) ) return \CmsLangOperations::lang_from_realm('admin',$key); - // return null + // return null },\CMSMS\HookManager::PRIORITY_HIGH); $perm_struct = array(); - while($result && $row = $result->FetchRow()) { - if (isset($perm_struct[$row['permission_id']])) { - $str = &$perm_struct[$row['permission_id']]; - $str->group[$row['group_id']]=1; - } - else { - $thisPerm = new \stdClass(); - $thisPerm->group = array(); - if (!empty($row['group_id'])) $thisPerm->group[$row['group_id']] = 1; - $thisPerm->id = $row['permission_id']; - $thisPerm->name = $thisPerm->label = $row['permission_text']; - $thisPerm->source = $row['permission_source']; - $thisPerm->label = \CMSMS\HookManager::do_hook_first_result('localizeperm',$thisPerm->name); - $thisPerm->description = \CMSMS\HookManager::do_hook_first_result('getperminfo',$thisPerm->name); - $perm_struct[$row['permission_id']] = $thisPerm; + if ($result) { + while ($row = $result->FetchRow()) { + foreach (['permission_source','permission_text'] as $fld) { + if ($row[$fld] === null) $row[$fld] = ''; + } + if (isset($perm_struct[$row['permission_id']])) { + $str = &$perm_struct[$row['permission_id']]; + $str->group[$row['group_id']]=1; + } + else { + $thisPerm = new \stdClass(); + $thisPerm->group = array(); + if (!empty($row['group_id'])) $thisPerm->group[$row['group_id']] = 1; + $thisPerm->id = $row['permission_id']; + $thisPerm->name = $thisPerm->label = $row['permission_text']; + $thisPerm->source = $row['permission_source']; + $thisPerm->label = \CMSMS\HookManager::do_hook_first_result('localizeperm',$thisPerm->name); + $thisPerm->description = \CMSMS\HookManager::do_hook_first_result('getperminfo',$thisPerm->name); + $perm_struct[$row['permission_id']] = $thisPerm; + } } + $result->Close(); } return $perm_struct; }; @@ -98,7 +99,7 @@ return strcasecmp($a->name,$b->name); }); - $out = [];; + $out = []; foreach( $in_struct as $one ) { $source = $one->source; if( !isset($out[$source]) ) $out[$source] = []; @@ -117,8 +118,6 @@ return $out; }; -if (!$access) die('permission denied'); - if( isset($_POST['filter']) ) { $disp_group = $_POST['groupsel']; cms_userprefs::set_for_user($userid,'changegroupassign_group',$disp_group); @@ -143,12 +142,13 @@ } } -$smarty->assign('group_list',$sel_groups); -$smarty->assign('allgroups',$allgroups); +$tpl = $smarty->createTemplate('admin_tpl:changegroupperm.tpl',null,null,$smarty,false); +$tpl->assign('group_list',$sel_groups); +$tpl->assign('allgroups',$allgroups); if ($submitted == 1) { // we have group permissions - $now = $db->DbTimeStamp(time()); + $now = $db->DBTimeStamp(time()); $iquery = "INSERT INTO ".CMS_DB_PREFIX. "group_perms (group_perm_id, group_id, permission_id, create_date, modified_date) VALUES (?,?,?,$now,$now)"; @@ -164,6 +164,7 @@ $one = (int)$one; if( $one > 0 ) $tmp[] = $one; } + unset($one); $query = 'DELETE FROM '.CMS_DB_PREFIX.'group_perms WHERE group_id IN ('.implode(',',$tmp).')'; $db->Execute($query); } @@ -180,43 +181,37 @@ $new_id = $db->GenID(CMS_DB_PREFIX."group_perms_seq"); $result = $db->Execute($iquery, array($new_id,$keyparts[2],$keyparts[1])); if( !$result ) { - echo "FATAL: ".$db->ErrorMsg().'
    '.$db->sql; exit(); + echo "FATAL: ".$db->ErrorMsg().'
    '.$db->sql; + exit; } } } } // put mention into the admin log - audit($userid, 'Permission Group ID: '.$userid, 'Changed'); +// audit($userid, 'Permission Group ID: '.$userid, 'Changed'); + $usernm = get_username(false); + audit($userid, 'Admin user', "Changed permissions of $usernm"); $message = lang('permissionschanged'); $gCms->clear_cached_files(); } - $perm_struct = $load_perms(); -$perm_struct = $group_perms($perm_struct); -$smarty->assign('perms',$perm_struct); -$smarty->assign('cms_secure_param_name',CMS_SECURE_PARAM_NAME); -$smarty->assign('cms_user_key',$_SESSION[CMS_USER_KEY]); -$smarty->assign('form_start','
    '); -$smarty->assign('filter_action','changegroupperm.php'); -$smarty->assign('form_end','
    '); -$smarty->assign('disp_group',$disp_group); -$smarty->assign('apply',lang('apply')); -$smarty->assign('title_permission',lang('permission')); -$smarty->assign('selectgroup',lang('selectgroup')); -$tmp = base64_encode(json_encode($sel_group_ids)); -$sig = md5(__FILE__.$tmp); -$smarty->assign('hidden2',''); -$smarty->assign('hidden',''); -$smarty->assign('submit',''); -$smarty->assign('cancel',''); +$themeObject->set_value('pagetitle','groupperms'); +//$themeObject->set_value('extra_lang_params', [group_name]); -# begin output -if( !empty($message) ) echo $themeObject->ShowMessage($message); -echo '
    '.$themeObject->ShowHeader('groupperms',array($group_name)); -echo $smarty->fetch('changegroupperm.tpl'); -echo '
    '; +if( !empty($message) ) $themeObject->ShowMessage($message); + +$tpl->assign('perms',$group_perms($perm_struct)); +// see also $smarty-assigned var $secureparam +$tpl->assign('securename',CMS_SECURE_PARAM_NAME); +$tpl->assign('secureval',$_SESSION[CMS_USER_KEY]); +//if( !empty($message) ) $tpl->assign('message',$message); +$tpl->assign('disp_group',$disp_group); +$tmp = base64_encode(json_encode($sel_group_ids)); +$sig = md5(__FILE__.$tmp); +$tpl->assign('hiddenval2',"$sig::$tmp"); +$tpl->display(); -include_once("footer.php"); +require_once 'footer.php'; diff --git a/admin/checksum.php b/admin/checksum.php index 71a1b13f..9afb60a6 100644 --- a/admin/checksum.php +++ b/admin/checksum.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,61 +15,53 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: supportinfo.php 4216 2007-10-06 19:28:55Z wishy $ +#$Id$ -$CMS_ADMIN_PAGE=1; -$CMS_ADMIN_TITLE = 'system_verification'; -$orig_memory = (function_exists('memory_get_usage')?memory_get_usage():0); +$CMS_ADMIN_PAGE = 1; +//$CMS_ADMIN_TITLE = 'system_verification'; +$orig_memory = (function_exists('memory_get_usage')) ? memory_get_usage() : 0; -require_once("../lib/include.php"); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; -@set_time_limit(9999); // this may not work on all hosts +require_once '../lib/include.php'; //CMSMS functions N/A yet check_login(); $userid = get_userid(); -$access = check_permission($userid, "Modify Site Preferences"); -if (!$access) die('Permission Denied'); - - -include_once("header.php"); - -define('CMS_BASE', dirname(dirname(__FILE__))); -require_once cms_join_path(CMS_BASE, 'lib', 'test.functions.php'); - -function checksum_lang($params,$smarty) -{ - if( isset($params['key']) ) return lang($params['key']); +$access = check_permission($userid,'Modify Site Preferences'); +if( !$access ) { + exit(lang('no_permission')); //TODO throw if can be caught } +require_once 'header.php'; +require_once cms_join_path(dirname(__DIR__),'lib','test.functions.php'); + +//returns bool indicating success and if false, sets $report (string) function check_checksum_data(&$report) { if( (!isset($_FILES['cksumdat'])) || empty($_FILES['cksumdat']['name']) ) { $report = lang('error_nofileuploaded'); return false; } - else if( $_FILES['cksumdat']['error'] > 0 ) { + elseif( $_FILES['cksumdat']['error'] > 0 ) { $report = lang('error_uploadproblem'); return false; } - else if( $_FILES['cksumdat']['size'] == 0 ) { + elseif( $_FILES['cksumdat']['size'] == 0 ) { $report = lang('error_uploadproblem'); return false; } - $fh = fopen($_FILES['cksumdat']['tmp_name'],'r'); + $fh = fopen($_FILES['cksumdat']['tmp_name'],'rb'); if( !$fh ) { $report = lang('error_uploadproblem'); return false; } - - - $config = \cms_config::get_instance(); - $salt = md5_file($config['root_path']."/lib/version.php").md5_file($config['root_path']."/index.php"); - $filenotfound = array(); + $fp1 = cms_join_path(CMS_ROOT_PATH,'lib','version.php'); + $fp2 = CMS_ROOT_PATH.DIRECTORY_SEPARATOR.'index.php'; + $salt = md5_file($fp1).md5_file($fp2); + $filenotfound = []; $notreadable = 0; $md5failed = 0; - $filesfailed = array(); + $filesfailed = []; $filespassed = 0; $errorlines = 0; while( !feof($fh) ) { @@ -79,7 +70,7 @@ function check_checksum_data(&$report) // strip out comments $pos = strpos($line,'#'); - if( $pos !== FALSE ) $line = substr($line,0,$pos); + if( $pos !== false ) $line = substr($line,0,$pos); // trim the line $line = trim($line); @@ -88,7 +79,7 @@ function check_checksum_data(&$report) if( empty($line) ) continue; // split it into fields - if( strstr($line,'--::--') === FALSE ) { + if( strpos($line,'--::--') === false ) { $errorlines++; continue; } @@ -102,9 +93,9 @@ function check_checksum_data(&$report) $md5sum = trim($md5sum); $file = trim($file); - $fn = cms_join_path($config['root_path'],$file); + $fn = cms_join_path(CMS_ROOT_PATH,$file); if( !file_exists( $fn ) ) { - $filenotfound[] = $file; + $filenotfound[] = ' '.$file; continue; } @@ -121,108 +112,113 @@ function check_checksum_data(&$report) continue; } - if( $md5sum != $md5 ) $filesfailed[] = $file; + if( $md5sum != $md5 ) $filesfailed[] = ' '.$file; // it passed. $filespassed++; } fclose($fh); - if( $filespassed == 0 || count($filenotfound) || $errorlines || $notreadable || $md5failed || count($filesfailed) ) { + if( $filespassed == 0 || $filenotfound || $errorlines > 0 || $notreadable > 0 || $md5failed > 0 || $filesfailed ) { // build the error report - $tmp2 = array(); - if( $filespassed == 0 ) $tmp2[] = lang('no_files_scanned'); - if( $errorlines ) $tmp2[] = lang('lines_in_error',$errorlines); - if( $filenotfound ) $tmp2[] = sprintf("%d %s",count($filenotfound),lang('files_not_found')); - if( $notreadable ) $tmp2[] = sprintf("%d %s",$notreadable,lang('files_not_readable')); - if( $md5failed ) $tmp2[] = sprintf("%d %s",$md5failed,lang('files_checksum_failed')); - if( !empty($tmp) ) $tmp .= "
    "; - - $tmp = implode( "
    ", $tmp2 ); + $tmp2 = []; + if( $filespassed == 0 ) $tmp2[] = lang('no_files_scanned'); + if( $errorlines > 0 ) $tmp2[] = lang('lines_in_error',$errorlines); + if( $notreadable > 0 ) $tmp2[] = lang('files_not_readable',$notreadable); + if( $md5failed > 0 ) $tmp2[] = lang('files_checksum_failed',$md5failed); if( $filenotfound ) { - $tmp .= "
    ".lang('files_not_found').':'; - $tmp .= "
    ".implode("
    ",$filenotfound)."
    "; + $tmp2[] = lang('files_not_found',count($filenotfound)).':'; + $tmp2 = array_merge($tmp2,$filenotfound); } if( $filesfailed ) { - $tmp .= "
    ".count($filesfailed).' '.lang('files_failed').':'; - $tmp .= "
    ".implode("
    ",$filesfailed)."
    "; + $tmp2[] = lang('files_failed',count($filesfailed)).':'; + $tmp2 = array_merge($tmp2,$filesfailed); } - - $report = $tmp; + $report = implode('
    ',$tmp2); return false; } return true; } - +//returns false and sets $report (string) upon error, otherwise no return function generate_checksum_file(&$report) { - $gCms = cmsms(); - $config = $gCms->GetConfig(); - $output = ''; - $salt = md5_file($config['root_path']."/lib/version.php").md5_file($config['root_path']."/index.php"); - - $excludes = array('^\.svn' , '^CVS$' , '^\#.*\#$' , '~$', '\.bak$', '^uploads$', '^tmp$', '^captchas$' ); - $tmp = get_recursive_file_list( $config['root_path'], $excludes); - if( count($tmp) <= 1 ) { + $config = cms_config::get_instance(); + $uptop = basename($config['uploads_path']); + $tmp = get_recursive_file_list(CMS_ROOT_PATH, + ["^$uptop\$",'^tmp$','^captchas$','index\.html?$', + '^\.svn','^\.git','^CVS$','^\#.*\#$','~$','\.bak$']); //some of the exclusions are silly for production site + if( !$tmp ) { $report = lang('error_retrieving_file_list'); return false; } + $output = ''; + $fp1 = cms_join_path(CMS_ROOT_PATH,'lib','version.php'); + $fp2 = CMS_ROOT_PATH.DIRECTORY_SEPARATOR.'index.php'; + $salt = md5_file($fp1).md5_file($fp2); + foreach( $tmp as $file ) { if( is_dir($file) ) continue; $md5sum = md5($salt.md5_file($file)); - $file = str_replace($config['root_path'],'',$file); + $file = str_replace(CMS_ROOT_PATH,'',$file); $output .= "{$md5sum}--::--{$file}\n"; } - $handlers = ob_list_handlers(); - for ($cnt = 0; $cnt < count($handlers); $cnt++) { ob_end_clean(); } + $num = count(ob_list_handlers()); + for ($cnt = 0; $cnt < $num; $cnt++) { ob_end_clean(); } + header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private',false); header('Content-Description: File Transfer'); header('Content-Type: text/plain'); - header("Content-Disposition: attachment; filename=\"checksum.dat\"" ); + header('Content-Disposition: attachment; filename="checksum.dat"' ); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . strlen($output)); echo $output; exit; -} +}; // Get ready -$gCms = \CmsApp::get_instance(); -$theme = \cms_utils::get_theme_object(); -$smarty = $gCms->GetSmarty(); -$smarty->register_function('lang','checksum_lang'); -$smarty->caching = false; -$smarty->force_compile = true; -$db = &$gCms->GetDb(); + +$smarty->changeCaching(false); +$tpl = $smarty->createTemplate('admin_tpl:checksum.tpl',null,null,$smarty,false); +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; // Handle output -$res = true; -$report = ''; if( isset($_POST['action']) ) { + @set_time_limit(9999); // this might not work on some hosts + $res = true; + $report = ''; switch($_POST['action']) { - case 'upload': - $res = check_checksum_data($report); - if( $res === true ) $smarty->assign('message',lang('checksum_passed')); - break; - case 'download': - $res = generate_checksum_file($report); - break; + case 'upload': + $res = check_checksum_data($report); + if( $res ) { + $themeObject->ShowMessage(lang('checksum_passed')); + } + break; + case 'download': + $res = generate_checksum_file($report); + if( $res ) { + redirect('checksum.php'.$urlext.'&exported=1'); //come back here to show completion message DOESN'T WORK + return; //USEFUL? + } + break; + } + if( !$res ) { + $tpl->assign('error',$report); } } +elseif( !empty($_GET['exported']) ) { + $themeObject->ShowMessage(lang('msg_completed')); +} +$themeObject->set_value('pagetitle','system_verification'); -if( !$res ) $smarty->assign('error',$report); - -// Display the output -$smarty->assign('urlext',$urlext); -$smarty->assign('cms_secure_param_name',CMS_SECURE_PARAM_NAME); -$smarty->assign('cms_user_key',$_SESSION[CMS_USER_KEY]); -echo $smarty->fetch('checksum.tpl'); -include_once("footer.php"); +$tpl->assign('securename',CMS_SECURE_PARAM_NAME) + ->assign('secureval',$_SESSION[CMS_USER_KEY]); +$tpl->display(); -?> +require_once 'footer.php'; diff --git a/admin/cms_js_setup.php b/admin/cms_js_setup.php deleted file mode 100644 index b0a1caf0..00000000 --- a/admin/cms_js_setup.php +++ /dev/null @@ -1,93 +0,0 @@ -GetFilePickerModule(); -if( $fp ) { - $data['filepicker_url'] = $fp->get_browser_url(); - $data['filepicker_url'] = str_replace('&','&',$data['filepicker_url']).'&showtemplate=false'; -} - -// output some javascript -$out = 'cms_data = {};'."\n"; - -foreach( $data as $key => $value ) { - $value = json_encode($value); - $out .= "cms_data.{$key} = {$value};\n"; -} - -$out .= << diff --git a/admin/deletebookmark.php b/admin/deletebookmark.php index a629da83..59e35c2c 100644 --- a/admin/deletebookmark.php +++ b/admin/deletebookmark.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,19 +15,17 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: deletebookmark.php 10298 2015-11-01 23:00:32Z calguy1000 $ +#$Id$ -$CMS_ADMIN_PAGE=1; +$CMS_ADMIN_PAGE = 1; -require_once("../lib/include.php"); -require_once("../lib/classes/class.bookmark.inc.php"); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +require_once '../lib/include.php'; +//require_once '../lib/classes/class.Bookmark.php'; check_login(); $bookmark_id = -1; -if (isset($_GET["bookmark_id"])) -{ +if (isset($_GET["bookmark_id"])) { $bookmark_id = $_GET["bookmark_id"]; $result = false; @@ -36,13 +33,12 @@ $bookops = cmsms()->GetBookmarkOperations(); $markobj = $bookops->LoadBookmarkByID($bookmark_id); - if ($markobj) - { + if ($markobj) { $result = $markobj->Delete(); } - } +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; redirect("listbookmarks.php".$urlext); ?> diff --git a/admin/deletegroup.php b/admin/deletegroup.php index 87261b7d..2ccfead8 100644 --- a/admin/deletegroup.php +++ b/admin/deletegroup.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,16 +15,19 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: deletegroup.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'; +//require_once '../lib/classes/class.Group.php'; check_login(); +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; + $group_id = -1; if (isset($_GET["group_id"])) { $group_id = $_GET["group_id"]; @@ -35,7 +37,6 @@ redirect("listgroups.php".$urlext); } - $group_name = ""; $userid = get_userid(); $access = check_permission($userid, 'Manage Groups'); @@ -60,15 +61,15 @@ } // now do the work. - \CMSMS\HookManager::do_hook('Core::DeleteGroupPre', [ 'group'=>&$groupobj ] ); + HookManager::do_hook('Core::DeleteGroupPre', [ 'group'=>$groupobj ]); if ($groupobj) $result = $groupobj->Delete(); - \CMSMS\HookManager::do_hook('Core::DeleteGroupPost', [ 'group'=>&$groupobj ] ); + HookManager::do_hook('Core::DeleteGroupPost', [ 'group'=>$groupobj ]); if ($result == true) { // put mention into the admin log - audit($group_id, 'Admin User Group: '.$group_name, 'Deleted'); + audit($group_id, 'Admin users group', "Deleted: $group_name"); } } diff --git a/admin/deleteuser.php b/admin/deleteuser.php index 3d5886f5..6d12c44f 100644 --- a/admin/deleteuser.php +++ b/admin/deleteuser.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,17 +15,16 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: deleteuser.php 10820 2016-08-30 14:53:58Z calguy1000 $ -$CMS_ADMIN_PAGE=1; +#$Id$ + +$CMS_ADMIN_PAGE = 1; require_once("../lib/include.php"); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; check_login(); $cur_userid = get_userid(); -if( !check_permission($cur_userid, 'Manage Users') ) { -die('Permission Denied'); -return; +if (!check_permission($cur_userid, 'Manage Users')) { + exit(lang('no_permission')); //TODO throw if can be caught } $dodelete = true; @@ -34,9 +32,6 @@ $user_id = -1; if (isset($_GET["user_id"])) { $user_id = $_GET["user_id"]; - $user_name = ""; - $userid = get_userid(); - if ($user_id != $cur_userid) { $gCms = cmsms(); $userops = $gCms->GetUserOperations(); @@ -49,22 +44,23 @@ } if ($dodelete) { - \CMSMS\HookManager::do_hook('Core::DeleteUserPre', [ 'user'=>&$oneuser] ); + CMSMS\HookManager::do_hook('Core::DeleteUserPre', ['user'=>$oneuser]); cms_userprefs::remove_for_user($user_id); $oneuser->Delete(); - \CMSMS\HookManager::do_hook('Core::DeleteUserPost', [ 'user'=>&$oneuser] ); + CMSMS\HookManager::do_hook('Core::DeleteUserPost', ['user'=>$oneuser]); // put mention into the admin log - audit($user_id, 'Admin Username: '.$user_name, 'Deleted'); + audit($user_id, 'Admin user', "Deleted: $user_name"); } } } -if ($dodelete == true) { - redirect("listusers.php".$urlext); +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +if ($dodelete) { + redirect("listusers.php$urlext"); } else { - redirect("listusers.php".$urlext."&message=".lang('erroruserinuse')); + redirect("listusers.php{$urlext}&message=".lang('erroruserinuse')); } diff --git a/admin/deleteuserplugin.php b/admin/deleteuserplugin.php index 2ada2b63..e861046a 100644 --- a/admin/deleteuserplugin.php +++ b/admin/deleteuserplugin.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,7 +15,10 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: deleteuserplugin.php 12671 2021-12-13 03:05:01Z tomphantoo $ +#$Id$ + +use CMSMS\HookManager; +use CMSMS\internal\global_cache; $CMS_ADMIN_PAGE=1; @@ -45,31 +47,31 @@ $userplugin_name = $row['userplugin_name']; } - \CMSMS\HookManager::do_hook('Core::DeleteUserDefinedTagPre', [ 'id'=>$userplugin_id, 'name'=>&$userplugin_name] ); + HookManager::do_hook('Core::DeleteUserDefinedTagPre', ['id'=>$userplugin_id, 'name'=>&$userplugin_name]); - $query = 'SELECT event_id,handler_id,handler_order FROM '.CMS_DB_PREFIX.'event_handlers - WHERE tag_name = ?'; + $query = 'SELECT event_id,handler_id,handler_order FROM '.CMS_DB_PREFIX. + 'event_handlers WHERE handler = ? AND handler_type = '.Events::HANDLERUDT; $handlers = $db->GetArray($query,array($userplugin_name)); if( is_array($handlers) && count($handlers) > 0 ) { $q1 = 'DELETE FROM '.CMS_DB_PREFIX.'event_handlers WHERE handler_id = ?'; - $q2 = 'UPDATE '.CMS_DB_PREFIX.'event_handlers SET handler_order = (handler_order - 1) - WHERE handler_order > ? AND event_id = ?'; + $q2 = 'UPDATE '.CMS_DB_PREFIX. + 'event_handlers SET handler_order = (handler_order - 1) WHERE handler_order > ? AND event_id = ?'; foreach( $handlers as $tmp ) { $hid = $tmp['handler_id']; $eid = $tmp['event_id']; $db->Execute($q1,array($hid)); - $db->Execute($q2,array($tmp['handler_order'],$eid)); + $db->Execute($q2,array($tmp['handler_order'], $eid)); } } - $query = "DELETE FROM ".CMS_DB_PREFIX."userplugins where userplugin_id = ?"; + $query = "DELETE FROM ".CMS_DB_PREFIX."userplugins WHERE userplugin_id = ?"; $result = $db->Execute($query,array($userplugin_id)); if ($result) { - \CMSMS\internal\global_cache::clear(get_class(UserTagOperations::get_instance())); - \CMSMS\HookManager::do_hook('Core::DeleteUserDefinedTagPost', [ 'id'=>$userplugin_id, 'name'=>&$userplugin_name ]); + global_cache::clear(get_class(UserTagOperations::get_instance())); + HookManager::do_hook('Core::DeleteUserDefinedTagPost', [ 'id'=>$userplugin_id, 'name'=>&$userplugin_name ]); // put mention into the admin log - audit($userplugin_id, 'User Defined Tag: '.$userplugin_name, 'Deleted'); + audit($userplugin_id, 'User Defined Tag', "Deleted: $userplugin_name"); } } } diff --git a/admin/editbookmark.php b/admin/editbookmark.php index 63338233..5a799dbf 100644 --- a/admin/editbookmark.php +++ b/admin/editbookmark.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 @@ -12,111 +11,138 @@ #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 +#along with this program; if not, read the license online at: +#https://www.gnu.org/licenses/#LicenseURLs # -#$Id: editbookmark.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'; check_login(); -$db = cmsms()->GetDb(); +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; -$error = ""; +if (isset($_POST['cancel'])) { + redirect('listbookmarks.php'.$urlext); +} -$title = ""; -if (isset($_POST["title"])) $title = trim(cleanValue($_POST["title"])); +$error = ''; +$title = ''; +if (isset($_POST['title'])) { + $title = trim(cleanValue($_POST['title'])); +} -$myurl = ""; -if (isset($_POST["url"])) $myurl = trim(cleanValue($_POST["url"])); +$url = ''; +if (isset($_POST['url'])) { + $url = trim(cleanValue($_POST['url'])); +} +if ($url) { + $url = html_entity_decode($url); + $url = urldecode($url); + $url = str_replace('[ROOT_URL]', CMS_ROOT_URL, $url); + $extsub = substr($urlext, 1); + if (strpos($url, '[SECURITYTAG]') !== false) { // deprecated + $url = str_replace('[SECURITYTAG]', $extsub, $url); // allow parsing + } + + $reported = false; + $res = cms_utils::validate_url($url, '!executable'); // aka '!'.CMSMS\FileType::TYPE_EXECUTABLE + if ($res !== true) { + $error .= '
  • '.$res.'
  • '; + $reported = true; + unset($_POST['editbookmark']); + } + + // revert placeholder if any + $url = str_replace($extsub, '[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['editbookmark']); + if (!$reported) { // don't repeat same error + $error .= '
  • '.lang('error_badfield', lang('url')).'
  • '; + } + } + } + elseif (strpos($url, '[SECURITYTAG]') !== false) { + unset($_POST['editbookmark']); + if (!$reported) { + $error .= '
  • '.lang('error_badfield', lang('url')).'
  • '; + } + } +} // url $bookmark_id = -1; -if (isset($_POST["bookmark_id"])) $bookmark_id = (int)$_POST["bookmark_id"]; -else if (isset($_GET["bookmark_id"])) $bookmark_id = (int)$_GET["bookmark_id"]; - -if (isset($_POST["cancel"])) { - redirect("listbookmarks.php".$urlext); - return; +if (isset($_POST['bookmark_id'])) { + $bookmark_id = (int)$_POST['bookmark_id']; +} +elseif (isset($_GET['bookmark_id'])) { + $bookmark_id = (int)$_GET['bookmark_id']; } $userid = get_userid(); -if (isset($_POST["editbookmark"])) { - $validinfo = true; - if ($title == "") { - $validinfo = false; - $error .= "
  • ".lang('nofieldgiven', array(lang('title')))."
  • "; - } - if ($myurl == "") { - $validinfo = false; - $error .= "
  • ".lang('nofieldgiven', array(lang('url')))."
  • "; - } - - if ($validinfo) { - cmsms()->GetBookmarkOperations(); - $markobj = new Bookmark(); - $markobj->bookmark_id = $bookmark_id; - $markobj->title = $title; - $markobj->url = $myurl; - $markobj->user_id = $userid; - - $result = $markobj->save(); - - if ($result) { - redirect("listbookmarks.php".$urlext); - return; - } - else { - $error .= "
  • ".lang('errorupdatingbookmark')."
  • "; - } - } +if (isset($_POST['editbookmark'])) { + $validinfo = true; + if ($title == '') { + $validinfo = false; + $error .= '
  • '.lang('nofieldgiven', lang('title')).'
  • '; + } + if ($url == '') { + $validinfo = false; + $error .= '
  • '.lang('nofieldgiven', lang('url')).'
  • '; + } + + if ($validinfo) { + $markobj = new Bookmark(); + $markobj->bookmark_id = $bookmark_id; + $markobj->title = $title; + $markobj->url = $url; // revert any encoding removed during parsing ? + $markobj->user_id = $userid; + + $result = $markobj->save(); + + if ($result) { + redirect('listbookmarks.php'.$urlext); + } + else { + $error .= '
  • '.lang('errorupdatingbookmark').'
  • '; + } + } } -else if ($bookmark_id != -1) { - $query = "SELECT * from ".CMS_DB_PREFIX."admin_bookmarks WHERE bookmark_id = ?"; - $result = $db->Execute($query, array($bookmark_id)); - $row = $result->FetchRow(); - - $myurl = $row["url"]; - $title = $row["title"]; +elseif ($bookmark_id != -1) { + $db = cmsms()->GetDb(); + $query = 'SELECT * from '.CMS_DB_PREFIX.'admin_bookmarks WHERE bookmark_id = ?'; + $result = $db->Execute($query, [$bookmark_id]); + if ($result) { + $row = $result->FetchRow(); + foreach (['title', 'url'] as $fld) { + if ($row[$fld] === null) { + $row[$fld] = ''; + } + } + $url = $row['url']; + $title = $row['title']; + $result->Close(); + } } -if (strlen($title) > 0) $CMS_ADMIN_SUBTITLE = $title; - -include_once("header.php"); - -if ($error != "") echo '

    '.$error.'

    '; -?> - -
    - ShowHeader('editbookmark'); ?> -
    -
    - -
    -
    -

    :

    -

    -
    -
    -

    :

    -

    -
    -
    -

     

    -

    - - - -

    -
    -
    -
    - +require_once 'header.php'; +$themeObject->set_value('pagetitle', 'editbookmark'); + +$tpl = $smarty->createTemplate('admin_tpl:editbookmark.tpl', null, null, $smarty, false); +// see also $smarty-assigned var $secureparam +$tpl->assign('error', $error) + ->assign('securename', CMS_SECURE_PARAM_NAME) + ->assign('secureval', $_SESSION[CMS_USER_KEY]) + ->assign('bookmark_id', $bookmark_id) + ->assign('userid', $userid) + ->assign('title', $title) + ->assign('url', $url); +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/editevent.php b/admin/editevent.php index 17b41c7e..dfdc2a0d 100644 --- a/admin/editevent.php +++ b/admin/editevent.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,227 +15,160 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: listtags.php 2772 2006-05-17 02:25:27Z wishy $ +#$Id$ -$CMS_ADMIN_PAGE=1; +$CMS_ADMIN_PAGE = 1; + +require_once '../lib/include.php'; + +check_login(); + +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +if( isset($_POST['close']) ) { + redirect('eventhandlers.php'.$urlext); +} + +$userid = get_userid(); +$access = check_permission($userid, 'Modify Events'); +if( !$access ) { + exit(lang('no_permission')); //TODO throw if can be caught +} -require_once("../lib/include.php"); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; $gCms = cmsms(); $db = $gCms->GetDb(); -$userid = get_userid(); -$access = check_permission($userid, "Modify Events"); +require_once 'header.php'; -function display_error( $text ) +//TODO into template or themeobject->ShowError() +function display_error($text) { - echo "

    $text

    \n"; + echo "

    $text

    \n"; } -check_login(); +$action = ''; +$originator = ''; +$event = ''; +$handler = ''; + +if( isset($_POST['add']) ) { + // we're adding some funky event handler + if( !empty($_POST['originator']) ) $originator = trim(cleanValue($_POST['originator'])); + if( !empty($_POST['event']) ) $event = trim(cleanValue($_POST['event'])); + if( !empty($_POST['handler']) ) $handler = trim(cleanValue($_POST['handler'])); + if( $originator && $event && $handler ) { + if( startswith($handler, 'm:') ) { + $handler = substr($handler, 2); + Events::AddEventTypedHandler($originator, $event, $handler, Events::HANDLERMOD); + } + else { + Events::AddEventTypedHandler($originator, $event, $handler, Events::HANDLERUDT); + } + } +} +else { + // we're processing an up/down or delete + if( !empty($_GET['action']) ) $action = trim(cleanValue($_GET['action'])); + if( !empty($_GET['originator']) ) $originator = trim(cleanValue($_GET['originator'])); + if( !empty($_GET['event']) ) $event = trim(cleanValue($_GET['event'])); + if( $originator == '' || $event == '' || $action == '' ) { + display_error(lang('missingparams')); + return; + } + if( !empty($_GET['handler']) ) $handler = (int)$_GET['handler']; + $cur_order = ( !empty($_GET['order']) ) ? (int)$_GET['order'] : -1; + + switch( $action ) { + case 'up': + // move an item up (decrease the order) + // increases the previous order, and decreases the current handler id + if( !$handler || $cur_order < 1 ) { + display_error(lang('missingparams')); + return; + } + Events::OrderHandlerUp($handler); + break; + + case 'down': + // move an item down (increase the order) + // move an item up (decrease the order) + // increases the previous order, and decreases the current handler id + if( !$handler || $cur_order < 1 ) { + display_error(lang('missingparams')); + return; + } + Events::OrderHandlerDown($handler); + break; + + case 'delete': + if( !$handler ) { + display_error( lang('missingparams' ) ); + return; + } + Events::RemoveEventHandlerById($handler); + break; + + default: + // unknown or unset action + break; + } // switch +} // else + +// get the event description +$usertagops = $gCms->GetUserTagOperations(); + +$description = ''; +$modulename = ''; +if ($originator == 'Core') { + $description = Events::GetEventDescription($event); + $modulename = lang('core'); +} +else { + $objinstance = cms_utils::get_module($originator); + $description = $objinstance->GetEventDescription($event); + $modulename = $objinstance->GetFriendlyName(); +} + +// get the handlers of this event, formatted for public presentation +$handlers = Events::ListEventHandlers($originator, $event, true); + +$allhandlers = array(); +// get all UDTs +$usertags = $usertagops->ListUserTags(); +foreach( $usertags as $value ) { + $allhandlers[$value] = $value; +} -include_once("header.php"); +// get all available module-handlers +//$checkmodules = module_meta::get_instance()->module_list_by_capability(CmsCoreCapabilities::EVENTS); +$allmodules = ModuleOperations::get_instance()->GetInstalledModules(); +foreach( $allmodules as $key ) { + if( $key == $modulename ) continue; + $modobj = ModuleOperations::get_instance()->get_module_instance($key); + if( $modobj && $modobj->HandlesEvents() ) { +// if( !in_array($key, $checkmodules) ) { audit('', 'Event handler', "$key module needs capabilities-update"); } + $allhandlers[$key] = 'm:'.$key; + } +} $downImg = $themeObject->DisplayImage('icons/system/arrow-d.gif', lang('down'),'','','systemicon'); $upImg = $themeObject->DisplayImage('icons/system/arrow-u.gif', lang('up'),'','','systemicon'); $deleteImg = $themeObject->DisplayImage('icons/system/delete.gif', lang('delete'),'','','systemicon'); - - -echo "
    \n"; -echo "
    \n"; -echo $themeObject->ShowHeader('editeventhandler'); -echo "
    \n"; - -if ($access) { - $action = ""; - $module = ""; - $event = ""; - $handler = ""; - if( isset( $_POST['add'] ) ) { - // we're adding some funky event handler - if( isset( $_POST['module'] ) && $_POST['module'] != '' ) $module = trim(cleanValue($_POST['module'])); - if( isset( $_POST['event'] ) && $_POST['event'] != '' ) $event = trim(cleanValue($_POST['event'])); - if( isset( $_POST['handler'] ) ) $handler = trim(cleanValue($_POST['handler'])); - if( $module && $event && $handler ) { - if( substr( $handler, 0, 2 ) == "m:" ) { - $handler = substr( $handler, 2 ); - Events::AddEventHandler( $module, $event, false, $handler ); - } - else { - Events::AddEventHandler( $module, $event, $handler ); - } - } - } - else { - $cur_order = -1; - - // we're processing an up/down or delete - if( isset( $_GET['action'] ) && $_GET['action'] != '' ) $action = trim(cleanValue($_GET['action'])); - if( isset( $_GET['module'] ) && $_GET['module'] != '' ) $module = trim(cleanValue($_GET['module'])); - if( isset( $_GET['event'] ) && $_GET['event'] != '' ) $event = trim(cleanValue($_GET['event'])); - if( isset( $_GET['handler'] ) && $_GET['handler'] != '' ) $handler = (int)$_GET['handler']; - if( isset( $_GET['order'] ) && $_GET['order'] != '' ) $cur_order = (int)$_GET['order']; - if( $module == "" || $event == "" || $action == "" ) { - display_error( lang("missingparams" ) ); - return; - } - - switch( $action ) { - case 'up': - // move an item up (decrease the order) - // increases the previous order, and decreases the current handler id - if( !$handler || $cur_order < 1 ) { - display_error( lang("missingparams" ) ); - return; - } - Events::OrderHandlerUp( $handler ); - break; - - case 'down': - // move an item down (increase the order) - // move an item up (decrease the order) - // increases the previous order, and decreases the current handler id - if( !$handler || $cur_order < 1 ) { - display_error( lang("missingparams" ) ); - return; - } - Events::OrderHandlerDown( $handler ); - break; - - case 'delete': - if( !$handler ) { - display_error( lang("missingparams" ) ); - return; - } - Events::RemoveEventHandlerById( $handler ); - break; - - default: - // unknown or unset action - break; - } // switch - } // else - - // get the event description - $usertagops = $gCms->GetUserTagOperations(); - - $description = ''; - $modulename = ''; - if ($module == 'Core') { - $description = Events::GetEventDescription($event); - $modulename = lang('core'); - } - else { - $objinstance = cms_utils::get_module($module); - $description = $objinstance->GetEventDescription($event); - $modulename = $objinstance->GetFriendlyName(); - } - - // and now get the list of handlers for this event - $handlers = Events::ListEventHandlers( $module, $event ); - - // and the list of all available handlers - $allhandlers = array(); - // we get the list of user tags, and add them to the list - $usertags = $usertagops->ListUserTags(); - foreach( $usertags as $key => $value ) { - $allhandlers[$value] = $value; - } - - // and the list of modules, and add them - $allmodules = ModuleOperations::get_instance()->GetInstalledModules(); - foreach( $allmodules as $key ) { - if( $key == $modulename ) continue; - $modobj = ModuleOperations::get_instance()->get_module_instance($key); - if( $modobj && $modobj->HandlesEvents() ) { - $allhandlers[$key] = 'm:'.$key; - } - } - - echo "
    \n"; - echo "

    ".lang("module_name").":

    \n"; - echo "

    ".$modulename."

    \n"; - echo "
    \n"; - echo "
    \n"; - echo "

    ".lang("event_name").":

    \n"; - echo "

    ".$event."

    \n"; - echo "
    \n"; - echo "
    \n"; - echo "

    ".lang("event_description").":

    \n"; - echo "

    ".$description."

    \n"; - echo "
    \n"; - - echo "
    \n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n"; - - $rowclass = "row1"; - if( $handlers != false ) { - echo "\n"; - $idx = 0; - $url = "editevent.php".$urlext."&module=".$module."&event=".$event; - foreach( $handlers as $onehandler ) { - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - if( $idx != 0 ) { - echo " \n"; - } - else { - echo ""; - } - if( $idx + 1 != count($handlers) ) { - echo " \n"; - } - else { - echo ""; - } - if( $onehandler['removable'] == 1 ) { - echo " \n"; - } - else { - echo " \n"; - } - echo "\n"; - - $idx++; - } - - } - else{ - echo "\n"; - echo "\n"; - echo ""; - echo "\n"; - } - echo "\n"; - echo "
    ".lang('order')."".lang('user_tag')."".lang('module')."   
    ".$onehandler['handler_order']."".$onehandler['tag_name']."".$onehandler['module_name']."$upImg $downImg $deleteImg 
     
    \n"; - echo "
    \n"; - echo "
    \n"; - echo ''."\n"; - echo ''."\n"; - echo "
    \n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo ""; - echo "
    \n"; - echo "
    \n"; -} -else { - display_error(lang('noaccessto', array(lang('editeventhandler')))); -} -include_once("footer.php"); +$themeObject->set_value('pagetitle', 'editeventhandler'); + +$tpl = $smarty->createTemplate('admin_tpl:editevent.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('selfurl', 'editevent.php') + ->assign('description', $description) + ->assign('event', $event) + ->assign('allhandlers', $allhandlers) + ->assign('handlers', $handlers) + ->assign('icondel', $deleteImg) + ->assign('icondown', $downImg) + ->assign('iconup', $upImg) + ->assign('originator', $originator) + ->assign('modulename', $modulename); +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/editgroup.php b/admin/editgroup.php index b3950032..46b21802 100644 --- a/admin/editgroup.php +++ b/admin/editgroup.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,135 +15,94 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: editgroup.php 11053 2017-02-04 04:20:03Z calguy1000 $ +#$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]; -$gCms = cmsms(); -$db = $gCms->GetDb(); - -$error = ""; - -$dropdown = ""; - -$group = ""; -if (isset($_POST["group"])) $group = cleanValue($_POST["group"]); - -$description = ""; -if (isset($_POST["description"])) $description = cleanValue($_POST["description"]); - -$group_id = -1; -if (isset($_POST["group_id"])) $group_id = (int) $_POST["group_id"]; -else if (isset($_GET["group_id"])) $group_id = (int) $_GET["group_id"]; - -$active = 1; -if (!isset($_POST["active"]) && isset($_POST["editgroup"]) && $group_id != 1) $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 +} + +$error = ''; +$group = (isset($_POST['group'])) ? cleanValue($_POST['group']) : ''; +$description = (isset($_POST['description'])) ? cleanValue($_POST['description']) : ''; +$group_id = (isset($_REQUEST['group_id'])) ? (int)$_REQUEST['group_id'] : -1; +$active = (isset($_POST['editgroup']) && empty($_POST['active']) && $group_id != 1) ? 0 : 1; + +$gCms = cmsms(); $userops = $gCms->GetUserOperations(); $useringroup = $userops->UserInGroup($userid,$group_id); -if ($access) { - $groupobj = new Group; - if( $group_id > 0 ) { - $groupobj = Group::load($group_id); - } - if (isset($_POST["editgroup"])) { - $validinfo = true; - if ($group == "") { - $validinfo = false; - $error .= "
  • ".lang('nofieldgiven', array(lang('groupname')))."
  • "; - } +require_once '../lib/classes/class.Group.php';; //don't bother autoloading - if ($validinfo) { - $groupobj->name = $group; - $groupobj->description = $description; - $groupobj->active = $active; - \CMSMS\HookManager::do_hook('Core::EditGroupPre', [ 'group'=>&$groupobj ] ); - - $result = $groupobj->save(); - if ($result) { - \CMSMS\HookManager::do_hook('Core::EditGroupPost', [ 'group'=>&$groupobj ] ); - - // put mention into the admin log - audit($groupobj->id, 'Admin User Group: '.$groupobj->name, 'Edited'); - redirect("listgroups.php".$urlext); - return; - } - else { - $error .= "
  • ".lang('errorupdatinggroup')."
  • "; - } - } +if( $group_id > 0 ) { + $groupobj = Group::load($group_id); +} +else { + $groupobj = new Group(); +} +if( isset($_POST['editgroup']) ) { + $validinfo = true; + if( !$group ) { + $validinfo = false; + $error .= '
  • '.lang('nofieldgiven', lang('groupname')).'
  • '; } - else if ($group_id != -1) { - $group = $groupobj->name; - $description = $groupobj->description; - $active = $groupobj->active; - } -} -if (strlen($group) > 0) $CMS_ADMIN_SUBTITLE = $group; -include_once("header.php"); + if( $validinfo ) { + $groupobj->name = $group; + $groupobj->description = $description; + $groupobj->active = $active; + HookManager::do_hook('Core::EditGroupPre', ['group'=>$groupobj]); -if (!$access) { - echo "

    ".lang('noaccessto', array(lang('editgroup')))."

    "; -} -else { - if ($error != "") { - echo "
      ".$error."
    "; - } -?> - -
    - ShowHeader('editgroup'); ?> -
    -
    - -
    -
    -

    -

    -
    -
    -

    -

    -
    - -
    -

    -

    />

    -
    - -
    - -
    -

     

    -

    - - - -

    -
    -
    -
    -save(); + if( $result ) { + HookManager::do_hook('Core::EditGroupPost', ['group'=>$groupobj]); + // put mention into the admin log + audit($groupobj->id, 'Admin users group',"Edited: $groupobj->name"); + redirect('listgroups.php'.$urlext); +// return; + } + else { + $error .= '
  • '.lang('errorupdatinggroup').'
  • '; + } + } +} +elseif( $group_id != -1 ) { + $group = $groupobj->name; + $description = $groupobj->description; + $active = $groupobj->active; } -include_once("footer.php"); - - -?> +require_once 'header.php'; + +$themeObject->set_value('pagetitle', 'editgroup'); +//if( $group ) $CMS_ADMIN_SUBTITLE = $group; does nothing + +$tpl = $smarty->createTemplate('admin_tpl:editgroup.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_id', $group_id) + ->assign('useringroup', $useringroup) + ->assign('group', $group) + ->assign('description', $description); +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/edituser.php b/admin/edituser.php index e3ce3c2d..790d308b 100644 --- a/admin/edituser.php +++ b/admin/edituser.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,41 +15,79 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: edituser.php 12671 2021-12-13 03:05:01Z tomphantoo $ +#$Id$ + +use CMSMS\HookManager; + $CMS_ADMIN_PAGE = 1; require_once ('../lib/include.php'); +$urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]; + check_login(); -$userid = get_userid(); +if (isset($_POST['cancel'])) { + redirect('listusers.php' . $urlext); +} -if (!check_permission($userid, 'Manage Users')) die('Permission Denied'); +$userid = get_userid(); +if (!check_permission($userid, 'Manage Users')) { + exit(lang('no_permission')); //TODO throw if can be caught +} /*-------------------- * Variables ---------------------*/ -$urlext = CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]; -$gCms = cmsms(); -$db = $gCms->GetDb(); -$error = ''; -$dropdown = ''; -$adminaccess = 1; -$active = 1; -$tplmaster = 0; -$copyfromtemplate = 1; -$message = ''; -$user_id = $userid; -// Post data -$user = isset($_POST["user"]) ? cleanValue($_POST["user"]) : ''; -$password = isset($_POST["password"]) ? $_POST["password"] : ''; -$passwordagain = isset($_POST["passwordagain"]) ? $_POST["passwordagain"] : ''; -$firstname = isset($_POST["firstname"]) ? cleanValue($_POST["firstname"]) : ''; -$lastname = isset($_POST["lastname"]) ? cleanValue($_POST["lastname"]) : ''; -$email = isset($_POST["email"]) ? trim(strip_tags($_POST["email"])) : ''; - -if (isset($_POST["user_id"])) { - $user_id = cleanValue($_POST["user_id"]); -} elseif (isset($_GET["user_id"])) { - $user_id = cleanValue($_GET["user_id"]); +$gCms = cmsms(); +$db = $gCms->GetDb(); +$error = ''; +$dropdown = ''; +$adminaccess = 1; +$active = 1; +$tplmaster = 0; +$copyfromtemplate = 1; +$message = ''; +$user_id = $userid; +if (isset($_GET['user_id'])) { + $user_id = preg_replace('/[^a-zA-Z0-9._\- \x8c\x8e\x9c\x9e\x9f\xc0-\xd6\xd8-\xf6\xf8-\xff\pL\p{Nd}\p{Po}]/u', '', trim($_GET['user_id'])); +} + +// POST[] data +/* +$user = isset($_POST["user"]) ? cleanValue($_POST["user"]) : ''; +$password = isset($_POST["password"]) ? $_POST["password"] : ''; +$passwordagain = isset($_POST["passwordagain"]) ? $_POST["passwordagain"] : ''; +$firstname = isset($_POST["firstname"]) ? cleanValue($_POST["firstname"]) : ''; +$lastname = isset($_POST["lastname"]) ? cleanValue($_POST["lastname"]) : ''; +$email = isset($_POST["email"]) ? trim(strip_tags($_POST["email"])) : ''; +*/ +$user = ''; +$password = ''; +$passwordagain = ''; +$firstname = ''; +$lastname = ''; +$email = ''; +foreach ($_POST as $key => $val) { + switch ($key) { + case 'user': //account + case 'user_id': + //scrub malicious/XSS & invalid content + $$key = preg_replace('/[^a-zA-Z0-9._\- \x8c\x8e\x9c\x9e\x9f\xc0-\xd6\xd8-\xf6\xf8-\xff\pL\p{Nd}\p{Po}]/u', '', trim($val)); + break; + case 'firstname': + case 'lastname': + //scrub malicious/XSS & invalid + $$key = preg_replace(['/[\x00-\x1f\x7f]/', '/<[^>]*>/', '/(<|%3c)(\?|%3f)php.*$/i', '/(<|%3c)(\?|%3f)\=?.*$/i'], ['', '', '', ''], trim($val)); //c.f. $sanitize_fn in include.php + break; + case 'password': + case 'passwordagain': + //scrub malicious/XSS & non-printables + $$key = preg_replace(['/[\x00-\x1f\x7f]/', '/(<|%3c)(\?|%3f)php.*$/i', '/(<|%3c)(\?|%3f)=?.*$/i'], ['', '', ''], $val); + break; + case 'email': + //TODO scrub XSS & invalid + //PHP's FILTER_VALIDATE_EMAIL mechanism is incomplete (per RFC5321) - see notes at https://www.php.net/manual/en/function.filter-var.php + $email = filter_var(trim($val), FILTER_SANITIZE_EMAIL); + } } // this is now always true... but we may want to change how things work, so I'll leave it @@ -58,7 +95,7 @@ $groupops = $gCms->GetGroupOperations(); $group_list = $groupops->LoadGroups(); $access_user = ($userid == $user_id); -$access_group = $userops->UserInGroup($userid, 1) || (!$userops->UserInGroup($user_id, 1)); +$access_group = $userops->UserInGroup($userid, 1) || (!$userops->UserInGroup($user_id, 1)); //TODO check logic $access = $access_user && $access_group; $assign_group_perm = check_permission($userid, 'Manage Groups'); $manage_users = check_permission($userid, 'Manage Users'); @@ -68,11 +105,6 @@ * Logic ---------------------*/ -if (isset($_POST['cancel'])) { - redirect('listusers.php?' . $urlext); - return; -} - if (isset($_POST["submit"])) { if( !$access_user && isset($_POST['active']) ) $active = (int) $_POST['active']; @@ -81,24 +113,29 @@ $validinfo = true; // check for errors - if ($user == '') { + if ($user == "") { //falsy ok? $validinfo = false; - $error .= "
  • " . lang('nofieldgiven', array(lang('username'))) . "
  • "; - } - - if (!preg_match("/^[a-zA-Z0-9\._ ]+$/", $user)) { + $error .= "
  • " . lang('nofieldgiven', lang('username')) . "
  • "; + } elseif ($user != trim($_POST['user'])) { $validinfo = false; - $error .= "
  • " . lang('illegalcharacters', array(lang('username'))) . "
  • "; + $error .= "
  • " . lang('illegalcharacters', lang('username')) . "
  • "; } - if ($password != $passwordagain) { + if (isset($_POST["password"]) && $_POST['password'] != $password) { + $error .= "
  • " . lang('illegalcharacters', lang('password')) . "
  • "; + } elseif ($password != $passwordagain) { $validinfo = false; $error .= "
  • " . lang('nopasswordmatch') . "
  • "; } - if (!empty($email) && !is_email($email)) { - $validinfo = false; - $error .= '
  • ' . lang('invalidemail') . ': ' . $email . '
  • '; + if ($email) { + if ($email != trim($_POST['email'])) { + $validinfo = false; + $error .= '
  • ' . lang('invalidemail') . '
  • '; + } elseif (!is_email($email)) { + $validinfo = false; + $error .= '
  • ' . lang('invalidemail') . '
  • '; + } } if (isset($_POST['copyusersettings']) && $_POST['copyusersettings'] > 0) { @@ -119,16 +156,16 @@ $thisuser->email = $email; $thisuser->adminaccess = $adminaccess; $thisuser->active = $active; - if ($password != '') + if ($password != '') { $thisuser->SetPassword($password); - - \CMSMS\HookManager::do_hook('Core::EditUserPre', [ 'user'=>&$thisuser ] ); + } + HookManager::do_hook('Core::EditUserPre', [ 'user'=>$thisuser ]); $result = $thisuser->save(); if ($assign_group_perm && isset($_POST['groups'])) { - $dquery = "delete from " . CMS_DB_PREFIX . "user_groups where user_id=?"; - $iquery = "insert into " . CMS_DB_PREFIX . "user_groups (user_id,group_id) VALUES (?,?)"; + $dquery = "DELETE FROM " . CMS_DB_PREFIX . "user_groups WHERE user_id=?"; $result = $db->Execute($dquery, array($thisuser->id)); + $iquery = "INSERT INTO " . CMS_DB_PREFIX . "user_groups (user_id,group_id) VALUES (?,?)"; foreach ($group_list as $thisGroup) { if (isset($_POST['g' . $thisGroup->id]) && $_POST['g' . $thisGroup->id] == 1) { $result = $db->Execute($iquery, array( @@ -140,34 +177,34 @@ } } - audit($userid, 'Admin Username: ' . $thisuser->username, ' Edited'); + audit($userid, 'Admin user', "Edited: $thisuser->username"); $message = lang('edited_user'); if ($result) { if (isset($_POST['copyusersettings']) && $_POST['copyusersettings'] > 0) { - // copy user preferences from the template user to this user. + // copy user preferences from the specified user to this one $prefs = cms_userprefs::get_all_for_user((int)$_POST['copyusersettings']); if (is_array($prefs) && count($prefs)) { cms_userprefs::remove_for_user($user_id); foreach ($prefs as $k => $v) { cms_userprefs::set_for_user($user_id, $k, $v); } - audit($user_id, 'Admin Username: ' . $thisuser->username, 'settings copied from template user'); + audit($user_id, 'Admin user', 'Settings of user id '.(int)$_POST['copyusersettings'].' copied to '.$thisuser->username); $message = lang('msg_usersettingscopied'); } } else if (isset($_POST['clearusersettings'])) { // clear all preferences for this user. - audit($user_id, 'Admin Username: ' . $thisuser->username, ' settings cleared'); + audit($user_id, 'Admin user', "Cleared all settings of $thisuser->username"); cms_userprefs::remove_for_user($user_id); $message = lang('msg_usersettingscleared'); } // put mention into the admin log - \CMSMS\HookManager::do_hook('Core::EditUserPost', [ 'user'=>&$thisuser ] ); + HookManager::do_hook('Core::EditUserPost', [ 'user'=>$thisuser ]); $gCms->clear_cached_files(); - $url = 'listusers.php?' . $urlext; + $url = 'listusers.php' . $urlext; if ($message) { - $message = urlencode($message); + $message = rawurlencode($message); $url .= '&message=' . $message; } redirect($url); @@ -189,38 +226,31 @@ * Display view ---------------------*/ -include_once ('header.php'); +require_once 'header.php'; -if (false == empty($error)) echo $themeObject->ShowErrors(''); +if (!empty($error)) $themeObject->ShowErrors(''); -$out = array(-1 => lang('none')); -$userlist = UserOperations::get_instance()->LoadUsers(); - -foreach ($userlist as $one) { - if ($one->id == $user_id) continue; - $out[$one->id] = $one->username; -} +$tpl = $smarty->createTemplate('admin_tpl:edituser.tpl', null, null, $smarty, false); +$selector = UserOperations::get_instance()->GenerateDropdown(0, 'copyusersettings', [$user_id], [-1 => lang('none')]); if ($assign_group_perm && !$access_user) { $groups = GroupOperations::get_instance()->LoadGroups(); - $smarty->assign('groups', $groups); - $smarty->assign('membergroups', UserOperations::get_instance()->GetMemberGroups($user_id)); + $tpl->assign('groups', $groups); + $tpl->assign('membergroups', UserOperations::get_instance()->GetMemberGroups($user_id)); } -$smarty->assign('user_id', $user_id); -$smarty->assign('user', $user); -$smarty->assign('firstname', $firstname); -$smarty->assign('lastname', $lastname); -$smarty->assign('email', $email); -$smarty->assign('adminaccess', $adminaccess); -$smarty->assign('active', $active); -$smarty->assign('tplmaster', $tplmaster); -$smarty->assign('copyfromtemplate', $copyfromtemplate); -$smarty->assign('access_user', $access_user); -$smarty->assign('manage_users', $manage_users); -$smarty->assign('users', $out); - -$smarty->display('edituser.tpl'); - -include_once ('footer.php'); -?> +$tpl->assign('user_id', $user_id) + ->assign('user', $user) + ->assign('firstname', $firstname) + ->assign('lastname', $lastname) + ->assign('email', $email) + ->assign('adminaccess', $adminaccess) + ->assign('active', $active) + ->assign('tplmaster', $tplmaster) + ->assign('copyfromtemplate', $copyfromtemplate) + ->assign('access_user', $access_user) + ->assign('manage_users', $manage_users) + ->assign('userselect', $selector); +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/editusertag.php b/admin/editusertag.php index b29d2422..58a71fef 100644 --- a/admin/editusertag.php +++ b/admin/editusertag.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,21 +15,24 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: listusertags.php 7396 2011-09-15 12:57:25Z rolf1 $ +#$Id$ -$CMS_ADMIN_PAGE=1; -require_once("../lib/include.php"); +$CMS_ADMIN_PAGE = 1; +require_once "../lib/include.php"; check_login(); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; $userid = get_userid(); if( !check_permission($userid, 'Modify User-defined Tags') ) return; + +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +if( isset($_POST['cancel']) ) redirect('listusertags.php'.$urlext); + $tagops = cmsms()->GetUserTagOperations(); -$themeObject = null; +$themeObject = null; // object not yet set $userplugin_id = 0; if( !isset($_POST['ajax']) ) { - include_once('header.php'); - $themeObject->set_value('pagetitle','userdefinedtags'); // generic header for oneeleven + require_once 'header.php'; + $themeObject->set_value('pagetitle', 'userdefinedtags'); } $record = array('userplugin_id'=>'', @@ -44,8 +46,6 @@ $record = $tagops->GetUserTag((int)$_REQUEST['userplugin_id']); } -if( isset($_POST['cancel']) ) redirect('listusertags.php'.$urlext); - $error = array(); if( isset($_POST['submit']) || isset($_POST['apply']) ) { $record['userplugin_name'] = trim(cleanValue($_POST['userplugin_name'])); @@ -59,14 +59,13 @@ // validate if( $record['userplugin_name'] == '' ) { - $error[] = lang('nofieldgiven',array(lang('name'))); + $error[] = lang('nofieldgiven',lang('name')); } - elseif(preg_match('<^[ a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$>',$record['userplugin_name'])==0) { + elseif( preg_match('<^[a-zA-Z_ \x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$>',$record['userplugin_name']) == 0 ) { //TODO === 0 OR != 1 ? $error[] = lang('error_udt_name_chars'); - $validinfo = false; } else { - // check for duplicate name. + // check for duplicate name $all_tags = $tagops->ListUserTags(); foreach( $all_tags as $id => $name ) { if( $name == $record['userplugin_name'] ) { @@ -75,58 +74,80 @@ } } - if( $record['code'] == '' ) $error[] = lang('nofieldgiven', array(lang('code'))); - - $code = $record['code']; - if( startswith($code,'') ) $code = substr($code,0,-2); - - $lastopenbrace = strrpos($code, '{'); - $lastclosebrace = strrpos($code, '}'); - if ($lastopenbrace > $lastclosebrace) { - $error[] = lang('invalidcode'); - $error[] = lang('invalidcode_brace_missing'); + if( $record['code'] == '' ) { + $error[] = lang('nofieldgiven',lang('code')); } - - if( count($error) == 0 ) { - srand(); - ob_start(); - if (eval('function testfunction'.rand().'() {'.$code."\n}") === FALSE) { + else { + $code = $record['code']; + if( startswith($code,'') ) { //TODO possible '%>' tag ? + $code = substr($code,0,-2); + $record['code'] = $code = rtrim($code); + } + $lastopenbrace = strrpos($code, '{'); + $lastclosebrace = strrpos($code, '}'); + if( $lastopenbrace > $lastclosebrace ) { $error[] = lang('invalidcode'); - $buffer = ob_get_clean(); - //add error - $error[] = preg_replace('/
    /', '', $buffer ); - $validinfo = false; + $error[] = lang('invalidcode_brace_missing'); } - else { - ob_get_clean(); + // more code validation when $record['code'] is saved, downstream + } + + if( !$error ) { + // validate UDT syntax + // TODO also validate content, especially before possible 'run' below + $old = ini_set('display_errors',1); + //for PHP < 7, a parse error causes eval() to return FALSE + //for PHP 7+, a parse error causes eval() to throw a ParseError + try { + $res = eval('function testfunction'.mt_rand().'($params,$smarty) {'.$code."\n}"); + if( $res === FALSE && PHP_VERSION_ID < 70000 ) { + $error[] = lang('invalidcode'); + $tmp = error_get_last(); + if( $tmp ) { + $l = $tmp['line']; + $m = $tmp['message']; + $error[] = "Parse error on line $l:\n$m"; //TODO \n or
    ? + } + else { + $error[] = "Parse error (no detail reported)"; + } + } } + catch (Throwable $e) { //PHP7+ only + $error[] = lang('invalidcode'); + $l = $e->getLine(); + $m = $e->getMessage(); + $error[] = "Parse error on line $l:\n$m"; + } + ini_set('display_errors',$old); } - if( count($error) == 0 ) { + if( !$error ) { + // save the UDT $res = $tagops->SetUserTag($record['userplugin_name'],$record['code'],$record['description'],$userplugin_id); - if( !$res ) $error = lang('errorupdatingusertag'); + if( !$res ) $error[] = lang('errorupdatingusertag'); } $details = lang('usertagupdated'); if( !$error ) { if( isset($_POST['run']) ) { + //TODO this is potentially very risky, the UDT content could do anything! @ob_start(); $params = array(); $res = $tagops->CallUserTag($record['userplugin_name'],$params); - $tmp = @ob_get_contents(); - @ob_end_clean(); - - if( $tmp ) - $details = $tmp; - else - $details = $res; + $tmp = @ob_get_clean(); + $details = $tmp ?: $res; } } if( !$error ) { - // save the UDT. if( isset($_POST['submit']) ) { redirect('listusertags.php'.$urlext); } @@ -139,7 +160,7 @@ } else { if( isset($_POST['submit']) ) { - echo $themeObject->ShowErrors($error); + $themeObject->ShowErrors($error); } else { // ajaxy. @@ -150,15 +171,8 @@ } } -// -// give everything to smarty. -// -$smarty = \Smarty_CMS::get_instance(); -$smarty->assign('record',$record); -echo $smarty->display('editusertag.tpl'); -include_once("footer.php"); +$tpl = $smarty->createTemplate('admin_tpl:editusertag.tpl',null,null,$smarty,false); +$tpl->assign('record',$record); +$tpl->display(); -# -# EOF -# -?> +require_once 'footer.php'; diff --git a/admin/eventhandlers.php b/admin/eventhandlers.php index 4226cf6a..342f7c4f 100644 --- a/admin/eventhandlers.php +++ b/admin/eventhandlers.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,187 +15,86 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: listtags.php 2772 2006-05-17 02:25:27Z wishy $ +#$Id$ -$CMS_ADMIN_PAGE=1; -$CMS_LOAD_ALL_PLUGINS=1; +$CMS_ADMIN_PAGE = 1; +//$CMS_LOAD_ALL_PLUGINS = 1; ? -require_once("../lib/include.php"); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +require_once '../lib/include.php'; check_login(); + $userid = get_userid(); $access = check_permission($userid, "Modify Events"); - if (!$access) { - die('Permission Denied'); - return; + exit(lang('no_permission')); //TODO throw if can be caught } +require_once 'header.php'; -// here we'll handle setting $action based on _POST['action'] -$action = ''; -$module = ''; -$event = ''; -$modulefilter = ''; -if( isset( $_GET['action'] ) && $_GET['action'] != '' ) $action = $_GET['action']; -if( isset( $_GET['module'] ) && $_GET['module'] != '' ) $module = $_GET['module']; -if( isset( $_GET['event'] ) && $_GET['event'] != '' ) $event = $_GET['event']; -if( isset( $_GET['modulefilter'] ) && $_GET['modulefilter'] != '' ) $modulefilter = $_GET['modulefilter']; +$action = (!empty($_REQUEST['action'])) ? $_REQUEST['action'] : ''; +$event = (!empty($_REQUEST['event'])) ? $_REQUEST['event'] : ''; +$originator = (!empty($_REQUEST['originator'])) ? $_REQUEST['originator'] : ''; +$modulefilter = (!empty($_REQUEST['modulefilter'])) ? $_REQUEST['modulefilter'] : ''; -// display the page -include_once("header.php"); +$themeObject->set_value('pagetitle', 'eventhandlers'); -$editImg = $themeObject->DisplayImage('icons/system/edit.gif', lang('edit'),'','','systemicon'); -$infoImg = $themeObject->DisplayImage('icons/system/info.gif', lang('help'),'','','systemicon'); - -echo '
    '; -echo '
    '; -echo $themeObject->ShowHeader('eventhandlers'); +$smarty->changeCaching(false); +$tplname = ($action == 'showeventhelp') ? 'eventhelp.tpl' : 'listevents.tpl'; +$tpl = $smarty->createTemplate("admin_tpl:$tplname",null,null,$smarty,false); +// see also $smarty-assigned var $secureparam +$tpl->assign('securename',CMS_SECURE_PARAM_NAME); +$tpl->assign('secureval',$_SESSION[CMS_USER_KEY]); switch( $action ) { case 'showeventhelp': - { - $desctext = ''; - $text = ''; - if ($module == 'Core') { + if( $originator == 'Core' ) { $desctext = Events::GetEventDescription($event); $text = Events::GetEventHelp($event); } else { - $moduleobj = cms_utils::get_module($module); - if( is_object($moduleobj) ) { + $moduleobj = cms_utils::get_module($originator); + if( is_object($moduleobj) ) { $desctext = $moduleobj->GetEventDescription($event); $text = $moduleobj->GetEventHelp($event); - } - } - - echo "

    $event

    "; - if( $desctext != "" ) echo "

    " . 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('eventhandler')."

    "; - $hlist = Events::ListEventHandlers( $module, $event ); - if ($hlist === false) { - echo '

    '.lang('none').'

    '; - } - else { - echo '
      '; - foreach ($hlist as $te) { - echo '
    • '.$te['handler_order'].'. '; - if (!empty($te['tag_name'])) { - echo lang('user_tag').': '.$te['tag_name']; - } - else if (!empty($te['module_name'])) { - echo lang('module').': '.$te['module_name']; - } - echo '
    • '; - } - echo '
    '; - } + $tpl->assign('desctext',$desctext) + ->assign('event',$event) + ->assign('hlist',$handlers) + ->assign('text',$text); break; - } default: - { + $modlist = []; $events = Events::ListEvents(); - - echo '
    '; - echo '
    '; - - echo lang('filterbymodule').':
    \n\n"; - - echo "\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n"; - echo "\n"; - - if( is_array($events) ) - { - $curclass = 'row1'; - foreach( $events as $oneevent ) - { - if ($modulefilter == '' || $modulefilter == $oneevent['originator']) - { - echo "\n"; - - $desctext = ''; - if ($oneevent['originator'] == 'Core') { - $desctext = Events::GetEventDescription($oneevent['event_name']); - echo " \n"; - } - else if ( ($objinstance = cms_utils::get_module($oneevent['originator'])) ) { - $desctext = $objinstance->GetEventDescription($oneevent['event_name']); - echo " \n"; - } - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; -if ($access) -{ - echo " \n"; -} - echo " \n"; - ($curclass=="row1"?$curclass="row2":$curclass="row1"); + if( $events ) { + foreach( $events as $oneevent ) { + if( !in_array($oneevent['originator'],$modlist) ) { + $modlist[] = $oneevent['originator']; } } } + $editicon = $themeObject->DisplayImage('icons/system/edit.gif',lang('edit'),'','','systemicon'); + $infoicon = $themeObject->DisplayImage('icons/system/info.gif',lang('help'),'','','systemicon'); + + $tpl->assign('access',$access) + ->assign('editImg',$editicon) + ->assign('events',$events) + ->assign('infoImg',$infoicon) + ->assign('modlist',$modlist) + ->assign('modulefilter',$modulefilter); +} - echo "\n"; - echo "
    ".lang('originator')."".lang('event')."".lang('eventhandler')."".lang('description')."  
    ".lang('core')."".$objinstance->GetFriendlyName().""; -if ($access) -{ - echo ""; -} - echo $oneevent['event_name']; -if ($access) -{ - echo ""; -} - echo ""; - if ($oneevent['usage_count'] > 0) - { - echo "". - $oneevent['usage_count'].""; - } - echo "".$desctext."".$infoImg."".$editImg."
    \n"; - } // default action - -} // switch - - -echo "
    \n"; -echo "
    \n"; - -include_once("footer.php"); +$tpl->display(); -?> +require_once 'footer.php'; diff --git a/admin/footer.php b/admin/footer.php index d9b976ed..e3a7f12c 100644 --- a/admin/footer.php +++ b/admin/footer.php @@ -1,13 +1,13 @@ do_footer(); } -$gCms = \CmsApp::get_instance(); -$config = \cms_config::get_instance(); -if ($config["debug"] == true) { +$gCms = CmsApp::get_instance(); +$config = cms_config::get_instance(); +if ($config['debug']) { // aka CMS_DEBUG // echo debug output to stdout echo '
    '; $arr = $gCms->get_errors(); @@ -18,26 +18,22 @@ } // Pull the stuff out of the buffer... +// $bodycontent should contain what goes in the main content area of the page. $bodycontent = ''; if (!(isset($USE_OUTPUT_BUFFERING) && $USE_OUTPUT_BUFFERING == false)) { $bodycontent = @ob_get_contents(); @ob_end_clean(); } -// bodycontent should contain what goes in the main content area of the page. -#Do any header replacements (this is for WYSIWYG stuff) -$formtext = ''; -$formsubmittext = ''; -$bodytext = ''; +// Do any header replacements (this is for WYSIWYG stuff) $userid = get_userid(); - +$modops = ModuleOperations::get_instance(); // initialize the requested wysiwyg modules -// because this can change based on module actions etc... it's done in the footer. +// because those can change during module action etc, it's done here in the footer. $list = CmsFormUtils::get_requested_wysiwyg_modules(); -if( is_array($list) && count($list) ) { +if( $list && is_array($list) ) { foreach( $list as $module_name => $info ) { - - $obj = cms_utils::get_module($module_name); + $obj = $modops->get_module_instance($module_name); if( !is_object($obj) ) { audit('','Core','WYSIWYG module '.$module_name.' requested, but could not be instantiated'); continue; @@ -64,7 +60,7 @@ $cssnames = $tmpnames; } else { - $cssnames = null; + $cssnames = []; } // initialize each 'specialized' textarea. @@ -73,7 +69,7 @@ $selector = $rec['id']; $cssname = $rec['stylesheet']; - if( $cssname == CmsFormUtils::NONE ) $cssname = null; + if( $cssname == CmsFormUtils::NONE ) $cssname = ''; if( !$cssname || !is_array($cssnames) || !in_array($cssname,$cssnames) || $selector == CmsFormUtils::NONE ) { $need_generic = TRUE; continue; @@ -92,16 +88,16 @@ // initialize the requested syntax hilighter modules $list = CmsFormUtils::get_requested_syntax_modules(); -if( is_array($list) && count($list) ) { +if( $list && is_array($list) ) { foreach( $list as $one ) { - $obj = cms_utils::get_module($one); + $obj = $modops->get_module_instance($one); if( is_object($obj) ) $themeObject->add_headtext($obj->SyntaxGenerateHeader()); } } -$out = \CMSMS\HookManager::do_hook_accumulate('admin_add_footertext'); -if( $out && !empty($out) ) { - foreach( $out as $one ) { +$list = CMSMS\HookManager::do_hook_accumulate('admin_add_footertext'); +if( $list && is_array($list) ) { + foreach( $list as $one ) { $one = trim($one); if( $one ) $themeObject->add_footertext($one); } @@ -110,20 +106,20 @@ $bodycontent = $themeObject->postprocess($bodycontent); echo $bodycontent; -if (!isset($USE_THEME) || $USE_THEME != false) { +if (!isset($USE_THEME) || $USE_THEME) { if( strpos($bodycontent,''; -} - -if (!isset($USE_THEME) || $USE_THEME != false) { if( isset($config['show_performance_info']) ) { - $db = \Cmsapp::get_instance()->GetDb(); - $endtime = microtime(); $memory = (function_exists('memory_get_usage')?memory_get_usage():0); $memory_net = 'n/a'; if( isset($orig_memory) ) $memory_net = $memory - $orig_memory; $memory_peak = (function_exists('memory_get_peak_usage')?memory_get_peak_usage():0); + $endtime = microtime(); + $db = $gCms->GetDb(); echo '
    '.microtime_diff($starttime,$endtime)." / ".(isset($db->query_count)?$db->query_count:'')." queries / Net Memory: {$memory_net} / End: {$memory} / Peak: {$memory_peak}
    \n"; } } +$obj = new CMSMS\JobCheck(); +$obj->initiate_background_processing(); + ?> diff --git a/admin/header.php b/admin/header.php index 9e918026..194b7424 100644 --- a/admin/header.php +++ b/admin/header.php @@ -5,7 +5,7 @@ if (!(isset($USE_OUTPUT_BUFFERING) && $USE_OUTPUT_BUFFERING == false)) @ob_start(); $userid = get_userid(); -$smarty = \Smarty_CMS::get_instance(); +$smarty = Smarty_CMS::get_instance(); if (isset($USE_THEME) && $USE_THEME == false) { //echo ''; @@ -13,18 +13,23 @@ else { debug_buffer('before theme load'); $themeObject = cms_utils::get_theme_object(); - $smarty->assign('secureparam', CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]); debug_buffer('after theme load'); + $smarty->assign('secureparam',CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY],true); //also in adminthemebase for some requests // Display notification stuff from modules // should be controlled by preferences or something - $ignoredmodules = explode(',',cms_userprefs::get_for_user($userid,'ignoredmodules')); - if( cms_siteprefs::get('enablenotifications',1) && cms_userprefs::get_for_user($userid,'enablenotifications',1) ) { - // Display a warning sitedownwarning - $sitedown_message = lang('sitedownwarning', TMP_CACHE_LOCATION . '/SITEDOWN'); - $sitedown_file = TMP_CACHE_LOCATION . '/SITEDOWN'; - if (file_exists($sitedown_file)) $themeObject->AddNotification(1,'Core',$sitedown_message); - } +// $ignoredmodules = explode(',',cms_userprefs::get_for_user($userid,'ignoredmodules')); no such thing + $sitedown_file = TMP_CACHE_LOCATION . DIRECTORY_SEPARATOR . 'SITEDOWN'; + if (file_exists($sitedown_file)) { + if (cms_siteprefs::get('enablenotifications',true) && cms_userprefs::get_for_user($userid,'enablenotifications',true)) { + // Display a warning + $sitedown_message = lang('sitedownwarning',$sitedown_file); + $themeObject->AddNotification(1,'Core',$sitedown_message); + } + } + else { + $smarty->changeCaching(true); // by default, non-module admin pages support caching + } $themeObject->do_header(); } diff --git a/admin/index.php b/admin/index.php index 8dbd2fa6..103185b8 100644 --- a/admin/index.php +++ b/admin/index.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,33 +15,45 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: index.php 12537 2020-09-04 15:21:47Z ruudvdvelden $ +#$Id$ $orig_memory = (function_exists('memory_get_usage')?memory_get_usage():0); -$CMS_ADMIN_PAGE=1; -$CMS_TOP_MENU='main'; -$CMS_ADMIN_TITLE='adminhome'; -$CMS_ADMIN_TITLE='mainmenu'; -$CMS_EXCLUDE_FROM_RECENT=1; +$CMS_ADMIN_PAGE = 1; +//$CMS_TOP_MENU = 'main'; +//$CMS_ADMIN_TITLE = 'adminhome'; +//$CMS_ADMIN_TITLE = 'mainmenu'; +//$CMS_EXCLUDE_FROM_RECENT = 1; -require_once("../lib/include.php"); +require_once '../lib/include.php'; -// if this page was accessed directly, and the secure param name is not in the URL -// but it is in the session, assume it is correct. -if( isset($_SESSION[CMS_USER_KEY]) && !isset($_GET[CMS_SECURE_PARAM_NAME]) ) $_GET[CMS_SECURE_PARAM_NAME] = $_SESSION[CMS_USER_KEY]; +// if this page was accessed directly, and the secure param name is not +// in the URL but it is in the session, assume it is correct. +if( !isset($_GET[CMS_SECURE_PARAM_NAME]) && isset($_SESSION[CMS_USER_KEY]) ) { + $_GET[CMS_SECURE_PARAM_NAME] = $_SESSION[CMS_USER_KEY]; +} check_login(); -include_once("header.php"); $section = (isset($_GET['section'])) ? trim($_GET['section']) : ''; -// todo: we should just be getting the html, and giving it to the theme. mmaybe +require_once 'header.php'; +$smarty->changeCaching(false); // user-permissions might change available links $themeObject->do_toppage($section); -$out = \CMSMS\HookManager::do_hook_accumulate('admin_add_headtext'); -if( $out && count($out) ) { - foreach( $out as $one ) { - $one = trim($one); - if( $one ) $themeObject->add_headtext($one); + +// run hook to get content to be inserted into +$all = CMSMS\HookManager::do_hook_accumulate('admin_add_headtext'); +if( $all && is_array($all) ) { + foreach( $all as $txt ) { + $txt = trim($txt); + if( $txt ) { $themeObject->add_headtext($txt); } + } +} +// run hook to get content to be inserted before the tag +$all = CMSMS\HookManager::do_hook_accumulate('admin_add_bottomtext'); +if( $all && is_array($all) ) { + foreach( $all as $txt ) { + $txt = trim($txt); + if( $txt ) { $themeObject->add_footertext($txt); } } } -include_once("footer.php"); +require_once 'footer.php'; diff --git a/admin/lang/en_US.php b/admin/lang/en_US.php index 87730e4e..93a1cbc0 100644 --- a/admin/lang/en_US.php +++ b/admin/lang/en_US.php @@ -1,981 +1,533 @@ (notifications will be displayed on all Admin pages)"; -$lang['admin_layout_legend'] = "Admin layout settings"; -$lang['admin_lock_timeout'] = 'Lock timeout'; -$lang['advanced'] = "Advanced"; -$lang['alert'] = "Alert"; -$lang['alerts'] = "Alerts"; -$lang['alias'] = "Alias"; +$lang['adduser'] = 'Add New User'; +$lang['addusertag'] = 'Add User Defined Tag'; +$lang['admin'] = 'Site Admin'; +$lang['adminaccess'] = 'Access to login to Admin'; +$lang['admincallout'] = 'Administration Shortcuts'; +$lang['admindescription'] = 'Site administration functions.'; +$lang['adminhome'] = 'Administration Home'; +$lang['adminindent'] = 'Content Display'; +$lang['adminlog'] = 'Admin Log'; +$lang['adminlogcleared'] = 'The Admin Log was successfully cleared'; +$lang['adminlogdescription'] = 'This logs Admin activity and shows e.g. content changes, user information, and time of access.'; +$lang['adminlogempty'] = 'The Admin Log is empty'; +$lang['adminlog_1day'] = '1 day'; +$lang['adminlog_1month'] = '1 month'; +$lang['adminlog_1week'] = '1 week'; +$lang['adminlog_2weeks'] = '2 weeks'; +$lang['adminlog_3months'] = '3 months'; +$lang['adminlog_6months'] = '6 months'; +$lang['adminlog_lifetime'] = 'Lifetime of Log-Entries'; +$lang['adminlog_manual'] = 'Manual deletion'; +$lang['adminpaging'] = 'Number of Content Items to show per page in Page List'; +$lang['adminpaneltitle'] = 'CMS Made Simple™ Admin Console'; +$lang['adminplugin'] = 'Admin Plugin'; +$lang['adminprefs'] = 'User Preferences'; +$lang['adminprefsdescription'] = 'Here you set your specific preferences for site administration'; +$lang['adminspecialgroup'] = 'Note: members of this group automatically have all permissions'; +$lang['adminsystemtitle'] = 'CMSMS Admin System'; +$lang['admintheme'] = 'Administration Theme'; +$lang['admin_enablenotifications'] = 'Allow users to view notifications
    (notifications will be displayed on all Admin pages)'; +$lang['admin_layout_legend'] = 'Admin layout settings'; +$lang['admin_lock_timeout'] = 'Lock Timeout (minutes)'; +$lang['advanced'] = 'Advanced'; +$lang['alert'] = 'Alert'; +$lang['alerts'] = 'Alerts'; +$lang['alias'] = 'Alias'; $lang['aliasalreadyused'] = 'The supplied "Page Alias" is already in use on another page. Change the "Page Alias" to something else.'; -$lang['aliasmustbelettersandnumbers'] = "Alias must be all letters and numbers"; -$lang['aliasnotaninteger'] = "Alias cannot be an integer"; -$lang['allow_browser_cache'] = "Allow Browser to Cache Pages"; -$lang['allpagesmodified'] = "All pages modified!"; -$lang['all_groups'] = "All Groups"; -$lang['always'] = "Always"; +$lang['aliasmustbelettersandnumbers'] = 'Alias must be all letters and numbers'; +$lang['aliasnotaninteger'] = 'Alias cannot be an integer'; +$lang['allow_browser_cache'] = 'Allow Browser to Cache Pages'; +$lang['allpagesmodified'] = 'All pages modified!'; +$lang['all_groups'] = 'All Groups'; +$lang['always'] = 'Always'; +$lang['anonymous'] = 'Anonymous'; $lang['applied'] = 'Applied'; -$lang['apply'] = "Apply"; -$lang['applydescription'] = "Save changes and continue to edit"; -$lang['assignmentchanged'] = "Group Assignments have been updated."; -$lang['assignments'] = "Assign Users"; +$lang['apply'] = 'Apply'; +$lang['applydescription'] = 'Save changes and continue to edit'; +$lang['assignmentchanged'] = 'Group assignments have been updated.'; +$lang['assignments'] = 'Assign Users'; +$lang['async_settings'] = 'Background Jobs Settings'; +$lang['async_status'] = 'Background jobs status'; //$lang['associationexists'] = "This association already exists"; //$lang['attachstylesheet'] = "Attach This Stylesheet"; //$lang['attachstylesheets'] = "Attach Stylesheets"; //$lang['attachtemplate'] = "Attach to this Template"; //$lang['attachtotemplate'] = "Attach Stylesheet to Template"; -$lang['author'] = "Author"; -$lang['autoclearcache'] = "Automatically clear the cache every N days"; -$lang['autoclearcache2'] = "Remove cache files that are older than the specified number of days"; -$lang['autoinstallupgrade'] = "Automatically install or upgrade"; -$lang['automatedtask_success'] = "Automated task performed"; +$lang['author'] = 'Author'; +$lang['autoclearcache'] = 'Automatically clear the cache every N days'; +$lang['autoclearcache2'] = 'Lifetime of Cached Files (days)'; +$lang['autoinstallupgrade'] = 'Automatically install or upgrade'; +//$lang['automatedtask_success'] = "Automated task performed"; -## B -$lang['back'] = "Back to Menu"; -$lang['backtoplugins'] = "Back to Plugins List"; -$lang['basic_attributes'] = "Basic Properties"; -//$lang['blobexists'] = "Global Content Block name already exists"; -//$lang['blobmanagement'] = "Global Content Block Management"; -//$lang['blobs'] = "Global Content Blocks"; -$lang['bookmarks'] = "Shortcuts"; -$lang['browser_cache_expiry'] = "Browser Cache Expiry Period (minutes)"; -$lang['browser_cache_settings'] = "Browser Cache Settings"; -$lang['bulk_success'] = "Bulk operation was successfully performed"; +// B +$lang['back'] = 'Back to Menu'; +$lang['backtoplugins'] = 'Back to Plugins List'; +$lang['basic_attributes'] = 'Basic Properties'; +$lang['bookmarks'] = 'Bookmarks'; +$lang['browser_cache_expiry'] = 'Browser Cache Expiry Period (minutes)'; +$lang['browser_cache_settings'] = 'Browser Cache Settings'; +$lang['bulk_success'] = 'Bulk operation was successfully performed'; -## C -$lang['cachable'] = "Cachable"; -$lang['cachecleared'] = "Cache Cleared"; -$lang['cachenotwritable'] = "Cache folder is not writeable. Clearing cache will not work. Please make the tmp/cache folder have full read/write/execute permissions (chmod 777). You may also have to disable safe mode."; -$lang['cancel'] = "Cancel"; -$lang['canceldescription'] = "Discard Changes"; +// C +$lang['cachable'] = 'Cachable'; +$lang['cachecleared'] = 'Cache cleared'; +$lang['cachenotwritable'] = 'Cache folder is not writeable. Clearing cache will not work. Please make the tmp/cache folder have full read/write/execute permissions (chmod 777). You may also have to disable safe mode.'; +$lang['callable'] = 'Callable'; +$lang['cancel'] = 'Cancel'; +$lang['canceldescription'] = 'Discard Changes'; $lang['cantchmodfiles'] = "Couldn't change permissions on some files"; -$lang['cantremove'] = "Cannot Remove"; -$lang['cantremovefiles'] = "Problem Removing Files (permissions?)"; -$lang['caution'] = "Caution"; -$lang['ce_navdisplay'] = "Content list navigation display"; +$lang['cantremove'] = 'Cannot Remove'; // ModuleManager only use? +$lang['cantremovefiles'] = 'Problem Removing Files (permissions?)'; +$lang['caution'] = 'Caution'; +$lang['ce_navdisplay'] = 'Content list navigation display'; $lang['chat'] = 'Chat'; -$lang['changehistory'] = "Change History"; -$lang['changeowner'] = "Change Owner"; -$lang['changepermissions'] = "Change Permissions"; +$lang['changehistory'] = 'Change History'; +$lang['changeowner'] = 'Change Owner'; +$lang['changepermissions'] = 'Change Permissions'; //$lang['changepermissionsconfirm'] = "USE CAUTION\n\nThis action will attempt to ensure that all of the files making up the module are writeable by the web server.\nAre you sure you want to continue?"; -$lang['checksumdescription'] = "Validate the integrity of CMS files by comparing against known checksums"; -$lang['checksum_passed'] = "All checksums match those in the uploaded file"; -$lang['checkversion'] = "Allow periodic checks for new versions"; -$lang['check_ini_set'] = "Test ini_set"; -$lang['check_ini_set_off'] = "You may have difficulty with some functionality without this capability. This test may fail if safe_mode is enabled"; +$lang['checksumdescription'] = 'Validate the integrity of CMS files by comparing against known checksums'; +$lang['checksum_passed'] = 'All checksums match those in the uploaded file'; +$lang['checkversion'] = 'New-Version Checks'; +$lang['check_ini_set'] = 'Test ini_set'; +$lang['check_ini_set_off'] = 'You may have difficulty with some functionality without this capability. This test may fail if safe_mode is enabled'; $lang['choose'] = 'Choose'; -$lang['clear'] = "Clear"; -$lang['clearadminlog'] = "Clear Admin Log"; -$lang['clearcache'] = "Clear Cache"; -$lang['clearcache_taskdescription'] = "Executed daily, this task will clear cached files that are older than the age pre-set in the global preferences"; -$lang['clearcache_taskname'] = "Clear Cached Files"; -$lang['clearusersettings'] = "Clear all settings"; -$lang['close'] = "Close"; -$lang['CMSEX_C001'] = 'Sorry, we could not create a valid page alias from the input supplied'; -$lang['CMSEX_F001'] = "File system permissions problem"; -$lang['CMSEX_G001'] = "Attempt to set invalid property into object"; -$lang['CMSEX_L001'] = "Attempt to delete a non expired lock owned by another user"; -$lang['CMSEX_L002'] = "Attempt to delete a lock when it has yet to be saved"; -$lang['CMSEX_L003'] = "Lock type empty"; -$lang['CMSEX_L004'] = "Lock not saved"; -$lang['CMSEX_L005'] = "Could not find a lock with the specified identifiers"; -$lang['CMSEX_L006'] = "Lock is owned by a different user. We cannot manipulate it"; -$lang['CMSEX_L007'] = "Other/unknown locking error"; -$lang['CMSEX_L008'] = "Locking exception"; -$lang['CMSEX_L009'] = "Problem removing lock"; -$lang['CMSEX_L010'] = 'Sorry, This item is locked, and cannot be edited at this time. Additionally, only expired locks can be removed.'; -$lang['CMSEX_M001'] = "Module already installed"; -$lang['CMSEX_M002'] = "Installing this package would result in a downgrade. Operation aborted"; -$lang['CMSEX_MODULENOTFOUND'] = "Module %s not found"; -$lang['CMSEX_SQL001'] = "Problem creating/updating lock record"; -$lang['CMSEX_XML001'] = "Problem opening XML file"; -$lang['CMSEX_XML002'] = "DTD Version missing or incompatible in the XML file"; -$lang['CMSEX_XML003'] = "XML file is incomplete or invalid"; -$lang['cms_install_information'] = "CMS Made Simple Install Information"; -$lang['cms_version'] = "CMSMS Version"; -$lang['code'] = "Code"; -$lang['config_information'] = "CMS Made Simple Config Settings"; -$lang['config_writable'] = "config.php writeable. It is more safe if you change permission to read-only"; +$lang['clear'] = 'Clear'; +$lang['clearadminlog'] = 'Clear Admin Log'; +$lang['clearcache'] = 'Clear Cache'; +//see jobs realm $lang['clearcache_description'] = "Executed daily, this job will clear cached files that are older than the age pre-set in the global preferences"; +//$lang['clearcache_taskname'] = "Clear Cached Files"; +$lang['clearjobrecords'] = 'Clear Job Records'; +$lang['clearusersettings'] = 'Clear all settings'; +$lang['close'] = 'Close'; +$lang['CMSEX_C001'] = 'Unable to create a valid page alias from the input supplied'; +$lang['CMSEX_F001'] = 'File system permissions problem'; +$lang['CMSEX_G001'] = 'Attempt to set invalid property into object'; +$lang['CMSEX_L001'] = 'Attempt to delete a non expired lock owned by another user'; +$lang['CMSEX_L002'] = 'Attempt to delete a lock when it has yet to be saved'; +$lang['CMSEX_L003'] = 'Lock type empty'; +$lang['CMSEX_L004'] = 'Lock not saved'; +$lang['CMSEX_L005'] = 'Could not find a lock with the specified identifiers'; +$lang['CMSEX_L006'] = 'Lock is owned by a different user. We cannot manipulate it'; +$lang['CMSEX_L007'] = 'Other/unknown locking error'; +$lang['CMSEX_L008'] = 'Locking exception'; +$lang['CMSEX_L009'] = 'Problem removing lock'; +$lang['CMSEX_L010'] = 'This item is locked, and cannot be edited (until the lock is released, or stolen after its expiry).'; +$lang['CMSEX_M001'] = 'Module already installed'; +$lang['CMSEX_M002'] = 'Installing this package would result in a downgrade. Operation aborted'; +$lang['CMSEX_MODULENOTFOUND'] = 'Module %s not found'; +$lang['CMSEX_SQL001'] = 'Problem creating/updating lock record'; +$lang['CMSEX_XML001'] = 'Problem opening XML file'; +$lang['CMSEX_XML002'] = 'DTD Version missing or incompatible in the XML file'; +$lang['CMSEX_XML003'] = 'XML file is incomplete or invalid'; +$lang['cms_install_information'] = 'CMS Made Simple Install Information'; +$lang['cms_version'] = 'CMSMS Version'; +$lang['code'] = 'Code'; +$lang['config_information'] = 'CMS Made Simple Config Settings'; +$lang['config_writable'] = 'config.php writeable. It is safer to change its permission to read-only'; $lang['config_issue'] = 'Configuration Issue'; -$lang['confirm'] = "Confirm"; -$lang['confirmcancel'] = "Are you sure you want to discard your changes? Click OK to discard all changes. Click Cancel to continue editing."; -$lang['confirmdefault'] = "Are you sure you want to set - %s - as site default page?"; -$lang['confirmdeletedir'] = "Are you sure you want to delete this directory and all of its contents?"; -$lang['confirm_bulkuserop'] = "Use caution when performing options on multiple users simultaneously.\nAre you sure that you want to continue?"; -$lang['confirm_edituser'] = "Are you sure you want to apply changes to this user account"; -$lang['confirm_delete_user'] = "Are you sure you want to delete this user account"; -$lang['confirm_deleteusertag'] = 'Are you sure you want to delete this user defined tag?'; +$lang['configure'] = 'Configure'; +$lang['confirm'] = 'Confirm'; +$lang['confirmcancel'] = 'Are you sure you want to discard your changes? Click OK to discard all changes. Click Cancel to continue editing.'; +$lang['confirmdefault'] = 'Are you sure you want to set - %s - as site default page?'; +$lang['confirmdeletedir'] = 'Are you sure you want to delete this directory and all of its contents?'; +$lang['confirm_bulkuserop'] = "Be cautious about performing options on multiple users simultaneously.\nAre you sure that you want to continue?"; +$lang['confirm_edituser'] = 'Are you sure you want to apply changes to this user account?'; +$lang['confirm_delete_user'] = 'Are you sure you want to delete this user account?'; +$lang['confirm_deleteusertag'] = 'Are you sure you want to delete this User Defined Tag?'; $lang['confirm_runusertag'] = 'Running a UDT may have adverse effects on your website. Please use caution!\n\nAre you sure you want to continue?'; -$lang['confirm_set_template_1'] = "Are you sure you want to set all of these pages to use this template"; -$lang['confirm_set_template_2'] = "Yes, I am sure."; -$lang['confirm_set_template_3'] = "Yes, I am really sure."; -$lang['confirm_switchuser'] = 'Are you sure you want to switch the effective UID to this user? You will need to logout from the admin console and re-login to resume normal operations under your user account.'; -$lang['confirm_toggleuseractive'] = "Are you sure you want to toggle the active state of this user?"; -$lang['confirm_uploadmodule'] = "Are you sure you would like to upload the selected XML file. Incorrectly uploading a module file may break a functioning website"; -$lang['connection_error'] = "Outgoing HTTP connections do not appear to work! There is a firewall or some ACL for external connections? This will result in module manager, and potentially other functionality failing."; -$lang['connection_failed'] = "Connection failed!"; -$lang['content'] = "Content"; -$lang['contentadded'] = "The content was successfully added to the database."; -$lang['contentdeleted'] = "The content was successfully removed from the database."; -$lang['contentdescription'] = "This is where we add and edit content."; -$lang['contentimage_path'] = "Path for {content_image} tag"; -$lang['contentmanagement'] = "Content Management"; -$lang['contenttype'] = "Content Type"; -$lang['contenttype_content'] = "Content"; -$lang['contenttype_errorpage'] = "Error Page"; -$lang['contenttype_pagelink'] = "Internal Page Link"; -$lang['contenttype_redirlink'] = "Redirecting Link"; -$lang['contenttype_sectionheader'] = "Section Header"; -$lang['contenttype_separator'] = "Separator"; -$lang['contentupdated'] = "The content was successfully updated."; +$lang['confirm_set_template_1'] = 'Are you sure you want to set all of these pages to use this template?'; +$lang['confirm_set_template_2'] = 'Yes, I am sure.'; +$lang['confirm_set_template_3'] = 'Yes, I am really sure.'; +$lang['confirm_switchuser'] = 'Are you sure you want to switch the effective UID to this user? You will need to log out from the admin console and re-login to resume normal operations under your user account.'; +$lang['confirm_toggleuseractive'] = 'Are you sure you want to toggle the active state of this user?'; +$lang['confirm_uploadmodule'] = 'Are you sure you would like to upload the selected XML file? Incorrectly uploading a module file may break a functioning website.'; +$lang['connection_error'] = 'Outgoing HTTP connections do not appear to work! There is a firewall or some ACL for external connections? This will result in module manager, and potentially other functionality failing.'; +$lang['connection_failed'] = 'Connection failed!'; +$lang['content'] = 'Content'; +$lang['contentadded'] = 'The content was successfully added to the database.'; +$lang['contentdeleted'] = 'The content was successfully removed from the database.'; +$lang['contentdescription'] = 'This is where users can add and edit website content.'; +$lang['contentimage_path'] = 'Relative path for content images'; // 'content_imagefield_path' different use +$lang['contentmanagement'] = 'Content Management'; +$lang['contenttype'] = 'Content Type'; // for ContentManager only ? +$lang['contenttype_content'] = 'Content'; +$lang['contenttype_errorpage'] = 'Error Page'; +$lang['contenttype_link'] = 'Redirecting Link'; +$lang['contenttype_pagelink'] = 'Internal Page Link'; +$lang['contenttype_sectionheader'] = 'Section Header'; +$lang['contenttype_separator'] = 'Separator'; +$lang['contentupdated'] = 'The content was successfully updated.'; $lang['content_autocreate_flaturls'] = "Automatically created URL's are flat"; $lang['content_autocreate_urls'] = "Automatically create page URL's"; -$lang['content_copied'] = "Content Item Copied to %s"; -$lang['content_editor_legend'] = "Content editor settings"; -$lang['content_id'] = "Content ID"; -$lang['content_imagefield_path'] = "Path for the {page_image} tag"; +$lang['content_copied'] = 'Content Item Copied to %s'; +$lang['content_editor_legend'] = 'Content editor settings'; +$lang['content_id'] = 'Content ID'; +$lang['content_imagefield_path'] = 'Relative path for page images'; $lang['content_mandatory_urls'] = "Page URL's are required"; -$lang['content_thumbnailfield_path'] = "Path for thumbnail field"; -$lang['contract'] = "Collapse Section"; -$lang['contractall'] = "Collapse All Sections"; -$lang['copy'] = "Copy"; -$lang['copycontent'] = "Copy Content Item"; -$lang['copyfromuser'] = "User"; -$lang['copystylesheet'] = "Copy Stylesheet"; -$lang['copytemplate'] = "Copy Template"; -$lang['copyusersettings'] = "Copy settings and preferences from another user"; -$lang['copyusersettings2'] = "Copy settings from another user"; -$lang['copy_from'] = "Copy From"; -$lang['copy_paste_forum'] = "View Text Report (suitable for copying into forum posts)"; -$lang['copy_to'] = "Copy To"; -$lang['core'] = "Core"; -$lang['create'] = "Create"; -$lang['created_at'] = "Created at"; -$lang['created_directory'] = "Created Directory"; -$lang['createnewfolder'] = "Create New Folder"; -$lang['create_dir_and_file'] = "Checking if the HTTPD process can create a file inside of a directory it created"; -$lang['cron_3h'] = "3 Hours"; -$lang['cron_6h'] = "6 Hours"; -$lang['cron_12h'] = "12 Hours"; -$lang['cron_15m'] = "15 Minutes"; -$lang['cron_24h'] = "24 Hours"; -$lang['cron_30m'] = "30 Minutes"; -$lang['cron_60m'] = "1 Hour"; -$lang['cron_120m'] = "2 Hours"; -$lang['cron_request'] = "Each Request"; -$lang['CSS'] = "CSS"; -$lang['cssalreadyused'] = "CSS name already in use"; -$lang['cssmanagement'] = "CSS Management"; -$lang['cssnameisblockname'] = "Use the block id as the default value for the CSS name parameter in content blocks"; -$lang['css_max_age'] = "Maximum amount of time (seconds) stylesheets can be cached in the browser"; -$lang['curl'] = "Test for the curl library"; -$lang['curlversion'] = "Test curl version"; -$lang['curl_versionstr'] = "version %s, minimum recommended version is %s"; -$lang['currentassociations'] = "Current Associations"; -$lang['currentdirectory'] = "Current Directory"; -$lang['currentgroups'] = "Backend Groups"; -$lang['currentpages'] = "Current Pages"; -$lang['currenttemplates'] = "Current Templates"; -$lang['currentusers'] = "Backend Users"; -$lang['custom404'] = "Custom 404 Error Message"; +$lang['content_thumbnailfield_path'] = 'Relative path for page thumbnail-images'; +$lang['contract'] = 'Collapse Section'; +$lang['contractall'] = 'Collapse All Sections'; +$lang['copy'] = 'Copy'; +$lang['copycontent'] = 'Copy Content Item'; +$lang['copyfromuser'] = 'User'; +$lang['copystylesheet'] = 'Copy Stylesheet'; +$lang['copytemplate'] = 'Copy Template'; +$lang['copyusersettings'] = 'Copy settings and preferences from another user'; +$lang['copyusersettings2'] = 'Copy settings from another user'; +$lang['copy_from'] = 'Copy From'; +$lang['copy_paste_forum'] = 'View Text Report (suitable for copying into forum posts)'; +$lang['copy_to'] = 'Copy To'; +$lang['core'] = 'Core'; +$lang['create'] = 'Create'; +$lang['created_at'] = 'Created at'; +$lang['created_directory'] = 'Created directory'; +$lang['createnewfolder'] = 'Create New Folder'; +$lang['create_dir_and_file'] = 'Checking if the HTTPD process can create a file inside of a directory it created'; +//$lang['cron_3h'] = "3 Hours"; +//$lang['cron_6h'] = "6 Hours"; +//$lang['cron_12h'] = "12 Hours"; +//$lang['cron_15m'] = "15 Minutes"; +//$lang['cron_24h'] = "24 Hours"; +//$lang['cron_30m'] = "30 Minutes"; +//$lang['cron_60m'] = "1 Hour"; +//$lang['cron_120m'] = "2 Hours"; +//$lang['cron_request'] = "Each Request"; +$lang['CSS'] = 'CSS'; +$lang['cssalreadyused'] = 'CSS name already in use'; +$lang['cssmanagement'] = 'CSS Management'; +$lang['cssnameisblockname'] = 'Use the block id as the default value for the CSS name parameter in content blocks'; +$lang['css_max_age'] = 'Maximum amount of time (seconds) stylesheets can be cached in the browser'; +$lang['curl'] = 'Test for the curl library'; +$lang['curlversion'] = 'Test curl version'; +$lang['curl_versionstr'] = 'version %s, minimum recommended version is %s'; +$lang['currentassociations'] = 'Current Associations'; +$lang['currentdirectory'] = 'Current Directory'; +$lang['currentgroups'] = 'Backend Groups'; +$lang['currentpages'] = 'Current Pages'; +$lang['currenttemplates'] = 'Current Templates'; +$lang['currentusers'] = 'Backend Users'; +$lang['custom404'] = 'Custom 404 Error Message'; -## D -$lang['dashboard'] = "View Dashboard"; -$lang['database'] = "Database"; -$lang['databaseprefix'] = "Database Prefix"; -$lang['databasetype'] = "Database Type"; -$lang['date'] = "Date"; -$lang['date_format_string'] = "Date Format String"; +// D +$lang['dashboard'] = 'View Dashboard'; +$lang['database'] = 'Database'; +$lang['databaseprefix'] = 'Database Prefix'; +$lang['databasetype'] = 'Database Type'; +$lang['date'] = 'Date'; +$lang['date_format_string'] = 'Date Format String'; $lang['date_format_string_help'] = "strftime formatted date format string. Try googling 'strftime' for more information"; -$lang['day'] = "day"; -$lang['days'] = "days"; -$lang['default'] = "Default"; -$lang['default_contenttype'] = "Default Content Type"; -$lang['defaultparentpage'] = "Default Parent Page"; -$lang['delete'] = "Delete"; +$lang['day'] = 'day'; +$lang['days'] = 'days'; +$lang['default'] = 'Default'; +$lang['default_contenttype'] = 'Default Content Type'; // for ContentManager only ? +$lang['defaultparentpage'] = 'Default Parent Page'; +$lang['delete'] = 'Delete'; //$lang['deleteassociationconfirm'] = "Are you sure you want to delete association to - %s - ?"; -$lang['deleteconfirm'] = "Are you sure you want to delete - %s - ?"; -$lang['deletecontent'] = "Delete Content"; +$lang['deleteconfirm'] = 'Are you sure you want to delete - %s - ?'; +$lang['deletecontent'] = 'Delete Content'; //$lang['deletecss'] = "Delete CSS"; -$lang['deleted_content'] = "Deleted Content"; -//$lang['deleted_css'] = "Deleted Stylesheet"; -//$lang['deleted_css_association'] = "Deleted Stylesheet Association"; -$lang['deleted_directory'] = "Deleted Directory"; -$lang['deleted_file'] = "Deleted File"; +$lang['deleted_content'] = 'Deleted content'; +//$lang['deleted_css'] = "Deleted stylesheet"; +//$lang['deleted_css_association'] = "Deleted stylesheet association"; +$lang['deleted_directory'] = 'Deleted directory'; +$lang['deleted_file'] = 'Deleted file'; //$lang['deleted_gcb'] = "Deleted Global Content Block"; -$lang['deleted_group'] = "Deleted Group"; -$lang['deleted_module'] = "Permanently removed %s"; -$lang['deleted_udt'] = "Deleted User Defined Tag"; -$lang['deleted_user'] = "Deleted User"; -$lang['deletepages'] = "Delete these pages?"; -$lang['deleteuser'] = "Delete User Account"; +$lang['deleted_group'] = 'Deleted group'; +$lang['deleted_module'] = 'Permanently removed %s'; +$lang['deleted_udt'] = 'Deleted User Defined Tag'; +$lang['deleted_user'] = 'Deleted user'; +$lang['deletepages'] = 'Delete these pages?'; +$lang['deleteuser'] = 'Delete User Account'; //$lang['depsformodule'] = "Dependencies for %s Module"; -$lang['description'] = "Description"; -$lang['design'] = "Design"; -$lang['design_id'] = "Design Id"; -$lang['destinationnotfound'] = "The selected page could not be found or is invalid"; -$lang['destination_page'] = "Destination Page"; -$lang['directoryabove'] = "directory above current level"; -$lang['directoryexists'] = "This directory already exists."; -$lang['disable'] = "Disable"; -$lang['disabled'] = "Disabled"; -$lang['disablesafemodewarning'] = "Disable Admin safe mode warning"; -$lang['disable_functions'] = "disable_functions in PHP"; -$lang['disable_wysiwyg'] = "Disable WYSIWYG editor on this page (regardless of template or user settings)"; -$lang['disallowed_contenttypes'] = "Content Types that are NOT allowed"; -$lang['documentation'] = "Documentation"; -$lang['down'] = "Down"; -$lang['download'] = "Download"; -$lang['download_cksum_file'] = "Create a new checksum file"; +$lang['description'] = 'Description'; +$lang['design'] = 'Design'; +$lang['design_id'] = 'Design Id'; +$lang['destinationnotfound'] = 'The selected page could not be found or is invalid'; +$lang['destination_page'] = 'Destination Page'; +$lang['directoryabove'] = 'directory above current level'; +$lang['directoryexists'] = 'This directory already exists.'; +$lang['disable'] = 'Disable'; +$lang['disabled'] = 'Disabled'; +$lang['disablesafemodewarning'] = 'Disable Admin safe mode warning'; +$lang['disable_functions'] = 'disable_functions in PHP'; +$lang['disable_wysiwyg'] = 'Disable WYSIWYG Editing'; +$lang['disallowed_contenttypes'] = 'Content types that are NOT allowed'; +$lang['documentation'] = 'Documentation'; +$lang['down'] = 'Down'; +$lang['download'] = 'Download'; +$lang['download_cksum_file'] = 'Create checksum file'; // legend -## E -$lang['ecommerce'] = "E-Commerce"; -$lang['ecommerce_desc'] = "Modules for providing E-commerce capabilities"; -$lang['edit'] = "Edit"; -$lang['editbookmark'] = "Edit Shortcut"; -$lang['editconfiguration'] = "Edit Configuration"; +// E +$lang['ecommerce'] = 'E-Commerce'; +$lang['ecommerce_desc'] = 'Modules for providing E-commerce capabilities'; +$lang['edit'] = 'Edit'; +$lang['editbookmark'] = 'Edit Shortcut'; +$lang['editconfiguration'] = 'Edit Configuration'; //$lang['editcontent'] = "Edit Content"; -$lang['editcontent_settings'] = "Content Editing Settings"; +$lang['editcontent_settings'] = 'Content Editing Settings'; //$lang['editcss'] = "Edit Stylesheet"; //$lang['editcsssuccess'] = "Stylesheet updated"; -//$lang['edited_content'] = "Edited Content"; +//$lang['edited_content'] = "Edited content"; //$lang['edited_gcb'] = "Edited Global Content Block"; -$lang['edited_group'] = "Edited Group"; +$lang['edited_group'] = 'Edited group'; //$lang['edited_template'] = "Edited Template"; -$lang['edited_udt'] = "Edited User Defined Tag"; -$lang['edited_user'] = "Edited User"; -$lang['edited_user_preferences'] = "Edited User Preferences"; -$lang['editeventhandler'] = "Edit Event Handler"; +$lang['edited_udt'] = 'Edited User Defined Tag'; +$lang['edited_user'] = 'Edited user'; +$lang['edited_user_preferences'] = 'Edited user preferences'; +$lang['editeventhandler'] = 'Edit Event Handlers'; $lang['editeventhandlerdescription'] = 'A utility to manage the handlers for a specific event.'; -$lang['editgroup'] = "Edit Group"; +$lang['editgroup'] = 'Edit Group'; //$lang['edithtmlblob'] = "Edit Global Content Block"; //$lang['edithtmlblobsuccess'] = "Global content block updated"; //$lang['editpage'] = "Edit Page"; //$lang['editstylesheet'] = "Edit Stylesheet"; -$lang['edituser'] = "Edit User"; -$lang['editusertag'] = "Edit User Defined Tag"; -$lang['email'] = "Email Address"; -$lang['emptyblock'] = "Empty content block: %s"; -$lang['enable'] = "Enable"; -$lang['enablecustom404'] = "Enable Custom 404 Message"; -$lang['enablenotifications'] = "Enable user notifications in the Admin section"; -$lang['enablesitedown'] = "Is the website "Down for Maintenance""; -$lang['enablewysiwyg'] = "Use the WYSIWYG on the "Site Down" message"; -$lang['encoding'] = "Encoding"; -$lang['error'] = "Error"; -$lang['errorcantcreatefile'] = "Could not create a file (permissions problem?)"; -$lang['errorchildcontent'] = "Content still contains child contents. Please remove them first."; -//$lang['errorcopyingstylesheet'] = "Error Copying Stylesheet"; -//$lang['errorcopyingtemplate'] = "Error Copying Template"; +$lang['edituser'] = 'Edit User'; +$lang['editusertag'] = 'Edit User Defined Tag'; +$lang['email'] = 'Email Address'; +$lang['emptyblock'] = 'Empty content block: %s'; +$lang['enable'] = 'Enable'; +$lang['enablecustom404'] = 'Enable Custom 404 Message'; +$lang['enablenotifications'] = 'Enable user notifications in the Admin section'; +$lang['enablesitedown'] = 'Is the website "Down for Maintenance"'; +$lang['enablewysiwyg'] = 'Use the WYSIWYG on the "Site Down" message'; +$lang['encoding'] = 'Encoding'; +$lang['error'] = 'Error'; +$lang['errorcantcreatefile'] = 'Could not create a file. Permissions problem?'; +$lang['errorchildcontent'] = 'Content still contains child contents. Please remove them first.'; +//$lang['errorcopyingstylesheet'] = "Error copying stylesheet"; +//$lang['errorcopyingtemplate'] = "Error copying template"; //$lang['errorcouldnotparsexml'] = "Error parsing XML file. Please make sure you are uploading a .xml file and not a .tar.gz or zip file."; //$lang['errorcreatingassociation'] = "Error creating association"; -//$lang['errorcssinuse'] = "This Stylesheet is still used by template or pages. Please remove those associations first."; -$lang['errordefaultpage'] = "Can not delete the current default page. Please set a different one first."; -$lang['errordeletingassociation'] = "Error deleting association"; -$lang['errordeletingcontent'] = "Error deleting content (either this page has children or is the default content)"; +//$lang['errorcssinuse'] = "This stylesheet is still used by template(s) or page(s). Please remove those associations first."; +$lang['errordefaultpage'] = 'You cannot delete the default page. Please set a different default page then try again.'; +$lang['errordeletingassociation'] = 'Error deleting association'; +$lang['errordeletingcontent'] = 'Error deleting content (either this page has children or is the default content)'; //$lang['errordeletingcss'] = "Error deleting CSS"; -$lang['errordeletingdirectory'] = "Could not delete directory. Permissions problem?"; -$lang['errordeletingfile'] = "Could not delete file. Permissions Problem?"; +$lang['errordeletingdirectory'] = 'Could not delete directory. Permissions problem?'; +$lang['errordeletingfile'] = 'Could not delete file. Permissions problem?'; $lang['error_deletespecialgroup'] = 'You cannot delete the special Admin group'; -$lang['errordirectorynotwritable'] = "No permission to write in directory. This could be caused by file permissions and ownership. Safe mode may also be in effect."; -$lang['errorgettingcontent'] = "Could not retrieve information for the specified content object"; -$lang['errorgroupexists'] = 'A group already exists with this name'; -//$lang['errorgettingcssname'] = "Error getting Stylesheet name"; +$lang['errordirectorynotwritable'] = 'No permission to write in directory. This could be caused by file permissions and ownership. Safe mode may also be in effect.'; +$lang['errorgettingcontent'] = 'Could not retrieve information for the specified content object'; +$lang['errorgroupexists'] = 'A group with this name already exists'; +//$lang['errorgettingcssname'] = "Error getting stylesheet name"; //$lang['errorgettingtemplatename'] = "Error getting template name"; //$lang['errorinsertingblob'] = "There was an error inserting the Global Content Block"; -//$lang['errorinsertingcss'] = "Error inserting Stylesheet"; -$lang['errorinsertinggroup'] = "Error inserting group"; -$lang['errorinsertingtag'] = "Error inserting User Defined Tag"; +//$lang['errorinsertingcss'] = "Error inserting stylesheet"; +$lang['errorinsertinggroup'] = 'Error inserting group'; +$lang['errorinsertingtag'] = 'Error inserting User Defined Tag'; //$lang['errorinsertingtemplate'] = "Error inserting template"; -$lang['errorinsertinguser'] = "Error inserting user"; +$lang['errorinsertinguser'] = 'Error inserting user'; $lang['err_invalidcontentimgpath'] = 'Error: Invalid path specified for {content_image} tag.'; //$lang['errorinstallfailed'] = "Module installation failed"; -$lang['errormodulenotfound'] = "Internal error, could not find the instance of a module"; -$lang['errormodulenotloaded'] = "Internal error, the module has not been instantiated"; -$lang['errormoduleversionincompatible'] = "Module is incompatible with this version of CMSMS"; -$lang['errormodulewontload'] = "Problem instantiating an available module"; -$lang['errornofilesexported'] = "Error exporting files to XML"; -$lang['errorpagealreadyinuse'] = "Sorry. A page of this type already exists, and only one of this type is allowed."; -//$lang['errorretrievingcss'] = "Error retrieving Stylesheet"; +$lang['errormodulenotfound'] = 'Internal error, could not find the instance of a module'; +$lang['errormodulenotloaded'] = 'Internal error, the module has not been instantiated'; +$lang['errormoduleversionincompatible'] = 'Module is incompatible with this version of CMSMS'; +$lang['errormodulewontload'] = 'Problem instantiating an available module'; +$lang['errornofilesexported'] = 'Error exporting files to XML'; +$lang['errorpagealreadyinuse'] = 'A page of this type already exists, and only one of this type is allowed.'; +//$lang['errorretrievingcss'] = "Error retrieving stylesheet"; //$lang['errorretrievingtemplate'] = "Error retrieving template"; -$lang['errorsendingemail'] = "There was an error sending the email. Contact your administrator."; +$lang['errorsendingemail'] = 'There was an error sending the email. Contact your administrator.'; +$lang['errorsinjobs'] = 'Error(s) found for these jobs'; //$lang['errortemplateinuse'] = "This template is still in use by one or more pages. Please remove it first."; -$lang['errorupdatetemplateallpages'] = "Template is not active"; -//$lang['errorupdatingcss'] = "Error updating Stylesheet"; -$lang['errorupdatinggroup'] = "Error updating group"; -$lang['errorupdatingpages'] = "Error updating pages"; -$lang['errorupdatingtemplate'] = "Error updating template"; -$lang['errorupdatinguser'] = "Error updating user"; -$lang['errorupdatingusertag'] = "Error updating user tag"; -$lang['erroruserinuse'] = "This user still owns content pages. Please change ownership to another user before deleting."; -$lang['error_contenttype'] = "The content type associated with this page is invalid or not permitted"; -$lang['error_copyusersettings_self'] = "This user account is the template user. You cannot copy user settings here"; -$lang['error_coreupgradeneeded'] = "The CMSMS core must be upgraded before this operation can succeed"; -$lang['error_delete_default_parent'] = "You cannot delete the default page, or a parent of the default page."; -$lang['error_frominvalid'] = "The from address specified is not a valid email address"; -$lang['error_fromrequired'] = "A from address is required"; -$lang['error_hostrequired'] = "A host name is required when using the SMTP mailer"; -$lang['error_internal'] = "Internal error"; -$lang['error_locknotsaved'] = "Cannot retrieve this information... lock has not been saved"; -$lang['error_mailnotset_notest'] = "Mail settings have not been saved. Cannot test"; -$lang['error_mailtest_noaddress'] = "No address specified for testing"; -$lang['error_mailtest_notemail'] = "Value specified is not a valid email address"; -$lang['error_module_mincmsversion'] = "This module requires a newer version of CMS Made Simple"; -$lang['error_multiusersettings'] = "Cannot set multiple user settings options at the same time"; -$lang['error_nofileuploaded'] = "No File has been uploaded"; -$lang['error_nograntall_found'] = "Could not find a suitable "GRANT ALL" permission, this does not necessarily lead to problems... But if you have problems installing/removing modules or adding and deleting items/pages this could be the cause!"; -$lang['error_nomodules'] = "No modules installed! Check Site Admin > Module Manager"; -$lang['error_notconfirmed'] = "Operation not confirmed"; -$lang['error_no_content_blocks'] = "No content blocks were detected in this template. Please ensure that you have at least the default {content} block defined in this template"; -$lang['error_no_default_content_block'] = "No default content block was detected in this template. Please ensure that you have a {content} tag in the page template."; -$lang['error_objectcantsetthis'] = "You cannot adjust the %s property of this object"; -$lang['error_parsing_content_blocks'] = "An error occurred parsing content blocks (look for an invalid template, or duplicated content blocks)"; -$lang['error_passwordrequired'] = "A password is required for SMTP authentication"; -$lang['error_portinvalid'] = "Port number is invalid"; -$lang['error_retrieving_file_list'] = "Error retrieving file list"; +$lang['errorupdatetemplateallpages'] = 'Template is not active'; +//$lang['errorupdatingcss'] = "Error updating stylesheet"; +$lang['errorupdatinggroup'] = 'Error updating group'; +$lang['errorupdatingpages'] = 'Error updating pages'; +$lang['errorupdatingtemplate'] = 'Error updating template'; +$lang['errorupdatinguser'] = 'Error updating user'; +$lang['errorupdatingusertag'] = 'Error updating user tag'; +$lang['erroruserinuse'] = 'This user still owns content pages. Please change ownership to another user before deleting.'; +$lang['error_badfield'] = 'Invalid %s given!'; +$lang['error_contenttype'] = 'The content type associated with this page is invalid or not permitted'; +$lang['error_copyusersettings_self'] = 'This user account is the template user. You cannot copy user settings here'; +$lang['error_coreupgradeneeded'] = 'The CMSMS core must be upgraded before this operation can succeed'; +$lang['error_delete_default_parent'] = 'You cannot delete the default page, or a parent of the default page.'; +$lang['error_frominvalid'] = 'The from address specified is not a valid email address'; +$lang['error_fromrequired'] = 'A from address is required'; +$lang['error_hostrequired'] = 'A host name is required when using the SMTP mailer'; +$lang['error_internal'] = 'Internal error'; +$lang['error_locknotsaved'] = 'Cannot retrieve this information... lock has not been saved'; +$lang['error_mailnotset_notest'] = 'Mail settings have not been saved. Cannot test'; +$lang['error_mailtest_noaddress'] = 'No address specified for testing'; +$lang['error_mailtest_notemail'] = 'Value specified is not a valid email address'; +$lang['error_module_mincmsversion'] = 'This module requires a newer version of CMS Made Simple'; +$lang['error_multiusersettings'] = 'Cannot set multiple user settings options at the same time'; +$lang['error_nofileuploaded'] = 'No file has been uploaded'; +$lang['error_nograntall_found'] = 'Could not find a suitable "GRANT ALL" permission, this does not necessarily lead to problems... But if you have problems installing/removing modules or adding and deleting items/pages this could be the cause!'; +$lang['error_nomodules'] = 'No modules installed! Check Extensions > Module Manager'; +$lang['error_notconfirmed'] = 'Operation not confirmed'; +$lang['error_no_content_blocks'] = 'No content block was detected in this template. Please ensure that there is at least the default {content} block defined in this template.'; +$lang['error_no_default_content_block'] = 'No default content block was detected in this template. Please ensure that you have a {content} tag in the page template.'; +$lang['error_objectcantsetthis'] = 'You cannot adjust the %s property of this object'; +$lang['error_parsing_content_blocks'] = 'An error occurred parsing content blocks (look for an invalid template, or duplicated content blocks)'; +$lang['error_passwordrequired'] = 'A password is required for SMTP authentication'; +$lang['error_portinvalid'] = 'Port number is invalid'; +$lang['error_retrieving_file_list'] = 'Error retrieving file list'; //$lang['error_setusersettings_self'] = "Cannot set the template user to this account"; -$lang['error_sitedownmessage'] = 'It appears that your sitedown message is empty. Please at least display some text to inform visitors that your website is down for maintenance'; -$lang['error_timedifference2'] = "A discrepancy in time with the PHP environment was detected. This may cause problems when publishing i.e. news articles."; -$lang['error_timeoutinvalid'] = "The time-out specified is invalid (must be between 1 and 3600 seconds)"; -$lang['error_type'] = "Error Type"; -$lang['error_udt_name_chars'] = "A valid UDT name starts with a letter or underscore, followed by any number of letters, numbers, or underscores."; -$lang['error_udt_name_whitespace'] = "Error: User Defined Tags cannot have spaces in their name."; -$lang['error_uploadproblem'] = "An error occurred in the upload"; -$lang['error_usernamerequired'] = "A username is required for SMTP authentication"; -$lang['event'] = "Event"; -$lang['eventhandler'] = "Event Handlers"; -$lang['eventhandlerdescription'] = "Associate User Defined Tags with Events"; -$lang['eventhandlers'] = "Event Manager"; -$lang['event_description'] = "Event Description"; -$lang['event_desc_adddesignpost'] = "Sent after a design/theme is saved"; -$lang['event_desc_adddesignpre'] = "Sent just before a design/theme is saved to the database"; -$lang['event_desc_addglobalcontentpost'] = "Sent after a new global content block is created"; -$lang['event_desc_addglobalcontentpre'] = "Sent before a new global content block is created"; -$lang['event_desc_addgrouppost'] = "Sent after a new group is created"; -$lang['event_desc_addgrouppre'] = "Sent before a new group is created"; -$lang['event_desc_addstylesheetpost'] = "Sent after a new stylesheet is created"; -$lang['event_desc_addstylesheetpre'] = "Sent before a new stylesheet is created"; -$lang['event_desc_addtemplatepost'] = "Sent after a new template is created"; -$lang['event_desc_addtemplatepre'] = "Sent before a new template is created"; -$lang['event_desc_addtemplatetypepost'] = "Sent just after a template type definition is saved to the database"; -$lang['event_desc_addtemplatetypepre'] = "Sent just prior to a template type definition being saved to the database"; -$lang['event_desc_adduserdefinedtagpost'] = "Sent after a user defined tag is inserted"; -$lang['event_desc_adduserdefinedtagpre'] = "Sent prior to a user defined tag insert"; -$lang['event_desc_adduserpost'] = "Sent after a new user is created"; -$lang['event_desc_adduserpre'] = "Sent before a new user is created"; -$lang['event_desc_changegroupassignpost'] = "Sent after group assignments are saved"; -$lang['event_desc_changegroupassignpre'] = "Sent before group assignments are saved"; -$lang['event_desc_contentdeletepost'] = "Sent after content is deleted from the system"; -$lang['event_desc_contentdeletepre'] = "Sent before content is deleted from the system"; -$lang['event_desc_contenteditpost'] = "Sent after edits to content are saved"; -$lang['event_desc_contenteditpre'] = "Sent before edits to content are saved"; -$lang['event_desc_contentpostcompile'] = "Sent after content has been processed by Smarty"; -$lang['event_desc_contentpostrender'] = "Sent before the combined HTML is sent to the browser"; -$lang['event_desc_contentprecompile'] = "Sent before content is sent to Smarty for processing"; -$lang['event_desc_contentprerender'] = "Sent before any Smarty processing is performed."; -$lang['event_desc_contentstylesheet'] = "Sent before the stylesheet is sent to the browser"; -$lang['event_desc_deletedesignpost'] = "Sent just after a design/theme is removed"; -$lang['event_desc_deletedesignpre'] = "Sent just prior to a design/theme being removed"; -$lang['event_desc_deleteglobalcontentpost'] = "Sent after a global content block is deleted from the system"; -$lang['event_desc_deleteglobalcontentpre'] = "Sent before a global content block is deleted from the system"; -$lang['event_desc_deletegrouppost'] = "Sent after a group is deleted from the system"; -$lang['event_desc_deletegrouppre'] = "Sent before a group is deleted from the system"; -$lang['event_desc_deletestylesheetpost'] = "Sent after a stylesheet is deleted from the system"; -$lang['event_desc_deletestylesheetpre'] = "Sent before a stylesheet is deleted from the system"; -$lang['event_desc_deletetemplatepost'] = "Sent after a template is deleted from the system"; -$lang['event_desc_deletetemplatepre'] = "Sent before a template is deleted from the system"; -$lang['event_desc_deletetemplatetypepost'] = "Sent just after a template type definition is deleted"; -$lang['event_desc_deletetemplatetypepre'] = "Sent just prior to a template type definition being deleted"; -$lang['event_desc_deleteuserdefinedtagpost'] = "Sent after a user defined tag is deleted"; -$lang['event_desc_deleteuserdefinedtagpre'] = "Sent prior to deleting a user defined tag"; -$lang['event_desc_deleteuserpost'] = "Sent after a user is deleted from the system"; -$lang['event_desc_deleteuserpre'] = "Sent before a user is deleted from the system"; -$lang['event_desc_editdesignpost'] = "Sent just after a design/theme is saved to the database"; -$lang['event_desc_editdesignpre'] = "Sent just before a design/theme is saved to the database"; -$lang['event_desc_editglobalcontentpost'] = "Sent after edits to a global content block are saved"; -$lang['event_desc_editglobalcontentpre'] = "Sent before edits to a global content block are saved"; -$lang['event_desc_editgrouppost'] = "Sent after edits to a group are saved"; -$lang['event_desc_editgrouppre'] = "Sent before edits to a group are saved"; -$lang['event_desc_editstylesheetpost'] = "Sent after edits to a stylesheet are saved"; -$lang['event_desc_editstylesheetpre'] = "Sent before edits to a stylesheet are saved"; -$lang['event_desc_edittemplatepost'] = "Sent after edits to a template are saved"; -$lang['event_desc_edittemplatepre'] = "Sent before edits to a template are saved"; -$lang['event_desc_edittemplatetypepost'] = "Sent just after a template type definition is saved"; -$lang['event_desc_edittemplatetypepre'] = "Sent just before a template type definition is saved"; -$lang['event_desc_edituserdefinedtagpost'] = "Sent after a user defined tag is updated"; -$lang['event_desc_edituserdefinedtagpre'] = "Sent prior to a user defined tag update"; -$lang['event_desc_edituserpost'] = "Sent after edits to a user are saved"; -$lang['event_desc_edituserpre'] = "Sent before edits to a user are saved"; -$lang['event_desc_globalcontentpostcompile'] = "Sent after a global content block has been processed by Smarty"; -$lang['event_desc_globalcontentprecompile'] = "Sent before a global content block is sent to Smarty for processing"; -$lang['event_desc_loginfailed'] = "Sent after a user failed to login into the Admin panel"; -$lang['event_desc_loginpost'] = "Sent after a user logs into the Admin panel"; -$lang['event_desc_logoutpost'] = "Sent after a user logs out of the Admin panel"; -$lang['event_desc_lostpassword'] = 'Sent when the lost password form is submitted'; -$lang['event_desc_lostpasswordreset'] = 'Sent when the lost password form is submitted'; -$lang['event_desc_moduleinstalled'] = "Sent after a module is installed"; -$lang['event_desc_moduleuninstalled'] = "Sent after a module is uninstalled"; -$lang['event_desc_moduleupgraded'] = "Sent after a module is upgraded"; -$lang['event_desc_smartypostcompile'] = "Sent after any content destined for Smarty has been processed"; -$lang['event_desc_smartyprecompile'] = "Sent before any content destined for Smarty is sent for processing"; -$lang['event_desc_stylesheetpostcompile'] = "Sent after a stylesheet is compiled through Smarty"; -$lang['event_desc_stylesheetprecompile'] = "Sent before a stylesheet is compiled through Smarty"; -$lang['event_desc_stylesheetpostrender'] = 'Sent after a stylesheet is passed through Smarty, but before cached to disk'; -$lang['event_desc_templatepostcompile'] = "Sent after a template has been processed by Smarty"; -$lang['event_desc_templateprecompile'] = "Sent before a template is sent to Smarty for processing"; -$lang['event_desc_templateprefetch'] = "Sent before a template is fetched from Smarty"; -$lang['event_help_adddesignpost'] = "Sent just after a new design/theme is saved to the database"; -$lang['event_help_adddesignpre'] = "

    Parameters

    -
      -
    • 'CmsLayoutCollection' - Reference to the affected design/collection object.
    • -
    -"; -$lang['event_help_adddesignpost'] = "

    Parameters

    -
      -
    • 'CmsLayoutCollection' - Reference to the affected design/collection object.
    • -
    -"; -$lang['event_help_addglobalcontentpost'] = "

    Parameters

    -
      -
    • 'global_content' - Reference to the affected global content block object.
    • -
    -"; -$lang['event_help_addglobalcontentpre'] = "

    Parameters

    -
      -
    • 'global_content' - Reference to the affected global content block object.
    • -
    -"; -$lang['event_help_addgrouppost'] = "

    Parameters

    -
      -
    • 'group' - Reference to the affected group object.
    • -
    -"; -$lang['event_help_addgrouppre'] = "

    Parameters

    -
      -
    • 'group' - Reference to the affected group object.
    • -
    -"; -$lang['event_help_addstylesheetpost'] = "

    Parameters

    -
      -
    • 'stylesheet' - Reference to the affected stylesheet object.
    • -
    -"; -$lang['event_help_addstylesheetpre'] = "

    Parameters

    -
      -
    • 'stylesheet' - Reference to the affected stylesheet object.
    • -
    -"; -$lang['event_help_addtemplatepost'] = "

    Parameters

    -
      -
    • 'template' - Reference to the affected template object.
    • -
    -"; -$lang['event_help_addtemplatepre'] = "

    Parameters

    -
      -
    • 'template' - Reference to the affected template object.
    • -
    -"; -$lang['event_help_addtemplatetypepost'] = "

    Parameters

    -
      -
    • 'CmsLayoutTemplateType' - Reference to the affected template type object.
    • -
    "; -$lang['event_help_addtemplatetypepre'] = "

    Parameters

    -
      -
    • 'CmsLayoutTemplateType' - Reference to the affected template type object.
    • -
    "; -$lang['event_help_adduserdefinedtagpost'] = "

    Parameters

    -
      -
    • None
    • -
    -"; -$lang['event_help_adduserdefinedtagpre'] = "

    Parameters

    -
      -
    • None
    • -
    -"; -$lang['event_help_adduserpost'] = "

    Parameters

    -
      -
    • 'user' - Reference to the affected user object.
    • -
    -"; -$lang['event_help_adduserpre'] = "

    Parameters

    -
      -
    • 'user' - Reference to the affected user object.
    • -
    -"; -$lang['event_help_changegroupassignpost'] = "

    Parameters>

    -
      -
    • 'group' - Reference to the affected group object.
    • -
    • 'users' - Array of references to user objects now belonging to the affected group.
    • -
    -"; -$lang['event_help_changegroupassignpre'] = "

    Parameters>

    -
      -
    • 'group' - Reference to the group object.
    • -
    • 'users' - Array of references to user objects belonging to the group.
    • -
    -"; -$lang['event_help_contentdeletepost'] = "

    Parameters

    -
      -
    • 'content' - Reference to the affected content object.
    • -
    -"; -$lang['event_help_contentdeletepre'] = "

    Parameters

    -
      -
    • 'content' - Reference to the affected content object.
    • -
    -"; -$lang['event_help_contenteditpost'] = "

    Parameters

    -
      -
    • 'content' - Reference to the affected content object.
    • -
    -"; -$lang['event_help_contenteditpre'] = "

    Parameters

    -
      -
    • 'global_content' - Reference to the affected content object.
    • -
    -"; -$lang['event_help_contentpostcompile'] = "

    Parameters

    -
      -
    • 'content' - Reference to the affected content text.
    • -
    -"; -$lang['event_help_contentpostrender'] = "

    Parameters

    -
      -
    • 'content' - Reference to the html text.
    • -
    -"; -$lang['event_help_contentprecompile'] = "

    Parameters

    -
      -
    • 'content' - Reference to the affected content text.
    • -
    -"; -$lang['event_help_contentprerender'] = "

    Parameters

    -
      -
    • 'content' - Reference to the affected content object..
    • -
    -"; -$lang['event_help_contentstylesheet'] = "

    Parameters

    -
      -
    • 'content' - Reference to the affected stylesheet text.
    • -
    -"; -$lang['event_help_deletedesignpost'] = '

    Parameters

    -
      -
    • \'CmsLayoutCollection\' - A reference to the affected collection (aka design/theme) object.
    • -
    -'; -$lang['event_help_deletedesignpre'] = '

    Parameters

    -
      -
    • \'CmsLayoutCollection\' - A reference to the affected collection (aka design/theme) object.
    • -
    -'; -$lang['event_help_deleteglobalcontentpost'] = "

    Parameters

    -
      -
    • 'global_content' - Reference to the affected global content block object.
    • -
    -"; -$lang['event_help_deleteglobalcontentpre'] = "

    Parameters

    -
      -
    • 'global_content' - Reference to the affected global content block object.
    • -
    -"; -$lang['event_help_deletegrouppost'] = "

    Parameters

    -
      -
    • 'group' - Reference to the affected group object.
    • -
    -"; -$lang['event_help_deletegrouppre'] = "

    Parameters

    -
      -
    • 'group' - Reference to the affected group object.
    • -
    -"; -$lang['event_help_deletestylesheetpost'] = "

    Parameters

    -
      -
    • 'stylesheet' - Reference to the affected stylesheet object.
    • -
    -"; -$lang['event_help_deletestylesheetpre'] = "

    Parameters

    -
      -
    • 'stylesheet' - Reference to the affected stylesheet object.
    • -
    -"; -$lang['event_help_deletetemplatepost'] = "

    Parameters

    -
      -
    • 'template' - Reference to the affected template object.
    • -
    -"; -$lang['event_help_deletetemplatepre'] = "

    Parameters

    -
      -
    • 'template' - Reference to the affected template object.
    • -
    -"; -$lang['event_help_deletetemplatetypepost'] = "

    Parameters

    -
      -
    • 'CmsLayoutTemplateType' - Reference to the affected template type object.
    • -
    "; -$lang['event_help_deletetemplatetypepre'] = "

    Parameters

    -
      -
    • 'CmsLayoutTemplateType' - Reference to the affected template type object.
    • -
    "; -$lang['event_help_deleteuserdefinedtagpost'] = "

    Parameters

    -
      -
    • None
    • -
    -"; -$lang['event_help_deleteuserdefinedtagpre'] = "

    Parameters

    -
      -
    • None
    • -
    -"; -$lang['event_help_deleteuserpost'] = "

    Parameters

    -
      -
    • 'user' - Reference to the affected user object.
    • -
    -"; -$lang['event_help_deleteuserpre'] = "

    Parameters

    -
      -
    • 'user' - Reference to the affected user object.
    • -
    -"; -$lang['event_help_editdesignpost'] = '

    Parameters

    -
      -
    • \'CmsLayoutCollection\' - A reference to the affected collection (aka design/theme) object.
    • -
    -'; -$lang['event_help_editdesignpre'] = '

    Parameters

    -
      -
    • \'CmsLayoutCollection\' - A reference to the affected collection (aka design/theme) object.
    • -
    -'; -$lang['event_help_editglobalcontentpost'] = "

    Parameters

    -
      -
    • 'global_content' - Reference to the affected global content block object.
    • -
    -"; -$lang['event_help_editglobalcontentpre'] = "

    Parameters

    -
      -
    • 'global_content' - Reference to the affected global content block object.
    • -
    -"; -$lang['event_help_editgrouppost'] = "

    Parameters

    -
      -
    • 'group' - Reference to the affected group object.
    • -
    -"; -$lang['event_help_editgrouppre'] = "

    Parameters

    -
      -
    • 'group' - Reference to the affected group object.
    • -
    -"; -$lang['event_help_editstylesheetpost'] = "

    Parameters

    -
      -
    • 'stylesheet' - Reference to the affected stylesheet object.
    • -
    -"; -$lang['event_help_editstylesheetpre'] = "

    Parameters

    -
      -
    • 'stylesheet' - Reference to the affected stylesheet object.
    • -
    -"; -$lang['event_help_edittemplatepost'] = "

    Parameters

    -
      -
    • 'template' - Reference to the affected template object.
    • -
    -"; -$lang['event_help_edittemplatepre'] = "

    Parameters

    -
      -
    • 'template' - Reference to the affected template object.
    • -
    -"; -$lang['event_help_edittemplatetypepost'] = "

    Parameters

    -
      -
    • 'CmsLayoutTemplateType' - Reference to the affected template type object.
    • -
    "; -$lang['event_help_edittemplatetypepre'] = "

    Parameters

    -
      -
    • 'CmsLayoutTemplateType' - Reference to the affected template type object.
    • -
    "; -$lang['event_help_edituserdefinedtagpost'] = "

    Parameters

    -
      -
    • None
    • -
    -"; -$lang['event_help_edituserdefinedtagpre'] = "

    Parameters

    -
      -
    • None
    • -
    -"; -$lang['event_help_edituserpost'] = "

    Parameters

    -
      -
    • 'user' - Reference to the affected user object.
    • -
    -"; -$lang['event_help_edituserpre'] = "

    Parameters

    -
      -
    • 'user' - Reference to the affected user object.
    • -
    -"; -$lang['event_help_globalcontentpostcompile'] = "

    Parameters

    -
      -
    • 'global_content' - Reference to the affected global content block text.
    • -
    -"; -$lang['event_help_globalcontentprecompile'] = "

    Parameters

    -
      -
    • 'global_content' - Reference to the affected global content block text.
    • -
    -"; -$lang['event_help_loginfailed'] = "

    Parameters

    -
      -
    • 'user' - (string) The username of the failed login attempt.
    • -
    "; -$lang['event_help_loginpost'] = "

    Parameters

    -
      -
    • 'user' - Reference to the affected user object.
    • -
    -"; -$lang['event_help_logoutpost'] = "

    Parameters

    -
      -
    • 'user' - Reference to the affected user object.
    • -
    -"; -$lang['event_help_lostpassword'] = "

    Parameters

    -
      -
    • 'username' - The username entered in the lostpassword form.
    • -
    -"; -$lang['event_help_lostpasswordreset'] = "

    Parameters

    -
      -
    • 'uid' - The integer userid for the account.
    • -
    • 'username' - The username for the reset account.
    • -
    • 'ip' - The IP address of the client that performed the reset.
    • -
    -"; -$lang['event_help_moduleinstalled'] = "

    Parameters

    -
      -
    • None
    • -
    -"; -$lang['event_help_moduleuninstalled'] = "

    Parameters

    -
      -
    • None
    • -
    -"; -$lang['event_help_moduleupgraded'] = "

    Parameters

    -
      -
    • None
    • -
    -"; -$lang['event_help_smartypostcompile'] = "

    Parameters

    -
      -
    • 'content' - Reference to the affected text.
    • -
    -"; -$lang['event_help_smartyprecompile'] = "

    Parameters

    -
      -
    • 'content' - Reference to the affected text.
    • -
    -"; -$lang['event_help_stylesheetpostcompile'] = "

    Parameters

    -
      -
    • None
    • -
    -"; -$lang['event_help_stylesheetpostrender'] = "

    Parameters

    -
      -
    • 'content' - Reference to the stylesheet text.
    • -
    -"; -$lang['event_help_stylesheetprecompile'] = "

    Parameters

    -
      -
    • None
    • -
    -"; -$lang['event_help_templatepostcompile'] = "

    Parameters

    -
      -
    • 'template' - Reference to the affected template text.
    • -
    • 'type' - The type of template call. i.e: template for a whole template, tpl_head, tpl_body, or tpl_top for a partial template.
    • -
    -"; -$lang['event_help_templateprecompile'] = "

    Parameters

    -
      -
    • 'template' - Reference to the affected template text.
    • -
    • 'type' - The type of template call. i.e: template for a whole template, tpl_head, tpl_body, or tpl_top for a partial template.
    • -
    -"; -$lang['event_help_templateprefetch'] = "

    Parameters

    -
      -
    • None
    • -
    "; -$lang['event_name'] = "Event Name"; -$lang['execute'] = "Execute"; -$lang['expand'] = "Expand Section"; -$lang['expandall'] = "Expand All Sections"; -$lang['expanded_xml'] = "Expanded XML file consisting of %s %s"; -$lang['export'] = "Export"; -$lang['extensions'] = "Extensions"; -$lang['extensionsdescription'] = "Modules, plugin tags and other features to expand CMSMS"; -$lang['extra1'] = "Extra Page Attribute 1"; -$lang['extra2'] = "Extra Page Attribute 2"; -$lang['extra3'] = "Extra Page Attribute 3"; +$lang['error_sitedownmessage'] = "It appears that this site's sitedown message is empty. Please at least display some text to inform visitors that this site is down for maintenance."; +$lang['error_timedifference2'] = 'A discrepancy in time with the PHP environment was detected. This may cause problems when publishing e.g. news articles.'; +$lang['error_timeoutinvalid'] = 'The time-out specified is invalid (must be between 1 and 3600 seconds)'; +$lang['error_type'] = 'Error Type'; +$lang['error_udt_name_chars'] = 'A valid UDT name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.'; +$lang['error_udt_name_whitespace'] = 'Error: User Defined Tags cannot have spaces in their name.'; +$lang['error_uploadproblem'] = 'An error occurred in the upload'; +$lang['error_usernamerequired'] = 'A username is required for SMTP authentication'; +$lang['errors'] = 'Errors'; +$lang['event'] = 'Event'; +$lang['event_description'] = 'Event Description'; +// 'event_desc_*' and 'event_help_*' strings have been exported to the 'events' realm i.e. files .../lib/lang/events/* +$lang['event_name'] = 'Event Name'; +$lang['eventhandler'] = 'Event Handlers'; // column-heading +$lang['eventhandlerdescription'] = 'Associate User Defined Tags with Events'; +$lang['eventhandlers'] = 'Event Manager'; // page-heading +$lang['execute'] = 'Execute'; +$lang['expand'] = 'Expand Section'; +$lang['expandall'] = 'Expand All Sections'; +$lang['expanded_xml'] = 'Expanded XML file consisting of %s %s'; +$lang['export'] = 'Export'; +$lang['extensions'] = 'Extensions'; +$lang['extensionsdescription'] = 'Modules, plugin tags and other features to expand CMSMS'; +$lang['extra1'] = 'Extra Page Attribute 1'; +$lang['extra2'] = 'Extra Page Attribute 2'; +$lang['extra3'] = 'Extra Page Attribute 3'; $lang['E_ALL'] = 'Is E_ALL enabled in error_reporting'; -$lang['E_DEPRECATED'] = "Is E_DEPRECATED disabled in error_reporting"; -$lang['E_STRICT'] = "Is E_STRICT disabled in error_reporting"; +$lang['E_DEPRECATED'] = 'Is E_DEPRECATED disabled in error_reporting'; +$lang['E_STRICT'] = 'Is E_STRICT disabled in error_reporting'; -## F -$lang['failure'] = "Failure"; -$lang['false'] = "False"; -$lang['filecreatedirbadchars'] = "Invalid characters were detected in the submitted directory name"; +// F +$lang['failure'] = 'Failure'; +$lang['false'] = 'False'; +$lang['filecreatedirbadchars'] = 'Invalid characters were detected in the submitted directory name'; //$lang['filecreatedirnodoubledot'] = "Directory cannot contain .. (double dots)"; -$lang['filecreatedirnoname'] = "Cannot create a directory with no name."; +$lang['filecreatedirnoname'] = 'Cannot create a directory with no name.'; //$lang['filecreatedirnoslash'] = "Directory name can not contain a / or \ character."; -$lang['filemanagement'] = "File Management"; -$lang['filemanager'] = "File Manager"; -$lang['filemanagerdescription'] = "Upload and manage files."; -$lang['filename'] = "Filename"; -$lang['filenotuploaded'] = "File could not be uploaded. This could be a Permission or Safe Mode problem?"; -$lang['files'] = "Files"; +$lang['filemanagement'] = 'File Management'; +$lang['filemanager'] = 'File Manager'; +$lang['filemanagerdescription'] = 'Upload and manage files.'; +$lang['filename'] = 'Filename'; +$lang['filenotuploaded'] = 'File could not be uploaded. This could be a Permission or Safe Mode problem?'; +$lang['files'] = 'Files'; $lang['filesdescription'] = 'File and media management'; -$lang['filesize'] = "File Size"; -$lang['files_checksum_failed'] = "Files could not be checksummed"; -$lang['files_failed'] = "Files failed md5sum check"; -$lang['files_not_found'] = "Files Not found"; -$lang['file_get_contents'] = "Test file_get_contents"; -$lang['file_uploads'] = "File uploads"; -$lang['file_url'] = "Link to file (instead of URL)"; +$lang['filesize'] = 'File Size'; +$lang['files_checksum_failed'] = '%d files could not be checksummed'; +$lang['files_failed'] = '%d files failed checksum match'; +$lang['files_not_found'] = '%d files not found'; +$lang['files_not_readable'] = '%d un-readable files found'; +$lang['file_get_contents'] = 'Test file_get_contents'; +$lang['file_uploads'] = 'File uploads'; +$lang['file_url'] = 'Link to file (instead of URL)'; $lang['filter'] = 'Filter'; -$lang['filteraction'] = "Action contains"; -$lang['filterapplied'] = "Current Filter"; -$lang['filterapply'] = "Apply filters"; -$lang['filterbymodule'] = "Filter By Originator"; -$lang['filtername'] = "Event name contains"; -$lang['filterreset'] = "Reset filters"; -$lang['filters'] = "Filters"; -$lang['filteruser'] = "Username is"; -$lang['first'] = "First"; -$lang['firstname'] = "First Name"; -$lang['forge'] = "Forge"; -$lang['forgotpwprompt'] = "Enter your Admin username. An email will then be sent to the email address associated with that username with new login information"; -$lang['forums'] = "Forums"; -$lang['frontendlang'] = "Default language for the frontend"; -$lang['frontendwysiwygtouse'] = "Frontend WYSIWYG"; +$lang['filteraction'] = 'Action contains'; +$lang['filterapplied'] = 'Current Filter'; +$lang['filterapply'] = 'Apply filters'; +$lang['filterbymodule'] = 'Filter By Originator'; +$lang['filtername'] = 'Event name contains'; +$lang['filterreset'] = 'Reset filters'; +//$lang['filters'] = "Filters"; +$lang['filteruser'] = 'Username is'; +$lang['first'] = 'First'; +$lang['firstname'] = 'First Name'; +$lang['forge'] = 'Forge'; +$lang['forgotpwprompt'] = 'Enter your Admin username. An email will then be sent to the email address associated with that username with new login information'; +$lang['forums'] = 'Forums'; +$lang['frequency'] = 'Frequency'; +$lang['frontendlang'] = 'Default language for the frontend'; +$lang['frontendparameters'] = 'Frontend-Action Parameters'; +$lang['frontendwysiwygtouse'] = 'Frontend WYSIWYG'; -## G -$lang['gcb_wysiwyg'] = "Enable GCB WYSIWYG"; -$lang['gcb_wysiwyg_help'] = "Enable the WYSIWYG editor while editing Global Content Blocks"; -$lang['gd_version'] = "GD version"; -$lang['general_operation_settings'] = "General Operation Settings"; -$lang['general_settings'] = "General Settings"; -$lang['generic'] = "Generic"; -$lang['globalconfig'] = "Settings - Global Settings"; -$lang['globalmetadata'] = "Global Metadata"; -$lang['global_umask'] = "File Creation Mask (umask)"; -$lang['goto'] = "Back to:"; -$lang['group'] = "Group"; -$lang['groupassignmentdescription'] = "Here you can assign users to groups."; -$lang['groupassignments'] = "Backend Group Assignments"; -$lang['groupmanagement'] = "Group Management"; -$lang['groupname'] = "Group Name"; -$lang['grouppermissions'] = "Backend Group Permissions"; -$lang['groupperms'] = "Backend Group Permissions"; -$lang['grouppermsdescription'] = "Set permissions and access levels for Admin groups"; -$lang['groups'] = "Backend Groups"; -$lang['groupsdescription'] = "This is where you manage Admin groups."; +// G +//$lang['gcb_wysiwyg'] = "Enable GCB WYSIWYG"; +//$lang['gcb_wysiwyg_help'] = "Enable the WYSIWYG editor while editing Global Content Blocks"; +$lang['gd_version'] = 'GD version'; +$lang['general_operation_settings'] = 'General Operation Settings'; +$lang['general_settings'] = 'General Settings'; +$lang['general'] = 'General'; +$lang['generic'] = 'Generic'; +$lang['globalconfig'] = 'Settings - Global'; +$lang['globalmetadata'] = 'Global Metadata'; +$lang['global_umask'] = 'File and Directory Creation Mask (umask)'; +$lang['goto'] = 'Back to:'; +$lang['group'] = 'Group'; +$lang['groupassignmentdescription'] = 'Here you can assign users to groups.'; +$lang['groupassignments'] = 'Backend Group Assignments'; +$lang['groupmanagement'] = 'Group Management'; +$lang['groupname'] = 'Group Name'; +$lang['groupperms'] = 'Backend Group Permissions'; +$lang['grouppermsdescription'] = 'Set permissions and access levels for Admin groups'; +$lang['groups'] = 'Backend Groups'; +$lang['groupsdescription'] = 'This is where you manage Admin groups.'; -## H -$lang['handler'] = "Handler (user defined tag)"; -$lang['handle_404'] = "Custom 404 Handling"; -$lang['hasdependents'] = "Has Dependants"; -$lang['headtags'] = "Head Tags"; -$lang['help'] = "Help"; +// H +$lang['handler'] = 'Handler'; +$lang['handle_404'] = 'Custom 404 Handling'; +$lang['hasdependents'] = 'Has Dependants'; +$lang['headtags'] = 'Head Tags'; +$lang['help'] = 'Help'; $lang['helpaddtemplate'] = "

    A template is what controls the look and feel of your site's content.

    Create the layout here and also add your CSS in the Stylesheet section to control the look of your various elements.

    "; -$lang['helplisttemplate'] = "

    This page allows you to edit, delete, and create templates.

    To create a new template, click on the Add New Template button.

    If you wish to set all content pages to use the same template, click on the Set All Content link.

    If you wish to duplicate a template, click on the Copy icon and you will be prompted to name the new duplicate template.

    "; -$lang['helpwithsection'] = "%s Help"; -$lang['help_content_accesskey'] = "Specify an access key character (single character) that can be used to access this content page. This is useful for accessibility purposes"; -$lang['help_content_active'] = "Inactive pages cannot be displayed, or appear in the navigation"; -$lang['help_content_addteditor'] = "This field allows you to specify other Admin users who will be able to edit this content page. This field is useful when editors have limited access privileges, and need the ability to edit different pages."; -$lang['help_content_cachable'] = "This toggle indicates whether the content of this page should be cached on the server, and on the browser. If a page is not cachable, then it must be regenerated on each and every request. Setting a page to be cachable can be a significant performance boost for most websites."; -$lang['help_content_content_en'] = "This is the default content block. Here you enter the content that will be most prominently displayed on the content page"; -$lang['help_content_disablewysiwyg'] = "This checkbox is used to indicate that regardless of settings in the page template, or user settings no WYSIWYG editor should be used at all in any text area on this page. This is useful when the page uses a standard site page template, but contains either hard coded HTML, Smarty logic, or only displays the output of a third party module"; -$lang['help_content_extra1'] = "This field is used for advanced navigations or template logic. Consult your site developer to see if you need to edit this value when managing content"; -$lang['help_content_extra2'] = "This field is used for advanced navigations or template logic. Consult your site developer to see if you need to edit this value when managing content"; -$lang['help_content_extra3'] = "This field is used for advanced navigations or template logic. Consult your site developer to see if you need to edit this value when managing content"; -$lang['help_content_image'] = "This field allows you to associate an image with the content page. The images must have already been uploaded to the website in a directory specified by the website designer. The image may optionally be displayed on the page, or used when building a navigation"; -$lang['help_content_menutext'] = "This is the text that represents this page in the navigation. The menu text is also used to create a page alias if none is specified."; -$lang['help_content_owner'] = "This field allows you to adjust the owner of this content item. It is useful when giving access to this page to an editor with less access privileges"; -$lang['help_content_pagedata'] = "This is a field where you can enter Smarty tags or logic that are specific to this content page, will probably not generate any direct output, and must be processed before anything else on the page"; -$lang['help_content_pagemeta'] = "In this field you can enter HTML meta tags. They will be merged with the default meta tags and inserted in the head section of the generated HTML page."; -$lang['help_content_parent'] = "Select an existing page in the content hierarchy which will be the parent page for this content page. This relationship is used when building a navigation"; -$lang['help_content_secure'] = "Specify whether this page should be accessed via a secure (encrypted) connection. i.e: via HTTPS"; -$lang['help_content_showinmenu'] = "Select whether this page will be visible (by default) in the navigation."; -$lang['help_systeminformation'] = "The information displayed below is collected from a variety of locations, and summarized here so that you may be able to conveniently find some of the information required when trying to diagnose a problem or request help with your CMS Made Simple™ installation."; -$lang['hidefrommenu'] = "Hide From Menu"; -$lang['hide_help_links'] = "Hide module help links"; -$lang['hide_help_links_help'] = "Disable the module help link in page headers."; +$lang['helplisttemplate'] = '

    This page allows you to edit, delete, and create templates.

    To create a new template, click on the Add New Template button.

    If you wish to set all content pages to use the same template, click on the Set All Content link.

    If you wish to duplicate a template, click on the Copy icon and you will be prompted to name the new duplicate template.

    '; +$lang['helpwithsection'] = '%s Help'; +$lang['help_content_accesskey'] = 'Specify an access key character (single character) that can be used to access this content page. This is useful for accessibility purposes'; +$lang['help_content_active'] = 'Inactive pages cannot be displayed, or appear in the navigation'; +$lang['help_content_addteditor'] = 'This field allows you to specify other Admin users who will be able to edit this content page. This field is useful when editors have limited access privileges, and need the ability to edit different pages.'; +$lang['help_content_cachable'] = 'This toggle indicates whether the content of this page should be cached on the server, and on the browser. If a page is not cachable, then it must be regenerated on each and every request. Setting a page to be cachable can be a significant performance boost for most websites.'; +$lang['help_content_content_en'] = 'This is the default content block. Here you enter the content that will be most prominently displayed on the content page'; +$lang['help_content_default'] = 'This toggle indicates whether this page is this website\'s default page. If you change the setting from checked/true to unchecked/false, you MUST manually set another page as the default, to replace this one.'; +//$lang['help_content_disablewysiwyg'] = "This checkbox is used to indicate that regardless of settings in the page template and/or user settings, no WYSIWYG editor should be used in any text area on this page. This can be useful when the page uses a standard site page template but contains either hard-coded HTML, Smarty logic, or only displays output from a non-core module"; see 'help_page_disablewysiwyg' +$lang['help_content_extra1'] = 'This field is used for advanced navigations or template logic. Consult your site developer to see if you need to edit this value when managing content'; +$lang['help_content_extra2'] = 'This field is used for advanced navigations or template logic. Consult your site developer to see if you need to edit this value when managing content'; +$lang['help_content_extra3'] = 'This field is used for advanced navigations or template logic. Consult your site developer to see if you need to edit this value when managing content'; +$lang['help_content_image'] = "This field allows associating an image with the content page. Such image might be for display on the page, or used when building a navigation, etc. Enter or select an absolute url, or a site-root-relative url, or just a file basename which will be taken to indicate the file is located in or below the site's configured uploaded-images folder. See also the 'content_imagefield_path' site-preference."; +$lang['help_content_menutext'] = 'This is the text that represents this page in the navigation. The menu text is also used to create a page alias if none is specified.'; +$lang['help_content_owner'] = 'This field allows you to adjust the owner of this content item. It is useful when giving access to this page to an editor with less access privileges'; +$lang['help_content_pagedata'] = 'This is a field where you can enter Smarty tags or logic that are specific to this content page, will probably not generate any direct output, and must be processed before anything else on the page'; +$lang['help_content_pagemeta'] = 'In this field you can enter HTML meta tags. They will be merged with the default meta tags and inserted in the head section of the generated HTML page.'; +$lang['help_content_parent'] = 'Select an existing page in the content hierarchy which will be the parent page for this content page. This relationship is used when building a navigation'; +$lang['help_content_secure'] = 'Specify whether this page should be accessed via a secure (encrypted) connection i.e. via HTTPS'; +$lang['help_content_showinmenu'] = 'Select whether this page will be visible (by default) in the navigation.'; +$lang['help_systeminformation'] = 'The information displayed below is collected from a variety of locations, and summarized here so that you may be able to conveniently find some of the information required when trying to diagnose a problem or request help with your CMS Made Simple™ installation.'; +$lang['hidefrommenu'] = 'Hide From Menu'; +$lang['hide_help_links'] = 'Module Help Links'; +$lang['hide_help_links_help'] = 'Disable the module help link in page headers.'; $lang['help_page_wantschildren'] = 'Specifies whether this page accepts child pages. If disabled, no new page can be created as a child of this page, and you cannot re-order pages to set them as a child of this page.'; $lang['help_title_content_accesskey'] = 'Access key field'; $lang['help_title_content_active'] = 'Active toggle'; $lang['help_title_content_addteditor'] = 'Additional editors'; $lang['help_title_content_cachable'] = 'Cachable toggle'; +$lang['help_title_content_default'] = 'Default toggle'; $lang['help_title_content_extra1'] = 'Extra1 field'; $lang['help_title_content_extra2'] = 'Extra2 field'; $lang['help_title_content_extra3'] = 'Extra3 field'; @@ -989,7 +541,7 @@ $lang['help_title_content_showinmenu'] = 'Show in Menu toggle'; $lang['help_title_content_ta'] = 'Title Attribute field'; $lang['help_title_content_tabindex'] = 'Tab Index field'; -$lang['help_title_content_target'] = 'Target field'; +$lang['help_title_content_target'] = 'Target selector'; $lang['help_title_content_thumbnail'] = 'Thumbnail selector'; $lang['help_title_content_title'] = 'Page Title field'; $lang['help_title_editcontent_design'] = 'Design selector'; @@ -999,113 +551,122 @@ $lang['help_title_page_disablewysiwyg'] = 'WYSIWYG toggle'; $lang['help_title_page_searchable'] = 'Searchable toggle'; $lang['help_title_page_url'] = 'Page URL field'; -$lang['help_title_page_wantschildren'] = 'Page wants children'; -$lang['home'] = "Home"; -$lang['homepage'] = "Homepage"; -$lang['hostname'] = "Host name"; -$lang['hour'] = "hour"; -$lang['hours'] = "hours"; +$lang['help_title_page_wantschildren'] = 'Child pages allowed'; +$lang['home'] = 'Home'; +$lang['homepage'] = 'Homepage'; +$lang['hostname'] = 'Host name'; +$lang['hour'] = 'hour'; +$lang['hours'] = 'hours'; //$lang['htmlblobdescription'] = "Global Content Blocks are chunks of content you can place in your pages or templates."; //$lang['htmlblobs'] = "Global Content Blocks"; -$lang['h_udtcode'] = 'Enter your PHP code here. Keep in mind that a UDT (User Defined Tag) is in fact a Smarty function plugin. It has limited scope.
    +$lang['h_udtcode'] = 'Enter your PHP code here. Keep in mind that a UDT (User Defined Tag) is in fact a Smarty function plugin. It has limited scope.
    • Note: You have access to the full CMSMS API to interact with the system and with modules.
    • -
    • Tip: Parameters passed to the UDT i.e: {myudt param1=value1 param2=value2} are available via the $params associative array, which is in scope.
    • +
    • Tip: Parameters passed to the UDT e.g. {myudt param1=value1 param2=value2} are available via the $params associative array, which is in scope.
    • Tip: It is best to do calculations and processing and return the results to Smarty for formatting via the $smarty->assign() method. The Smarty object is also in scope.
    • Tip: It is best to keep UDTs short, with a single and small piece of functionality.
    '; -$lang['h_udtdesc'] = "This field allows you to enter details and notes about the UDT for future reference when debugging or transforming the tag. More details are better than less"; -$lang['h_udtname'] = "Enter a name for the user defined tag. Name should contain ASCII alphanumeric characters and digits and underscores. The name must not start with a digit"; +$lang['h_udtdesc'] = 'This field allows you to enter details and notes about the UDT for future reference when debugging or transforming the tag. More details are better than less'; +$lang['h_udtname'] = 'Enter a name for the user defined tag. The name may contain ASCII letters, digits and/or underscores. The name must not start with a digit.'; -## I -$lang['idnotvalid'] = "The given id is not valid"; -$lang['ignorenotificationsfrommodules'] = "Ignore notifications from these modules"; -$lang['illegalcharacters'] = "Invalid characters in field %s."; -$lang['image'] = "Image"; +// I +$lang['idnotvalid'] = 'The given id is not valid'; +$lang['ignorenotificationsfrommodules'] = 'Ignore notifications from these modules'; +$lang['illegalcharacters'] = 'Invalid characters in field %s.'; +$lang['image'] = 'Image'; //$lang['imagemanagement'] = "Image Management"; //$lang['imagemanager'] = "Image Manager"; //$lang['imagemanagerdescription'] = "Upload/edit and remove images."; -$lang['inactive'] = "Inactive"; -$lang['indent'] = "Indent Pagelist to Emphasize Hierarchy"; -$lang['informationmissing'] = "Information missing"; -$lang['info_adduser'] = "Add a administrative new user account"; -$lang['info_adduser_username'] = "The username field must consist of alphanumeric characters,, the dot (.), underscore, or space"; -$lang['info_autoalias'] = "If this field is empty, an alias will be created automatically."; -$lang['info_changegroupperms'] = "This page allows specifying which Admin user groups have which permission. Keep in mind that an individual Admin user can belong to multiple Admin groups.
    Note: the "Admin" group is a special group and is automatically granted all permissions."; -$lang['info_changeusergroup'] = "This page allows specifying the member groups for each Admin user. Group membership determines the permissions the user has, and therefore his capabilities in the Admin console.
    Note: the "Admin" group is a special group and is automatically granted all permissions."; -$lang['info_clearusersettings'] = "This will remove all user settings from the database, setting every preference back to defaults"; -$lang['info_copyusersettings'] = "Ensure that this users settings and preferences are identical to that of another existing user"; -$lang['info_default_contenttype'] = "Applicable when adding new content objects, this control specifies the type that is selected by default. Please ensure that the selected item is not one of the "disallowed types"."; -$lang['info_deletepages'] = "Note: due to permission restrictions, some of the pages you selected for deletion may not be listed below"; -$lang['info_edeprecated_failed'] = "If E_DEPRECATED is enabled in your error reporting users will see a lot of warning messages that could affect the display and functionality"; -$lang['info_editcontent_design'] = "Associating a design with a content page allows the rendering engine to output the proper stylesheets for the page"; -$lang['info_editcontent_template'] = "You must associate a template with each content page, and that template must have at least the default {content} block defined within it. The template does not need to be a page template type"; +$lang['inactive'] = 'Inactive'; +$lang['indent'] = 'Indent pageslist to emphasize hierarchy'; +$lang['informationmissing'] = 'Information missing'; +$lang['info_adduser'] = 'Add a administrative new user account'; +$lang['info_adduser_username'] = 'The username field may include only alphanumeric characters, period(.)s, underscores and/or spaces, and must be unique'; +$lang['info_autoalias'] = 'If this field is empty, an alias will be created automatically.'; +$lang['info_changegroupperms'] = 'This page allows specifying the permission(s) granted to admin-console user groups. Keep in mind that each user can belong to multiple groups.
    Note: the "Admin" group is special, its members are granted all permissions.'; +$lang['info_changeusergroup'] = 'This page allows specifying the user group(s) to which each admin-console user belongs. Group membership determines the permissions the user has, and therefore her/his capabilities in the admin console.
    Note: the "Admin" group is special, its members are granted all permissions.'; +$lang['info_clearusersettings'] = 'This will remove all user settings from the database, setting every preference back to defaults'; +$lang['info_copyusersettings'] = "Ensure that this user's settings and preferences are identical to those of another existing user"; +$lang['info_default_contenttype'] = 'Applicable when adding new content objects, this control specifies the type that is selected by default. Please ensure that the selected item is not one of the "disallowed types".'; +$lang['info_default_none'] = 'Currently there is no recorded default page'; +$lang['info_default_page'] = 'The default page currently is: %s (%s)'; +$lang['info_deletepages'] = 'Note: due to permission restrictions, some of the pages you selected for deletion may not be listed below'; +$lang['info_edeprecated_failed'] = 'If E_DEPRECATED is enabled in your error reporting users will see a lot of warning messages that could affect the display and functionality'; +$lang['info_editcontent_design'] = 'Associating a design with a content page allows the rendering engine to output the proper stylesheets for the page'; +$lang['info_editcontent_template'] = 'You must associate a template with each content page, and that template must have at least the default {content} block defined within it. The template does not need to be a page template type'; $lang['info_edituser_password'] = "Change this field to change the user's password"; $lang['info_edituser_passwordagain'] = "Change this field to change the user's password"; -$lang['info_estrict_failed'] = "Some libraries that CMSMS uses do not work well with E_STRICT. Please disable this before continuing"; -$lang['info_generate_cksum_file'] = "This function will allow you to generate a checksum file and save it on your local computer for later validation. This should be done just prior to rolling out the website, and/or after any upgrades, or major modifications."; -$lang['info_group_inactive'] = "This group is inactive. Members of this group will not realize the permissions associated with the group"; -$lang['info_mailtest'] = "This form will send a pre formatted email to the address you specify.
    If you do not receive the mail you may need to re-check your settings.
    Note: you may also want to check your spam folder."; -$lang['info_mail_notset'] = "Mail settings have not yet been saved. Please ensure the information in Site Admin >> Settings - Global Settings >> Mail Settings tab is correct for your server."; -$lang['info_membergroups'] = "A user may be a member of zero or more groups. A user who is not a member of any groups will still be able to login to the Admin console"; +$lang['info_estrict_failed'] = 'Some libraries that CMSMS uses do not work well with E_STRICT. Please disable this before continuing'; +$lang['info_generate_cksum_file'] = 'This function generates checksums and saves them in a file on your local computer for later use in validation. All website files except those in the uploads and tmp trees are processed. Checksums should be saved just prior to rolling out the website and/or after any upgrade or major modification.'; +$lang['info_group_inactive'] = 'This group is inactive. Members of this group will not realize the permissions associated with the group'; +$lang['info_mailtest'] = 'This form will send a pre formatted email to the address you specify.
    If you do not receive the mail you may need to re-check your settings.
    Note: you may also want to check your spam folder.'; +$lang['info_mail_notset'] = 'Mail settings have not yet been saved. Please ensure the information in Site Admin >> Settings - Global >> Mail tab is correct for your server.'; +$lang['info_membergroups'] = 'A user may be a member of zero or more groups. A user who is not a member of any group will still be able to log in to the Admin Console'; $lang['info_noalerts'] = 'There are no alerts at this time'; -$lang['info_noedituser'] = "Although this user account exists, your permissions do not permit you to manage that account"; -$lang['info_pagealias'] = "Specify a unique alias for this page."; -$lang['info_pagedefaults'] = "This form allows specifying various options as to the initial settings when creating new content pages. The items in this page have no effect when editing existing pages"; -$lang['info_preview_notice'] = "Warning: This preview panel behaves much like a browser window allowing you to navigate away from the initially previewed page. However, if you do that, you may experience unexpected behavior. If you navigate away from the initial display and return, you may not see the un-committed content until you make a change to the content in the main tab, and then reload this tab. When adding content, if you navigate away from this page, you will be unable to return, and must refresh this panel."; -$lang['info_selectuser'] = "Toggle selection to perform actions on multiple users at once"; -$lang['info_settings_sitedown'] = "These options allow you to toggle the website as "down for maintenance" for website visitor."; -//$lang['info_setusersettings'] = "Set this users settings to be a template for newly created users and to effect other users"; -$lang['info_sitedownexcludes'] = "This parameter allows listing a comma separated list of IP addresses or networks that should not be subject to the Site Down mechanism. This allows administrators to work on a site whilst anonymous visitors receive a Site Down message.

    Addresses can be specified in the following formats:
    -1. xxx.xxx.xxx.xxx -- (exact IP address)
    -2. xxx.xxx.xxx.[yyy-zzz] -- (IP address range)
    -3. xxx.xxx.xxx.xxx/nn -- (nnn = number of bits, cisco style. i.e: 192.168.0.100/24 = entire 192.168.0 class C subnet)"; -$lang['info_smarty_cachemodules'] = "Select how to cache tags in various templates that call module actions. If enabled, all module calls will be cached. This may have negative effects on some modules, or modules with forms. (note: you can override this using the nocache option as described in the Smarty manual). If disabled no module calls will be cached which may have an effect on performance. If you select to allow the module to decide, the default is that caching is not performed. The module can override this, and you can disable caching using the nocache parameter when calling the module."; -$lang['info_smarty_cacheudt'] = "If enabled, all calls to user defined tags will be cached. This will be useful for tags that display the output of database queries. You can disable caching using the nocache parameter in the UDT call. i.e: {myusertag nocache}"; -$lang['info_smarty_options'] = "The following options have effect only when the above caching options are enabled"; -$lang['info_target'] = "This option may used by the Menu Manager to indicate when and how new frames or windows should be opened. Some menu manager templates may ignore this option."; -$lang['info_templateuser'] = "This account is the template user account. New users will be created using this accounts settings"; -$lang['info_this_templateuser'] = "This account is set as the template user. New accounts will inherit this users settings, and you can copy this users settings to any user account"; -$lang['info_user_active'] = "Toggle this checkbox off to preserve the user information, but prevent the user from logging in to the Admin console"; -$lang['info_user_active2'] = "Toggle this flag to preserve the user information, but prevent the user from logging in to the Admin console"; -$lang['info_user_switch'] = "Test as this user"; -$lang['info_validation'] = "This function will compare the checksums found in the uploaded file with the files on the current installation. It can assist in finding problems with uploads, or exactly what files were modified if your system has been hacked."; -$lang['info_wait'] = "Wait a few minutes before proceeding."; -$lang['insecure'] = "Insecure (HTTP)"; +$lang['info_noedituser'] = 'Although this user account exists, your permissions do not permit you to manage that account'; +$lang['info_no_jobs'] = 'No job is waiting to be processed'; +$lang['info_pagealias'] = 'Specify a unique alias for this page.'; +$lang['info_pagedefaults'] = 'This form allows specifying various options as to the initial settings when creating new content pages. The items in this page have no effect when editing existing pages'; +$lang['info_preview_notice'] = 'Warning: This preview panel behaves much like a browser window allowing you to navigate away from the initially previewed page. However, if you do that, you may experience unexpected behavior. If you navigate away from the initial display and return, you may not see the un-committed content until you make a change to the content in the main tab, and then reload this tab. When adding content, if you navigate away from this page, you will be unable to return, and must refresh this panel.'; +$lang['info_selectuser'] = 'Toggle selection to perform actions on multiple users at once'; +$lang['info_settings_sitedown'] = 'These options allow you to toggle the website as "down for maintenance" for website visitors.'; +//$lang['info_setusersettings'] = "Set this user's settings to be a template for newly created users and to affect other users"; +$lang['info_sitedownexcludes'] = 'This parameter allows listing a comma separated list of IP addresses or networks that should not be subject to the Site Down mechanism. This allows administrators to work on a site whilst anonymous visitors receive a Site Down message.

    Addresses can be specified in the following formats:
    +1. xxx.xxx.xxx.xxx -- (exact IP address)
    +2. xxx.xxx.xxx.[yyy-zzz] -- (IP address range)
    +3. xxx.xxx.xxx.xxx/nn -- (nnn = number of bits, cisco style e.g. 192.168.0.100/24 = entire 192.168.0 class C subnet)'; +$lang['info_smarty_cachemodules'] = 'Select how to cache tags in various templates that call module actions. If enabled, all module calls will be cached. This may have negative effects on some modules, or modules with forms. (note: you can override this using the nocache option as described in the Smarty manual). If disabled no module calls will be cached which may have an effect on performance. If you select to allow the module to decide, the default is that caching is not performed. The module can override this, and you can disable caching using the nocache parameter when calling the module.'; +$lang['info_smarty_cacheudt'] = 'If enabled, all calls to user defined tags will be cached. This will be useful for tags that display the output of database queries. You can disable caching using the nocache parameter in the UDT call e.g. {myusertag nocache}'; +$lang['info_smarty_options'] = 'The following options have effect only when the above caching options are enabled'; +$lang['info_target'] = 'This option may used by the Menu Manager to indicate when and how new frames or windows should be opened. Some menu manager templates may ignore this option.'; +//$lang['info_templateuser'] = "This account is the template user account. New users will be created using this account's settings"; +//$lang['info_this_templateuser'] = "This account is set as the template user. New accounts will inherit this user's settings, and you can copy this user's settings to any user account"; +$lang['info_user_active'] = 'Toggle this checkbox off to preserve the user information, but prevent the user from logging in to the Admin Console'; +$lang['info_user_active2'] = 'Toggle this flag to preserve the user information, but prevent the user from logging in to the Admin Console'; +$lang['info_user_switch'] = 'Test as this user'; +$lang['info_validation'] = "This function will compare the checksums in the uploaded file with the files in the current installation, and report differences. Files that don't match might be a problem. Extra installed files will be ignored."; +$lang['info_wait'] = 'Wait a few minutes before proceeding.'; +$lang['insecure'] = 'Insecure (HTTP)'; //$lang['install'] = "Install"; $lang['installfileexists'] = 'Warning: The installation assistant file: %s still exists in the root directory. As this could potentially be a security vulnerability, please delete it.'; -$lang['installed'] = "Installed"; +$lang['installed'] = 'Installed'; //$lang['installed_mod'] = "Installed version %s"; -$lang['installed_modules'] = "Installed Modules"; -$lang['invalid'] = "Invalid"; -$lang['invalidalias'] = "The alias entered contains invalid characters. White space, / . and other punctuation characters are not permitted."; -$lang['invalidalias2'] = "The alias entered contains invalid characters. Numeric values, White space, / . or other punctuation characters are not permitted."; -$lang['invalidcode'] = "Invalid code entered."; -$lang['invalidcode_brace_missing'] = "Uneven amount of braces"; -$lang['invalidemail'] = "The email address entered is invalid"; -$lang['invalidparent'] = "You must select a parent page (contact your administrator if you do not see this option)."; +$lang['installed_modules'] = 'Installed modules'; +$lang['invalid'] = 'Invalid'; +//$lang['invalidalias'] = "The alias entered contains invalid characters. White space, '/', '.' and other punctuation characters are not permitted."; +$lang['invalidalias2'] = "The alias entered contains invalid characters. Numeric values, white space, '/', '.' or other punctuation characters are not permitted."; +$lang['invalidcode'] = 'Invalid code entered.'; +$lang['invalidcode_brace_missing'] = 'Uneven amount of braces'; +$lang['invalidemail'] = 'The email address entered is invalid'; +$lang['invalidparent'] = 'You must select a parent page (contact your administrator if you do not see this option).'; //$lang['invalidtemplate'] = "The template is not valid"; -$lang['invalid_test'] = "Invalid test parameter value!"; -$lang['ip_addr'] = "IP Address"; -$lang['itemid'] = "Item ID"; -$lang['itemname'] = "Item Name"; -$lang['item_name_contains'] = 'Item Name Contains'; -$lang['itsbeensincelogin'] = "It has been %s since you last logged in"; +$lang['invalid_test'] = 'Invalid test parameter value!'; +$lang['ip_addr'] = 'IP Address'; +$lang['itemid'] = 'Item ID'; +$lang['itemname'] = 'Item Name'; +$lang['item_name_contains'] = 'Item name contains'; +$lang['itsbeensincelogin'] = 'It has been %s since you last logged in'; -## J -$lang['jsdisabled'] = "Sorry, this function requires that you have JavaScript enabled."; -$lang['json_function'] = "JSON functions"; +// J +$lang['jobs'] = 'Jobs'; +$lang['jobs_configure'] = 'Jobs Configuation'; +$lang['jobs_list'] = 'Jobs List'; +$lang['jobscount'] = '%s job(s) waiting for execution'; +$lang['jobsmenu'] = 'Background Jobs'; // see also 'sysmaintab_jobs' +$lang['jobsmenudescription'] = 'Display recorded jobs and their status'; +$lang['jsdisabled'] = 'Sorry, this function requires that you have JavaScript enabled.'; +$lang['json_function'] = 'JSON functions'; -## L +// L //$lang['langparam'] = "Parameter is used to specify what language to use for display on the frontend. Not all modules support or need this."; -$lang['language'] = "Language"; -$lang['lang_settings_legend'] = "Language related settings"; -$lang['last'] = "Last"; -$lang['lastname'] = "Last Name"; -$lang['last_modified_at'] = "Last modified at"; -$lang['last_modified_by'] = "Last modified by"; -$lang['layout'] = "Layout"; -$lang['layoutdescription'] = "Site layout options."; +$lang['language'] = 'Language'; +$lang['lang_settings_legend'] = 'Language related settings'; +$lang['last'] = 'Last'; +$lang['lastname'] = 'Last Name'; +$lang['last_modified_at'] = 'Last modified at'; +$lang['last_modified_by'] = 'Last modified by'; +$lang['layout'] = 'Layout'; +$lang['layoutdescription'] = 'Site layout options.'; //$lang['lctitle_active'] = "Indicates whether the content item is active. Inactive items cannot be displayed."; //$lang['lctitle_alias'] = "The alias of existing content items. Some content items do not have aliases"; //$lang['lctitle_default'] = "Specify the content item that is accessed when the root URL is requested. Only one item can be default"; @@ -1115,7 +676,7 @@ //$lang['lctitle_page'] = "The title of existing content items"; //$lang['lctitle_template'] = "The selected template for the content item. Some content items do not have templates"; //$lang['lctitle_url'] = "The URL suffix for the content item. If set"; -$lang['lines_in_error'] = "%d lines with errors"; +$lang['lines_in_error'] = '%d lines with errors'; //$lang['listcontent_settings'] = "Content List Settings"; //$lang['listcontent_showalias'] = "Display the "Alias" column"; //$lang['listcontent_showtitle'] = "Display the Page Title or Menu Text"; @@ -1124,235 +685,241 @@ //$lang['liststylesheets'] = "Stylesheets"; //$lang['liststylesheets_pagelimit'] = "Number of rows per page when viewing stylesheets"; //$lang['listtemplates_pagelimit'] = "Number of rows per page when viewing templates"; -$lang['lock_refresh'] = "Locking Refresh"; -$lang['lock_timeout'] = "Locking Time-out"; -$lang['loginprompt'] = "Enter a valid user credential to get access to the Admin Console."; -$lang['logintitle'] = "Login to CMS Made Simple™"; -$lang['login_failed'] = "User Login Failed"; -$lang['login_info'] = "For the Admin console to work properly"; -$lang['login_info_params'] = "
      +$lang['lock_refresh'] = 'Locking Refresh'; +$lang['lock_timeout'] = 'Locking Time-out'; +$lang['logged'] = 'Logged'; +$lang['loginprompt'] = 'Enter a valid user credential to get access to the Admin Console.'; +$lang['logintitle'] = 'Log in to the %s website Administration Console'; +$lang['login_failed'] = 'User Login Failed'; +$lang['login_info'] = 'For the Admin Console to work properly'; +$lang['login_info_params'] = '
        +
      1. PHP sessions must be enabled
      2. Cookies must be enabled in your browser
      3. Javascript must be enabled in your browser
      4. Popup windows must be allowed for the following address:
      5. -
      "; -$lang['login_info_title'] = "Information"; -$lang['logout'] = "Logout"; -$lang['lostpw'] = "Forgot your password?"; +
    '; +$lang['login_info_title'] = 'Information'; +$lang['logout'] = 'Logout'; +$lang['lostpw'] = 'Forgot your password?'; $lang['lostpwemail'] = '

    Hello

    This email was sent to you because a request has been made to recover the \'%s\' website admin-console password for user account \'%s\'. If you would like to reset the password for that account, click on the link below or paste it into the URL field of your favorite browser:

    %s

    Or if this is incorrect, ignore this email and nothing will change.

    '; -$lang['lostpwemailsubject'] = "[%s] Password Recovery"; +$lang['lostpwemailsubject'] = '[%s] Password Recovery'; -## M -$lang['magic_quotes_gpc'] = "Magic quotes for Get/Post/Cookie"; -$lang['magic_quotes_gpc_on'] = "Single-quote, double quote and backslash are escaped automatically. You can experience problems when saving templates"; -$lang['magic_quotes_runtime'] = "Magic quotes in runtime"; -$lang['magic_quotes_runtime_on'] = "Most functions that return data will have quotes escaped with a backslash. You can experience problems"; -$lang['mail_settings'] = "Mail Settings"; -$lang['mail_testbody'] = "

    Greetings

    You are receiving this message from an installation of CMS Made Simple. This message is proving the validity of the settings used for sending email messages. If you are reading this message, then everything appears to be working fine. However, if you did not solicit this email from a CMS Made Simple Admin console, please contact the website administrator.

    "; -$lang['mail_testsubject'] = "CMSMS Mail Test message"; -$lang['main'] = "Main"; -$lang['mainmenu'] = "Main Menu"; -$lang['maintenance_warning'] = "Website is still in maintenance mode! Are you sure you want to logout now?"; -$lang['managebookmarks'] = "Manage Shortcuts"; -$lang['managebookmarksdescription'] = "This is where you can manage your administration shortcuts."; -$lang['master_admintheme'] = "Default Administration Theme (for the login page and new user accounts)"; -$lang['maximumversion'] = "Maximum Version"; -$lang['maximumversionsupported'] = "Maximum CMSMS Version Supported"; -$lang['max_execution_time'] = "Maximum Execution Time"; -$lang['md5_function'] = "md5 function"; +// M +$lang['magic_quotes_gpc'] = 'Magic quotes for Get/Post/Cookie'; +$lang['magic_quotes_gpc_on'] = 'Single-quote, double quote and backslash are escaped automatically. You can experience problems when saving templates'; +$lang['magic_quotes_runtime'] = 'Magic quotes in runtime'; +$lang['magic_quotes_runtime_on'] = 'Most functions that return data will have quotes escaped with a backslash. You can experience problems'; +$lang['mail_settings'] = 'Mail'; +$lang['mail_testbody'] = '

    Greetings

    You are receiving this message from an installation of CMS Made Simple. This message is proving the validity of the settings used for sending email messages. If you are reading this message, then everything appears to be working fine. However, if you did not solicit this email from a CMS Made Simple Admin Console, please contact the website administrator.

    '; +$lang['mail_testsubject'] = 'CMSMS Mail Test message'; +$lang['main'] = 'Main'; +$lang['mainmenu'] = 'Main Menu'; +$lang['maintenance_warning'] = 'Website is still in maintenance mode! Are you sure you want to log out now?'; +$lang['managebookmarks'] = 'My Bookmarks'; +$lang['managebookmarksdescription'] = 'This is where you can manage your website-page shortcuts.'; +$lang['master_admintheme'] = 'Default Administration Theme'; +$lang['maximumversion'] = 'Maximum Version'; +$lang['maximumversionsupported'] = 'Maximum CMSMS Version Supported'; +$lang['max_execution_time'] = 'Maximum Execution Time'; +$lang['md5_function'] = 'md5 function'; /* $lang['mediatype'] = "Media Type"; $lang['mediatype_'] = "None set : will affect everywhere "; $lang['mediatype_all'] = "all : Suitable for all devices."; -$lang['mediatype_aural'] = "aural : Intended for speech synthesizers."; -$lang['mediatype_braille'] = "braille : Intended for Braille tactile feedback devices."; -$lang['mediatype_embossed'] = "embossed : Intended for paged Braille printers."; -$lang['mediatype_handheld'] = "handheld : Intended for handheld devices"; +$lang['mediatype_aural'] = "aural : Intended for speech synthesizers."; //deprecated type +$lang['mediatype_braille'] = "braille : Intended for Braille tactile feedback devices."; //deprecated type +$lang['mediatype_embossed'] = "embossed : Intended for paged Braille printers."; //deprecated type +$lang['mediatype_handheld'] = "handheld : Intended for handheld devices"; //deprecated type $lang['mediatype_print'] = "print : Intended for paged, opaque material and for documents viewed on screen in print preview mode."; -$lang['mediatype_projection'] = "projection : Intended for projected presentations, for example projectors or print to transparencies."; +$lang['mediatype_projection'] = "projection : Intended for projected presentations, for example projectors or print to transparencies."; //deprecated type $lang['mediatype_screen'] = "screen : Intended primarily for color computer screens."; -$lang['mediatype_speech'] = "speech : Intended for speech synthesizers."; -$lang['mediatype_tty'] = "tty : Intended for media using a fixed-pitch character grid, such as Teletypes and terminals."; -$lang['mediatype_tv'] = "tv : Intended for television-type devices."; +$lang['mediatype_speech'] = "speech : Intended for speech synthesizers."; //maybe deprecated type +$lang['mediatype_tty'] = "tty : Intended for media using a fixed-pitch character grid, such as Teletypes and terminals."; //deprecated type +$lang['mediatype_tv'] = "tv : Intended for television-type devices."; //deprecated type $lang['media_query'] = "Media Query"; -$lang['media_query_description'] = "Notice: When Media Query is used, Media Type selection will be ignored.
    Use any valid expression as recommended by W3C."; +$lang['media_query_description'] = "Notice: When Media Query is used, Media Type selection will be ignored.
    Use any valid expression as recommended by W3C."; */ -$lang['memory_limit'] = "PHP Effective Memory Limit"; -$lang['menutext'] = "Menu Text"; -$lang['menu_bookmarks'] = "[+]"; -$lang['metadata'] = "Metadata"; -$lang['minimumversion'] = "Minimum Version"; -$lang['minimumversionrequired'] = "Minimum CMSMS Version Required"; -$lang['minute'] = "minute"; -$lang['minutes'] = "minutes"; -$lang['missingdependency'] = "Missing Dependency"; -$lang['missingparams'] = "Some parameters were missing or invalid"; -$lang['modifygroupassignments'] = "Modify Group Assignments"; -$lang['module'] = "Module"; -$lang['moduleabout'] = "About the %s module"; -$lang['moduledecides'] = "Module Decides"; -$lang['moduledescription'] = "Modules extend CMS Made Simple™ to provide all kinds of custom functionality."; -$lang['moduleerrormessage'] = "Error Message for %s Module"; -$lang['modulehelp'] = "Help for the %s module"; -$lang['modulehelp_english'] = "View In English"; -$lang['modulehelp_yourlang'] = "View in Your Language"; -$lang['moduleinstalled'] = "Module already installed"; -$lang['moduleinstallmessage'] = "Install Message for %s Module"; -$lang['moduleinterface'] = "%s Interface"; -$lang['modules'] = "Modules"; -$lang['modulesnotwritable'] = "The modules folder (and/or the uploads folder) is not writeable, if you would like to install modules by uploading an XML file you need ensure that these folders have full read/write/execute permissions (chmod 777). Safe mode may also be in effect."; -$lang['moduleuninstallmessage'] = "Uninstall Message for %s Module"; -$lang['moduleupgraded'] = "Upgrade Successful"; -$lang['moduleupgradeerror'] = "There was an error upgrading the module."; -$lang['module_help'] = "Module Help"; -$lang['module_name'] = "Module Name"; -$lang['module_param_lang'] = "Deprecated - Override the current language that is used for selecting translated strings."; -$lang['move'] = "Move"; -$lang['movecontent'] = "Move Pages"; -$lang['msg_userdeleted'] = 'Selected user account successfully deleted.'; +$lang['memory_limit'] = 'PHP Effective Memory Limit'; +$lang['menutext'] = 'Menu Text'; +$lang['menu_bookmarks'] = '[+]'; +$lang['metadata'] = 'Metadata'; +$lang['minimumversion'] = 'Minimum Version'; +$lang['minimumversionrequired'] = 'Minimum CMSMS Version Required'; +$lang['minute'] = 'minute'; +$lang['minutes'] = 'minutes'; +$lang['missingdependency'] = 'Missing Dependency'; +$lang['missingparams'] = 'Some parameters were missing or invalid'; +$lang['modifygroupassignments'] = 'Modify Group Assignments'; +$lang['module'] = 'Module'; +$lang['moduleabout'] = 'About the %s module'; +$lang['moduledecides'] = 'Module Decides'; +$lang['moduledescription'] = 'Modules extend CMS Made Simple™ to provide all kinds of custom functionality.'; +$lang['moduleerrormessage'] = 'Error Message for %s Module'; +$lang['modulehelp'] = 'Help for the %s module'; +$lang['modulehelp_english'] = 'View In English'; +$lang['modulehelp_yourlang'] = 'View in Your Language'; +$lang['moduleinstalled'] = 'Module already installed'; +$lang['moduleinstallmessage'] = 'Install Message for %s Module'; +$lang['moduleinterface'] = '%s Interface'; +$lang['modules'] = 'Modules'; +$lang['modulesnotwritable'] = 'The modules folder (and/or the uploads folder) is not writeable, if you would like to install modules by uploading an XML file you need ensure that these folders have full read/write/execute permissions (chmod 777). Safe mode may also be in effect.'; +$lang['moduleuninstallmessage'] = 'Uninstall Message for %s Module'; +$lang['moduleupgraded'] = 'Upgrade successful'; +$lang['moduleupgradeerror'] = 'There was an error upgrading the module.'; +$lang['module_help'] = 'Module Help'; +$lang['module_name'] = 'Module Name'; +$lang['module_param_lang'] = 'Deprecated - Override the current language that is used for selecting translated strings.'; +$lang['move'] = 'Move'; +$lang['movecontent'] = 'Move Pages'; +$lang['msg_completed'] = 'Operation completed'; //$lang['msg_defaultcontent'] = "Add code here that should appear as the default content of all new pages"; //$lang['msg_defaultmetadata'] = "Add code here that should appear in the metadata section of all new pages"; -$lang['msg_grantall_found'] = "Found a "GRANT ALL" statement that appears to be suitable"; -$lang['msg_mailprefs_set'] = "Email settings saved"; -$lang['msg_notimedifference2'] = "No time difference found"; -$lang['msg_permstab'] = "Authorized administrators, or page owners can adjust the ownership and additional editors of a content page"; -$lang['msg_settemplateuser'] = "Template user account set"; -$lang['msg_usersdeleted'] = "%d users were deleted"; -$lang['msg_usersedited'] = "%d users were modified"; -$lang['msg_usersettingscleared'] = "User settings cleared"; -$lang['msg_usersettingscopied'] = "User settings copied from template user account"; -$lang['myaccount'] = "My Account"; -$lang['myaccountdescription'] = "This is where you can update your personal account details."; -$lang['myprefs'] = "My Preferences"; -$lang['myprefsdescription'] = "This is where you can customize the site Admin area to work the way you want."; +$lang['msg_grantall_found'] = 'Found a "GRANT ALL" statement that appears to be suitable'; +$lang['msg_mailprefs_set'] = 'Email settings saved'; +$lang['msg_notimedifference2'] = 'No time difference found'; +$lang['msg_permstab'] = 'Authorized administrators and the page owner can adjust the ownership and additional editors of a content page'; +//$lang['msg_settemplateuser'] = "Template user account set"; +$lang['msg_userdeleted'] = 'Selected user account successfully deleted.'; +$lang['msg_usersdeleted'] = '%d users were deleted'; +$lang['msg_usersedited'] = '%d users were modified'; +$lang['msg_usersettingscleared'] = 'User settings cleared'; +//$lang['msg_usersettingscopied'] = "User settings copied from template user account"; +$lang['myaccount'] = 'My Account'; +$lang['myaccountdescription'] = 'This is where you can update your personal account details.'; +$lang['myprefs'] = 'My Preferences'; +$lang['myprefsdescription'] = 'This is where you can customize the site Admin Console to work the way you want.'; -## N -$lang['name'] = "Name"; +// N +$lang['n_a'] = 'N/A'; // abbreviated Not Applicable +$lang['name'] = 'Name'; $lang['needpermissionto'] = "You need the '%s' permission to perform that function."; //$lang['needupgrade'] = "Needs Upgrade"; -$lang['never'] = "Never"; +$lang['never'] = 'Never'; +$lang['new_version_avail2'] = 'Notice: You are currently running CMSMS version %s. Version %s is available. Please upgrade soon.'; +$lang['new_version_avail_title'] = 'Your CMSMS version is out of date'; +$lang['new_window'] = 'new window'; //$lang['newstylesheetname'] = "New Stylesheet Name"; //$lang['newtemplatename'] = "New Template Name"; -$lang['new_version_avail_title'] = 'Your CMSMS version is out of date'; -$lang['new_version_avail2'] = 'Notice: You are currently running CMSMS version %s. Version %s is available. Please upgrade soon.'; -$lang['new_window'] = "new window"; -$lang['next'] = "Next"; -$lang['no'] = "No"; -$lang['noaccessto'] = "No Access to %s"; +$lang['next'] = 'Next'; +$lang['no'] = 'No'; +$lang['no_bulk_performed'] = 'No bulk operation performed.'; +$lang['no_file_url'] = 'None (Use URL Above)'; +$lang['no_files_scanned'] = 'No file was scanned during the verification process (maybe the file is invalid)'; +//$lang['no_orders_changed'] = "You chose to reorder pages, but you did not change the order of any of them. Pages were not reordered."; +$lang['no_permission'] = 'You are not permitted to perform that function.'; +$lang['no_shortcuts'] = 'No bookmark defined yet. You can add them by clicking the link above.'; +$lang['noaccessto'] = 'No Access to %s'; //$lang['nocss'] = "No Stylesheet"; -$lang['nodefault'] = "No Default Selected"; -$lang['noentries'] = "No Entries"; -$lang['nofieldgiven'] = "No %s given!"; -$lang['nofiles'] = "No Files"; +$lang['nodefault'] = 'No Default Selected'; +$lang['noentries'] = 'No Entries'; +$lang['noerrorsinjobs'] = 'No error detected'; +$lang['nofieldgiven'] = 'No %s given!'; +$lang['nofiles'] = 'No Files'; //$lang['nogcbwysiwyg'] = "Disallow WYSIWYG editors on global content blocks"; -$lang['noncachable'] = "Non Cachable"; -$lang['none'] = "None"; -$lang['nopaging'] = "Show All Items"; -$lang['nopasswordforrecovery'] = "No email address set for this user. Password recovery is not possible. Please contact your administrator."; -$lang['nopasswordmatch'] = "Passwords do not match"; -$lang['nopluginabout'] = "No about information available for this plugin"; -$lang['nopluginhelp'] = "No help available for this plugin"; -$lang['norealdirectory'] = "No real directory given"; -$lang['norealfile'] = "No real file given"; -$lang['notifications'] = "Notifications"; -$lang['notifications_to_handle2'] = "You have %d unhandled notification(s)"; -$lang['notinstalled'] = "Not installed"; -$lang['notspecified'] = "Not specified / Empty"; -$lang['noudtcode'] = "No code specified for the User Defined Tag"; -//$lang['noxmlfileuploaded'] = "No file was uploaded. To install a module via XML you must choose and upload an module .xml file from your computer."; -$lang['no_bulk_performed'] = "No bulk operation performed."; -$lang['no_files_scanned'] = "No files were scanned during the verification process (maybe the file is invalid)"; -$lang['no_file_url'] = "None (Use URL Above)"; -//$lang['no_orders_changed'] = "You chose to reorder pages, but you did not change the order of any of them. Pages were not reordered."; -$lang['no_permission'] = "You have not permission to perform that function."; -$lang['no_shortcuts'] = "No shortcuts defined yet. You can add them by clicking the button below."; -$lang['n_a'] = "N/A"; +$lang['noncachable'] = 'Non Cachable'; +$lang['none'] = 'None'; +$lang['nopaging'] = 'Show All Items'; +$lang['nopasswordforrecovery'] = 'No email address set for this user. Password recovery is not possible. Please contact your administrator.'; +$lang['nopasswordmatch'] = 'Passwords do not match'; +$lang['nopluginabout'] = 'No about information available for this plugin'; +$lang['nopluginhelp'] = 'No help available for this plugin'; +$lang['norealdirectory'] = 'No real directory given'; +$lang['norealfile'] = 'No real file given'; +$lang['notices_timeout'] = 'Maximum Duration of Admin Console Popup Notifications (seconds)'; +$lang['notices_timeout_short'] = 'Notifications Duration'; // popup help title +$lang['notifications'] = 'Notifications'; +$lang['notifications_to_handle2'] = 'You have %d unhandled notification(s)'; +$lang['notinstalled'] = 'Not installed'; +$lang['notreachable_url'] = 'The URL is not accessible from here'; +$lang['notspecified'] = 'Not specified / Empty'; +$lang['noudtcode'] = 'No code specified for the User Defined Tag'; +$lang['nouse'] = 'not directly usable'; +//$lang['noxmlfileuploaded'] = "No file was uploaded. To install a module via XML you must choose and upload a module .xml file from your computer."; -## O -$lang['of'] = "of"; -$lang['off'] = "Off"; -$lang['ok'] = "Ok"; -$lang['on'] = "On"; -$lang['open'] = "Open"; -$lang['open_basedir'] = "PHP Open Basedir"; -$lang['open_basedir_active'] = "No check because open basedir active"; -$lang['options'] = "Options"; -$lang['order'] = "Order"; -$lang['order_too_large'] = "A page order cannot be larger than the number of pages in that level. Pages were not reordered."; -$lang['order_too_small'] = "A page order cannot be zero. Pages were not reordered."; -$lang['originator'] = "Originator"; -$lang['os_session_save_path'] = "No check because OS path"; -$lang['other'] = "Other"; -$lang['output'] = "Output"; -$lang['output_buffering'] = "PHP output_buffering"; +// O +$lang['of'] = 'of'; +$lang['off'] = 'Off'; +$lang['ok'] = 'Ok'; +$lang['on'] = 'On'; +$lang['open'] = 'Open'; +$lang['open_basedir'] = 'PHP Open Basedir'; +$lang['open_basedir_active'] = 'No check because open basedir active'; +$lang['options'] = 'Options'; +$lang['order'] = 'Order'; +$lang['order_too_large'] = 'A page order cannot be larger than the number of pages in that level. Pages were not reordered.'; +$lang['order_too_small'] = 'A page order cannot be zero. Pages were not reordered.'; +$lang['originator'] = 'Originator'; +$lang['os_session_save_path'] = 'No check because OS path'; +$lang['other'] = 'Other'; +$lang['output'] = 'Output'; +$lang['output_buffering'] = 'PHP output_buffering'; //$lang['overwritemodule'] = "Overwrite existing modules"; -$lang['owner'] = "Owner"; +$lang['owner'] = 'Owner'; -## P -$lang['page'] = "Page"; -$lang['pagealias'] = "Page Alias"; -$lang['pagedata'] = "Smarty data or logic that is specific to this page"; -$lang['pagedata_codeblock'] = "Smarty data or logic that is specific to this page"; -$lang['pagedefaults'] = "Page Defaults"; -$lang['pagedefaultsdescription'] = "Set default values for new pages"; -$lang['pagedefaultsupdated'] = "Page default settings updated"; -$lang['pagelink_circular'] = "A page link cannot list another page link as its destination"; -$lang['pagemetadata'] = "Page Specific Metadata"; -$lang['pages'] = "Pages"; -$lang['pagesdescription'] = "This is where we add and edit pages and other content."; -$lang['pages_reordered'] = "Pages were successfully reordered"; -$lang['page_metadata'] = "Page Specific Metadata"; -$lang['page_reordered'] = "Page was successfully reordered."; -$lang['page_url'] = "Page URL"; -$lang['parameters'] = "Parameters"; -$lang['parent'] = "Parent"; -$lang['password'] = "Password"; -$lang['passwordagain'] = "Password (again)"; -$lang['passwordchange'] = "Please, provide the new password"; -$lang['passwordchangedlogin'] = "Password changed. Please log in using the new credentials."; -$lang['performance_information'] = "Performance and Tuning Information (recommended settings, but not required)"; -$lang['perform_validation'] = "Perform Validation"; -$lang['period_ago'] = "ago"; -$lang['period_day'] = "day"; -$lang['period_days'] = "days"; -$lang['period_decade'] = "decade"; -$lang['period_decades'] = "decades"; -$lang['period_fmt'] = "%d %s %s"; -$lang['period_fromnow'] = "from now"; -$lang['period_hour'] = "hour"; -$lang['period_hours'] = "hours"; -$lang['period_min'] = "minute"; -$lang['period_mins'] = "minutes"; -$lang['period_month'] = "month"; -$lang['period_months'] = "months"; -$lang['period_sec'] = "second"; -$lang['period_secs'] = "seconds"; -$lang['period_week'] = "week"; -$lang['period_weeks'] = "weeks"; -$lang['period_year'] = "year"; -$lang['period_years'] = "years"; -$lang['permission'] = "Permission"; -$lang['permissions'] = "Permissions"; -$lang['permissionschanged'] = "Permissions have been updated."; -$lang['permission_information'] = "Permission Information"; +// P +$lang['page'] = 'Page'; +$lang['pagealias'] = 'Page Alias'; +$lang['pagedata'] = 'Smarty data or logic that is specific to this page'; +$lang['pagedata_codeblock'] = 'Smarty data or logic that is specific to this page'; +$lang['pagedefaults'] = 'Page Defaults'; +$lang['pagedefaultsdescription'] = 'Set default values for new pages'; +$lang['pagedefaultsupdated'] = 'Page default settings updated'; +$lang['pagelink_circular'] = 'A page link cannot list another page link as its destination'; +$lang['pagemetadata'] = 'Page Specific Metadata'; +$lang['pages'] = 'Pages'; +$lang['pagesdescription'] = 'This is where users can add and edit pages and other website content.'; +$lang['pages_reordered'] = 'Pages were successfully reordered'; +$lang['page_metadata'] = 'Page Specific Metadata'; +$lang['page_reordered'] = 'Page was successfully reordered.'; +$lang['page_url'] = 'Page URL'; +$lang['parameters'] = 'Parameters'; +$lang['parent'] = 'Parent'; +$lang['password'] = 'Password'; +$lang['passwordagain'] = 'Password (again)'; +$lang['passwordchange'] = 'Please, provide the new password'; +$lang['passwordchangedlogin'] = 'Password changed. Please log in using the new credentials.'; +$lang['performance_information'] = 'Performance and Tuning Information (recommended settings, but not required)'; +$lang['perform_validation'] = 'Perform validation'; // legend +$lang['period_ago'] = 'ago'; +$lang['period_day'] = 'day'; +$lang['period_days'] = 'days'; +$lang['period_decade'] = 'decade'; +$lang['period_decades'] = 'decades'; +$lang['period_fmt'] = '%d %s %s'; +$lang['period_fromnow'] = 'from now'; +$lang['period_hour'] = 'hour'; +$lang['period_hours'] = 'hours'; +$lang['period_min'] = 'minute'; +$lang['period_mins'] = 'minutes'; +$lang['period_month'] = 'month'; +$lang['period_months'] = 'months'; +$lang['period_now'] = 'now'; +$lang['period_sec'] = 'second'; +$lang['period_secs'] = 'seconds'; +$lang['period_week'] = 'week'; +$lang['period_weeks'] = 'weeks'; +$lang['period_year'] = 'year'; +$lang['period_years'] = 'years'; +$lang['permission'] = 'Permission'; +$lang['permissions'] = 'Permissions'; //see also 'zz_4perms_tab__' +$lang['permissionschanged'] = 'Permissions have been updated.'; +$lang['permission_information'] = 'Permission Information'; $lang['perm_Add_Pages'] = 'Add Pages'; $lang['perm_Add_Templates'] = 'Add Templates'; -$lang['perm_Advanced_usage_of_the_File_Manager_module'] = 'Advanced usage of the File Manager module'; -$lang['perm_Approve_News_For_Frontend_Display'] = 'Approve News for Frontend Display'; // should go in News -$lang['perm_Clear_Admin_Log'] = 'Clear Admin Log'; -$lang['perm_Delete_News_Articles'] = 'Delete News Articles'; // should go in News +//$lang['perm_Advanced_usage_of_the_File_Manager_module'] = 'Advanced usage of the File Manager module'; //already in FileManager +$lang['perm_Clear_Admin_Log'] = 'Clear Admin Log'; // see also 'clearadminlog' $lang['perm_Manage_All_Content'] = 'Manage All Content'; $lang['permdesc_Manage_All_Content'] = 'A user with this permission can perform all tasks on any and all content pages'; -$lang['perm_Manage_Designs'] = 'Manage Designs'; +//$lang['perm_Manage_Designs'] = 'Manage Designs'; //TODO if actually needed, migrate to DesignManager $lang['perm_Manage_Groups'] = 'Manage Groups'; -$lang['perm_Manage_Jobs'] = 'Manage Asynchronous Jobs'; // should be in CmsJobManager +$lang['perm_Manage_Jobs'] = 'Manage Asynchronous Jobs'; $lang['perm_Manage_My_Account'] = 'Manage My Account'; $lang['perm_Manage_My_Bookmarks'] = 'Manage My Bookmarks'; $lang['perm_Manage_My_Settings'] = 'Manage My Settings'; -$lang['perm_Modify_News'] = 'Modify News Articles'; // should go in News. $lang['perm_Manage_Stylesheets'] = 'Manage Stylesheets'; $lang['perm_Manage_Users'] = 'Manage Users'; $lang['perm_Modify_Any_Page'] = 'Modify Any Page'; @@ -1363,130 +930,143 @@ $lang['perm_Modify_Permissions'] = 'Modify Permissions'; $lang['perm_Modify_Site_Preferences'] = 'Modify Site Preferences'; $lang['perm_Modify_Templates'] = 'Modify Templates'; -$lang['perm_Modify_User-defined_Tags'] = 'Modify User-defined Tags'; +$lang['perm_Modify_User-defined_Tags'] = 'Modify User-Defined Tags'; $lang['perm_Remove_Pages'] = 'Remove Pages'; $lang['perm_Reorder_Content'] = 'Reorder Content'; -$lang['perm_Use_Admin_Search'] = 'Use Admin Search'; // should be in AdminSearch -$lang['perm_Manage_Search'] = 'Manage Search'; // should be in Search $lang['perm_View_Tag_Help'] = 'View Tag Help'; -$lang['phpversion'] = "Current PHP Version"; -$lang['php_information'] = "PHP Information"; +$lang['phpversion'] = 'Current PHP Version'; +$lang['php_information'] = 'PHP Information'; $lang['php_opcache'] = 'PHP 5.5+ Opcode Cache'; -$lang['pluginabout'] = "About the %s tag"; -$lang['pluginhelp'] = "Help for the %s tag"; -$lang['pluginmanagement'] = "Plugin Management"; -$lang['plugins'] = "Plugins"; -$lang['post_max_size'] = "Maximum Post Size"; -$lang['preferences'] = "Preferences"; -$lang['preferencesdescription'] = "This is where you set various site-wide preferences."; -$lang['prefsupdated'] = "User preferences have been updated."; -$lang['prettyurls_noeffect'] = "Pretty URLS are not configured... this URL will have no effect"; -$lang['preview'] = "Preview"; -$lang['previewdescription'] = "Preview changes"; -$lang['previous'] = "Previous"; -$lang['profile'] = "Profile"; -$lang['prompt_smarty_cachemodules'] = "Cache module calls"; -$lang['prompt_smarty_cacheudt'] = "Cache UDT Calls"; -$lang['prompt_smarty_compilecheck'] = "Do a Compilation Check"; -$lang['prompt_use_smartycaching'] = "Enable Smarty Caching"; -$lang['pseudocron_granularity'] = "Pseudocron Granularity"; +$lang['pluginabout'] = 'About the %s tag'; +$lang['pluginhelp'] = 'Help for the %s tag'; +$lang['pluginmanagement'] = 'Plugin Management'; +$lang['plugins'] = 'Plugins'; +$lang['post_max_size'] = 'Maximum Post Size'; +$lang['preferences'] = 'Preferences'; +$lang['preferencesdescription'] = 'This is where you set various site-wide preferences.'; +$lang['prefsupdated'] = 'User preferences have been updated.'; +$lang['prettyurls_noeffect'] = 'Pretty URLS are not configured... this URL will have no effect'; +$lang['preview'] = 'Preview'; +$lang['previewdescription'] = 'Preview changes'; +$lang['previous'] = 'Previous'; +$lang['profile'] = 'Profile'; +$lang['prompt_smarty_cachemodules'] = 'Cache module calls'; +$lang['prompt_smarty_cacheudt'] = 'Cache UDT Calls'; +$lang['prompt_smarty_compilecheck'] = 'Do a Compilation Check'; +$lang['prompt_use_smartycaching'] = 'Enable Smarty Caching'; +$lang['protected_data_path'] = 'Protected Data Path'; -## R -$lang['read'] = "Read"; -$lang['recentpages'] = "Recent Pages"; -$lang['recoveryemailsent'] = "Email sent to recorded address. Please check your inbox for further instructions."; -$lang['register_globals'] = "PHP register_globals"; -$lang['remote_connection_timeout'] = "Connection Timed Out!"; -$lang['remote_response_404'] = "Remote response: not found!"; -$lang['remote_response_error'] = "Remote response: error!"; -$lang['remote_response_ok'] = "Remote response: OK!"; -$lang['remove'] = "Remove"; +// R +$lang['read'] = 'Read'; +$lang['recentpages'] = 'Recent Pages'; +$lang['recoveryemailsent'] = 'Email sent to recorded address. Please check your inbox for further instructions.'; +$lang['recur_120m'] = 'Every 2 hours'; // see also former 'cron_*' +$lang['recur_15m'] = 'Every 15 minutes'; +$lang['recur_180m'] = 'Every 3 hours'; +$lang['recur_30m'] = 'Every 30 minutes'; +$lang['recur_daily'] = 'Daily'; +$lang['recur_hourly'] = 'Hourly'; +$lang['recur_monthly'] = 'Monthly'; +$lang['recur_weekly'] = 'Weekly'; +$lang['recur_yearly'] = 'Yearly'; +$lang['register_globals'] = 'PHP register_globals'; +$lang['remote_connection_timeout'] = 'Connection Timed Out!'; +$lang['remote_response_404'] = 'Remote response: not found!'; +$lang['remote_response_error'] = 'Remote response: error!'; +$lang['remote_response_ok'] = 'Remote response: OK!'; +$lang['remove'] = 'Remove'; $lang['remove_alert'] = 'Remove this alert'; //$lang['removeconfirm'] = "This action will permanently remove the files making up this module from this installation.\nAre you sure you want to proceed?"; //$lang['removecssassociation'] = "Remove Stylesheet Association"; -$lang['reorder'] = "Reorder"; -$lang['reorderpages'] = "Reorder Pages"; +$lang['reorder'] = 'Reorder'; +$lang['reorderpages'] = 'Reorder Pages'; $lang['reset'] = 'Reset'; -$lang['results'] = "Results"; -$lang['revert'] = "Revert all changes"; -$lang['root'] = "Root"; -$lang['routesrebuilt'] = "The database routes are rebuilt"; -$lang['run'] = "Run"; -$lang['runuserplugin'] = "Save, and execute this user defined tag"; -$lang['run_udt'] = "Run this User Defined Tag"; +$lang['results'] = 'Results'; +$lang['revert'] = 'Revert all changes'; +$lang['root'] = 'Root'; +$lang['routesrebuilt'] = 'The database routes have been rebuilt'; +$lang['run'] = 'Run'; +$lang['runuserplugin'] = 'Save then execute this User Defined Tag'; +$lang['run_udt'] = 'Run this User Defined Tag'; -## S -$lang['safe_mode'] = "PHP Safe Mode"; -$lang['saveconfig'] = "Save Config"; -$lang['searchable'] = "This page is searchable"; -$lang['search_module'] = "Search module"; -$lang['search_string_find'] = "Connection ok!"; -$lang['secure'] = "Secure (HTTPS)"; -$lang['secure_page'] = "Use HTTPS for this page"; +// S +$lang['safe_mode'] = 'PHP Safe Mode'; +$lang['saveconfig'] = 'Save Config'; +$lang['searchable'] = 'Searchable'; +$lang['search_module'] = 'Search Module'; +$lang['search_string_find'] = 'Connection ok!'; +$lang['secure'] = 'Secure (HTTPS)'; +$lang['secure_page'] = 'Use HTTPS for this page'; $lang['security_issue'] = 'Security Issue'; -$lang['selectall'] = "Select All"; -$lang['selecteditems'] = "With Selected"; -$lang['selectgroup'] = "Select Group"; +$lang['selectall'] = 'Select All'; +$lang['selecteditems'] = 'With Selected'; +$lang['selectgroup'] = 'Select Group'; $lang['select_file'] = 'Select File'; -$lang['send'] = "Send"; -$lang['sendmail_settings'] = "Sendmail Settings"; -$lang['sendtest'] = "Send"; -$lang['server_api'] = "Server API"; -$lang['server_cache_settings'] = "Server Cache Settings"; -$lang['server_db_grants'] = "Check database access levels"; -$lang['server_db_type'] = "Server Database"; -$lang['server_db_version'] = "Server Database Version"; -$lang['server_information'] = "Server Information"; -$lang['server_os'] = "Server Operating System"; -$lang['server_software'] = "Server Software"; -$lang['server_time_diff'] = "Check for file system time differences"; -$lang['session_save_path'] = "Session Save Path"; -$lang['session_use_cookies'] = "Sessions are allowed to use Cookies"; +$lang['send'] = 'Send'; +$lang['sendmail_settings'] = 'Sendmail Settings'; +$lang['sendtest'] = 'Send'; +$lang['server_api'] = 'Server API'; +$lang['server_cache_settings'] = 'Server Cache Settings'; +$lang['server_db_grants'] = 'Check database access levels'; +$lang['server_db_type'] = 'Server Database'; +$lang['server_db_version'] = 'Server Database Version'; +$lang['server_information'] = 'Server Information'; +$lang['server_os'] = 'Server Operating System'; +$lang['server_software'] = 'Server Software'; +$lang['server_time_diff'] = 'Check for file system time differences'; +$lang['session_save_path'] = 'Session Save Path'; +$lang['session_use_cookies'] = 'Sessions are allowed to use Cookies'; //$lang['setallcontent'] = "Set All Pages"; //$lang['setallcontentconfirm'] = "Are you sure you want to set all pages to use this template?"; -$lang['setfalse'] = "Set False"; -$lang['settemplate'] = "Set Template"; -$lang['settings'] = "Settings"; -$lang['settings_authentication'] = "Authentication"; -$lang['settings_authpassword'] = "Password"; -$lang['settings_authsecure'] = "Encryption method"; -$lang['settings_authusername'] = "User name"; -$lang['settings_mailer'] = "Mailer"; -$lang['settings_mailfrom'] = "From Address"; -$lang['settings_mailfromuser'] = "From Name"; -$lang['settings_sendmailpath'] = "Sendmail Path"; -$lang['settings_smtpauth'] = "SMTP Authentication is Required"; -$lang['settings_smtpautotls'] = "Auto TLS Encryption"; -$lang['settings_smtphost'] = "SMTP Hostname"; -$lang['settings_smtpport'] = "SMTP Port"; -$lang['settings_smtptimeout'] = "SMTP Time-out (seconds)"; -$lang['settings_testaddress'] = "Email Address"; -$lang['settrue'] = "Set True"; -$lang['setup'] = "Advanced Setup"; +$lang['setfalse'] = 'Set False'; +$lang['settemplate'] = 'Set Template'; +$lang['settings'] = 'Settings'; +$lang['settings_authentication'] = 'Authentication'; +$lang['settings_authpassword'] = 'Password'; +$lang['settings_authsecure'] = 'Encryption method'; +$lang['settings_authusername'] = 'User name'; +$lang['settings_jobmaxerrs'] = 'Maximum Errors'; +$lang['settings_jobsinterval'] = 'Processing Interval (minutes)'; +$lang['settings_jobstimeout'] = 'Processing Timeout (seconds)'; +$lang['settings_mailer'] = 'Mailer'; +$lang['settings_mailfrom'] = 'From Address'; +$lang['settings_mailfromuser'] = 'From Name'; +$lang['settings_sendmailpath'] = 'Sendmail Path'; +$lang['settings_smtpauth'] = 'SMTP Authentication is Required'; +$lang['settings_smtpautotls'] = 'Auto TLS Encryption'; +$lang['settings_smtphost'] = 'SMTP Hostname'; +$lang['settings_smtpport'] = 'SMTP Port'; +$lang['settings_smtptimeout'] = 'SMTP Time-out (seconds)'; +$lang['settings_testaddress'] = 'Email Address'; +$lang['settrue'] = 'Set True'; +$lang['setup'] = 'Advanced Setup'; //$lang['setusersettings'] = "Set this user account to be the template"; -$lang['showall'] = "Show All"; -$lang['showbookmarks'] = "Show Admin Bookmarks"; -$lang['showfilters'] = "Edit filter"; -$lang['showinmenu'] = "Show in Menu"; -$lang['showrecent'] = "Show Recently Used Pages"; -$lang['showsite'] = "Show Site"; -$lang['show_shortcuts_message'] = "To show the shortcuts button in your Admin theme, set My account >> User Preferences >> Administration Shortcuts"; -$lang['sibling_duplicate_order'] = "Two sibling pages can not have the same order. Pages were not reordered."; -$lang['siteadmin'] = "Site Admin"; -$lang['sitedownexcludeadmins'] = "Exclude users logged in to the CMSMS Admin console"; -$lang['sitedownexcludes'] = "Exclude these IP addresses from the "Site Down" status"; -$lang['sitedownmessage'] = "Site Down Message"; -$lang['sitedownwarning'] = 'Warning: Your site is currently showing a "Site Down for Maintenance" message. Remove the %s file to resolve this.'; -$lang['sitedown_settings'] = "Maintenance Mode"; -$lang['sitename'] = "Site Name"; -$lang['siteprefs'] = "Global Settings"; -$lang['siteprefsupdated'] = "Global Settings Updated"; -$lang['siteprefs_confirm'] = "Are you sure you want to alter these settings?"; -$lang['smarty_settings'] = "Smarty Settings"; -$lang['smtp_settings'] = "SMTP Settings"; -$lang['sqlerror'] = "SQL error in %s"; -$lang['start_upgrade_process'] = "Start Upgrade Process"; -$lang['status'] = "Status"; +$lang['showall'] = 'Show All'; +$lang['showbookmarks'] = 'Show admin bookmarks'; +$lang['showfilters'] = 'Edit filter'; +$lang['showinmenu'] = 'Show in Menu'; +$lang['showrecent'] = 'Show Recently Used Pages'; +$lang['showsite'] = 'Show Site'; +$lang['show_shortcuts_message'] = 'To show your shortcuts in your Admin theme bookmarks popup, set My account >> User Preferences >> Administration Shortcuts'; +$lang['sibling_duplicate_order'] = 'Two sibling pages can not have the same order. Pages were not reordered.'; +$lang['siteadmin'] = 'Site Admin'; +$lang['sitedownexcludeadmins'] = 'Exclude users logged in to the CMSMS Admin Console'; +$lang['sitedownexcludes'] = 'Exclude these IP addresses from the "Site Down" status'; +$lang['sitedownmessage'] = 'Site Down Message'; +$lang['sitedownwarning'] = 'Warning: This site is currently showing a "Site Down for Maintenance" message. Delete file \'%s\' to resolve this.'; +$lang['sitedown_settings'] = 'Maintenance Mode'; +$lang['sitename'] = 'Site Name'; +$lang['siteprefs'] = 'Global Settings'; +$lang['siteprefsupdated'] = 'Global settings updated'; +$lang['siteprefs_confirm'] = 'Are you sure you want to alter these settings?'; +$lang['smarty_cache_expiry1'] = 'Admin Template Expiry Period (minutes)'; +$lang['smarty_cache_expiry2'] = 'Frontend Template Expiry Period (minutes)'; +$lang['smarty_settings'] = 'Smarty'; +$lang['smtp_settings'] = 'SMTP Settings'; +$lang['sqlerror'] = 'SQL error in %s'; +$lang['start_upgrade_process'] = 'Start Upgrade Process'; +$lang['start'] = 'Start'; +$lang['status'] = 'Status'; /* $lang['stylesheet'] = "Stylesheet"; $lang['stylesheetcopied'] = "Stylesheet Copied"; @@ -1496,233 +1076,235 @@ $lang['stylesheetsdescription'] = "Stylesheet management is an advanced way to handle cascading Stylesheets (CSS) separately from templates."; $lang['stylesheetstodelete'] = "These stylesheets will be deleted"; */ -$lang['subitems'] = "Subitems"; -$lang['submit'] = "Submit"; -$lang['submitdescription'] = "Save changes"; -$lang['success'] = "Success"; -$lang['syntaxhighlightertouse'] = "Select syntax highlighter to use"; -$lang['sysmaintab_changelog'] = "Changelog"; -$lang['sysmaintab_content'] = "Cache and content"; -$lang['sysmaintab_database'] = "Database"; -$lang['sysmain_aliasesfixed'] = "aliases fixed"; -$lang['sysmain_cache_status'] = "Cache status"; -$lang['sysmain_confirmclearlog'] = "Are you sure you want to clear the Admin log?"; -$lang['sysmain_confirmfixaliases'] = "Are you sure you want to add aliases to pages missing it?"; -$lang['sysmain_confirmfixtypes'] = "Are you sure you want to convert all with invalid content into standard content pages?"; +$lang['subitems'] = 'Subitems'; +$lang['submit'] = 'Submit'; +$lang['submitdescription'] = 'Save changes'; +$lang['success'] = 'Success'; +$lang['syntaxhighlightertouse'] = 'Select syntax highlighter to use'; +$lang['sysmaintab_changelog'] = 'Changelog'; +$lang['sysmaintab_content'] = 'Cache and content'; +$lang['sysmaintab_database'] = 'Database'; +$lang['sysmaintab_jobs'] = 'Background Jobs'; // see also 'jobsmenu' +$lang['sysmain_aliasesfixed'] = 'aliases fixed'; +$lang['sysmain_cache_status'] = 'Cache status'; +$lang['sysmain_confirmclearlog'] = 'Are you sure you want to clear the Admin Log?'; +$lang['sysmain_confirmfixaliases'] = 'Are you sure you want to add an alias to pages without one?'; +$lang['sysmain_confirmfixtypes'] = 'Are you sure you want to convert all with invalid content into standard content pages?'; //$lang['sysmain_confirmupdatehierarchy'] = "Are you sure you want to update page hierarchy positions?"; -//$lang['sysmain_confirmupdateurls'] = "Are you sure you want to refresh the route database"; -$lang['sysmain_content_status'] = "Content status"; -$lang['sysmain_database_status'] = "Database status"; -$lang['sysmain_fixaliases'] = "Add aliases where missed"; -$lang['sysmain_fixtypes'] = "Convert into standard content pages"; -$lang['sysmain_hierarchyupdated'] = "Page hierarchy positions updated"; -$lang['sysmain_nocontenterrors'] = "No content errors detected"; -$lang['sysmain_nostr_errors'] = "No structural errors were detected in the database"; -$lang['sysmain_optimize'] = "Optimize"; -$lang['sysmain_optimizetables'] = "Optimize tables"; -$lang['sysmain_pagesfound'] = "pages found"; -$lang['sysmain_pagesinvalidtypes'] = "pages with invalid content type"; -$lang['sysmain_pagesmissinalias'] = "pages missing aliases"; -$lang['sysmain_repair'] = "Repair"; -$lang['sysmain_repairtables'] = "Repair tables"; -$lang['sysmain_str_error'] = "Structural error detected in table"; -$lang['sysmain_str_errors'] = "Structural errors detected in tables"; -$lang['sysmain_tablesfound'] = "tables found (out of which %d are not seq-tables)"; -$lang['sysmain_tablesoptimized'] = "Tables optimized"; -$lang['sysmain_tablesrepaired'] = "Tables repaired"; -$lang['sysmain_typesfixed'] = "page content types fixed"; -$lang['sysmain_update'] = "Update"; -$lang['sysmain_updatehierarchy'] = "Update page hierarchy positions"; -$lang['sysmain_updateurls'] = "Update Routes"; -$lang['systeminfo'] = "System Information"; -$lang['systeminfodescription'] = "Display various pieces of information about your system that may be useful in diagnosing problems"; -$lang['systeminfo_copy_paste'] = "Please copy and paste this selected text into your forum posting"; -$lang['systemmaintenance'] = "System Maintenance"; -$lang['systemmaintenancedescription'] = "Various functions for maintaining the health of your system. You can also browse the changelog for all releases."; -$lang['system_verification'] = "System Verification"; +//$lang['sysmain_confirmupdateurls'] = "Are you sure you want to refresh the routes database?"; +$lang['sysmain_content_status'] = 'Content status'; +$lang['sysmain_database_status'] = 'Database status'; +$lang['sysmain_filesfound'] = '%d files found'; +$lang['sysmain_fixaliases'] = 'Add Missing Aliases'; +$lang['sysmain_fixtypes'] = 'Convert into standard content pages'; +$lang['sysmain_hierarchyupdated'] = 'Page hierarchy positions updated'; +$lang['sysmain_nocontenterrors'] = 'No content error detected'; +$lang['sysmain_nostr_errors'] = 'No structural error detected in the database'; +$lang['sysmain_optimize'] = 'Optimize'; +$lang['sysmain_optimizetables'] = 'Optimize Tables'; +$lang['sysmain_pagesfound'] = '%d pages found'; +$lang['sysmain_pagesinvalidtypes'] = '%d pages with invalid content type'; +$lang['sysmain_pagesmissinalias'] = '%d pages missing alias'; +$lang['sysmain_repair'] = 'Repair'; +$lang['sysmain_repairtables'] = 'Repair Tables'; +$lang['sysmain_str_error'] = 'Structural error detected in table'; +$lang['sysmain_str_errors'] = 'Structural errors detected in tables'; +$lang['sysmain_tablesfound'] = 'tables found (of which %d are not sequence-tables)'; +$lang['sysmain_tablesoptimized'] = 'Tables optimized'; +$lang['sysmain_tablesrepaired'] = 'Tables repaired'; +$lang['sysmain_typesfixed'] = 'page content types fixed'; +$lang['sysmain_update'] = 'Update'; +$lang['sysmain_updatehierarchy'] = 'Update Page Hierarchy Positions'; +$lang['sysmain_updateurls'] = 'Update Routes'; +$lang['systeminfo'] = 'System Information'; +$lang['systeminfodescription'] = 'Display various pieces of information about your system that may be useful in diagnosing problems'; +$lang['systeminfo_copy_paste'] = 'Please copy and paste this selected text into your forum posting'; +$lang['systemmaintenance'] = 'System Maintenance'; +$lang['systemmaintenancedescription'] = 'Various functions for maintaining the health of your system. You can also browse the changelog for all releases.'; +$lang['system_verification'] = 'System Verification'; -## T -$lang['tabindex'] = "Tab Index"; -$lang['tagdescription'] = "Tags are little bits of PHP functionality that can be added to your content and/or templates."; -$lang['tags'] = "Tags"; -$lang['tagtousegcb'] = "Tag to Use this Block"; -$lang['target'] = "Target"; -$lang['team'] = "Team"; +// T +$lang['tabindex'] = 'Tab Index'; +$lang['tagdescription'] = 'Tags are little bits of PHP functionality that can be added to your content and/or templates.'; +$lang['tags'] = 'Tags'; +$lang['tagtousegcb'] = 'Tag to Use this Block'; +$lang['target'] = 'Target'; +$lang['team'] = 'Team'; //$lang['templatecopied'] = "Template Copied"; //$lang['templatecss'] = "Assign Templates to Stylesheet"; //$lang['templatemanagement'] = "Template Management"; -//$lang['templatesdescription'] = "This is where we add and edit templates. Templates define the look and feel of your site."; +//$lang['templatesdescription'] = "This is where users can add and edit templates. Templates define the look and feel of this site."; //$lang['templatestodelete'] = "These templates will be deleted"; //$lang['templateuser'] = "Template Account"; -$lang['tempnam_function'] = "tempnam function"; -$lang['test'] = "Test"; -$lang['testmsg_success'] = "Test message sent... check your inbox."; -$lang['test_allow_browser_cache'] = "Allowing browsers to cache pages will improve performance by not requiring your system to serve the page on repeated visits to a page."; -$lang['test_allow_url_fopen_failed'] = "When allow URL fopen is disabled you will not be able to accessing URL object like file using the ftp or http protocol."; -$lang['test_auto_clear_cache_age'] = "The system should be configured to destroy old temporary files after a reasonable time to improve performance and minimize disk space requirements"; -$lang['test_browser_cache_expiry'] = "A longer value will have increased performance benefits"; -$lang['test_check_open_basedir_failed'] = "Open basedir restrictions are in effect. You may have difficulty with some add-on functionality with this restriction"; -$lang['test_curl'] = "Test for curl availability"; -$lang['test_curlversion'] = "Test Curl Version"; -$lang['test_db_timedifference'] = "Testing for time difference in the database"; -$lang['test_db_timedifference_msg'] = "Detected a difference of at least %d seconds. This may effect the system dramatically"; -$lang['test_edeprecated_failed'] = "E_DEPRECATED is enabled"; +$lang['tempnam_function'] = 'tempnam function'; +$lang['test'] = 'Test'; +$lang['testmsg_success'] = 'Test message sent... check your inbox.'; +$lang['test_allow_browser_cache'] = 'Allowing browsers to cache pages will improve performance by not requiring your system to serve the page on repeated visits to a page.'; +$lang['test_allow_url_fopen_failed'] = 'When allow URL fopen is disabled you will not be able to accessing URL object like file using the ftp or http protocol.'; +$lang['test_auto_clear_cache_age'] = 'The system should be configured to destroy old temporary files after a reasonable time to improve performance and minimize disk space requirements'; +$lang['test_browser_cache_expiry'] = 'A longer value will have increased performance benefits'; +$lang['test_check_open_basedir_failed'] = 'Open basedir restrictions are in effect. You may have difficulty with some add-on functionality with this restriction'; +//$lang['test_curl'] = "Test for curl availability"; see 'curl' +//$lang['test_curlversion'] = "Test curl version"; see 'curlversion' +$lang['test_db_timedifference'] = 'Testing for time difference in the database'; +$lang['test_db_timedifference_msg'] = 'Detected a difference of at least %d seconds. This may effect the system dramatically'; +$lang['test_edeprecated_failed'] = 'E_DEPRECATED is enabled'; $lang['test_eall_failed'] = 'E_ALL is not enabled in error reporting, this could mean that you may not see important problems in your error log.'; $lang['test_error_eall'] = 'Testing if E_ALL is enabled in php.ini error_reporting'; -$lang['test_error_edeprecated'] = "Testing if E_DEPRECATED is enabled in php.ini error_reporting"; -$lang['test_error_estrict'] = "Testing if E_STRICT is enabled in php.ini error_reporting"; -$lang['test_estrict_failed'] = "E_STRICT is enabled in the error_reporting"; -$lang['test_file_timedifference'] = "Testing for time difference in the file system"; -$lang['test_file_timedifference_msg'] = "Detected a difference of at least %d seconds. This may effect the system dramatically"; -$lang['test_remote_url'] = "Test for remote URL"; -$lang['test_remote_url_failed'] = "You will probably not be able to open a file on a remote web server."; -$lang['test_smarty_cacheudt'] = "Caching user defined tags can have serious performance benefits. Use caution"; -$lang['test_smarty_caching'] = "Enabling Smarty caching can have serious performance benefits for most websites."; -$lang['text_changeowner'] = "Set Selected Pages to a different User"; -$lang['text_settemplate'] = "Set Selected Pages to a different Template"; -$lang['theme'] = "Theme"; -$lang['thumbnail'] = "Thumbnail"; -$lang['thumbnail_height'] = "Thumbnail Height"; -$lang['thumbnail_width'] = "Thumbnail Width"; -$lang['title'] = "Title"; -$lang['titleattribute'] = "Description (title attribute)"; -$lang['title_applyusertag'] = "Save this User Defined Tag, and continue editing"; +$lang['test_error_edeprecated'] = 'Testing if E_DEPRECATED is enabled in php.ini error_reporting'; +$lang['test_error_estrict'] = 'Testing if E_STRICT is enabled in php.ini error_reporting'; +$lang['test_estrict_failed'] = 'E_STRICT is enabled in the error_reporting'; +$lang['test_file_timedifference'] = 'Testing for time difference in the file system'; +$lang['test_file_timedifference_msg'] = 'Detected a difference of at least %d seconds. This may effect the system dramatically'; +$lang['test_remote_url'] = 'Remote URL access'; +$lang['test_remote_url_failed'] = 'You will probably not be able to open a file on a remote web server.'; +$lang['test_smarty_cacheudt'] = 'Caching user defined tags can have serious performance benefits. Use caution'; //TODO silly overall message +$lang['test_smarty_caching'] = 'Enabling Smarty caching can have serious performance benefits for most websites.'; +$lang['test_smarty_compiled'] = 'Template-compilation checking can degrade performance, but ensures that any template change will automatically be processed, without pages-cache clearance or timeout'; +$lang['text_changeowner'] = 'Set Selected Pages to a different User'; +$lang['text_settemplate'] = 'Set Selected Pages to a different Template'; +$lang['theme'] = 'Theme'; +$lang['thumbnail'] = 'Thumbnail'; +$lang['thumbnail_height'] = 'Thumbnail Height'; +$lang['thumbnail_width'] = 'Thumbnail Width'; +$lang['title'] = 'Title'; +$lang['titleattribute'] = 'Description (title attribute)'; +$lang['title_applyusertag'] = 'Save this User Defined Tag, and continue editing'; +$lang['title_callable'] = 'More detail is displayed for developers'; $lang['title_event_description'] = 'This column contains brief descriptions for each event'; $lang['title_event_handlers'] = 'This column indicates the number of handlers for each event (if any)'; $lang['title_event_name'] = 'This column contains a unique name for each event'; $lang['title_event_originator'] = 'This column contains the name of the module or code piece that sends the event. Usually "Core" indicates that the event is sent by a core API function.'; -$lang['title_hierselect'] = "This field displays the selected content page. The actual string displayed (page title or menu text) is dependent on user and site preference."; +$lang['title_hierselect'] = 'This field displays the selected content page. The actual string displayed (page title or menu text) is dependent on user and site preference.'; $lang['title_hierselect_select'] = 'Select a content page. If the selected page has children a new dropdown will appear. Selecting "None" indicates that the selection stops with the value of the previous select if any.'; -$lang['title_mailtest'] = "Mail Test"; +$lang['title_mailtest'] = 'Mail Test'; //$lang['toggle'] = "Toggle"; -$lang['tools'] = "Tools"; +$lang['tools'] = 'Tools'; $lang['tplhelp_page'] = 'TODO'; -$lang['troubleshooting'] = "(Troubleshooting)"; -$lang['true'] = "True"; -$lang['type'] = "Type"; -$lang['typenotvalid'] = "Type is not valid"; +$lang['troubleshooting'] = '(Troubleshooting)'; +$lang['true'] = 'True'; +$lang['type'] = 'Type'; +$lang['typenotvalid'] = 'Type is not valid'; -## U +// U //$lang['uninstall'] = "Uninstall"; //$lang['uninstallconfirm'] = "Are you sure you want to uninstall this module? Name:"; //$lang['uninstalled_mod'] = "Uninstalled module %s"; -$lang['unknown'] = "Unknown"; -$lang['unlimited'] = "Unlimited"; -$lang['untested'] = "Not Tested"; -$lang['up'] = "Up"; -$lang['updateperm'] = "Update Permissions"; +$lang['unknown'] = 'Unknown'; +$lang['unlimited'] = 'Unlimited'; +$lang['untested'] = 'Not Tested'; +$lang['until'] = 'Until'; +$lang['up'] = 'Up'; +$lang['updateperm'] = 'Update Permissions'; //$lang['upgrade'] = "Upgrade"; //$lang['upgradeconfirm'] = "Are you sure you want to upgrade this?"; //$lang['upgraded_mod'] = "%s Upgraded from Version %s to %s"; -$lang['uploaded_file'] = "Uploaded File"; +$lang['uploaded_file'] = 'Uploaded file'; $lang['upload_filetobig'] = 'This file is too large to upload'; //$lang['uploadfile'] = "Upload File"; //$lang['uploadxmlfile'] = "Install module via XML file"; -$lang['upload_cksum_file'] = "Upload Checksum File"; +$lang['upload_cksum_file'] = 'Upload Checksum File'; $lang['upload_largeupload'] = 'The total size of files to upload exceeds the limit specified in the PHP configuration'; -$lang['upload_max_filesize'] = "Maximum Upload Size"; -$lang['url'] = "URL"; +$lang['upload_max_filesize'] = 'Maximum Upload Size'; +$lang['url'] = 'URL'; //$lang['useadvancedcss'] = "Use Advanced Stylesheet Management"; -$lang['user'] = "User"; -$lang['useraccount'] = "User Account"; -$lang['userdefinedtags'] = "User Defined Tags"; -$lang['usermanagement'] = "User Management"; -$lang['username'] = "User name"; -$lang['usernameincorrect'] = "User name or password incorrect"; -$lang['usernotfound'] = "User Not Found"; -$lang['userprefs'] = "User Preferences"; -$lang['users'] = "Backend Users"; -$lang['usersassignedtogroup'] = "Users Assigned to Group %s"; -$lang['usersdescription'] = "Here you can manage Admin users."; +$lang['user'] = 'User'; +$lang['useraccount'] = 'User Account'; +$lang['userdefinedtags'] = 'User Defined Tags'; +$lang['usermanagement'] = 'User Management'; +$lang['username'] = 'User name'; +$lang['usernameincorrect'] = 'User name or password incorrect'; +$lang['usernotfound'] = 'User Not Found'; +$lang['userprefs'] = 'User Preferences'; +$lang['users'] = 'Backend Users'; +$lang['usersassignedtogroup'] = 'Users assigned to group %s'; +$lang['usersdescription'] = 'Here you can manage Admin users.'; $lang['userdisabled'] = 'User account disabled'; -$lang['usersettings'] = "User Settings"; -$lang['usersgroups'] = "User Management"; -$lang['usersgroupsdescription'] = "User and Group related items."; -$lang['usertagadded'] = "The User Defined Tag was successfully added"; -$lang['usertagdeleted'] = "The User Defined Tag was successfully removed."; -$lang['usertagdescription'] = "User Defined Tags (UDT's) that you can create and modify yourself to perform specific tasks, right from your browser."; -$lang['usertagexists'] = "A User Defined Tag with this name already exists. Please choose another."; -$lang['usertags'] = "User Defined Tags"; -$lang['usertagupdated'] = "The User Defined Tag was successfully updated."; -$lang['user_created'] = "Custom Shortcuts"; -$lang['user_login'] = "User Login"; -$lang['user_logout'] = "User Logout"; -$lang['user_tag'] = "User Tag"; -$lang['usewysiwyg'] = "Use WYSIWYG editor for content"; -$lang['use_name'] = "In the parent page dropdown, show the page title instead of the menu text"; -$lang['use_wysiwyg'] = "Use WYSIWYG"; +$lang['usersettings'] = 'User Settings'; +$lang['usersgroups'] = 'User Management'; +$lang['usersgroupsdescription'] = 'User and Group related items.'; +$lang['usertagadded'] = 'The User Defined Tag was successfully added'; +$lang['usertagdeleted'] = 'The User Defined Tag was successfully removed.'; +$lang['usertagdescription'] = "User Defined Tags (UDT's) that you can create and modify to perform simple tasks, right from your browser."; +$lang['usertagexists'] = 'A User Defined Tag with this name already exists. Please choose another.'; +$lang['usertags'] = 'User Defined Tags'; +$lang['usertagupdated'] = 'The User Defined Tag was successfully updated.'; +$lang['user_login'] = 'User Login'; +$lang['user_logout'] = 'User Logout'; +$lang['user_tag'] = 'User Tag'; +$lang['usewysiwyg'] = 'Use WYSIWYG editor for content'; +$lang['use_name'] = 'In the parent page dropdown, show the page title instead of the menu text'; +$lang['use_wysiwyg'] = 'Use WYSIWYG'; -## V -$lang['version'] = "Version"; -$lang['view'] = "View"; -$lang['viewsite'] = "View Site"; -$lang['view_page'] = "View this page in a new window"; +// V +$lang['version'] = 'Version'; +$lang['view'] = 'View'; +$lang['viewsite'] = 'View Site'; +$lang['view_page'] = 'View this page in a new window'; -## W -$lang['wantschildren'] = 'Wants Children'; +// W +$lang['wantschildren'] = 'Child Pages Allowed'; $lang['warning_mail_settings'] = 'Your mail settings have not been configured. This could interfere with the ability of your website to send email messages. You should go to Extensions >> CMSMailer and configure the mail settings with the information provided by your host.'; -$lang['warning_safe_mode'] = "WARNING: PHP Safe mode is enabled. This will cause difficulty with files uploaded via the web browser interface, including images, theme and module XML packages. You are advised to contact your site administrator to see about disabling safe mode."; -$lang['warning_upgrade'] = "Warning: CMSMS is in need of an upgrade!"; -$lang['warning_upgrade_info1'] = "The website is now running schema version %s and needs to be upgraded to version %s"; -$lang['warning_upgrade_info2'] = "Please click the following link: %s."; -$lang['warn_addgroup'] = "Creating a new group does not assign any permissions. You will need to assign permissions to the new group in a separate step."; -$lang['warn_admin_ipandcookies'] = "Warning: Admin activities use cookies and tracks your IP address"; +$lang['warning_safe_mode'] = 'WARNING: PHP Safe mode is enabled. This will cause difficulty with files uploaded via the web browser interface, including images, theme and module XML packages. You are advised to contact your site administrator to see about disabling safe mode.'; +$lang['warning_upgrade'] = 'Warning: CMSMS is in need of an upgrade!'; +$lang['warning_upgrade_info1'] = 'The website is now running schema version %s and needs to be upgraded to version %s'; +$lang['warning_upgrade_info2'] = 'Please click the following link: %s.'; +$lang['warn_addgroup'] = "Creating a new group does not assign any permission. You will need to assign permission(s) to the new group in a 'Change Permissions' action."; +$lang['warn_admin_ipandcookies'] = 'Note: Admin activities use cookies (for internal functional purposes only) and might track your IP address (for those same purposes)'; //$lang['warn_bulk_settemplate'] = 'Warning: This is potentially a destructive operation, and may break an existing website. Use caution!'; -$lang['warn_nosefurl'] = "SEO Friendly or Pretty URLs have not been configured. Its settings are not visible here"; -$lang['welcomemsg'] = "Welcome %s"; -$lang['welcome_user'] = "Welcome"; -$lang['wiki'] = "Wiki"; // backwards compatibility +$lang['warn_nosefurl'] = "SEO-friendly ('pretty') URLs have not been configured. Settings related to those are not displayed here."; +$lang['warn_protected_path'] = "WARNING An inappropriate value for this property will cripple this website, correctable only by forensic manipulation by a site developer.
    Change the value only if you're supremely confident that the result will be effective."; +$lang['welcomemsg'] = 'Welcome %s'; +$lang['welcome_user'] = 'Welcome'; +$lang['wiki'] = 'Wiki'; // backwards compatibility //$lang['wikihelp'] = "Community Help"; -$lang['wontdeletetemplateinuse'] = "These templates are in use and will not be deleted"; -$lang['write'] = "Write"; -$lang['wysiwygtouse'] = "Select WYSIWYG to use"; - -## X -$lang['xml'] = "XML"; -$lang['xmlreader_class'] = "Checking for the XMLReader class"; -$lang['xml_function'] = "Basic XML (expat) support"; - -## Y -$lang['yes'] = "Yes"; -$lang['your_ipaddress'] = "Your IP Address is"; - -## Z -$lang['zz_1nav_tab__'] = "Navigation"; -$lang['zz_2logic_tab__'] = "Logic"; -$lang['zz_3options_tab__'] = "Options"; -$lang['zz_4perms_tab__'] = "Permissions"; - +$lang['wontdeletetemplateinuse'] = 'These templates are in use and will not be deleted'; +$lang['write'] = 'Write'; +$lang['wysiwygtouse'] = 'Select WYSIWYG to use'; -## Serving Content Manager module -$lang['dependencies'] = "Dependencies"; // also serving third-party modules +// X +$lang['xml'] = 'XML'; +$lang['xmlreader_class'] = 'Checking for the XMLReader class'; +$lang['xml_function'] = 'Basic XML (expat) support'; -$lang['help_content_tabindex'] = "Specify an integer value for the tab order used when surfing the navigation to browse to this page. This is useful when building accessible websites"; -$lang['help_content_target'] = "Specify a target attribute to use when including this item in the navigation. A target of _blank will open this page in a new navigator window, or tab."; -$lang['help_content_thumbnail'] = "This field allows you to associate a thumbnail image with the content page. The images must have already been generated on the website (The FileManager module can generate thumbnails on upload) to a directory specified by the website designer. The image may optionally be displayed on the page, or used when building a navigation"; -$lang['help_content_title'] = "The title of the page is displayed in the title bar of the browser, is used in search engine optimization, and is usually displayed prominently on the website"; -$lang['help_content_titleattribute'] = "Specify a brief description for this content page. This data can be used for search engine optimization, or in the navigation"; -$lang['help_css_max_age'] = "This parameter should be set relatively high for static sites, and should be set to 0 for site development"; -$lang['help_page_alias'] = "The alias is used as an alternate to the page id to uniquely identify a page. It must be unique across all pages. The alias is also used to assist in building the URL for the page"; -$lang['help_page_cachable'] = "Performance can be increased by setting as many pages as possible to cachable. However this cannot be used for pages where content may change on a per request basis"; -$lang['help_page_disablewysiwyg'] = "This option will disable the WYSIWYG editor for all content areas on this page independent of settings in the {content} block or user settings"; -$lang['help_page_searchable'] = "This setting indicates whether the content of this page should be indexed by the Search module"; -$lang['help_page_url'] = "Specify an alternate URL (relative to the root of your website) that can be used to uniquely identify this page. i.e: path/to/mypage. The page URL is only useful when pretty URLs are enabled."; -$lang['invalid_url2'] = "The page URL specified is invalid. It should contain only alphanumeric characters, or - or /. Extensions must contain only alphanumeric chars and be less than 5 characters in length. It is also possible that the URL specified is already in use."; +// Y +$lang['yes'] = 'Yes'; +$lang['your_ipaddress'] = 'Your IP Address is'; +// Z +$lang['zz_1nav_tab__'] = 'Navigation'; +$lang['zz_2logic_tab__'] = 'Logic'; +$lang['zz_3options_tab__'] = 'Options'; +$lang['zz_4perms_tab__'] = 'Permissions'; -## Serving third-party modules -$lang['added_template'] = "Added Template"; -$lang['addtemplate'] = "Add New Template"; +// Serving Content Manager module or Content-related classes +$lang['dependencies'] = 'Dependencies'; // also serving third-party modules +$lang['help_content_tabindex'] = 'Specify an integer value for the tab order used when surfing the navigation to browse to this page. This is useful when building accessible websites'; +$lang['help_content_target'] = "Specify a target attribute to use when including this item in the navigation. A target of '_blank' will open this page in a new navigator window, or tab."; +$lang['help_content_thumbnail'] = "This field allows associating a thumbnail image with the content page. Such image might be for display on the page, or used when building a navigation, etc. Enter or select an absolute url, or a site-root-relative url, or just a file basename which will be taken to indicate the file is located in or below the site's configured uploaded-images folder. See also the 'content_thumbnailfield_path' site-preference."; +$lang['help_content_title'] = 'The title of the page is displayed in the title bar of the browser, is used in search engine optimization, and is usually displayed prominently on the website'; +$lang['help_content_titleattribute'] = 'Specify a brief description for this content page. This data can be used for search engine optimization, or in the navigation'; +$lang['help_css_max_age'] = 'This parameter should be set relatively high for static sites, and should be set to 0 for site development'; +$lang['help_page_alias'] = 'The alias is used as an alternate to the page id to uniquely identify a page. It must be unique across all pages. The alias is also used to assist in building the URL for the page'; +$lang['help_page_cachable'] = 'Performance can be increased by setting as many pages as possible to cachable. However this cannot be used for pages where content may change on a per request basis'; +$lang['help_page_disablewysiwyg'] = 'This option will disable WYSIWYG editing for all content areas on this page, regardless of template {content} block attributes and/or user settings'; +$lang['help_page_searchable'] = 'This setting indicates whether the content of this page should be indexed by the Search module'; +$lang['help_page_url'] = "Specify a unique URL-path (relative to the root of the website) that can be used to access this page e.g. my/special/page. Without leading '/', with any URL-compatible content, any letter-case.
    Such URL-path can be directly used only if one of the supported kinds of url-rewriting is configured."; +$lang['invalid_url'] = 'The specified page URL has no valid content.'; +//$lang['invalid_url2'] = "The page URL specified is invalid. It should contain only alphanumeric characters, or - or /. Extensions must contain only alphanumeric chars and be less than 5 characters in length. It is also possible that the URL specified is already in use."; +$lang['urlalreadyused'] = "The specified 'Page URL' is already in use. Change it to something else."; -$lang['deleted_template'] = "Deleted Template"; -$lang['deletetemplate'] = "Delete Template"; -$lang['deletetemplates'] = "Delete Templates"; +// Serving third-party modules ? +$lang['added_template'] = 'Added template'; +$lang['addtemplate'] = 'Add New Template'; -$lang['edittemplate'] = "Edit Template"; -$lang['edittemplatesuccess'] = "Template updated"; +$lang['deleted_template'] = 'Deleted template'; +$lang['deletetemplate'] = 'Delete Template'; +$lang['deletetemplates'] = 'Delete Templates'; -$lang['template'] = "Template"; -$lang['templateexists'] = "Template name already exists"; -$lang['templates'] = "Templates"; +$lang['edittemplate'] = 'Edit Template'; +$lang['edittemplatesuccess'] = 'Template updated'; -?> +$lang['template'] = 'Template'; +$lang['templateexists'] = 'Template name already exists'; +$lang['templates'] = 'Templates'; diff --git a/phar_installer/app/upgrade/2.0/tmp.txt b/admin/lang/ext/.gitkeep similarity index 100% rename from phar_installer/app/upgrade/2.0/tmp.txt rename to admin/lang/ext/.gitkeep diff --git a/admin/listbookmarks.php b/admin/listbookmarks.php index 8db5665c..58c340c9 100644 --- a/admin/listbookmarks.php +++ b/admin/listbookmarks.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,97 +15,50 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: listbookmarks.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'; check_login(); -include_once("header.php"); - -?> -
    -
    - -GetBookmarkOperations(); - $marklist = $bookops->LoadBookmarks($userid); - - $page = 1; - if (isset($_GET['page'])) $page = $_GET['page']; - $limit = 20; - - if (count($marklist) > $limit) - { - echo "

    ".pagination($page, count($marklist), $limit)."

    "; - } - echo $themeObject->ShowHeader('bookmarks').'
    '; - - if (count($marklist) > 0) { - - echo'

    ' . lang('show_shortcuts_message') . '

    '; - - echo "\n"; - echo ''; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo ''; - echo ''; - - $currow = "row1"; - - // construct true/false button images - $image_true = $themeObject->DisplayImage('icons/system/true.gif', lang('true'),'','','systemicon'); - $image_false = $themeObject->DisplayImage('icons/system/false.gif', lang('false'),'','','systemicon'); - - $counter=0; - foreach ($marklist as $onemark){ - if ($counter < $page*$limit && $counter >= ($page*$limit)-$limit) { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - ($currow == "row1"?$currow="row2":$currow="row1"); - } - $counter++; +require_once 'header.php'; + +$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1; +$limit = 20; // max items per page +$showinfo = false; + +$show = []; +$userid = get_userid(); +$bookops = cmsms()->GetBookmarkOperations(); +$marklist = $bookops->LoadBookmarks($userid); +if ($marklist) { + $urlext = CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; + $gmax = $page * $limit; + for ($ctr = $gmax - $limit; $ctr < $gmax; $ctr++) { + if (isset($marklist[$ctr])) { + //replicate part of BookmarkOperations::_prep_for_saving() + $marklist[$ctr]->url = str_replace($urlext,'[SECURITYTAG]',$marklist[$ctr]->url); + $show[] = $marklist[$ctr]; } - - echo ''; - echo "
    ".lang('name')."".lang('url')."  
    bookmark_id."\">".$onemark->title."".$onemark->url."bookmark_id."\">"; - echo $themeObject->DisplayImage('icons/system/edit.gif', lang('edit'),'','','systemicon'); - echo "bookmark_id."\" onclick=\"return confirm('".cms_html_entity_decode(lang('deleteconfirm', $onemark->title) )."');\">"; - echo $themeObject->DisplayImage('icons/system/delete.gif', lang('delete'),'','','systemicon'); - echo "
    \n"; - - } else { - echo'

    ' . lang('no_shortcuts') . '

    '; } -?> - -
    - + $showinfo = !cms_userprefs::get_for_user($userid,'bookmarks',false); +} + +$themeObject->set_value('pagetitle', 'bookmarks'); + +$smarty->changeCaching(false); +$tpl = $smarty->createTemplate('admin_tpl:listbookmarks.tpl',null,null,$smarty,false); +// see also $smarty-assigned var $secureparam +$tpl->assign('showinfo',$showinfo) + ->assign('iconadd',$themeObject->DisplayImage('icons/system/newobject.gif',lang('addbookmark'),'','','systemicon')) + ->assign('iconedit',$themeObject->DisplayImage('icons/system/edit.gif',lang('editbookmark'),'','','systemicon')) + ->assign('icondelete',$themeObject->DisplayImage('icons/system/delete.gif',lang('delete'),'','','systemicon')); +if (($n = count($marklist)) > $limit) { + $tpl->assign('pagination',pagination($page,$n,$limit)); +} +$tpl->assign('marklist',$show); +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/listgroups.php b/admin/listgroups.php index aa21b23a..ea752c10 100644 --- a/admin/listgroups.php +++ b/admin/listgroups.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,144 +15,55 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: listgroups.php 10298 2015-11-01 23:00:32Z calguy1000 $ +#$Id$ -$CMS_ADMIN_PAGE=1; +$CMS_ADMIN_PAGE = 1; -require_once("../lib/include.php"); -require_once("../lib/classes/class.group.inc.php"); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +require_once '../lib/include.php'; check_login(); $userid = get_userid(); -$access = check_permission($userid, "Manage Groups"); - +$access = check_permission($userid, 'Manage Groups'); // 'Add Groups' ok? if (!$access) { - die('Permission Denied'); - return; + exit(lang('no_permission')); //TODO throw if can be caught } - -include_once("header.php"); - - -?> - -
    - -GetUserOperations(); - $groupops = $gCms->GetGroupOperations(); - $grouplist = $groupops->LoadGroups(); - - echo $themeObject->ShowHeader('currentgroups').'
    '; - $page = 1; - if (isset($_GET['page'])) $page = $_GET['page']; - $limit = 20; - if (count($grouplist) > $limit) { - echo "

    ".pagination($page, count($grouplist), $limit)."

    "; - } - if (count($grouplist) > 0) { - echo "\n"; - echo ''; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo ''; - echo ''; - - $currow = "row1"; - - // construct true/false button images - $image_true = $themeObject->DisplayImage('icons/system/true.gif', lang('true'),'','','systemicon'); - $image_false = $themeObject->DisplayImage('icons/system/false.gif', lang('false'),'','','systemicon'); - $image_groupassign = $themeObject->DisplayImage('icons/system/groupassign.gif', lang('assignments'),'','','systemicon'); - $image_permissions = $themeObject->DisplayImage('icons/system/permissions.gif', lang('permissions'),'','','systemicon'); - - $counter=0; - foreach ($grouplist as $onegroup){ - if ($counter < $page*$limit && $counter >= ($page*$limit)-$limit) { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - if ($onegroup->id != 1 && !$userops->UserInGroup($userid,$onegroup->id)) { - echo "\n"; - } - else { - echo ''."\n"; - } - echo "\n"; - - ($currow == "row1"?$currow="row2":$currow="row1"); - } - $counter++; - } - - echo ''; - echo "
    ".lang('name')."".lang('active')."    
    description."\" href=\"editgroup.php".$urlext."&group_id=".$onegroup->id."\">".$onegroup->name.""; - if( $onegroup->id == 1 ) { - echo ' '; - } - else { - if( $onegroup->active == 1 ) { - echo $image_true; +require_once 'header.php'; + +$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1; +$limit = 20; // max items per page + +$showgroups = []; +$gCms = cmsms(); +$groupops = $gCms->GetGroupOperations(); +$grouplist = $groupops->LoadGroups(); +if ($grouplist) { + $userops = $gCms->GetUserOperations(); + $gmax = $page * $limit; + for ($ctr = $gmax - $limit; $ctr < $gmax; $ctr++) { + if (isset($grouplist[$ctr])) { + $group = $grouplist[$ctr]; + $showgroups[] = [$group,$userops->UserInGroup($userid,$group->id)]; } - else { - echo $image_false; - } - } - echo "id."\">".$image_permissions."id."\">".$image_groupassign."id."\">"; - echo $themeObject->DisplayImage('icons/system/edit.gif', lang('edit'),'','','systemicon'); - echo "id."\" onclick=\"return confirm('".cms_html_entity_decode(lang('deleteconfirm', $onegroup->name) )."');\">"; - echo $themeObject->DisplayImage('icons/system/delete.gif', lang('delete'),'','','systemicon'); - echo " 
    \n"; - } - -if (check_permission($userid, 'Add Groups')) { -?> - - -
    -set_value('pagetitle', 'currentgroups'); + +$tpl = $smarty->createTemplate('admin_tpl:listgroups.tpl',null,null,$smarty,false); +$tpl->assign('padd',check_permission($userid,'Add Groups')) + ->assign('iconadd',$themeObject->DisplayImage('icons/system/newobject.gif',lang('addgroup'),'','','systemicon')) + ->assign('iconedit',$themeObject->DisplayImage('icons/system/edit.gif',lang('editgroup'),'','','systemicon')) + ->assign('icondelete',$themeObject->DisplayImage('icons/system/delete.gif',lang('delete'),'','','systemicon')) + ->assign('icontrue',$themeObject->DisplayImage('icons/system/true.gif',lang('true'),'','','systemicon')) + ->assign('iconfalse',$themeObject->DisplayImage('icons/system/false.gif',lang('false'),'','','systemicon')) + ->assign('icongroup',$themeObject->DisplayImage('icons/system/groupassign.gif',lang('assignments'),'','','systemicon')) + ->assign('iconperms',$themeObject->DisplayImage('icons/system/permissions.gif',lang('permissions'),'','','systemicon')) + ->assign('grouplist',$showgroups); +if (($n = count($grouplist)) > $limit) { + $tpl->assign('pagination',pagination($page,$n,$limit)); +} +$tpl->display(); -?> +require_once 'footer.php'; diff --git a/admin/listjobs.php b/admin/listjobs.php new file mode 100644 index 00000000..22ab264e --- /dev/null +++ b/admin/listjobs.php @@ -0,0 +1,199 @@ + + +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, read the license online at: +https://www.gnu.org/licenses/old-licenses/gpl-2.0.html +*/ + +use CMSMS\Async\Job; +use CMSMS\Async\RegularJob; +use CMSMS\JobOperations; + +global $CMS_ADMIN_PAGE; +$CMS_ADMIN_PAGE = 1; +require_once '../lib/include.php'; + +$userid = get_userid(); +if( !check_permission($userid,'Manage Jobs') ) { + exit(lang('no_permission')); //TODO throw if can be caught +} + +require_once 'header.php'; + +$me = basename(__FILE__); +$gap = JobOperations::get_async_freq(); +$config = cms_config::get_instance(); + +$locked = JobOperations::is_locked(); +if( $locked ) { + if( JobOperations::lock_expired() ) { + debug_to_log($me.': Removing an expired lock (probably an error occurred)'); + audit('',$me,'Removing an expired lock. An error probably occurred with a previous job.'); + JobOperations::unlock(); + $locked = false; + } +} +$now = time(); // in case it's locked +if( !$locked ) { + // replicate parts of backend-processor script to get fresh snapshot + //TODO error-recording needed here too + JobOperations::lock(); // block parallel processing + + $prior = (int)JobOperations::retrieve_timestamp(0,'last_processing'); + if( $prior > $now - $gap - 10 ) { + // fake value to ensure jobs can refreshed now + JobOperations::record_timestamp(0,'tasks_lastcheck',$now - $gap - 10); + } + + $db = CmsApp::get_instance()->GetDb(); + $save_time = function($job_id,$stamp) use($db) + { + $sql = 'UPDATE '.CMS_DB_PREFIX.JobOperations::RECORDTABLE.' SET start = ? WHERE id = ?'; + $db->Execute($sql,[$stamp,$job_id]); + }; + $devreport = !empty($config['developer_mode']); + $time_limit = JobOperations::get_batch_timeout(); + + try { + JobOperations::process_errors(); + JobOperations::clear_bad_jobs(); + + $started_at = $now = time(); + + set_time_limit($time_limit); + JobOperations::record_eligible_jobs(); + $jobs = JobOperations::get_jobs(); + + foreach( $jobs as $job ) { + // skip future-start jobs + if( (int)$job->start > $now ) { // OR allow a little slop ? + continue; //ASYNCDEBUG + } + try { + if( $job instanceof RegularJob ) { + $nextat = 1; // force a downstream test whether to execute now + } else { + $nextat = JobOperations::calculate_next_start_time($job); + } + if( $nextat == 0 ) { + if( $job->id > 0 ) { + $job->delete(); + } + } + elseif( $nextat <= time() + 1 ) { // checking $now is bad when debugging ASYNCDEBUG + $pst = $job->start; + $res = $job->execute($now); // updates start property to $now + if( $job->start != $pst ) { //TODO $res (API change) unreliable ? + $job->save(); // record updated start, errors TODO etc? might be whole job re-inserted + if( $devreport ) { + audit('',$me,'Processed job '.$job->name); + } + } + else { + $here = 2; //ASYNC DEBUG + } + } + else { + $here = 3; //ASYNC DEBUG + } + } + catch( Exception $e ) { + audit($job->id,$me,'Job \''.$job->name.'\' error: '.$e->getMessage() ); + } + $now = time(); // update for timeout-check + // make sure we have not timed out + if( $now - $time_limit >= $started_at ) { + break; // ASYNCDEBUG $here = 1; + } + } + // defer the next jobs-poll + JobOperations::record_timestamp(0,'last_async_trigger',$now); + } + catch( Exception $e ) { + // some other error occurred + debug_to_log('--Major async processing exception--'); + debug_to_log('exception '.$e->GetMessage()); + debug_to_log($e->GetTraceAsString()); + } + JobOperations::unlock(); + JobOperations::record_timestamp(0,'last_processing',$now); +} + +// setup for display +$nozone = true; +$jobs = []; +$job_objs = JobOperations::get_jobs_for_display(); +if( $job_objs ) { + $list = []; + $list[Job::RECUR_15M] = lang('recur_15m'); + $list[Job::RECUR_30M] = lang('recur_30m'); + $list[Job::RECUR_HOURLY] = lang('recur_hourly'); + $list[Job::RECUR_120M] = lang('recur_120m'); + $list[Job::RECUR_180M] = lang('recur_180m'); + $list[Job::RECUR_DAILY] = lang('recur_daily'); + $list[Job::RECUR_WEEKLY] = lang('recur_weekly'); + $list[Job::RECUR_MONTHLY] = lang('recur_monthly'); + $list[Job::RECUR_YEARLY] = lang('recur_yearly'); + + $offs = 0; + $zone = $config['timezone']; + if( $zone && $zone != 'UTC' ) { + try { + $dt = new DateTime('@0', new DateTimeZone('UTC')); + $tz = new DateTimeZone($zone); + $offs = $tz->getOffset($dt); + $nozone = false; + } + catch( Exception $e ) { + // nothing here + } + } + + foreach( $job_objs as $job ) { + $obj = new stdClass(); + $obj->name = $job->name; + $obj->desc = $job->description ?: null; + $obj->module = $job->module ?: null; + $rec = $job->displayrecr; // anything custom is preferred + if( !$rec ) { + if( JobOperations::job_recurs($job) ) { + $rec = $job->recurs; + if( array_key_exists($rec,$list) ) { $rec = $list[$rec]; } + } + else { + $rec = null; + } + } + $obj->recurs = $rec; + $start = $job->start; + $obj->created = ($start == 0) ? $job->created : (($start > $now) ? $job->created : null); //not displayed unless differs from start + $obj->start = $start; + $obj->until = ($job->until) ? $job->until + $offs : null; + $obj->errors = $job->errors; + $jobs[] = $obj; + } +} + +$pdev = check_permission($userid,'Modify Site Preferences') || !empty($config['developer_mode']); // whether to also display extra information suitable for site-developers + +$smarty->changeCaching(false); +$tpl = $smarty->createTemplate('admin_tpl:listjobs.tpl',null,null,$smarty,false); +$tpl->assign('pdev',$pdev) + ->assign('async_freq',$gap) + ->assign('gmtime',$nozone) + ->assign('jobs',$jobs) + ->display(); + +require_once 'footer.php'; diff --git a/admin/listtags.php b/admin/listtags.php index fe015028..fd4e6ba9 100644 --- a/admin/listtags.php +++ b/admin/listtags.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,53 +15,46 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: listtags.php 11342 2017-07-04 16:50:35Z calguy1000 $ +#$Id$ -$CMS_ADMIN_PAGE=1; -$CMS_LOAD_ALL_PLUGINS=1; +$CMS_ADMIN_PAGE = 1; +//$CMS_LOAD_ALL_PLUGINS = 1; ? -require_once("../lib/include.php"); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +require_once "../lib/include.php"; check_login(); - -$plugin = ""; -if (isset($_GET["plugin"])) $plugin = basename(cleanValue($_GET["plugin"])); - -$type = ""; -if (isset($_GET["type"])) $type = basename(cleanValue($_GET["type"])); - -$action = ""; -if (isset($_GET["action"])) $action = cleanValue($_GET["action"]); - $userid = get_userid(); $access = check_permission($userid, "View Tag Help"); - -if (!$access) { - die('Permission Denied'); - return; +if( !$access ) { + exit(lang('no_permission')); //TODO throw if can be caught } -$dirs = []; -$dirs[] = $config['root_path'].'/assets/plugins'; -$dirs[] = $config['root_path'].'/plugins'; -$dirs[] = $config['root_path'].'/lib/plugins'; -$dirs[] = $config['admin_path'].'/plugins'; +$plugin = (isset($_GET["plugin"])) ? basename(cleanValue($_GET["plugin"])) : ''; +$type = (isset($_GET["type"])) ? basename(cleanValue($_GET["type"])) : ''; +$action = (isset($_GET["action"])) ? cleanValue($_GET["action"]) : ''; + $config = cmsms()->GetConfig(); +$dirs = []; +$dirs[] = CMS_ROOT_PATH.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'plugins'; +$dirs[] = CMS_ROOT_PATH.DIRECTORY_SEPARATOR.'plugins'; +$dirs[] = CMS_ROOT_PATH.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'plugins'; +$dirs[] = $config['admin_path'].DIRECTORY_SEPARATOR.'plugins'; -$find_file = function($filename) use ($dirs) { - $filename = basename($filename); // no sneaky paths - foreach( $dirs as $dir ) { - $fn = "$dir/$filename"; +$find_file = function($filename) use($dirs) { + $dn = DIRECTORY_SEPARATOR.basename($filename); // no sneaky paths + foreach( $dirs as $one ) { + $fn = "$one{$dn}"; if( is_file($fn) ) return $fn; } + return ''; }; -include_once("header.php"); -$smarty = cmsms()->GetSmarty(); -$smarty->assign('header',$themeObject->ShowHeader('tags')); +require_once 'header.php'; -if ($action == "showpluginhelp") { +$themeObject->set_value('pagetitle','tags'); +$tpl = $smarty->createTemplate('admin_tpl:listtags.tpl',null,null,$smarty,false); + +if( $action == "showpluginhelp" ) { $content = ''; $file = $find_file("$type.$plugin.php"); if( is_file($file) ) require_once($file); @@ -74,50 +66,52 @@ $content = @ob_get_contents(); @ob_end_clean(); } - else if( CmsLangOperations::key_exists("help_{$type}_{$plugin}",'tags') ) { + elseif( CmsLangOperations::key_exists("help_{$type}_{$plugin}",'tags') ) { $content = CmsLangOperations::lang_from_realm('tags',"help_{$type}_{$plugin}"); } - else if( CmsLangOperations::key_exists("help_{$type}_{$plugin}") ) { + elseif( CmsLangOperations::key_exists("help_{$type}_{$plugin}") ) { $content = lang("help_{$type}_{$plugin}"); } if( $content ) { - $smarty->assign('subheader',lang('pluginhelp',array($plugin))); - $smarty->assign('content',$content); + $tpl->assign('subheader',lang('pluginhelp',$plugin)); + $tpl->assign('content',$content); } else { - $smarty->assign('error',lang('nopluginhelp')); + $tpl->assign('error',lang('nopluginhelp')); } } -else if ($action == "showpluginabout") { +elseif( $action == "showpluginabout" ) { $file = $find_file("$type.$plugin.php"); if( file_exists($file) ) require_once($file); - $smarty->assign('subheader',lang('pluginabout',$plugin)); + $tpl->assign('subheader',lang('pluginabout',$plugin)); $func_name = 'smarty_cms_about_'.$type.'_'.$plugin; - if (function_exists($func_name)) { + if( function_exists($func_name) ) { @ob_start(); call_user_func_array($func_name, array()); $content = @ob_get_contents(); @ob_end_clean(); - $smarty->assign('content',$content); + $tpl->assign('content',$content); } else { - $smarty->assign('error',lang('nopluginabout')); + $tpl->assign('error',lang('nopluginabout')); } } else { + $urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; + $file_array = array(); + $files = array(); foreach( $dirs as $one ) { $files = array_merge($files,glob($one.'/*.php')); } - if( is_array($files) && count($files) ) { - $file_array = array(); - foreach($files as $onefile) { + if( $files ) { + foreach( $files as $onefile ) { $file = basename($onefile); $parts = explode('.',$file); - if( startswith($file,'prefilter.') || startswith($file,'postfilter.') ) continue; + if( startswith($file,'prefilter.') || startswith($file,'postfilter.') ) continue; if( !is_array($parts) || count($parts) != 3 ) continue; $rec = array(); @@ -129,18 +123,18 @@ include_once($onefile); if( !function_exists('smarty_'.$rec['type'].'_'.$rec['name']) && - !function_exists('smarty_nocache_'.$rec['type'].'_'.$rec['name']) && + !function_exists('smarty_nocache_'.$rec['type'].'_'.$rec['name']) && !function_exists('smarty_cms_'.$rec['type'].'_'.$rec['name']) ) continue; $rec['cachable'] = 'n_a'; if( $rec['type'] == 'function' && $rec['admin'] == 0 ) { - if( function_exists('smarty_cms_'.$rec['type'].'_'.$rec['name']) ) { + if( function_exists('smarty_cms_'.$rec['type'].'_'.$rec['name']) ) { //this test probably bogus now $rec['cachable'] = 'no'; } - else if( function_exists('smarty_nocache_'.$rec['type'].'_'.$rec['name']) ) { + elseif( function_exists('smarty_nocache_'.$rec['type'].'_'.$rec['name']) ) { $rec['cachable'] = 'no'; } - else if( function_exists('smarty_'.$rec['type'].'_'.$rec['name']) ) { + elseif( function_exists('smarty_'.$rec['type'].'_'.$rec['name']) ) { $rec['cachable'] = 'yes'; } } @@ -148,10 +142,10 @@ if( function_exists("smarty_cms_help_".$rec['type']."_".$rec['name']) ) { $rec['help_url'] = 'listtags.php'.$urlext.'&action=showpluginhelp&plugin='.$rec['name'].'&type='.$rec['type']; } - else if( CmsLangOperations::key_exists('help_'.$rec['type'].'_'.$rec['name'],'tags') ) { + elseif( CmsLangOperations::key_exists('help_'.$rec['type'].'_'.$rec['name'],'tags') ) { $rec['help_url'] = 'listtags.php'.$urlext.'&action=showpluginhelp&plugin='.$rec['name'].'&type='.$rec['type']; } - else if( CmsLangOperations::key_exists('help_'.$rec['type'].'_'.$rec['name']) ) { + elseif( CmsLangOperations::key_exists('help_'.$rec['type'].'_'.$rec['name']) ) { $rec['help_url'] = 'listtags.php'.$urlext.'&action=showpluginhelp&plugin='.$rec['name'].'&type='.$rec['type']; } @@ -164,35 +158,29 @@ } // add in standard tags... - $rec = array('type'=>'function','name'=>'content'); + $rec = array('type'=>'function','name'=>'content','cachable'=>'no'); $rec['help_url'] = 'listtags.php'.$urlext.'&action=showpluginhelp&plugin='.$rec['name'].'&type='.$rec['type']; - $rec['cachable'] = 'no'; $file_array[] = $rec; - $rec = array('type'=>'function','name'=>'content_image'); + $rec = array('type'=>'function','name'=>'content_image','cachable'=>'no'); $rec['help_url'] = 'listtags.php'.$urlext.'&action=showpluginhelp&plugin='.$rec['name'].'&type='.$rec['type']; - $rec['cachable'] = 'no'; $file_array[] = $rec; - $rec = array('type'=>'function','name'=>'content_module'); + $rec = array('type'=>'function','name'=>'content_module','cachable'=>'no'); $rec['help_url'] = 'listtags.php'.$urlext.'&action=showpluginhelp&plugin='.$rec['name'].'&type='.$rec['type']; - $rec['cachable'] = 'no'; $file_array[] = $rec; - $rec = array('type'=>'function','name'=>'process_pagedata'); + $rec = array('type'=>'function','name'=>'process_pagedata','cachable'=>'no'); $rec['help_url'] = 'listtags.php'.$urlext.'&action=showpluginhelp&plugin='.$rec['name'].'&type='.$rec['type']; - $rec['cachable'] = 'no'; $file_array[] = $rec; - function listtags_plugin_sort($a,$b) - { + usort($file_array,function($a,$b) { return strcmp($a['name'],$b['name']); - } - - usort($file_array,'listtags_plugin_sort'); + }); - $smarty->assign('plugins',$file_array); + $tpl->assign('plugins',$file_array); } -echo $smarty->fetch('listtags.tpl'); -include_once("footer.php"); +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/listusers.php b/admin/listusers.php index 90b46e61..bb2d954c 100644 --- a/admin/listusers.php +++ b/admin/listusers.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,9 +15,9 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: listusers.php 11099 2017-03-01 18:21:57Z calguy1000 $ +#$Id$ -use \CMSMS\HookManager; +use CMSMS\HookManager; $CMS_ADMIN_PAGE = 1; require_once ('../lib/include.php'); @@ -27,8 +26,7 @@ $userid = get_userid(); if (!check_permission($userid, 'Manage Users')) { - die('Permission Denied'); - return; + exit(lang('no_permission')); //TODO throw if can be caught } /*-------------------- @@ -38,7 +36,7 @@ $urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]; $gCms = cmsms(); $db = $gCms->GetDb(); -$templateuser = cms_siteprefs::get('template_userid'); +//$templateuser = cms_siteprefs::get('template_userid'); $page = 1; $limit = 100; $message = ''; @@ -50,7 +48,7 @@ ---------------------*/ if( isset($_GET['switchuser']) ) { - // switch user functionality is only allowed to members of the admin group + // switch user functionality is allowed only to members of the admin group (? not necessarily user 1) if( !\UserOperations::get_instance()->UserInGroup($userid,1) ) { $error .= '
  • '.lang('permissiondenied').'
  • '; } else { @@ -63,9 +61,8 @@ $error .= '
  • '.lang('userdisabled').'
  • '; } else { - CMSMS\LoginOperations::get_instance()->set_effective_user($to_user); - $urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]; - redirect('index.php'.$urlext); + CMSMS\internal\LoginOperations::get_instance()->set_effective_user($to_user); + redirect('index.php'.$urlext.'§ion=usersgroups'); } } } @@ -80,13 +77,13 @@ $result = false; $thisuser->active == 1 ? $thisuser->active = 0 : $thisuser->active = 1; - HookManager::do_hook('Core::EditUserPre', [ 'user' => &$thisuser ] ); + HookManager::do_hook('Core::EditUserPre', [ 'user' => $thisuser ]); $result = $thisuser->save(); if ($result) { // put mention into the admin log - audit($userid, 'Admin Username: ' . $thisuser->username, 'Edited'); - HookManager::do_hook('Core::EditUserPost', [ 'user' => &$thisuser ] ); + audit($userid, 'Admin user', "Edited: $thisuser->username"); + HookManager::do_hook('Core::EditUserPost', [ 'user' => $thisuser ]); } else { $error .= "
  • " . lang('errorupdatinguser') . "
  • "; } @@ -110,10 +107,10 @@ continue; // can't delete user who owns pages. // ready to delete. - HookManager::do_hook('Core::DeleteUserPre', [ 'user'=>&$oneuser ] ); + HookManager::do_hook('Core::DeleteUserPre', [ 'user'=>$oneuser ]); $oneuser->Delete(); - HookManager::do_hook('Core::DeleteUserPost', [ 'user'=>&$oneuser ] ); - audit($uid, 'Admin Username: ' . $oneuser->username, 'Deleted'); + HookManager::do_hook('Core::DeleteUserPost', [ 'user'=>$oneuser ]); + audit($uid, 'Admin user', "Deleted: $oneuser->username"); $ndeleted++; } if ($ndeleted > 0) { @@ -130,10 +127,10 @@ $oneuser = $userops->LoadUserById($uid); if (!is_object($oneuser)) continue; // invalid user - HookManager::do_hook('Core::EditUserPre', [ 'user'=>&$oneuser ] ); + HookManager::do_hook('Core::EditUserPre', [ 'user'=>$oneuser ]); cms_userprefs::remove_for_user($uid); - HookManager::do_hook('Core::EditUserPost', [ 'user'=>&$oneuser ] ); - audit($uid, 'Admin Username: ' . $oneuser->username, 'Settings cleared'); + HookManager::do_hook('Core::EditUserPost', [ 'user'=>$oneuser ]); + audit($uid, 'Admin user', "Cleared all settings of $oneuser->username"); $nusers++; } if ($nusers > 0) { @@ -157,13 +154,13 @@ $oneuser = $userops->LoadUserById($uid); if (!is_object($oneuser)) continue; // invalid user - HookManager::do_hook('Core::EditUserPre', [ 'user'=>&$oneuser ] ); + HookManager::do_hook('Core::EditUserPre', [ 'user'=>$oneuser ]); cms_userprefs::remove_for_user($uid); foreach ($prefs as $k => $v) { cms_userprefs::set_for_user($uid, $k, $v); } - HookManager::do_hook('Core::EditUserPost', [ 'user'=>&$oneuser ] ); - audit($uid, 'Admin Username: ' . $oneuser->username, 'Settings cleared'); + HookManager::do_hook('Core::EditUserPost', [ 'user'=>$oneuser ]); + audit($uid, 'Admin user', "Cleared all settings of $oneuser->username"); $nusers++; } } @@ -186,11 +183,11 @@ if (!is_object($oneuser)) continue; // invalid user if ($oneuser->active) { - HookManager::do_hook('Core::EditUserPre', [ 'user'=>&$oneuser ] ); + HookManager::do_hook('Core::EditUserPre', [ 'user'=>$oneuser ]); $oneuser->active = 0; $oneuser->save(); - HookManager::do_hook('Core::EditUserPost', [ 'user'=>&$oneuser ] ); - audit($uid, 'Admin Username: ' . $oneuser->username, 'Disabled'); + HookManager::do_hook('Core::EditUserPost', [ 'user'=>$oneuser ]); + audit($uid, 'Admin user', "Disabled: $oneuser->username"); $nusers++; } } @@ -211,11 +208,11 @@ if (!is_object($oneuser)) continue; // invalid user if (!$oneuser->active) { - HookManager::do_hook('Core::EditUserPre', [ 'user'=>&$oneuser ] ); + HookManager::do_hook('Core::EditUserPre', [ 'user'=>$oneuser ]); $oneuser->active = 1; $oneuser->save(); - HookManager::do_hook('Core::EditUserPost', [ 'user'=>&$oneuser ] ); - audit($uid, 'Admin Username: ' . $oneuser->username, 'Enabled'); + HookManager::do_hook('Core::EditUserPost', [ 'user'=>$oneuser ]); + audit($uid, 'Admin user', "Enabled: $oneuser->username"); $nusers++; } } @@ -230,34 +227,31 @@ * Display view ---------------------*/ -include_once ('header.php'); +require_once 'header.php'; -if (false == empty($error)) echo $themeObject->ShowErrors(''); +if (!empty($error)) $themeObject->ShowErrors(''); if (isset($_GET["message"])) $message = preg_replace('/\

    ' . $message . '

    '; +if (!empty($message)) echo '

    ' . $message . '

    '; // OR $themeObject->ShowMessage()? -$out = array(); +$out = []; $offset = ((int)$page - 1) * $limit; $userlist = $userops->LoadUsers($limit, $offset); -$is_admin = $userops->UserInGroup($userid,1); +$is_admin = $userops->UserInGroup($userid, 1); // OR bullet-proof ->IsSuperuser($userid) ? +$usage = []; // extra properties -foreach ($userlist as $one) { - $out[$one->id] = $one->username; +foreach ($userlist as &$one) { + $uid = $one->id; + $out[$uid] = $one->username; + $usage[$uid]['access_to_user'] = (!$is_admin && $userops->UserInGroup($uid, 1)) ? 0 : 1; } +unset($one); -foreach ($userlist as &$oneuser) { - $oneuser->access_to_user = 1; +$tpl = $smarty->createTemplate('admin_tpl:listusers.tpl', null, null, $smarty, false); +$tpl->assign('is_admin', $is_admin) + ->assign('users', $userlist) + ->assign('my_userid', $userid) + ->assign('userlist', $out) + ->assign('usage', $usage); +$tpl->display(); - if ($userops->UserInGroup($oneuser->id, 1) && !$userops->UserInGroup($userid, 1)) $oneuser->access_to_user = 0; - $oneuser->pagecount = $userops->CountPageOwnershipById($oneuser->id); -} - -$smarty->assign('is_admin',$is_admin); -$smarty->assign('users', $userlist); -$smarty->assign('my_userid', get_userid()); -$smarty->assign('urlext', $urlext); -$smarty->assign('userlist', $out); - -$smarty->display('listusers.tpl'); - -include_once ('footer.php'); +require_once 'footer.php'; diff --git a/admin/listusertags.php b/admin/listusertags.php index 4145f4af..98378134 100644 --- a/admin/listusertags.php +++ b/admin/listusertags.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,38 +15,40 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: listusertags.php 11583 2018-02-03 16:49:10Z calguy1000 $ +#$Id$ -$CMS_ADMIN_PAGE=1; +$CMS_ADMIN_PAGE = 1; + +require_once '../lib/include.php'; -require_once("../lib/include.php"); check_login(); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; $userid = get_userid(); $access = check_permission($userid, 'Modify User-defined Tags'); if (!$access) { - die('Permission Denied'); - return; + exit(lang('no_permission')); //TODO throw if can be caught } -include_once("header.php"); +require_once 'header.php'; + +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; function listudt_summarize($str,$numwords,$ets='...') { + if( !$str ) { return (string)$str; } $str = strip_tags($str); $stringarray = explode(" ",$str); $numwords = min(max($numwords,1),100); - if( $numwords >= count($stringarray) ) return $str; + if( $numwords >= count($stringarray) ) { return $str; } $tmp = array_slice($stringarray,0,$numwords); $tmp = implode(' ',$tmp).$ets; return $tmp; } -if (FALSE == empty($_GET['message'])) echo $themeObject->ShowMessage(lang($_GET['message'])); +if (!empty($_GET['message'])) $themeObject->ShowMessage(lang($_GET['message'])); $list = UserTagOperations::get_instance()->ListUserTags(); -$tags = null; -if( count($list) ) { +$tags = []; +if( $list && is_array($list) ) { foreach( $list as $id => $label ) { $tag = UserTagOperations::get_instance()->GetUserTag($id); $rec = array(); @@ -57,9 +58,10 @@ function listudt_summarize($str,$numwords,$ets='...') $tags[$id] = $rec; } } -$smarty = \Smarty_CMS::get_instance(); -$smarty->assign('tags',$tags); -$smarty->assign('addurl','editusertag.php'.$urlext); -$smarty->assign('urlext',$urlext); -echo $smarty->display('listusertags.tpl'); -include_once("footer.php"); + +$tpl = $smarty->createTemplate('admin_tpl:listusertags.tpl',null,null,$smarty,false); +$tpl->assign('tags',$tags) + ->assign('addurl','editusertag.php'.$urlext); +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/login.php b/admin/login.php index 078b6c80..710c3582 100644 --- a/admin/login.php +++ b/admin/login.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 @@ -13,18 +12,19 @@ #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 +#along with this program. If not, read the license online at +#https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # #$Id$ -namespace CMSMS; +use CMSMS\HookManager; +use CMSMS\internal\LoginOperations; -$CMS_ADMIN_PAGE=1; -$CMS_LOGIN_PAGE=1; +$CMS_ADMIN_PAGE = 1; +$CMS_LOGIN_PAGE = 1; require_once("../lib/include.php"); -$gCms = \CmsApp::get_instance(); +$gCms = CmsApp::get_instance(); $db = $gCms->GetDb(); // if we allow modules to do the login operations @@ -32,7 +32,7 @@ // getloginModule // call the module's getLoginForm() action // -$login_ops = \CMSMS\LoginOperations::get_instance(); +$login_ops = LoginOperations::get_instance(); $error = ""; $forgotmessage = ""; @@ -45,27 +45,27 @@ * @param User $user * @return results from the attempt to send a message. */ -function send_recovery_email(\User $user) +function send_recovery_email(User $user) { - $gCms = \CmsApp::get_instance(); + $gCms = CmsApp::get_instance(); $config = $gCms->GetConfig(); - $obj = new \cms_mailer; + $obj = new cms_mailer(); $obj->IsHTML(TRUE); $obj->AddAddress($user->email, html_entity_decode($user->firstname . ' ' . $user->lastname)); - $obj->SetSubject(lang('lostpwemailsubject',html_entity_decode(get_site_preference('sitename','CMSMS Site')))); + $obj->SetSubject(lang('lostpwemailsubject',html_entity_decode(cms_siteprefs::get('sitename','CMSMS Site')))); $code = md5(md5(__FILE__ . '--' . $user->username . md5($user->password.time()))); - \cms_userprefs::set_for_user( $user->id, 'pwreset', $code ); + cms_userprefs::set_for_user( $user->id, 'pwreset', $code ); $url = $config['admin_url'] . '/login.php?recoverme=' . $code; - $body = lang('lostpwemail',html_entity_decode(get_site_preference('sitename','CMSMS Site')), $user->username, $url, $url); + $body = lang('lostpwemail',html_entity_decode(cms_siteprefs::get('sitename','CMSMS Site')), $user->username, $url, $url); $obj->SetBody($body); if( $obj->Send() ) { - audit('','Core','Sent Lost Password Email for '.$user->username); + audit($user->id,'Core','Sent lost password email to '.$user->username); return true; } - audit('','Core','Failed to send Lost Password Email for '.$user->username); + audit($user->id,'Core','Failed to send lost password email to '.$user->username); return false; } @@ -79,14 +79,14 @@ function send_recovery_email(\User $user) function find_recovery_user($hash) { if( $hash ) { - $gCms = \CmsApp::get_instance(); - $userops = $gCms->GetUserOperations(); - - foreach ($userops->LoadUsers() as $user) { - $code = \cms_userprefs::get_for_user( $user->id, 'pwreset' ); - if( $code && $hash === $code ) { //OR hash_equals($hash, $code) PHP 5.6+ + $gCms = CmsApp::get_instance(); + $userops = $gCms->GetUserOperations(); + // TODO avoid creating all User-objects merely to try to find one of them + foreach ($userops->LoadUsers() as $user) { + $code = cms_userprefs::get_for_user( $user->id, 'pwreset' ); + if( $code && $hash === $code ) { //timing attack, hence hash_equals($hash, $code), not a factor here return $user; - } + } } } return null; @@ -101,7 +101,7 @@ function find_recovery_user($hash) $userops = $gCms->GetUserOperations(); $forgot_username = cms_html_entity_decode($_REQUEST['forgottenusername']); unset($_REQUEST['forgottenusername'],$_POST['forgottenusername']); - \CMSMS\HookManager::do_hook('Core::LostPassword', [ 'username'=>$forgot_username] ); + HookManager::do_hook('Core::LostPassword', [ 'username'=>$forgot_username]); $oneuser = $userops->LoadUserByUsername($forgot_username); unset($_REQUEST['loginsubmit'],$_POST['loginsubmit']); @@ -118,7 +118,7 @@ function find_recovery_user($hash) } else { unset($_POST['username'],$_POST['password'],$_REQUEST['username'],$_REQUEST['password']); - \CMSMS\HookManager::do_hook('Core::LoginFailed', [ 'user'=>$forgot_username ] ); + HookManager::do_hook('Core::LoginFailed', [ 'user'=>$forgot_username ]); $error = lang('usernotfound'); } } @@ -137,15 +137,15 @@ function find_recovery_user($hash) $error = lang('usernotfound'); } else { - if ($_REQUEST['password'] != '') { + if ($_REQUEST['password']) { if ($_REQUEST['password'] == $_REQUEST['passwordagain']) { $user->SetPassword($_REQUEST['password']); $user->Save(); // put mention into the admin log - \cms_userprefs::remove_for_user( $user->id, 'pwreset' ); - $ip_passw_recovery = \cms_utils::get_real_ip(); - audit('','Core','Completed lost password recovery for: '.$user->username.' (IP: '.$ip_passw_recovery.')'); - \CMSMS\HookManager::do_hook('Core::LostPasswordReset', [ 'uid'=>$user->id, 'username'=>$user->username, 'ip'=>$ip_passw_recovery ] ); + cms_userprefs::remove_for_user( $user->id, 'pwreset' ); + $ip_passw_recovery = cms_utils::get_real_ip(); + audit($user->id,'Core','Completed lost password recovery for '.$user->username.' (IP: '.$ip_passw_recovery.')'); + HookManager::do_hook('Core::LostPasswordReset', [ 'uid'=>$user->id, 'username'=>$user->username, 'ip'=>$ip_passw_recovery ]); $acceptLogin = lang('passwordchangedlogin'); $changepwhash = ''; } @@ -155,7 +155,7 @@ function find_recovery_user($hash) } } else { - $error = lang('nofieldgiven', array(lang('password'))); + $error = lang('nofieldgiven', lang('password')); $changepwhash = $_REQUEST['changepwhash']; } } @@ -168,10 +168,10 @@ function find_recovery_user($hash) debug_buffer("Logging out. Cleaning cookies and session variables."); $userid = $login_ops->get_loggedin_uid(); $username = $login_ops->get_loggedin_username(); - \CMSMS\HookManager::do_hook('Core::LogoutPre', [ 'uid'=>$userid, 'username'=>$username ] ); + HookManager::do_hook('Core::LogoutPre', [ 'uid'=>$userid, 'username'=>$username ]); $login_ops->deauthenticate(); // unset all the cruft needed to make sure we're logged in. - \CMSMS\HookManager::do_hook('Core::LogoutPost', [ 'uid'=>$userid, 'username'=>$username ] ); - audit($userid, "Admin Username: ".$username, 'Logged Out'); + HookManager::do_hook('Core::LogoutPost', [ 'uid'=>$userid, 'username'=>$username ]); + audit($userid, 'Admin user', 'Logged out'); } if( isset($_POST['logincancel']) ) { @@ -181,63 +181,83 @@ function find_recovery_user($hash) else if( isset($_POST['loginsubmit']) ) { // login form submitted $login_ops->deauthenticate(); - $username = $password = null; - if (isset($_POST["username"])) $username = cleanValue($_POST["username"]); - if (isset($_POST["password"])) $password = $_POST["password"]; + $username = ''; + if( isset($_POST["username"]) ) $username = cleanValue($_POST["username"]); + $password = ''; + if( isset($_POST["password"]) ) $password = $_POST["password"]; unset($_POST['username'],$_POST['password'],$_REQUEST['username'],$_REQUEST['password']); $userops = $gCms->GetUserOperations(); - class CmsLoginError extends \CmsException {} + class CmsLoginError extends CmsException {} try { - if( !$username || !$password ) throw new \LogicException(lang('usernameincorrect')); + if( !$username || !$password ) throw new LogicException(lang('usernameincorrect')); + + // send a pre-login event (pre-2.2.7 used key 'user' instead of 'username') + HookManager::do_hook('Core::LoginPre', [ 'username'=>$username, 'password'=>$password ]); + // if a LoginPre handler doesn't return here, it must locally perform all the following // load user by name - // do hooks for authentication $oneuser = $userops->LoadUserByUsername($username, $password, TRUE, TRUE); - // $oneuser = $userops->LoadUserByUsername($username, $password, TRUE, TRUE); if( !$oneuser ) throw new CmsLoginError(lang('usernameincorrect')); - \CMSMS\HookManager::do_hook('Core::LoginPre', [ 'user'=>$oneuser ] ); - $login_ops->save_authentication($oneuser); + // send a post-pw-check event (in case MFA is deployed) + HookManager::do_hook('Core::LoginPassed', [ 'user'=>$oneuser ]); + // if a LoginPassed handler doesn't return here, it must locally perform all the following + // put mention into the admin log - audit($oneuser->id, "Admin Username: ".$oneuser->username, 'Logged In'); + audit($oneuser->id, 'Admin user', 'Logged in'); - // send the post login event - \CMSMS\HookManager::do_hook('Core::LoginPost', [ 'user'=>$oneuser ] ); + // send a post-login event + HookManager::do_hook('Core::LoginPost', [ 'user'=>$oneuser ]); - // redirect outa hre somewhere + // redirect outa here somewhere if( isset($_SESSION['login_redirect_to']) ) { // we previously attempted a URL but didn't have the user key in the request. - $url_ob = new \cms_url($_SESSION['login_redirect_to']); + $url_ob = new cms_url($_SESSION['login_redirect_to']); unset($_SESSION['login_redirect_to']); $url_ob->erase_queryvar('_s_'); $url_ob->erase_queryvar('sp_'); $url_ob->set_queryvar(CMS_SECURE_PARAM_NAME,$_SESSION[CMS_USER_KEY]); $url = (string) $url_ob; redirect($url); - } else { - // find the users homepage, if any, and redirect there. - $homepage = \cms_userprefs::get_for_user($oneuser->id,'homepage'); - if( !$homepage ) $homepage = $config['admin_url']; - - $homepage = \CmsAdminUtils::get_session_url($homepage); - - // and redirect. + } + else { + // find the user's homepage, if any, and redirect there. + $homepage = cms_userprefs::get_for_user($oneuser->id,'homepage'); + if( !$homepage ) { + $homepage = $config['admin_url']; + } +/* elseif( 0 ) { + url should be rel. to $config['admin_url'] + //TODO somewhere, efficiently check page ok (FR#12400) + //e.g. after each system upgrade and after each module-uninstall or -deactivate + $homepage = $config['admin_url']; + } +*/ + $homepage = CmsAdminUtils::get_session_url($homepage); // involves deprecated conversion of 'placeholders'. instead use verbatim $homepage = html_entity_decode($homepage); redirect($homepage); } } - catch( \Exception $e ) { + catch( Exception $e ) { $error = $e->GetMessage(); - debug_buffer("Login failed. Error is: " . $error); - \CMSMS\HookManager::do_hook('Core::LoginFailed', [ 'user'=>$username ] ); + debug_buffer("Login failed. Error was: " . $error); + if( $username ) { + HookManager::do_hook('Core::LoginFailed', [ 'user'=>$username ]); + } // put mention into the admin log - $ip_login_failed = \cms_utils::get_real_ip(); - audit('', '(IP: ' . $ip_login_failed . ') ' . "Admin Username: " . $username, 'Login Failed'); + $ip_login_failed = cms_utils::get_real_ip(); + if( !empty($oneuser) ) { + $id = $oneuser->id; + } + else { + $id = ''; + } + audit($id, 'Admin user', "Login failed (IP: $ip_login_failed)"); } } @@ -247,9 +267,11 @@ class CmsLoginError extends \CmsException {} // Language shizzle cms_admin_sendheaders(); -header("Content-Language: " . \CmsNlsOperations::get_current_language()); +header("Content-Language: " . CmsNlsOperations::get_current_language()); +header("Cache-Control: no-store"); +header("Expires: 0"); -$themeObject = \cms_utils::get_theme_object(); +$themeObject = cms_utils::get_theme_object(); $vars = array('error'=>$error); if( isset($warningLogin) ) $vars['warningLogin'] = $warningLogin; if( isset($acceptLogin) ) $vars['acceptLogin'] = $acceptLogin; diff --git a/admin/loginstyle.php b/admin/loginstyle.php index 3dae62d6..6d29c992 100644 --- a/admin/loginstyle.php +++ b/admin/loginstyle.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 @@ -13,40 +12,36 @@ #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 +#along with this program. If not, read the license online at +#https://www.gnu.org/licenses/#LicenseURLs # -#$Id: login.php 4251 2007-11-15 21:34:40Z calguy1000 $ +#$Id$ -$CMS_ADMIN_PAGE=1; -$CMS_LOGIN_PAGE=1; +$CMS_ADMIN_PAGE = 1; +$CMS_LOGIN_PAGE = 1; -require_once("../lib/include.php"); -require_once("../lib/classes/class.user.inc.php"); +require_once '../lib/include.php'; +//require_once '../lib/classes/class.User.php'; $themeObject = cms_utils::get_theme_object(); $theme = $themeObject->themeName; -$cms_readfile = function($filename) { - @ob_start(); - echo file_get_contents($filename); - $result = @ob_get_contents(); - @ob_end_clean(); - if( !empty($result) ) { - echo $result; - return TRUE; - } - return FALSE; -}; - -header("Content-type: text/css; charset=" . get_encoding()); -if (file_exists(dirname(__FILE__)."/themes/$theme/css/style.css")) { - echo file_get_contents(dirname(__FILE__)."/themes/$theme/css/style.css"); +header("Content-Type: text/css; charset=" . get_encoding()); +$fp = cms_join_path(__DIR__,'themes',$theme,'css','style.css'); +if (file_exists($fp)) { + echo file_get_contents($fp); } else { - echo file_get_contents(dirname(__FILE__)."/themes/OneEleven/css/style.css"); + echo file_get_contents(__DIR__."/themes/OneEleven/css/style.css"); } -if (file_exists(dirname(__FILE__)."/themes/".$theme."/extcss/style.css")) { - $cms_readfile(dirname(__FILE__)."/themes/".$theme."/extcss/style.css"); +$fp = cms_join_path(__DIR__,'themes',$theme,'extcss','style.css'); +if (file_exists($fp)) { + @ob_start(); //WHATFOR buffering? + echo file_get_contents($fp); + $result = @ob_get_contents(); + @ob_end_clean(); + if( $result ) { + echo $result; + } } diff --git a/admin/logout.php b/admin/logout.php index a222fe79..bb2a0714 100644 --- a/admin/logout.php +++ b/admin/logout.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,7 +15,7 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: logout.php 10530 2016-04-03 17:07:53Z calguy1000 $ +#$Id$ $CMS_ADMIN_PAGE=1; require_once("../lib/include.php"); diff --git a/admin/makebookmark.php b/admin/makebookmark.php deleted file mode 100644 index 4ec88140..00000000 --- a/admin/makebookmark.php +++ /dev/null @@ -1,45 +0,0 @@ -GetConfig(); -$link = base64_decode($_GET['ref'], TRUE); - -$newmark = new Bookmark(); -$newmark->user_id = get_userid(); -$newmark->url = $link; -$newmark->title = $_GET['title']; -$result = $newmark->save(); - -if( $result ) { - header('Location: //' . $link); -} -else { - redirect($config['admin_url'] . '/listbookmarks.php?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]); -} - -?> diff --git a/admin/moduleinterface.php b/admin/moduleinterface.php index 7d0d114b..4b71fdda 100644 --- a/admin/moduleinterface.php +++ b/admin/moduleinterface.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 @@ -9,99 +8,109 @@ #(at your option) any later version. # #This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANthe TY; without even the implied warranty of +#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 +#along with this program. If not, read the license online at +#https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # -#$Id: moduleinterface.php 12564 2020-09-27 15:43:03Z ruudvdvelden $ +#$Id$ -$CMS_ADMIN_PAGE=1; -$CMS_MODULE_PAGE=1; +$nomod = empty($_REQUEST['mact']); +if( !$nomod ) { + $ary = explode(',', $_REQUEST['mact'], 4); + if( empty($ary[0]) ) { // no module specified + $nomod = true; + } +} +if( $nomod ) { + require_once __DIR__.DIRECTORY_SEPARATOR.'index.php'; + return; +} + +$CMS_ADMIN_PAGE = 1; +$CMS_MODULE_PAGE = 1; $orig_memory = (function_exists('memory_get_usage')?memory_get_usage():0); $starttime = microtime(); -require_once("../lib/include.php"); -//$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'include.php'; check_login(); $userid = get_userid(); if( isset($_SESSION['cms_passthru']) ) { // remove me, this is a hack for something - $_REQUEST = array_merge($_REQUEST,$_SESSION['cms_passthru']); + $_REQUEST = array_merge($_REQUEST, $_SESSION['cms_passthru']); unset($_SESSION['cms_passthru']); } -$smarty = \Smarty_CMS::get_instance(); -// $smarty->assign('date_format_string',cms_userprefs::get_for_user($userid,'date_format_string','%x %X')); - -$id = 'm1_'; -$module = ''; -$action = 'defaultadmin'; -$suppressOutput = false; -if (isset($_REQUEST['mact'])) { - $ary = explode(',', cms_htmlentities($_REQUEST['mact']), 4); - $module = (isset($ary[0])?$ary[0]:''); - $id = (isset($ary[1])?$ary[1]:'m1_'); - $action = (isset($ary[2])?$ary[2]:''); -} - -$modinst = ModuleOperations::get_instance()->get_module_instance($module); +$modops = ModuleOperations::get_instance(); +$ary = explode(',', cms_htmlentities($_REQUEST['mact']), 4); // this time, with sanitization OR sanitize each $ary[] member +$module = ($ary[0]) ?: ''; // also checked above, without sanitization +$modinst = $modops->get_module_instance($module); if( !$modinst ) { - trigger_error('Module '.$module.' not found in memory. This could indicate that the module is in need of upgrade or that there are other problems'); - redirect('index.php'); + trigger_error('Module '.$module.' not found in memory. This could indicate that the module is in need of upgrade or that there are other problems.'); + return; } -$USE_THEME = true; -if( isset($_REQUEST['showtemplate']) && ($_REQUEST['showtemplate'] == 'false')) { - // for simplicity and compatibility with the frontend. - $USE_THEME = false; -} -if( $USE_THEME && $modinst->SuppressAdminOutput($_REQUEST) != false || isset($_REQUEST['suppressoutput']) ) $USE_THEME = false; +$id = (!empty($ary[1])) ? $ary[1] : 'm1_'; +$action = (!empty($ary[2])) ? $ary[2] : 'defaultadmin'; +$params = $modops->GetModuleParameters($id); +$smarty = Smarty_CMS::get_instance(); + +$USE_THEME = (!isset($_REQUEST['showtemplate']) || $_REQUEST['showtemplate'] != 'false') + && !(isset($_REQUEST['suppressoutput']) || $modinst->SuppressAdminOutput($_REQUEST)); // module output -$params = ModuleOperations::get_instance()->GetModuleParameters($id); -$content = null; if( $USE_THEME ) { $themeObject = cms_utils::get_theme_object(); $themeObject->set_action_module($module); - // get module output + // get action output (out-of-order) @ob_start(); - echo $modinst->DoActionBase($action, $id, $params, '', $smarty); - $content = @ob_get_contents(); - @ob_end_clean(); + echo $modinst->DoActionBase($action, $id, $params, '', $smarty); + $content = @ob_get_clean(); - // deprecate this. - $txt = $modinst->GetHeaderHTML($action); + // deprecated since 2.2 - just use the hook as follows + $txt = $modinst->GetHeaderHTML(); if( $txt ) $themeObject->add_headtext($txt); - // call admin_add_headtext to get any admin data to add to the - $out = \CMSMS\HookManager::do_hook_accumulate('admin_add_headtext'); - if( $out && !empty($out) ) { - foreach( $out as $one ) { - $one = trim($one); - if( $one ) $themeObject->add_headtext($one); + // run hook to get content to be inserted into + $all = CMSMS\HookManager::do_hook_accumulate('admin_add_headtext'); + if( $all && is_array($all) ) { + foreach( $all as $txt ) { + $txt = trim($txt); + if( $txt ) $themeObject->add_headtext($txt); + } + } + // run hook to get content to be inserted before the tag + $all = CMSMS\HookManager::do_hook_accumulate('admin_add_bottomtext'); + if( $all && is_array($all) ) { + foreach( $all as $txt ) { + $txt = trim($txt); + if( $txt ) { $themeObject->add_footertext($txt); } } } - include_once("header.php"); - - // this is hackish - echo '
    '; - echo '
    '; $title = $themeObject->title; - $module_help_type = 'both'; - if( $title ) $module_help_type = null; + // $module_help_type as used here affects $title-processing but has no effect on help-display + $module_help_type = ($title) ? false : true; if( !$title ) $title = $themeObject->get_active_title(); if( !$title ) $title = $modinst->GetFriendlyName(); - echo $themeObject->ShowHeader($title,'','',$module_help_type).'
    '; - echo $content; - echo '
    '; - include_once("footer.php"); + $themeObject->ShowHeader($title, [], '', $module_help_type); + require_once 'header.php'; + // this is hackish, could otherwise be in a simple template + echo << + $content + + +EOS; + require_once 'footer.php'; } else { echo $modinst->DoActionBase($action, $id, $params, '', $smarty); } + +$obj = new CMSMS\JobCheck(); +$obj->initiate_background_processing(); diff --git a/admin/myaccount.php b/admin/myaccount.php index 0c680d4d..5de6fb41 100644 --- a/admin/myaccount.php +++ b/admin/myaccount.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,31 +15,39 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: editprefs.php 7685 2012-01-22 21:52:55Z calguy1000 $ +#$Id$ -/** +use CMSMS\HookManager; + +/* * Init variables / objects */ $orig_memory = (function_exists('memory_get_usage')?memory_get_usage():0); $CMS_ADMIN_PAGE = 1; -$CMS_TOP_MENU = 'admin'; -$CMS_ADMIN_TITLE = 'myaccount'; -require_once ("../lib/include.php"); +//$CMS_TOP_MENU = 'admin'; +//$CMS_ADMIN_TITLE = 'myaccount'; + +require_once '../lib/include.php'; // might change the password recorded in $_POST[] check_login(); + $urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]; -$thisurl = basename(__FILE__) . $urlext; -$userid = get_userid(); // Checks also login -if( !check_permission($userid,'Manage My Settings') && !check_permission($userid,'Manage My Account') ) return; +if( isset($_POST['cancel']) ) { + redirect('index.php' . $urlext . '§ion=usersgroups'); +} +$userid = get_userid(); // Also checks login - again! +if( !(check_permission($userid,'Manage My Settings') || check_permission($userid,'Manage My Account')) ) { + exit(lang('no_permission')); //TODO throw if can be caught +} -$userobj = UserOperations::get_instance()->LoadUserByID($userid); // <- Safe to do, cause if $userid fails, it redirects automatically to login. +$thisurl = basename(__FILE__) . $urlext; +$userobj = UserOperations::get_instance()->LoadUserByID($userid); // <- Safe to do, cause if $userid failed, it redirected to login. $db = cmsms()->GetDb(); $error = ''; $message = ''; - -/** +/* * Get preferences */ $wysiwyg = cms_userprefs::get_for_user($userid, 'wysiwyg'); @@ -48,7 +55,8 @@ $syntaxhighlighter = cms_userprefs::get_for_user($userid, 'syntaxhighlighter'); $default_cms_language = cms_userprefs::get_for_user($userid, 'default_cms_language'); $old_default_cms_lang = $default_cms_language; -$admintheme = cms_userprefs::get_for_user($userid, 'admintheme', CmsAdminThemeBase::GetDefaultTheme()); +$admintheme = cms_userprefs::get_for_user($userid, 'admintheme'); +if (!$admintheme) $admintheme = CmsAdminThemeBase::GetDefaultTheme(); $bookmarks = cms_userprefs::get_for_user($userid, 'bookmarks', 0); $indent = cms_userprefs::get_for_user($userid, 'indent', true); $paging = cms_userprefs::get_for_user($userid, 'paging', 0); @@ -57,112 +65,120 @@ $homepage = cms_userprefs::get_for_user($userid, 'homepage'); $hide_help_links = cms_userprefs::get_for_user($userid, 'hide_help_links', 0); -/** - * Cancel - */ -if (isset($_POST["cancel"])) redirect("index.php" . $urlext); - -/** +/* * Check tab */ -$tab=''; -if( isset($_POST['active_tab']) ) $tab = trim(cleanValue($_POST['active_tab'])); +$tab = ''; +if( isset($_POST['active_tab']) ) { $tab = trim(cleanValue($_POST['active_tab'])); } -/** +/* * Submit account * - * NOTE: Assumes that we succesfully acquired user object. + * NOTE: assumes that we successfully acquired the user object. */ if (isset($_POST['submit_account']) && check_permission($userid,'Manage My Account')) { - - // Collect params - $username = ''; - if (isset($_POST["user"])) $username = cleanValue($_POST["user"]); - - $password = ''; - if (isset($_POST["password"])) $password = $_POST["password"]; - + // collect params + $username = ''; + $password = ''; $passwordagain = ''; - if (isset($_POST["passwordagain"])) $passwordagain = $_POST["passwordagain"]; - - $firstname = ''; - if (isset($_POST["firstname"])) $firstname = cleanValue($_POST["firstname"]); - - $lastname = ''; - if (isset($_POST["lastname"])) $lastname = cleanValue($_POST["lastname"]); - - $email = ''; - if (isset($_POST["email"])) $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); + $firstname = ''; + $lastname = ''; + $email = ''; + foreach ($_POST as $key => $val) { + switch ($key) { + case 'user': //account + //scrub malicious/XSS & invalid content + $username = preg_replace('/[^a-zA-Z0-9._\- \x8c\x8e\x9c\x9e\x9f\xc0-\xd6\xd8-\xf6\xf8-\xff\pL\p{Nd}\p{Po}]/u', '', trim($val)); + break; + case 'firstname': + case 'lastname': + //scrub malicious/XSS & invalid + $$key = preg_replace(['/[\x00-\x1f\x7f]/', '/<[^>]*>/', '/(<|%3c)(\?|%3f)php.*$/i', '/(<|%3c)(\?|%3f)=?.*$/i'], ['', '', '', ''], trim($val)); //c.f. $sanitize_fn in include.php + break; + case 'password': + case 'passwordagain': + //scrub malicious/XSS & non-printables + $$key = preg_replace(['/[\x00-\x1f\x7f]/', '/(<|%3c)(\?|%3f)php.*$/i', '/(<|%3c)(\?|%3f)=?.*$/i'], ['', '', ''], $val); + break; + case 'email': + //TODO scrub XSS & invalid + //PHP's FILTER_VALIDATE_EMAIL mechanism is incomplete (per RFC5321) - see notes at https://www.php.net/manual/en/function.filter-var.php + $email = filter_var(trim($val), FILTER_SANITIZE_EMAIL); + } + } // Do validations $validinfo = true; - if ($username == "") { + if ($username == '') { $validinfo = false; - $error = lang('nofieldgiven', array(lang('username'))); + $error = lang('nofieldgiven', lang('username')); } - else if ( !preg_match("/^[a-zA-Z0-9\._ ]+$/", $username) ) { + elseif ( $username != trim($_POST["user"])) { $validinfo = false; - $error = lang('illegalcharacters', array(lang('username'))); + $error = lang('illegalcharacters', lang('username')); } - else if ($password != $passwordagain) { + elseif ($password && ($password != $passwordagain)) { $validinfo = false; $error = lang('nopasswordmatch'); } - else if (!empty($email) && !is_email($email)) { + elseif ($email && ($email != trim($_POST['email']) || !is_email($email))) { $validinfo = false; $error = lang('invalidemail').': '.$email; } // If success do action - if($validinfo) { + if ($validinfo) { $userobj->username = $username; $userobj->firstname = $firstname; $userobj->lastname = $lastname; $userobj->email = $email; - \CMSMS\HookManager::do_hook('Core::EditUserPre', [ 'user'=>&$userobj ] ); + HookManager::do_hook('Core::EditUserPre', [ 'user'=>$userobj ]); - if ($password != '') $userobj->SetPassword($password); + if ($password) $userobj->SetPassword($password); $result = $userobj->Save(); - if($result) { + if ($result) { // put mention into the admin log - audit($userid, 'Admin Username: '.$userobj->username, 'Edited'); - \CMSMS\HookManager::do_hook('Core::EditUserPost', [ 'user'=>&$userobj ] ); - $message = lang('accountupdated'); + audit($userid, 'Admin user', "Edited: $userobj->username"); + HookManager::do_hook('Core::EditUserPost', [ 'user'=>$userobj ]); + $message = lang('accountupdated'); } else { - // throw exception? update just failed. + // throw? update just failed } } -} // end of account submit +} -/** - * Submit prefs +/* + * Record submitted prefs */ if (isset($_POST['submit_prefs']) && check_permission($userid,'Manage My Settings')) { // Get values from request and drive em to variables - $wysiwyg = cleanValue($_POST['wysiwyg']); + $tmp = $_POST['wysiwyg']; + $wysiwyg = ($tmp) ? cleanValue($tmp) : ''; $ce_navdisplay = cleanValue($_POST['ce_navdisplay']); - $syntaxhighlighter = cleanValue($_POST['syntaxhighlighter']); + $tmp = $_POST['syntaxhighlighter']; + $syntaxhighlighter = ($tmp) ? cleanValue($tmp) : ''; $default_cms_language = ''; if (isset($_POST['default_cms_language'])) $default_cms_language = cleanValue($_POST['default_cms_language']); $old_default_cms_lang = ''; if (isset($_POST['old_default_cms_lang'])) $old_default_cms_lang = cleanValue($_POST['old_default_cms_lang']); - $admintheme = cleanValue($_POST['admintheme']); - $bookmarks = (isset($_POST['bookmarks']) ? 1 : 0); - $indent = (isset($_POST['indent']) ? true : false); - $paging = (isset($_POST['paging']) ? 1 : 0); + if (isset($_POST['admintheme'])) { $admintheme = cleanValue($_POST['admintheme']); } + else { $admintheme = null; } //aka unset + $bookmarks = (!empty($_POST['bookmarks']) ? 1 : 0); + $indent = (!empty($_POST['indent'])); + $paging = (!empty($_POST['paging']) ? 1 : 0); $date_format_string = trim(strip_tags(substr($_POST['date_format_string'], 0, 20))); $default_parent = ''; if (isset($_POST['parent_id'])) $default_parent = (int)$_POST['parent_id']; $homepage = cleanValue($_POST['homepage']); - $hide_help_links = (isset($_POST['hide_help_links']) ? 1 : 0); + $hide_help_links = (!empty($_POST['hide_help_links']) ? 1 : 0); // Set prefs cms_userprefs::set_for_user($userid, 'wysiwyg', $wysiwyg); cms_userprefs::set_for_user($userid, 'ce_navdisplay', $ce_navdisplay); cms_userprefs::set_for_user($userid, 'syntaxhighlighter', $syntaxhighlighter); cms_userprefs::set_for_user($userid, 'default_cms_language', $default_cms_language); - cms_userprefs::set_for_user($userid, 'admintheme', $admintheme); + if (isset($admintheme)) cms_userprefs::set_for_user($userid, 'admintheme', $admintheme); cms_userprefs::set_for_user($userid, 'bookmarks', $bookmarks); cms_userprefs::set_for_user($userid, 'hide_help_links', $hide_help_links); cms_userprefs::set_for_user($userid, 'indent', $indent); @@ -172,99 +188,76 @@ cms_userprefs::set_for_user($userid, 'homepage', $homepage); // Audit, message, cleanup - audit($userid, 'Admin Username: '.$userobj->username, 'Edited'); + audit($userid, 'Admin user', "Edited: $userobj->username"); $message = lang('prefsupdated'); cmsms()->clear_cached_files(); -} // end of prefs submit +} -/** +/* * Build page */ +require_once 'header.php'; -include_once ("header.php"); - -if ($error != "") { +if ($error) { $themeObject->ShowErrors($error); } -if ($message != "") { +if ($message) { $themeObject->ShowMessage($message); } -$smarty = cmsms()->GetSmarty(); -$contentops = cmsms()->GetContentOperations(); -$smarty->assign('SECURE_PARAM_NAME', CMS_SECURE_PARAM_NAME); // Assigned at include.php? -$smarty->assign('CMS_USER_KEY', $_SESSION[CMS_USER_KEY]); // Assigned at include.php? +$tpl = $smarty->createTemplate('admin_tpl:myaccount.tpl', null, null, $smarty, false); +// see also $smarty-assigned var $secureparam +$tpl->assign('securename', CMS_SECURE_PARAM_NAME) // defined in include.php? + ->assign('secureval', $_SESSION[CMS_USER_KEY]) // set in include.php? + ->assign('tab', $tab); -# WYSIWYG editor +$contentops = cmsms()->GetContentOperations(); +// html editor $tmp = module_meta::get_instance()->module_list_by_capability(CmsCoreCapabilities::WYSIWYG_MODULE); -$tmp2 = array(-1 => lang('none')); +$tmp2 = array('' => lang('none')); for ($i = 0; $i < count($tmp); $i++) { $tmp2[$tmp[$i]] = $tmp[$i]; } -$smarty -> assign('wysiwyg_opts', $tmp2); +$tpl->assign('wysiwyg_opts', $tmp2); -# Syntaxhighlighter editor +// syntax highlight editor $tmp = module_meta::get_instance()->module_list_by_capability(CmsCoreCapabilities::SYNTAX_MODULE); -$tmp2 = array(-1 => lang('none')); +$tmp2 = array('' => lang('none')); for ($i = 0; $i < count($tmp); $i++) { $tmp2[$tmp[$i]] = $tmp[$i]; } -$smarty->assign('syntax_opts', $tmp2); +$tpl->assign('syntax_opts', $tmp2); -# Admin themes -$smarty->assign('themes_opts',CmsAdminThemeBase::GetAvailableThemes()); +// admin themes +$allthemes = (array)CmsAdminThemeBase::GetAvailableThemes(); -# Modules -$allmodules = ModuleOperations::get_instance()->GetInstalledModules(); -$modules = array(); -foreach ((array)$allmodules as $onemodule) { - $modules[$onemodule] = $onemodule; -} +$pagesel = $contentops->CreateHierarchyDropdown(0, $default_parent, 'parent_id', false, true, false, false, false, 'selparent'); -#Tabs -$out = $themeObject->StartTabHeaders(); -if( check_permission($userid,'Manage My Account') ) { - $out .= $themeObject->SetTabHeader('maintab',lang('useraccount'), ('maintab' == $tab)?true:false); +$tpl->assign('wysiwyg', $wysiwyg); +$tpl->assign('ce_navdisplay', $ce_navdisplay); +$tpl->assign('syntaxhighlighter', $syntaxhighlighter); +$tpl->assign('language_opts', get_language_list()); +$tpl->assign('default_cms_language', $default_cms_language); +$tpl->assign('old_default_cms_lang', $old_default_cms_lang); +$tpl->assign('bookmarks', $bookmarks); +if( count($allthemes) > 1 ) { + $tpl->assign('themes_opts', $allthemes); + $tpl->assign('admintheme', $admintheme); } -if( check_permission($userid,'Manage My Settings') ) { - $out .= $themeObject->SetTabHeader('advancedtab',lang('userprefs'), ('advtab' == $tab)?true:false); -} -$out .= $themeObject->EndTabHeaders() . $themeObject->StartTabContent(); -$smarty->assign('tab_start',$out); - -$smarty->assign('tabs_end',$themeObject->EndTabContent()); -$smarty->assign('maintab_start',$themeObject->StartTab("maintab")); -$smarty->assign('advancedtab_start',$themeObject->StartTab("advancedtab")); -$smarty->assign('tab_end',$themeObject->EndTab()); - -# Prefs -$smarty->assign('module_opts', $modules); -$smarty->assign('wysiwyg', $wysiwyg); -$smarty->assign('ce_navdisplay', $ce_navdisplay); -$smarty->assign('syntaxhighlighter', $syntaxhighlighter); -$smarty->assign('language_opts', get_language_list()); -$smarty->assign('default_cms_language', $default_cms_language); -$smarty->assign('old_default_cms_lang', $old_default_cms_lang); -$smarty->assign('bookmarks', $bookmarks); -$smarty->assign('admintheme', $admintheme); -$smarty->assign('hide_help_links', $hide_help_links); -$smarty->assign('indent', $indent); -$smarty->assign('paging', $paging); -$smarty->assign('date_format_string', $date_format_string); -$smarty->assign('default_parent', $contentops->CreateHierarchyDropdown(0, $default_parent, 'parent_id', 0, 1)); -$smarty->assign('homepage', $themeObject->GetAdminPageDropdown('homepage', $homepage, 'homepage')); -$tmp = array(10 => 10, 20 => 20, 50 => 50, 100 => 100); -$smarty->assign('pagelimit_opts', $tmp); -$smarty->assign('backurl', $themeObject -> backUrl()); -$smarty->assign('formurl', $thisurl); -$smarty->assign('userobj', $userobj); -$smarty->assign('manageaccount',check_permission($userid,'Manage My Account')); -$smarty->assign('managesettings',check_permission($userid,'Manage My Settings')); - -# Output -$smarty->display('myaccount.tpl'); -include_once ("footer.php"); - -?> +$tpl->assign('hide_help_links', $hide_help_links); +$tpl->assign('indent', $indent); +$tpl->assign('paging', $paging); +$tpl->assign('date_format_string', $date_format_string); +$tpl->assign('default_parent', $pagesel); +$tpl->assign('homepage', $themeObject->GetAdminPageDropdown('homepage', $homepage, 'homepage')); +$tpl->assign('pagelimit_opts', [10 => 10, 20 => 20, 50 => 50, 100 => 100]); +$tpl->assign('backurl', $themeObject->backUrl()); +$tpl->assign('formurl', $thisurl); +$tpl->assign('userobj', $userobj); +$tpl->assign('manageaccount', check_permission($userid,'Manage My Account')); +$tpl->assign('managesettings', check_permission($userid,'Manage My Settings')); +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/plugins/function.admin_icon.php b/admin/plugins/function.admin_icon.php index 1a9d17ef..a1ccda38 100644 --- a/admin/plugins/function.admin_icon.php +++ b/admin/plugins/function.admin_icon.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 @@ -18,11 +17,9 @@ function smarty_function_admin_icon($params,$template) { - $smarty = $template->smarty; + if( !cmsms()->test_state(CmsApp::STATE_ADMIN_PAGE) ) return ''; - if( !cmsms()->test_state(CmsApp::STATE_ADMIN_PAGE) ) return; - - $icon = null; + $icon = ''; $tagparms = array('class'=>'systemicon'); foreach( $params as $key => $value ) { switch( $key ) { @@ -45,9 +42,9 @@ function smarty_function_admin_icon($params,$template) } } - if( !$icon ) return; + if( !$icon ) return ''; $fnd = cms_admin_utils::get_icon($icon); - if( !$fnd ) return; + if( !$fnd ) return ''; if( !isset($tagparms['alt']) ) $tagparms['alt'] = basename($fnd); @@ -55,11 +52,11 @@ function smarty_function_admin_icon($params,$template) foreach( $tagparms as $key => $value ) { $out .= " $key=\"$value\""; } - $out .= '/>'; + $out .= '>'; if( isset($params['assign']) ) { - $smarty->assign(trim($params['assign']),$out); - return; + $template->assign(trim($params['assign']),$out); + return ''; } return $out; } diff --git a/admin/plugins/function.cms_admin_user.php b/admin/plugins/function.cms_admin_user.php index 76cc3054..7377ad57 100644 --- a/admin/plugins/function.cms_admin_user.php +++ b/admin/plugins/function.cms_admin_user.php @@ -1,16 +1,30 @@ +# +#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_cms_admin_user($params,$template) { - $smarty = $template->smarty; - $out = null; + $out = ''; if( cmsms()->test_state(CmsApp::STATE_ADMIN_PAGE) ) { - $uid = (int)get_parameter_value($params,'uid'); + $uid = get_parameter_value($params,'uid',0); if( $uid > 0 ) { $user = UserOperations::get_instance()->LoadUserByID((int)$params['uid']); if( is_object($user) ) { - $mode = trim(get_parameter_value($params,'mode','username')); + $mode = get_parameter_value($params,'mode','username'); switch( $mode ) { case 'username': $out = $user->username; @@ -33,8 +47,8 @@ function smarty_function_cms_admin_user($params,$template) } if( isset($params['assign']) ) { - $smarty->assign($params['assign'],$out); - return; + $template->assign($params['assign'],$out); + return ''; } return $out; } diff --git a/admin/plugins/function.cms_filepicker.php b/admin/plugins/function.cms_filepicker.php index 1347fb37..aa77bb6e 100644 --- a/admin/plugins/function.cms_filepicker.php +++ b/admin/plugins/function.cms_filepicker.php @@ -1,34 +1,60 @@ +# +#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, read the licence online at +#https://www.gnu.org/licenses/old-licenses/gpl-2.0.html + function smarty_function_cms_filepicker($params,$template) { - $filepicker = \cms_utils::get_filepicker_module(); - if( !$filepicker ) return; + $filepicker = cms_utils::get_filepicker_module(); + if( !$filepicker ) { + if( !empty($params['assign']) ) { + $template->assign(trim($params['assign']),''); + } + return ''; + } - $name = trim(get_parameter_value($params,'name')); - if( !$name ) return; - $profile_name = trim(get_parameter_value($params,'profile')); - $prefix = trim(get_parameter_value($params,'prefix')); - $value = trim(get_parameter_value($params,'value')); - $top = trim(get_parameter_value($params,'top')); - $type = trim(get_parameter_value($params,'type')); - $required = cms_to_bool(get_parameter_value($params,'required')); + $name = get_parameter_value($params,'name','picker'); //default name, since 2.2.19 + $prefix = get_parameter_value($params,'prefix'); // not a profile property + $value = get_parameter_value($params,'value'); // ditto + $required = get_parameter_value($params,'required',false); // ditto - $profile = $filepicker->get_profile_or_default($profile_name); - $parms = []; + $top = get_parameter_value($params,'top'); if( $top ) { - // TODO $top might be Windoze-style absolute path and separator might be \ or / - if( !startswith($top,'/') ) $top = cmsms()->GetConfig()['uploads_path'].'/'.$top; - if( startswith($top, CMS_ROOT_PATH ) ) $parms['top'] = $top; - } - if( $type ) $parms['type'] = $type; - if( $parms ) { - $profile = $profile->overrideWith( $parms ); + if( is_absolute_path($top) ) { + $config = cms_utils::get_config(); + $uploads_path = $config['uploads_path']; + if( startswith($top,$uploads_path) ) { + $params['top'] = substr($top,strlen($uploads_path) + 1); //omit leading separator + } + else { + unset($params['top']); + } + } + else { + $params['top'] = ltrim($top,' \/'); //omit any leading separator + } } + $profile_name = get_parameter_value($params,'profile'); + $profile = $filepicker->get_profile_or_default($profile_name, '', get_userid(false)); + unset($params['can_upload'],$params['can_delete'],$params['can_mkdir']); // prevent overriding these + $profile->overrideWith($params); - // todo: something with required. - $out = $filepicker->get_html( $prefix.$name, $value, $profile, $required ); + $out = $filepicker->get_html($prefix.$name,$value,$profile,$required); if( isset($params['assign']) ) { - $template->assign( $params['assign'], $out ); + $template->assign(trim($params['assign']),$out); + return ''; } else { return $out; } diff --git a/admin/plugins/function.cms_help.php b/admin/plugins/function.cms_help.php index 47e40daf..4d677b44 100644 --- a/admin/plugins/function.cms_help.php +++ b/admin/plugins/function.cms_help.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 @@ -18,12 +17,10 @@ function smarty_function_cms_help($params,$template) { - $smarty = $template->smarty; - $out = cms_admin_utils::get_help_tag($params); if( isset($params['assign']) ) { - $smarty->assign($params['assign'],$out); + $template->assign($params['assign'],$out); } else { return $out; diff --git a/admin/plugins/function.page_error.php b/admin/plugins/function.page_error.php index 3bcff903..1b3be760 100644 --- a/admin/plugins/function.page_error.php +++ b/admin/plugins/function.page_error.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 @@ -18,15 +17,13 @@ function smarty_function_page_error($params,$template) { - $smarty = $template->smarty; - - if( !cmsms()->test_state(CmsApp::STATE_ADMIN_PAGE) ) return; - if( !isset($params['msg']) ) return; + if( !cmsms()->test_state(CmsApp::STATE_ADMIN_PAGE) ) return ''; + if( !isset($params['msg']) ) return ''; $out = '
    '.trim($params['msg']).'
    '; if( isset($params['assign']) ) { - $smarty->assign(trim($params['assign']),$out); - return; + $template->assign(trim($params['assign']),$out); + return ''; } return $out; } diff --git a/admin/plugins/function.page_selector.php b/admin/plugins/function.page_selector.php index 40bf5c01..cf0b88e1 100644 --- a/admin/plugins/function.page_selector.php +++ b/admin/plugins/function.page_selector.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 @@ -18,16 +17,18 @@ function smarty_function_page_selector($params,$template) { - $value = (isset($params['value']) ) ? (int) $params['value'] : 0; - $name = (isset($params['name']) ) ? trim($params['name']) : 'parent_id'; - $allowcurrent = (isset($params['allowcurrent']) ) ? cms_to_bool($params['allowcurrent']) : 0; - $allow_all = (isset($params['allowall']) ) ? cms_to_bool($params['allowall']) : 0; - $for_child = (isset($params['for_child']) ) ? cms_to_bool($params['for_child']) : 0; - - $out = \ContentOperations::get_instance()->CreateHierarchyDropdown('',$value,$name,$allowcurrent,0,0,$allow_all,$for_child); + $value = (isset($params['value']) ) ? (int)$params['value'] : 0; // selected-page id + $name = (isset($params['name']) ) ? trim($params['name']) : 'page_id'; //input-element name attrib + $htmlid = (isset($params['id']) ) ? trim($params['id']) : ''; //input-element id attrib + $title = (isset($params['title']) ) ? trim($params['title']) : null; //input-element title attrib + $allowcurrent = (isset($params['allowcurrent']) ) ? cms_to_bool($params['allowcurrent']) : false; + $allow_all = (isset($params['allow_all']) ) ? cms_to_bool($params['allow_all']) : false; + $for_child = (isset($params['for_child']) ) ? cms_to_bool($params['for_child']) : false; + // no current-page + $out = ContentOperations::get_instance()->CreateHierarchyDropdown(0,$value,$name,$allowcurrent,false,false,$allow_all,$for_child,$htmlid,$title); if( isset($params['assign']) ) { - $smarty->assign(trim($params['assign']),$out); - return; + $template->assign(trim($params['assign']),$out); + return ''; } return $out; } diff --git a/admin/plugins/function.page_warning.php b/admin/plugins/function.page_warning.php index acc9b66a..2fabd6bd 100644 --- a/admin/plugins/function.page_warning.php +++ b/admin/plugins/function.page_warning.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 @@ -18,16 +17,13 @@ function smarty_function_page_warning($params,$template) { - $smarty = $template->smarty; - - if( !cmsms()->test_state(CmsApp::STATE_ADMIN_PAGE) ) return; - if( !isset($params['msg']) ) return; + if( !cmsms()->test_state(CmsApp::STATE_ADMIN_PAGE) ) return ''; + if( !isset($params['msg']) ) return ''; $out = '
    '.trim($params['msg']).'
    '; - if( isset($params['assign']) ) - { - $smarty->assign(trim($params['assign']),$out); - return; + if( isset($params['assign']) ) { + $template->assign(trim($params['assign']),$out); + return ''; } return $out; } diff --git a/admin/plugins/function.tab_end.php b/admin/plugins/function.tab_end.php index 85ee1d87..8f0272ab 100644 --- a/admin/plugins/function.tab_end.php +++ b/admin/plugins/function.tab_end.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 @@ -18,13 +17,11 @@ function smarty_function_tab_end($params,$template) { - $smarty = $template->smarty; - - $out = cms_admin_tabs::end_tab_content(); + $out = cms_admin_tabs::end_tab_content(true); if( isset($params['assign']) ) { - $smarty->assign(trim($params['assign']),$out); - return; + $template->assign(trim($params['assign']),$out); + return ''; } return $out; } diff --git a/admin/plugins/function.tab_header.php b/admin/plugins/function.tab_header.php index f8b539b6..13499638 100644 --- a/admin/plugins/function.tab_header.php +++ b/admin/plugins/function.tab_header.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 @@ -18,9 +17,7 @@ function smarty_function_tab_header($params,$template) { - $smarty = $template->smarty; - - if( !isset($params['name']) ) return; + if( !isset($params['name']) ) return ''; $name = trim($params['name']); $label = $name; $active = FALSE; @@ -35,10 +32,10 @@ function smarty_function_tab_header($params,$template) } } - $out = cms_admin_tabs::set_tab_header($name,$label,$active); + $out = cms_admin_tabs::set_tab_header($name,$label,$active,TRUE); if( isset($params['assign']) ) { - $smarty->assign(trim($params['assign']),$out); - return; + $template->assign(trim($params['assign']),$out); + return ''; } return $out; } diff --git a/admin/plugins/function.tab_start.php b/admin/plugins/function.tab_start.php index 4a4cde55..c75f30d6 100644 --- a/admin/plugins/function.tab_start.php +++ b/admin/plugins/function.tab_start.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 @@ -18,9 +17,7 @@ function smarty_function_tab_start($params,$template) { - $smarty = $template->smarty; - - if( !isset($params['name']) ) return; + if( !isset($params['name']) ) return ''; $parms = array(); foreach( $params as $key => $value ) @@ -37,11 +34,11 @@ function smarty_function_tab_start($params,$template) } } - $out = cms_admin_tabs::start_tab($name,$parms); + $out = cms_admin_tabs::start_tab($name,$parms,true); if( isset($params['assign']) ) { - $smarty->assign(trim($params['assign']),$out); - return; + $template->assign(trim($params['assign']),$out); + return ''; } return $out; } diff --git a/admin/siteprefs.php b/admin/siteprefs.php index ec357a1f..3809a873 100644 --- a/admin/siteprefs.php +++ b/admin/siteprefs.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 @@ -18,23 +17,30 @@ # #$Id$ -/** - * Init variables / objects - */ +use CMSMS\internal\global_cache; -$CMS_ADMIN_PAGE=1; -$CMS_TOP_MENU='admin'; -$CMS_ADMIN_TITLE='preferences'; +$CMS_ADMIN_PAGE = 1; +//$CMS_TOP_MENU = 'admin'; +//$CMS_ADMIN_TITLE = 'preferences'; -require_once("../lib/include.php"); +require_once '../lib/include.php'; check_login(); -$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; -$thisurl=basename(__FILE__).$urlext; + $userid = get_userid(); // <- Checks also login -/** - * A convenience function to interpret octal permissions, and return - * a human readable string. Uses the lang() function for translation. +$access = check_permission($userid, 'Modify Site Preferences'); +if( !$access ) { + exit(lang('no_permission')); //TODO throw if can be caught +} + +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; +if( isset($_POST['cancel']) ) { + redirect('index.php'.$urlext.'§ion=siteadmin'); +} +$pjobs = check_permission($userid,'Manage Jobs'); + +/* + * Interpret octal permissions, and return a human-readable string. * * @internal * @param int The permissions to test. @@ -59,7 +65,6 @@ function siteprefs_interpret_permissions($perms) return [$owner,$group,$other]; } - function siteprefs_display_permissions($permsarr) { if( count($permsarr) != 3 ) return lang('permissions_parse_error'); @@ -71,136 +76,87 @@ function siteprefs_display_permissions($permsarr) $str .= implode(',',$permsarr[$i]); $result[] = $str; } - $str = implode('
      ',$result); + $str = implode('
      ',$result); return $str; } -$access = check_permission($userid, 'Modify Site Preferences'); -if (!$access) { - die('Permission Denied'); // <- Pretty cruel huh? maybe redirection and message, or something. -Stikki- - return; //useless here -} - $gCms = cmsms(); $db = $gCms->GetDb(); $config = $gCms->GetConfig(); -$pretty_urls = $config['url_rewriting'] === 'none' ? 0 : 1; +$devmode = !empty($config['developer_mode']); $error = ''; $message = ''; -$mail_is_set = cms_siteprefs::get('mail_is_set',0); $testresults = lang('untested'); -$thumbnail_width = 96; -$thumbnail_height = 96; -$sitedownexcludes = ''; -$sitedownexcludeadmins = ''; -$disallowed_contenttypes = ''; -$basic_attributes = ''; -$xmlmodulerepository = ''; -$checkversion = 1; -$defaultdateformat = ''; -$enablesitedownmessage = '0'; -$lock_timeout = 60; -$use_wysiwyg = 1; -$sitedownmessage = '

    Site is currently down. Check back later.

    '; -$sitedownmessagetemplate = '-1'; -$metadata = ''; -$sitename = 'CMSMS Website'; -$frontendlang = ''; -$frontendwysiwyg = ''; -$global_umask = '022'; -$logintheme = 'default'; -$backendwysiwyg = ''; -$auto_clear_cache_age = 0; -$allow_browser_cache = 0; -$browser_cache_expiry = 60; -$content_autocreate_urls = 0; -$content_autocreate_flaturls = 0; -$content_mandatory_urls = 0; -$contentimage_useimagepath = 0; -$content_imagefield_path = ''; -$content_thumbnailfield_path = ''; -$content_cssnameisblockname = 1; -$contentimage_path = ''; -$adminlog_lifetime = (3600 * 24 * 31); -$search_module = 'Search'; -$use_smartycache = 0; -$use_smartycompilecheck = 1; -$mailprefs = array( - 'mailer'=>'mail', - 'host'=>'localhost', - 'port'=>25, - 'from'=>'root@localhost.localdomain', - 'fromuser'=>'CMS Administrator', - 'sendmail'=>'/usr/sbin/sendmail', - 'smtpauth'=>0, - 'smtpautotls'=>1, - 'username'=>'', - 'password'=>'', - 'secure'=>'', - 'timeout'=>60, - 'charset'=>'utf-8'); - -if (isset($_POST['cancel'])) { - redirect("index.php".$urlext); - return; //useless here -} -/** - * Get preferences - */ -$allow_browser_cache = cms_siteprefs::get('allow_browser_cache', $allow_browser_cache); -$browser_cache_expiry = cms_siteprefs::get('browser_cache_expiry', $browser_cache_expiry); -$auto_clear_cache_age = cms_siteprefs::get('auto_clear_cache_age', $auto_clear_cache_age); -$thumbnail_width = cms_siteprefs::get('thumbnail_width', $thumbnail_width); -$thumbnail_height = cms_siteprefs::get('thumbnail_height', $thumbnail_height); -$global_umask = cms_siteprefs::get('global_umask', $global_umask); -$frontendlang = cms_siteprefs::get('frontendlang', $frontendlang); -$frontendwysiwyg = cms_siteprefs::get('frontendwysiwyg', $frontendwysiwyg); -$enablesitedownmessage = cms_siteprefs::get('enablesitedownmessage', $enablesitedownmessage); -$use_wysiwyg = cms_siteprefs::get('sitedown_use_wysiwyg', $use_wysiwyg); -$sitedownmessage = cms_siteprefs::get('sitedownmessage', $sitedownmessage); -$xmlmodulerepository = cms_siteprefs::get('xmlmodulerepository', $xmlmodulerepository); -$checkversion = cms_siteprefs::get('checkversion', $checkversion); -$defaultdateformat = cms_siteprefs::get('defaultdateformat', $defaultdateformat); -$logintheme = cms_siteprefs::get('logintheme', $logintheme); -$backendwysiwyg = cms_siteprefs::get('backendwysiwyg', $backendwysiwyg); -$metadata = cms_siteprefs::get('metadata', $metadata); -$sitename = cms_html_entity_decode(cms_siteprefs::get('sitename', $sitename)); -$lock_timeout = (int)cms_siteprefs::get('lock_timeout', $lock_timeout); -$sitedownexcludes = cms_siteprefs::get('sitedownexcludes', $sitedownexcludes); -$sitedownexcludeadmins = cms_siteprefs::get('sitedownexcludeadmins', $sitedownexcludeadmins); -$disallowed_contenttypes = cms_siteprefs::get('disallowed_contenttypes', $disallowed_contenttypes); -$basic_attributes = cms_siteprefs::get('basic_attributes', $basic_attributes); -$content_autocreate_urls = cms_siteprefs::get('content_autocreate_urls', $content_autocreate_urls); -$content_autocreate_flaturls = cms_siteprefs::get('content_autocreate_flaturls', $content_autocreate_flaturls); -$content_mandatory_urls = cms_siteprefs::get('content_mandatory_urls', $content_mandatory_urls); -$content_imagefield_path = cms_siteprefs::get('content_imagefield_path', $content_imagefield_path); -$content_thumbnailfield_path = cms_siteprefs::get('content_thumbnailfield_path', $content_thumbnailfield_path); -$content_cssnameisblockname = cms_siteprefs::get('content_cssnameisblockname', $content_cssnameisblockname); -$contentimage_path = cms_siteprefs::get('contentimage_path', $contentimage_path); -$adminlog_lifetime = cms_siteprefs::get('adminlog_lifetime', $adminlog_lifetime); -$search_module = cms_siteprefs::get('searchmodule', $search_module); -$use_smartycache = cms_siteprefs::get('use_smartycache', $use_smartycache); -$use_smartycompilecheck = cms_siteprefs::get('use_smartycompilecheck', $use_smartycompilecheck); +// Get preferences +global_cache::clear('cms_siteprefs'); //use original data +if( $pjobs ) { + $jobs_interval = cms_siteprefs::get('jobs_interval',15); + $jobs_timeout = cms_siteprefs::get('jobs_timeout',30); + $job_maxerrs = cms_siteprefs::get('job_maxerrs',5); +} +$adminlog_lifetime = cms_siteprefs::get('adminlog_lifetime',86400 * 31); +$allow_browser_cache = cms_siteprefs::get('allow_browser_cache',0); +$auto_clear_cache_age = cms_siteprefs::get('auto_clear_cache_age',0); +$backendwysiwyg = cms_siteprefs::get('backendwysiwyg'); +$browser_cache_expiry = cms_siteprefs::get('browser_cache_expiry',60); +$checkversion = cms_siteprefs::get('checkversion',1); +$defaultdateformat = cms_siteprefs::get('defaultdateformat'); +$enablesitedownmessage = cms_siteprefs::get('enablesitedownmessage',0); +$frontendlang = cms_siteprefs::get('frontendlang'); +$frontendwysiwyg = cms_siteprefs::get('frontendwysiwyg'); +$global_umask = cms_siteprefs::get('global_umask') ?: str_pad(decoct(umask()), 3, '0', STR_PAD_LEFT); +$lock_timeout = (int)cms_siteprefs::get('lock_timeout',60); +$logintheme = cms_siteprefs::get('logintheme','default'); +$mail_is_set = cms_siteprefs::get('mail_is_set',0); $tmp = cms_siteprefs::get('mailprefs'); -if( $tmp ) { - $mailprefs = unserialize($tmp); +$mailprefs = ($tmp) ? unserialize($tmp,['allowed_classes'=>[]]) : ''; +if( !$mailprefs ) { + $mailprefs = [ + 'mailer'=>'mail', + 'host'=>'localhost', + 'port'=>25, + 'from'=>'root@localhost.localdomain', + 'fromuser'=>'CMS Administrator', + 'sendmail'=>'/usr/sbin/sendmail', + 'smtpauth'=>0, + 'smtpautotls'=>1, + 'username'=>'', + 'password'=>'', + 'secure'=>'', + 'timeout'=>60, + 'charset'=>'utf-8' + ]; + $mail_is_set = 0; +} +$metadata = cms_siteprefs::get('metadata'); +$notices_timeout = cms_siteprefs::get('notices_timeout',10); +$search_module = cms_siteprefs::get('searchmodule','Search'); +$sitedownexcludeadmins = cms_siteprefs::get('sitedownexcludeadmins'); +$sitedownexcludes = cms_siteprefs::get('sitedownexcludes'); +$sitedownmessage = cms_siteprefs::get('sitedownmessage','

    Site is currently down. Check back later.

    '); +$sitename = cms_html_entity_decode(cms_siteprefs::get('sitename','CMSMS Website')); +$SmartyAdmincacheLife = (int)cms_siteprefs::get('SmartyAdmincacheLife',30); +$SmartyFrontcacheLife = (int)cms_siteprefs::get('SmartyFrontcacheLife',60); +$thumbnail_height = cms_siteprefs::get('thumbnail_height',96); +$thumbnail_width = cms_siteprefs::get('thumbnail_width',96); +$use_smartycache = cms_siteprefs::get('use_smartycache',0); +$use_smartycompilecheck = cms_siteprefs::get('use_smartycompilecheck',1); +$use_wysiwyg = cms_siteprefs::get('sitedown_use_wysiwyg',1); +$xmlmodulerepository = cms_siteprefs::get('xmlmodulerepository'); +if( $devmode ) { + $ppath = cms_siteprefs::get('privatePath'); } -/** - * Check tab - */ -$tab=''; -if( isset($_POST['active_tab']) ) $tab = trim(cleanValue($_POST['active_tab'])); +// Active tab +$tab = (isset($_POST['active_tab'])) ? trim(cleanValue($_POST['active_tab'])) : ''; -/** - * Submit - */ -if( isset($_POST['testmail']) ) { +// Submit +if( isset($_POST['testmail']) ) { // not 'testemail' if( !$mail_is_set ) { $error .= '
  • '.lang('error_mailnotset_notest').'
  • '; } - else if( $_POST['mailtest_testaddress'] == '' ) { + elseif( $_POST['mailtest_testaddress'] == '' ) { $error .= '
  • '.lang('error_mailtest_noaddress').'
  • '; } else { @@ -214,23 +170,25 @@ function siteprefs_display_permissions($permsarr) try { $mailer = new cms_mailer(); $mailer->AddAddress($addr); - $mailer->IsHTML(TRUE); + $mailer->IsHTML(true); $mailer->SetBody(lang('mail_testbody','siteprefs')); $mailer->SetSubject(lang('mail_testsubject','siteprefs')); $mailer->Send(); if( $mailer->IsError() ) { $error .= '
  • '.$mailer->GetErrorInfo().'
  • '; } - $message .= lang('testmsg_success'); + else { + $message .= lang('testmsg_success'); + } } - catch( \Exception $e ) { + catch( Exception $e ) { $error .= '
  • '.$e->GetMessage().'
  • '; } } } } -if (isset($_POST['testumask'])) { +if( isset($_POST['testumask']) ) { $testdir = TMP_CACHE_LOCATION; $testfile = $testdir.DIRECTORY_SEPARATOR.'dummy.tst'; if( !is_writable($testdir) ) { @@ -246,153 +204,287 @@ function siteprefs_display_permissions($permsarr) else { @fclose($fh); $filestat = stat($testfile); - if( $filestat == FALSE ) $testresults = lang('errorcantcreatefile'); + if( $filestat == false ) $testresults = lang('errorcantcreatefile'); - if(function_exists("posix_getpwuid")) { + if( function_exists("posix_getpwuid") ) { //function posix_getpwuid not available on WAMP systems $userinfo = @posix_getpwuid($filestat[4]); $username = isset($userinfo['name']) ? $userinfo['name'] : lang('unknown'); $permsstr = siteprefs_display_permissions(siteprefs_interpret_permissions($filestat[2])); - $testresults = sprintf("%s: %s
    %s:
      %s",lang('owner'),$username,lang('permissions'),$permsstr); - } else { - $testresults = sprintf("%s: %s
    %s:
      %s",lang('owner'),"N/A",lang('permissions'),"N/A"); + $testresults = sprintf("%s: %s
    %s:
      %s",lang('owner'),$username,lang('permissions'),$permsstr); + } + else { + $testresults = sprintf("%s: %s
    %s:
      %s",lang('owner'),"N/A",lang('permissions'),"N/A"); } @unlink($testfile); } } } -if (isset($_POST['editsiteprefs'])) { - if ($access) { +if( isset($_POST['editsiteprefs']) ) { + if( $access ) { switch( $tab ) { case 'general': // tab 1 // @todo: should validate input or fully trust users allowed to change these values - if (isset($_POST['sitename'])) $sitename = cleanValue($_POST['sitename']); - cms_siteprefs::set('sitename', $sitename); - if (isset($_POST['frontendlang'])) $frontendlang = cleanValue($_POST['frontendlang']); - cms_siteprefs::set('frontendlang', $frontendlang); - if (isset($_POST['frontendwysiwyg'])) $frontendwysiwyg = cleanValue($_POST['frontendwysiwyg']); - cms_siteprefs::set('frontendwysiwyg', $frontendwysiwyg); - if (isset($_POST['metadata'])) $metadata = $_POST['metadata']; - cms_siteprefs::set('metadata', $metadata); - if (isset($_POST['logintheme'])) $logintheme = cleanValue($_POST['logintheme']); - cms_siteprefs::set('logintheme', $logintheme); - if (isset($_POST['backendwysiwyg'])) $backendwysiwyg = cleanValue($_POST['backendwysiwyg']); - cms_siteprefs::set('backendwysiwyg', $backendwysiwyg); - if (isset($_POST['defaultdateformat'])) $defaultdateformat = str_replace('%','%',cleanValue($_POST['defaultdateformat'])); // have to undo some cleaning. - cms_siteprefs::set('defaultdateformat', $defaultdateformat); - if( isset($_POST['thumbnail_width']) ) $thumbnail_width = (int)$_POST['thumbnail_width']; - if( isset($_POST['thumbnail_height']) ) $thumbnail_height = (int)$_POST['thumbnail_height']; - cms_siteprefs::set('thumbnail_width',$thumbnail_width); - cms_siteprefs::set('thumbnail_height',$thumbnail_height); + if( isset($_POST['sitename']) ) { + $sitename = cleanValue($_POST['sitename']); + cms_siteprefs::set('sitename', $sitename); + } + if( isset($_POST['frontendlang']) ) { + $frontendlang = cleanValue($_POST['frontendlang']); + cms_siteprefs::set('frontendlang', $frontendlang); + } + if( isset($_POST['frontendwysiwyg']) ) { + $frontendwysiwyg = cleanValue($_POST['frontendwysiwyg']); + cms_siteprefs::set('frontendwysiwyg', $frontendwysiwyg); + } + if( !empty($_POST['metadata']) ) { + $matches = []; + $merr = []; + $val = addcslashes(trim($_POST['metadata']), '~+*?[]^$(){}\\|'); + $arr = preg_split('~]+\2\s*)+/{0,1}>(.*)$~s', $val, $matches) ) { + if( $matches[3] ) { + $val = str_replace($matches[3], '', $val); + if( preg_match('~\S~', $matches[3]) ) { + $merr[] = 'unqouted data'; + } + } + $val = rtrim($val, "/>\r\n\t ") . '>'; //html5 format + $o = 0; + while (preg_match('~(.*?)([a-zA-Z]{2,}[\w\-.]*)\s*=\s*("(\\\\.|[^"])*"|\'(\\\\.|[^\'])*\')(\s+|\s*\/{0,1}>\s*)~', $val, $matches, PREG_OFFSET_CAPTURE, $o)) { + if( ($s = strpbrk($matches[3][0], '`$')) ) { + $val = ''; + $merr[] = 'prohibited '. $s[0] . ' in data'; + break; + } + if( $matches[1][0] ) { + $s = str_repeat(' ', strlen($matches[1][0])); + $val = str_replace($matches[1][0], $s, $val); + $merr[] = 'unqouted data'; + } + //filter per meta name TODO deal with all oWASP examples + switch ($matches[2][0]) { + case 'content': + $s = trim($matches[3][0], '"\''); + if( $s == 'no-referrer' ) { + if( ($p = stripos($val, 'referrer')) !== false && $p < $matches[3][1] ) { + $val = ''; + $merr[] = 'no-referrer'; + break; + } + } + if( $s == 'upgrade-insecure-requests' ) { + if( ($p = stripos($val, 'Content-Security-Policy')) !== false && $p < $matches[3][1] ) { + $val = ''; + $merr[] = 'insecure CSP override'; + break; + } + } + if( stripos($s, 'url') !== false ) { + if( ($p = stripos($val, 'refresh')) !== false && $p < $matches[3][1] ) { + $val = ''; + $merr[] = 'refresh URL'; + break; + } + } + break; + default: + break; + } + if( $val !== '' ) { + $o = $matches[6][1] + strlen($matches[6][0]); + } + else { + continue 2; + } + } + $val = ''; + $val = implode(',', $merr); + audit('', 'Site metadata', 'Ignored some/all having '.$val); + } + } + else { + cms_siteprefs::set('metadata', ''); + } + if( isset($_POST['notices_timeout']) ) { + $notices_timeout = (int)$_POST['notices_timeout']; + if( $notices_timeout < 0 ) { $notices_timeout = 0; } + elseif( $notices_timeout > 30 ) { $notices_timeout = 30; } + cms_siteprefs::set('notices_timeout', $notices_timeout); + } + if( isset($_POST['logintheme']) ) { + $logintheme = cleanValue($_POST['logintheme']); + cms_siteprefs::set('logintheme', $logintheme); + } + if( isset($_POST['backendwysiwyg']) ) { + $backendwysiwyg = cleanValue($_POST['backendwysiwyg']); + cms_siteprefs::set('backendwysiwyg', $backendwysiwyg); + } + if( isset($_POST['defaultdateformat']) ) { + $defaultdateformat = str_replace('%','%',cleanValue($_POST['defaultdateformat'])); // have to undo some cleaning. + cms_siteprefs::set('defaultdateformat', $defaultdateformat); + } + if( isset($_POST['thumbnail_width']) ) { + $thumbnail_width = (int)$_POST['thumbnail_width']; + cms_siteprefs::set('thumbnail_width',$thumbnail_width); + } + if( isset($_POST['thumbnail_height']) ) { + $thumbnail_height = (int)$_POST['thumbnail_height']; + cms_siteprefs::set('thumbnail_height',$thumbnail_height); + } if( isset($_POST['search_module']) ) { $search_module = trim(cleanValue($_POST['search_module'])); cms_siteprefs::set('searchmodule',$search_module); } break; +/* exported to ContentManager settings UI case 'editcontent': - if( $pretty_urls ) { - $content_autocreate_urls = (int)$_POST['content_autocreate_urls']; - cms_siteprefs::set('content_autocreate_urls',$content_autocreate_urls); - $content_autocreate_flaturls = (int)$_POST['content_autocreate_flaturls']; - cms_siteprefs::set('content_autocreate_flaturls',$content_autocreate_flaturls); - $content_mandatory_urls = (int)$_POST['content_mandatory_urls']; - cms_siteprefs::set('content_mandatory_urls',$content_mandatory_urls); - } - $content_imagefield_path = trim($_POST['content_imagefield_path']); - cms_siteprefs::set('content_imagefield_path',$content_imagefield_path); - $content_thumbnailfield_path = trim($_POST['content_thumbnailfield_path']); - cms_siteprefs::set('content_thumbnailfield_path',$content_thumbnailfield_path); - $contentimage_path = trim($_POST['contentimage_path']); - cms_siteprefs::set('contentimage_path',$contentimage_path); - $content_cssnameisblockname = (int)$_POST['content_cssnameisblockname']; - cms_siteprefs::set('content_cssnameisblockname',$content_cssnameisblockname); - if( isset($_POST['basic_attributes']) ) { - $basic_attributes = implode(',',($_POST['basic_attributes'])); - } - else { - $basic_attributes = ''; - } - cms_siteprefs::set('basic_attributes',$basic_attributes); - $disallowed_contenttypes = ''; - if( isset($_POST['disallowed_contenttypes']) ) $disallowed_contenttypes = implode(',',$_POST['disallowed_contenttypes']); - cms_siteprefs::set('disallowed_contenttypes',$disallowed_contenttypes); break; - +*/ case 'sitedown': - if( isset($_POST['sitedownexcludes']) ) $sitedownexcludes = trim($_POST['sitedownexcludes']); - $sitedownexcludeadmins = (int)$_POST['sitedownexcludeadmins']; + if( isset($_POST['sitedownexcludes']) ) { + $sitedownexcludes = trim($_POST['sitedownexcludes']); + cms_siteprefs::set('sitedownexcludes',$sitedownexcludes); + } + if( isset($_POST['sitedownexcludeadmins']) ) { + $sitedownexcludeadmins = (int)$_POST['sitedownexcludeadmins']; + cms_siteprefs::set('sitedownexcludeadmins',$sitedownexcludeadmins); + } + $tmp = false; + if( isset($_POST['sitedownmessage']) ) { + $sitedownmessage = $_POST['sitedownmessage']; + $tmp = trim(empty($_POST['use_wysiwyg']) ? strip_tags($sitedownmessage) : $sitedownmessage); + if( $tmp ) { + $sitedownmessage = $tmp; + cms_siteprefs::set('sitedownmessage',$sitedownmessage); + } + else { $error .= lang('error_sitedownmessage'); } + } $prevsitedown = $enablesitedownmessage; - if (isset($_POST['enablesitedownmessage'])) $enablesitedownmessage=$_POST['enablesitedownmessage']; - if (isset($_POST['sitedownmessage'])) $sitedownmessage = $_POST['sitedownmessage']; - if (isset($_POST['use_wysiwyg'])) $use_wysiwyg = $_POST['use_wysiwyg']; + if( $tmp ) { + if( isset($_POST['enablesitedownmessage']) ) { + $enablesitedownmessage = (int)$_POST['enablesitedownmessage']; + cms_siteprefs::set('enablesitedownmessage',$enablesitedownmessage); + } + } + else { + $enablesitedownmessage = false; + } if( !$prevsitedown && $enablesitedownmessage ) { - audit('','Global Settings','Sitedown enabled'); - } - else if( $prevsitedown && !$enablesitedownmessage ) { - audit('','Global Settings','Sitedown disabled'); - } - $tmp = trim(strip_tags($sitedownmessage)); - if( !$tmp ) $error .= lang('error_sitedownmessage'); - if( !$error ) cms_siteprefs::set('enablesitedownmessage', $enablesitedownmessage); - cms_siteprefs::set('sitedown_use_wysiwyg', $use_wysiwyg); - cms_siteprefs::set('sitedownmessage', $sitedownmessage); - cms_siteprefs::set('sitedownexcludes',$sitedownexcludes); - cms_siteprefs::set('sitedownexcludeadmins',$sitedownexcludeadmins); + audit('','Global settings','Sitedown enabled'); + } + elseif( $prevsitedown && !$enablesitedownmessage ) { + audit('','Global settings','Sitedown disabled'); + } + if( isset($_POST['use_wysiwyg']) ) { + $use_wysiwyg = (int)$_POST['use_wysiwyg']; + cms_siteprefs::set('sitedown_use_wysiwyg',$use_wysiwyg); + } break; case 'mail': - // gather mailprefs + // gather mailprefs Values of disabled elements are provided (courtesy of jQ) + $mclean = []; $prefix = 'mailprefs_'; + $lp = strlen($prefix); foreach( $_POST as $key => $val ) { if( !startswith($key,$prefix) ) continue; - $key = substr($key,strlen($prefix)); - $mailprefs[$key] = trim(htmlspecialchars($val, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5, 'UTF-8', false)); //OR custom fitterer c.f. include.php + $key = substr($key,$lp); + switch ($key) { + case 'from': + //TODO scrub malicious/XSS, invalid content c.f. execSpecialize()'s etc + //TODO PHP's FILTER_SANITIZE_EMAIL is incomplete (per RFC5321) + $mclean[$key] = filter_var(trim($val),FILTER_SANITIZE_EMAIL); + break; + case 'fromuser': + case 'username': + //TODO scrub malicious/XSS + $mclean[$key] = trim($val,'<> '); + break; + case 'password': + //TODO scrub malicious/XSS + $mclean[$key] = $val; + break; + default: + if( is_numeric($val) ) { + // 'port' 'smtpauth' 'smtpautotls' 'timeout' + $mclean[$key] = (int)$val; + } + else { + // 'mailer' 'host' 'sendmail' 'secure' 'charset' + $mclean[$key] = trim(cleanValue($val)); //OR custom filterer c.f. include.php + } + } } // validate - if( $mailprefs['from'] == '' ) { - $error .= '
  • '.lang('error_fromrequired').'
  • '; + if( $mclean['from'] == '' ) { + $error .= '
  • '.lang('error_fromrequired').'
  • '; + } + elseif( $mclean['from'] != trim($_POST[$prefix.'from']) ) { + $error .= '
  • '.lang('error_frominvalid').'
  • '; } - else if( !is_email($mailprefs['from']) ) { + elseif( !is_email($mclean['from']) ) { $error .= '
  • '.lang('error_frominvalid').'
  • '; } - if( $mailprefs['mailer'] == 'smtp' ) { - if( $mailprefs['host'] == '' ) { + if( $mclean['mailer'] == 'smtp' ) { + if( $mclean['host'] == '' ) { $error .= '
  • '.lang('error_hostrequired').'
  • '; } - if( $mailprefs['port'] == '' ) $mailprefs['port'] = 25; // convenience. - if( $mailprefs['port'] < 1 || $mailprefs['port'] > 10240 ) { + if( $mclean['port'] == '' ) $mclean['port'] = 25; // convenience + if( $mclean['port'] < 1 || $mclean['port'] > 10240 ) { $error .= '
  • '.lang('error_portinvalid').'
  • '; } - if( $mailprefs['timeout'] == '' ) $mailprefs['timeout'] = 180; - if( $mailprefs['timeout'] < 1 || $mailprefs['timeout'] > 3600 ) { + if( $mclean['timeout'] == '' ) $mclean['timeout'] = 180; + if( $mclean['timeout'] < 1 || $mclean['timeout'] > 3600 ) { $error .= '
  • '.lang('error_timeoutinvalid').'
  • '; } - if( $mailprefs['smtpauth'] ) { - if( $mailprefs['username'] == '' ) $error .= '
  • '.lang('error_usernamerequired').'
  • '; - if( $mailprefs['password'] == '' ) $error .= '
  • '.lang('error_passwordrequired').'
  • '; + if( $mclean['smtpauth'] ) { + if( $mclean['username'] == '' ) $error .= '
  • '.lang('error_usernamerequired').'
  • '; + if( $mclean['password'] == '' ) $error .= '
  • '.lang('error_passwordrequired').'
  • '; } } - // save. + $mailprefs = $mclean + $mailprefs; if( !$error ) { - cms_siteprefs::set('mail_is_set',1); cms_siteprefs::set('mailprefs',serialize($mailprefs)); + cms_siteprefs::set('mail_is_set',1); } break; case 'setup': - if (isset($_POST['lock_timeout'])) $lock_timeout = (int)$_POST['lock_timeout']; - if (isset($_POST['xmlmodulerepository'])) $xmlmodulerepository = cleanValue($_POST['xmlmodulerepository']); - if (isset($_POST['checkversion'])) $checkversion = (int) $_POST['checkversion']; - if (isset($_POST['global_umask'])) $global_umask = cleanValue($_POST['global_umask']); - cms_siteprefs::set('global_umask', $global_umask); - cms_siteprefs::set('xmlmodulerepository', $xmlmodulerepository); - cms_siteprefs::set('checkversion', $checkversion); - cms_siteprefs::set('lock_timeout',$lock_timeout); + if( isset($_POST['lock_timeout']) ) { + $lock_timeout = (int)$_POST['lock_timeout']; + cms_siteprefs::set('lock_timeout',$lock_timeout); + } + if( isset($_POST['xmlmodulerepository']) ) { + $xmlmodulerepository = cleanValue($_POST['xmlmodulerepository']); + cms_siteprefs::set('xmlmodulerepository',$xmlmodulerepository); + } + if( isset($_POST['checkversion']) ) { + $checkversion = (int) $_POST['checkversion']; + cms_siteprefs::set('checkversion',$checkversion); + } + if( isset($_POST['global_umask']) ) { + $global_umask = cleanValue($_POST['global_umask']); + cms_siteprefs::set('global_umask',$global_umask); + } if( isset($_POST['allow_browser_cache']) ) { $allow_browser_cache = (int)$_POST['allow_browser_cache']; cms_siteprefs::set('allow_browser_cache',$allow_browser_cache); @@ -405,201 +497,189 @@ function siteprefs_display_permissions($permsarr) $auto_clear_cache_age = (int)$_POST['auto_clear_cache_age']; cms_siteprefs::set('auto_clear_cache_age',$auto_clear_cache_age); } - if (isset($_POST['adminlog_lifetime'])) { + if( isset($_POST['adminlog_lifetime']) ) { $adminlog_lifetime = (int)$_POST['adminlog_lifetime']; cms_siteprefs::set('adminlog_lifetime',$adminlog_lifetime); } + if( $pjobs && isset($_POST['jobs_interval']) ) { + $jobs_interval = max(3,min(60,(int)$_POST['jobs_interval'])); + cms_siteprefs::set('jobs_interval',$jobs_interval); + $jobs_timeout = max(10,min(600,(int)$_POST['jobs_timeout'])); + cms_siteprefs::set('jobs_timeout',$jobs_timeout); + $job_maxerrs = max(0,min(20,(int)$_POST['job_maxerrs'])); + cms_siteprefs::set('job_maxerrs',$job_maxerrs); + } + if( $devmode && isset($_POST['privatePath']) ) { + $opath = $ppath; + $ofull = private_place('',$config); + $ppath = trim($_POST['privatePath'],' ,\\/'); + $ppath = strtr($ppath,[' '=>'','/'=>',','\\'=>',']); + cms_siteprefs::set('privatePath',$ppath); + $pfull = private_place('',$config); + if( !$pfull ) { + audit('','Global settings','Ignored invalid path: '.$ppath); + cms_siteprefs::set('privatePath',$opath); + //$error .= "
  • ".lang('TODO')."
  • "; + } + elseif( $pfull != $ofull ) { + //TODO check stuff, do stuff e.g. rename, move content + audit('','Global settings','Private path changed from: '.$opath); + audit('','Global settings','Private path changed to: '.$ppath); + $fp = cms_join_path(CMS_ROOT_PATH,'lib','classes','dbPath'); + chmod($fp,0666); + file_put_contents($fp,$ppath); + usleep(40000); + chmod($fp,0444); + //TODO reconcile access by installer upgrade or refresh ? + } + } break; case 'smarty': - if( isset($_POST['use_smartycache']) ) { - $use_smartycache = (int)$_POST['use_smartycache']; - cms_siteprefs::set('use_smartycache',$use_smartycache); - } - if( isset($_POST['use_smartycompilecheck']) ) { - $use_smartycompilecheck = (int)$_POST['use_smartycompilecheck']; - cms_siteprefs::set('use_smartycompilecheck',$use_smartycompilecheck); - } + $use_smartycache = (isset($_POST['use_smartycache'])) ? (int)$_POST['use_smartycache'] : 0; + cms_siteprefs::set('use_smartycache',$use_smartycache); + $SmartyFrontcacheLife = max(0, min(180, (int)$_POST['SmartyFrontcacheLife'])); + cms_siteprefs::set('SmartyFrontcacheLife',$SmartyFrontcacheLife); + $SmartyAdmincacheLife = max(0, min(180, (int)$_POST['SmartyAdmincacheLife'])); + cms_siteprefs::set('SmartyAdmincacheLife',$SmartyAdmincacheLife); + $use_smartycompilecheck = (isset($_POST['use_smartycompilecheck'])) ? (int)$_POST['use_smartycompilecheck'] : 0; + cms_siteprefs::set('use_smartycompilecheck',$use_smartycompilecheck); $gCms->clear_cached_files(); break; } // put mention into the admin log if( !$error ) { - audit('', 'Global Settings', 'Edited'); - $message .= lang('siteprefsupdated'); + audit('', 'Global settings', 'Edited'); + if( !isset($message) ) $message .= lang('siteprefsupdated'); } } else { - $error .= "
  • ".lang('noaccessto', array('Modify Site Permissions'))."
  • "; + $error .= "
  • ".lang('noaccessto', 'Modify Site Permissions')."
  • "; } } -/** - * Build page - */ +// Build page -include_once("header.php"); +require_once 'header.php'; -if ($error != "") $themeObject->ShowErrors($error); -if ($message != "") $themeObject->ShowMessage($message); +if( $error ) $themeObject->ShowErrors($error); +if( $message ) $themeObject->ShowMessage($message); // Make sure cache folder is writable -if (FALSE == is_writable(TMP_CACHE_LOCATION) || - FALSE == is_writable(TMP_TEMPLATES_C_LOCATION) ) { +if( !is_writable(TMP_CACHE_LOCATION) || + !is_writable(TMP_TEMPLATES_C_LOCATION) ) { $themeObject->ShowErrors(lang('cachenotwritable')); } +$tpl = $smarty->createTemplate('admin_tpl:siteprefs.tpl',null,null,$smarty,false); + $modules = ModuleOperations::get_instance()->get_modules_with_capability('search'); -if( is_array($modules) && count($modules) ) { +if( $modules && is_array($modules) ) { $tmp = []; $tmp['-1'] = lang('none'); - for($i = 0, $iMax = count($modules); $i < $iMax; $i++ ) { + for( $i = 0, $iMax = count($modules); $i < $iMax; $i++ ) { $tmp[$modules[$i]] = $modules[$i]; } - $smarty->assign('search_modules',$tmp); + $tpl->assign('search_modules',$tmp); } -$maileritems = []; -$maileritems['mail'] = 'mail'; -$maileritems['sendmail'] = 'sendmail'; -$maileritems['smtp'] = 'smtp'; -$smarty->assign('maileritems',$maileritems); +$maileritems = [ + 'mail'=>'mail', + 'sendmail'=>'sendmail', + 'smtp'=>'smtp' +]; +$tpl->assign('maileritems',$maileritems); $opts = []; $opts[''] = lang('none'); $opts['ssl'] = 'SSL'; $opts['tls'] = 'TLS'; -$smarty->assign('secure_opts',$opts); -$smarty->assign('mail_is_set',$mail_is_set); -$smarty->assign('mailprefs',$mailprefs); +$tpl->assign('secure_opts',$opts); +$tpl->assign('mailprefs',$mailprefs); +$tpl->assign('mail_is_set',$mail_is_set); -$smarty->assign('languages',get_language_list()); -$smarty->assign('tab',$tab); -$smarty->assign('pretty_urls',$pretty_urls); +$tpl->assign('languages',get_language_list()); +$tpl->assign('tab',$tab); // need a list of wysiwyg modules. -{ - $tmp = module_meta::get_instance()->module_list_by_capability('wysiwyg'); - $tmp2 = array(-1=>lang('none')); - for($i = 0, $iMax = count($tmp); $i < $iMax; $i++ ) { - $tmp2[$tmp[$i]] = $tmp[$i]; - } - $smarty->assign('wysiwyg',$tmp2); +$tmp = module_meta::get_instance()->module_list_by_capability('wysiwyg'); +$tmp2 = [-1 => lang('none')]; +for( $i = 0, $iMax = count($tmp); $i < $iMax; $i++ ) { + $tmp2[$tmp[$i]] = $tmp[$i]; } +$tpl->assign('wysiwyg',$tmp2); -if ($dir = opendir(__DIR__ . "/themes/")) -{ +if( ($dir = opendir(__DIR__ . '/themes')) ) { $themes = []; - while (($file = readdir($dir)) !== false ) { - if( @is_dir("themes/".$file) && ($file[0]!='.') && @is_readable("themes/{$file}/{$file}Theme.php")) { + while( ($file = readdir($dir)) !== false ) { + if( $file[0] != '.' && @is_dir("themes/$file") && @is_readable("themes/$file/{$file}Theme.php") ) { $themes[$file] = $file; } } - $smarty->assign('themes',$themes); - $smarty->assign('logintheme',cms_siteprefs::get('logintheme','default')); -} - -$smarty->assign('tabs_end',$themeObject->EndTabContent()); -$smarty->assign('general_start',$themeObject->StartTab("general")); -$smarty->assign('editcontent_start',$themeObject->StartTab("editcontent")); -$smarty->assign('sitedown_start',$themeObject->StartTab("sitedown")); -$smarty->assign('setup_start',$themeObject->StartTab("setup")); -$smarty->assign('smarty_start',$themeObject->StartTab("smarty")); -$smarty->assign('tab_end',$themeObject->EndTab()); - -$smarty->assign('SECURE_PARAM_NAME',CMS_SECURE_PARAM_NAME); -$smarty->assign('CMS_USER_KEY',$_SESSION[CMS_USER_KEY]); -$smarty->assign('sitename',$sitename); -$smarty->assign('global_umask',$global_umask); -$smarty->assign('testresults',$testresults); -$smarty->assign('frontendlang',$frontendlang); -$smarty->assign('frontendwysiwyg',$frontendwysiwyg); -$smarty->assign('backendwysiwyg',$backendwysiwyg); -$smarty->assign('metadata',$metadata); -$smarty->assign('enablesitedownmessage',$enablesitedownmessage); -$smarty->assign('use_wysiwyg',$use_wysiwyg); -$smarty->assign('textarea_sitedownmessage',create_textarea($use_wysiwyg,$sitedownmessage,'sitedownmessage','pagesmalltextarea')); -$smarty->assign('checkversion',$checkversion); -$smarty->assign('defaultdateformat',$defaultdateformat); -$smarty->assign('lock_timeout',$lock_timeout); -$smarty->assign('sitedownexcludes',$sitedownexcludes); -$smarty->assign('sitedownexcludeadmins',$sitedownexcludeadmins); -$smarty->assign('basic_attributes',explode(',',$basic_attributes)); -$smarty->assign('disallowed_contenttypes',explode(',',$disallowed_contenttypes)); -$smarty->assign('thumbnail_width',$thumbnail_width); -$smarty->assign('thumbnail_height',$thumbnail_height); -$smarty->assign('allow_browser_cache',$allow_browser_cache); -$smarty->assign('browser_cache_expiry',$browser_cache_expiry); -$smarty->assign('auto_clear_cache_age',$auto_clear_cache_age); -$smarty->assign('content_autocreate_urls',$content_autocreate_urls); -$smarty->assign('content_autocreate_flaturls',$content_autocreate_flaturls); -$smarty->assign('content_mandatory_urls',$content_mandatory_urls); -$smarty->assign('content_imagefield_path',$content_imagefield_path); -$smarty->assign('content_thumbnailfield_path',$content_thumbnailfield_path); -$smarty->assign('content_cssnameisblockname',$content_cssnameisblockname); -$smarty->assign('contentimage_path',$contentimage_path); -$smarty->assign('adminlog_lifetime',$adminlog_lifetime); -$smarty->assign('search_module',$search_module); -$smarty->assign('use_smartycache',$use_smartycache); -$smarty->assign('use_smartycompilecheck',$use_smartycompilecheck); - -$tmp = array( - 60*60*24=>lang('adminlog_1day'), - 60*60*24*7=>lang('adminlog_1week'), - 60*60*24*14=>lang('adminlog_2weeks'), - 60*60*24*31=>lang('adminlog_1month'), - 60*60*24*31*3=>lang('adminlog_3months'), - 60*60*24*31*6=>lang('adminlog_6months'), - -1=>lang('adminlog_manual')); -$smarty->assign('adminlog_options',$tmp); - -$smarty->assign('lang_autoclearcache',lang('autoclearcache')); - -$smarty->assign('lang_cancel',lang('cancel')); -$smarty->assign('lang_submit',lang('submit')); -$smarty->assign('lang_clearcache',lang('clearcache')); -$smarty->assign('lang_clear',lang('clear')); -$smarty->assign('lang_frontendlang',lang('frontendlang')); -$smarty->assign('lang_frontendwysiwygtouse',lang('frontendwysiwygtouse')); -$smarty->assign('lang_template',lang('template')); -$smarty->assign('lang_date_format_string_help',lang('date_format_string_help')); -$smarty->assign('lang_info_sitedownexcludes',lang('info_sitedownexcludes')); - -$all_attributes = null; -{ - $content_obj = new Content; // should this be the default type? - $list = $content_obj->GetProperties(); - if( is_array($list) && count($list) ) { - // pre-remove some items. - $all_attributes = []; - for($i = 0, $iMax = count($list); $i < $iMax; $i++ ) { - $obj = $list[$i]; - if( $obj->tab == $content_obj::TAB_PERMS ) continue; - if( !isset($all_attributes[$obj->tab]) ) $all_attributes[$obj->tab] = array('label'=>lang($obj->tab),'value'=>[]); - $all_attributes[$obj->tab]['value'][] = array('value'=>$obj->name,'label'=>lang($obj->name)); - } + if( count($themes) > 1 ) { + $tpl->assign('themes',$themes); + $tpl->assign('logintheme',cms_siteprefs::get('logintheme','default')); } - $txt = CmsFormUtils::create_option($all_attributes); } -$smarty->assign('all_attributes',$all_attributes); -$smarty->assign('smarty_cacheoptions',array('always'=>lang('always'),'never'=>lang('never'),'moduledecides'=>lang('moduledecides'))); -$smarty->assign('smarty_cacheoptions2',array('always'=>lang('always'),'never'=>lang('never'))); - -$contentops = cmsms()->GetContentOperations(); -$all_contenttypes = $contentops->ListContentTypes(false,false); -$smarty->assign('all_contenttypes',$all_contenttypes); -$yesno = array(0=>lang('no'),1=>lang('yes')); -$smarty->assign('yesno',$yesno); - -$titlemenu = array(0=>lang('menutext'),1=>lang('title')); -$smarty->assign('titlemenu',$titlemenu); - -$smarty->assign('backurl', $themeObject->backUrl()); -$smarty->assign('formurl', $thisurl); - -# begin output -$smarty->display('siteprefs.tpl'); -include_once("footer.php"); +$tpl->assign('pjobs',$pjobs); +if( $pjobs ) { + $tpl->assign('jobs_interval',$jobs_interval); + $tpl->assign('jobs_timeout',$jobs_timeout); + $tpl->assign('job_maxerrs',$job_maxerrs); +} +// see also $smarty-assigned var $secureparam +$tpl->assign('securename',CMS_SECURE_PARAM_NAME) + ->assign('secureval',$_SESSION[CMS_USER_KEY]) + ->assign('sitename',$sitename) + ->assign('site_ipaddr',cms_utils::get_real_ip()) + ->assign('global_umask',$global_umask) + ->assign('testresults',$testresults) + ->assign('frontendlang',$frontendlang) + ->assign('frontendwysiwyg',$frontendwysiwyg) + ->assign('backendwysiwyg',$backendwysiwyg) + ->assign('metadata',$metadata) + ->assign('notices_timeout',($notices_timeout>0)?(int)$notices_timeout:'') + ->assign('enablesitedownmessage',$enablesitedownmessage) + ->assign('use_wysiwyg',$use_wysiwyg) + ->assign('textarea_sitedownmessage',create_textarea($use_wysiwyg,$sitedownmessage,'sitedownmessage','pagesmalltextarea')) + ->assign('checkversion',$checkversion) + ->assign('defaultdateformat',$defaultdateformat) + ->assign('lock_timeout',$lock_timeout) + ->assign('sitedownexcludes',$sitedownexcludes) + ->assign('sitedownexcludeadmins',$sitedownexcludeadmins) + ->assign('thumbnail_width',$thumbnail_width) + ->assign('thumbnail_height',$thumbnail_height) + ->assign('allow_browser_cache',$allow_browser_cache) + ->assign('browser_cache_expiry',$browser_cache_expiry) + ->assign('auto_clear_cache_age',$auto_clear_cache_age) + ->assign('adminlog_lifetime',$adminlog_lifetime) + ->assign('search_module',$search_module) + ->assign('SmartyAdmincacheLife',$SmartyAdmincacheLife) + ->assign('SmartyFrontcacheLife',$SmartyFrontcacheLife) + ->assign('use_smartycache',$use_smartycache) + ->assign('use_smartycompilecheck',$use_smartycompilecheck); +if( $devmode ) { + $tpl->assign('privatePath',$ppath); +} -?> +$tmp = [ + 86400=>lang('adminlog_1day'), + 86400*7=>lang('adminlog_1week'), + 86400*14=>lang('adminlog_2weeks'), + 86400*31=>lang('adminlog_1month'), + 86400*91=>lang('adminlog_3months'), + 86400*182=>lang('adminlog_6months'), + -1=>lang('adminlog_manual') +]; +$tpl->assign('adminlog_options',$tmp); +$tpl->assign('smarty_cacheoptions',['always'=>lang('always'),'never'=>lang('never'),'moduledecides'=>lang('moduledecides')]); +$tpl->assign('smarty_cacheoptions2',['always'=>lang('always'),'never'=>lang('never')]); +$tpl->assign('yesno',[0=>lang('no'),1=>lang('yes')]); +$tpl->assign('titlemenu',[0=>lang('menutext'),1=>lang('title')]); +$tpl->assign('backurl',$themeObject->backUrl()); +$tpl->assign('formurl',basename(__FILE__).$urlext); + +$tpl->display(); + +require_once 'footer.php'; diff --git a/admin/style.php b/admin/style.php index 0f06d2d1..8fd9351a 100644 --- a/admin/style.php +++ b/admin/style.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,7 +15,7 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: style.php 10940 2016-12-28 01:19:00Z calguy1000 $ +#$Id$ $CMS_ADMIN_PAGE = 1; $CMS_STYLESHEET = TRUE; @@ -57,6 +56,7 @@ if( !is_object($object) ) continue; if( $object->HasAdmin() ) echo $object->AdminStyle(); } + unset($object); } ?> diff --git a/admin/systeminfo.php b/admin/systeminfo.php index 6b887be4..0b97c1b2 100644 --- a/admin/systeminfo.php +++ b/admin/systeminfo.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,80 +15,55 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: supportinfo.php 4216 2007-10-06 19:28:55Z wishy $ +#$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'; +$urlext = '?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]; check_login(); - $userid = get_userid(); -$access = check_permission($userid, "Modify Site Preferences"); +$access = check_permission($userid, 'Modify Site Preferences'); if (!$access) { - die('Permission Denied'); -return; + exit(lang('no_permission')); //TODO throw if can be caught } -include_once("header.php"); - -define('CMS_BASE', dirname(dirname(__FILE__))); -require_once cms_join_path(CMS_BASE, 'lib', 'test.functions.php'); +require_once 'header.php'; +require_once cms_join_path(dirname(__DIR__), 'lib', 'test.functions.php'); -function installerHelpLanguage( $lang, $default_null=null ) +function installerHelpLanguage($lang, $default_null = null)//: string { - if( (!is_null($default_null)) && ($default_null == $lang) ) return ''; - return substr($lang, 0, 2); + if( (!is_null($default_null)) && ($default_null == $lang) ) return ''; + return substr($lang, 0, 2); } -function systeminfo_lang($params, $smarty) -{ - if( count($params) ) - { - $tmp = array(); - foreach( $params as $k=>$v) - { - $tmp[] = $v; - } - - $str = $tmp[0]; - $tmp2 = array(); - for( $i = 1; $i < count($tmp); $i++ ) - $tmp2[] = $params[$i]; - return lang($str,$tmp2); - } -} - -$gCms = cmsms(); -$smarty = $gCms->GetSmarty(); -$smarty->register_function('si_lang','systeminfo_lang'); -$smarty->caching = false; -$smarty->force_compile = true; -$db = $gCms->GetDb(); - - +$themeObject->set_value('pagetitle', 'systeminfo'); -//smartyfier -$smarty->assign('themename', $themeObject->themeName); -$smarty->assign('showheader', $themeObject->ShowHeader('systeminfo')); -$smarty->assign('backurl', $themeObject->BackUrl()); -$smarty->assign('systeminfo_cleanreport', 'systeminfo.php'.$urlext.'&cleanreport=1'); +if(isset($_GET['cleanreport']) && $_GET['cleanreport'] == 1) { + $tplname = 'systeminfo.txt.tpl'; +} +else { + $tplname = 'systeminfo.tpl'; +} +$tpl = $smarty->createTemplate("admin_tpl:$tplname", null, null, $smarty, false); +$tpl->assign('themename', $themeObject->themeName); +$tpl->assign('backurl', $themeObject->BackUrl()); +$tpl->assign('systeminfo_cleanreport', 'systeminfo.php'.$urlext.'&cleanreport=1'); /* Default help url */ -$smarty->assign('cms_install_help_url', 'https://docs.cmsmadesimple.org/installation/installing/permissions-and-php-settings'); - +$tpl->assign('cms_install_help_url', 'https://docs.cmsmadesimple.org/installation/installing/permissions-and-php-settings'); /* CMS Install Information */ -$smarty->assign('cms_version', $GLOBALS['CMS_VERSION']); - +$tpl->assign('cms_version', $CMS_VERSION); +$db = cmsms()->GetDb(); $query = "SELECT * FROM ".CMS_DB_PREFIX."modules WHERE active=1"; -$modules = $db->GetArray($query); -asort($modules); -$smarty->assign('installed_modules', $modules); +$modules = $db->GetArray($query); //TODO any null-valued strings to process? +usort($modules, function($a,$b) { return strcasecmp($a['module_name'], $b['module_name']); }); +$tpl->assign('installed_modules', $modules); clearstatcache(); $tmp = array(0=>array(), 1=>array()); @@ -110,6 +84,8 @@ function systeminfo_lang($params, $smarty) $tmp[1]['image_uploads_path'] = testConfig('image_uploads_path', 'image_uploads_path', 'testDirWrite'); $tmp[1]['image_uploads_url'] = testConfig('image_uploads_url', 'image_uploads_url'); $tmp[1]['ssl_uploads_url'] = testConfig('ssl_uploads_url', 'ssl_uploads_url'); +$tmp[1]['themes_path'] = testConfig('themes_path', 'themes_path', 'testDirWrite'); // since 2.2.22F2 +$tmp[1]['themes_url'] = testConfig('themes_url', 'themes_url'); // since 2.2.22F2 $tmp[0]['auto_alias_content'] = testConfig('auto_alias_content', 'auto_alias_content'); $tmp[0]['locale'] = testConfig('locale', 'locale'); //$tmp[0]['default_encoding'] = testConfig('default_encoding', 'default_encoding'); @@ -117,31 +93,34 @@ function systeminfo_lang($params, $smarty) $tmp[0]['set_names'] = testConfig('set_names', 'set_names'); $tmp[0]['timezone'] = testConfig('timezone', 'timezone'); $tmp[0]['permissive_smarty'] = testConfig('permissive_smarty','permissive_smarty'); -$smarty->assign('count_config_info', count($tmp[0])); -$smarty->assign('config_info', $tmp); +$tpl->assign('count_config_info', count($tmp[0])); +$tpl->assign('config_info', $tmp); /* Performance Information */ $tmp = array(0=>array(), 1=>array()); -$res = get_site_preference('allow_browser_cache',0); -$tmp[0]['allow_browser_cache'] = testBoolean(0, lang('allow_browser_cache'),$res,lang('test_allow_browser_cache'), FALSE); -$res = get_site_preference('browser_cache_expiry',60); -$tmp[0]['browser_cache_expiry'] = testRange(0, lang('browser_cache_expiry'),$res,lang('test_browser_cache_expiry'),1,60,FALSE); - -if( version_compare(phpversion(),'5.5') >= 0 ) { +$res = (bool)cms_siteprefs::get('allow_browser_cache', false); +$tmp[0]['allow_browser_cache'] = testBoolean(false, lang('allow_browser_cache'), $res, lang('test_allow_browser_cache'), false); +$res = cms_siteprefs::get('browser_cache_expiry', 60); +$tmp[0]['browser_cache_expiry'] = testRange(false, lang('browser_cache_expiry'), $res, lang('test_browser_cache_expiry'), 1, 60, false); +$phpv = PHP_VERSION_ID; +if( $phpv < 70000 ) { + if( $phpv >= 50500 ) { $opcache = ini_get('opcache.enable'); - $tmp[0]['php_opcache'] = testBoolean(0, lang('php_opcache'), $opcache, '', false, false, 'opcache_enabled'); -} else { - $tmp[0]['php_opcache'] = testBoolean(0, lang('php_opcache'), false, '', false, false, 'opcache_notavailable'); + $tmp[0]['php_opcache'] = testBoolean(false, lang('php_opcache'), $opcache, '', false, false, 'opcache_enabled'); + } + else { + $tmp[0]['php_opcache'] = testBoolean(false, lang('php_opcache'), false, '', false, false, 'opcache_notavailable'); + } } -$res = (bool) get_site_preference('use_smartycache', FALSE); -$tmp[0]['smarty_cache'] = testBoolean(0, lang('prompt_use_smartycaching'),$res,lang('test_smarty_caching'), FALSE); -$res = get_site_preference('use_smartycompilecheck', FALSE); -$tmp[0]['smarty_compilecheck'] = testBoolean(0, lang('prompt_smarty_compilecheck'),$res,lang('test_smarty_caching'),FALSE,TRUE); -$res = get_site_preference('auto_clear_cache_age', 0); -$tmp[0]['auto_clear_cache_age'] = testBoolean(0, lang('autoclearcache2'),$res,lang('test_auto_clear_cache_age'), FALSE); +$res = (bool)cms_siteprefs::get('use_smartycache', 0); +$tmp[0]['smarty_cache'] = testBoolean(false, lang('prompt_use_smartycaching'), $res, lang('test_smarty_caching'), false); +$res = (bool)cms_siteprefs::get('use_smartycompilecheck', false); +$tmp[0]['smarty_compilecheck'] = testBoolean(false, lang('prompt_smarty_compilecheck'), $res, lang('test_smarty_compiled'), false, true); +$res = cms_siteprefs::get('auto_clear_cache_age', 0); +$tmp[0]['auto_clear_cache_age'] = testBoolean(false, lang('autoclearcache2'), $res, lang('test_auto_clear_cache_age'), false); -$smarty->assign('performance_info', $tmp); +$tpl->assign('performance_info', $tmp); /* PHP Information */ @@ -152,121 +131,117 @@ function systeminfo_lang($params, $smarty) $open_basedir = ini_get('open_basedir'); list($minimum, $recommended) = getTestValues('php_version'); -$tmp[0]['phpversion'] = testVersionRange(0, 'phpversion', phpversion(), '', $minimum, $recommended, false); +$tmp[0]['phpversion'] = testVersionRange(false, 'phpversion', PHP_VERSION, '', $minimum, $recommended, false); -$tmp[0]['md5_function'] = testBoolean(0, 'md5_function', function_exists('md5'), '', false, false, 'Function_md5_disabled'); -$tmp[0]['json_function'] = testBoolean(0, 'json_function', function_exists('json_decode'), '', false, false, 'json_disabled'); +$tmp[0]['md5_function'] = testBoolean(false, 'md5_function', function_exists('md5'), '', false, false, 'Function_md5_disabled'); +$tmp[0]['json_function'] = testBoolean(false, 'json_function', function_exists('json_decode'), '', false, false, 'json_disabled'); list($minimum, $recommended) = getTestValues('gd_version'); -$tmp[0]['gd_version'] = testGDVersion(0, 'gd_version', $minimum, '', 'min_GD_version'); +$tmp[0]['gd_version'] = testGDVersion(false, 'gd_version', $minimum, '', 'min_GD_version'); -$tmp[0]['tempnam_function'] = testBoolean(0, 'tempnam_function', function_exists('tempnam'), '', false, false, 'Function_tempnam_disabled'); +$tmp[0]['tempnam_function'] = testBoolean(false, 'tempnam_function', function_exists('tempnam'), '', false, false, 'Function_tempnam_disabled'); -$tmp[0]['magic_quotes_runtime'] = testBoolean(0, 'magic_quotes_runtime', 'magic_quotes_runtime', lang('magic_quotes_runtime_on'), true, true, 'magic_quotes_runtime_On'); -$tmp[0]['E_ALL'] = testIntegerMask(0,lang('test_error_eall'), 'error_reporting',E_ALL,lang('test_eall_failed'),true,false,false); -$tmp[0]['E_STRICT'] = testIntegerMask(0,lang('test_error_estrict'), 'error_reporting',E_STRICT,lang('test_estrict_failed'),true,true,false); +$tmp[0]['magic_quotes_runtime'] = testBoolean(false, 'magic_quotes_runtime', 'magic_quotes_runtime', lang('magic_quotes_runtime_on'), true, true, 'magic_quotes_runtime_On'); +$tmp[0]['E_ALL'] = testIntegerMask(false,lang('test_error_eall'), 'error_reporting',E_ALL,lang('test_eall_failed'),true,false,false); +if( $phpv < 80400 ) { //E_STRICT deprecated and useless since PHP 8.4 + $tmp[0]['E_STRICT'] = testIntegerMask(false,lang('test_error_estrict'), 'error_reporting',E_STRICT,lang('test_estrict_failed'),true,true,false); +} if( defined('E_DEPRECATED') ) { - $tmp[0]['E_DEPRECATED'] = testIntegerMask(0,lang('test_error_edeprecated'), 'error_reporting',E_DEPRECATED,lang('test_edeprecated_failed'),true,true,false); - } + $tmp[0]['E_DEPRECATED'] = testIntegerMask(false,lang('test_error_edeprecated'), 'error_reporting',E_DEPRECATED,lang('test_edeprecated_failed'),true,true,false); +} $_tmp = _testTimeSettings1(); $tmp[0]['test_file_timedifference'] = ($_tmp->value) ? testDummy('test_file_timedifference',lang('msg_notimedifference2'),'green') : testDummy('test_file_timedifference',lang('error_timedifference2'),'red'); $_tmp = _testTimeSettings2(); $tmp[0]['test_db_timedifference'] = ($_tmp->value) ? testDummy('test_db_timedifference',lang('msg_notimedifference2'),'green') : testDummy('test_file_timedifference',lang('error_timedifference2'),'red'); -$tmp[0]['create_dir_and_file'] = testCreateDirAndFile(0, '', ''); +$tmp[0]['create_dir_and_file'] = testCreateDirAndFile(false, '', ''); list($minimum, $recommended) = getTestValues('memory_limit'); -$tmp[0]['memory_limit'] = testRange(0, 'memory_limit', 'memory_limit', '', $minimum, $recommended, true, true, -1, 'memory_limit_range'); +$tmp[0]['memory_limit'] = testRange(false, 'memory_limit', 'memory_limit', '', $minimum, $recommended, true, true, -1, 'memory_limit_range'); list($minimum, $recommended) = getTestValues('max_execution_time'); -$tmp[0]['max_execution_time'] = testRange(0, 'max_execution_time', 'max_execution_time', '', $minimum, $recommended, true, false, 0, 'max_execution_time_range'); +$tmp[0]['max_execution_time'] = testRange(false, 'max_execution_time', 'max_execution_time', '', $minimum, $recommended, true, false, 0, 'max_execution_time_range'); -$tmp[0]['register_globals'] = testBoolean(0, lang('register_globals'), 'register_globals', '', true, true, 'register_globals_enabled'); +$tmp[0]['register_globals'] = testBoolean(false, lang('register_globals'), 'register_globals', '', true, true, 'register_globals_enabled'); $ob = ini_get('output_buffering'); -if( strtolower($ob) == 'off' || strtolower($ob) == 'on' ) - { - $tmp[0]['output_buffering'] = testBoolean(0, lang('output_buffering'), 'output_buffering', '', true, false, 'output_buffering_disabled'); - } -else - { - $tmp[0]['output_buffering'] = testInteger(0, lang('output_buffering'), 'output_buffering', '', true, true, 'output_buffering_disabled'); - } +if( strtolower($ob) == 'off' || strtolower($ob) == 'on' ) { + $tmp[0]['output_buffering'] = testBoolean(false, lang('output_buffering'), 'output_buffering', '', true, false, 'output_buffering_disabled'); +} +else { + $tmp[0]['output_buffering'] = testInteger(false, lang('output_buffering'), 'output_buffering', '', true, true, 'output_buffering_disabled'); +} -$tmp[0]['disable_functions'] = testString(0, lang('disable_functions'), 'disable_functions', '', true, 'green', 'yellow', 'disable_functions_not_empty'); +$tmp[0]['disable_functions'] = testString(false, lang('disable_functions'), 'disable_functions', '', true, 'green', 'yellow', 'disable_functions_not_empty'); -$tmp[0]['open_basedir'] = testString(0, lang('open_basedir'), $open_basedir, '', false, 'green', 'yellow', 'open_basedir_enabled'); +$tmp[0]['open_basedir'] = testString(false, lang('open_basedir'), $open_basedir, '', false, 'green', 'yellow', 'open_basedir_enabled'); -$tmp[0]['test_remote_url'] = testRemoteFile(0, 'test_remote_url', '', lang('test_remote_url_failed')); +$tmp[0]['test_remote_url'] = testRemoteFile(false, 'test_remote_url', '', lang('test_remote_url_failed')); -$tmp[0]['file_uploads'] = testBoolean(0, 'file_uploads', 'file_uploads', '', true, false, 'Function_file_uploads_disabled'); +$tmp[0]['file_uploads'] = testBoolean(false, 'file_uploads', 'file_uploads', '', true, false, 'Function_file_uploads_disabled'); list($minimum, $recommended) = getTestValues('post_max_size'); -$tmp[0]['post_max_size'] = testRange(0, 'post_max_size', 'post_max_size', '', $minimum, $recommended, true, true, null, 'min_post_max_size'); +$tmp[0]['post_max_size'] = testRange(false, 'post_max_size', 'post_max_size', '', $minimum, $recommended, true, true, null, 'min_post_max_size'); list($minimum, $recommended) = getTestValues('upload_max_filesize'); -$tmp[0]['upload_max_filesize'] = testRange(0, 'upload_max_filesize', 'upload_max_filesize', '', $minimum, $recommended, true, true, null, 'min_upload_max_filesize'); +$tmp[0]['upload_max_filesize'] = testRange(false, 'upload_max_filesize', 'upload_max_filesize', '', $minimum, $recommended, true, true, null, 'min_upload_max_filesize'); $session_save_path = testSessionSavePath(''); -if(empty($session_save_path)) -{ - $tmp[0]['session_save_path'] = testDummy('session_save_path', lang('os_session_save_path'), 'yellow', '', 'session_save_path_empty', ''); +if( empty($session_save_path) ) { + $tmp[0]['session_save_path'] = testDummy('session_save_path', lang('os_session_save_path'), 'yellow', '', 'session_save_path_empty', ''); } -elseif (! empty($open_basedir)) -{ - $tmp[0]['session_save_path'] = testDummy('session_save_path', lang('open_basedir_active'), 'yellow', '', 'No_check_session_save_path_with_open_basedir', ''); +elseif( !empty($open_basedir) ) { + $tmp[0]['session_save_path'] = testDummy('session_save_path', lang('open_basedir_active'), 'yellow', '', 'No_check_session_save_path_with_open_basedir', ''); } -else -{ - $tmp[0]['session_save_path'] = testDirWrite(0, lang('session_save_path'), $session_save_path, $session_save_path, 1); +else { + $tmp[0]['session_save_path'] = testDirWrite(false, lang('session_save_path'), $session_save_path, $session_save_path, 1); } -$tmp[0]['session_use_cookies'] = testBoolean(0, 'session.use_cookies', 'session.use_cookies'); +$tmp[0]['session_use_cookies'] = testBoolean(false, 'session.use_cookies', 'session.use_cookies'); -$tmp[0]['xml_function'] = testBoolean(1, 'xml_function', extension_loaded_or('xml'), '', false, false, 'Function_xml_disabled'); -$tmp[0]['xmlreader_class'] = testBoolean(1,'xmlreader_class',class_exists('XMLReader',false),'',false,false,'class_xmlreader_unavailable'); +$tmp[0]['xml_function'] = testBoolean(true, 'xml_function', extension_loaded_or('xml'), '', false, false, 'Function_xml_disabled'); +$tmp[0]['xmlreader_class'] = testBoolean(true, 'xmlreader_class', class_exists('XMLReader',false), '', false, false, 'class_xmlreader_unavailable'); -#$tmp[1]['file_get_contents'] = testBoolean(0, 'file_get_contents', function_exists('file_get_contents'), '', false, false, 'Function_file_get_content_disabled'); +#$tmp[1]['file_get_contents'] = testBoolean(false, 'file_get_contents', function_exists('file_get_contents'), '', false, false, 'Function_file_get_content_disabled'); $_log_errors_max_len = (ini_get('log_errors_max_len')) ? ini_get('log_errors_max_len').'0' : '99'; ini_set('log_errors_max_len', $_log_errors_max_len); $result = (ini_get('log_errors_max_len') == $_log_errors_max_len); -$tmp[0]['check_ini_set'] = testBoolean(0, 'check_ini_set', $result, lang('check_ini_set_off'), false, false, 'ini_set_disabled'); +$tmp[0]['check_ini_set'] = testBoolean(false, 'check_ini_set', $result, lang('check_ini_set_off'), false, false, 'ini_set_disabled'); $hascurl = 0; $curlgood = 0; $curl_version = ''; $min_curlversion = '7.19.7'; if( in_array('curl',get_loaded_extensions()) ) { - $hascurl = 1; - if( function_exists('curl_version') ) { - $t = curl_version(); - if( isset($t['version']) ) { - $curl_version = $t['version']; - if( version_compare($t['version'],$min_curlversion) >= 0 ) { - $curlgood = 1; - } - } + $hascurl = 1; + if( function_exists('curl_version') ) { + $t = curl_version(); + if( isset($t['version']) ) { + $curl_version = $t['version']; + if( version_compare($t['version'],$min_curlversion) >= 0 ) { + $curlgood = 1; + } } + } } if( !$hascurl ) { - $tmp[0]['curl'] = testDummy('curl',lang('off'),'yellow','','curl_not_available',''); + $tmp[0]['curl'] = testDummy('curl',lang('off'),'yellow','','curl_not_available',''); } else { - $tmp[0]['curl'] = testDummy('curl',lang('on'),'green'); - if( $curlgood ) { - $tmp[1]['curlversion'] = testDummy('curlversion', - lang('curl_versionstr',$curl_version,$min_curlversion), - 'green'); - } - else { - $tmp[1]['curlversion'] = testDummy('curlversion',lang('test_curlversion'),'yellow', - lang('curl_versionstr',$curl_version,$min_curlversion)); - } + $tmp[0]['curl'] = testDummy('curl',lang('on'),'green'); + if( $curlgood ) { + $tmp[1]['curlversion'] = testDummy('curlversion', + lang('curl_versionstr',$curl_version,$min_curlversion), + 'green'); + } + else { + $tmp[1]['curlversion'] = testDummy('curlversion',lang('curlversion'),'yellow', + lang('curl_versionstr',$curl_version,$min_curlversion)); + } } -$smarty->assign('count_php_information', count($tmp[0])); -$smarty->assign('php_information', $tmp); - +$tpl->assign('count_php_information', count($tmp[0])); +$tpl->assign('php_information', $tmp); /* Server Information */ @@ -275,85 +250,87 @@ function systeminfo_lang($params, $smarty) $tmp[0]['server_software'] = testDummy('', $_SERVER['SERVER_SOFTWARE'], ''); $tmp[0]['server_api'] = testDummy('', PHP_SAPI, ''); -$tmp[0]['server_os'] = testDummy('', PHP_OS . ' ' . php_uname('r') .' '. lang('on') .' '. php_uname('m'), ''); - -switch($config['dbms']) { //workaround: ServerInfo() is unsupported in adodblite - case 'mysqli': - case 'mysql': - $v = $db->GetOne('SELECT version()'); - $tmp[0]['server_db_type'] = testDummy('', 'MySQL ('.$config['dbms'].')', ''); - $_server_db = (false === strpos($v, "-")) ? $v : substr($v, 0, strpos($v, "-")); - list($minimum, $recommended) = getTestValues('mysql_version'); - $tmp[0]['server_db_version'] = testVersionRange(0, 'server_db_version', $_server_db, '', $minimum, $recommended, false); - - $grants = $db->GetArray('SHOW GRANTS FOR CURRENT_USER'); - if( !is_array($grants) || count($grants) == 0 ) { - $tmp[0]['server_db_grants'] = testDummy('db_grants',lang('os_db_grants'),'yellow','','error_no_grantall_info'); - } - else { - $found_grantall = 0; - function __check_grant_all($item,$key) - { - $item = strtoupper($item); - if( strstr($item,'GRANT ALL PRIVILEGES') !== FALSE ) - { - global $found_grantall; - $found_grantall = 1; - } - } - array_walk_recursive($grants,'__check_grant_all'); - if( !$found_grantall ) { - $tmp[0]['server_db_grants'] = testDummy('db_grants',lang('error_nograntall_found'),'yellow'); - } - else { - $tmp[0]['server_db_grants'] = testDummy('db_grants',lang('msg_grantall_found'),'green'); - } - } - break; +if( function_exists('php_uname') ) { + $tmp[0]['server_os'] = testDummy('', PHP_OS . ' ' . php_uname('r') .' '. lang('on') .' '. php_uname('m'), ''); // NOTE PHP_OS is the build-system +} +else { + $tmp[0]['server_os'] = 'Unknown'; // TODO fallack mechanism } +switch($config['dbms']) { //workaround: ServerInfo() is unsupported in adodblite and CMSMS Connection + case 'mysqli': + case 'mysql': + $v = $db->GetOne('SELECT version()'); + $tmp[0]['server_db_type'] = testDummy('', 'MySQL ('.$config['dbms'].')', ''); + $_server_db = (false === strpos($v, "-")) ? $v : substr($v, 0, strpos($v, "-")); + list($minimum, $recommended) = getTestValues('mysql_version'); + $tmp[0]['server_db_version'] = testVersionRange(false, 'server_db_version', $_server_db, '', $minimum, $recommended, false); + + $grants = $db->GetArray('SHOW GRANTS FOR CURRENT_USER'); + if( !is_array($grants) || count($grants) == 0 ) { + $tmp[0]['server_db_grants'] = testDummy('db_grants',lang('os_db_grants'),'yellow','','error_no_grantall_info'); + } + else { + $found_grantall = false; + function __check_grant_all($item,$key) + { + global $found_grantall; + if( stripos($item,'GRANT ALL PRIVILEGES') !== false ) { + $found_grantall = true; + } + } + array_walk_recursive($grants,'__check_grant_all'); + if( !$found_grantall ) { + $tmp[0]['server_db_grants'] = testDummy('db_grants',lang('error_nograntall_found'),'yellow'); + } + else { + $tmp[0]['server_db_grants'] = testDummy('db_grants',lang('msg_grantall_found'),'green'); + } + } + break; +} -$smarty->assign('count_server_info', count($tmp[0])); -$smarty->assign('server_info', $tmp); - +$tpl->assign('count_server_info', count($tmp[0])); +$tpl->assign('server_info', $tmp); $tmp = array(0=>array(), 1=>array()); -$dir = $config['root_path'] . DIRECTORY_SEPARATOR . 'tmp'; -$tmp[0]['tmp'] = testDirWrite(0, $dir, $dir); +$dir = CMS_ROOT_PATH . DIRECTORY_SEPARATOR . 'tmp'; +$tmp[0]['tmp'] = testDirWrite(false, $dir, $dir); $dir = TMP_CACHE_LOCATION; -$tmp[0]['tmp_cache'] = testDirWrite(0, $dir, $dir); +$tmp[0]['tmp_cache'] = testDirWrite(false, $dir, $dir); + +$dir = TMP_CONFIG_LOCATION; +$tmp[0]['tmp_config'] = testDirWrite(false, $dir, $dir); $dir = TMP_TEMPLATES_C_LOCATION; -$tmp[0]['templates_c'] = testDirWrite(0, $dir, $dir); +$tmp[0]['templates_c'] = testDirWrite(false, $dir, $dir); -$dir = $config['root_path'] . DIRECTORY_SEPARATOR . 'modules'; -$tmp[0]['modules'] = testDirWrite(0, $dir, $dir); +$dir = CMS_ROOT_PATH . DIRECTORY_SEPARATOR . 'modules'; +$tmp[0]['modules'] = testDirWrite(false, $dir, $dir); $dir = $config['uploads_path']; -$tmp[0]['uploads'] = testDirWrite(0, $dir, $dir); +$tmp[0]['uploads'] = testDirWrite(false, $dir, $dir); -$global_umask = get_site_preference('global_umask', '022'); -$tmp[0][lang('global_umask')] = testUmask(0, lang('global_umask'), $global_umask); +// deprecated since 2.2.19 Avoid using umask() in multithreaded webservers, all running scripts use the same umask +$global_umask = cms_siteprefs::get('global_umask', '022'); +$tmp[0][lang('global_umask')] = testUmask(false, lang('global_umask'), $global_umask); $result = is_writable(CONFIG_FILE_LOCATION); -#$tmp[1]['config_file'] = testFileWritable(0, lang('config_writable'), CONFIG_FILE_LOCATION, ''); +#$tmp[1]['config_file'] = testFileWritable(false, lang('config_writable'), CONFIG_FILE_LOCATION, ''); $tmp[0]['config_file'] = testDummy('', substr(sprintf('%o', fileperms(CONFIG_FILE_LOCATION)), -4), (($result) ? 'red' : 'green'), (($result) ? lang('config_writable') : '')); -$smarty->assign('count_permission_info', count($tmp[0])); -$smarty->assign('permission_info', $tmp); - +$tpl->assign('count_permission_info', count($tmp[0])); +$tpl->assign('permission_info', $tmp); if(isset($_GET['cleanreport']) && $_GET['cleanreport'] == 1) { $orig_lang = CmsNlsOperations::get_current_language(); CmsNlsOperations::set_language('en_US'); - echo $smarty->fetch('systeminfo.txt.tpl'); + $tpl->display(); CmsNlsOperations::set_language($orig_lang); } -else echo $smarty->fetch('systeminfo.tpl'); - - -include_once("footer.php"); - -?> +else { + $tpl->display(); +} +require_once 'footer.php'; diff --git a/admin/systemmaintenance.php b/admin/systemmaintenance.php index e03dc955..70d23d48 100644 --- a/admin/systemmaintenance.php +++ b/admin/systemmaintenance.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,286 +15,318 @@ #along with this program; if not, write to the Free Software #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#$Id: supportinfo.php 4216 2007-10-06 19:28:55Z wishy $ -$CMS_ADMIN_PAGE = 1; +#$Id$ -// -// note, much of this code is mysql specific -// +$CMS_ADMIN_PAGE = 1; -require_once("../lib/include.php"); -$urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]; +require_once '../lib/include.php'; check_login(); - $userid = get_userid(); -$access = check_permission($userid, "Modify Site Preferences"); +$access = check_permission($userid, 'Modify Site Preferences'); if (!$access) { - die('Permission Denied'); - return; + exit(lang('no_permission')); //TODO throw if can be caught } +$pjobs = check_permission($userid, 'Manage Jobs'); -include_once("header.php"); - -define('CMS_BASE', dirname(dirname(__FILE__))); -require_once cms_join_path(CMS_BASE, 'lib', 'test.functions.php'); +require_once 'header.php'; +require_once cms_join_path(dirname(__DIR__), 'lib', 'test.functions.php'); +$active_content = false; +$active_db = false; +$active_jobs = false; +$active_log = false; $gCms = cmsms(); -$smarty = $gCms->GetSmarty(); -$smarty->caching = false; -$smarty->force_compile = true; -$db = $gCms->GetDb(); - -$smarty->assign('theme', $themeObject); - -/* - * - * Database - * - */ - - -$query = "SHOW TABLES LIKE ?"; -$tablestmp = $db->GetArray($query,array(CMS_DB_PREFIX.'%')); -$tables = array(); -$nonseqtables = array(); +// Database +$db = $gCms->GetDb(); +$query = 'SHOW TABLES LIKE ?'; +$tablestmp = $db->GetArray($query, [CMS_DB_PREFIX.'%']); +$tables = []; +$nonseqtables = []; foreach ($tablestmp as $table) { foreach ($table as $tabeinfo => $tablename) { $tables[] = $tablename; - if (!stripos($tablename, "_seq")) { + if (stripos($tablename, '_seq') === false) { $nonseqtables[] = $tablename; } } } -$smarty->assign("tablecount", count($tables)); -$smarty->assign("nonseqcount", count($nonseqtables)); - +$smarty->changeCaching(false); +$tpl = $smarty->createTemplate('admin_tpl:systemmaintenance.tpl', null, null, $smarty, false); +$tpl->assign('tablecount', count($tables)); +$tpl->assign('nonseqcount', count($nonseqtables)); -function MakeCommaList($tables) +function MakeCommaList(array $tables)//: string { - $out = ""; + $out = ''; foreach ($tables as $table) { - if ($out != "") $out .= " ,"; - $out .= "`" . $table . "`"; + if ($out) { + $out .= ' ,'; + } + $out .= "`$table`"; } return $out; } -if (isset($_POST["optimizeall"])) { - $query = "OPTIMIZE TABLE " . MakeCommaList($nonseqtables); +if (isset($_POST['optimizeall'])) { + $query = 'OPTIMIZE TABLE ' . MakeCommaList($nonseqtables); $optimizearray = $db->GetArray($query); //print_r($optimizearray); $errorsfound = 0; - $errordetails = ""; + $errordetails = ''; foreach ($optimizearray as $check) { - if (isset($check["Msg_text"]) && $check["Msg_text"] != "OK") { - $errorsfound++; - $errordetails .= "MySQL reports that table " . $check["Table"] . " does not checkout OK.
    "; + if (isset($check['Msg_text']) && $check['Msg_text'] != 'OK') { + ++$errorsfound; + $errordetails .= 'MySQL reports that table ' . $check['Table'] . ' does not checkout OK.
    '; } } // put mention into the admin log - audit('', 'System Maintenance', 'All db-tables optimized'); - $themeObject->ShowMessage(lang("sysmain_tablesoptimized")); - $smarty->assign("active_database", "true"); + audit('', 'System maintenance', 'All db-tables optimized'); + $themeObject->ShowMessage(lang('sysmain_tablesoptimized')); + $active_db = true; } -if (isset($_POST["repairall"])) { - $query = "REPAIR TABLE " . MakeCommaList($tables); +if (isset($_POST['repairall'])) { + $query = 'REPAIR TABLE ' . MakeCommaList($tables); $repairarray = $db->GetArray($query); $errorsfound = 0; - $errordetails = ""; + $errordetails = ''; foreach ($repairarray as $check) { - if (isset($check["Msg_text"]) && $check["Msg_text"] != "OK") { - $errorsfound++; - $errordetails .= "MySQL reports that table " . $check["Table"] . " does not checkout OK.
    "; + if (isset($check['Msg_text']) && $check['Msg_text'] != 'OK') { + ++$errorsfound; + $errordetails .= 'MySQL reports that table ' . $check['Table'] . ' does not checkout OK.
    '; } } // put mention into the admin log - audit('', 'System Maintenance', 'All db-tables repaired'); - $themeObject->ShowMessage(lang("sysmain_tablesrepaired")); - $smarty->assign("active_database", "true"); + audit('', 'System maintenance', 'All db-tables repaired'); + $themeObject->ShowMessage(lang('sysmain_tablesrepaired')); + $active_db = true; } +$urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]; +$tpl->assign('formurl', 'systemmaintenance.php' . $urlext); -$smarty->assign("formurl", "systemmaintenance.php" . $urlext); - - -$query = "CHECK TABLE " . MakeCommaList($tables); +$query = 'CHECK TABLE ' . MakeCommaList($tables); //echo $query; $checkarray = $db->GetArray($query); //print_r($checkarray); -$errortables = array(); +$errortables = []; foreach ($checkarray as $check) { - if (isset($check["Msg_text"]) && $check["Msg_text"] != "OK") { - $errortables[] = $check["Table"]; + if (isset($check['Msg_text']) && $check['Msg_text'] != 'OK') { + $errortables[] = $check['Table']; } } -$smarty->assign("errorcount", count($errortables)); +$tpl->assign('errorcount', count($errortables)); if (count($errortables) > 0) { - $smarty->assign("errortables", implode(",", $errortables)); + $tpl->assign('errortables', implode(',', $errortables)); } -/* - * - * Cache and content - * - */ -$contentops = cmsms()->GetContentOperations(); +// Cache and content +$contentops = $gCms->GetContentOperations(); if (isset($_POST['updateurls'])) { cms_route_manager::rebuild_static_routes(); audit('', 'System maintenance', 'Static routes rebuilt'); - $themeObject->ShowMessage(lang("routesrebuilt")); - $smarty->assign("active_content", "true"); + $themeObject->ShowMessage(lang('routesrebuilt')); + $active_content = true; } if (isset($_POST['clearcache'])) { - cmsms()->clear_cached_files(-1); - // put mention into the admin log - audit('', 'System maintenance', 'Cache cleared'); - $themeObject->ShowMessage(lang("cachecleared")); - $smarty->assign("active_content", "true"); + $gCms->clear_cached_files(); + $contentops->SetContentModified(); + audit('', 'System maintenance', 'Page-content caches cleared'); + $themeObject->ShowMessage(lang('cachecleared')); + $active_content = true; +} else { + $n = count(scandir(TMP_CACHE_LOCATION, SCANDIR_SORT_NONE)); + $n += count(scandir(TMP_TEMPLATES_C_LOCATION, SCANDIR_SORT_NONE)); + $n = max(0, $n-6); // ignore '.' and '..' and 'index.html' + $tpl->assign('filescount', $n); +} + +if ($pjobs && isset($_POST['clearjobs'])) { + CMSMS\JobOperations::clear_all(); + $active_jobs = true; } -if (isset($_POST["updatehierarchy"])) { +if (isset($_POST['updatehierarchy'])) { $contentops->SetAllHierarchyPositions(); audit('', 'System maintenance', 'Page hierarchy positions updated'); - $themeObject->ShowMessage(lang("sysmain_hierarchyupdated")); - $smarty->assign("active_content", "true"); + $themeObject->ShowMessage(lang('sysmain_hierarchyupdated')); + $active_content = true; } -//Setting up types +//Setup types $contenttypes = $contentops->ListContentTypes(false, true); //print_r($contenttypes); -$simpletypes = array(); +$simpletypes = []; foreach ($contenttypes as $typeid => $typename) { $simpletypes[] = $typeid; } - -if (isset($_POST["addaliases"])) { - //$contentops->SetAllHierarchyPositions(); - $count = 0; - $query = "SELECT * FROM " . CMS_DB_PREFIX . "content"; - $allcontent = $db->Execute($query); - while ($contentpiece = $allcontent->FetchRow()) { - $content_id = $contentpiece["content_id"]; - if (trim($contentpiece["content_alias"]) == '' && $contentpiece['type'] != 'separator' ) { - - $alias = trim($contentpiece["menu_text"]); - if ($alias == '') { - $alias = trim($contentpiece["content_name"]); +if (isset($_POST['addaliases'])) { + $n = 0; + $query = 'SELECT content_id,content_name,type,menu_text,content_alias FROM ' . CMS_DB_PREFIX . "content WHERE content_alias IS NULL OR content_alias=''"; + $allcontent = $db->GetArray($query); + if ($allcontent) { + $query2 = 'UPDATE ' . CMS_DB_PREFIX . 'content SET content_alias=? WHERE content_id=?'; + foreach ($allcontent as $contentpiece) { + foreach ([ + 'content_name', + 'type', + 'menu_text', + 'content_alias' + ] as $fld) { + if ($contentpiece[$fld] === null) { + $contentpiece[$fld] = ''; + } } - - $tolower = true; - $alias = munge_string_to_url($alias, $tolower); - if ($contentops->CheckAliasError($alias, $content_id)) { - $alias_num_add = 2; - // If a '-2' version of the alias already exists - // Check the '-3' version etc. - while ($contentops->CheckAliasError($alias . '-' . $alias_num_add) !== FALSE) { - $alias_num_add++; + $content_id = (int)$contentpiece['content_id']; + if (trim($contentpiece['content_alias']) == '' && $contentpiece['type'] != 'separator') { + $alias = trim($contentpiece['menu_text']); + if ($alias == '') { + $alias = trim($contentpiece['content_name']); + } + $alias = munge_string_to_url($alias, true); + if (!$alias) { + continue; //TODO throw } - $alias .= '-' . $alias_num_add; + if ($contentops->CheckAliasUsed($alias, $content_id)) { + // Some other page uses it already, generate a suffixed variant + $alias_num_add = 2; + // If a '-2' variant of the alias is used, try '-3', etc. + while ($contentops->CheckAliasUsed($alias . '-' . $alias_num_add)) { + ++$alias_num_add; + } + $alias .= '-' . $alias_num_add; + } + $dbresult = $db->Execute($query2, [$alias, $content_id]); + ++$n; } - $query2 = "UPDATE " . CMS_DB_PREFIX . "content SET content_alias=? WHERE content_id=?"; - $params2 = array($alias, $content_id); - $dbresult = $db->Execute($query2, $params2); - $count++; - } + $contentops->SetAllHierarchyPositions(); // update hierarchy_path's } - audit('', 'System maintenance', 'Fixed pages missing aliases, count:' . $count); - $themeObject->ShowMessage($count . " " . lang("sysmain_aliasesfixed")); - $smarty->assign("active_content", "true"); -} + audit('', 'System maintenance', "Updated $n page(s) whose alias was missing"); + $themeObject->ShowMessage($n . ' ' . lang('sysmain_aliasesfixed')); + $active_content = true; +} -if (isset($_POST["fixtypes"])) { - //$contentops->SetAllHierarchyPositions(); - - $count = 0; - $query = "SELECT * FROM " . CMS_DB_PREFIX . "content"; - $allcontent = $db->Execute($query); - while ($contentpiece = $allcontent->FetchRow()) { - if (!in_array($contentpiece["type"], $simpletypes)) { - $query2 = "UPDATE " . CMS_DB_PREFIX . "content SET type='content' WHERE content_id=?"; - $params2 = array($contentpiece["content_id"]); - $dbresult = $db->Execute($query2, $params2); - $count++; +if (isset($_POST['fixtypes'])) { + $n = 0; + $query = 'SELECT content_id,type FROM ' . CMS_DB_PREFIX . 'content'; + $allcontent = $db->GetArray($query); + if ($allcontent) { + $query2 = 'UPDATE ' . CMS_DB_PREFIX . "content SET type='content' WHERE content_id=?"; + foreach ($allcontent as $contentpiece) { + if (!$contentpiece['type'] || + !in_array($contentpiece['type'], $simpletypes)) { + $dbresult = $db->Execute($query2, [$contentpiece['content_id']]); + ++$n; + } } } - audit('', 'System maintenance', 'Converted pages with invalid content types, count:' . $count); - $themeObject->ShowMessage($count . " " . lang("sysmain_typesfixed")); - $smarty->assign("active_content", "true"); + audit('', 'System maintenance', "Converted $n page(s) with invalid content type"); + $themeObject->ShowMessage($n . ' ' . lang('sysmain_typesfixed')); + $active_content = true; } - -$query = "SELECT * FROM " . CMS_DB_PREFIX . "content"; -$allcontent = $db->Execute($query); -$pages = array(); -$withoutalias = array(); -$invalidtypes = array(); -if( is_object($allcontent) ) { - while ($contentpiece = $allcontent->FetchRow()) { - $pages[] = $contentpiece["content_name"]; - if (trim($contentpiece["content_alias"]) == "" && $contentpiece['type'] != 'separator') { +$pages = []; +$withoutalias = []; +$invalidtypes = []; +$query = 'SELECT content_name,type,content_alias FROM ' . CMS_DB_PREFIX . 'content ORDER BY hierarchy_path'; +$allcontent = $db->GetArray($query); +if ($allcontent) { + foreach ($allcontent as $contentpiece) { + foreach ([ + 'content_name', + 'type', + 'content_alias', + ] as $fld) { + if ($contentpiece[$fld] === null) { + $contentpiece[$fld] = ''; + } + } + $pages[] = $contentpiece['content_name']; + if (trim($contentpiece['content_alias']) == '' && $contentpiece['type'] != 'separator') { $withoutalias[] = $contentpiece; } - if (!in_array($contentpiece["type"], $simpletypes)) { + if (!in_array($contentpiece['type'], $simpletypes)) { $invalidtypes[] = $contentpiece; } - //print_r($contentpiece); } } -$smarty->assign_by_ref("pagesmissingalias", $withoutalias); -$smarty->assign_by_ref("pageswithinvalidtype", $invalidtypes); -$smarty->assign("pagecount", count($pages)); -$smarty->assign("invalidtypescount", count($invalidtypes)); -$smarty->assign("withoutaliascount", count($withoutalias)); +$tpl->assign('pagecount', count($pages)); +$tpl->assign('pagesmissingalias', $withoutalias); +$tpl->assign('withoutaliascount', count($withoutalias)); +$tpl->assign('pageswithinvalidtype', $invalidtypes); +$tpl->assign('invalidtypescount', count($invalidtypes)); + +// Jobs +if ($pjobs) { + $query = 'SELECT name,module,errors FROM ' . CMS_DB_PREFIX . CMSMS\JobOperations::RECORDTABLE . ' ORDER BY name,module'; + $alljobs = $db->GetArray($query); + if ($alljobs) { + $tpl->assign('jobs', $alljobs); + $tpl->assign('jobscount', count($alljobs)); + $errs = []; + foreach ($alljobs as $row) { + if ($row['errors'] > 0) { + $key = $row['module'] ? $row['module'].'::'.$row['name'] : $row['name']; + $errs[$key] = $row['errors']; + } + } + $tpl->assign('jobserrs', $errs); + } else { + $tpl->assign('jobs', []); + $tpl->assign('jobscount', 0); + } + $tpl->assign('pjobs', true); +} -/* -* -* Changelog -* -*/ -$ch_filename = cms_join_path(CMS_BASE, 'doc', 'CHANGELOG.txt'); -$changelog = @file($ch_filename); +// Changelog +$ch_filename = cms_join_path(dirname(__DIR__), 'doc', 'CHANGELOG.txt'); if (is_readable($ch_filename)) { + $changelog = @file($ch_filename); + $open = false; + for ($i = 0, $n = count($changelog); $i < $n; ++$i) { + if (strncmp($changelog[$i], 'Version', 7) == 0) { + if ($i == 0) { + $changelog[$i] = "
    \n

    " . trim($changelog[$i]) . "

    \n"; + } else { + $changelog[$i] = "\n
    \n
    \n

    " . rtrim($changelog[$i]) . "

    \n"; + } + $open = true; + } elseif (trim($changelog[$i]) == '') { + unset($changelog[$i]); + } + } + if ($open) { + $changelog[$n] = "\n
    "; + } - for ($i = 0; $i < count($changelog); $i++) { - if (substr($changelog[$i], 0, 7) == "Version") { - if ($i == 0) { - $changelog[$i] = "

    " . $changelog[$i] . "

    "; - } else { - $changelog[$i] = "

    " . $changelog[$i] . "

    "; - } - - } - } - - $changelog = implode("
    ", $changelog); - - $smarty->assign("changelog", $changelog); - $smarty->assign("changelogfilename", $ch_filename); - + $changelog = implode('
    ', $changelog); + $changelog = str_replace(["\n
    ", "
    \n
    "], ["\n", ''], $changelog); + $tpl->assign('changelog', $changelog); +//$tpl->assign('changelogfilename', $ch_filename); don't reveal site filepath +//$active_log = true; } -$smarty->assign('backurl', $themeObject->BackUrl()); - -echo $smarty->fetch('systemmaintenance.tpl'); - - -include_once("footer.php"); +$tpl->assign('active_changelog', $active_log); +$tpl->assign('active_content', $active_content); +$tpl->assign('active_database', $active_db); +$tpl->assign('active_jobs', $active_jobs); +$tpl->assign('backurl', $themeObject->BackUrl()); +$tpl->display(); -?> +require_once 'footer.php'; diff --git a/admin/templates/addbookmark.tpl b/admin/templates/addbookmark.tpl new file mode 100644 index 00000000..8d9c02f5 --- /dev/null +++ b/admin/templates/addbookmark.tpl @@ -0,0 +1,23 @@ +
    +{if !empty($error)} +

    {$error}

    +{/if} +
    + +
    +

    +

    +
    +
    + {$t=lang('url')}

     {cms_help key2='help_bookmark_url' title=$t}

    +

    +
    +
    +
    +
    + + +
    +
    +
    +
    diff --git a/admin/templates/addgroup.tpl b/admin/templates/addgroup.tpl new file mode 100644 index 00000000..08cc28d5 --- /dev/null +++ b/admin/templates/addgroup.tpl @@ -0,0 +1,33 @@ +
    +{if $error} +
    +
      + {$error} +
    +
    +
    +{/if} +

    {lang('warn_addgroup')}

    +
    +
    + +
    +

    +

    +
    +
    +

    +

    +
    +
    + +

    +

    +
    +
    +
    + + +
    +
    +
    diff --git a/admin/templates/adduser.tpl b/admin/templates/adduser.tpl index 1d30f165..5ce3ab02 100644 --- a/admin/templates/adduser.tpl +++ b/admin/templates/adduser.tpl @@ -3,7 +3,7 @@ {form_start url='adduser.php'} {tab_header name='user' label=lang('profile')} - {if isset($groups)} + {if !empty($groups)} {tab_header name='groups' label=lang('groups')} {/if} {tab_header name='settings' label=lang('settings')} @@ -15,7 +15,7 @@  {cms_help realm='admin' key='info_adduser_username' title=lang('name')}

    - +

    @@ -23,7 +23,7 @@  {cms_help realm='admin' key='info_edituser_password' title=lang('password')}

    - +

    @@ -31,7 +31,7 @@  {cms_help realm='admin' key='info_edituser_passwordagain' title=lang('passwordagain')}

    - +

    @@ -39,7 +39,7 @@  {cms_help key2='help_myaccount_firstname' title=lang('firstname')}

    - +

    @@ -47,27 +47,28 @@  {cms_help key2='help_myaccount_lastname' title=lang('lastname')}

    - +

    -  {cms_help key2='help_myaccount_email' title=lang('email')} +  {cms_help key2='help_myaccount_email' title=lang('email')}

    - +

    +

    - {lang('active')}: {cms_help realm='admin' key='info_user_active' title=lang('active')} +  {cms_help realm='admin' key='info_user_active' title=lang('active')}

    - +

    - {if isset($groups)} + {if !empty($groups)} {tab_start name='groups'}
    @@ -88,8 +89,7 @@ {foreach $groups as $onegroup} - - id,$sel_groups)}checked="checked"{/if}/> + id,$sel_groups)} checked{/if}> {$onegroup->description} @@ -107,17 +107,15 @@

    {lang('copyusersettings')}: {cms_help realm='admin' key='info_copyusersettings' title=lang('copyusersettings')}

    -

    - -

    +
    + {$userselect} +
    {tab_end}
    - - + +
    {form_end} diff --git a/admin/templates/adminlog.tpl b/admin/templates/adminlog.tpl index c75ab405..bda1851e 100644 --- a/admin/templates/adminlog.tpl +++ b/admin/templates/adminlog.tpl @@ -1,82 +1,86 @@ -
    -