Changeset 10264 for extensions
- Timestamp:
- Apr 10, 2011, 10:07:47 PM (13 years ago)
- Location:
- extensions/AStat
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AStat/astat_aim.class.inc.php
r5546 r10264 16 16 if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } 17 17 18 include_once( PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');18 include_once('astat_root.class.inc.php'); 19 19 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php'); 20 20 21 class AStat_AIM extends CommonPlugin21 class AStat_AIM extends AStat_root 22 22 { 23 23 protected $css = null; 24 24 25 function AStat_AIM($prefixeTable, $filelocation)25 function __construct($prefixeTable, $filelocation) 26 26 { 27 $this->setPluginName("AStat.2");28 $this->setPluginNameFiles("astat");29 27 parent::__construct($prefixeTable, $filelocation); 30 $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css");31 28 } 32 29 … … 39 36 } 40 37 41 42 /*43 initialization of config properties44 */45 function initConfig()46 {47 $this->config=array(48 'AStat_BarColor_Pages' => '6666ff',49 'AStat_BarColor_Img' => '66ff66',50 'AStat_BarColor_IP' => 'ff6666',51 'AStat_MouseOverColor' => '303030',52 'AStat_NpIPPerPages' => '25',53 'AStat_NpCatPerPages' => '50',54 'AStat_MaxBarWidth' => '400',55 'AStat_default_period' => 'global', //global, all, year, month, day56 'AStat_ShowThumbCat' => 'true',57 'AStat_DefaultSortCat' => 'page', //page, picture, nbpicture58 'AStat_ShowThumbImg' => 'true',59 'AStat_DefaultSortImg' => 'picture', //picture, catname60 'AStat_NbImgPerPages' => '100',61 'AStat_BarColor_Cat' => 'fff966',62 'AStat_DefaultSortIP' => 'page', //page, ip, picture63 'AStat_SeeTimeRequests' => 'false',64 'AStat_BlackListedIP' => '', // ip blacklisted (separator : ",")65 'AStat_UseBlackList' => 'false' // if false, blacklist usage is disabled, if "invert" then result are inverted66 );67 68 }69 70 /*71 surchage of CommonPlugin->saveConfig function72 */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 function84 */85 function saveConfig()86 {87 if(parent::saveConfig())88 {89 $this->css->makeCSS($this->generate_CSS());90 return(true);91 }92 return(false);93 }94 95 /*96 generate the css code97 */98 function generate_CSS()99 {100 $text = ".AStatBar1, .AStatBar2, .AStatBar3, .AStatBar4, .AStatBarX {101 border:0px;102 height:8px;103 display: block;104 margin:0px;105 padding:0px;106 left:0;107 position:relative;108 }109 .MiniSquare1, .MiniSquare2, .MiniSquare3, .MiniSquare4 {110 border:0px;111 height:8px;112 width:8px;113 margin:0px;114 padding:0px;115 }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;}120 .AStatBarX { background-color:transparent; top:-3px; height:1px; }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']."; }126 .formtable, .formtable P { text-align:left; display:block; }127 .formtable tr { vertical-align:top; }128 .window_thumb {129 position:absolute;130 border: none;131 background: none;132 left:0;133 top:0;134 margin:0px;135 padding:0px;136 z-index:100;137 overflow:hidden;138 visibility:hidden; }139 .img_thumb {140 border: solid 3px #ffffff;141 background: #000000;142 margin:0px;143 padding:0px; }144 .time_request {145 font-size:83%;146 text-align:right; }147 .invisible { visibility:hidden; display:none; }148 .littlefont { font-size:90%; }149 table.littlefont th { padding:3px; }150 table.littlefont td { padding:0px;padding-left:3px;padding-right:3px; }151 #iplist { visibility:hidden; position:absolute; width:200px; z-index:1000; }152 .iipsellistitem { float:right; }153 #iipsellist { width:100%; font-family:monospace; }154 ";155 156 return($text);157 }158 159 /* ---------------------------------------------------------------------------160 Function needed for plugin activation161 --------------------------------------------------------------------------- */162 163 /*164 get 'section' enumeration from HISTORY_TABLE165 */166 function get_section_enum($add)167 {168 $returned=array('', false);169 $sql = 'SHOW COLUMNS FROM '.HISTORY_TABLE.' LIKE "section"';170 $result=pwg_query($sql);171 if($result)172 {173 $row = pwg_db_fetch_assoc($result);174 $list=substr($row['Type'], 5, strlen($row['Type'])-6);175 $returned[0]=explode(',', $list);176 if((strpos($list, "'$add'")===false)&&($add!=''))177 { array_push($returned[0], "'$add'"); }178 else179 { $returned[1]=true; }180 return($returned);181 }182 }183 184 function alter_history_section_enum($section)185 {186 $sections=$this->get_section_enum('deleted_cat');187 if(!$sections[1])188 {189 $enums=implode(',', $sections[0]);190 $sql="ALTER TABLE ".HISTORY_TABLE."191 CHANGE `section` `section`192 ENUM (".$enums.") ;";193 $result=pwg_query($sql);194 if(!$result)195 {196 return(false);197 }198 }199 return(true);200 }201 202 38 } // AStat_Plugin class 203 39 -
extensions/AStat/astat_aip.class.inc.php
r6699 r10264 15 15 if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } 16 16 17 include_once('astat_ aim.class.inc.php');17 include_once('astat_root.class.inc.php'); 18 18 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 19 19 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php'); 20 20 21 class AStat_AIP extends AStat_ AIM21 class AStat_AIP extends AStat_root 22 22 { 23 23 protected $tabsheet; … … 65 65 function initEvents() 66 66 { 67 add_event_handler('loc_end_page_header', array(&$this ->css, 'applyCSS'));67 add_event_handler('loc_end_page_header', array(&$this, 'applyCSS')); 68 68 } 69 69 … … 73 73 Public classe functions 74 74 --------------------------------------------------------------------------- */ 75 76 public function applyCSS() 77 { 78 GPCCore::addHeaderCSS(basename(dirname($this->getPluginNameFiles())), PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'css/'.$this->getPluginNameFiles().".css"); 79 } 80 81 75 82 76 83 /* -
extensions/AStat/astat_version.inc.php
r6699 r10264 15 15 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 16 16 17 define('ASTAT_VERSION', '2.2.2'); 18 define('ASTAT_VERSION2', '02.02.02'); 17 define('ASTAT_VERSION', '2.3.0'); 18 define('ASTAT_VERSION2', '02.03.00'); 19 define('ASTAT_GPC_NEEDED', '3.5.0'); 19 20 ?> -
extensions/AStat/main.inc.php
r6699 r10264 2 2 /* 3 3 Plugin Name: AStat.2 4 Version: 2. 2.24 Version: 2.3.0 5 5 Description: Statistiques avancées / Advanced statistics 6 6 Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=172 … … 63 63 | | | Stat by categories doesn't work when IP filter is activated 64 64 | | | 65 | 2.3.0 | 2011/04/10 | * mantis: bug 2146 66 | | | . compatibility with piwigo 2.2 65 67 | | | 66 68 | | | -
extensions/AStat/maintain.inc.php
r5546 r10264 17 17 if(!defined('ASTAT_PATH')) define('ASTAT_PATH' , PHPWG_PLUGINS_PATH . ASTAT_DIR . '/'); 18 18 19 include_once('astat_version.inc.php'); 19 include_once('astat_version.inc.php'); // => Don't forget to update this file !! 20 20 21 //ini_set('error_reporting', E_ALL);22 //ini_set('display_errors', true);23 21 24 global $gpc _installed, $gpcNeeded, $lang; //needed for plugin manager compatibility22 global $gpcInstalled, $lang; //needed for plugin manager compatibility 25 23 26 24 /* ----------------------------------------------------------------------------- 27 AStat -2needs the Grum Plugin Classe25 AStat needs the Grum Plugin Classe 28 26 ----------------------------------------------------------------------------- */ 29 $gpc_installed=false; 30 $gpcNeeded="3.0.0"; 27 $gpcInstalled=false; 31 28 if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) 32 29 { 33 30 @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); 34 // need GPC release greater or equal than 3. 0.035 if(CommonPlugin::checkGPCRelease( 3,0,0))31 // need GPC release greater or equal than 3.5.0 32 if(CommonPlugin::checkGPCRelease(ASTAT_GPC_NEEDED)) 36 33 { 37 @include_once("astat_aim.class.inc.php");38 $gpc _installed=true;34 include_once("astat_install.class.inc.php"); 35 $gpcInstalled=true; 39 36 } 40 37 } … … 42 39 function gpcMsgError(&$errors) 43 40 { 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'), ASTAT_GPC_NEEDED); 46 42 if(is_array($errors)) 47 43 { … … 56 52 57 53 54 58 55 load_language('plugin.lang', ASTAT_PATH); 56 57 58 59 59 60 60 function plugin_install($plugin_id, $plugin_version, &$errors) 61 61 { 62 global $prefixeTable, $gpc _installed, $gpcNeeded;63 if($gpc _installed)62 global $prefixeTable, $gpcInstalled; 63 if($gpcInstalled) 64 64 { 65 $obj = new AStat_AIM($prefixeTable, __FILE__); 66 $obj->deleteConfig(); 67 $obj->initConfig(); 68 $obj->my_config['installed']=ASTAT_VERSION2; 69 $obj->saveConfig(); 70 GPCCore::register($obj->getPluginName(), ASTAT_VERSION, $gpcNeeded); 65 $obj=new AStat_install($prefixeTable, __FILE__); 66 $result=$obj->install(); 71 67 } 72 68 else … … 78 74 function plugin_activate($plugin_id, $plugin_version, &$errors) 79 75 { 80 global $prefixeTable, $gpc _installed;81 if($gpc _installed)76 global $prefixeTable, $gpcInstalled; 77 if($gpcInstalled) 82 78 { 83 $obj = new AStat_AIM($prefixeTable, __FILE__); 84 $obj->initConfig(); 85 $obj->loadConfig(); 86 $obj->my_config['installed']=ASTAT_VERSION2; 87 $obj->saveConfig(); 88 $obj->alter_history_section_enum('deleted_cat'); 89 } 90 else 91 { 92 gpcMsgError($errors); 79 $obj=new AStat_install($prefixeTable, __FILE__); 80 $result=$obj->activate(); 93 81 } 94 82 } … … 96 84 function plugin_deactivate($plugin_id) 97 85 { 86 global $prefixeTable, $gpcInstalled; 87 88 if($gpcInstalled) 89 { 90 $obj=new AStat_install($prefixeTable, __FILE__); 91 $obj->deactivate(); 92 } 98 93 } 99 94 100 95 function plugin_uninstall($plugin_id) 101 96 { 102 global $prefixeTable, $gpc _installed;103 if($gpc _installed)97 global $prefixeTable, $gpcInstalled; 98 if($gpcInstalled) 104 99 { 105 $obj = new AStat_AIM($prefixeTable, __FILE__); 106 $obj->deleteConfig(); 107 GPCCore::unregister($obj->getPluginName()); 100 $obj=new AStat_install($prefixeTable, __FILE__); 101 $result=$obj->uninstall(); 108 102 } 109 103 else … … 115 109 116 110 111 112 117 113 ?>
Note: See TracChangeset
for help on using the changeset viewer.