function global_version_update() { global $conf; // Get current plugin version $plugin = HIPE_infos(HIPE_PATH); $version = $plugin['version']; // Update plugin version $query = ' SELECT value FROM ' . CONFIG_TABLE . ' WHERE param = "HistoryIPConfig" ;'; $result = pwg_query($query); $conf_HIPE = pwg_db_fetch_assoc($result); $Newconf_HIPE = unserialize($conf_HIPE['value']); $Newconf_HIPE['Version'] = $version; conf_update_param('HistoryIPConfig', pwg_db_real_escape_string(serialize($Newconf_HIPE))); }
function plugin_install($id, $version, &$errors) { global $conf; // Set plugin parameters $default = array(); $query = ' SELECT param FROM ' . CONFIG_TABLE . ' WHERE param = "HistoryIPExcluder" ;'; $count = pwg_db_num_rows(pwg_query($query)); if ($count == 0) { $q = ' INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("HistoryIPExcluder","","History IP Excluder parameters"); '; pwg_query($q); } // Set plugin config $plugin = HIPE_infos(HIPE_PATH); $version = $plugin['version']; $default = array('Blacklist' => "0", 'Version' => $version); $query = ' SELECT param FROM ' . CONFIG_TABLE . ' WHERE param = "HistoryIPConfig" ;'; $count = pwg_db_num_rows(pwg_query($query)); if ($count == 0) { $q = ' INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("HistoryIPConfig","' . pwg_db_real_escape_string(serialize($default)) . '","History IP Excluder options"); '; pwg_query($q); } }
<?php if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } load_language('plugin.lang', HIPE_PATH); // +-----------------------------------------------------------------------+ // | Getting plugin version | // +-----------------------------------------------------------------------+ $plugin = HIPE_infos(HIPE_PATH); $version = $plugin['version']; $name = $plugin['name']; $ip_geolocalisation1 = '<a href="http://www.geoiptool.com/fr/?IP='; $ip_geolocalisation2 = '" title="Geo IP localisation" target="_blank"><img src="' . HIPE_PATH . '/geoip.ico" class="button" alt="' . l10n('IP_geolocalisation') . '"></a>'; $ip_ripe1 = '<a href="http://www.ripe.net/whois?form_type=simple&full_query_string=&searchtext='; $ip_ripe2 = '+&do_search=Search" title="Ripe Whois" target="_blank">'; $ip_ripe3 = '</a>'; if (isset($_POST['submit'])) { $v = $_POST['HIPE_IPs_Excluded']; $v = str_replace("\r\n", ",", $v); $v = str_replace(",,", ",", $v); $conf['HistoryIPExcluder'] = stripslashes($v); $query = ' UPDATE ' . CONFIG_TABLE . ' SET value="' . $conf['HistoryIPExcluder'] . '" WHERE param="HistoryIPExcluder" LIMIT 1'; pwg_query($query); if (!isset($_POST['HIPE_chkb'])) { $_POST['HIPE_chkb'] = '0'; }
function HIPE_admin_menu($menu) { // +-----------------------------------------------------------------------+ // | Getting plugin name | // +-----------------------------------------------------------------------+ $plugin = HIPE_infos(HIPE_PATH); $name = $plugin['name']; array_push($menu, array('NAME' => $name, 'URL' => get_root_url() . 'admin.php?page=plugin-' . basename(HIPE_PATH))); return $menu; }