2022-12-11 13:55:49 +05:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
//проверяем кто мы
|
|
|
|
|
$access = 0;
|
|
|
|
|
if ( $_SESSION['dostup'] =='a' ) $access=1;
|
|
|
|
|
if ( $_SESSION['dostup'] =='u' ) $access=1;
|
|
|
|
|
if ( $access==0 ) die( "Нет прав" );
|
|
|
|
|
|
2023-01-02 21:33:36 +05:00
|
|
|
|
switch( @$_POST['act'] ) {
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
02.01.2023
|
|
|
|
|
Сохраняем мета-теги
|
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
|
case 'savemeta':
|
|
|
|
|
if ( $_POST['id'] ) \DB::set("UPDATE `meta` SET `" . $_POST['pole'] . "`=? WHERE `id`=? AND `mod`='tovar_cat'", array( $_POST['txt'], $_POST['id'] ));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
02.01.2023
|
|
|
|
|
Сохраняем заголовок категории
|
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
|
case 'savetitle':
|
|
|
|
|
if ( $_POST['id'] ) \DB::set( "UPDATE `tovar_category` SET `title`=? WHERE `id`=?", array( $_POST['txt'], $_POST['id'] ) );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-11 13:55:49 +05:00
|
|
|
|
case 'new_cat': //30.01.2022 - законченный модуль создания/редактирования модуля
|
|
|
|
|
if ( $_POST['input_new_cat_edit_id'] ){//Если приказали редактировать
|
|
|
|
|
//вынимаем из таблицы json, в процессе изменяем его и снова пихаем в базу
|
|
|
|
|
unset( $a );
|
|
|
|
|
$a['id'] = $_POST['input_new_cat_edit_id'];
|
|
|
|
|
$t = $db -> from_j ( $db -> clear_json ( $db -> get_val('pages', $a, 'json' ) ) );
|
|
|
|
|
}
|
|
|
|
|
unset( $_POST['act'] );
|
|
|
|
|
$massiv['tip'] = 'tovarCat';
|
|
|
|
|
$massiv['user_id'] = $_SESSION['user_id'];
|
|
|
|
|
$massiv['t'] = time();
|
|
|
|
|
if ($_POST['parent_id'])
|
|
|
|
|
$massiv['parent'] = $_POST['parent_id'];
|
|
|
|
|
else
|
|
|
|
|
$massiv['parent'] = '0';
|
|
|
|
|
$massiv['txt'] = $_POST['input_new_cat'];
|
|
|
|
|
$massiv['public'] = 1;
|
|
|
|
|
$t['title'] = $_POST['input_new_cat'];
|
|
|
|
|
$t['description'] = $_POST['input_new_cat_description'];
|
|
|
|
|
$t['keywords'] = $_POST['input_new_cat_keywords'];
|
|
|
|
|
$massiv['json'] = $db -> to_j( $t );
|
|
|
|
|
if ( $_POST['input_new_cat_edit_id'] ){//Если приказали редактировать
|
|
|
|
|
$db -> update( 'pages', $_POST['input_new_cat_edit_id'], $massiv );
|
|
|
|
|
}else{
|
|
|
|
|
$db -> add ( 'pages', $massiv );
|
|
|
|
|
}
|
|
|
|
|
break;
|
2022-12-24 21:12:23 +05:00
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
21.12.2022
|
|
|
|
|
Обновляем статус категории товара
|
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
|
case 'updateStatus':
|
|
|
|
|
\DB::set("UPDATE `tovar_category` SET `status`=? WHERE `id`=? LIMIT 1", array( $_POST['status'], $_POST['id'] ));
|
|
|
|
|
break;
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
21.12.2022
|
|
|
|
|
Сохраняет настройки модуля. Вынести в ядро!
|
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
|
case 'setSettings':
|
|
|
|
|
$json=\DB::getValue("SELECT `json` FROM `settings` WHERE `mod`='a_tovar_cat' LIMIT 1");
|
|
|
|
|
$massiv=\json::from_j($json);
|
|
|
|
|
$massiv[$_POST['showNoPublic']]=$_POST['val'];
|
|
|
|
|
$json=\json::to_j($massiv);
|
|
|
|
|
\DB::set("UPDATE `settings` SET `json`=? WHERE `mod`='a_tovar_cat' LIMIT 1", array( $json ));
|
2022-12-11 13:55:49 +05:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'del_page':
|
|
|
|
|
unset( $_POST['act'] );
|
|
|
|
|
$db -> del_id( 'pages', $_POST['id'] );
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
?>
|