core/api/modules/admin/ajax.php

57 lines
2.1 KiB
PHP
Raw Normal View History

2022-12-11 13:55:49 +05:00
<?php
2023-03-11 21:03:29 +05:00
ini_set( 'display_errors', 0 );
2022-12-17 18:15:09 +05:00
if ( $_SESSION['dostup']!='a' ) header( 'Location: /login/' );// && $dostup!='m'
2022-12-11 13:55:49 +05:00
2022-12-17 18:15:09 +05:00
switch( @$_POST['act'] ) {
//Сохранение статуса задачи
case 'saveTaskStatus':
\DB::set('UPDATE `tasks` SET `status`="' . $_POST['status'] . '" WHERE `id` = "' . $_POST['id'] . '"');
break;
2022-12-11 13:55:49 +05:00
2022-12-17 18:15:09 +05:00
case 'save':/*Сохранение заметки*/
2023-03-11 21:03:29 +05:00
if ($db['type']=='mysql') \DB::set( "ALTER TABLE `zametka` ADD `user_id` int(10) NOT NULL, ADD FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)");
if ($db['type']=='sqlite3') \DB::alterTable("ALTER TABLE `zametka` ADD `user_id` INTEGER");
$z_id=\DB::getValue("SELECT `id` FROM `zametka` WHERE `user_id`=? LIMIT 1", $_SESSION['user_id']);
if ($z_id)
\DB::set( "UPDATE `zametka` SET `txt`=? WHERE `user_id` = ?", array( $_POST['txt'], $_SESSION['user_id'] ) );
else
\DB::add("INSERT INTO `zametka` (`txt`, `user_id`) VALUES (?,?)", array($_POST['txt'], $_SESSION['user_id']));
2022-12-11 13:55:49 +05:00
break;
case 'loados':/*загружаем обратную связь со статусом не прочитано*/
unset( $a );
$a['status'] = 0;
$massiv = $db -> get_massiv( 'otzyv', $a, 'id' );
$num = $db -> num;
break;
2023-01-02 21:33:36 +05:00
case 'clearimg':
require_once 'api/php/list_file.php';
$filesm=list_file ( 'img/' . $_SERVER['SERVER_NAME'] . '/tovar' );
echo count ($filesm);
//\DB::set('UPDATE `tasks` SET `status`="' . $_POST['status'] . '" WHERE `id` = "' . $_POST['id'] . '"');
break;
2023-01-24 15:51:26 +05:00
case 'savePos':
$id = \DB::getValue("SELECT `id` FROM `admin_el_pos` WHERE `elem`=?", $_POST['elem']);
if ($id)
\DB::set( "UPDATE `admin_el_pos` SET `x`=?, `y`=? WHERE `elem` = ?", array( $_POST['x'], $_POST['y'], $_POST['elem'] ) );
else
\DB::add("INSERT INTO `admin_el_pos` (`x`, `y`, `elem`) VALUES(?,?,?)", array( $_POST['x'], $_POST['y'], $_POST['elem'] ));
break;
case 'getPos':
$pos = \DB::getAll("SELECT * FROM `admin_el_pos`");
echo \json::to_j($pos);
break;
2022-12-11 13:55:49 +05:00
}
?>