Changeset 10344


Ignore:
Timestamp:
04/12/11 23:46:45 (8 years ago)
Author:
grum
Message:

bug:2263
Compatibility with piwigo 2.2

Location:
extensions/UserStat
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserStat/main.inc.php

    r5799 r10344  
    22/* 
    33Plugin Name: UserStat 
    4 Version: 1.1.1 
     4Version: 1.2.0 
    55Description: Statistiques utilisateurs / Users statistics 
    66Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=321 
     
    3333|         |            |   . it_IT 
    3434|         |            | 
    35 |         |            | 
    36 |         |            | 
     35| 1.2.0   | 201012     | * mantis feature:2263 
     36|         |            |   . compatibility with Piwigo 2.2 
    3737|         |            | 
    3838|         |            | 
  • extensions/UserStat/maintain.inc.php

    r5549 r10344  
    1616include_once('userstat_version.inc.php'); // => Don't forget to update this file !! 
    1717 
    18 if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } 
     18defined('USERSTAT_DIR') || define('USERSTAT_DIR' , basename(dirname(__FILE__))); 
     19defined('USERSTAT_PATH') || define('USERSTAT_PATH' , PHPWG_PLUGINS_PATH . USERSTAT_DIR . '/'); 
     20include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCore.class.inc.php'); 
    1921 
    20 if(!defined('USERSTAT_DIR')) define('USERSTAT_DIR' , basename(dirname(__FILE__))); 
    21 if(!defined('USERSTAT_PATH')) define('USERSTAT_PATH' , PHPWG_PLUGINS_PATH . USERSTAT_DIR . '/'); 
    22  
    23  
    24 global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility 
     22global $gpcInstalled, $lang; //needed for plugin manager compatibility 
    2523 
    2624/* ----------------------------------------------------------------------------- 
    27 UserStat needs the Grum Plugin Classe 
    28 ----------------------------------------------------------------------------- */ 
    29 $gpc_installed=false; 
    30 $gpcNeeded="3.0.0"; 
     25 * UserStat needs the Grum Plugin Classes 
     26 * -------------------------------------------------------------------------- */ 
     27$gpcInstalled=false; 
    3128if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) 
    3229{ 
    3330  @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)) 
     31  // need GPC release greater or equal than USERSTAT_GPC_NEEDED 
     32  if(CommonPlugin::checkGPCRelease(USERSTAT_GPC_NEEDED)) 
    3633  { 
    37     @include_once("userstat_aim.class.inc.php"); 
    38     $gpc_installed=true; 
     34    @include_once("userstat_install.class.inc.php"); 
     35    $gpcInstalled=true; 
    3936  } 
    4037} 
     
    4239function gpcMsgError(&$errors) 
    4340{ 
    44   global $gpcNeeded; 
    45   $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded); 
     41  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), USERSTAT_GPC_NEEDED); 
    4642  if(is_array($errors)) 
    4743  { 
     
    5652 
    5753 
     54 
    5855load_language('plugin.lang', USERSTAT_PATH); 
    5956 
    6057function plugin_install($plugin_id, $plugin_version, &$errors) 
    6158{ 
    62   global $prefixeTable, $gpc_installed, $gpcNeeded; 
    63   if($gpc_installed) 
     59  global $prefixeTable, $gpcInstalled; 
     60  if($gpcInstalled) 
    6461  { 
    65     $obj = new UserStat_AIM($prefixeTable, __FILE__); 
    66     $obj->deleteConfig(); 
    67     $obj->initConfig(); 
    68     $obj->my_config['installed']=USERSTAT_VERSION2; 
    69     $obj->saveConfig(); 
    70     GPCCore::register($obj->getPluginName(), USERSTAT_VERSION, $gpcNeeded); 
     62    $obj=new UserStat_install($prefixeTable, __FILE__); 
     63    $result=$obj->install(); 
    7164  } 
    7265  else 
     
    7871function plugin_activate($plugin_id, $plugin_version, &$errors) 
    7972{ 
    80   global $prefixeTable, $gpc_installed, $gpcNeeded; 
    81   if($gpc_installed) 
     73  global $prefixeTable, $gpcInstalled; 
     74  if($gpcInstalled) 
    8275  { 
    83     $obj = new UserStat_AIM($prefixeTable, __FILE__); 
    84     $obj->initConfig(); 
    85     $obj->loadConfig(); 
    86     $obj->my_config['installed']=USERSTAT_VERSION2; 
    87     $obj->saveConfig(); 
    88   } 
    89   else 
    90   { 
    91     gpcMsgError($errors); 
     76    $obj=new UserStat_install($prefixeTable, __FILE__); 
     77    $result=$obj->activate(); 
    9278  } 
    9379} 
     
    9581function plugin_deactivate($plugin_id) 
    9682{ 
     83  global $prefixeTable, $gpcInstalled; 
     84 
     85  if($gpcInstalled) 
     86  { 
     87    $obj=new UserStat_install($prefixeTable, __FILE__); 
     88    $obj->deactivate(); 
     89  } 
    9790} 
    9891 
    9992function plugin_uninstall($plugin_id) 
    10093{ 
    101   global $prefixeTable, $gpc_installed; 
    102   if($gpc_installed) 
     94  global $prefixeTable, $gpcInstalled; 
     95  if($gpcInstalled) 
    10396  { 
    104     $obj = new UserStat_AIM($prefixeTable, __FILE__); 
    105     $obj->deleteConfig(); 
    106     GPCCore::unregister($obj->getPluginName()); 
     97    $obj=new UserStat_install($prefixeTable, __FILE__); 
     98    $result=$obj->uninstall(); 
    10799  } 
    108100  else 
     
    113105 
    114106 
    115  
    116107?> 
  • extensions/UserStat/userstat.css

    r4270 r10344  
    11 
    2 .StatTableRow:hover { background-color:#303030; } 
     2.StatTableRow:hover { background-color:#303030; cursor:pointer; } 
    33.formtable, .formtable P { text-align:left; display:block; } 
    44.formtable tr { vertical-align:top; } 
     
    1111div.table { margin-bottom:15px; } 
    1212pointerHand { cursor:pointer; } 
    13      
  • extensions/UserStat/userstat_aim.class.inc.php

    r5549 r10344  
    1616if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } 
    1717 
    18 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); 
     18include_once('userstat_root.class.inc.php'); 
    1919include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php'); 
    2020 
    21 class UserStat_AIM extends CommonPlugin 
     21class UserStat_AIM extends UserStat_root 
    2222{ 
    23   protected $css = null; 
    24  
    25   public function __construct($prefixeTable, $filelocation) 
     23  function __construct($prefixeTable, $filelocation) 
    2624  { 
    27     $this->setPluginName("UserStat"); 
    28     $this->setPluginNameFiles("userstat"); 
    2925    parent::__construct($prefixeTable, $filelocation); 
    30     $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css"); 
    31   } 
    32  
    33   public function __destruct() 
    34   { 
    35     unset($this->css); 
    36     parent::__destruct(); 
    3726  } 
    3827 
     
    4231  function initEvents() 
    4332  { 
     33    parent::initEvents(); 
    4434    add_event_handler('get_admin_plugin_menu_links', array(&$this, 'pluginAdminMenu') ); 
    4535  } 
    46  
    47  
    48   /* 
    49     initialization of config properties 
    50   */ 
    51   function initConfig() 
    52   { 
    53     $this->config=array( 
    54       'UserStat_MouseOverColor' => '303030', 
    55       /*'AStat_BarColor_Pages' => '6666ff', 
    56       'AStat_BarColor_Img' => '66ff66', 
    57       'AStat_BarColor_IP' => 'ff6666', 
    58       'AStat_NpIPPerPages' => '25', 
    59       'AStat_NpCatPerPages' => '50', 
    60       'AStat_MaxBarWidth' => '400', 
    61       'AStat_default_period' => 'global', //global, all, year, month, day 
    62       'AStat_ShowThumbCat' => 'true', 
    63       'AStat_DefaultSortCat' => 'page', //page, picture, nbpicture 
    64       'AStat_ShowThumbImg' => 'true', 
    65       'AStat_DefaultSortImg' => 'picture',  //picture, catname 
    66       'AStat_NbImgPerPages' => '100', 
    67       'AStat_BarColor_Cat' => 'fff966', 
    68       'AStat_DefaultSortIP' => 'page',    //page, ip, picture 
    69       'AStat_SeeTimeRequests' => 'false', 
    70       'AStat_BlackListedIP' => '',    // ip blacklisted (separator : ",") 
    71       'AStat_UseBlackList' => 'false'    // if false, blacklist usage is disabled, if "invert" then result are inverted*/ 
    72       ); 
    73  
    74   } 
    75  
    76   /* 
    77     surchage of CommonPlugin->saveConfig function 
    78   */ 
    79   function loadConfig() 
    80   { 
    81     parent::loadConfig(); 
    82     if(!$this->css->fileExists()) 
    83     { 
    84       $this->css->makeCSS($this->generate_CSS()); 
    85     } 
    86   } 
    87  
    88   /* 
    89     surchage of CommonPlugin->saveConfig function 
    90   */ 
    91   function saveConfig() 
    92   { 
    93     if(parent::saveConfig()) 
    94     { 
    95       $this->css->makeCSS($this->generate_CSS()); 
    96       return(true); 
    97     } 
    98     return(false); 
    99   } 
    100  
    101   /* 
    102     generate the css code 
    103   */ 
    104   function generate_CSS() 
    105   { 
    106     $text = " 
    107 .StatTableRow:hover { background-color:#".$this->config['UserStat_MouseOverColor']."; } 
    108 .formtable, .formtable P { text-align:left; display:block; } 
    109 .formtable tr { vertical-align:top; } 
    110 .invisible { visibility:hidden; display:none; } 
    111 .littlefont { font-size:90%; } 
    112 table.table2.littlefont td { text-align:center;padding:0px;padding-left:3px;padding-right:3px; } 
    113 .throw { line-height:auto; font-size:100%; } 
    114 table.table2 tr.throw { height:26px; } 
    115 table.table2 td.toLeft  { text-align:left; } 
    116 div.table { margin-bottom:15px; } 
    117 pointerHand { cursor:pointer; } 
    118     "; 
    119  
    120     return($text); 
    121   } 
    122  
    123   /* --------------------------------------------------------------------------- 
    124   Function needed for plugin activation 
    125   --------------------------------------------------------------------------- */ 
    126  
    12736 
    12837 
  • extensions/UserStat/userstat_aip.class.inc.php

    r5549 r10344  
    1515if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } 
    1616 
    17 include_once('userstat_aim.class.inc.php'); 
     17include_once('userstat_root.class.inc.php'); 
    1818include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 
    1919include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php'); 
    2020 
    21 class UserStat_AIP extends UserStat_AIM 
     21class UserStat_AIP extends UserStat_root 
    2222{ 
    2323  protected $tabsheet; 
  • extensions/UserStat/userstat_version.inc.php

    r5798 r10344  
    1515  if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
    1616 
    17   define('USERSTAT_VERSION',  '1.1.1'); 
    18   define('USERSTAT_VERSION2', '01.01.01'); 
     17  define('USERSTAT_VERSION',  '1.2.0'); 
     18  define('USERSTAT_VERSION2', '01.02.00'); 
     19  define('USERSTAT_GPC_NEEDED', '3.5.0'); 
    1920?> 
Note: See TracChangeset for help on using the changeset viewer.