64 lines
1.5 KiB
PHP
64 lines
1.5 KiB
PHP
<?php
|
|
|
|
//print_r($_FILES);
|
|
//print_r($_POST);
|
|
//echo 1;
|
|
switch(@$_POST['act']) {
|
|
|
|
|
|
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;
|
|
|
|
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'://интерактивное измениение заголовка
|
|
|
|
|
|
|
|
break;
|
|
|
|
case 'r_comment'://рейтинг коментариев
|
|
require_once MYDIR . '/api/modules/page/ajax.' . $_POST['act'] . '.php';
|
|
break;
|
|
default:
|
|
|
|
}
|
|
?>
|