Ejemplo n.º 1
0
}
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
$action = isset($_GET['action']) ? $_GET['action'] : 'history';
if (!$id) {
    message($lang_common['Bad request']);
}
$result = $db->query('SELECT * FROM ' . $db->prefix . 'glossary_items WHERE id=' . $id) or error('Could not fetch glossary item info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result)) {
    message($lang_common['Bad request']);
}
$cur_gloss = $db->fetch_assoc($result);
if (isset($_POST['action'])) {
    switch ($_POST['action']) {
        case 'editgloss':
            $cur_gloss = array('id' => $id, 'src' => isset($_POST['source']) ? strtolower(trim($_POST['source'])) : null, 'dst' => isset($_POST['destination']) ? strtolower(trim($_POST['destination'])) : null, 'description' => isset($_POST['description']) ? strtolower(trim($_POST['description'])) : null);
            process_newgloss($cur_gloss, true);
            redirect('glossitem.php?id=' . $id, 'Glossary updated.');
            break;
        case 'vote':
            $vote_id = intval($_POST['vote']);
            $dsts = parse_evgs_destination($cur_gloss['dst']);
            if (!isset($dsts[$vote_id])) {
                message($lang_common['Bad request']);
            }
            if ($cur_gloss['votes'] != '') {
                $votes = unserialize($cur_gloss['votes']);
            } else {
                $votes = array();
            }
            $votes[$pun_user['id']] = $dsts[$vote_id];
            $cur_gloss['votes'] = serialize($votes);
Ejemplo n.º 2
0
require PUN_ROOT . 'lang/' . $pun_user['language'] . '/evgs.php';
if ($pun_user['g_read_board'] == '0') {
    message($lang_common['No view']);
} else {
    if ($pun_user['g_search'] == '0') {
        message($lang_search['No search permission']);
    }
}
// Detect two byte character sets
$multibyte = isset($lang_common['lang_multibyte']) && $lang_common['lang_multibyte'] ? true : false;
if (isset($_POST['action']) && $_POST['action'] == 'newgloss') {
    if ($pun_user['is_guest']) {
        message($lang_common['No permission']);
    }
    $cur_gloss = array('src' => isset($_POST['source']) ? strtolower(trim($_POST['source'])) : null, 'dst' => isset($_POST['destination']) ? strtolower(trim($_POST['destination'])) : null, 'description' => isset($_POST['description']) ? strtolower(trim($_POST['description'])) : null);
    $id = process_newgloss($cur_gloss);
    if ($id > 0) {
        redirect('glossary.php?action=search&source=' . urlencode($cur_gloss['src']), '__Added successfully new term');
    } else {
        if (!defined('PUN_HEADER')) {
            global $pun_user;
            $page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / ' . $lang_common['Info'];
            require PUN_ROOT . 'header.php';
        }
        if (isset($cur_gloss['error'])) {
            ?>
<div id="msg" class="block">
	<h2><span><?php 
            echo $lang_common['Info'];
            ?>
</span></h2>