Ignore:
Timestamp:
Oct 28, 2010, 12:19:44 AM (14 years ago)
Author:
plg
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Statistics/maintain.inc.php

    r3438 r7445  
    11<?php
    22
    3  
     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        );
    425
    5   function plugin_install()
     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}
    635
    7   {
     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}
    856
    9       global $prefixeTable;
    10 
    11     $q = '
    12 
    13       INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
    14 
    15       VALUES ("statistics","off,on, ,off,off","Parameters of Statistics plugin");
    16 
    17     ';
    18 
    19      
    20 
    21     pwg_query($q);
    22 
    23  
    24 
    25   }
    26 
    27  
    28 
    29   function plugin_uninstall()
    30 
    31   {
    32 
    33     global $prefixeTable;
    34 
    35       $q = '
    36 
    37         DELETE FROM '.CONFIG_TABLE.'
    38 
    39         WHERE param="statistics" LIMIT 1;
    40 
    41       ';
    42 
    43    
    44 
    45       pwg_query($q);
    46 
    47    
    48 
    49     } 
    50 
     57function plugin_uninstall()
     58{
     59  $query = '
     60DELETE FROM '.CONFIG_TABLE.'
     61  WHERE param=\'statistics\'
     62;';
     63  pwg_query($query);
     64}
    5165?>
Note: See TracChangeset for help on using the changeset viewer.