source: extensions/Statistics/maintain.inc.php @ 25999

Last change on this file since 25999 was 7445, checked in by plg, 14 years ago

bug fixed: ability to use a Google Analytics/Piwik javascript code including a
comma.

simpler code, easier to maintain I hope.

change file format from MacOs to Unix line endings.

File size: 1.3 KB
Line 
1<?php
2
3function plugin_activate()
4{
5  $query = '
6SELECT
7    value
8  FROM '.CONFIG_TABLE.'
9  WHERE param=\'statistics\'
10;';
11  $result = pwg_query($query);
12  if ($row = pwg_db_fetch_assoc($result))
13  {
14    if (!preg_match('/^a:/', $row['value']))
15    {
16      $old_conf = explode("," , $row['value']);
17     
18      $conf_statistics = array(
19        'content'       => $old_conf[2],
20        'header'        => ($old_conf[0] == 'on'),
21        'tail'          => ($old_conf[1] == 'on'),
22        'exclude_admin' => ($old_conf[3] == 'on'),
23        'exclude_guest' => ($old_conf[4] == 'on'),
24        );
25
26      $query = '
27UPDATE '.CONFIG_TABLE.'
28  SET value = \''.pwg_db_real_escape_string(serialize($conf_statistics)).'\'
29  WHERE param=\'statistics\'
30;';
31      pwg_query($query);
32    }
33  }
34}
35
36function plugin_install()
37{
38  $conf_statistics = array(
39    'content' => '',
40    'header' => false,
41    'tail' => true,
42    'exclude_admin' => false,
43    'exclude_guest' => false,
44    );
45 
46  $query = '
47INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
48  VALUES (
49    \'statistics\',
50    \''.pwg_db_real_escape_string(serialize($conf_statistics)).'\',
51    \'Parameters of Statistics plugin\'
52  )
53;';
54  pwg_query($query);
55}
56
57function plugin_uninstall()
58{
59  $query = '
60DELETE FROM '.CONFIG_TABLE.'
61  WHERE param=\'statistics\'
62;';
63  pwg_query($query);
64}
65?>
Note: See TracBrowser for help on using the repository browser.