1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Update cpage.php

Added check to prevent saving page\menu with empty page_title & menu_name fields when edit.
This commit is contained in:
sudakk 2019-10-28 22:24:05 +03:00 committed by GitHub
parent d01a0b6e83
commit e72b1ca30e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1030,7 +1030,7 @@ class page_admin_ui extends e_admin_ui
$newdata = e107::getCustomFields()->processDataPost('page_fields',$newdata);
$newdata['menu_name'] = preg_replace('/[^\w-*]/','-',$newdata['menu_name']);
$newdata['menu_name'] = preg_replace('/[^\w\-*]/','-',$newdata['menu_name']);
if(empty($newdata['page_sef']))
{
@ -1074,11 +1074,16 @@ class page_admin_ui extends e_admin_ui
function beforeUpdate($newdata,$olddata, $id)
{
if(isset($newdata['page_title']) && isset($newdata['menu_name']) && empty($newdata['page_title']) && empty($newdata['menu_name']))
{
e107::getMessage()->addError(CUSLAN_79);
return false;
}
$newdata = e107::getCustomFields()->processDataPost('page_fields',$newdata);
if(isset($newdata['menu_name']))
{
$newdata['menu_name'] = preg_replace('/[^\w-*]/','',$newdata['menu_name']);
$newdata['menu_name'] = preg_replace('/[^\w\-*]/','',$newdata['menu_name']);
}