Index: /extensions/nbc_HistoryIPExcluder/trunk/admin/HIPE_admin.php =================================================================== --- /extensions/nbc_HistoryIPExcluder/trunk/admin/HIPE_admin.php (revision 5099) +++ /extensions/nbc_HistoryIPExcluder/trunk/admin/HIPE_admin.php (revision 5099) @@ -0,0 +1,220 @@ +'; + +$ip_ripe1 = ''; +$ip_ripe3 = ''; + + + +if ( isset($_POST['submit']) and !is_adviser() ) +{ + $v = $_POST['HIPE_IPs_Excluded']; + $v = str_replace( "\r\n", ",", $v ); + $v = str_replace( ",,", ",", $v ); + + $conf['nbc_HistoryIPExcluder'] = serialize($v); + //$conf['nbc_HistoryIPExcluder'] = stripslashes($v); + + $query = ' + UPDATE '.CONFIG_TABLE.' + SET value="'.addslashes($conf['nbc_HistoryIPExcluder']).'" + WHERE param="nbc_HistoryIPExcluder" + LIMIT 1'; + pwg_query($query); + + // information message + array_push($page['infos'], $lang['HIPE_save_config']); +} +elseif ( isset($_POST['CleanHist']) ) +{ + $conf_HIPE = unserialize($conf['nbc_HistoryIPExcluder']); + //$conf_nbc_HistoryIPExcluder = explode("," , $conf['nbc_HistoryIPExcluder']); + + foreach ( $conf_HIPE as $Exclusion ) + { + $query = ' + delete FROM '.HISTORY_TABLE.' where + IP like \''.$Exclusion.'\';'; + pwg_query($query); + } + + + $query = ' + truncate '.HISTORY_SUMMARY_TABLE.';'; + pwg_query($query); + + $query = ' + UPDATE '.HISTORY_TABLE.' + SET summarized = \'false\';'; + pwg_query($query); + + // information message + array_push($page['infos'], $lang['HIPE_hist_cleaned']); +} +elseif ( isset($_POST['HIPE_IPByMember']) ) +{ + $template->assign( + array( + 'HIPE_DESCRIPTION2' => $lang['HIPE_IPByMember_description'], + ) + ); + + $query = ' + select distinct h.ip, u.username + from '.HISTORY_TABLE.' as h + inner join '.USERS_TABLE.' as u on u.id = h.user_id + where h.user_id <> 2 + order by h.ip + ;'; + + $subresult = pwg_query($query); + + while ($subrow = mysql_fetch_array($subresult)) + { + $template->assign( + 'resultat', + array( + 'HIPE_RESULTAT1' => $ip_geolocalisation1.$subrow['ip'].$ip_geolocalisation2.' '.$ip_ripe1.$subrow['ip'].$ip_ripe2.$subrow['ip'].$ip_ripe3, + 'HIPE_RESULTAT2' => $subrow['username'], + ) + ); + } + + // information message + array_push($page['infos'], l10n('HIPE_resquet_ok')); +} +elseif ( isset($_POST['HIPE_OnlyGuest']) ) +{ + $template->assign( + array( + 'HIPE_DESCRIPTION2' => l10n('HIPE_OnlyGuest_description'), + ) + ); + + $query1 = ' + select distinct h.ip + from '.HISTORY_TABLE.' as h + where h.user_id <> 2 + ;'; + + $IPsMember = array_from_query($query1, 'ip'); + + $query = ' + select h.ip, count(h.ip) as nbreIP + from '.HISTORY_TABLE.' as h + where h.ip not in (\''.implode('\',\'', $IPsMember).'\') + group by h.ip + order by nbreIP desc + ;'; + + $subresult = pwg_query($query); + + while ($subrow = mysql_fetch_array($subresult)) + { + $template->assign( + 'resultat', + array( + 'HIPE_RESULTAT1' => $ip_geolocalisation1.$subrow['ip'].$ip_geolocalisation2.' '.$ip_ripe1.$subrow['ip'].$ip_ripe2.$subrow['ip'].$ip_ripe3, + 'HIPE_RESULTAT2' => $subrow['nbreIP'], + ) + ); + } + + // information message + array_push($page['infos'], l10n('HIPE_resquet_ok')); +} +elseif ( isset($_POST['HIPE_IPForMember']) and isset($_POST['HIPE_input'])) +{ + $template->assign( + array( + 'HIPE_DESCRIPTION2' => l10n('HIPE_IPForMember_description'), + ) + ); + + $query = ' + select h.ip, u.username + from '.HISTORY_TABLE.' as h + inner join '.USERS_TABLE.' as u on u.id = h.user_id + where u.username like \''.$_POST['HIPE_input'].'\' + group by h.ip + order by h.ip + ;'; + + $subresult = pwg_query($query); + + while ($subrow = mysql_fetch_array($subresult)) + { + $template->assign( + 'resultat', + array( + 'HIPE_RESULTAT1' => $subrow['username'], + 'HIPE_RESULTAT2' => $ip_geolocalisation1.$subrow['ip'].$ip_geolocalisation2.' '.$ip_ripe1.$subrow['ip'].$ip_ripe2.$subrow['ip'].$ip_ripe3, + ) + ); + } + + // information message + array_push($page['infos'], l10n('HIPE_resquet_ok')); +} +elseif ( isset($_POST['HIPE_MemberForIp']) and isset($_POST['HIPE_input'])) +{ + $template->assign( + array( + 'HIPE_DESCRIPTION2' => l10n('HIPE_MemberForIp_description'), + ) + ); + + $query = ' + select h.ip, u.username + from '.HISTORY_TABLE.' as h + inner join '.USERS_TABLE.' as u on u.id = h.user_id + where h.ip like \''.$_POST['HIPE_input'].'\' + group by u.username + order by u.username + ;'; + + $subresult = pwg_query($query); + + while ($subrow = mysql_fetch_array($subresult)) + { + $template->assign( + 'resultat', + array( + 'HIPE_RESULTAT1' => $ip_geolocalisation1.$subrow['ip'].$ip_geolocalisation2.' '.$ip_ripe1.$subrow['ip'].$ip_ripe2.$subrow['ip'].$ip_ripe3, + 'HIPE_RESULTAT2' => $subrow['username'], + ) + ); + } + + // information message + array_push($page['infos'], l10n('HIPE_resquet_ok')); +} + + +$conf_HIPE = unserialize($conf['nbc_HistoryIPExcluder']); +//$conf_nbc_HistoryIPExcluder = explode("," , $conf['nbc_HistoryIPExcluder']); + +$template->assign( + array( + 'HIPE_F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=nbc_HistoryIPExcluder%2Fadmin%2FHIPE_admin.php', + 'IPs_EXCLUDED' => $conf_HIPE, + ) +); + + $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/HIPE_admin.tpl'); + $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); + +//$template->set_filenames( array('plugin_admin_content' => HIPE_PATH.'admin/nbc_HistoryIPExcluder_admin.tpl') ); + +//$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content'); + +?> Index: /extensions/nbc_HistoryIPExcluder/trunk/admin/HIPE_admin.tpl =================================================================== --- /extensions/nbc_HistoryIPExcluder/trunk/admin/HIPE_admin.tpl (revision 5099) +++ /extensions/nbc_HistoryIPExcluder/trunk/admin/HIPE_admin.tpl (revision 5099) @@ -0,0 +1,55 @@ +
{'HIPE_description'|@translate}
+ + Index: /extensions/nbc_HistoryIPExcluder/trunk/admin/index.php =================================================================== --- /extensions/nbc_HistoryIPExcluder/trunk/admin/index.php (revision 5099) +++ /extensions/nbc_HistoryIPExcluder/trunk/admin/index.php (revision 5099) @@ -0,0 +1,33 @@ + Index: /extensions/nbc_HistoryIPExcluder/trunk/index.php =================================================================== --- /extensions/nbc_HistoryIPExcluder/trunk/index.php (revision 5099) +++ /extensions/nbc_HistoryIPExcluder/trunk/index.php (revision 5099) @@ -0,0 +1,33 @@ + Index: /extensions/nbc_HistoryIPExcluder/trunk/language/en_UK/index.php =================================================================== --- /extensions/nbc_HistoryIPExcluder/trunk/language/en_UK/index.php (revision 5099) +++ /extensions/nbc_HistoryIPExcluder/trunk/language/en_UK/index.php (revision 5099) @@ -0,0 +1,33 @@ + Index: /extensions/nbc_HistoryIPExcluder/trunk/language/en_UK/plugin.lang.php =================================================================== --- /extensions/nbc_HistoryIPExcluder/trunk/language/en_UK/plugin.lang.php (revision 5099) +++ /extensions/nbc_HistoryIPExcluder/trunk/language/en_UK/plugin.lang.php (revision 5099) @@ -0,0 +1,28 @@ +When activated, the IP entered in the list below will not been logged any more in the PWG history table.