コード例 #1
0
ファイル: pms_misc.php プロジェクト: mtechnik/pantherforum
                        }
                        ($hook = get_extensions('pms_delete_folder_before_deletion')) ? eval($hook) : null;
                        $update = array('folder_id' => 2);
                        $update_data = array(':id' => $id);
                        $db->update('pms_data', $update, 'folder_id=:id', $update_data);
                        $db->delete('folders', 'id=:id AND user_id=:uid', $data);
                        redirect(panther_link($panther_url['pms_folders']), $lang_pm['Folder del redirect']);
                    }
                }
            }
            $data = array(':uid' => $panther_user['id']);
            $folders = array();
            $ps = $db->select('folders', 'name, id', $data, 'user_id=:uid');
            foreach ($ps as $cur_folder) {
                $folders[] = array('id' => $cur_folder['id'], 'name' => $cur_folder['name']);
            }
            $required_fields = array('req_folder' => $lang_pm['Folder']);
            $focus_element = array('folder', 'req_folder');
            ($hook = get_extensions('pms_message_folders_before_header')) ? eval($hook) : null;
            $page_title = array($panther_config['o_board_title'], $lang_common['PM'], $lang_pm['My folders 2']);
            define('PANTHER_ALLOW_INDEX', 1);
            define('PANTHER_ACTIVE_PAGE', 'pm');
            require PANTHER_ROOT . 'header.php';
            $tpl = load_template('message_folders.tpl');
            echo $tpl->render(array('errors' => $errors, 'lang_pm' => $lang_pm, 'lang_common' => $lang_common, 'pm_menu' => generate_pm_menu('folders'), 'form_action' => panther_link($panther_url['pms_folders']), 'folder' => isset($folder) ? $folder : '', 'folders' => $folders));
            require PANTHER_ROOT . 'footer.php';
        } else {
            message($lang_common['Bad request']);
        }
    }
}
コード例 #2
0
ファイル: pms_inbox.php プロジェクト: mtechnik/pantherforum
$data = array(':fid' => $box_id, ':uid' => $panther_user['id']);
$ps = $db->run('SELECT COUNT(c.id) FROM ' . $db->prefix . 'conversations AS c INNER JOIN ' . $db->prefix . 'pms_data AS cd ON c.id=cd.topic_id WHERE cd.user_id=:uid AND cd.deleted=0 AND (cd.folder_id=:fid ' . ($box_id == 1 ? 'OR cd.viewed=0)' : ')'), $data);
$messages = $ps->fetchColumn();
$num_pages = ceil($messages / $panther_user['disp_topics']);
$p = !isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages ? 1 : intval($_GET['p']);
$start_from = $panther_user['disp_topics'] * ($p - 1);
$data = array(':uid' => $panther_user['id'], ':fid' => $box_id, ':start' => $start_from);
$ps = $db->run('SELECT c.id, c.subject, c.poster, c.poster_id, c.num_replies, c.last_post, c.last_poster, c.last_post_id, cd.viewed, u.group_id AS poster_gid, u.email, u.use_gravatar, l.id AS last_poster_id, l.group_id AS last_poster_gid FROM ' . $db->prefix . 'conversations AS c INNER JOIN ' . $db->prefix . 'pms_data AS cd ON c.id=cd.topic_id LEFT JOIN ' . $db->prefix . 'users AS u ON u.id=c.poster_id LEFT JOIN ' . $db->prefix . 'users AS l ON l.username=c.last_poster WHERE cd.user_id=:uid AND cd.deleted=0 AND (cd.folder_id=:fid ' . ($box_id == 1 ? 'OR cd.viewed=0)' : ')') . 'ORDER BY c.last_post DESC LIMIT :start, ' . $panther_user['disp_topics'], $data);
define('COMMON_JAVASCRIPT', true);
$page_title = array($panther_config['o_board_title'], $lang_common['PM'], $lang_pm['PM Inbox']);
define('PANTHER_ALLOW_INDEX', 1);
define('PANTHER_ACTIVE_PAGE', 'pm');
require PANTHER_ROOT . 'header.php';
($hook = get_extensions('inbox_before_display')) ? eval($hook) : null;
$topics = array();
foreach ($ps as $cur_topic) {
    $data = array(':tid' => $cur_topic['id']);
    $users = array();
    $ps1 = $db->run('SELECT cd.user_id AS id, u.username, u.group_id FROM ' . $db->prefix . 'pms_data AS cd INNER JOIN ' . $db->prefix . 'users AS u ON cd.user_id=u.id WHERE topic_id=:tid', $data);
    foreach ($ps1 as $user_data) {
        $users[] = colourize_group($user_data['username'], $user_data['group_id'], $user_data['id']);
    }
    if ($panther_config['o_censoring'] == '1') {
        $cur_topic['subject'] = censor_words($cur_topic['subject']);
    }
    $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $panther_user['disp_posts']);
    $topics[] = array('viewed' => $cur_topic['viewed'], 'id' => $cur_topic['id'], 'poster' => colourize_group($cur_topic['poster'], $cur_topic['poster_gid'], $cur_topic['poster_id']), 'users' => $users, 'last_post_avatar' => generate_avatar_markup($cur_topic['last_poster_id'], $cur_topic['email'], $cur_topic['use_gravatar'], array(32, 32)), 'last_post_link' => panther_link($panther_url['pms_post'], array($cur_topic['last_post_id'])), 'last_post' => format_time($cur_topic['last_post']), 'last_poster' => colourize_group($cur_topic['last_poster'], $cur_topic['last_poster_gid'], $cur_topic['last_poster_id']), 'num_replies' => forum_number_format($cur_topic['num_replies']), 'new_post_link' => panther_link($panther_url['pms_new'], array($cur_topic['id'])), 'pagination' => paginate($num_pages_topic, -1, $panther_url['pms_paginate'], array($cur_topic['id'])), 'num_pages' => $num_pages_topic, 'url' => panther_link($panther_url['pms_view'], array($cur_topic['id'])), 'subject' => $cur_topic['subject']);
}
$tpl = load_template('inbox.tpl');
echo $tpl->render(array('lang_common' => $lang_common, 'lang_pm' => $lang_pm, 'index_link' => panther_link($panther_url['index']), 'inbox_link' => panther_link($panther_url['inbox']), 'box_link' => panther_link($panther_url['box'], array($box_id)), 'message_link' => panther_link($panther_url['send_message']), 'box_name' => $box_name, 'pm_menu' => generate_pm_menu($box_id), 'csrf_token' => generate_csrf_token(), 'page' => $p, 'pagination' => paginate($num_pages, $p, $panther_url['box'], array($box_id)), 'box_id' => $box_id, 'topics' => $topics));
require PANTHER_ROOT . 'footer.php';
コード例 #3
0
ファイル: pms_send.php プロジェクト: mtechnik/pantherforum
        message($lang_common['Bad request']);
    } else {
        $folder_id = $ps->fetchColumn();
    }
    if ($folder_id == 3) {
        // If we've archived this folder
        message($lang_common['Bad request']);
    }
}
if (!empty($panther_robots) && $panther_user['g_robot_test'] == '1') {
    $required_fields['answer'] = $lang_common['Robot title'];
}
$focus_element[] = $tid ? 'req_message' : 'req_subject';
$page_title = array($panther_config['o_board_title'], $lang_common['PM'], $lang_pm['Send message']);
define('PANTHER_ALLOW_INDEX', 1);
define('PANTHER_ACTIVE_PAGE', 'pm');
require PANTHER_ROOT . 'header.php';
$render = array('tid' => $tid, 'errors' => $errors, 'preview' => isset($_POST['preview']) ? true : false, 'index_link' => panther_link($panther_url['index']), 'inbox_link' => panther_link($panther_url['inbox']), 'pm_menu' => generate_pm_menu('send'), 'form_action' => !$tid ? panther_link($panther_url['send_message']) : panther_link($panther_url['pms_reply'], array($tid)), 'subject' => isset($subject) ? $subject : '', 'message' => isset($_POST['req_message']) ? $message : (isset($quote) ? $quote : ''), 'lang_pm' => $lang_pm, 'lang_common' => $lang_common, 'panther_config' => $panther_config, 'panther_user' => $panther_user, 'lang_post' => $lang_post, 'csrf_token' => generate_csrf_token('post.php'), 'quickpost_links' => array('bbcode' => panther_link($panther_url['help'], array('bbcode')), 'url' => panther_link($panther_url['help'], array('url')), 'img' => panther_link($panther_url['help'], array('img')), 'smilies' => panther_link($panther_url['help'], array('smilies'))));
($hook = get_extensions('pms_before_submit')) ? eval($hook) : null;
if (isset($_POST['preview'])) {
    require_once PANTHER_ROOT . 'include/parser.php';
    $render['preview'] = $parser->parse_message($message, $hide_smilies);
}
if (!empty($panther_robots) && $panther_user['g_robot_test'] == '1') {
    $id = array_rand($panther_robots);
    $render['robot_id'] = $id;
    $render['test'] = $panther_robots[$id];
}
$tpl = load_template('send_message.tpl');
echo $tpl->render($render);
require PANTHER_ROOT . 'footer.php';
コード例 #4
0
ファイル: pms_view.php プロジェクト: mtechnik/pantherforum
    }
    if ($cur_topic['fid'] != '3') {
        if ($cur_post['poster_id'] == $panther_user['id'] || $panther_user['is_admmod']) {
            $post_actions[] = array('class' => 'delete', 'href' => panther_link($panther_url['pms_delete'], array($cur_post['id'])), 'title' => $lang_topic['Delete']);
            if ($panther_user['g_edit_posts'] == '1') {
                $post_actions[] = array('class' => 'edit', 'href' => panther_link($panther_url['pms_edit'], array($cur_post['id'])), 'title' => $lang_topic['Edit']);
            }
            if ($panther_user['g_post_replies'] == '1') {
                $post_actions[] = array('class' => 'quote', 'href' => panther_link($panther_url['pms_quote'], array($tid, $cur_post['id'])), 'title' => $lang_topic['Quote']);
            }
        }
    }
    // Do signature parsing/caching
    if ($panther_config['o_signatures'] == '1' && $cur_post['signature'] != '' && $panther_user['show_sig'] != '0') {
        if (isset($signature_cache[$cur_post['poster_id']])) {
            $signature = $signature_cache[$cur_post['poster_id']];
        } else {
            $signature = $parser->parse_signature($cur_post['signature']);
            $signature_cache[$cur_post['poster_id']] = $signature;
        }
    }
    $posts[] = array('id' => $cur_post['id'], 'link' => panther_link($panther_url['pms_post'], array($cur_post['id'])), 'posted' => format_time($cur_post['posted']), 'username' => colourize_group($cur_post['username'], $cur_post['g_id'], $cur_post['poster_id']), 'user_title' => $user_title, 'number' => $start_from + ++$post_count, 'avatar' => $user_avatar, 'poster_reputation' => $reputation, 'message' => $parser->parse_message($cur_post['message'], $cur_post['hide_smilies']), 'signature' => $signature, 'edited' => $cur_post['edited'] ? format_time($cur_post['edited']) : '', 'edited_by' => $cur_post['edited_by'], 'post_actions' => $post_actions, 'user_info' => $user_info, 'group_image' => $group_image, 'user_contacts' => $user_contacts, 'is_online' => $cur_post['is_online'], 'poster_id' => $cur_post['poster_id']);
}
$render = array('lang_common' => $lang_common, 'lang_topic' => $lang_topic, 'lang_pm' => $lang_pm, 'index_link' => panther_link($panther_url['index']), 'inbox_link' => panther_link($panther_url['inbox']), 'cur_topic' => $cur_topic, 'panther_config' => $panther_config, 'panther_user' => $panther_user, 'reply_link' => panther_link($panther_url['pms_reply'], array($tid)), 'pm_menu' => generate_pm_menu($cur_topic['fid']), 'pagination' => paginate($num_pages, $p, $panther_url['pms_paginate'], array($tid)), 'posts' => $posts, 'quickpost' => $quickpost, 'csrf_token' => generate_csrf_token());
if ($quickpost) {
    $render['quickpost_links'] = array('form_action' => panther_link($panther_url['pms_reply'], array($tid)), 'bbcode' => panther_link($panther_url['help'], array('bbcode')), 'url' => panther_link($panther_url['help'], array('url')), 'img' => panther_link($panther_url['help'], array('img')), 'smilies' => panther_link($panther_url['help'], array('smilies')));
}
$tpl = load_template('pm_topic.tpl');
echo $tpl->render($render);
($hook = get_extensions('pms_topic_after_display')) ? eval($hook) : null;
require PANTHER_ROOT . 'footer.php';