Ignore:
Timestamp:
May 5, 2012, 12:56:27 AM (12 years ago)
Author:
plg
Message:

simplify custom text management

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContactForm/admin/cf_persoform.tab.php

    r14428 r14756  
    11<?php
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     3
    34check_status(ACCESS_ADMINISTRATOR);
    45
    56global $template, $conf, $user;
    67
     8if (isset($_POST['submitpersoform']))
     9{
     10  conf_update_param('persoformtop', $_POST['persoform_top']);
     11  conf_update_param('persoformbottom', $_POST['persoform_bottom']);
     12
     13  // reload configuration
     14  load_conf_from_db();
     15}
     16
    717//charge Persoform
    8 $query = '
    9 select param,value
    10         FROM ' . CONFIG_TABLE . '
    11   WHERE param = "persoformtop"
    12         ;';
    13 $result = pwg_query($query);
    14 
    15 $row = mysql_fetch_array($result);
    16    
    17   $template->assign(
    18     array(
    19       'PERSOFORMTOP' => $row['value'],
    20       ));
    21 
    22 $query = '
    23 select param,value
    24         FROM ' . CONFIG_TABLE . '
    25   WHERE param = "persoformbottom"
    26         ;';
    27 $result = pwg_query($query);
    28 
    29 $row = mysql_fetch_array($result);
    30    
    31   $template->assign(
    32     array(
    33       'PERSOFORMBOTTOM' => $row['value'],
    34       ));
    35 
    36 if (isset($_POST['submitpersoform']))
    37         {
    38         $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="persoformtop" LIMIT 1;';
    39     pwg_query($q);
    40                 $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("persoformtop","'.$_POST['persoform_top'].'","Add text above form to contactform plugin");';
    41     pwg_query($query);
    42 
    43   $template->assign(
    44     array(
    45       'PERSOFORMTOP' => stripslashes($_POST['persoform_top']),
    46       ));
    47 
    48         $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="persoformbottom" LIMIT 1;';
    49     pwg_query($q);
    50         $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("persoformbottom","'.$_POST['persoform_bottom'].'","Add text below form to contactform plugin");';
    51     pwg_query($query);
    52 
    53   $template->assign(
    54     array(
    55       'PERSOFORMBOTTOM' => stripslashes($_POST['persoform_bottom']),
    56       ));
    57         }       
    58        
     18$template->assign(
     19  array(
     20    'PERSOFORMTOP' => $conf['persoformtop'],
     21    'PERSOFORMBOTTOM' => $conf['persoformbottom'],
     22    )
     23  );
    5924?>
Note: See TracChangeset for help on using the changeset viewer.