/** * Triggered on get_admin_plugin_menu_links * * Plugin's administration menu */ function PP_admin_menu($menu) { // +-----------------------------------------------------------------------+ // | Getting plugin name | // +-----------------------------------------------------------------------+ $plugin = PPInfos(PP_PATH); $name = $plugin['name']; array_push($menu, array('NAME' => $name, 'URL' => get_root_url() . 'admin.php?page=plugin-' . basename(PP_PATH))); return $menu; }
function plugin_install($id, $version, &$errors) { global $conf; // Set current plugin version in config table // ------------------------------------------ $plugin = PPInfos(PP_PATH); $version = $plugin['version']; /* ****************************************************************** */ /* **************** BEGIN - Data preparation in vars **************** */ /* ****************************************************************** */ // Default global parameters for PasswordPolicy conf // ------------------------------------------------- $defaultPP = array('PPVersion' => $version, 'PASSWORDENF' => 'false', 'PASSWORD_SCORE' => '100', 'ADMINPASSWENF' => 'false', 'PWDRESET' => 'false', 'LOGFAILBLOCK' => 'false', 'NBLOGFAIL' => '0', 'USRLOCKEDTXT' => l10n('PP_User_Account_Locked_Txt')); /* **************************************************************** */ /* **************** END - Data preparation in vars **************** */ /* **************************************************************** */ /* ***************************************************************************** */ /* **************** BEGIN - Database actions and initialization **************** */ /* ***************************************************************************** */ // Create PasswordPolicy conf if not already exists // ------------------------------------------------ $query = ' SELECT param FROM ' . CONFIG_TABLE . ' WHERE param = "PasswordPolicy" ;'; $count = pwg_db_num_rows(pwg_query($query)); if ($count == 0) { $q = ' INSERT INTO ' . CONFIG_TABLE . ' (param, value, comment) VALUES ("PasswordPolicy","' . pwg_db_real_escape_string(serialize($defaultPP)) . '","Password Policy parameters") ;'; pwg_query($q); } // Piwigo's native tables modifications for password reset function - Add pwdreset column if not already exists // ------------------------------------------------------------------------------------------------------------ $query = ' SHOW COLUMNS FROM ' . USERS_TABLE . ' LIKE "PP_pwdreset" ;'; $result = pwg_query($query); if (!pwg_db_fetch_row($result)) { $q = ' ALTER TABLE ' . USERS_TABLE . ' ADD PP_pwdreset enum("true","false") ;'; pwg_query($q); } // Piwigo's native tables modifications for failed login attempts count // -------------------------------------------------------------------- $query = ' SHOW COLUMNS FROM ' . USERS_TABLE . ' LIKE "PP_loginfailcount" ;'; $result = pwg_query($query); if (!pwg_db_fetch_row($result)) { $q = ' ALTER TABLE ' . USERS_TABLE . ' ADD PP_loginfailcount INT NOT NULL DEFAULT "0" ;'; pwg_query($q); } // Piwigo's native tables modifications for locked accounts // -------------------------------------------------------- $query = ' SHOW COLUMNS FROM ' . USERS_TABLE . ' LIKE "PP_lock" ;'; $result = pwg_query($query); if (!pwg_db_fetch_row($result)) { $q = ' ALTER TABLE ' . USERS_TABLE . ' ADD PP_lock enum("true","false") ;'; pwg_query($q); } /* *************************************************************************** */ /* **************** END - Database actions and initialization **************** */ /* *************************************************************************** */ }
//ini_set('error_reporting', E_ALL); //ini_set('display_errors', true); include_once PHPWG_ROOT_PATH . 'admin/include/tabsheet.class.php'; include_once PHPWG_ROOT_PATH . '/include/constants.php'; load_language('plugin.lang', PP_PATH); // +-----------------------------------------------------------------------+ // | Variables initialization | // +-----------------------------------------------------------------------+ $page['global'] = array(); $error = array(); $my_base_url = get_admin_plugin_menu_link(__FILE__); $PP_Password_Test_Score = 0; // +-----------------------------------------------------------------------+ // | Getting plugin version | // +-----------------------------------------------------------------------+ $plugin = PPInfos(PP_PATH); $version = $plugin['version']; // ------------------------------------------ // Template initialization for forms and data // ------------------------------------------ $themeconf = $template->get_template_vars('themeconf'); $PP_theme = $themeconf['id']; // +----------------------------------------------------------+ // | FCK Editor for email text fields | // +----------------------------------------------------------+ $toolbar = 'Basic'; $width = '750px'; $height = '300px'; $areas = array(); array_push($areas, 'PP_CustomLockMsg'); if (function_exists('set_fckeditor_instance')) {