Location: PHPKode > projects > PhpMyForum > phpmyforum_4_1_1/admin/word.php
<?php
define('PMF_INCLUDE', 1);
require('head.php');
access('acp_word');

require_once($_cfg['MAIN'].'/lib/sys.inc.php');
$_sys = new pmf_sys();
require($_cfg['MAIN'].'/lib/admin.inc.php');


#
#
### W�rter Liste (form)
if (!$_GET['action']) {
    $result = $_db->query('SELECT * FROM `'.$_cfg['DB_PREFIX'].'word` ORDER BY search ASC');
    $word_lines = '';
    while ($Daten = $_db->fetch_array($result)) {
        $Daten['search'] = htmlentities($Daten['search'], ENT_QUOTES);
        $Daten['replacement'] = htmlentities($Daten['replacement'], ENT_QUOTES);
        $word_lines .= eval ('return ("'.$_style->get('acp_word_line').'");');
    }
    eval ('echo "'.$_style->get('acp_word').'";');



#
#
### Wort hinzufügen
} elseif ($_GET['action'] == 'add') {
    eval ('echo "'.$_style->get('acp_word_add').'";');


    
#
#
### Wort bearbeiten
} elseif ($_GET['action'] == 'edit' && is_numeric($_GET['id'])) {
    $Daten = $_db->fetch_first('SELECT * FROM `'.$_cfg['DB_PREFIX'].'word` WHERE id = '.$_GET['id']);
    $Daten['search'] = htmlentities($Daten['search'], ENT_QUOTES);
    $Daten['replacement'] = htmlentities($Daten['replacement'], ENT_QUOTES);
    eval ('echo "'.$_style->get('acp_word_edit').'";');



#
#
### Wort speichern
} elseif ($_GET['action'] == 'save') {
    # hinzuf�gen
    if (!$_POST['id']) {
        $_db->u_query('INSERT INTO `'.$_cfg['DB_PREFIX'].'word` (`search`,`replacement`)
                       VALUES (\''.gpc_addslashes($_POST['search']).'\',\''.gpc_addslashes($_POST['replacement']).'\')');
    # bearbeiten
    } else {
        $_db->u_query('UPDATE `'.$_cfg['DB_PREFIX'].'word`
                     SET search = \''.gpc_addslashes($_POST['search']).'\',
                         replacement = \''.gpc_addslashes($_POST['replacement']).'\'
                     WHERE id = '.intval($_POST['id']));
    }
    // Cache erstellen
    cache_words();
    
    msg('error_acp_save', 'word.php?'.$_sess['url']);



#
#
### Wort löschen
} elseif ($_GET['action'] == 'del' && is_numeric($_GET['id'])) {
    # Formular anzeigen
    if (!$_GET['ok']) {
        $Daten = $_db->fetch_first('SELECT * FROM `'.$_cfg['DB_PREFIX'].'word` WHERE id = '.$_GET['id']);
        eval ('echo "'.$_style->get('acp_word_del').'";');
    # wirklich löschen
    } else {
        $_db->u_query('DELETE FROM `'.$_cfg['DB_PREFIX'].'word` WHERE id = '.$_GET['id']);
        // Cache erstellen
        cache_words();
    
        msg('error_acp_del', 'word.php?'.$_sess['url']);
    }
}
?>
Return current item: PhpMyForum