Changeset 14969


Ignore:
Timestamp:
May 14, 2012, 1:14:17 PM (8 years ago)
Author:
ddtddt
Message:

[extensions] - add_head_element - clean code

Location:
extensions/add_head_element
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/add_head_element/admin/admin.php

    r12496 r14969  
    2626$tabsheet->assign();
    2727
    28 // Onglet Management
    2928switch ($page['tab'])
    3029{
    3130  case 'Management':
    32 
    33 //charge Perso About
    34 $query = '
    35 select param,value
    36         FROM ' . CONFIG_TABLE . '
    37   WHERE param = "add_head_element"
    38         ;';
    39 $result = pwg_query($query);
    40 $row = mysql_fetch_array($result);
     31global $template, $conf;
    4132   
    4233  $template->assign(
    4334    'gestA',
    44     array(
    45       'AHEBASE' => $row['value'],
    46       ));
    47 
     35    array('AHEBASE' => $conf['add_head_element'],));
    4836
    4937if (isset($_POST['submitahe']))
    5038        {
    51         $query = '
    52 UPDATE ' . CONFIG_TABLE . '
    53   SET value= \''.$_POST['ahe'].'\'
    54   WHERE param = "add_head_element"
    55     ;';
    56 $result = pwg_query($query);
    57 
     39  conf_update_param('add_head_element', $_POST['ahe']);
    5840  $template->assign(
    5941    'gestA',
    60     array(
    61       'AHEBASE' => stripslashes($_POST['ahe']),
    62       ));
    63 
     42    array('AHEBASE' => stripslashes($_POST['ahe']),));
    6443        }
    65 
    66     break;
    67 
    68        
     44 break;
    6945}
    7046
  • extensions/add_head_element/main.inc.php

    r12496 r14969  
    3232{
    3333
    34 global $template;
     34global $template,$conf;
    3535
    36 $query = '
    37 select param,value
    38         FROM ' . CONFIG_TABLE . '
    39   WHERE param = "add_head_element"
    40         ;';
    41 $result = pwg_query($query);
    42 $row = mysql_fetch_assoc($result);
    43 
    44         if (!empty($row['value']))
     36        if (!empty($conf['add_head_element']))
    4537        {
    46     $template->append('head_elements', $row['value']);
     38    $template->append('head_elements', $conf['add_head_element']);
    4739        }
    4840 }
Note: See TracChangeset for help on using the changeset viewer.