Esempio n. 1
0
    }
} elseif (!empty($_POST['getCommentsA'])) {
    $articles = new articles();
    $aComments = new articlesComments();
    // проверяем наличие статьи
    if (!($arrData = $articles->getPublishedArticle("id=" . secure::escQuoteData($_POST['getCommentsA'])))) {
        $arrErrors[] = ERROR_COMMENT_ARTICLE_NOT_FOUND;
    } else {
        // Order
        $order = 'DESC';
        if (!empty($_POST['order']) && ('ordDesc' == $_POST['order'] || 'ordAsc' == $_POST['order'])) {
            $order = 'ordDesc' == $_POST['order'] ? 'DESC' : 'ASC';
        }
        // проверяем, кто смотрит статью (у автора есть право удалять комментарии)
        $author = !empty($_SESSION['sd_user']['data']['id']) && $_SESSION['sd_user']['data']['id'] == $arrData['id_user'] ? true : false;
        $arrComments = $aComments->getRecords("id_article=" . secure::escQuoteData($_POST['getCommentsA']) . " AND token='active' ORDER BY datetime " . $order, false, false, false);
        $smarty->assignByRef('author', $author);
        $smarty->assignByRef('order', $order);
        $smarty->assignByRef('arrComments', $arrComments);
    }
    $smarty->assignByRef('errors', $arrErrors);
    $smarty->display('articles.comments.list.tpl');
} elseif (isset($_POST['complaintCommentA'])) {
    if (!empty($_POST['complaintCommentA'])) {
        $articles = new articles();
        $aComments = new articlesComments();
        if ($arrComment = $aComments->getRecord("id=" . secure::escQuoteData($_POST['complaintCommentA'] . " AND token='active'"))) {
            if ($arrData = $articles->getPublishedArticle("id=" . secure::escQuoteData($arrComment['id_article']))) {
                if (!empty($arrData['id_user'])) {
                    $user = new user();
                    $recipient = ($arrUser = $user->getUser("id=" . secure::escQuoteData($arrData['id_user']) . " AND token='active'")) ? $arrUser['email'] : CONF_MAIL_ADMIN_EMAIL;
Esempio n. 2
0
} elseif (!empty($_POST['mailFile']) && !empty($_POST['mailText']) && !empty($_POST['pathMailTemplates'])) {
    $_POST['mailFile'] = $_POST['pathMailTemplates'] . str_replace('_', '.', $_POST['mailFile']) . '.txt';
    // формируем имя файла
    echo tools::saveMailTemplateFile($_POST['mailFile'], $_POST['mailText']);
} elseif (!empty($_POST['uID']) && !empty($_POST['userType']) && !empty($_POST['userGroup'])) {
    $user = new user();
    $user->changeTable('conf_users');
    $response = !$user->updateUser(array('user_type' => $_POST['userType'], 'user_group' => $_POST['userGroup']), "id IN (" . secure::escQuoteData($_POST['uID']) . ")") ? db::$message_error : 'true';
    $user->changeTable('users', USR_PREFIX);
    echo $response;
} elseif (!empty($_POST['getArticleDetail']) && !empty($_POST['strQuery'])) {
    $articles = new articles();
    $arrArticle = $articles->getArticle("id IN (" . secure::escQuoteData($_POST['getArticleDetail']) . ")");
    $aComments = new articlesComments();
    $arrOrder = array('datetime' => 'DESC');
    $arrComments = $aComments->getRecords("id_article=" . secure::escQuoteData($_POST['getArticleDetail']) . " AND token='active'", $arrOrder, false, false);
    // адресная строка
    $smarty->assignByRef('qString', $_POST['strQuery']);
    $smarty->assignByRef('arrArticle', $arrArticle);
    $smarty->assignByRef('arrComments', $arrComments);
    $smarty->display('adm.manager.articles.detail.tpl');
} elseif (!empty($_POST['getNewsDetail']) && !empty($_POST['strQuery'])) {
    $news = new news();
    $arrNews = $news->getNews("id=" . secure::escQuoteData($_POST['getNewsDetail']));
    $newsComments = new newsComments();
    $arrOrder = array('datetime' => 'DESC');
    $arrComments = $newsComments->getRecords("id_news=" . secure::escQuoteData($_POST['getNewsDetail']) . " AND token='active'", $arrOrder, false, false);
    // адресная строка
    $smarty->assignByRef('qString', $_POST['strQuery']);
    $smarty->assignByRef('arrNews', $arrNews);
    $smarty->assignByRef('arrComments', $arrComments);