private function forget_password() { $error_array = array(); $error_array['authentication'] = array('type' => 'forget_password', 'status' => 'false'); $db = wpl_db::get_DBO(); $user_login = wpl_db::sanitize($this->username); if (trim($user_login) == '') { return $error_array; } elseif (strpos($user_login, '@')) { $user_data = wpl_users::get_user_by('email', $user_login); if (trim($user_data) == '') { return $error_array; } } else { $login = trim($user_login); $user_data = wpl_users::get_user_by('login', $login); } do_action('lostpassword_post'); if (!$user_data) { return $this->failed_array; } $user_login = $user_data->user_login; $user_email = $user_data->user_email; do_action('retreive_password', $user_login); do_action('retrieve_password', $user_login); $allow = apply_filters('allow_password_reset', true, $user_data->ID); if (is_wp_error($allow)) { return $error_array; } $key = wpl_global::generate_password(20, false); do_action('retrieve_password_key', $user_login, $key); $hashed = wpl_global::wpl_hasher(8, $key); wpl_db::update('users', array('user_activation_key' => $hashed), 'user_login', $user_login); $message = __('Someone requested that the password be reset for the following account:', WPL_TEXTDOMAIN) . "\r\n"; $message .= network_home_url('/') . "\r\n"; $message .= sprintf(__('Username: %s', WPL_TEXTDOMAIN), $user_login) . "\r\n"; $message .= __('If this was a mistake, just ignore this email and nothing will happen.', WPL_TEXTDOMAIN) . "\r\n"; $message .= __('To reset your password, visit the following address:', WPL_TEXTDOMAIN) . "\r\n"; $message .= '<' . network_site_url("wp-login.php?action=rp&key={$key}&login="******">\r\n"; if (is_multisite()) { $blogname = $GLOBALS['current_site']->site_name; } else { $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); } $title = sprintf(__('[%s] Password Reset', WPL_TEXTDOMAIN), $blogname); $title = apply_filters('retrieve_password_title', $title); $message = apply_filters('retrieve_password_message', $message, $key); if ($message && !wp_mail($user_email, $title, $message)) { return $error_array; } $this->built['authentication'] = array('type' => 'forget_password', 'status' => 'true'); return $this->built; }
/** * Uninstalling WPL * @author Howard <*****@*****.**> * @return boolean */ public function uninstall_wpl() { $tables = wpl_db::select('SHOW TABLES'); $database = wpl_db::get_DBO(); foreach ($tables as $table_name => $table) { if (strpos($table_name, $database->prefix . 'wpl_') !== false) { /** drop table **/ wpl_db::q("DROP TABLE `{$table_name}`"); } } /** delete options **/ wpl_db::q("DELETE FROM `#__options` WHERE `option_name` LIKE 'wpl_%' AND `option_name` NOT LIKE 'wpl_theme%'", 'delete'); /** remove WPL upload directory **/ if (function_exists('is_multisite') and is_multisite() and wpl_global::check_addon('multisite')) { $original_blog_id = wpl_global::get_current_blog_id(); // Get all blogs $blogs = wpl_db::select("SELECT `blog_id` FROM `#__blogs`", 'loadColumn'); foreach ($blogs as $blog) { if (!isset($blog->blog_id)) { continue; } switch_to_blog($blog->blog_id); $upload_path = wpl_global::get_upload_base_path($blog->blog_id); if (wpl_folder::exists($upload_path)) { wpl_folder::delete($upload_path); } } switch_to_blog($original_blog_id); } else { $upload_path = wpl_global::get_upload_base_path(); if (wpl_file::exists($upload_path)) { wpl_file::delete($upload_path); } } return true; }