Changeset 5162


Ignore:
Timestamp:
03/17/10 17:44:07 (10 years ago)
Author:
Eric
Message:

[nbc_HistoryIPExcluder]

  • Removing "NBC" references
  • Display the good plugin's name
  • Database upgrade process for next version
Location:
extensions/nbc_HistoryIPExcluder/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/nbc_HistoryIPExcluder/trunk/admin/HIPE_admin.php

    r5121 r5162  
    2121  $v = str_replace( ",,", ",", $v ); 
    2222 
    23   $conf['nbc_HistoryIPExcluder'] = stripslashes($v); 
     23  $conf['HistoryIPExcluder'] = stripslashes($v); 
    2424 
    2525  $query = ' 
    2626    UPDATE '.CONFIG_TABLE.' 
    27     SET value="'.$conf['nbc_HistoryIPExcluder'].'" 
    28     WHERE param="nbc_HistoryIPExcluder" 
     27    SET value="'.$conf['HistoryIPExcluder'].'" 
     28    WHERE param="HistoryIPExcluder" 
    2929    LIMIT 1'; 
    3030  pwg_query($query); 
     
    3535elseif ( isset($_POST['CleanHist']) ) 
    3636{ 
    37   $conf_HIPE = explode("," , $conf['nbc_HistoryIPExcluder']); 
     37  $conf_HIPE = explode("," , $conf['HistoryIPExcluder']); 
    3838 
    3939  foreach ( $conf_HIPE as $Exclusion ) 
     
    197197} 
    198198 
    199 $conf_HIPE = explode("," , $conf['nbc_HistoryIPExcluder']); 
     199$conf_HIPE = explode("," , $conf['HistoryIPExcluder']); 
    200200 
    201201$template->assign( 
    202202  array( 
    203     'HIPE_F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=plugin&section=nbc_HistoryIPExcluder%2Fadmin%2FHIPE_admin.php', 
     203    'HIPE_F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=plugin&section=HistoryIPExcluder%2Fadmin%2FHIPE_admin.php', 
    204204    'IPs_EXCLUDED' => implode("\n", $conf_HIPE), 
    205205  ) 
  • extensions/nbc_HistoryIPExcluder/trunk/admin/HIPE_admin.tpl

    r5121 r5162  
    1414     
    1515    <div style="text-align:center;"> 
    16       <textarea name="HIPE_IPs_Excluded" rows="10" cols="60" {$TAG_INPUT_ENABLED}>{$IPs_EXCLUDED}</textarea> 
     16      <textarea name="HIPE_IPs_Excluded" rows="10" cols="30" {$TAG_INPUT_ENABLED}>{$IPs_EXCLUDED}</textarea> 
     17 
    1718    </div> 
    1819     
  • extensions/nbc_HistoryIPExcluder/trunk/main.inc.php

    r5121 r5162  
    11<?php 
    22/* 
    3 Plugin Name: NBC History IP Excluder 
    4 Version: 2.0.0 
    5 Description: Permet l'exclusion d'une IP ou d'une plage d'IP de l historique - Excludes one IP or a range of IP from the history. plugin directement derive de Stats Ip Excluder de Eric  
     3Plugin Name: History IP Excluder 
     4Version: 2.0.1 
     5Description: Permet l'exclusion d'une IP ou d'une plage d'IP de l historique - Excludes one IP or a range of IP from the history. 
    66Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=147 
    77Author: Nicco, Eric 
     
    2222function HIPE_admin_menu($menu) 
    2323{ 
     24// +-----------------------------------------------------------------------+ 
     25// |                      Getting plugin name                              | 
     26// +-----------------------------------------------------------------------+ 
     27  $plugin =  PluginNfo(HIPE_PATH); 
     28  $name = $plugin['name']; 
     29   
    2430  array_push($menu, 
    2531    array( 
    26       'NAME' => 'History IP Excluder', 
     32      'NAME' => $name, 
    2733      'URL' => get_admin_plugin_menu_link(HIPE_PATH.'admin/HIPE_admin.php') 
    2834    ) 
     
    3743  global $conf; 
    3844 
    39   $conf_HIPE = explode("," , $conf['nbc_HistoryIPExcluder']); 
     45  $conf_HIPE = explode("," , $conf['HistoryIPExcluder']); 
    4046 
    4147  if (!$do_log) 
     
    6369  } 
    6470} 
     71 
     72 
     73/* Email sending debugger function */ 
     74function DebugLog($value1,$value2) 
     75{ 
     76   $fo=fopen (HIPE_PATH.'admin/log.txt','a') ; 
     77   fwrite($fo,"======================\n") ; 
     78   fwrite($fo, "\n" . $value1 . "\r\n") ; 
     79   fwrite($fo, "\n" . $value2 . "\r\n") ; 
     80   fclose($fo) ; 
     81} 
     82 
     83/* Function called to get the plugin name */ 
     84function PluginNfo($dir) 
     85{ 
     86  $path = $dir; 
     87 
     88  $plg_data = implode( '', file($path.'main.inc.php') ); 
     89  if ( preg_match("|Plugin Name: (.*)|", $plg_data, $val) ) 
     90  { 
     91    $plugin['name'] = trim( $val[1] ); 
     92  } 
     93  if (preg_match("|Version: (.*)|", $plg_data, $val)) 
     94  { 
     95    $plugin['version'] = trim($val[1]); 
     96  } 
     97  if ( preg_match("|Plugin URI: (.*)|", $plg_data, $val) ) 
     98  { 
     99    $plugin['uri'] = trim($val[1]); 
     100  } 
     101  if ($desc = load_language('description.txt', $path.'/', array('return' => true))) 
     102  { 
     103    $plugin['description'] = trim($desc); 
     104  } 
     105  elseif ( preg_match("|Description: (.*)|", $plg_data, $val) ) 
     106  { 
     107    $plugin['description'] = trim($val[1]); 
     108  } 
     109  if ( preg_match("|Author: (.*)|", $plg_data, $val) ) 
     110  { 
     111    $plugin['author'] = trim($val[1]); 
     112  } 
     113  if ( preg_match("|Author URI: (.*)|", $plg_data, $val) ) 
     114  { 
     115    $plugin['author uri'] = trim($val[1]); 
     116  } 
     117  if (!empty($plugin['uri']) and strpos($plugin['uri'] , 'extension_view.php?eid=')) 
     118  { 
     119    list( , $extension) = explode('extension_view.php?eid=', $plugin['uri']); 
     120    if (is_numeric($extension)) $plugin['extension'] = $extension; 
     121  } 
     122// IMPORTANT SECURITY ! 
     123  $plugin = array_map('htmlspecialchars', $plugin); 
     124 
     125  return $plugin ; 
     126} 
     127 
    65128?> 
  • extensions/nbc_HistoryIPExcluder/trunk/maintain.inc.php

    r5121 r5162  
    99  $q = ' 
    1010INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 
    11 VALUES ("nbc_HistoryIPExcluder","","Parametres nbc History IP Excluder"); 
     11VALUES ("HistoryIPExcluder","","History IP Excluder parameters"); 
    1212'; 
    1313       
    1414  pwg_query($q); 
     15} 
     16 
     17 
     18function plugin_activate() 
     19{ 
     20  global $conf; 
     21   
     22/* Check for upgrade from 2.0.0 to 2.0.1 */ 
     23/* *************************************** */ 
     24        $query = ' 
     25SELECT param 
     26  FROM '.CONFIG_TABLE.' 
     27WHERE param = "nbc_HistoryIPExcluder" 
     28;'; 
     29  $count = mysql_num_rows(pwg_query($query)); 
     30   
     31        if ($count == 1) 
     32        { 
     33  /* upgrade from branch 2.0.0 to 2.0.1 */ 
     34  /* ************************************ */ 
     35                upgrade_200(); 
     36        } 
    1537} 
    1638 
     
    3153} 
    3254 
     55 
     56function upgrade_200() 
     57{ 
     58  global $conf; 
     59   
     60  $q = ' 
     61UPDATE '.CONFIG_TABLE.' 
     62SET param = "HistoryIPExcluder" 
     63WHERE param = "nbc_HistoryIPExcluder" 
     64;'; 
     65  pwg_query($q); 
     66 
     67  $q = ' 
     68UPDATE '.CONFIG_TABLE.' 
     69SET comment = "History IP Excluder parameters" 
     70WHERE comment = "Parametres nbc History IP Excluder" 
     71;'; 
     72  pwg_query($q); 
     73} 
    3374?> 
Note: See TracChangeset for help on using the changeset viewer.