. * ************************************************/ /** Changelog : 1.2.0 (05.05.2013) : No change 1.1.0 (04.05.2013) : Added HSTS security settings Modified default values at initialization (disabled by default) 1.0.0 (02.05.2013) : Initial version */ if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); define('FORCE_HTTPS_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); function plugin_install() { $q = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("fhp_use_https", "false", "https usage status tag used by the piwigo-force-https plugin");'; pwg_query( $q ); $q = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("fhp_use_sts", "false", "HTTP Strict Transport Security (HSTS) usage status tag used by the piwigo-force-https plugin");'; pwg_query( $q ); $q = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("fhp_sts_maxage", "500", "max age duration (in seconds) used by the piwigo-force-https plugin");'; pwg_query( $q ); } function plugin_uninstall() { if (is_dir(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'piwigo-force-https')) { deltree(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'piwigo-force-https'); } $q = 'DELETE FROM '.CONFIG_TABLE.' WHERE param LIKE "fhp_%" LIMIT 6;'; pwg_query( $q ); } function plugin_activate() { global $conf; if (!isset($conf['fhp_use_https'])) { plugin_install(); } } function deltree($path) { if (is_dir($path)) { $fh = opendir($path); while ($file = readdir($fh)) { if ($file != '.' and $file != '..') { $pathfile = $path . '/' . $file; if (is_dir($pathfile)) { deltree($pathfile); } else { @unlink($pathfile); } } } closedir($fh); return @rmdir($path); } } ?>