Обратная связь

Обратная связь 1.1.0

Нет прав для скачивания

Kryl

Пользователь
#51
В page_header.php
найти 'U_TRACKER' => "tracker.php",
ниже вставить 'U_CONTACTUS' => "contactus.php",
В page_header.tpl найти (может отличаться)
<a class="guestButton" href="login.php">{L_LOGIN}</a> <a class="guestButton" href="{U_REGISTER}">{L_REGISTER}</a>
Рядом добавить <a class="guestButton" href="{U_CONTACTUS}">{L_CONTACTUS}</a>
 

Вложения

vitalix

Пользователь
#52
нотис в логах
[08-Apr-2015 07:38:51 UTC] PHP Notice: Undefined index: msg_type in /contactus.php on line 9

строка:
$msg_type = (int) $_POST['msg_type'];
 

sergey67

Пользователь
#54
всем привет,поделитесь пожалуйста адаптацией мода под версию 2.2.3,если есть у кого
 

sergey67

Пользователь
#55
привел файл к такому виду
PHP:
<?php

// ACP Header - START
if (!empty($setmodules))
{
    $module['MODS']['Вопросы от гостей'] = basename(__FILE__) . '?mode=list';
    return;
}
require('./pagestart.php');
// ACP Header - END

$mode      = (string) request_var('mode', '');
$submit  = isset($_POST['submit']);
//$countact_id = isset($_GET['id']) ? (int) $_GET['id'] : '';
$countact_id = (int) request_var('id', '');
$selected = isset($_POST['select']) ? implode(',', $_POST['select']) : '';
$message  = (string) request_var('message', '');

switch($mode)
{
    case 'list':
        $sql_count = DB()->fetch_row("SELECT COUNT(id) AS count FROM bb_contactus");
        if(!$sql_count['count']) bb_die('Вопросов пока нету !');
        
        $sql = DB()->fetch_rowset("SELECT * FROM bb_contactus ORDER BY msg_type ASC");
        
        foreach($sql as $i => $row)
        {
            $template->assign_block_vars('list', array(
                'ROW_CLASS'      => !($i % 2) ? 'row2' : 'row1',
                'NUMBER'      => $i + 1,
                'ID'          => $row['id'],
                'MSG_TYPE'      => $bb_cfg['massege_type_view'][$row['msg_type']],
                'ADMIN_TYPE'  => $bb_cfg['admin_type_view'][$row['admin_type']],
                'NAME'          => $row['name'],
                'TIME'          => bb_date($row['msg_time']),
                'TITLE'          => $row['subject'],
            ));
        }
        
        $template->assign_vars(array(
            'TPL_LIST'         => true,
            'S_ACTION'         => 'admin_countactus.php',
            'S_MODE'        => 'list',
        ));
        
        break;
    
    case 'view':
    
        $sql = DB()-> fetch_rowset("SELECT * FROM bb_contactus WHERE id = $countact_id");
        
        foreach($sql as $row)
        {
            $subject[] = $row['subject'];
            $template->assign_vars(array(
                'ID'         => $row['id'],
                'TIME'         => bb_date($row['msg_time']),
                'USER_IP'     => decode_ip($row['user_ip']),
                'MSG_TYPE'     => $bb_cfg['massege_type_view'][$row['msg_type']],
                'ADMIN_TYPE' => $row['admin_type'] ? $bb_cfg['admin_type'][$row['admin_type']] : '',
                'EMAIL'         => $row['email'],
                'NAME'         => $row['name'],
                'TITLE'         => $row['subject'],
                'MASSEGE'     => $row['massege'],
            ));
        }
        
        $select_type = array();
        foreach($bb_cfg['admin_type'] as $type => $key)
        {   
            $select_type[$key] = $type;
        }
        
        $template->assign_vars(array(
            'TPL_EDIT'             => true,
            'S_ACTION'             => 'admin_countactus.php',
            'S_MODE'            => 'view',
            'ADMIN_TYPE'        => build_select('admin_type', $select_type, $row['admin_type']),
        ));
        
        break;
        
    case 'delete':
        DB()->query("DELETE FROM bb_contactus WHERE id IN ($countact_id)");
        meta_refresh('admin_countactus.php?mode=list', 2);
        bb_die('Готово !');
        break;
}

if ($submit)
{
    //dump($_POST);
    if ($_POST['mode'] == 'list' && $selected)
    {
        DB()->query("DELETE FROM bb_contactus WHERE id IN ($selected)");
        meta_refresh('admin_countactus.php?mode=list', 2);
        bb_die('Удаление закончино!');
    }
    elseif ($_POST['mode'] == 'view')
    {
        $id         = $_POST['id'];
        $admin_type = $_POST['admin_type'];
        
        DB()->query("UPDATE bb_contactus SET
            admin_type = '$admin_type'
        WHERE
            id = '$id'
        ");

        if ($_POST['message'])
            
        {
            $emailer = new TorrentPier\Legacy\Emailer();
                
            $emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
            $emailer->set_to([$_POST['name'] => $_POST['email']]);
            $emailer->set_subject($subject);
            
            $emailer->set_template('admin_send_email');
            $emailer->assign_vars(array(
                'SUBJECT'    => $subject[0],
                'MESSAGE'    => html_entity_decode($message.$bb_cfg['admin_type'][$admin_type]),
            ));
                
            $emailer->send();
            //$emailer->reset();
        }
        elseif (!empty($_POST['delete']))
        {
            $id = $_POST['id'];
            DB()->query("DELETE FROM bb_contactus WHERE id = $id");
        }
        
        meta_refresh('admin_countactus.php?mode=list', 2);
        bb_die('Действие было исполнено!');
    }
}

print_page('admin_countactus.tpl', 'admin');

но пока результата не добился. Не работает отправка. Может кто подскажет,как исправить? Тапками не кидайтесь,я всего лишь учусь
 

sergey67

Пользователь
#56
Чуть чуть изменил, но проблема с массивом осталась...
PHP:
<?php

// ACP Header - START
if (!empty($setmodules))
{
    $module['MODS']['Вопросы от гостей'] = basename(__FILE__) . '?mode=list';
    return;
}
require('./pagestart.php');
// ACP Header - END

$mode      = (string) request_var('mode', '');
$submit  = isset($_POST['submit']);
//$countact_id = isset($_GET['id']) ? (int) $_GET['id'] : '';
$countact_id = (int) request_var('id', '');
$selected = isset($_POST['select']) ? implode(',', $_POST['select']) : '';
$message  = (string) request_var('message', '');

switch($mode)
{
    case 'list':
        $sql_count = DB()->fetch_row("SELECT COUNT(id) AS count FROM bb_contactus");
        if(!$sql_count['count']) bb_die('Вопросов пока нету !');
        
        $sql = DB()->fetch_rowset("SELECT * FROM bb_contactus ORDER BY msg_type ASC");
        
        foreach($sql as $i => $row)
        {
            $template->assign_block_vars('list', array(
                'ROW_CLASS'      => !($i % 2) ? 'row2' : 'row1',
                'NUMBER'      => $i + 1,
                'ID'          => $row['id'],
                'MSG_TYPE'      => $bb_cfg['massege_type_view'][$row['msg_type']],
                'ADMIN_TYPE'  => $bb_cfg['admin_type_view'][$row['admin_type']],
                'NAME'          => $row['name'],
                'TIME'          => bb_date($row['msg_time']),
                'TITLE'          => $row['subject'],
            ));
        }
        
        $template->assign_vars(array(
            'TPL_LIST'         => true,
            'S_ACTION'         => 'admin_countactus.php',
            'S_MODE'        => 'list',
        ));
        
        break;
    
    case 'view':
    
        $sql = DB()-> fetch_rowset("SELECT * FROM bb_contactus WHERE id = $countact_id");
        
        foreach($sql as $row)
        {
            $subject[] = $row['subject'];
            $template->assign_vars(array(
                'ID'         => $row['id'],
                'TIME'         => bb_date($row['msg_time']),
                'USER_IP'     => decode_ip($row['user_ip']),
                'MSG_TYPE'     => $bb_cfg['massege_type_view'][$row['msg_type']],
                'ADMIN_TYPE' => $row['admin_type'] ? $bb_cfg['admin_type'][$row['admin_type']] : '',
                'NAME'         => $row['name'],
                'EMAIL'         => $row['email'],
                'TITLE'         => $row['subject'],
                'MASSEGE'     => $row['massege'],
            ));
        }
        
        $select_type = array();
        foreach($bb_cfg['admin_type'] as $type => $key)
        {   
            $select_type[$key] = $type;
        }
        
        $template->assign_vars(array(
            'TPL_EDIT'             => true,
            'S_ACTION'             => 'admin_countactus.php',
            'S_MODE'            => 'view',
            'ADMIN_TYPE'        => build_select('admin_type', $select_type, $row['admin_type']),
        ));
        
        break;
        
    case 'delete':
        DB()->query("DELETE FROM bb_contactus WHERE id IN ($countact_id)");
        meta_refresh('admin_countactus.php?mode=list', 2);
        bb_die('Готово !');
        break;
}

if ($submit)
{
    //dump($_POST);
    if ($_POST['mode'] == 'list' && $selected)
    {
        DB()->query("DELETE FROM bb_contactus WHERE id IN ($selected)");
        meta_refresh('admin_countactus.php?mode=list', 2);
        bb_die('Удаление закончино!');
    }
    elseif ($_POST['mode'] == 'view')
    {
        $id         = $_POST['id'];
        $admin_type = $_POST['admin_type'];
        
        DB()->query("UPDATE bb_contactus SET
            admin_type = '$admin_type'
        WHERE
            id = '$id'
        ");

        if ($_POST['message'])
            
        {
            $emailer = new TorrentPier\Legacy\Emailer();
                
            $emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
            $emailer->set_to([$_POST['email'] => $_POST['name']]);
            $emailer->set_subject($subject);
            $emailer->set_template('admin_send_email');
            
            $emailer->assign_vars(array(
                'SUBJECT'    => $subject[0],
                'MESSAGE'    => html_entity_decode($message.$bb_cfg['admin_type'][$admin_type]),
            ));
                
            $emailer->send();
        }
        elseif (!empty($_POST['delete']))
        {
            $id = $_POST['id'];
            DB()->query("DELETE FROM bb_contactus WHERE id = $id");
        }
        
        meta_refresh('admin_countactus.php?mode=list', 2);
        bb_die('Действие было исполнено!');
    }
}

print_page('admin_countactus.tpl', 'admin');
 
Сверху