Changeset 5546 for extensions


Ignore:
Timestamp:
Apr 1, 2010, 9:04:16 PM (14 years ago)
Author:
grum
Message:

Update the plugin for compatibility with Piwigo 2.1

Location:
extensions/AStat
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/AStat/admin/plugin_admin.php

    r3394 r5546  
    2222$main_plugin_object = get_plugin_data($plugin_id);
    2323
    24 $plugin_ai = new AStat_AIP($prefixeTable, $main_plugin_object->get_filelocation());
     24$plugin_ai = new AStat_AIP($prefixeTable, $main_plugin_object->getFileLocation());
    2525$plugin_ai->manage();
    2626
  • extensions/AStat/astat_aim.class.inc.php

    r5423 r5546  
    1616if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
    1717
    18 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php');
    19 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/css.class.inc.php');
    20 
    21 class AStat_AIM extends common_plugin
     18include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
     19include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php');
     20
     21class AStat_AIM extends CommonPlugin
    2222{
    2323  protected $css = null;
     
    2525  function AStat_AIM($prefixeTable, $filelocation)
    2626  {
    27     $this->plugin_name="AStat.2";
    28     $this->plugin_name_files="astat";
     27    $this->setPluginName("AStat.2");
     28    $this->setPluginNameFiles("astat");
    2929    parent::__construct($prefixeTable, $filelocation);
    30     $this->css = new css(dirname($this->filelocation).'/'.$this->plugin_name_files.".css");
     30    $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css");
    3131  }
    3232
     
    3434    initialize events call for the plugin
    3535  */
    36   function init_events()
    37   {
    38     add_event_handler('get_admin_plugin_menu_links', array(&$this, 'plugin_admin_menu') );
     36  function initEvents()
     37  {
     38    add_event_handler('get_admin_plugin_menu_links', array(&$this, 'pluginAdminMenu') );
    3939  }
    4040
     
    4343    initialization of config properties
    4444  */
    45   function init_config()
    46   {
    47     $this->my_config=array(
     45  function initConfig()
     46  {
     47    $this->config=array(
    4848      'AStat_BarColor_Pages' => '6666ff',
    4949      'AStat_BarColor_Img' => '66ff66',
     
    6969
    7070  /*
    71     surchage of common_plugin->save_config function
    72   */
    73   function load_config()
    74   {
    75     parent::load_config();
    76     if(!$this->css->css_file_exists())
    77     {
    78       $this->css->make_CSS($this->generate_CSS());
    79     }
    80   }
    81 
    82   /*
    83     surchage of common_plugin->save_config function
    84   */
    85   function save_config()
    86   {
    87     if(parent::save_config())
    88     {
    89       $this->css->make_CSS($this->generate_CSS());
     71    surchage of CommonPlugin->saveConfig function
     72  */
     73  function loadConfig()
     74  {
     75    parent::loadConfig();
     76    if(!$this->css->fileExists())
     77    {
     78      $this->css->makeCSS($this->generate_CSS());
     79    }
     80  }
     81
     82  /*
     83    surchage of CommonPlugin->saveConfig function
     84  */
     85  function saveConfig()
     86  {
     87    if(parent::saveConfig())
     88    {
     89      $this->css->makeCSS($this->generate_CSS());
    9090      return(true);
    9191    }
     
    114114      padding:0px;
    115115      }
    116        .AStatBar1 { background-color:#".$this->my_config['AStat_BarColor_Pages']."; top:5px;  }
    117        .AStatBar2 { background-color:#".$this->my_config['AStat_BarColor_Img']."; top:-3px; }
    118        .AStatBar3 { background-color:#".$this->my_config['AStat_BarColor_IP']."; top:-3px;}
    119        .AStatBar4 { background-color:#".$this->my_config['AStat_BarColor_Cat']."; top:-3px;}
     116       .AStatBar1 { background-color:#".$this->config['AStat_BarColor_Pages']."; top:5px;  }
     117       .AStatBar2 { background-color:#".$this->config['AStat_BarColor_Img']."; top:-3px; }
     118       .AStatBar3 { background-color:#".$this->config['AStat_BarColor_IP']."; top:-3px;}
     119       .AStatBar4 { background-color:#".$this->config['AStat_BarColor_Cat']."; top:-3px;}
    120120       .AStatBarX { background-color:transparent; top:-3px; height:1px; }
    121        .MiniSquare1 { color:#".$this->my_config['AStat_BarColor_Pages'].";   }
    122        .MiniSquare2 { color:#".$this->my_config['AStat_BarColor_Img'].";  }
    123        .MiniSquare3 { color:#".$this->my_config['AStat_BarColor_IP']."; }
    124        .MiniSquare4 { color:#".$this->my_config['AStat_BarColor_Cat']."; }
    125        .StatTableRow:hover { background-color:#".$this->my_config['AStat_MouseOverColor']."; }
     121       .MiniSquare1 { color:#".$this->config['AStat_BarColor_Pages'].";   }
     122       .MiniSquare2 { color:#".$this->config['AStat_BarColor_Img'].";  }
     123       .MiniSquare3 { color:#".$this->config['AStat_BarColor_IP']."; }
     124       .MiniSquare4 { color:#".$this->config['AStat_BarColor_Cat']."; }
     125       .StatTableRow:hover { background-color:#".$this->config['AStat_MouseOverColor']."; }
    126126       .formtable, .formtable P { text-align:left; display:block; }
    127127       .formtable tr { vertical-align:top; }
  • extensions/AStat/astat_aip.class.inc.php

    r5423 r5546  
    1717include_once('astat_aim.class.inc.php');
    1818include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    19 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/ajax.class.inc.php');
     19include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php');
    2020
    2121class AStat_AIP extends AStat_AIM
     
    2626  protected $list_sortimg = array('picture', 'catname');
    2727  protected $list_sortip = array('page', 'picture', 'ip');
    28   protected $ajax;
    2928
    3029  protected $catfilter;    //filter on categories
     
    3635    parent::__construct($prefixeTable, $filelocation);
    3736
    38     $this->load_config();
    39     $this->init_events();
     37    $this->loadConfig();
     38    $this->initEvents();
    4039
    4140    $this->tabsheet = new tabsheet();
    4241    $this->tabsheet->add('stats_by_period',
    4342                          l10n('AStat_by_period'),
    44                           $this->page_link.'&fAStat_tabsheet=stats_by_period');
     43                          $this->getAdminLink().'&fAStat_tabsheet=stats_by_period');
    4544    $this->tabsheet->add('stats_by_ip',
    4645                          l10n('AStat_by_ip'),
    47                           $this->page_link.'&fAStat_tabsheet=stats_by_ip');
     46                          $this->getAdminLink().'&fAStat_tabsheet=stats_by_ip');
    4847    $this->tabsheet->add('stats_by_category',
    4948                          l10n('AStat_by_category'),
    50                           $this->page_link.'&fAStat_tabsheet=stats_by_category');
     49                          $this->getAdminLink().'&fAStat_tabsheet=stats_by_category');
    5150    $this->tabsheet->add('stats_by_image',
    5251                          l10n('AStat_by_image'),
    53                           $this->page_link.'&fAStat_tabsheet=stats_by_image');
     52                          $this->getAdminLink().'&fAStat_tabsheet=stats_by_image');
    5453    $this->tabsheet->add('config',
    5554                          l10n('AStat_config'),
    56                           $this->page_link.'&fAStat_tabsheet=config');
     55                          $this->getAdminLink().'&fAStat_tabsheet=config');
    5756    $this->tabsheet->add('tools',
    5857                          l10n('AStat_tools'),
    59                           $this->page_link.'&fAStat_tabsheet=tools');
    60 
    61     $this->ajax = new Ajax();
     58                          $this->getAdminLink().'&fAStat_tabsheet=tools');
     59
    6260  }
    6361
     
    6563    initialize events call for the plugin
    6664  */
    67   function init_events()
    68   {
    69     add_event_handler('loc_end_page_header', array(&$this->css, 'apply_CSS'));
     65  function initEvents()
     66  {
     67    add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS'));
    7068  }
    7169
     
    9290    if($_REQUEST['fAStat_catfilter']!="")
    9391    {
    94       $this->page_link.="&fAStat_catfilter=".$_REQUEST['fAStat_catfilter'];
     92      $this->setAdminLink($this->getAdminLink()."&fAStat_catfilter=".$_REQUEST['fAStat_catfilter']);
    9593    }
    9694
     
    102100          $_REQUEST['fAStat_month'],
    103101          $_REQUEST['fAStat_day'],
    104           $this->my_config['AStat_MaxBarWidth'],
    105           $this->my_config['AStat_SeeTimeRequests']
     102          $this->config['AStat_MaxBarWidth'],
     103          $this->config['AStat_SeeTimeRequests']
    106104      );
    107105    }
     
    117115          $_REQUEST['fAStat_month'],
    118116          $_REQUEST['fAStat_day'],
    119           $this->my_config['AStat_MaxBarWidth'],
    120           $this->my_config['AStat_NpIPPerPages'],
     117          $this->config['AStat_MaxBarWidth'],
     118          $this->config['AStat_NpIPPerPages'],
    121119          $_REQUEST['fAStat_page_number'],
    122120          $_REQUEST['fAStat_SortIP'],
    123           $this->my_config['AStat_SeeTimeRequests']
     121          $this->config['AStat_SeeTimeRequests']
    124122      );
    125123    }
     
    130128          $_REQUEST['fAStat_month'],
    131129          $_REQUEST['fAStat_day'],
    132           $this->my_config['AStat_MaxBarWidth'],
    133           $this->my_config['AStat_NpCatPerPages'],
     130          $this->config['AStat_MaxBarWidth'],
     131          $this->config['AStat_NpCatPerPages'],
    134132          $_REQUEST['fAStat_page_number'],
    135           $this->my_config['AStat_ShowThumbCat'],
     133          $this->config['AStat_ShowThumbCat'],
    136134          $_REQUEST['fAStat_SortCat'],
    137           $this->my_config['AStat_SeeTimeRequests']
     135          $this->config['AStat_SeeTimeRequests']
    138136      );
    139137    }
     
    144142          $_REQUEST['fAStat_month'],
    145143          $_REQUEST['fAStat_day'],
    146           $this->my_config['AStat_MaxBarWidth'],
    147           $this->my_config['AStat_NbImgPerPages'],
     144          $this->config['AStat_MaxBarWidth'],
     145          $this->config['AStat_NbImgPerPages'],
    148146          $_REQUEST['fAStat_page_number'],
    149           $this->my_config['AStat_ShowThumbImg'],
     147          $this->config['AStat_ShowThumbImg'],
    150148          $_REQUEST['fAStat_SortImg'],
    151149          $_REQUEST['fAStat_IP'],
    152           $this->my_config['AStat_SeeTimeRequests']
     150          $this->config['AStat_SeeTimeRequests']
    153151      );
    154152    }
     
    197195          break;
    198196      }
    199       //$template->
    200       $this->ajax->return_result($result);
     197      GPCAjax::returnResult($result);
    201198    }
    202199  }
     
    223220    if(!array_key_exists('fAStat_SortCat', $_REQUEST))
    224221    {
    225       $_REQUEST['fAStat_SortCat']=$this->my_config['AStat_DefaultSortCat'];
     222      $_REQUEST['fAStat_SortCat']=$this->config['AStat_DefaultSortCat'];
    226223    }
    227224    if(!array_key_exists('fAStat_SortImg', $_REQUEST))
    228225    {
    229       $_REQUEST['fAStat_SortImg']=$this->my_config['AStat_DefaultSortImg'];
     226      $_REQUEST['fAStat_SortImg']=$this->config['AStat_DefaultSortImg'];
    230227    }
    231228    if(!array_key_exists('fAStat_SortIP', $_REQUEST))
    232229    {
    233       $_REQUEST['fAStat_SortIP']=$this->my_config['AStat_DefaultSortIP'];
     230      $_REQUEST['fAStat_SortIP']=$this->config['AStat_DefaultSortIP'];
    234231    }
    235232    if(!array_key_exists('fAStat_page_number', $_REQUEST))
     
    252249    if(($_REQUEST['fAStat_tabsheet']=='stats_by_period')&&($_REQUEST['fAStat_defper']=='Y'))
    253250    {
    254       if($this->my_config['AStat_default_period']!='global')
     251      if($this->config['AStat_default_period']!='global')
    255252      {
    256253        $default_request['all'] = 'N';
    257254      }
    258255
    259       if(($this->my_config['AStat_default_period']=='year')||
    260         ($this->my_config['AStat_default_period']=='month')||
    261         ($this->my_config['AStat_default_period']=='day'))
     256      if(($this->config['AStat_default_period']=='year')||
     257        ($this->config['AStat_default_period']=='month')||
     258        ($this->config['AStat_default_period']=='day'))
    262259      {
    263260        $default_request['year'] = date('Y');
    264261      }
    265262
    266       if(($this->my_config['AStat_default_period']=='month')||
    267         ($this->my_config['AStat_default_period']=='day'))
     263      if(($this->config['AStat_default_period']=='month')||
     264        ($this->config['AStat_default_period']=='day'))
    268265      {
    269266        $default_request['month'] = date('n');
    270267      }
    271268
    272       if($this->my_config['AStat_default_period']=='day')
     269      if($this->config['AStat_default_period']=='day')
    273270      {
    274271        $default_request['day'] = date('j');
     
    420417    }
    421418
    422     if(($this->my_config['AStat_UseBlackList']!="false")&&($this->my_config['AStat_BlackListedIP']!=""))
     419    if(($this->config['AStat_UseBlackList']!="false")&&($this->config['AStat_BlackListedIP']!=""))
    423420    {
    424421      ($sql_where=="")?$sql_where=" where ":$sql_where.=" AND ";
    425       ($this->my_config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
    426       $sql_where .= $this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     422      ($this->config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
     423      $sql_where .= $this->make_IP_where_clause($this->config['AStat_BlackListedIP']);
    427424    }
    428425
     
    499496    }
    500497
    501     if(($this->my_config['AStat_UseBlackList']!="false")&&($this->my_config['AStat_BlackListedIP']!=""))
     498    if(($this->config['AStat_UseBlackList']!="false")&&($this->config['AStat_BlackListedIP']!=""))
    502499    {
    503500      ($sql_where=="")?$sql_where=" where ":$sql_where.=" AND ";
    504       ($this->my_config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
    505       $sql_where .= $this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     501      ($this->config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
     502      $sql_where .= $this->make_IP_where_clause($this->config['AStat_BlackListedIP']);
    506503      $sql.=" , 'N' AS blacklist";
    507504    }
    508505    else
    509506    {
    510       if($this->my_config['AStat_BlackListedIP']=='')
     507      if($this->config['AStat_BlackListedIP']=='')
    511508      {
    512509        $sql.=" , 'N' AS blacklist";
     
    515512      {
    516513        $sql.=" , (CASE ";
    517         $tmp=explode(',', $this->my_config['AStat_BlackListedIP']);
     514        $tmp=explode(',', $this->config['AStat_BlackListedIP']);
    518515        foreach($tmp as $key=>$val)
    519516        {
     
    626623    $sql_where .= "  ic2.catid = ".HISTORY_TABLE.".category_id ";
    627624
    628     if(($this->my_config['AStat_UseBlackList']!="false")&&($this->my_config['AStat_BlackListedIP']!=""))
    629     {
    630       ($this->my_config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
    631       $sql_where .= $this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     625    if(($this->config['AStat_UseBlackList']!="false")&&($this->config['AStat_BlackListedIP']!=""))
     626    {
     627      ($this->config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
     628      $sql_where .= $this->make_IP_where_clause($this->config['AStat_BlackListedIP']);
    632629    }
    633630
     
    722719    }
    723720
    724     if(($this->my_config['AStat_UseBlackList']!="false")&&($this->my_config['AStat_BlackListedIP']!=""))
     721    if(($this->config['AStat_UseBlackList']!="false")&&($this->config['AStat_BlackListedIP']!=""))
    725722    {
    726723      ($sql_where=="")?$sql_where=" where ":$sql_where.=" AND ";
    727       ($this->my_config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
    728       $sql_where .= $this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     724      ($this->config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
     725      $sql_where .= $this->make_IP_where_clause($this->config['AStat_BlackListedIP']);
    729726    }
    730727
     
    783780
    784781    $dir_links = "";
    785     $a_links=array("global" => $this->page_link."&fAStat_defper=N&fAStat_all=Y",
    786         "all" => $this->page_link."&fAStat_defper=N&fAStat_all=N",
    787         "year" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year",
    788         "month" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month",
    789         "day" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
    790 
    791     $ip_links=array("all" => $this->page_link."&fAStat_tabsheet=stats_by_ip",
    792         "year" => $this->page_link."&fAStat_tabsheet=stats_by_ip&fAStat_year=",
    793         "month" => $this->page_link."&fAStat_tabsheet=stats_by_ip&fAStat_year=$year&fAStat_month=",
    794         "day" => $this->page_link."&fAStat_tabsheet=stats_by_ip&fAStat_year=$year&fAStat_month=$month&fAStat_day=");
    795 
    796     $cat_links=array("all" => $this->page_link."&fAStat_tabsheet=stats_by_category",
    797         "year" => $this->page_link."&fAStat_tabsheet=stats_by_category&fAStat_year=",
    798         "month" => $this->page_link."&fAStat_tabsheet=stats_by_category&fAStat_year=$year&fAStat_month=",
    799         "day" => $this->page_link."&fAStat_tabsheet=stats_by_category&fAStat_year=$year&fAStat_month=$month&fAStat_day=");
    800 
    801     $img_links=array("all" => $this->page_link."&fAStat_tabsheet=stats_by_image",
    802         "year" => $this->page_link."&fAStat_tabsheet=stats_by_image&fAStat_year=",
    803         "month" => $this->page_link."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=",
    804         "day" => $this->page_link."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=$month&fAStat_day=");
     782    $a_links=array("global" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=Y",
     783        "all" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N",
     784        "year" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year",
     785        "month" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month",
     786        "day" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
     787
     788    $ip_links=array("all" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_ip",
     789        "year" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_ip&fAStat_year=",
     790        "month" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_ip&fAStat_year=$year&fAStat_month=",
     791        "day" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_ip&fAStat_year=$year&fAStat_month=$month&fAStat_day=");
     792
     793    $cat_links=array("all" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_category",
     794        "year" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_category&fAStat_year=",
     795        "month" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_category&fAStat_year=$year&fAStat_month=",
     796        "day" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_category&fAStat_year=$year&fAStat_month=$month&fAStat_day=");
     797
     798    $img_links=array("all" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image",
     799        "year" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image&fAStat_year=",
     800        "month" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=",
     801        "day" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=$month&fAStat_day=");
    805802
    806803
     
    869866      { // si mois sélectionné, jours affichés
    870867        $value = $stats[$i]["GId"]." (".l10n("AStat_day_of_week_".date("w",mktime(0, 0, 0, $month, $stats[$i]["GId"], $year))).")";
    871         $link=$this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month&fAStat_day=".$stats[$i]["GId"];
     868        $link=$this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month&fAStat_day=".$stats[$i]["GId"];
    872869        $value_ip=$ip_links["day"].$stats[$i]["GId"];
    873870        $value_cat=$cat_links["day"].$stats[$i]["GId"];
     
    877874      { // si année sélectionnée, mois affichés
    878875        $value = l10n("AStat_month_of_year_".$stats[$i]["GId"]);
    879         $link=$this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=".$stats[$i]["GId"];
     876        $link=$this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=".$stats[$i]["GId"];
    880877        $value_ip=$ip_links["month"].$stats[$i]["GId"];
    881878        $value_cat=$cat_links["month"].$stats[$i]["GId"];
     
    885882      { // si total sélectionné, années affichées
    886883        $value = $stats[$i]["GId"];
    887         $link=$this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=".$stats[$i]["GId"];
     884        $link=$this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=".$stats[$i]["GId"];
    888885        $value_ip=$ip_links["year"].$stats[$i]["GId"];
    889886        $value_cat=$cat_links["year"].$stats[$i]["GId"];
     
    893890      {
    894891        $value=l10n("AStat_period_label_all");
    895         $link=$this->page_link."&fAStat_defper=N&fAStat_all=N";
     892        $link=$this->getAdminLink()."&fAStat_defper=N&fAStat_all=N";
    896893        $value_ip=$ip_links["all"];
    897894        $value_cat=$cat_links["all"];
     
    966963    $dir_links = "";
    967964    $page_link = "";
    968     $a_links=array("global" => $this->page_link."&fAStat_defper=N&fAStat_all=Y",
    969         "all" => $this->page_link."&fAStat_defper=N&fAStat_all=N",
    970         "year" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year",
    971         "month" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month",
    972         "day" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
    973 
    974     $ip_links=array("all" => $this->page_link."&fAStat_tabsheet=stats_by_ip",
    975         "year" => $this->page_link."&fAStat_tabsheet=stats_by_ip&fAStat_year=$year",
    976         "month" => $this->page_link."&fAStat_tabsheet=stats_by_ip&fAStat_year=$year&fAStat_month=$month",
    977         "day" => $this->page_link."&fAStat_tabsheet=stats_by_ip&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
    978 
    979     $img_links=array("all" => $this->page_link."&fAStat_tabsheet=stats_by_image",
    980         "year" => $this->page_link."&fAStat_tabsheet=stats_by_image&fAStat_year=$year",
    981         "month" => $this->page_link."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=$month",
    982         "day" => $this->page_link."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
     965    $a_links=array("global" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=Y",
     966        "all" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N",
     967        "year" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year",
     968        "month" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month",
     969        "day" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
     970
     971    $ip_links=array("all" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_ip",
     972        "year" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_ip&fAStat_year=$year",
     973        "month" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_ip&fAStat_year=$year&fAStat_month=$month",
     974        "day" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_ip&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
     975
     976    $img_links=array("all" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image",
     977        "year" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image&fAStat_year=$year",
     978        "month" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=$month",
     979        "day" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
    983980
    984981
     
    11301127    $dir_links = "";
    11311128    $page_link = "";
    1132     $a_links=array("global" => $this->page_link."&fAStat_defper=N&fAStat_all=Y",
    1133         "all" => $this->page_link."&fAStat_defper=N&fAStat_all=N",
    1134         "year" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year",
    1135         "month" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month",
    1136         "day" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
    1137 
    1138     $cat_links=array("all" => $this->page_link."&fAStat_tabsheet=stats_by_category",
    1139         "year" => $this->page_link."&fAStat_tabsheet=stats_by_category&fAStat_year=$year",
    1140         "month" => $this->page_link."&fAStat_tabsheet=stats_by_category&fAStat_year=$year&fAStat_month=$month",
    1141         "day" => $this->page_link."&fAStat_tabsheet=stats_by_category&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
     1129    $a_links=array("global" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=Y",
     1130        "all" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N",
     1131        "year" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year",
     1132        "month" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month",
     1133        "day" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
     1134
     1135    $cat_links=array("all" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_category",
     1136        "year" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_category&fAStat_year=$year",
     1137        "month" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_category&fAStat_year=$year&fAStat_month=$month",
     1138        "day" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_category&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
    11421139
    11431140    /* make navigation links */
     
    12761273    $dir_links = "";
    12771274    $page_link = "";
    1278     $a_links=array("global" => $this->page_link."&fAStat_defper=N&fAStat_all=Y",
    1279         "all" => $this->page_link."&fAStat_defper=N&fAStat_all=N",
    1280         "year" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year",
    1281         "month" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month",
    1282         "day" => $this->page_link."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
    1283 
    1284     $img_links=array("all" => $this->page_link."&fAStat_tabsheet=stats_by_image",
    1285         "year" => $this->page_link."&fAStat_tabsheet=stats_by_image&fAStat_year=$year",
    1286         "month" => $this->page_link."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=$month",
    1287         "day" => $this->page_link."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
     1275    $a_links=array("global" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=Y",
     1276        "all" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N",
     1277        "year" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year",
     1278        "month" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month",
     1279        "day" => $this->getAdminLink()."&fAStat_defper=N&fAStat_all=N&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
     1280
     1281    $img_links=array("all" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image",
     1282        "year" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image&fAStat_year=$year",
     1283        "month" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=$month",
     1284        "day" => $this->getAdminLink()."&fAStat_tabsheet=stats_by_image&fAStat_year=$year&fAStat_month=$month&fAStat_day=$day");
    12881285
    12891286    /* navigation links */
     
    14341431  private function add_ip_to_filter($ip)
    14351432  {
    1436     if(strpos($this->my_config['AStat_BlackListedIP'].",", $ip.",")===false)
    1437     {
    1438       ($this->my_config['AStat_BlackListedIP']!='')?$this->my_config['AStat_BlackListedIP'].=",":"";
    1439       $this->my_config['AStat_BlackListedIP'].=$ip;
    1440       $this->save_config();
     1433    if(strpos($this->config['AStat_BlackListedIP'].",", $ip.",")===false)
     1434    {
     1435      ($this->config['AStat_BlackListedIP']!='')?$this->config['AStat_BlackListedIP'].=",":"";
     1436      $this->config['AStat_BlackListedIP'].=$ip;
     1437      $this->saveConfig();
    14411438    }
    14421439  }
     
    14561453      if(!is_adviser())
    14571454      {
    1458         reset($this->my_config);
    1459         while (list($key, $val) = each($this->my_config))
     1455        reset($this->config);
     1456        while (list($key, $val) = each($this->config))
    14601457        {
    14611458          if(isset($_POST['f_'.$key]))
    14621459          {
    1463             $this->my_config[$key] = $_POST['f_'.$key];
     1460            $this->config[$key] = $_POST['f_'.$key];
    14641461          }
    14651462        }
    1466         if($this->save_config())
     1463        if($this->saveConfig())
    14671464        {
    14681465          array_push($page['infos'], l10n('AStat_config_saved'));
     
    14861483
    14871484    //standards inputs zones
    1488     reset($this->my_config);
    1489     while (list($key, $val) = each($this->my_config))
     1485    reset($this->config);
     1486    while (list($key, $val) = each($this->config))
    14901487    {
    14911488      $template_datas["f_".$key]=$val;
     
    14931490
    14941491    //
    1495     $template_datas['ajaxurl']=$this->page_link;
     1492    $template_datas['ajaxurl']=$this->getAdminLink();
    14961493
    14971494    // define selected item for lists zones
    1498     $template_datas['AStat_periods_selected']=$this->my_config['AStat_default_period'];
    1499     $template_datas['AStat_defaultsortcat_selected']=$this->my_config['AStat_DefaultSortCat'];
    1500     $template_datas['AStat_defaultsortip_selected']=$this->my_config['AStat_DefaultSortIP'];
    1501     $template_datas['AStat_defaultsortimg_selected']=$this->my_config['AStat_DefaultSortImg'];
    1502 
    1503     $template_datas['AStat_showthumbcat_selected']=$this->my_config['AStat_ShowThumbCat'];
    1504     $template_datas['AStat_showthumbimg_selected']=$this->my_config['AStat_ShowThumbImg'];
    1505     $template_datas['AStat_UseBlackList_selected']=$this->my_config['AStat_UseBlackList'];
     1495    $template_datas['AStat_periods_selected']=$this->config['AStat_default_period'];
     1496    $template_datas['AStat_defaultsortcat_selected']=$this->config['AStat_DefaultSortCat'];
     1497    $template_datas['AStat_defaultsortip_selected']=$this->config['AStat_DefaultSortIP'];
     1498    $template_datas['AStat_defaultsortimg_selected']=$this->config['AStat_DefaultSortImg'];
     1499
     1500    $template_datas['AStat_showthumbcat_selected']=$this->config['AStat_ShowThumbCat'];
     1501    $template_datas['AStat_showthumbimg_selected']=$this->config['AStat_ShowThumbImg'];
     1502    $template_datas['AStat_UseBlackList_selected']=$this->config['AStat_UseBlackList'];
    15061503
    15071504    // making lists zones
     
    16161613        elseif($_REQUEST['fAStat_purge_history_type']=='byipid0')
    16171614        {
    1618           $fparam=$this->my_config['AStat_BlackListedIP'];
     1615          $fparam=$this->config['AStat_BlackListedIP'];
    16191616        }
    16201617        else
     
    21462143  private function purge_history_count_ipid0()
    21472144  {
    2148     if($this->my_config['AStat_BlackListedIP']!="")
    2149     {
    2150       $list=explode(',', $this->my_config['AStat_BlackListedIP']);
     2145    if($this->config['AStat_BlackListedIP']!="")
     2146    {
     2147      $list=explode(',', $this->config['AStat_BlackListedIP']);
    21512148    }
    21522149    else
     
    21572154    $returned=array(0,count($list));
    21582155
    2159     if($this->my_config['AStat_BlackListedIP']!='')
     2156    if($this->config['AStat_BlackListedIP']!='')
    21602157    {
    21612158      $sql="SELECT COUNT(id)
    21622159            FROM ".HISTORY_TABLE."
    2163             WHERE ".$this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     2160            WHERE ".$this->make_IP_where_clause($this->config['AStat_BlackListedIP']);
    21642161      $result=pwg_query($sql);
    21652162      if($result)
  • extensions/AStat/language/fr_FR/plugin.lang.php

    r3707 r5546  
    216216$lang['AStat_enableddisabled_invert'] = "Filtre inversé";
    217217
     218//--- > 2.2.0
     219$lang['To install this plugin, you need to install Grum Plugin Classes %s before'] = 'Pour installer ce plugin, vous devez au préalable, installer le plugin Grum Plugin Classes %s';
     220
     221
    218222?>
  • extensions/AStat/main.inc.php

    r5423 r5546  
    8181define('ASTAT_PATH' , PHPWG_PLUGINS_PATH . ASTAT_DIR . '/');
    8282
    83 define('ASTAT_VERSION' , '2.2.0'); // => ne pas oublier la version dans l'entête !!
     83include_once('astat_version.inc.php'); // => Don't forget to update this file !!
    8484
    8585global $prefixeTable;
     
    9191
    9292  $obj = new AStat_AIM($prefixeTable, __FILE__);
    93   $obj->init_events();
     93  $obj->initEvents();
    9494  set_plugin_data($plugin['id'], $obj);
    9595}
  • extensions/AStat/maintain.inc.php

    r5425 r5546  
    1717if(!defined('ASTAT_PATH')) define('ASTAT_PATH' , PHPWG_PLUGINS_PATH . ASTAT_DIR . '/');
    1818
     19include_once('astat_version.inc.php');
     20
    1921//ini_set('error_reporting', E_ALL);
    2022//ini_set('display_errors', true);
    2123
    22 global $gpc_installed, $lang; //needed for plugin manager compatibility
     24global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility
    2325
    2426/* -----------------------------------------------------------------------------
     
    2628----------------------------------------------------------------------------- */
    2729$gpc_installed=false;
    28 if(file_exists(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php'))
     30$gpcNeeded="3.0.0";
     31if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
    2932{
    30   @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/main.inc.php');
    31   // need GPC release greater or equal than 2.0.5
    32   if(checkGPCRelease(2,0,5))
     33  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
     34  // need GPC release greater or equal than 3.0.0
     35  if(CommonPlugin::checkGPCRelease(3,0,0))
    3336  {
    3437    @include_once("astat_aim.class.inc.php");
     
    3942function gpcMsgError(&$errors)
    4043{
    41   array_push($errors, sprintf(l10n('AStat_gpc2_not_installed'), "2.0.5"));
     44  global $gpcNeeded;
     45  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded);
     46  if(is_array($errors))
     47  {
     48    array_push($errors, $msg);
     49  }
     50  else
     51  {
     52    $errors=Array($msg);
     53  }
    4254}
    4355// -----------------------------------------------------------------------------
     
    4860function plugin_install($plugin_id, $plugin_version, &$errors)
    4961{
    50   global $prefixeTable, $gpc_installed;
     62  global $prefixeTable, $gpc_installed, $gpcNeeded;
    5163  if($gpc_installed)
    5264  {
    5365    $obj = new AStat_AIM($prefixeTable, __FILE__);
    54     $obj->delete_config();
    55     $obj->init_config();
    56     $obj->save_config();
     66    $obj->deleteConfig();
     67    $obj->initConfig();
     68    $obj->my_config['installed']=ASTAT_VERSION2;
     69    $obj->saveConfig();
     70    GPCCore::register($obj->getPluginName(), ASTAT_VERSION, $gpcNeeded);
    5771  }
    5872  else
     
    6882  {
    6983    $obj = new AStat_AIM($prefixeTable, __FILE__);
    70     $obj->init_config();
    71     $obj->load_config();
    72     $obj->save_config();
     84    $obj->initConfig();
     85    $obj->loadConfig();
     86    $obj->my_config['installed']=ASTAT_VERSION2;
     87    $obj->saveConfig();
    7388    $obj->alter_history_section_enum('deleted_cat');
    7489  }
     
    89104  {
    90105    $obj = new AStat_AIM($prefixeTable, __FILE__);
    91     $obj->delete_config();
     106    $obj->deleteConfig();
     107    GPCCore::unregister($obj->getPluginName());
    92108  }
    93109  else
Note: See TracChangeset for help on using the changeset viewer.