core/api/modules/blog/ajax.php

64 lines
1.5 KiB
PHP
Raw Normal View History

2022-12-11 13:55:49 +05:00
<?php
//print_r($_FILES);
//print_r($_POST);
//echo 1;
switch(@$_POST['act']) {
2023-05-03 14:51:58 +05:00
case 'saveblog':
print_r($_POST);
\DB::set("UPDATE `pages` SET `title`=?, `txt`=?, `t`=?, `user_id`=?, `category`=?, `status`=1 WHERE `id`=?", array(
$_POST['title'],
$_POST['txt'],
time(),
$_SESSION['user_id'],
1,
$_SESSION['blog_id']
));
break;
case 'new_blog':
$_SESSION['blog_id'] = \DB::add("INSERT INTO `pages`(`user_id`, `t`, `category`, `status`) VALUES (?, ?, 1, 0)", array($_SESSION['user_id'], time()));
break;
2022-12-11 13:55:49 +05:00
case 'add_comment':
$_POST['t']=time();
if ($_SESSION['user_id'])
$_POST['user_id']=$_SESSION['user_id'];
else
$_POST['user_id']=session_id();
unset($_POST['act']);
$db->add ( 'pages_comments', $_POST );
break;
case 'like':
unset($a);
unset($b);
$a['id']=$_POST['id'];
$b['likes']=$db->get_val('pages', $a, 'likes')+1;
setcookie ("page_like", $a['id'], time()+31536000, '/', $_SERVER['SERVER_NAME']);
$db->update('pages', $a['id'], $b);
break;
case 'edit_title'://интерактивное измениение заголовка
2023-05-03 14:51:58 +05:00
break;
2022-12-11 13:55:49 +05:00
case 'r_comment'://рейтинг коментариев
require_once MYDIR . '/api/modules/page/ajax.' . $_POST['act'] . '.php';
break;
default:
}
?>