php js AppAdmin GAMECMS

Сообщения
14
Реакции
1
Здравствуйте , кто может помочи установил model_Extra APPFTA , работает все хорошо , но тут проблема после заполнения заявки она не
отправляется
в ДБ и зависает проблема от actions.php ! у меня php 7.4 вот код


PHP:
<?php
include_once "../../../inc/start.php";
include_once "../../../inc/protect.php";
include_once "../../../modules_extra/appadmin/base/config.php";



if(isset($_POST['get_appadmin'])) {
    $start = check($_POST['start'],"int");
    $server = check($_POST['server'],"int");
    $limit = check($_POST['limit'],"int");

    if(empty($start)) {
        $start = 0;
    }
    if(empty($limit)) {
        $limit = 10;
    }

    $tpl = new Template;
    $tpl->dir = '../../../templates/'.$conf->template.'/';

    $AD = new ApplicationAdmin($module, $pdo, $tpl);

    $tpl->show($AD->get_appadmin($start, $server, $limit));
    $tpl->global_clear();

    exit();
}

/* Добавление жалобы
=========================================*/
if (isset($_POST['add_appadmin'])) {
    $server = check($_POST['server'],"int");
    $nick = check($_POST['nick'],null);
    $steam_link = check($_POST['steam_link'],"var");
    $ave_online = check($_POST['ave_online'],"var");
    $exp_admin_serv = check($_POST['exp_admin_serv'],"int");
    $exp_admin = check($_POST['exp_admin'],"var");
    $spend_time = check($_POST['spend_time'],"var");
    $link_vk = check($_POST['link_vk'],"var");
    $log_discord = check($_POST['log_discord'],"var");

    include_once '../../../inc/classes/HTMLPurifier/HTMLPurifier.auto.php';
    $why_u = $Purifier->purify($_POST['why_u']);
    $why_u = find_img_mp3($why_u, $_SESSION['id'], 1);

    if (empty($server)) {
        exit (json_encode(array('status' => '2', 'input' => 'server', 'reply' => 'Заполните!')));
    }
    if (empty($nick)) {
        exit (json_encode(array('status' => '2', 'input' => 'nick', 'reply' => 'Заполните!')));
    }
    if (mb_strlen($nick, 'UTF-8') > 64) {
        exit (json_encode(array('status' => '2', 'input' => 'nick', 'reply' => 'Не более 64 символов!')));
    }
    if (mb_strlen($steam_link, 'UTF-8') != 17) {
        exit (json_encode(array('status' => '2', 'input' => 'steam_link', 'reply' => 'ID состоит из 17 цифр!')));
    }
    if (empty($steam_link)) {
        exit (json_encode(array('status' => '2', 'input' => 'steam_link', 'reply' => 'Заполните!')));
    }
    if (empty($ave_online)) {
        exit (json_encode(array('status' => '2', 'input' => 'ave_online', 'reply' => 'Заполните!')));
    }
    if ($exp_admin_serv === null) {
        exit (json_encode(array('status' => '2', 'input' => 'exp_admin_serv', 'reply' => 'Заполните!')));
    }
    if ($exp_admin_serv == 1) {
        if (empty($exp_admin)) {
            exit (json_encode(array('status' => '2', 'input' => 'exp_admin', 'reply' => 'Заполните!')));
        }
    }
    if (empty($spend_time)) {
        exit (json_encode(array('status' => '2', 'input' => 'spend_time', 'reply' => 'Заполните!')));
    }
    if (empty($link_vk)) {
        exit (json_encode(array('status' => '2', 'input' => 'link_vk', 'reply' => 'Заполните!')));
    }
    if (mb_strlen($link_vk, 'UTF-8') < 5 or mb_strlen($link_vk, 'UTF-8') > 32) {
        exit (json_encode(array('status' => '2', 'input' => 'link_vk', 'reply' => 'Не меньше 5 символов и не более 32!')));
    }
    if (empty($log_discord)) {
        exit (json_encode(array('status' => '2', 'input' => 'log_discord', 'reply' => 'Заполните!')));
    }
    if (!preg_match('/^((.+?)#\d{4})/', $log_discord)) {
        exit (json_encode(array('status' => '2', 'input' => 'log_discord', 'reply' => 'Неверный логин discord!')));
    }

    $STH = $pdo->query("SELECT date FROM appadmin WHERE author='$_SESSION[id]' LIMIT 1"); $STH->setFetchMode(PDO::FETCH_OBJ);
    $row = $STH->fetch();

    if(isset($row->date)) {
        $delta = time() - strtotime($row->date);
        if ($delta < (7*24*60*60)) {
            exit (json_encode(array('status' => '3')));
        }
    }

    $date = date("Y-m-d H:i:s");
    $STH = $pdo->prepare("INSERT INTO appadmin (server,nick,date,author,steam_link,ave_online,exp_admin_serv,exp_admin,spend_time,link_vk,log_discord,why_u) values (:server, :nick, :date, :author, :steam_link, :ave_online, :exp_admin_serv, :exp_admin, :spend_time, :link_vk, :log_discord, :why_u)");
    if ($STH->execute(array( 'server' => $server, 'nick' => $nick, 'date' => $date, 'author' => $_SESSION['id'], 'steam_link' => $steam_link, 'ave_online' => $ave_online, 'exp_admin_serv' => $exp_admin_serv, 'exp_admin' => $exp_admin, 'spend_time' => $spend_time, 'link_vk' => $link_vk, 'log_discord' => $log_discord, 'why_u' => $why_u)) == '1') {
        $STH = $pdo->query("SELECT id FROM appadmin WHERE date='$date' LIMIT 1"); $STH->setFetchMode(PDO::FETCH_OBJ);
        $row = $STH->fetch();

        include_once "../../../inc/notifications.php";
        sendmail('none', "Оставлена новая заявка на администратора", "На администрируемом Вами сайте \"".$site_name."\" оставлена новая заявка на администратора.", $pdo, 1);
        exit (json_encode(array('status' => '1', 'id' => $row->id)));
    }
}

if (isset($_POST['dell_appadmin']) and is_worthy("o")) {
    $id = checkJs($_POST['id'],"int");

    if (empty($id)){
        exit(json_encode(array('status' => '2')));
    }

    $STH = $pdo->query("SELECT `id`, `server` FROM `appadmin` WHERE id='$id' LIMIT 1"); $STH->setFetchMode(PDO::FETCH_OBJ);
    $row = $STH->fetch();

    if (empty($row->id)){
        exit(json_encode(array('status' => '2')));
    }
    if(!is_worthy_specifically("o", $row->server)) {
        exit(json_encode(array('status' => '2')));
    }

    $pdo->exec("DELETE FROM appadmin WHERE id='$id' LIMIT 1");
    $pdo->exec("DELETE FROM appadmin__comments WHERE appadmin_id='$id'");
    exit (json_encode(array('status' => '1')));
}

if (isset($_POST['close_appadmin']) and is_worthy("o")) {
    $id = checkJs($_POST['id'],"int");
    $action_type = checkJs($_POST['type'],"int");

    if ($action_type != '1' and $action_type != '2'){
        exit(json_encode(array('status' => '2')));
    }
    if (empty($id)){
        exit(json_encode(array('status' => '2')));
    }

    $STH = $pdo->query("SELECT `server` FROM `appadmin` WHERE id='$id' LIMIT 1"); $STH->setFetchMode(PDO::FETCH_OBJ);
    $row = $STH->fetch();
    if (empty($row->server)){
        exit(json_encode(array('status' => '2')));
    }

    if(!is_worthy_specifically("o", $row->server)) {
        exit(json_encode(array('status' => '2')));
    }

    $STH = $pdo->prepare("UPDATE `appadmin` SET `status`=:status, `closed`=:closed WHERE `id`='$id' LIMIT 1");
    if ($STH->execute(array( 'status' => $action_type, 'closed' => $_SESSION['id'])) == '1') {
        $action_type++;
        $STH = $pdo->query("SELECT `appadmin`.`author`, `users`.`email`, `users`.`email_notice` FROM `appadmin` LEFT JOIN `users` ON `users`.`id`=`appadmin`.`author` WHERE `appadmin`.`id`='$id' LIMIT 1"); $STH->setFetchMode(PDO::FETCH_OBJ);
        $row = $STH->fetch();
    
        include_once '../../../inc/notifications.php';
        send_noty($pdo, "Ваша заявка на администратора <a href='../appadmin/appadmin?id=".$id."'>#".$id."</a> рассмотрена", $row->author, $action_type);

        if($row->email_notice == 1) {
            sendmail($row->email, "Ваша заявка на администратора рассмотрена", "Ваша заявка на администратора (".$full_site_host."appadmin/appadmin?id=".$id.") рассмотрена", $pdo);
        }

        exit (json_encode(array('status' => '1', 'closed' => $_SESSION['id'], 'closed_a' => $_SESSION['login'])));
    } else {
        exit(json_encode(array('status' => '2')));
    }
}

if (isset($_POST['load_appadmin_comments'])) {
    $id = checkJs($_POST['id'],"int");
    $i = 0;

    $tpl = new Template;
    $tpl->dir = '../../../templates/'.$conf->template.'/tpl';
    $tpl->result['content'] = '';
    $STH = $pdo->query("SELECT `appadmin__comments`.*, `appadmin`.`server`, `users`.`login`, `users`.`avatar`, `users`.`rights` FROM `appadmin__comments`
        LEFT JOIN `users` ON `appadmin__comments`.`user_id` = `users`.`id`
        LEFT JOIN `appadmin` ON `appadmin__comments`.`appadmin_id` = `appadmin`.`id`
        WHERE `appadmin__comments`.`appadmin_id` = '$id' ORDER BY `appadmin__comments`.`id` DESC"); $STH->setFetchMode(PDO::FETCH_OBJ);
    while($row = $STH->fetch()) {
        $tpl->load_template('/elements/comment.tpl');

        $gp = $users_groups[$row->rights];
        $date = expand_date($row->date,8);
        if (is_worthy_specifically("u", $row->server)){
            $dell = '<span onclick="dell_appadmin_comment('.$row->id.');" tooltip="yes" data-placement="left" title="Удалить" class="m-icon icon-trash dell_message"></span>';
        } else {
            $dell = '';
        }
        $i++;

        $tpl->set("{id}", $row->id);
        $tpl->set("{user_id}", $row->user_id);
        $tpl->set("{login}", $row->login);
        $tpl->set("{avatar}", $row->avatar);
        $tpl->set("{text}", $row->text);
        $tpl->set("{dell}", $dell);
        $tpl->set("{date_full}", $date['full']);
        $tpl->set("{date_short}", $date['short']);
        $tpl->set("{gp_color}", $gp['color']);
        $tpl->set("{gp_name}", $gp['name']);
        $tpl->compile( 'content' );
        $tpl->clear();
    }
    if ($i == 0){
        echo '<span class="empty-element">Комментариев нет</span>';
    } else {
        $tpl->show($tpl->result['content']);
        $tpl->global_clear();
    }
    exit();
}

if (isset($_POST['send_appadmin_comment'])) {
    $id = checkJs($_POST['id'],"int");

    if (empty($id)) {
        exit(json_encode(array('status' => '2')));
    }

    include_once '../../../inc/classes/HTMLPurifier/HTMLPurifier.auto.php';
    $text = $Purifier->purify($_POST['text']);
    $text = find_img_mp3($text, $id, 1);

    if (empty($text)) {
        exit (json_encode(array('status' => '2', 'input' => 'text', 'reply' => 'Заполните!')));
    }

    if (mb_strlen($text, 'UTF-8') > 10000) {
        exit (json_encode(array('status' => '2', 'input' => 'text', 'reply' => 'Слишком длинный контент.')));
    }

    $date = date("Y-m-d H:i:s");

    $STH = $pdo->query("SELECT `appadmin`.`author`, `appadmin`.`closed`, `users`.`email`, `users`.`email_notice` FROM `appadmin` LEFT JOIN `users` ON `users`.`id`=`appadmin`.`author` WHERE `appadmin`.`id`='$id' LIMIT 1"); $STH->setFetchMode(PDO::FETCH_OBJ);
    $row = $STH->fetch();

    $STH = $pdo->prepare("INSERT INTO `appadmin__comments` (`user_id`, `appadmin_id`, `text`, `date`) values (:user_id, :appadmin_id, :text, :date)");
    $STH->execute(array( 'user_id' => $_SESSION['id'], 'appadmin_id' => $id, 'text' => $text, 'date' => $date ));
    if ($row->author != $_SESSION['id']){
    
        $STH = $pdo->prepare("UPDATE `appadmin` SET `have_answer`=:have_answer WHERE `id`='$id' LIMIT 1");
        $STH->execute(array( 'have_answer' => '1' ));

        include_once "../../../inc/notifications.php";

        send_noty($pdo, "В вашей заявке на администратора <a href='../appadmin/appadmin?id=".$id."'>#".$id."</a> оставлен ответ", $row->author, 1);

        if($row->email_notice == 1) {
            sendmail($row->email, "Оставлен ответ в заявке на администратора", "В Вашей заявке на администратора (".$full_site_host."appadmin/appadmin?id=".$id.") оставлен ответ", $pdo);
        }
    } else {
        if($row->closed == 0) {
            $STH = $pdo->prepare("UPDATE `appadmin` SET `have_answer`=:have_answer WHERE `id`='$id' LIMIT 1");
            $STH->execute(array( 'have_answer' => '0' ));
        }
    }
    exit (json_encode(array('status' => '1')));
}

if (isset($_POST['dell_appadmin_comment']) and is_worthy("u")) {
    $id = check($_POST['id'],"int");

    if (empty($id)){
        exit(json_encode(array('status' => '2')));
    }

    $STH = $pdo->prepare("SELECT `appadmin`.`server` FROM `appadmin__comments`
        LEFT JOIN `appadmin` ON `appadmin__comments`.`appadmin_id` = `appadmin`.`id`
        WHERE `appadmin__comments`.`id` = :id LIMIT 1"); $STH->setFetchMode(PDO::FETCH_OBJ);
    $STH->execute(array( ':id' => $id ));
    $row = $STH->fetch();

    if (!is_worthy_specifically("u", $row->server)) {
        exit(json_encode(array('status' => '2')));
    }

    $pdo->exec("DELETE FROM `appadmin__comments` WHERE `id`='$id' LIMIT 1");
    exit(json_encode(array('status' => '1')));
}
?>

ошибки из browser

Failed to load resource: the server responded with a status of 500 ()
o104379.ingest.sentry.io/api/5495040/envelope/?sentry_key=31f33ef1a1a74d32a00749c3718b640d&sentry_version=7:1 Failed to load resource: the server responded with a status of 403 ()
noty.js?v=41:527 Uncaught TypeError: Cannot read properties of undefined (reading 'layouts')
at noty.js?v=41:527:19
at dispatch (jquery3.js?v=41:2:41772)
at y.handle (jquery3.js?v=41:2:39791)
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу