Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /* Plugin Name: LDAP/Active Directory Login for Intranet Sites Plugin URI: http..
Decoded Output download
<?php
/*
Plugin Name: LDAP/Active Directory Login for Intranet Sites
Plugin URI: http://miniorange.com
Description: LDAP/Active Directory Login Plugin provides login to WordPress using credentials stored in your LDAP Server.
Author: miniOrange
Version: 26.0.1
Author URI: http://miniorange.com
*/
require_once "mo_ldap_pages.php";
require "mo_ldap_support.php";
require "class-mo-ldap-customer-setup.php";
require "class-mo-ldap-utility.php";
require "class-mo-ldap-config.php";
require "class-mo-ldap-role-mapping.php";
require "mo_ldap_licensing_plans.php";
require_once "mo-utility-framework.php";
require_once "mo-ldap-feedback-form.php";
require_once "mo-ldap-intranet-version-update.php";
require_once __DIR__."/includes/lib/export.php";
require_once __DIR__."/Directories/DirectoryFactory.php";
define("Tab_ldap_Class_Names", serialize(array("ldap_Login" => "mo_options_ldap_acc_details", "ldap_config" => "mo_options_ldap_config_details", "Role_Mapping" => "mo_option_ldap_role_mapping", "Attribute_Mapping" => "mo_options_ldap_enum_attribute_mapping", "Dirsync_Ldap_To_Wp_Sync" => "mo_option_ldap_dirsync_ldap_to_wp_sync", "Dirsync_Wp_To_Ldap_sync" => "mo_option_ldap_dirsync_wp_to_ldap_sync", "plugin_version" => "mo_plugin_info")));
error_reporting(E_ERROR);
class Mo_Ldap_Local_Login
{
function __construct()
{
$oc = 7;
add_action("admin_menu", array($this, "mo_ldap_local_login_widget_menu"));
add_action("admin_init", array($this, "login_widget_save_options"));
add_action("init", array($this, "test_attribute_configuration"));
add_action("admin_enqueue_scripts", array($this, "mo_ldap_local_settings_style"));
add_action("admin_enqueue_scripts", array($this, "mo_ldap_local_settings_script"));
$Ab = get_option("mo_ldap_local_enable_update_ldap");
if (!($Ab == 1)) {
goto t_;
}
add_action("profile_update", array($this, "update_profile"), 10, 2);
t_:
$uy = !empty(get_option("mo_ldap_plugin_version")) ? get_option("mo_ldap_plugin_version") : "none";
if (!(strcasecmp($uy, "26.0.1") != 0)) {
goto QY;
}
Mo_Ldap_Local_Util::bp_hjey_hpfeh_dy_mysvejr($uy);
update_option("mo_ldap_plugin_version", "26.0.1");
QY:
remove_action("admin_notices", array($this, "success_message"));
remove_action("admin_notices", array($this, "error_message"));
register_deactivation_hook(__DIR__."/input.php", array($this, "mo_ldap_local_deactivate"));
add_action("show_user_profile", array($this, "show_user_profile"));
add_action("edit_user_profile", array($this, "show_user_profile"));
$WY = get_option("mo_ldap_local_authorized_users_only");
if (!($WY == 1)) {
goto NC;
}
add_action("wp", array($this, "mo_ldap_local_login_redirect"));
NC:
if (!in_array("next-active-directory-integration/index.php", (array) get_option("active_plugins", array()), true)) {
goto Y_;
}
$oc = 20;
Y_:
$YC = get_option("mo_ldap_local_enable_login");
if (!($YC == 1)) {
goto dR;
}
remove_filter("authenticate", "wp_authenticate_username_password", 20, 3);
add_filter("authenticate", array($this, "ldap_login"), $oc, 3);
add_filter("login_redirect", array($this, "mo_ldap_local_custom_redirect"), 10, 3);
dR:
register_activation_hook(__DIR__."/input.php", array($this, "mo_ldap_activate"));
add_action("mo_ldap_local_license_sync", array($this, "mo_ldap_local_license_sync"));
add_action("flushcache", array($this, "update_status"), 10, 3);
add_filter("mo_check_config", array($this, "bp_srz_fpqtws_azezma"));
$gq = Jp_hwfrqar_mzwhwzl_arvowfra::wa_zvweh_fmazpbrv();
if (!$gq) {
goto vo;
}
add_action("admin_footer", array($this, "ldap_feedback_request"));
vo:
}
public function ldap_feedback_request()
{
display_ldap_feedback_form();
}
function mo_ldap_local_custom_redirect($IA, $Cf, $user)
{
$p4 = get_option("mo_ldap_local_redirect_to");
if (!(isset($user->roles) && is_array($user->roles))) {
goto Hf;
}
if (in_array("administrator", $user->roles)) {
return $IA;
}
if ($p4) {
if ($p4 == "homepage") {
$IA = home_url();
goto Pn;
}
if ($p4 == "profile") {
$R8 = home_url() . "/wp-admin/profile.php";
$IA = $R8;
goto Pn;
}
if ($p4 == "custom") {
$ph = get_option("mo_ldap_local_custom_redirect");
$IA = $ph;
// [PHPDeobfuscator] Implied goto
goto Pn;
}
goto Pn;
}
Pn:
Hf:
return $IA;
}
function mo_ldap_local_login_redirect()
{
$yH = get_queried_object_id();
$o5 = rtrim(get_permalink($yH), "/");
$Pb = !empty(get_option("mo_ldap_public_pages_list")) ? unserialize(get_option("mo_ldap_public_pages_list")) : array();
if (!(empty(get_option("mo_ldap_public_pages_enable")) || !in_array(strtolower($o5), $Pb))) {
goto Rs;
}
if (is_user_logged_in()) {
goto yL;
}
auth_redirect();
yL:
Rs:
}
function bp_srz_fpqtws_azezma($dc)
{
if (!(strcasecmp(Jp_hwfrqar_mzwhwzl_arvowfra::bp_mzwhwzl_azeza($dc), "verified") == 0)) {
return false;
}
return true;
}
function show_user_profile($user)
{
$Rv = unserialize(get_option("mo_ldap_local_custom_attributes"));
echo " <h3>Extra profile information</h3>
<table class=\"form-table\">
<tr>
<td><b><label for=\"user_dn\">User DN</label></b></td>
<td>
<b>";
echo esc_attr(get_the_author_meta("mo_ldap_user_dn", $user->ID));
echo "</b></td>
</td>
</tr>
";
if (!get_the_author_meta("mo_ldap_user_phone", $user->ID)) {
goto od;
}
echo " <tr>
<td><b><label for=\"user_phone\">User Phone Number</label></b></td>
<td>
<b>";
echo esc_attr(get_the_author_meta("mo_ldap_user_phone", $user->ID));
echo "</b>
</td>
</tr>
";
od:
foreach ($Rv as $Pt => $dc) {
$hY = get_user_meta($user->ID, $Pt, true);
if (empty($hY)) {
goto Fj;
}
echo " <tr>
<td><b><font color=\"#FF0000\"></font>";
echo $dc;
echo "</b></td>
";
if (is_array($hY)) {
echo "<td>";
foreach ($hY as $Qz) {
echo "<b>" . $Qz . "</b><br>";
}
echo "</td>";
// [PHPDeobfuscator] Implied goto
goto Eb;
}
echo "<td>";
echo "<b>" . $hY . "</b><br>";
echo "</td>";
Eb:
echo " </tr>
";
Fj:
}
echo " </table>
";
}
function update_profile($fM, $xD = null)
{
$eV = apply_filters("mo_check_config", '');
if (!$eV) {
goto fX;
}
$Rv = unserialize(get_option("mo_ldap_local_custom_attributes"));
$o7 = array();
foreach ($Rv as $Pt => $dc) {
if (!isset($_POST[$dc])) {
goto DM;
}
$o7[$dc] = $_POST[$dc];
DM:
}
$user = get_userdata($fM);
$gi = new Mo_Ldap_Local_Config();
$gi->modify_user_info_in_ldap($user, $o7);
fX:
}
function ldap_login($user, $Dv, $oV)
{
$eV = apply_filters("mo_check_config", '');
$Mz = get_option("active_plugins");
if (!in_array("miniorange-customize-wp-ldap-login-screen-add-on/add_login_message.php", $Mz)) {
goto FF;
}
add_filter("login_message", "add_login_messages");
function add_login_messages($hW)
{
$tk = get_option("mo_ldap_login_messages");
foreach ($tk as $ls) {
$hW = $hW . "<p name='custom-login-message' id='custom-login-message' style='margin-top: 20px;margin-left: 0;padding: 8px 8px 8px;font-weight: 200;overflow: hidden;background: #fff;border: 4px solid #fff;box-shadow: 0 1px 3px rgba(0,0,0,.04);border-left-color: " . $ls["color"] . ";border-top: none;border-bottom: none;'><strong>" . $ls["message"] . "</strong></p>";
}
$hW .= "<br>";
return $hW;
}
FF:
$KO = get_option("mo_ldap_enable_user_session_sync");
if ($KO && in_array("miniorange-terminate-ldap-user-session-on-password-update-add-on/terminate_ldap_user_session_sync.php", $Mz)) {
$uU = true;
// [PHPDeobfuscator] Implied goto
goto j0;
}
$uU = false;
j0:
error_log("Value for LDAP PWD sync : " . $uU);
if (!(empty($Dv) || empty($oV))) {
$s1 = get_option("mo_ldap_local_enable_both_login");
$gi = new Mo_Ldap_Local_Config();
$j0 = $gi->authenticate_ldap_user($Dv, $oV);
if ($j0->statusCode == "LDAP_BIND_SUCCESS_USER_EXISTS" && $eV) {
$VF = get_option("mo_ldap_enable_ultimate_member_login");
$ZM = get_option("mo_ldap_enable_ultimate_member_profile");
$Ie = $j0->profileAttributesList;
$qo = $Ie["mail"];
if (username_exists($Dv) || email_exists($Dv) || username_exists($qo) || email_exists($qo)) {
$NN = strtolower(get_option("mo_ldap_local_email_attribute"));
$user = false;
if (username_exists($Dv)) {
$user = get_user_by("login", $Dv);
goto Zh;
}
if (email_exists($Dv)) {
$user = get_user_by("email", $Dv);
goto Zh;
}
if (isset($Ie[$NN]) && email_exists($Ie[$NN])) {
$user = get_user_by("email", $Ie[$NN]);
// [PHPDeobfuscator] Implied goto
goto Zh;
}
Zh:
if ($user) {
if (!($uU == true)) {
goto oW;
}
error_log("saving user meta key");
update_user_meta($user->ID, "mo_ldap_user_session_key", Mo_Ldap_Local_Util::encrypt($oV));
oW:
$gi->fetch_or_update_user_attributes($user, $j0);
$user = get_user_by("id", $user->ID);
if (!($ZM == 1)) {
goto ua;
}
delete_option("um_cache_userdata_{$user->ID}");
ua:
if ($VF == 1) {
wp_set_auth_cookie($user->ID, false);
apply_filters("login_redirect", null, null, $user);
// [PHPDeobfuscator] Implied goto
goto qR;
}
$z5 = get_option("mo_ldap_enable_role_restriction");
if (!$z5) {
ee:
return $user;
}
$xY = new Mo_Ldap_Local_Role_Mapping();
$xm = $xY->mo_ldap_is_user_login_restricted($user->roles);
if (!$xm) {
goto ee;
}
$GB = new WP_Error();
$GB->add("UNKNOWN_ERROR", __("<strong>ERROR</strong>: You are not allowed to Login. Please contact your administrator"));
return $GB;
}
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error:</strong> Invalid Username/Password combination");
goto WM;
}
$Ii = get_option("mo_ldap_local_register_user");
if (!$Ii) {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error:</strong> Your Administrator has not enabled Auto Registration. Please contact your Administrator.");
$GB = new WP_Error();
$GB->add("registration_disabled_error", __("<strong>ERROR</strong>: Your Administrator has not enabled Auto Registration. Please contact your Administrator."));
return $GB;
}
$E0 = get_option("mo_ldap_local_enable_fallback_login");
$uO = wp_generate_password(10, false);
$qo = '';
$fv = '';
$eO = '';
$bC = '';
$Ey = '';
$WD = get_option("mo_ldap_local_enable_attr_mapping");
if (!($WD == 1)) {
goto Ov;
}
$qT = strtolower(get_option("mo_ldap_local_fname_attribute"));
$yB = strtolower(get_option("mo_ldap_local_lname_attribute"));
$NN = strtolower(get_option("mo_ldap_local_email_attribute"));
$RA = strtolower(get_option("mo_ldap_local_phone_attribute"));
$jd = strtolower(get_option("mo_ldap_local_nickname_attribute"));
$qo = $Ie[$NN];
$fv = $Ie[$qT];
$eO = $Ie[$yB];
$bC = $Ie[$jd];
$Ey = $Ie[$RA];
Ov:
$UU = array("user_login" => $Dv, "user_email" => $qo, "first_name" => $fv, "last_name" => $eO, "nickname" => $bC, "user_pass" => $uO);
if (!($WD == 1)) {
goto MA;
}
if (empty($bC)) {
goto dm;
}
$UU["nickname"] = $bC;
dm:
$tY = get_option("mo_ldap_local_display_name_attribute");
if (empty($tY)) {
goto zw;
}
if ($tY == "nickname" && !empty($bC)) {
$UU["display_name"] = $bC;
goto rb;
}
if ($tY == "email") {
$UU["display_name"] = $qo;
goto rb;
}
if ($tY == "firstname") {
$UU["display_name"] = $fv;
goto rb;
}
if ($tY == "firstlast") {
$UU["display_name"] = $fv . " " . $eO;
goto rb;
}
if ($tY == "lastfirst") {
$UU["display_name"] = $eO . " " . $fv;
// [PHPDeobfuscator] Implied goto
goto rb;
}
rb:
zw:
MA:
$fM = wp_insert_user($UU);
if (!is_wp_error($fM)) {
$user = get_user_by("login", $Dv);
if (!($uU == true)) {
goto D4;
}
error_log("saving user meta key");
update_user_meta($user->ID, "mo_ldap_user_session_key", Mo_Ldap_Local_Util::encrypt($oV));
D4:
update_user_meta($user->ID, "mo_ldap_user_dn", $j0->userDn, false);
update_user_meta($user->ID, "mo_ldap_user_phone", $Ey);
$iJ = get_option("mo_ldap_local_enable_role_mapping");
$Y9 = new Mo_Ldap_Local_Role_Mapping();
$fn = $Y9->get_member_of_attribute($Dv);
if (!($iJ == 1)) {
goto Zx;
}
$Y9->mo_ldap_local_update_role_mapping($user->ID, $fn);
Zx:
$user = get_user_by("id", $user->ID);
if ($WD == 1) {
$Rv = $j0->extraProfileAttributesList;
// [PHPDeobfuscator] Implied goto
goto JQ;
}
$Rv = array();
JQ:
if (!array_key_exists("memberof", $Rv)) {
goto A8;
}
$Rv["memberof"] = $fn;
A8:
foreach ($Rv as $Pt => $dc) {
update_user_meta($user->ID, $Pt, $dc);
}
do_action("mo_ldap_buddypress", $Rv, $user);
do_action("mo_ldap_attribute_to_usermeta_update", $user);
do_action("mo_ldap_profile_picture_mapping", $user);
do_action("mo_ldap_buddypress_profile_picture_mapping", $user);
do_action("mo_wp_to_ldap_groups_mapping", $user, $fn);
do_action("mo_ldap_learndash_groups_mapping", $user, $fn);
do_action("mo_ldap_tutor_groups_mapping", $user, $fn);
if (!($ZM == 1)) {
goto nf;
}
delete_option("um_cache_userdata_{$user->ID}");
nf:
if ($VF == 1) {
wp_set_auth_cookie($user->ID, false);
apply_filters("login_redirect", null, null, $user);
qR:
WM:
wp_redirect(site_url());
exit;
}
$z5 = get_option("mo_ldap_enable_role_restriction");
if (!$z5) {
gJ:
return $user;
}
$xY = new Mo_Ldap_Local_Role_Mapping();
$xm = $xY->mo_ldap_is_user_login_restricted($user->roles);
if (!$xm) {
goto gJ;
}
$GB = new WP_Error();
$GB->add("UNKNOWN_ERROR", __("<strong>ERROR</strong>: You are not allowed to Login. Please contact your administrator"));
return $GB;
}
$this->mo_ldap_report_update($Dv, $j0->statusMessage, "<strong>Login Error:</strong> There was an error registering your account. Please try again.");
$GB = new WP_Error();
$GB->add("registration_error", __("<strong>ERROR</strong>: There was an error registering your account. Please try again."));
return $GB;
}
if (!empty($s1) || !$eV) {
$user = false;
if (username_exists($Dv)) {
$user = get_user_by("login", $Dv);
goto It;
}
if (email_exists($Dv)) {
$user = get_user_by("email", $Dv);
// [PHPDeobfuscator] Implied goto
goto It;
}
It:
if ($user) {
if (!(!$eV && $j0->statusCode == "LDAP_BIND_SUCCESS_USER_EXISTS")) {
Hu:
$lO = false;
if ($s1 == "all" || !$eV) {
$lO = true;
goto uC;
}
if ($s1 == "admin" && user_can($user->ID, "manage_options")) {
$lO = true;
// [PHPDeobfuscator] Implied goto
goto uC;
}
uC:
if ($lO && wp_check_password($oV, $user->data->user_pass, $user->ID)) {
$z5 = get_option("mo_ldap_enable_role_restriction");
if (!$z5) {
Zj:
return $user;
}
$xY = new Mo_Ldap_Local_Role_Mapping();
$xm = $xY->mo_ldap_is_user_login_restricted($user->roles);
if (!$xm) {
goto Zj;
}
$GB = new WP_Error();
$GB->add("UNKNOWN_ERROR", __("<strong>ERROR</strong>: You are not allowed to Login. Please contact your administrator"));
return $GB;
}
if ($j0->statusCode == "LDAP_CONNECTION_ERROR") {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: LDAP server is not reachable. Authentication failed against Local WordPress server.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: LDAP server is not reachable. Authentication failed against Local WordPress server."));
return $GB;
}
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect."));
return $GB;
}
$Cv = get_user_meta($user->ID, "mo_ldap_user_dn");
$Cv = !empty($Cv) ? $Cv : false;
if (!($Cv != false)) {
goto Hu;
}
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Trial:</strong> Your Trial License has Expired");
$GB = new WP_Error();
$GB->add("registration_disabled_error", __("<strong>ERROR</strong>: Your miniOrange LDAP/AD Login for Intranet Sites Trial License has expired."));
return $GB;
}
if ($j0->statusCode == "LDAP_CONNECTION_ERROR") {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>ERROR</strong>: LDAP server is not reachable.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>ERROR</strong>: LDAP server is not reachable."));
return $GB;
}
if ($j0->statusCode == "LDAP_BIND_ERROR_USER_EXISTS") {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect."));
return $GB;
}
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: User with specified Username/Email address Not Found.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: User with specified Username/Email address Not Found."));
return $GB;
}
if ($j0->statusCode == "LDAP_CONNECTION_ERROR") {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: LDAP server is not reachable");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: LDAP server is not reachable. Fallback to local WordPress authentication is not enabled."));
return $GB;
}
if ($j0->statusCode == "LDAP_BIND_ERROR_USER_EXISTS") {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect."));
return $GB;
}
if ($j0->statusCode == "LDAP_EXTENSION_ERROR") {
$this->mo_ldap_report_update($Dv, $j0->statusMessage, "<strong>Login Error</strong>: <a target=\"_blank\" href=\"http://php.net/manual/en/ldap.installation.php\">PHP LDAP extension</a> is not installed or disabled. Please enable it.");
$GB = new WP_Error();
$GB->add("LDAP_EXTENSION_ERROR", __("<strong>Login Error</strong>: <a target=\"_blank\" href=\"http://php.net/manual/en/ldap.installation.php\">PHP LDAP extension</a> is not installed or disabled. Please enable it."));
return $GB;
}
if ($j0->statusCode == "OPENSSL_EXTENSION_ERROR") {
$this->mo_ldap_report_update($Dv, $j0->statusMessage, "<strong>Login Error</strong>: <a target=\"_blank\" href=\"http://php.net/manual/en/openssl.installation.php\">PHP OpenSSL extension</a> is not installed or disabled.");
$GB = new WP_Error();
$GB->add("OPENSSL_EXTENSION_ERROR", __("<strong>Login Error</strong>: <a target=\"_blank\" href=\"http://php.net/manual/en/openssl.installation.php\">PHP OpenSSL extension</a> is not installed or disabled."));
return $GB;
}
$GB = new WP_Error();
$GB->add("UNKNOWN_ERROR", __("<strong>ERROR</strong>: Unknown error occurred during authetication. Please contact your administrator."));
return $GB;
}
$GB = new WP_Error();
if (!empty($Dv)) {
goto rG;
}
$GB->add("empty_username", __("<strong>ERROR</strong>: Email field is empty."));
rG:
if (!empty($oV)) {
goto ms;
}
$GB->add("empty_password", __("<strong>ERROR</strong>: Password field is empty."));
ms:
return $GB;
}
function mo_ldap_local_login_widget_menu()
{
add_menu_page("LDAP/AD Login for Intranet", "LDAP/AD Login for Intranet", "activate_plugins", "mo_ldap_local_login", array($this, "mo_ldap_local_login_widget_options"), plugin_dir_url(__DIR__."/input.php") . "includes/images/miniorange_icon.png");
}
function mo_ldap_local_login_widget_options()
{
$B6 = array("server_url" => "ldap://58.64.132.235:389", "service_account_dn" => "cn=testuser,cn=Users,dc=miniorange,dc=com", "admin_password" => "XXXXXXXX", "dn_attribute" => "distinguishedName", "search_base" => "cn=Users,dc=miniorange,dc=com", "username_attribute" => "sAMAccountName", "search_filter" => "(&(objectClass=*)(cn=?))", "test_username" => "testuser", "test_password" => "password");
update_option("mo_ldap_local_default_config", $B6);
mo_ldap_local_settings();
}
function login_widget_save_options()
{
$eV = apply_filters("mo_check_config", '');
if (!((!empty(get_option("user_logs_table_exists")) || strcasecmp(get_option("user_logs_table_exists"), "1") === 0) && (empty(get_option("mo_ldap_local_user_table_updated")) || strcasecmp(get_option("mo_ldap_local_user_table_updated"), "true") !== 0))) {
goto Yq;
}
Mo_Ldap_Local_Util::update_user_auth_table_headers();
update_option("mo_ldap_local_user_table_updated", "true");
Yq:
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_local_verify_customer") == 0) {
$qo = '';
$oV = '';
if (Mo_Ldap_Local_Util::check_empty_or_null($_POST["email"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["password"])) {
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid entries.");
$this->show_error_message();
return;
}
$qo = sanitize_email($_POST["email"]);
$oV = $_POST["password"];
update_option("mo_ldap_local_admin_email", $qo);
update_option("mo_ldap_local_password", $oV);
$D8 = new Mo_Ldap_Local_Customer();
$yq = $D8->get_customer_key();
$bS = json_decode($yq, true);
if (strcasecmp($bS["status"], "SUCCESS") == 0) {
update_option("mo_ldap_local_admin_phone", $bS["phone"]);
$this->save_success_customer_config($bS["id"], $bS["apiKey"], $bS["token"], "Your account has been retrieved successfully.");
update_option("mo_ldap_local_password", '');
goto KE;
}
if (strcasecmp($bS["status"], "ERROR") == 0) {
update_option("mo_ldap_local_message", $bS["statusMessage"]);
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto KE;
}
update_option("mo_ldap_local_message", "Invalid username or password. Please try again.");
$this->show_error_message();
KE:
update_option("mo_ldap_local_password", '');
goto Fm;
}
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_local_verify_license") == 0) {
if (!Mo_Ldap_Local_Util::check_empty_or_null($_POST["mo_ldap_local_license_key"])) {
$ho = trim($_POST["mo_ldap_local_license_key"]);
$D8 = new Mo_Ldap_Local_Customer();
$yq = json_decode($D8->XfskodsfhHJ($ho), true);
if (isset($yq["status"]) && $yq["isTrial"] == true) {
$VM = Jp_hwfrqar_mzwhwzl_arvowfra::bp_efzwoezr_zvweh_hwfrqar($yq, $ho);
update_option("mo_ldap_local_message", $VM["displayMsg"]);
if ($VM["trialStatus"]) {
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Di;
}
$this->show_error_message();
Di:
goto om;
}
if (isset($yq["status"]) && strcasecmp($yq["status"], "SUCCESS") == 0) {
update_option("mo_plugin_utility_key_stat", Jp_hwfrqar_mzwhwzl_arvowfra::rqfvlyz_mzwhwzl("premium"));
delete_option("mo_plugin_utility_key");
update_option("mo_ldap_local_license_verified", "true");
update_option("mo_ldap_local_license_key", Mo_Ldap_Local_Util::encrypt($ho));
update_option("mo_ldap_local_message", "Your license is verified. You can now setup the plugin.");
$this->show_success_message();
goto om;
}
if (isset($yq["status"]) && strcasecmp($yq["status"], "FAILED") == 0) {
if (isset($yq["status"]) && strcasecmp($yq["message"], "Code has Expired") == 0) {
$yE = add_query_arg(array("tab" => "pricing"), $_SERVER["REQUEST_URI"]);
update_option("mo_ldap_local_message", "License key you have entered has already been used. Please enter a key which has not been used before on any other instance or if you have exausted all your keys then <a href=\"" . $yE . "\">Click here</a> to buy more.");
// [PHPDeobfuscator] Implied goto
goto zO;
}
update_option("mo_ldap_local_message", "You have entered an invalid license key. Please enter a valid license key.");
zO:
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto om;
}
update_option("mo_ldap_local_message", "An error occured while processing your request. Please Try again.");
$this->show_error_message();
om:
goto Fm;
}
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid license key.");
$this->show_error_message();
return;
}
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo-check-license-button") == 0) {
$ho = Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_license_key"));
$D8 = new Mo_Ldap_Local_Customer();
$yq = json_decode($D8->XfskodsfhHJ($ho), true);
$nH = Jp_hwfrqar_mzwhwzl_arvowfra::bp_myjezr_hwfrqar_mzwhwzl($yq);
update_option("mo_ldap_local_message", $nH);
$this->show_success_message();
goto Fm;
}
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo-change-account-button") == 0) {
Jp_hwfrqar_mzwhwzl_arvowfra::bp_hpspmz_fmazpbrv_mzwhwzl();
goto Fm;
}
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_public_pages") == 0) {
$g0 = $_POST["mo_ldap_custom_page_restriction_check"];
update_option("mo_ldap_public_pages_enable", $g0);
$lr = 1;
$Pb = !empty(get_option("mo_ldap_public_pages_list")) ? unserialize(get_option("mo_ldap_public_pages_list")) : array();
sZ:
if (!isset($_POST["mo_ldap_custom_page_" . $lr])) {
update_option("mo_ldap_public_pages_list", serialize($Pb));
goto Fm;
}
if (!(strcasecmp($_POST["mo_ldap_custom_page_" . $lr], '') != 0)) {
goto R5;
}
$Bi = rtrim(sanitize_text_field(strtolower($_POST["mo_ldap_custom_page_" . $lr])), "/");
if (!in_array($Bi, $Pb)) {
array_push($Pb, $Bi);
$hW = "Page <b>" . $Bi . "</b> Added Successfully";
update_option("mo_ldap_local_message", $hW);
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto m_;
}
$hW = "Page <b>" . $Bi . "</b> Already Added.";
update_option("mo_ldap_local_message", $hW);
$this->show_error_message();
m_:
R5:
$lr++;
goto sZ;
}
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_delete_page") == 0) {
$Bi = $_POST["mo_ldap_delete_page_name"];
$Pb = !empty(get_option("mo_ldap_public_pages_list")) ? unserialize(get_option("mo_ldap_public_pages_list")) : array();
$k_ = array_search($Bi, $Pb);
unset($Pb[$k_]);
update_option("mo_ldap_public_pages_list", serialize($Pb));
$hW = "Page <b>" . $Bi . "</b> Removed Successfully.";
update_option("mo_ldap_local_message", $hW);
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Fm;
}
Fm:
if (!(isset($_POST["option"]) && $eV)) {
goto Nr;
}
$vM = $_POST["option"];
switch ($vM) {
case "mo_ldap_local_save_config":
if (NddKoYsdasadJD()) {
$jn = isset($_POST["anonymous_bind"]) ? 1 : 0;
update_option("mo_ldap_local_anonymous_bind", $jn);
$tH = '';
$Jo = '';
$SO = '';
if (Mo_Ldap_Local_Util::check_empty_or_null($_POST["ldap_server"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["dn"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["admin_password"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["mo_ldap_protocol"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["mo_ldap_server_port_no"])) {
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid entries.");
$this->show_error_message();
return;
}
$rq = $_POST["mo_ldap_protocol"];
$Fs = sanitize_text_field($_POST["mo_ldap_server_port_no"]);
$ez = sanitize_text_field($_POST["ldap_server"]);
$tH = $rq . "://" . $ez . ":" . $Fs;
$Jo = sanitize_text_field($_POST["dn"]);
$SO = $_POST["admin_password"];
if (!Mo_Ldap_Local_Util::is_extension_installed("openssl")) {
update_option("mo_ldap_local_message", "PHP OpenSSL extension is not installed or disabled. Please enable it first.");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto q0;
}
$lC = $_POST["mo_ldap_directory_server_value"];
if (strcasecmp($lC, "other") == 0) {
$Fo = isset($_POST["mo_ldap_directory_server_custom_value"]) && !empty($_POST["mo_ldap_directory_server_custom_value"]) ? $_POST["mo_ldap_directory_server_custom_value"] : "other";
update_option("mo_ldap_directory_server_custom_value", $Fo);
// [PHPDeobfuscator] Implied goto
goto Ei;
}
delete_option("mo_ldap_directory_server_custom_value");
Ei:
update_option("mo_ldap_directory_server_value", $lC);
update_option("mo_ldap_local_ldap_protocol", $rq);
update_option("mo_ldap_local_ldap_server_address", Mo_Ldap_Local_Util::encrypt($ez));
if ($rq == "ldap") {
update_option("mo_ldap_local_ldap_port_number", $Fs);
goto Y2;
}
if ($rq == "ldaps") {
update_option("mo_ldap_local_ldaps_port_number", $Fs);
// [PHPDeobfuscator] Implied goto
goto Y2;
}
Y2:
update_option("mo_ldap_local_server_url", Mo_Ldap_Local_Util::encrypt($tH));
update_option("mo_ldap_local_server_dn", Mo_Ldap_Local_Util::encrypt($Jo));
update_option("mo_ldap_local_server_password", Mo_Ldap_Local_Util::encrypt($SO));
$gi = new Mo_Ldap_Local_Config();
$hW = "Your configuration has been saved.";
$YX = $gi->test_connection();
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_BIND_SUCCESSFUL") == 0) {
update_option("mo_ldap_local_message", " Connection was established successfully. Your configuration has been saved. Please configure LDAP User Mapping now.", '', "no");
update_option("mo_ldap_local_verify_ldap_connection", "true");
$this->show_success_message();
goto EO;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_BIND_ERROR") == 0) {
$this->mo_ldap_report_update("LDAP CONNECTION TEST", "ERROR", "<strong>Test Connection Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
update_option("mo_ldap_local_verify_ldap_connection", "false");
$this->show_error_message();
goto EO;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_CONNECTION_ERROR") == 0) {
$this->mo_ldap_report_update("LDAP CONNECTION TEST", "ERROR", "<strong>Test Connection Error: </strong>Cannot connect to LDAP Server. Make sure you have entered correct LDAP server hostname or IP address.");
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
update_option("mo_ldap_local_verify_ldap_connection", "false");
$this->show_error_message();
goto EO;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_EXTENSION_ERROR") == 0) {
$this->mo_ldap_report_update("LDAP CONNECTION TEST", "ERROR", "<strong>Test Connection Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
update_option("mo_ldap_local_verify_ldap_connection", "false");
$this->show_error_message();
goto EO;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "OPENSSL_EXTENSION_ERROR") == 0) {
$this->mo_ldap_report_update("LDAP CONNECTION TEST", "ERROR", "<strong>Test Connection Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
update_option("mo_ldap_local_verify_ldap_connection", "false");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto EO;
}
EO:
goto q0;
}
update_option("mo_ldap_local_message", "Settings can't be saved without verifying your license key.");
$this->show_error_message();
q0:
goto rJ;
case "mo_ldap_local_tls_enable":
$C1 = isset($_POST["mo_ldap_local_tls_enable"]) ? $_POST["mo_ldap_local_tls_enable"] : 0;
update_option("mo_ldap_local_use_tls", $C1);
if ($C1 == 1) {
update_option("mo_ldap_local_message", "TLS has been enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto SX;
}
update_option("mo_ldap_local_message", "TLS has been disabled.");
$this->show_error_message();
SX:
goto rJ;
case "mo_ldap_local_save_user_mapping":
delete_option("mo_ldap_local_user_mapping_status");
update_option("mo_local_filter_check", isset($_POST["ldap_search_filters"]) ? 1 : 0);
$o1 = '';
$yU = '';
$If = '';
$GQ = array();
$nh = array();
if (Mo_Ldap_Local_Util::check_empty_or_null($_POST["search_base"])) {
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid entries.");
add_option("mo_ldap_local_user_mapping_status", "INVALID", '', "no");
$this->show_error_message();
return;
}
if (Mo_Ldap_Local_Util::check_empty_or_null($_POST["user_attribute_text"]) && Mo_Ldap_Local_Util::check_empty_or_null($_POST["search_filter"])) {
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid entries.");
add_option("mo_ldap_local_user_mapping_status", "INVALID", '', "no");
$this->show_error_message();
return;
}
$yU = strtolower(sanitize_text_field($_POST["search_base"]));
if (!Mo_Ldap_Local_Util::is_extension_installed("openssl")) {
update_option("mo_ldap_local_message", "PHP OpenSSL extension is not installed or disabled. Please enable it first.");
add_option("mo_ldap_local_user_mapping_status", "INVALID", '', "no");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto E2;
}
$If = sanitize_text_field($_POST["search_filter"]);
$nE = sanitize_text_field($_POST["user_attribute_text"]);
$ji = sanitize_text_field($_POST["extra_user_attribute"]);
if (!isset($nE)) {
goto cm;
}
foreach ($_POST["user_attribute_text"] as $k_ => $dc) {
$GQ[$k_] = $dc;
}
cm:
update_option("mo_ldap_local_search_filter", Mo_Ldap_Local_Util::encrypt($If));
update_option("mo_ldap_local_username_attribute", $GQ);
update_option("mo_ldap_local_extra_user_attribute", $ji);
update_option("mo_ldap_local_search_base", Mo_Ldap_Local_Util::encrypt($yU));
$hW = "LDAP User Mapping Configuration has been saved. Please test authentication to verify LDAP User Mapping Configuration.";
update_option("mo_ldap_local_message", $hW, '', "no");
add_option("mo_ldap_local_user_mapping_status", "VALID", '', "no");
$this->show_success_message();
update_option("mo_ldap_local_check_user_mapping_config", "true");
E2:
goto rJ;
case "mo_ldap_local_test_auth":
if (NddKoYsdasadJD()) {
$tH = get_option("mo_ldap_local_server_url");
$Jo = get_option("mo_ldap_local_server_dn");
$SO = get_option("mo_ldap_local_server_password");
$yU = get_option("mo_ldap_local_search_base");
$GQ = get_option("mo_ldap_local_username_attribute");
$If = get_option("mo_ldap_local_search_filter");
$UA = '';
$fz = '';
if (Mo_Ldap_Local_Util::check_empty_or_null($_POST["test_username"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["test_password"])) {
$this->mo_ldap_report_update("Test Authentication ", "ERROR", "<strong>ERROR</strong>: All the fields are required. Please enter valid entries.");
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid entries.", '', "no");
$this->show_error_message();
return;
}
if (Mo_Ldap_Local_Util::check_empty_or_null($tH) || Mo_Ldap_Local_Util::check_empty_or_null($Jo) || Mo_Ldap_Local_Util::check_empty_or_null($SO) || Mo_Ldap_Local_Util::check_empty_or_null($yU) || Mo_Ldap_Local_Util::check_empty_or_null($GQ) || Mo_Ldap_Local_Util::check_empty_or_null($If)) {
$this->mo_ldap_report_update("Test authentication", "ERROR", "<strong>Test Authentication Error</strong>: Please save LDAP Configuration to test authentication.");
update_option("mo_ldap_local_message", "Please save LDAP Configuration to test authentication.", '', "no");
$this->show_error_message();
return;
}
$UA = sanitize_text_field($_POST["test_username"]);
$fz = $_POST["test_password"];
$gi = new Mo_Ldap_Local_Config();
$YX = $gi->test_authentication($UA, $fz);
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_BIND_SUCCESS_USER_EXISTS") == 0) {
$dL = add_query_arg(array("tab" => "rolemapping"), $_SERVER["REQUEST_URI"]);
$hW = "You have successfully configured your LDAP settings.<br>
You can now do either of two things.<br>
1. Enable LDAP Login at the top and then <a href=\"" . wp_logout_url(get_permalink()) . "\">Logout</a> from WordPress and login again with your LDAP credentials.<br>
2. Do role mapping (<a href=\"" . $dL . "\">Click here</a>)";
update_option("mo_ldap_local_message", $hW, '', "no");
$this->show_success_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_CONNECTION_ERROR") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_BIND_ERROR_USER_EXISTS") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_BIND_ERROR") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_USER_NOT_EXIST") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong> Cannot find user in the directory");
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_USER_SEARCH_ERROR") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong> Cannot find user in the directory");
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_EXTENSION_ERROR") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "OPENSSL_EXTENSION_ERROR") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_LOCAL_SERVER_NOT_CONFIGURED") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto pB;
}
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong> There was an error processing your request. Please verify the Search Base(s) and Username attribute. Your user should be present in the Search base defined.");
update_option("mo_ldap_local_message", "There was an error processing your request. Please verify the Search Base(s) and Username attribute. Your user should be present in the Search base defined.");
$this->show_error_message();
goto pB;
}
update_option("mo_ldap_local_message", "Settings can't be tested without verifying your license key.");
$this->show_error_message();
pB:
goto rJ;
case "mo_ldap_local_enable":
if (NddKoYsdasadJD()) {
$YC = isset($_POST["enable_ldap_login"]) ? $_POST["enable_ldap_login"] : 0;
update_option("mo_ldap_local_enable_login", $YC);
if ($YC == 1) {
update_option("mo_ldap_local_message", "Login through your LDAP has been enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto No;
}
update_option("mo_ldap_local_message", "Login through your LDAP has been disabled.");
$this->show_error_message();
goto No;
}
update_option("mo_ldap_local_message", "Settings can't be saved without verifying your license key.");
$this->show_error_message();
No:
goto rJ;
case "mo_ldap_local_enable_both_login":
$L0 = isset($_POST["mo_ldap_local_enable_both_login"]) ? $_POST["mo_ldap_local_enable_both_login"] : '';
update_option("mo_ldap_local_enable_both_login", $L0);
if ($L0 == "admin") {
update_option("mo_ldap_local_message", "Login using Local WordPress Credentials for <b>Administrators</b> is enabled.");
$this->show_success_message();
goto Sm;
}
if ($L0 == "all") {
update_option("mo_ldap_local_message", "Login using Local WordPress Credentials for <b>All Users</b> is enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Sm;
}
update_option("mo_ldap_local_message", "Login using Local WordPress Credentials is <b>disabled</b>.");
$this->show_error_message();
Sm:
goto rJ;
case "mo_ldap_local_save_login_redirect":
$xG = $_POST["redirect_to"];
update_option("mo_ldap_local_redirect_to", $xG);
if ($xG == "profile") {
update_option("mo_ldap_local_message", "Users will get redirected to Profile Page after login.");
goto Ok;
}
if ($xG == "homepage") {
update_option("mo_ldap_local_message", "Users will get redirected to Home Page after login.");
// [PHPDeobfuscator] Implied goto
goto Ok;
}
Ok:
if ($xG != "custom" && $xG !== "none") {
$this->show_success_message();
goto hZ;
}
if ($xG == "none") {
update_option("mo_ldap_local_message", "Redirection after login is disabled.");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto hZ;
}
hZ:
goto rJ;
case "mo_ldap_local_custom_redirect":
$ph = $_POST["mo_ldap_local_custom_url"];
update_option("mo_ldap_local_custom_redirect", $ph);
update_option("mo_ldap_local_message", "Users will get redirected to custom redirect URL after login.");
$this->show_success_message();
goto rJ;
case "mo_ldap_local_register_user":
if (NddKoYsdasadJD()) {
$Zm = isset($_POST["mo_ldap_local_register_user"]) ? $_POST["mo_ldap_local_register_user"] : 0;
update_option("mo_ldap_local_register_user", $Zm);
if ($Zm == 1) {
update_option("mo_ldap_local_message", "Auto Registering users has been enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto UF;
}
update_option("mo_ldap_local_message", "Auto Registering users has been disabled.");
$this->show_error_message();
goto UF;
}
update_option("mo_ldap_local_message", "Settings can't be saved without verifying your license key.");
$this->show_error_message();
UF:
goto rJ;
case "mo_ldap_local_authorized_users_only":
if (NddKoYsdasadJD()) {
$Gq = isset($_POST["authorized_users_only"]) ? $_POST["authorized_users_only"] : 0;
update_option("mo_ldap_local_authorized_users_only", $Gq);
if ($Gq == 1) {
update_option("mo_ldap_local_message", "Protect Content by Login enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto rV;
}
update_option("mo_ldap_local_message", "Protect Content by Login disabled.");
$this->show_error_message();
goto rV;
}
update_option("mo_ldap_local_message", "Settings can't be saved without verifying your license key.");
$this->show_error_message();
rV:
goto rJ;
case "mo_ldap_local_group_role_mapping":
$ne = isset($_POST["enable_ldap_role_mapping_based_on_ldap_groups"]) ? $_POST["enable_ldap_role_mapping_based_on_ldap_groups"] : 0;
update_option("mo_ldap_local_enable_role_mapping_based_on_ldap_groups", $ne);
if ($ne == 1) {
update_option("mo_ldap_local_message", "LDAP Group to WP role mapping has been enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Cp;
}
update_option("mo_ldap_local_message", "LDAP Group to WP role mapping has been disabled.");
$this->show_error_message();
Cp:
goto rJ;
case "mo_ldap_fetch_groups_list":
if (!isset($_REQUEST["mo_ldap_groups_search_base"])) {
goto ZQ;
}
$fl = trim($_REQUEST["mo_ldap_groups_search_base"]);
ZQ:
update_option("mo_ldap_local_groups_search_base", Mo_Ldap_Local_Util::encrypt($fl));
update_option("mo_ldap_show_groups", 1);
goto rJ;
case "mo_ldap_local_save_mapping":
$WP = array();
$MS = array();
$nh = array();
$qu = 1;
$td = 0;
$VZ = $_POST["mapping_key_1"];
BJ:
if (!isset($VZ)) {
update_option("mo_ldap_local_role_mapping_key_array", serialize($WP));
update_option("mo_ldap_local_role_mapping_value_array", serialize($MS));
update_option("mo_ldap_local_role_mapping_group_names", serialize($nh));
update_option("mo_ldap_local_role_mapping_count", $td);
if (!isset($_POST["mapping_value_default"])) {
goto XZ;
}
update_option("mo_ldap_local_mapping_value_default", $_POST["mapping_value_default"]);
XZ:
if (!isset($_POST["mapping_memberof_attribute"])) {
goto Iw;
}
update_option("mo_ldap_local_mapping_memberof_attribute", $_POST["mapping_memberof_attribute"]);
Iw:
$M2 = '';
$YH = get_option("mo_ldap_local_mapping_value_default");
$iJ = get_option("mo_ldap_local_enable_role_mapping");
if (!$YH) {
$M2 = " Please select the Default Role and then check <b>\"Enable Role Mapping\"</b> to activate it.";
goto a_;
}
if ($iJ == 0) {
$M2 = " Please check <b>\"Enable Role Mapping\"</b> to activate it.";
// [PHPDeobfuscator] Implied goto
goto a_;
}
a_:
update_option("mo_ldap_local_message", "LDAP Group to WP role mapping has been updated." . $M2);
$this->show_success_message();
goto rJ;
}
if (empty($VZ)) {
goto Cr;
}
$UC = $_POST["selected_for_save_role_mapping_" . $qu];
if (!($UC == "true")) {
goto a7;
}
$td++;
$Sq = $_POST["mapping_group_name_" . $qu];
$nh[$td] = $Sq;
$WP["mo_ldap_local_mapping_key_" . $td] = trim($VZ);
$MS["mo_ldap_local_mapping_value_" . $td] = $_POST["mapping_value_" . $qu];
a7:
Cr:
$qu++;
$VZ = $_POST["mapping_key_" . $qu];
goto BJ;
case "mo_ldap_ldap_ou_based_role_mapping":
$ZD = $_POST["enable_ldap_role_mapping_based_on_ldap_ou"];
$F6 = 1;
$sf = array();
uN:
if (empty($_POST["mo_ldap_role_mapping_ou_value_" . $F6])) {
update_option("mo_ldap_local_ou_role_mapping_options", serialize($sf));
if ($ZD == 1) {
update_option("mo_ldap_local_enable_role_mapping_based_on_ldap_ou", 1);
update_option("mo_ldap_local_message", "Successfully saved Role Mapping based on LDAP OU");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto nc;
}
update_option("mo_ldap_local_enable_role_mapping_based_on_ldap_ou", 0);
update_option("mo_ldap_local_message", "Disabled Role Mapping based on LDAP OU");
$this->show_error_message();
nc:
goto rJ;
}
$ZX = array();
if (empty($_POST["mo_ldap_role_mapping_ou_value_" . $F6])) {
goto yw;
}
$ZX["ou_value"] = trim($_POST["mo_ldap_role_mapping_ou_value_" . $F6]);
$ZX["ou_based_wp_role_name"] = trim($_POST["mo_ldap_ou_mapping_role_name_" . $F6]);
yw:
array_push($sf, $ZX);
$F6++;
goto uN;
case "mo_ldap_local_enable_role_mapping":
$iJ = isset($_POST["enable_ldap_role_mapping"]) ? $_POST["enable_ldap_role_mapping"] : 0;
update_option("mo_ldap_local_enable_role_mapping", $iJ);
if ($iJ == 1) {
update_option("mo_ldap_local_message", "LDAP Group to WP role mapping has been enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto bv;
}
update_option("mo_ldap_local_message", "LDAP Group to WP role mapping has been disabled.");
$this->show_error_message();
bv:
goto rJ;
case "mo_ldap_local_keep_existing_user_roles":
$wh = isset($_POST["keep_existing_user_roles"]) ? $_POST["keep_existing_user_roles"] : 0;
update_option("mo_ldap_local_keep_existing_user_roles", $wh);
if ($wh == 1) {
update_option("mo_ldap_local_message", "WP Roles of Existing users will not be removed.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto dB;
}
update_option("mo_ldap_local_message", "WP Roles of Existing users will be updated.");
$this->show_error_message();
dB:
goto rJ;
case "mo_ldap_fetch_recursive_groups_enable":
$Yl = isset($_POST["fetch_recursive_groups"]) ? $_POST["fetch_recursive_groups"] : 0;
update_option("mo_ldap_fetch_recursive_groups_enable", $Yl);
if ($Yl) {
update_option("mo_ldap_local_message", "Nested groups from the LDAP associated with the user will be fetched.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Vz;
}
update_option("mo_ldap_local_message", "Nested groups from the LDAP associated with the user will not be fetched.");
$this->show_error_message();
Vz:
goto rJ;
case "mo_ldap_save_default_role":
if (!isset($_POST["mapping_value_default"])) {
goto LC;
}
update_option("mo_ldap_local_mapping_value_default", $_POST["mapping_value_default"]);
LC:
goto rJ;
case "mo_ldap_role_mapping_selection":
$kj = isset($_POST["mo_ldap_role_mapping_selected_tab"]) ? sanitize_text_field($_POST["mo_ldap_role_mapping_selected_tab"]) : 1;
update_option("mo_ldap_local_selected_role_mapping_subtab", $kj);
goto rJ;
case "mo_ldap_enable_attribute_mapping":
$WD = isset($_POST["mo_ldap_local_enable_attr_mapping"]) ? 1 : 0;
update_option("mo_ldap_local_enable_attr_mapping", $WD);
if ($WD == 1) {
update_option("mo_ldap_local_message", "LDAP Attribute Mapping Enabled");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Sd;
}
update_option("mo_ldap_local_message", "LDAP Attribute Mapping Disabled");
$this->show_error_message();
Sd:
goto rJ;
case "mo_ldap_enable_updating_ldap":
$Ow = isset($_POST["enable_update_ldap"]) ? 1 : 0;
update_option("mo_ldap_local_enable_update_ldap", $Ow);
if ($Ow == 1) {
update_option("mo_ldap_local_message", "Enabled updating information in LDAP when user edits profile");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Bn;
}
update_option("mo_ldap_local_message", "Disabled updating information in LDAP when user edits profile");
$this->show_error_message();
Bn:
goto rJ;
case "mo_ldap_save_attribute_config":
update_option("mo_ldap_directory_server_value", isset($_POST["mo_ldap_directory_server_value"]) ? $_POST["mo_ldap_directory_server_value"] : "msad");
$NN = sanitize_text_field($_POST["mo_ldap_email_attribute"]);
$RA = sanitize_text_field($_POST["mo_ldap_phone_attribute"]);
$qT = sanitize_text_field($_POST["mo_ldap_fname_attribute"]);
$yB = sanitize_text_field($_POST["mo_ldap_lname_attribute"]);
$jd = sanitize_text_field($_POST["mo_ldap_nickname_attribute"]);
$tY = sanitize_text_field($_POST["mo_ldap_display_name_attribute"]);
update_option("mo_ldap_local_email_attribute", $NN);
update_option("mo_ldap_local_phone_attribute", $RA);
update_option("mo_ldap_local_fname_attribute", $qT);
update_option("mo_ldap_local_lname_attribute", $yB);
update_option("mo_ldap_local_nickname_attribute", $jd);
update_option("mo_ldap_local_display_name_attribute", $tY);
$Rv = unserialize(get_option("mo_ldap_local_custom_attributes"));
if (!Mo_Ldap_Local_Util::check_empty_or_null($Rv)) {
goto qe;
}
$Rv = array();
qe:
$RS = 1;
$OG = $_POST["mo_ldap_local_custom_attribute_1_name"];
qo:
if (!isset($OG)) {
if (empty($Rv)) {
goto s2;
}
update_option("mo_ldap_local_custom_attributes", serialize(array_unique($Rv)));
s2:
update_option("mo_ldap_local_message", "Successfully saved LDAP Attribute Configuration");
$this->show_success_message();
goto rJ;
}
if (empty($OG)) {
goto qC;
}
if (!(strpos($OG, " ") !== false)) {
goto a1;
}
$OG = str_replace(" ", '', $OG);
a1:
$Q0 = "mo_ldap_local_custom_attribute_" . strtolower(sanitize_text_field($OG));
$Rv[$Q0] = strtolower($OG);
qC:
$RS++;
$OG = $_POST["mo_ldap_local_custom_attribute_" . $RS . "_name"];
goto qo;
case "mo_ldap_delete_custom_attribute":
$ej = strtolower(sanitize_text_field($_POST["custom_attribute_name"]));
$sy = "mo_ldap_local_custom_attribute_" . $ej;
$fB = unserialize(get_option("mo_ldap_local_custom_attributes"));
unset($fB[$sy]);
if (!is_plugin_active("miniorange-ldap-third-party-integration-add-on/ldap-attributes-to-custom-usermeta.php")) {
goto Ej;
}
$rm = get_option("mo_ldap_attribute_usermeta_mapping");
foreach ($rm as $q_ => $zG) {
if (!(strcasecmp($ej, $zG) == 0)) {
}
unset($rm[$q_]);
update_option("mo_ldap_attribute_usermeta_mapping", $rm);
goto sD;
}
sD:
Ej:
update_option("mo_ldap_local_custom_attributes", serialize(array_unique($fB)));
do_action("mo_ldap_buddypress_update_attribute_mapping", $ej);
update_option("mo_ldap_local_message", "Successfully delete custom attribute: <b>" . $ej . "</b>");
$this->show_success_message();
goto rJ;
case "user_report_logs":
$Jb = get_option("user_logs_table_exists");
$IR = isset($_POST["mo_ldap_local_user_report_log"]) ? $_POST["mo_ldap_local_user_report_log"] : 0;
update_option("mo_ldap_local_user_report_log", $IR);
if (!($IR == 1 && $Jb != 1)) {
goto ZC;
}
$this->prefix_update_table();
ZC:
goto rJ;
case "keep_user_report_logs_on_unistall":
update_option("mo_ldap_local_keep_user_report_log_on_uninstall", isset($_POST["mo_ldap_local_keep_user_report_log"]) ? $_POST["mo_ldap_local_keep_user_report_log"] : 0);
goto rJ;
case "mo_ldap_pass":
$WE = isset($_POST["enable_ldap_login"]) ? 1 : 0;
update_option("mo_ldap_export", $WE);
if ($WE == 1) {
update_option("mo_ldap_local_message", "Service account password will be exported in encrypted fashion");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto HR;
}
update_option("mo_ldap_local_message", "Service account password will not be exported.");
$this->show_error_message();
HR:
goto rJ;
case "mo_ldap_export":
$jJ = get_option("mo_ldap_local_server_url");
if (!empty($jJ)) {
$this->miniorange_ldap_export();
// [PHPDeobfuscator] Implied goto
goto ik;
}
update_option("mo_ldap_local_message", "LDAP Configuration not set. Please configure LDAP Connection settings.");
$this->show_error_message();
ik:
goto rJ;
case "mo_ldap_import":
$o8 = $_FILES["mo_ldap_import_file"]["name"];
$SG = $_FILES["mo_ldap_import_file"]["size"];
$Pl = $_FILES["mo_ldap_import_file"]["tmp_name"];
$RW = $_FILES["mo_ldap_import_file"]["type"];
$RN = strtolower(pathinfo($o8, PATHINFO_EXTENSION));
if ($RN == "json") {
$Ej = file_get_contents($Pl);
$JW = json_decode($Ej, true);
error_log("Started importing uploaded configurations");
if (array_key_exists("ldap_Login", $JW) || array_key_exists("ldap_config", $JW) || array_key_exists("Role_Mapping", $JW) || array_key_exists("Attribute_Mapping", $JW) || array_key_exists("Dirsync_Ldap_To_Wp_Sync", $JW) || array_key_exists("Dirsync_Wp_To_Ldap_sync", $JW)) {
delete_option("mo_ldap_local_custom_attributes");
delete_option("mo_ldap_local_role_mapping_key_array");
delete_option("mo_ldap_local_role_mapping_value_array");
delete_option("mo_ldap_local_server_url_status");
delete_option("mo_ldap_local_service_account_status");
delete_option("mo_ldap_local_user_mapping_status");
delete_option("mo_ldap_local_username_status");
delete_option("mo_ldap_local_role_mapping_group_names");
delete_option("mo_ldap_local_ldap_protocol");
delete_option("mo_ldap_local_ldap_server_address");
delete_option("mo_ldap_local_ldap_port_number");
delete_option("mo_ldap_local_server_password");
delete_option("mo_ldap_local_role_mapping_count");
update_option("mo_ldap_local_enable_login", 0);
update_option("mo_ldap_local_enable_role_mapping", 0);
update_option("mo_ldap_local_enable_attr_mapping", 0);
update_option("mo_ldap_local_enable_update_ldap", 0);
delete_option("mo_ldap_local_enable_both_login");
update_option("mo_ldap_local_register_user", 0);
delete_option("mo_ldap_local_redirect_to");
delete_option("mo_ldap_local_custom_redirect");
update_option("mo_local_filter_check", 0);
update_option("mo_ldap_local_authorized_users_only", 0);
update_option("mo_ldap_local_keep_existing_user_roles", 0);
delete_option("mo_ldap_local_username_attribute");
$E1 = unserialize(Tab_ldap_Class_Names);
$wy = $JW["plugin_version"]["plugin_version"];
foreach ($JW as $zg => $k7) {
$L3 = call_user_func($E1[$zg] . "::getConstants");
foreach ($L3 as $k_ => $n_) {
if (!array_key_exists($k_, $k7)) {
goto lZ;
}
if (!($k_ == "mapping_count")) {
goto Mm;
}
$Bo = $k7[$k_];
Mm:
if ($k_ == "Role_mapping_key") {
if (!empty($wy)) {
goto qk;
}
$Yv = array();
$HZ = 1;
et:
if (!($HZ <= $Bo)) {
update_option("mo_ldap_local_role_mapping_key_raw_array", $Yv);
qk:
goto Kq;
}
$dc = sanitize_text_field($k7[$k_][$HZ]);
$Yv[$n_ . $HZ] = $dc;
$HZ++;
goto et;
}
if ($k_ == "Role_mapped_value") {
if (!empty($wy)) {
goto UD;
}
$Y1 = array();
$HZ = 1;
ae:
if (!($HZ <= $Bo)) {
update_option("mo_ldap_local_role_mapping_value_raw_array", $Y1);
UD:
goto Kq;
}
$dc = sanitize_text_field($k7[$k_][$HZ]);
$Y1[$n_ . $HZ] = $dc;
$HZ++;
goto ae;
}
if ($k_ == "Role_mapping_key_array") {
update_option("mo_ldap_local_role_mapping_key_array", serialize($k7["Role_mapping_key_array"]));
goto Kq;
}
if ($k_ == "Role_mapping_value_array") {
update_option("mo_ldap_local_role_mapping_value_array", serialize($k7["Role_mapping_value_array"]));
goto Kq;
}
if ($k_ == "Role_mapping_group_names") {
update_option("mo_ldap_local_role_mapping_group_names", serialize($k7["Role_mapping_group_names"]));
goto Kq;
}
if ($k_ == "custom_attribute_name") {
$RS = sizeof($k7[$k_]);
$jx = array();
$HZ = 1;
Pc:
if (!($HZ <= $RS)) {
update_option("mo_ldap_local_custom_attributes", serialize(array_unique($jx)));
// [PHPDeobfuscator] Implied goto
goto Kq;
}
$dc = sanitize_text_field($k7[$k_][$HZ]);
$jx["mo_ldap_local_custom_attribute_" . $dc] = $dc;
$HZ++;
goto Pc;
}
$dc = !empty(sanitize_text_field($k7[$k_])) ? sanitize_text_field($k7[$k_]) : $k7[$k_];
if (!($n_ == "mo_ldap_local_server_url" or $n_ == "mo_ldap_local_server_dn" or $n_ == "mo_ldap_local_search_base" or $n_ == "mo_ldap_local_search_filter" or $n_ == "mo_ldap_local_username_attribute")) {
goto In;
}
if ($n_ == "mo_ldap_local_username_attribute") {
if (!empty($wy)) {
goto kW;
}
$iI = explode(";", $dc);
$W5 = array("samaccountname", "mail", "userprincipalname", "uid", "cn");
$dc = array();
$by = '';
foreach ($iI as $k_ => $Y5) {
if (in_array(strtolower($Y5), $W5)) {
array_push($dc, strtolower($Y5));
// [PHPDeobfuscator] Implied goto
goto lx;
}
$by = $by . "," . strtolower($Y5);
lx:
}
if (!($by != '')) {
goto ip;
}
$by = trim($by, ",");
update_option("mo_ldap_local_extra_user_attribute", $by);
array_push($dc, "extraUserAttribute");
// [PHPDeobfuscator] Implied goto
goto ip;
}
$dc = Mo_Ldap_Local_Util::encrypt($dc);
ip:
kW:
In:
update_option($n_, $dc);
Kq:
lZ:
}
}
if (!empty($wy)) {
goto Df;
}
error_log("Importing changes for Version 23.0 and below");
$x3 = Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_server_url"));
$mX = "/[:]/";
$x3 = str_replace("//", '', $x3);
$Rd = preg_split($mX, $x3);
update_option("mo_ldap_local_ldap_protocol", $Rd[0]);
update_option("mo_ldap_local_ldap_server_address", Mo_Ldap_Local_Util::encrypt($Rd[1]));
update_option("mo_ldap_local_ldap_port_number", $Rd[2]);
$W0 = get_option("mo_ldap_local_role_mapping_key_raw_array");
$FS = get_option("mo_ldap_local_role_mapping_value_raw_array");
delete_option("mo_ldap_local_role_mapping_key_raw_array");
delete_option("mo_ldap_local_role_mapping_value_raw_array");
$Zf = array();
$HZ = 1;
AC:
if (!($HZ <= $Bo)) {
$Pu = count($Zf);
update_option("mo_ldap_local_role_mapping_count", $Pu);
$d8 = array();
$O2 = array();
$H4 = array();
$HZ = 1;
$cy = "/[=,]/";
foreach ($Zf as $k_ => $dc) {
$d8["mo_ldap_local_mapping_key_" . $HZ] = $k_;
$O2["mo_ldap_local_mapping_value_" . $HZ] = $dc;
$ly = preg_split($cy, $k_);
$H4[$HZ] = $ly[1];
$HZ++;
}
update_option("mo_ldap_local_role_mapping_key_array", serialize($d8));
update_option("mo_ldap_local_role_mapping_value_array", serialize($O2));
update_option("mo_ldap_local_role_mapping_group_names", serialize($H4));
Df:
$cq = get_option("mo_ldap_local_username_attribute");
if (!empty($cq)) {
goto SS;
}
update_option("mo_local_filter_check", 1);
SS:
update_option("mo_ldap_local_message", "The file was imported successfully");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto x3;
}
if (empty($Zf[$W0["mo_ldap_local_mapping_key_" . $HZ]])) {
$Zf[$W0["mo_ldap_local_mapping_key_" . $HZ]] = array($FS["mo_ldap_local_mapping_value_" . $HZ]);
// [PHPDeobfuscator] Implied goto
goto Qb;
}
$iH = $Zf[$W0["mo_ldap_local_mapping_key_" . $HZ]];
array_push($iH, $FS["mo_ldap_local_mapping_value_" . $HZ]);
$Zf[$W0["mo_ldap_local_mapping_key_" . $HZ]] = $iH;
Qb:
$HZ++;
goto AC;
}
update_option("mo_ldap_local_message", "Incorrect file uploaded! Please upload the file that was exported from this plugin");
$this->show_error_message();
goto x3;
}
update_option("mo_ldap_local_message", "Incorrect file uploaded! Please upload the file that was exported from this plugin");
$this->show_error_message();
x3:
goto rJ;
case "mo_ldap_local_login_send_query":
$e4 = sanitize_text_field($_POST["query"]);
$qo = sanitize_text_field($_POST["query_email"]);
$Ey = sanitize_text_field($_POST["query_phone"]);
$gq = Jp_hwfrqar_mzwhwzl_arvowfra::wa_zvweh_fmazpbrv();
if ($gq) {
$e4 = "[WP LDAP for Intranet (Free Trial single site)]: " . $e4;
// [PHPDeobfuscator] Implied goto
goto uo;
}
$e4 = "[WP LDAP for Intranet (Premium single site)]: " . $e4;
uo:
$this->mo_ldap_send_query($qo, $Ey, $e4);
goto rJ;
case "mo_ldap_login_send_query":
$qo = sanitize_text_field($_POST["inner_form_email_id"]);
$Ey = sanitize_text_field($_POST["inner_form_phone_id"]);
$e4 = sanitize_text_field($_POST["inner_form_query_id"]);
$C3 = get_option("mo_ldap_directory_server_value");
if (strcasecmp($C3, "msad") == 0) {
$C3 = "Microsoft Active Directory";
goto vE;
}
if (strcasecmp($C3, "openldap") == 0) {
$C3 = "OpenLDAP";
goto vE;
}
if (strcasecmp($C3, "freeipa") == 0) {
$C3 = "FreeIPA";
goto vE;
}
if (strcasecmp($C3, "jumpcloud") == 0) {
$C3 = "JumpCloud";
goto vE;
}
if (strcasecmp($C3, "other") == 0) {
$C3 = get_option("mo_ldap_directory_server_custom_value");
// [PHPDeobfuscator] Implied goto
goto vE;
}
$C3 = "Not Configured";
vE:
update_option("mo_ldap_local_directory_server", $C3);
$cB = $_POST["export_configuration_choice"];
if ($cB == "yes") {
$XX = $this->auto_email_ldap_export();
$XX = implode(" <br>", $XX);
$e4 = $e4 . " ,<br><br>Plugin Configuration:<br> " . $XX;
goto dw;
}
if ($cB == "no") {
$XX = "Configuration was not uploaded by user";
$e4 = $e4 . " ,<br><br>Plugin Configuration:<br> " . $XX;
// [PHPDeobfuscator] Implied goto
goto dw;
}
dw:
$gq = Jp_hwfrqar_mzwhwzl_arvowfra::wa_zvweh_fmazpbrv();
if ($gq) {
$e4 = "[WP LDAP for Intranet (Free Trial single site)]: " . $e4;
// [PHPDeobfuscator] Implied goto
goto Wa;
}
$e4 = "[WP LDAP for Intranet (Premium single site)]: " . $e4;
Wa:
$this->mo_ldap_send_query($qo, $Ey, $e4);
goto rJ;
case "mo_ldap_login_send_feature_request_query":
$qo = sanitize_text_field($_POST["query_email"]);
$Ey = sanitize_text_field($_POST["query_phone"]);
$e4 = sanitize_text_field($_POST["query"]);
$gq = Jp_hwfrqar_mzwhwzl_arvowfra::wa_zvweh_fmazpbrv();
if ($gq) {
$e4 = "[WP LDAP for Intranet (Free Trial single site)]: " . $e4;
// [PHPDeobfuscator] Implied goto
goto lG;
}
$e4 = "[WP LDAP for Intranet (Premium single site)]: " . $e4;
lG:
$this->mo_ldap_send_query($qo, $Ey, $e4);
goto rJ;
case "mo_ldap_local_fallback_login":
update_option("mo_ldap_local_enable_fallback_login", isset($_POST["mo_ldap_local_enable_fallback_login"]) ? $_POST["mo_ldap_local_enable_fallback_login"] : 0);
update_option("mo_ldap_local_message", "Fallback login using WordPress password enabled");
$this->show_success_message();
goto rJ;
case "mo_ldap_save_restrict_login_by_role":
$dm = isset($_POST["mo_ldap_local_restrict_user_by_role"]) ? $_POST["mo_ldap_local_restrict_user_by_role"] : 0;
update_option("mo_ldap_enable_role_restriction", $dm);
$rs = empty($_POST["mo_ldap_restrict_role"]) ? array() : $_POST["mo_ldap_restrict_role"];
update_option("mo_ldap_restricted_login_roles", serialize($rs));
goto rJ;
}
rJ:
Nr:
if (!(isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_feedback") == 0)) {
goto dJ;
}
$user = wp_get_current_user();
$hW = "Query :[WordPress LDAP/AD Plugin:] Plugin Deactivated: ";
$Tl = array_key_exists("query_feedback", $_POST) ? sanitize_textarea_field(wp_unslash($_POST["query_feedback"])) : false;
$es = '';
if (!isset($_POST["get_reply"])) {
goto Wv;
}
$es = sanitize_text_field(wp_unslash($_POST["get_reply"]));
Wv:
if (empty($es)) {
$es = "NO";
$hW .= "<strong><span style=\"color: red;\">[Follow up Needed : NO]</strong></span><br> ";
// [PHPDeobfuscator] Implied goto
goto EZ;
}
$es = "YES";
$hW .= "<strong><span style=\"color: green;\">[Follow up Needed : YES]</strong></span><br>";
EZ:
if (empty($Tl)) {
goto k8;
}
$hW .= "<br>Feedback : " . $Tl . "<br>";
k8:
$j9 = !empty(get_option("mo_ldap_plugin_version")) ? get_option("mo_ldap_plugin_version") : "26.0.1";
$hW .= "<br>Current Version Installed : " . $j9 . "<br>";
if (!isset($_POST["rate"])) {
goto eI;
}
$QP = sanitize_text_field(wp_unslash($_POST["rate"]));
$hW .= "<br>[Rating : " . $QP . "]<br>";
eI:
$qo = isset($_POST["query_mail"]) ? sanitize_email(wp_unslash($_POST["query_mail"])) : '';
$ar = "WordPress LDAP/AD Plugin Feedback (Premium Plugin)- " . $qo;
if (filter_var($qo, FILTER_VALIDATE_EMAIL)) {
goto RA;
}
$qo = get_option("mo_ldap_local_admin_email");
if (!empty($qo)) {
goto QA;
}
$qo = $user->user_email;
QA:
RA:
$Q2 = isset($_POST["company"]) ? sanitize_text_field(wp_unslash($_POST["company"])) : '';
$EW = new Mo_Ldap_Local_Customer();
if (is_null($EW)) {
dJ:
if (!(isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_skip_feedback") == 0)) {
goto aD;
}
deactivate_plugins(__DIR__."/input.php");
update_option("mo_ldap_local_message", "Plugin deactivated successfully.");
$this->deactivate_error_message();
aD:
// [PHPDeobfuscator] Implied return
return;
}
$Qa = json_decode($EW->send_email_alert($ar, $qo, $hW, $Q2), true);
if (!(json_last_error() === JSON_ERROR_NONE)) {
goto og;
}
if (is_array($Qa) && array_key_exists("status", $Qa) && strcasecmp($Qa["status"], "ERROR") === 0) {
update_option("mo_ldap_local_message", $Qa["message"]);
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto Uj;
}
if ($Qa) {
goto sQ;
}
update_option("mo_ldap_local_message", "Error while submitting the query.");
$this->show_error_message();
sQ:
Uj:
og:
deactivate_plugins(__DIR__."/input.php");
update_option("mo_ldap_local_message", "Thank you for the feedback.");
$this->show_success_message();
wp_safe_redirect("plugins.php");
exit;
}
function mo_ldap_send_query($qo, $Ey, $e4)
{
if (Mo_Ldap_Local_Util::check_empty_or_null($qo) || Mo_Ldap_Local_Util::check_empty_or_null($e4)) {
update_option("mo_ldap_local_message", "Please submit your query along with email.");
$this->show_error_message();
return;
}
$cp = new Mo_Ldap_Local_Customer();
$Qa = json_decode($cp->submit_contact_us($qo, $Ey, $e4), true);
if (isset($Qa["status"]) && strcasecmp($Qa["status"], "CURL_ERROR") == 0) {
update_option("mo_ldap_local_message", $Qa["statusMessage"]);
$this->show_error_message();
goto Jb;
}
if (json_last_error() == JSON_ERROR_NONE) {
if ($Qa == false) {
update_option("mo_ldap_local_message", "Your query could not be submitted. Please try again.");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto US;
}
update_option("mo_ldap_local_message", "Thanks for getting in touch! We shall get back to you shortly.");
$this->show_success_message();
goto US;
}
US:
Jb:
}
function miniorange_ldap_export()
{
if (!(array_key_exists("option", $_POST) && $_POST["option"] == "mo_ldap_export")) {
// [PHPDeobfuscator] Implied return
return;
}
$s0 = get_option("active_plugins");
$jf = in_array("directory_sync/directory_sync.php", $s0);
$dn = array("Dirsync_Ldap_To_Wp_Sync" => "mo_option_ldap_dirsync_ldap_to_wp_sync", "Dirsync_Wp_To_Ldap_sync" => "mo_option_ldap_dirsync_wp_to_ldap_sync");
$E1 = unserialize(Tab_ldap_Class_Names);
$VA = get_option("mo_dirsync_ldap_to_wp_config_done");
$jv = get_option("mo_dirsync_wp_to_ldap_config_done");
if (!$jf) {
foreach ($dn as $Wu => $n_) {
if (!array_key_exists($Wu, $E1)) {
goto Nm;
}
unset($E1[$Wu]);
Nm:
}
// [PHPDeobfuscator] Implied goto
goto Tv;
}
if ($VA) {
goto fl;
}
if (!array_key_exists("Dirsync_Ldap_To_Wp_Sync", $E1)) {
goto hu;
}
unset($E1["Dirsync_Ldap_To_Wp_Sync"]);
hu:
fl:
if ($jv) {
goto L0;
}
if (!array_key_exists("Dirsync_Wp_To_Ldap_sync", $E1)) {
goto VB;
}
unset($E1["Dirsync_Wp_To_Ldap_sync"]);
VB:
L0:
Tv:
$JW = array();
foreach ($E1 as $k_ => $dc) {
$JW[$k_] = $this->mo_get_configuration_array($dc);
}
header("Content-Disposition: attachment; filename=miniorange-ldap-config.json");
echo json_encode($JW, "JSON_U^EWWY_UV__\ASHES");
exit;
}
function mo_get_configuration_array($HM)
{
$L3 = call_user_func($HM . "::getConstants");
$Bo = get_option("mo_ldap_local_role_mapping_count");
$yz = array();
$is = array();
$oL = array();
$b9 = array();
foreach ($L3 as $k_ => $dc) {
if ($dc == "mo_ldap_local_server_url" or $dc == "mo_ldap_local_server_password" or $dc == "mo_ldap_local_server_dn" or $dc == "mo_ldap_local_search_base" or $dc == "mo_ldap_local_search_filter" or $dc == "mo_ldap_local_username_attribute") {
$Yj = 1;
// [PHPDeobfuscator] Implied goto
goto Yb;
}
$Yj = 0;
Yb:
if ($dc == "mo_ldap_local_mapping_key_") {
$B4 = unserialize(get_option("mo_ldap_local_role_mapping_key_array"));
$HZ = 1;
F1:
if (!($HZ <= $Bo)) {
$Sf = $is;
goto TN;
}
$is[$HZ] = $B4[$dc . $HZ];
$HZ++;
goto F1;
}
if ($dc == "mo_ldap_local_mapping_value_") {
$st = unserialize(get_option("mo_ldap_local_role_mapping_value_array"));
$HZ = 1;
i9:
if (!($HZ <= $Bo)) {
$Sf = $oL;
goto TN;
}
$oL[$HZ] = $st[$dc . $HZ];
$HZ++;
goto i9;
}
if ($dc == "mo_ldap_local_custom_attribute_") {
$Rv = unserialize(get_option("mo_ldap_local_custom_attributes"));
$HZ = 1;
foreach ($Rv as $Pt => $dc) {
$b9[$HZ++] = $dc;
}
$Sf = $b9;
// [PHPDeobfuscator] Implied goto
goto TN;
}
$Sf = get_option($dc);
TN:
if (!$Sf) {
goto wb;
}
if (!(@unserialize(strval($Sf)) !== false)) {
goto mE;
}
$Sf = unserialize(strval($Sf));
mE:
if ($Yj == 1) {
if ($dc == "mo_ldap_local_server_password" and get_option("mo_ldap_export") == "0") {
goto c0;
}
if ($dc == "mo_ldap_local_server_password" and get_option("mo_ldap_export") == "1") {
$yz[$k_] = $Sf;
goto X8;
}
if ($k_ == "user_attr") {
$yz[$k_] = $Sf;
// [PHPDeobfuscator] Implied goto
goto X8;
}
$yz[$k_] = Mo_Ldap_Local_Util::decrypt($Sf);
goto X8;
}
if ($dc == "mo_ldap_local_ou_role_mapping_options" || $dc == "mo_ldap_restricted_login_roles") {
$yz[$k_] = serialize($Sf);
// [PHPDeobfuscator] Implied goto
goto f1;
}
$yz[$k_] = $Sf;
f1:
X8:
wb:
c0:
}
return $yz;
}
function auto_email_ldap_export()
{
$lC = get_option("mo_ldap_local_directory_server");
$tH = get_option("mo_ldap_local_server_url") ? Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_server_url")) : '';
$Jo = get_option("mo_ldap_local_server_dn") ? Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_server_dn")) : '';
$yU = get_option("mo_ldap_local_search_base") ? Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_search_base")) : '';
$If = get_option("mo_ldap_local_search_filter") ? Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_search_filter")) : '';
$XX = array("Directory Server" => "Directory Server: " . $lC, "LDAP Server" => "LDAP Server: " . $tH, "Service Account DN" => "Service Account DN: " . $Jo, "Search Base" => "Search Base: " . $yU, "LDAP Search Filter" => "LDAP Search Filter: " . $If);
return $XX;
}
function test_attribute_configuration()
{
$eV = apply_filters("mo_check_config", '');
if (!(is_user_logged_in() && $eV)) {
goto LW;
}
if (!(current_user_can("administrator") && isset($_REQUEST["option"]))) {
goto i0;
}
if ($_REQUEST["option"] == "testattrconfig") {
$Dv = $_REQUEST["user"];
$gi = new Mo_Ldap_Local_Config();
$gi->test_attribute_configuration($Dv);
goto SZ;
}
if ($_REQUEST["option"] == "testrolemappingconfig") {
$Dv = $_REQUEST["user"];
$Y9 = new Mo_Ldap_Local_Role_Mapping();
$Y9->test_configuration($Dv);
goto SZ;
}
if ($_REQUEST["option"] == "searchbaselist") {
$gi = new Mo_Ldap_Local_Config();
$gi->show_search_bases_list();
goto SZ;
}
if ($_REQUEST["option"] == "fecthattributesforldapserver") {
$lC = get_option("mo_ldap_directory_server_value");
$oR = new DirectoryFactory();
$oR = $oR->selectDirectorySystem($lC);
$gi = new Mo_Ldap_Local_Config();
$gi->show_all_ldap_attributes($oR);
// [PHPDeobfuscator] Implied goto
goto SZ;
}
SZ:
i0:
LW:
}
function save_success_customer_config($Ij, $u4, $no, $hW)
{
update_option("mo_ldap_local_admin_customer_key", $Ij);
update_option("mo_ldap_local_admin_api_key", $u4);
update_option("mo_ldap_local_customer_token", $no);
update_option("mo_ldap_local_password", '');
update_option("mo_ldap_local_message", $hW);
$this->show_success_message();
}
function mo_ldap_local_settings_style()
{
wp_enqueue_style("mo_ldap_admin_settings_style", plugins_url("includes/css/style_settings.min.css", __DIR__."/input.php"), array(), "26.0.1");
wp_enqueue_style("mo_ldap_admin_settings_phone_style", plugins_url("includes/css/phone.min.css", __DIR__."/input.php"), array(), "26.0.1");
wp_enqueue_style("mo_ldap_admin_ldap_plugin_style", plugins_url("includes/css/mo_ldap_plugins_page.min.css", __DIR__."/input.php"), array(), "26.0.1");
wp_enqueue_style("mo_ldap_admin_font_awsome", plugins_url("includes/fonts/css/font-awesome.min.css", __DIR__."/input.php"), array(), "26.0.1");
}
function mo_ldap_local_settings_script()
{
wp_enqueue_script("mo_ldap_admin_settings_phone_script", plugins_url("includes/js/phone.js", __DIR__."/input.php"), array(), "26.0.1", false);
wp_enqueue_script("mo_ldap_admin_settings_script", plugins_url("includes/js/settings_page.js", __DIR__."/input.php"), array("jquery"), "26.0.1", false);
}
private function deactivate_error_message()
{
$oz = "error";
$hW = get_option("mo_ldap_local_message");
$tO = array("a" => array("href" => array(), "title" => array()), "br" => array(), "em" => array(), "strong" => array(), "b" => array(), "h1" => array(), "h2" => array(), "h3" => array(), "h4" => array(), "h5" => array(), "h6" => array(), "i" => array());
echo "<div id='error' class='" . esc_attr($oz) . "'> <p>" . wp_kses($hW, $tO) . "</p></div>";
}
function error_message()
{
$oz = "error";
$hW = get_option("mo_ldap_local_message");
echo "<div id='error' class='error'> <p>" . $hW . "</p></div>";
}
function success_message()
{
$oz = "updated";
$hW = get_option("mo_ldap_local_message");
echo "<div id='success' class='updated'> <p>" . $hW . "</p></div>";
}
function show_success_message()
{
remove_action("admin_notices", array($this, "error_message"));
add_action("admin_notices", array($this, "success_message"));
}
function show_error_message()
{
remove_action("admin_notices", array($this, "success_message"));
add_action("admin_notices", array($this, "error_message"));
}
function prefix_update_table()
{
global $uP;
global $wpdb;
$mx = $wpdb->get_charset_collate();
$gL = "CREATE TABLE if not exists`{$wpdb->base_prefix}user_report` (
id int NOT NULL AUTO_INCREMENT,
user_name varchar(50) NOT NULL,
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
Ldap_status varchar(250) NOT NULL,
Ldap_error varchar(250) ,
PRIMARY KEY (id)
) {$mx};";
if (!function_exists("dbDelta")) {
require_once "ABSPATHwp-admin/includes/upgrade.php";
}
dbDelta($gL);
update_option("user_logs_table_exists", 1);
}
function mo_ldap_report_update($Dv, $o4, $AJ)
{
$YO = get_option("mo_ldap_local_user_report_log");
if (!($YO == 1)) {
goto co;
}
global $wpdb;
$Vo = $wpdb->prefix . "user_report";
$oj = $wpdb->get_row("SELECT id FROM {$Vo} WHERE user_name ='" . $Dv . "'");
$wpdb->insert($Vo, array("user_name" => $Dv, "time" => current_time("mysql"), "Ldap_status" => $o4, "Ldap_error" => $AJ));
co:
}
function mo_ldap_activate()
{
update_option("mo_ldap_local_host_name", "https://login.xecurify.com");
update_option("mo_ldap_local_register_user", 1);
$Zx = new DateTime("now");
$dU = $Zx->getTimestamp();
wp_schedule_event($dU, "daily", "mo_ldap_local_license_sync");
Jp_hwfrqar_mzwhwzl_arvowfra::efzwoezr_mzwhwzl();
}
function mo_ldap_local_deactivate()
{
do_action("flushcache");
Jp_hwfrqar_mzwhwzl_arvowfra::jrefzwoezr_mzwhwzl();
delete_option("mo_ldap_local_admin_email");
delete_option("mo_ldap_local_host_name");
delete_option("mo_ldap_local_default_config");
delete_option("mo_ldap_local_password");
delete_option("mo_ldap_local_admin_phone");
delete_option("mo_ldap_local_admin_customer_key");
delete_option("mo_ldap_local_admin_api_key");
delete_option("mo_ldap_local_customer_token");
delete_option("mo_ldap_local_message");
delete_option("mo_ldap_local_enable_login");
delete_option("mo_ldap_local_license_key");
delete_option("mo_ldap_local_license_verified");
delete_option("mo_ldap_plugin_version");
delete_option("mo_ldap_show_groups");
wp_clear_scheduled_hook("mo_ldap_local_license_sync");
}
function mo_ldap_local_license_sync()
{
$ho = !empty(get_option("mo_ldap_local_license_key")) ? Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_license_key")) : '';
if (empty($ho)) {
goto aW;
}
$D8 = new Mo_Ldap_Local_Customer();
$yq = json_decode($D8->XfskodsfhHJ($ho), true);
$nH = Jp_hwfrqar_mzwhwzl_arvowfra::bp_myjezr_hwfrqar_mzwhwzl($yq);
aW:
}
function update_status()
{
$wZ = get_option("mo_ldap_local_license_key");
if (empty($wZ)) {
goto CS;
}
$D8 = new Mo_Ldap_Local_Customer();
$D8->mo_ldap_local_update_status();
CS:
}
}
new Mo_Ldap_Local_Login();
?>
Did this file decode correctly?
Original Code
<?php
/*
Plugin Name: LDAP/Active Directory Login for Intranet Sites
Plugin URI: http://miniorange.com
Description: LDAP/Active Directory Login Plugin provides login to WordPress using credentials stored in your LDAP Server.
Author: miniOrange
Version: 26.0.1
Author URI: http://miniorange.com
*/
require_once "mo_ldap_pages.php";
require "mo_ldap_support.php";
require "class-mo-ldap-customer-setup.php";
require "class-mo-ldap-utility.php";
require "class-mo-ldap-config.php";
require "class-mo-ldap-role-mapping.php";
require "mo_ldap_licensing_plans.php";
require_once "mo-utility-framework.php";
require_once "mo-ldap-feedback-form.php";
require_once "mo-ldap-intranet-version-update.php";
require_once __DIR__."/includes/lib/export.php";
require_once __DIR__."/Directories/DirectoryFactory.php";
define("Tab_ldap_Class_Names", serialize(array("ldap_Login" => "mo_options_ldap_acc_details", "ldap_config" => "mo_options_ldap_config_details", "Role_Mapping" => "mo_option_ldap_role_mapping", "Attribute_Mapping" => "mo_options_ldap_enum_attribute_mapping", "Dirsync_Ldap_To_Wp_Sync" => "mo_option_ldap_dirsync_ldap_to_wp_sync", "Dirsync_Wp_To_Ldap_sync" => "mo_option_ldap_dirsync_wp_to_ldap_sync", "plugin_version" => "mo_plugin_info")));
error_reporting(E_ERROR);
class Mo_Ldap_Local_Login
{
function __construct()
{
$oc = 7;
add_action("admin_menu", array($this, "mo_ldap_local_login_widget_menu"));
add_action("admin_init", array($this, "login_widget_save_options"));
add_action("init", array($this, "test_attribute_configuration"));
add_action("admin_enqueue_scripts", array($this, "mo_ldap_local_settings_style"));
add_action("admin_enqueue_scripts", array($this, "mo_ldap_local_settings_script"));
$Ab = get_option("mo_ldap_local_enable_update_ldap");
if (!($Ab == 1)) {
goto t_;
}
add_action("profile_update", array($this, "update_profile"), 10, 2);
t_:
$uy = !empty(get_option("mo_ldap_plugin_version")) ? get_option("mo_ldap_plugin_version") : "none";
if (!(strcasecmp($uy, "26.0.1") != 0)) {
goto QY;
}
Mo_Ldap_Local_Util::bp_hjey_hpfeh_dy_mysvejr($uy);
update_option("mo_ldap_plugin_version", "26.0.1");
QY:
remove_action("admin_notices", array($this, "success_message"));
remove_action("admin_notices", array($this, "error_message"));
register_deactivation_hook(__DIR__."/input.php", array($this, "mo_ldap_local_deactivate"));
add_action("show_user_profile", array($this, "show_user_profile"));
add_action("edit_user_profile", array($this, "show_user_profile"));
$WY = get_option("mo_ldap_local_authorized_users_only");
if (!($WY == 1)) {
goto NC;
}
add_action("wp", array($this, "mo_ldap_local_login_redirect"));
NC:
if (!in_array("next-active-directory-integration/index.php", (array) get_option("active_plugins", array()), true)) {
goto Y_;
}
$oc = 20;
Y_:
$YC = get_option("mo_ldap_local_enable_login");
if (!($YC == 1)) {
goto dR;
}
remove_filter("authenticate", "wp_authenticate_username_password", 20, 3);
add_filter("authenticate", array($this, "ldap_login"), $oc, 3);
add_filter("login_redirect", array($this, "mo_ldap_local_custom_redirect"), 10, 3);
dR:
register_activation_hook(__DIR__."/input.php", array($this, "mo_ldap_activate"));
add_action("mo_ldap_local_license_sync", array($this, "mo_ldap_local_license_sync"));
add_action("flushcache", array($this, "update_status"), 10, 3);
add_filter("mo_check_config", array($this, "bp_srz_fpqtws_azezma"));
$gq = Jp_hwfrqar_mzwhwzl_arvowfra::wa_zvweh_fmazpbrv();
if (!$gq) {
goto vo;
}
add_action("admin_footer", array($this, "ldap_feedback_request"));
vo:
}
public function ldap_feedback_request()
{
display_ldap_feedback_form();
}
function mo_ldap_local_custom_redirect($IA, $Cf, $user)
{
$p4 = get_option("mo_ldap_local_redirect_to");
if (!(isset($user->roles) && is_array($user->roles))) {
goto Hf;
}
if (in_array("administrator", $user->roles)) {
return $IA;
}
if ($p4) {
if ($p4 == "homepage") {
$IA = home_url();
goto Pn;
}
if ($p4 == "profile") {
$R8 = home_url() . "/wp-admin/profile.php";
$IA = $R8;
goto Pn;
}
if ($p4 == "custom") {
$ph = get_option("mo_ldap_local_custom_redirect");
$IA = $ph;
// [PHPDeobfuscator] Implied goto
goto Pn;
}
goto Pn;
}
Pn:
Hf:
return $IA;
}
function mo_ldap_local_login_redirect()
{
$yH = get_queried_object_id();
$o5 = rtrim(get_permalink($yH), "/");
$Pb = !empty(get_option("mo_ldap_public_pages_list")) ? unserialize(get_option("mo_ldap_public_pages_list")) : array();
if (!(empty(get_option("mo_ldap_public_pages_enable")) || !in_array(strtolower($o5), $Pb))) {
goto Rs;
}
if (is_user_logged_in()) {
goto yL;
}
auth_redirect();
yL:
Rs:
}
function bp_srz_fpqtws_azezma($dc)
{
if (!(strcasecmp(Jp_hwfrqar_mzwhwzl_arvowfra::bp_mzwhwzl_azeza($dc), "verified") == 0)) {
return false;
}
return true;
}
function show_user_profile($user)
{
$Rv = unserialize(get_option("mo_ldap_local_custom_attributes"));
echo "\t\t<h3>Extra profile information</h3>\r\n\r\n\t\t<table class=\"form-table\">\r\n\r\n\t\t\t<tr>\r\n\t\t\t\t<td><b><label for=\"user_dn\">User DN</label></b></td>\r\n\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<b>";
echo esc_attr(get_the_author_meta("mo_ldap_user_dn", $user->ID));
echo "</b></td>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t";
if (!get_the_author_meta("mo_ldap_user_phone", $user->ID)) {
goto od;
}
echo "\t\t\t\t<tr>\r\n\t\t\t\t\t<td><b><label for=\"user_phone\">User Phone Number</label></b></td>\r\n\r\n\t\t\t\t\t<td>\r\n\t\t\t\t\t\t<b>";
echo esc_attr(get_the_author_meta("mo_ldap_user_phone", $user->ID));
echo "</b>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t";
od:
foreach ($Rv as $Pt => $dc) {
$hY = get_user_meta($user->ID, $Pt, true);
if (empty($hY)) {
goto Fj;
}
echo "\t\t\t\t\t<tr>\r\n\t\t\t\t\t<td><b><font color=\"#FF0000\"></font>";
echo $dc;
echo "</b></td>\r\n\t\t\t\t\t";
if (is_array($hY)) {
echo "<td>";
foreach ($hY as $Qz) {
echo "<b>" . $Qz . "</b><br>";
}
echo "</td>";
// [PHPDeobfuscator] Implied goto
goto Eb;
}
echo "<td>";
echo "<b>" . $hY . "</b><br>";
echo "</td>";
Eb:
echo "\t\t\t\t\t</tr>\r\n\t\t\t\t\t";
Fj:
}
echo "\t\t</table>\r\n\r\n\t\t";
}
function update_profile($fM, $xD = null)
{
$eV = apply_filters("mo_check_config", '');
if (!$eV) {
goto fX;
}
$Rv = unserialize(get_option("mo_ldap_local_custom_attributes"));
$o7 = array();
foreach ($Rv as $Pt => $dc) {
if (!isset($_POST[$dc])) {
goto DM;
}
$o7[$dc] = $_POST[$dc];
DM:
}
$user = get_userdata($fM);
$gi = new Mo_Ldap_Local_Config();
$gi->modify_user_info_in_ldap($user, $o7);
fX:
}
function ldap_login($user, $Dv, $oV)
{
$eV = apply_filters("mo_check_config", '');
$Mz = get_option("active_plugins");
if (!in_array("miniorange-customize-wp-ldap-login-screen-add-on/add_login_message.php", $Mz)) {
goto FF;
}
add_filter("login_message", "add_login_messages");
function add_login_messages($hW)
{
$tk = get_option("mo_ldap_login_messages");
foreach ($tk as $ls) {
$hW = $hW . "<p name='custom-login-message' id='custom-login-message' style='margin-top: 20px;margin-left: 0;padding: 8px 8px 8px;font-weight: 200;overflow: hidden;background: #fff;border: 4px solid #fff;box-shadow: 0 1px 3px rgba(0,0,0,.04);border-left-color: " . $ls["color"] . ";border-top: none;border-bottom: none;'><strong>" . $ls["message"] . "</strong></p>";
}
$hW .= "<br>";
return $hW;
}
FF:
$KO = get_option("mo_ldap_enable_user_session_sync");
if ($KO && in_array("miniorange-terminate-ldap-user-session-on-password-update-add-on/terminate_ldap_user_session_sync.php", $Mz)) {
$uU = true;
// [PHPDeobfuscator] Implied goto
goto j0;
}
$uU = false;
j0:
error_log("Value for LDAP PWD sync : " . $uU);
if (!(empty($Dv) || empty($oV))) {
$s1 = get_option("mo_ldap_local_enable_both_login");
$gi = new Mo_Ldap_Local_Config();
$j0 = $gi->authenticate_ldap_user($Dv, $oV);
if ($j0->statusCode == "LDAP_BIND_SUCCESS_USER_EXISTS" && $eV) {
$VF = get_option("mo_ldap_enable_ultimate_member_login");
$ZM = get_option("mo_ldap_enable_ultimate_member_profile");
$Ie = $j0->profileAttributesList;
$qo = $Ie["mail"];
if (username_exists($Dv) || email_exists($Dv) || username_exists($qo) || email_exists($qo)) {
$NN = strtolower(get_option("mo_ldap_local_email_attribute"));
$user = false;
if (username_exists($Dv)) {
$user = get_user_by("login", $Dv);
goto Zh;
}
if (email_exists($Dv)) {
$user = get_user_by("email", $Dv);
goto Zh;
}
if (isset($Ie[$NN]) && email_exists($Ie[$NN])) {
$user = get_user_by("email", $Ie[$NN]);
// [PHPDeobfuscator] Implied goto
goto Zh;
}
Zh:
if ($user) {
if (!($uU == true)) {
goto oW;
}
error_log("saving user meta key");
update_user_meta($user->ID, "mo_ldap_user_session_key", Mo_Ldap_Local_Util::encrypt($oV));
oW:
$gi->fetch_or_update_user_attributes($user, $j0);
$user = get_user_by("id", $user->ID);
if (!($ZM == 1)) {
goto ua;
}
delete_option("um_cache_userdata_{$user->ID}");
ua:
if ($VF == 1) {
wp_set_auth_cookie($user->ID, false);
apply_filters("login_redirect", null, null, $user);
// [PHPDeobfuscator] Implied goto
goto qR;
}
$z5 = get_option("mo_ldap_enable_role_restriction");
if (!$z5) {
ee:
return $user;
}
$xY = new Mo_Ldap_Local_Role_Mapping();
$xm = $xY->mo_ldap_is_user_login_restricted($user->roles);
if (!$xm) {
goto ee;
}
$GB = new WP_Error();
$GB->add("UNKNOWN_ERROR", __("<strong>ERROR</strong>: You are not allowed to Login. Please contact your administrator"));
return $GB;
}
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error:</strong> Invalid Username/Password combination");
goto WM;
}
$Ii = get_option("mo_ldap_local_register_user");
if (!$Ii) {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error:</strong> Your Administrator has not enabled Auto Registration. Please contact your Administrator.");
$GB = new WP_Error();
$GB->add("registration_disabled_error", __("<strong>ERROR</strong>: Your Administrator has not enabled Auto Registration. Please contact your Administrator."));
return $GB;
}
$E0 = get_option("mo_ldap_local_enable_fallback_login");
$uO = wp_generate_password(10, false);
$qo = '';
$fv = '';
$eO = '';
$bC = '';
$Ey = '';
$WD = get_option("mo_ldap_local_enable_attr_mapping");
if (!($WD == 1)) {
goto Ov;
}
$qT = strtolower(get_option("mo_ldap_local_fname_attribute"));
$yB = strtolower(get_option("mo_ldap_local_lname_attribute"));
$NN = strtolower(get_option("mo_ldap_local_email_attribute"));
$RA = strtolower(get_option("mo_ldap_local_phone_attribute"));
$jd = strtolower(get_option("mo_ldap_local_nickname_attribute"));
$qo = $Ie[$NN];
$fv = $Ie[$qT];
$eO = $Ie[$yB];
$bC = $Ie[$jd];
$Ey = $Ie[$RA];
Ov:
$UU = array("user_login" => $Dv, "user_email" => $qo, "first_name" => $fv, "last_name" => $eO, "nickname" => $bC, "user_pass" => $uO);
if (!($WD == 1)) {
goto MA;
}
if (empty($bC)) {
goto dm;
}
$UU["nickname"] = $bC;
dm:
$tY = get_option("mo_ldap_local_display_name_attribute");
if (empty($tY)) {
goto zw;
}
if ($tY == "nickname" && !empty($bC)) {
$UU["display_name"] = $bC;
goto rb;
}
if ($tY == "email") {
$UU["display_name"] = $qo;
goto rb;
}
if ($tY == "firstname") {
$UU["display_name"] = $fv;
goto rb;
}
if ($tY == "firstlast") {
$UU["display_name"] = $fv . " " . $eO;
goto rb;
}
if ($tY == "lastfirst") {
$UU["display_name"] = $eO . " " . $fv;
// [PHPDeobfuscator] Implied goto
goto rb;
}
rb:
zw:
MA:
$fM = wp_insert_user($UU);
if (!is_wp_error($fM)) {
$user = get_user_by("login", $Dv);
if (!($uU == true)) {
goto D4;
}
error_log("saving user meta key");
update_user_meta($user->ID, "mo_ldap_user_session_key", Mo_Ldap_Local_Util::encrypt($oV));
D4:
update_user_meta($user->ID, "mo_ldap_user_dn", $j0->userDn, false);
update_user_meta($user->ID, "mo_ldap_user_phone", $Ey);
$iJ = get_option("mo_ldap_local_enable_role_mapping");
$Y9 = new Mo_Ldap_Local_Role_Mapping();
$fn = $Y9->get_member_of_attribute($Dv);
if (!($iJ == 1)) {
goto Zx;
}
$Y9->mo_ldap_local_update_role_mapping($user->ID, $fn);
Zx:
$user = get_user_by("id", $user->ID);
if ($WD == 1) {
$Rv = $j0->extraProfileAttributesList;
// [PHPDeobfuscator] Implied goto
goto JQ;
}
$Rv = array();
JQ:
if (!array_key_exists("memberof", $Rv)) {
goto A8;
}
$Rv["memberof"] = $fn;
A8:
foreach ($Rv as $Pt => $dc) {
update_user_meta($user->ID, $Pt, $dc);
}
do_action("mo_ldap_buddypress", $Rv, $user);
do_action("mo_ldap_attribute_to_usermeta_update", $user);
do_action("mo_ldap_profile_picture_mapping", $user);
do_action("mo_ldap_buddypress_profile_picture_mapping", $user);
do_action("mo_wp_to_ldap_groups_mapping", $user, $fn);
do_action("mo_ldap_learndash_groups_mapping", $user, $fn);
do_action("mo_ldap_tutor_groups_mapping", $user, $fn);
if (!($ZM == 1)) {
goto nf;
}
delete_option("um_cache_userdata_{$user->ID}");
nf:
if ($VF == 1) {
wp_set_auth_cookie($user->ID, false);
apply_filters("login_redirect", null, null, $user);
qR:
WM:
wp_redirect(site_url());
exit;
}
$z5 = get_option("mo_ldap_enable_role_restriction");
if (!$z5) {
gJ:
return $user;
}
$xY = new Mo_Ldap_Local_Role_Mapping();
$xm = $xY->mo_ldap_is_user_login_restricted($user->roles);
if (!$xm) {
goto gJ;
}
$GB = new WP_Error();
$GB->add("UNKNOWN_ERROR", __("<strong>ERROR</strong>: You are not allowed to Login. Please contact your administrator"));
return $GB;
}
$this->mo_ldap_report_update($Dv, $j0->statusMessage, "<strong>Login Error:</strong> There was an error registering your account. Please try again.");
$GB = new WP_Error();
$GB->add("registration_error", __("<strong>ERROR</strong>: There was an error registering your account. Please try again."));
return $GB;
}
if (!empty($s1) || !$eV) {
$user = false;
if (username_exists($Dv)) {
$user = get_user_by("login", $Dv);
goto It;
}
if (email_exists($Dv)) {
$user = get_user_by("email", $Dv);
// [PHPDeobfuscator] Implied goto
goto It;
}
It:
if ($user) {
if (!(!$eV && $j0->statusCode == "LDAP_BIND_SUCCESS_USER_EXISTS")) {
Hu:
$lO = false;
if ($s1 == "all" || !$eV) {
$lO = true;
goto uC;
}
if ($s1 == "admin" && user_can($user->ID, "manage_options")) {
$lO = true;
// [PHPDeobfuscator] Implied goto
goto uC;
}
uC:
if ($lO && wp_check_password($oV, $user->data->user_pass, $user->ID)) {
$z5 = get_option("mo_ldap_enable_role_restriction");
if (!$z5) {
Zj:
return $user;
}
$xY = new Mo_Ldap_Local_Role_Mapping();
$xm = $xY->mo_ldap_is_user_login_restricted($user->roles);
if (!$xm) {
goto Zj;
}
$GB = new WP_Error();
$GB->add("UNKNOWN_ERROR", __("<strong>ERROR</strong>: You are not allowed to Login. Please contact your administrator"));
return $GB;
}
if ($j0->statusCode == "LDAP_CONNECTION_ERROR") {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: LDAP server is not reachable. Authentication failed against Local WordPress server.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: LDAP server is not reachable. Authentication failed against Local WordPress server."));
return $GB;
}
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect."));
return $GB;
}
$Cv = get_user_meta($user->ID, "mo_ldap_user_dn");
$Cv = !empty($Cv) ? $Cv : false;
if (!($Cv != false)) {
goto Hu;
}
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Trial:</strong> Your Trial License has Expired");
$GB = new WP_Error();
$GB->add("registration_disabled_error", __("<strong>ERROR</strong>: Your miniOrange LDAP/AD Login for Intranet Sites Trial License has expired."));
return $GB;
}
if ($j0->statusCode == "LDAP_CONNECTION_ERROR") {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>ERROR</strong>: LDAP server is not reachable.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>ERROR</strong>: LDAP server is not reachable."));
return $GB;
}
if ($j0->statusCode == "LDAP_BIND_ERROR_USER_EXISTS") {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect."));
return $GB;
}
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: User with specified Username/Email address Not Found.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: User with specified Username/Email address Not Found."));
return $GB;
}
if ($j0->statusCode == "LDAP_CONNECTION_ERROR") {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: LDAP server is not reachable");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: LDAP server is not reachable. Fallback to local WordPress authentication is not enabled."));
return $GB;
}
if ($j0->statusCode == "LDAP_BIND_ERROR_USER_EXISTS") {
$this->mo_ldap_report_update($Dv, "ERROR", "<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect.");
$GB = new WP_Error();
$GB->add("incorrect_credentials", __("<strong>Login Error</strong>: The password you entered for the User <strong>" . $Dv . "</strong> is incorrect."));
return $GB;
}
if ($j0->statusCode == "LDAP_EXTENSION_ERROR") {
$this->mo_ldap_report_update($Dv, $j0->statusMessage, "<strong>Login Error</strong>: <a target=\"_blank\" href=\"http://php.net/manual/en/ldap.installation.php\">PHP LDAP extension</a> is not installed or disabled. Please enable it.");
$GB = new WP_Error();
$GB->add("LDAP_EXTENSION_ERROR", __("<strong>Login Error</strong>: <a target=\"_blank\" href=\"http://php.net/manual/en/ldap.installation.php\">PHP LDAP extension</a> is not installed or disabled. Please enable it."));
return $GB;
}
if ($j0->statusCode == "OPENSSL_EXTENSION_ERROR") {
$this->mo_ldap_report_update($Dv, $j0->statusMessage, "<strong>Login Error</strong>: <a target=\"_blank\" href=\"http://php.net/manual/en/openssl.installation.php\">PHP OpenSSL extension</a> is not installed or disabled.");
$GB = new WP_Error();
$GB->add("OPENSSL_EXTENSION_ERROR", __("<strong>Login Error</strong>: <a target=\"_blank\" href=\"http://php.net/manual/en/openssl.installation.php\">PHP OpenSSL extension</a> is not installed or disabled."));
return $GB;
}
$GB = new WP_Error();
$GB->add("UNKNOWN_ERROR", __("<strong>ERROR</strong>: Unknown error occurred during authetication. Please contact your administrator."));
return $GB;
}
$GB = new WP_Error();
if (!empty($Dv)) {
goto rG;
}
$GB->add("empty_username", __("<strong>ERROR</strong>: Email field is empty."));
rG:
if (!empty($oV)) {
goto ms;
}
$GB->add("empty_password", __("<strong>ERROR</strong>: Password field is empty."));
ms:
return $GB;
}
function mo_ldap_local_login_widget_menu()
{
add_menu_page("LDAP/AD Login for Intranet", "LDAP/AD Login for Intranet", "activate_plugins", "mo_ldap_local_login", array($this, "mo_ldap_local_login_widget_options"), plugin_dir_url(__DIR__."/input.php") . "includes/images/miniorange_icon.png");
}
function mo_ldap_local_login_widget_options()
{
$B6 = array("server_url" => "ldap://58.64.132.235:389", "service_account_dn" => "cn=testuser,cn=Users,dc=miniorange,dc=com", "admin_password" => "XXXXXXXX", "dn_attribute" => "distinguishedName", "search_base" => "cn=Users,dc=miniorange,dc=com", "username_attribute" => "sAMAccountName", "search_filter" => "(&(objectClass=*)(cn=?))", "test_username" => "testuser", "test_password" => "password");
update_option("mo_ldap_local_default_config", $B6);
mo_ldap_local_settings();
}
function login_widget_save_options()
{
$eV = apply_filters("mo_check_config", '');
if (!((!empty(get_option("user_logs_table_exists")) || strcasecmp(get_option("user_logs_table_exists"), "1") === 0) && (empty(get_option("mo_ldap_local_user_table_updated")) || strcasecmp(get_option("mo_ldap_local_user_table_updated"), "true") !== 0))) {
goto Yq;
}
Mo_Ldap_Local_Util::update_user_auth_table_headers();
update_option("mo_ldap_local_user_table_updated", "true");
Yq:
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_local_verify_customer") == 0) {
$qo = '';
$oV = '';
if (Mo_Ldap_Local_Util::check_empty_or_null($_POST["email"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["password"])) {
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid entries.");
$this->show_error_message();
return;
}
$qo = sanitize_email($_POST["email"]);
$oV = $_POST["password"];
update_option("mo_ldap_local_admin_email", $qo);
update_option("mo_ldap_local_password", $oV);
$D8 = new Mo_Ldap_Local_Customer();
$yq = $D8->get_customer_key();
$bS = json_decode($yq, true);
if (strcasecmp($bS["status"], "SUCCESS") == 0) {
update_option("mo_ldap_local_admin_phone", $bS["phone"]);
$this->save_success_customer_config($bS["id"], $bS["apiKey"], $bS["token"], "Your account has been retrieved successfully.");
update_option("mo_ldap_local_password", '');
goto KE;
}
if (strcasecmp($bS["status"], "ERROR") == 0) {
update_option("mo_ldap_local_message", $bS["statusMessage"]);
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto KE;
}
update_option("mo_ldap_local_message", "Invalid username or password. Please try again.");
$this->show_error_message();
KE:
update_option("mo_ldap_local_password", '');
goto Fm;
}
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_local_verify_license") == 0) {
if (!Mo_Ldap_Local_Util::check_empty_or_null($_POST["mo_ldap_local_license_key"])) {
$ho = trim($_POST["mo_ldap_local_license_key"]);
$D8 = new Mo_Ldap_Local_Customer();
$yq = json_decode($D8->XfskodsfhHJ($ho), true);
if (isset($yq["status"]) && $yq["isTrial"] == true) {
$VM = Jp_hwfrqar_mzwhwzl_arvowfra::bp_efzwoezr_zvweh_hwfrqar($yq, $ho);
update_option("mo_ldap_local_message", $VM["displayMsg"]);
if ($VM["trialStatus"]) {
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Di;
}
$this->show_error_message();
Di:
goto om;
}
if (isset($yq["status"]) && strcasecmp($yq["status"], "SUCCESS") == 0) {
update_option("mo_plugin_utility_key_stat", Jp_hwfrqar_mzwhwzl_arvowfra::rqfvlyz_mzwhwzl("premium"));
delete_option("mo_plugin_utility_key");
update_option("mo_ldap_local_license_verified", "true");
update_option("mo_ldap_local_license_key", Mo_Ldap_Local_Util::encrypt($ho));
update_option("mo_ldap_local_message", "Your license is verified. You can now setup the plugin.");
$this->show_success_message();
goto om;
}
if (isset($yq["status"]) && strcasecmp($yq["status"], "FAILED") == 0) {
if (isset($yq["status"]) && strcasecmp($yq["message"], "Code has Expired") == 0) {
$yE = add_query_arg(array("tab" => "pricing"), $_SERVER["REQUEST_URI"]);
update_option("mo_ldap_local_message", "License key you have entered has already been used. Please enter a key which has not been used before on any other instance or if you have exausted all your keys then <a href=\"" . $yE . "\">Click here</a> to buy more.");
// [PHPDeobfuscator] Implied goto
goto zO;
}
update_option("mo_ldap_local_message", "You have entered an invalid license key. Please enter a valid license key.");
zO:
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto om;
}
update_option("mo_ldap_local_message", "An error occured while processing your request. Please Try again.");
$this->show_error_message();
om:
goto Fm;
}
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid license key.");
$this->show_error_message();
return;
}
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo-check-license-button") == 0) {
$ho = Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_license_key"));
$D8 = new Mo_Ldap_Local_Customer();
$yq = json_decode($D8->XfskodsfhHJ($ho), true);
$nH = Jp_hwfrqar_mzwhwzl_arvowfra::bp_myjezr_hwfrqar_mzwhwzl($yq);
update_option("mo_ldap_local_message", $nH);
$this->show_success_message();
goto Fm;
}
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo-change-account-button") == 0) {
Jp_hwfrqar_mzwhwzl_arvowfra::bp_hpspmz_fmazpbrv_mzwhwzl();
goto Fm;
}
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_public_pages") == 0) {
$g0 = $_POST["mo_ldap_custom_page_restriction_check"];
update_option("mo_ldap_public_pages_enable", $g0);
$lr = 1;
$Pb = !empty(get_option("mo_ldap_public_pages_list")) ? unserialize(get_option("mo_ldap_public_pages_list")) : array();
sZ:
if (!isset($_POST["mo_ldap_custom_page_" . $lr])) {
update_option("mo_ldap_public_pages_list", serialize($Pb));
goto Fm;
}
if (!(strcasecmp($_POST["mo_ldap_custom_page_" . $lr], '') != 0)) {
goto R5;
}
$Bi = rtrim(sanitize_text_field(strtolower($_POST["mo_ldap_custom_page_" . $lr])), "/");
if (!in_array($Bi, $Pb)) {
array_push($Pb, $Bi);
$hW = "Page <b>" . $Bi . "</b> Added Successfully";
update_option("mo_ldap_local_message", $hW);
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto m_;
}
$hW = "Page <b>" . $Bi . "</b> Already Added.";
update_option("mo_ldap_local_message", $hW);
$this->show_error_message();
m_:
R5:
$lr++;
goto sZ;
}
if (isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_delete_page") == 0) {
$Bi = $_POST["mo_ldap_delete_page_name"];
$Pb = !empty(get_option("mo_ldap_public_pages_list")) ? unserialize(get_option("mo_ldap_public_pages_list")) : array();
$k_ = array_search($Bi, $Pb);
unset($Pb[$k_]);
update_option("mo_ldap_public_pages_list", serialize($Pb));
$hW = "Page <b>" . $Bi . "</b> Removed Successfully.";
update_option("mo_ldap_local_message", $hW);
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Fm;
}
Fm:
if (!(isset($_POST["option"]) && $eV)) {
goto Nr;
}
$vM = $_POST["option"];
switch ($vM) {
case "mo_ldap_local_save_config":
if (NddKoYsdasadJD()) {
$jn = isset($_POST["anonymous_bind"]) ? 1 : 0;
update_option("mo_ldap_local_anonymous_bind", $jn);
$tH = '';
$Jo = '';
$SO = '';
if (Mo_Ldap_Local_Util::check_empty_or_null($_POST["ldap_server"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["dn"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["admin_password"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["mo_ldap_protocol"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["mo_ldap_server_port_no"])) {
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid entries.");
$this->show_error_message();
return;
}
$rq = $_POST["mo_ldap_protocol"];
$Fs = sanitize_text_field($_POST["mo_ldap_server_port_no"]);
$ez = sanitize_text_field($_POST["ldap_server"]);
$tH = $rq . "://" . $ez . ":" . $Fs;
$Jo = sanitize_text_field($_POST["dn"]);
$SO = $_POST["admin_password"];
if (!Mo_Ldap_Local_Util::is_extension_installed("openssl")) {
update_option("mo_ldap_local_message", "PHP OpenSSL extension is not installed or disabled. Please enable it first.");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto q0;
}
$lC = $_POST["mo_ldap_directory_server_value"];
if (strcasecmp($lC, "other") == 0) {
$Fo = isset($_POST["mo_ldap_directory_server_custom_value"]) && !empty($_POST["mo_ldap_directory_server_custom_value"]) ? $_POST["mo_ldap_directory_server_custom_value"] : "other";
update_option("mo_ldap_directory_server_custom_value", $Fo);
// [PHPDeobfuscator] Implied goto
goto Ei;
}
delete_option("mo_ldap_directory_server_custom_value");
Ei:
update_option("mo_ldap_directory_server_value", $lC);
update_option("mo_ldap_local_ldap_protocol", $rq);
update_option("mo_ldap_local_ldap_server_address", Mo_Ldap_Local_Util::encrypt($ez));
if ($rq == "ldap") {
update_option("mo_ldap_local_ldap_port_number", $Fs);
goto Y2;
}
if ($rq == "ldaps") {
update_option("mo_ldap_local_ldaps_port_number", $Fs);
// [PHPDeobfuscator] Implied goto
goto Y2;
}
Y2:
update_option("mo_ldap_local_server_url", Mo_Ldap_Local_Util::encrypt($tH));
update_option("mo_ldap_local_server_dn", Mo_Ldap_Local_Util::encrypt($Jo));
update_option("mo_ldap_local_server_password", Mo_Ldap_Local_Util::encrypt($SO));
$gi = new Mo_Ldap_Local_Config();
$hW = "Your configuration has been saved.";
$YX = $gi->test_connection();
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_BIND_SUCCESSFUL") == 0) {
update_option("mo_ldap_local_message", " Connection was established successfully. Your configuration has been saved. Please configure LDAP User Mapping now.", '', "no");
update_option("mo_ldap_local_verify_ldap_connection", "true");
$this->show_success_message();
goto EO;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_BIND_ERROR") == 0) {
$this->mo_ldap_report_update("LDAP CONNECTION TEST", "ERROR", "<strong>Test Connection Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
update_option("mo_ldap_local_verify_ldap_connection", "false");
$this->show_error_message();
goto EO;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_CONNECTION_ERROR") == 0) {
$this->mo_ldap_report_update("LDAP CONNECTION TEST", "ERROR", "<strong>Test Connection Error: </strong>Cannot connect to LDAP Server. Make sure you have entered correct LDAP server hostname or IP address.");
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
update_option("mo_ldap_local_verify_ldap_connection", "false");
$this->show_error_message();
goto EO;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_EXTENSION_ERROR") == 0) {
$this->mo_ldap_report_update("LDAP CONNECTION TEST", "ERROR", "<strong>Test Connection Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
update_option("mo_ldap_local_verify_ldap_connection", "false");
$this->show_error_message();
goto EO;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "OPENSSL_EXTENSION_ERROR") == 0) {
$this->mo_ldap_report_update("LDAP CONNECTION TEST", "ERROR", "<strong>Test Connection Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
update_option("mo_ldap_local_verify_ldap_connection", "false");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto EO;
}
EO:
goto q0;
}
update_option("mo_ldap_local_message", "Settings can't be saved without verifying your license key.");
$this->show_error_message();
q0:
goto rJ;
case "mo_ldap_local_tls_enable":
$C1 = isset($_POST["mo_ldap_local_tls_enable"]) ? $_POST["mo_ldap_local_tls_enable"] : 0;
update_option("mo_ldap_local_use_tls", $C1);
if ($C1 == 1) {
update_option("mo_ldap_local_message", "TLS has been enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto SX;
}
update_option("mo_ldap_local_message", "TLS has been disabled.");
$this->show_error_message();
SX:
goto rJ;
case "mo_ldap_local_save_user_mapping":
delete_option("mo_ldap_local_user_mapping_status");
update_option("mo_local_filter_check", isset($_POST["ldap_search_filters"]) ? 1 : 0);
$o1 = '';
$yU = '';
$If = '';
$GQ = array();
$nh = array();
if (Mo_Ldap_Local_Util::check_empty_or_null($_POST["search_base"])) {
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid entries.");
add_option("mo_ldap_local_user_mapping_status", "INVALID", '', "no");
$this->show_error_message();
return;
}
if (Mo_Ldap_Local_Util::check_empty_or_null($_POST["user_attribute_text"]) && Mo_Ldap_Local_Util::check_empty_or_null($_POST["search_filter"])) {
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid entries.");
add_option("mo_ldap_local_user_mapping_status", "INVALID", '', "no");
$this->show_error_message();
return;
}
$yU = strtolower(sanitize_text_field($_POST["search_base"]));
if (!Mo_Ldap_Local_Util::is_extension_installed("openssl")) {
update_option("mo_ldap_local_message", "PHP OpenSSL extension is not installed or disabled. Please enable it first.");
add_option("mo_ldap_local_user_mapping_status", "INVALID", '', "no");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto E2;
}
$If = sanitize_text_field($_POST["search_filter"]);
$nE = sanitize_text_field($_POST["user_attribute_text"]);
$ji = sanitize_text_field($_POST["extra_user_attribute"]);
if (!isset($nE)) {
goto cm;
}
foreach ($_POST["user_attribute_text"] as $k_ => $dc) {
$GQ[$k_] = $dc;
}
cm:
update_option("mo_ldap_local_search_filter", Mo_Ldap_Local_Util::encrypt($If));
update_option("mo_ldap_local_username_attribute", $GQ);
update_option("mo_ldap_local_extra_user_attribute", $ji);
update_option("mo_ldap_local_search_base", Mo_Ldap_Local_Util::encrypt($yU));
$hW = "LDAP User Mapping Configuration has been saved. Please test authentication to verify LDAP User Mapping Configuration.";
update_option("mo_ldap_local_message", $hW, '', "no");
add_option("mo_ldap_local_user_mapping_status", "VALID", '', "no");
$this->show_success_message();
update_option("mo_ldap_local_check_user_mapping_config", "true");
E2:
goto rJ;
case "mo_ldap_local_test_auth":
if (NddKoYsdasadJD()) {
$tH = get_option("mo_ldap_local_server_url");
$Jo = get_option("mo_ldap_local_server_dn");
$SO = get_option("mo_ldap_local_server_password");
$yU = get_option("mo_ldap_local_search_base");
$GQ = get_option("mo_ldap_local_username_attribute");
$If = get_option("mo_ldap_local_search_filter");
$UA = '';
$fz = '';
if (Mo_Ldap_Local_Util::check_empty_or_null($_POST["test_username"]) || Mo_Ldap_Local_Util::check_empty_or_null($_POST["test_password"])) {
$this->mo_ldap_report_update("Test Authentication ", "ERROR", "<strong>ERROR</strong>: All the fields are required. Please enter valid entries.");
update_option("mo_ldap_local_message", "All the fields are required. Please enter valid entries.", '', "no");
$this->show_error_message();
return;
}
if (Mo_Ldap_Local_Util::check_empty_or_null($tH) || Mo_Ldap_Local_Util::check_empty_or_null($Jo) || Mo_Ldap_Local_Util::check_empty_or_null($SO) || Mo_Ldap_Local_Util::check_empty_or_null($yU) || Mo_Ldap_Local_Util::check_empty_or_null($GQ) || Mo_Ldap_Local_Util::check_empty_or_null($If)) {
$this->mo_ldap_report_update("Test authentication", "ERROR", "<strong>Test Authentication Error</strong>: Please save LDAP Configuration to test authentication.");
update_option("mo_ldap_local_message", "Please save LDAP Configuration to test authentication.", '', "no");
$this->show_error_message();
return;
}
$UA = sanitize_text_field($_POST["test_username"]);
$fz = $_POST["test_password"];
$gi = new Mo_Ldap_Local_Config();
$YX = $gi->test_authentication($UA, $fz);
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_BIND_SUCCESS_USER_EXISTS") == 0) {
$dL = add_query_arg(array("tab" => "rolemapping"), $_SERVER["REQUEST_URI"]);
$hW = "You have successfully configured your LDAP settings.<br>\r\n You can now do either of two things.<br>\r\n 1. Enable LDAP Login at the top and then <a href=\"" . wp_logout_url(get_permalink()) . "\">Logout</a> from WordPress and login again with your LDAP credentials.<br> \r\n 2. Do role mapping (<a href=\"" . $dL . "\">Click here</a>)";
update_option("mo_ldap_local_message", $hW, '', "no");
$this->show_success_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_CONNECTION_ERROR") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_BIND_ERROR_USER_EXISTS") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_BIND_ERROR") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_USER_NOT_EXIST") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong> Cannot find user in the directory");
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_USER_SEARCH_ERROR") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong> Cannot find user in the directory");
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_EXTENSION_ERROR") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "OPENSSL_EXTENSION_ERROR") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
goto pB;
}
if (isset($YX->statusCode) && strcasecmp($YX->statusCode, "LDAP_LOCAL_SERVER_NOT_CONFIGURED") == 0) {
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong>" . $YX->statusMessage);
update_option("mo_ldap_local_message", $YX->statusMessage, '', "no");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto pB;
}
$this->mo_ldap_report_update($_POST["test_username"], "ERROR", "<strong>Test Authentication Error: </strong> There was an error processing your request. Please verify the Search Base(s) and Username attribute. Your user should be present in the Search base defined.");
update_option("mo_ldap_local_message", "There was an error processing your request. Please verify the Search Base(s) and Username attribute. Your user should be present in the Search base defined.");
$this->show_error_message();
goto pB;
}
update_option("mo_ldap_local_message", "Settings can't be tested without verifying your license key.");
$this->show_error_message();
pB:
goto rJ;
case "mo_ldap_local_enable":
if (NddKoYsdasadJD()) {
$YC = isset($_POST["enable_ldap_login"]) ? $_POST["enable_ldap_login"] : 0;
update_option("mo_ldap_local_enable_login", $YC);
if ($YC == 1) {
update_option("mo_ldap_local_message", "Login through your LDAP has been enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto No;
}
update_option("mo_ldap_local_message", "Login through your LDAP has been disabled.");
$this->show_error_message();
goto No;
}
update_option("mo_ldap_local_message", "Settings can't be saved without verifying your license key.");
$this->show_error_message();
No:
goto rJ;
case "mo_ldap_local_enable_both_login":
$L0 = isset($_POST["mo_ldap_local_enable_both_login"]) ? $_POST["mo_ldap_local_enable_both_login"] : '';
update_option("mo_ldap_local_enable_both_login", $L0);
if ($L0 == "admin") {
update_option("mo_ldap_local_message", "Login using Local WordPress Credentials for <b>Administrators</b> is enabled.");
$this->show_success_message();
goto Sm;
}
if ($L0 == "all") {
update_option("mo_ldap_local_message", "Login using Local WordPress Credentials for <b>All Users</b> is enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Sm;
}
update_option("mo_ldap_local_message", "Login using Local WordPress Credentials is <b>disabled</b>.");
$this->show_error_message();
Sm:
goto rJ;
case "mo_ldap_local_save_login_redirect":
$xG = $_POST["redirect_to"];
update_option("mo_ldap_local_redirect_to", $xG);
if ($xG == "profile") {
update_option("mo_ldap_local_message", "Users will get redirected to Profile Page after login.");
goto Ok;
}
if ($xG == "homepage") {
update_option("mo_ldap_local_message", "Users will get redirected to Home Page after login.");
// [PHPDeobfuscator] Implied goto
goto Ok;
}
Ok:
if ($xG != "custom" && $xG !== "none") {
$this->show_success_message();
goto hZ;
}
if ($xG == "none") {
update_option("mo_ldap_local_message", "Redirection after login is disabled.");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto hZ;
}
hZ:
goto rJ;
case "mo_ldap_local_custom_redirect":
$ph = $_POST["mo_ldap_local_custom_url"];
update_option("mo_ldap_local_custom_redirect", $ph);
update_option("mo_ldap_local_message", "Users will get redirected to custom redirect URL after login.");
$this->show_success_message();
goto rJ;
case "mo_ldap_local_register_user":
if (NddKoYsdasadJD()) {
$Zm = isset($_POST["mo_ldap_local_register_user"]) ? $_POST["mo_ldap_local_register_user"] : 0;
update_option("mo_ldap_local_register_user", $Zm);
if ($Zm == 1) {
update_option("mo_ldap_local_message", "Auto Registering users has been enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto UF;
}
update_option("mo_ldap_local_message", "Auto Registering users has been disabled.");
$this->show_error_message();
goto UF;
}
update_option("mo_ldap_local_message", "Settings can't be saved without verifying your license key.");
$this->show_error_message();
UF:
goto rJ;
case "mo_ldap_local_authorized_users_only":
if (NddKoYsdasadJD()) {
$Gq = isset($_POST["authorized_users_only"]) ? $_POST["authorized_users_only"] : 0;
update_option("mo_ldap_local_authorized_users_only", $Gq);
if ($Gq == 1) {
update_option("mo_ldap_local_message", "Protect Content by Login enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto rV;
}
update_option("mo_ldap_local_message", "Protect Content by Login disabled.");
$this->show_error_message();
goto rV;
}
update_option("mo_ldap_local_message", "Settings can't be saved without verifying your license key.");
$this->show_error_message();
rV:
goto rJ;
case "mo_ldap_local_group_role_mapping":
$ne = isset($_POST["enable_ldap_role_mapping_based_on_ldap_groups"]) ? $_POST["enable_ldap_role_mapping_based_on_ldap_groups"] : 0;
update_option("mo_ldap_local_enable_role_mapping_based_on_ldap_groups", $ne);
if ($ne == 1) {
update_option("mo_ldap_local_message", "LDAP Group to WP role mapping has been enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Cp;
}
update_option("mo_ldap_local_message", "LDAP Group to WP role mapping has been disabled.");
$this->show_error_message();
Cp:
goto rJ;
case "mo_ldap_fetch_groups_list":
if (!isset($_REQUEST["mo_ldap_groups_search_base"])) {
goto ZQ;
}
$fl = trim($_REQUEST["mo_ldap_groups_search_base"]);
ZQ:
update_option("mo_ldap_local_groups_search_base", Mo_Ldap_Local_Util::encrypt($fl));
update_option("mo_ldap_show_groups", 1);
goto rJ;
case "mo_ldap_local_save_mapping":
$WP = array();
$MS = array();
$nh = array();
$qu = 1;
$td = 0;
$VZ = $_POST["mapping_key_1"];
BJ:
if (!isset($VZ)) {
update_option("mo_ldap_local_role_mapping_key_array", serialize($WP));
update_option("mo_ldap_local_role_mapping_value_array", serialize($MS));
update_option("mo_ldap_local_role_mapping_group_names", serialize($nh));
update_option("mo_ldap_local_role_mapping_count", $td);
if (!isset($_POST["mapping_value_default"])) {
goto XZ;
}
update_option("mo_ldap_local_mapping_value_default", $_POST["mapping_value_default"]);
XZ:
if (!isset($_POST["mapping_memberof_attribute"])) {
goto Iw;
}
update_option("mo_ldap_local_mapping_memberof_attribute", $_POST["mapping_memberof_attribute"]);
Iw:
$M2 = '';
$YH = get_option("mo_ldap_local_mapping_value_default");
$iJ = get_option("mo_ldap_local_enable_role_mapping");
if (!$YH) {
$M2 = " Please select the Default Role and then check <b>\"Enable Role Mapping\"</b> to activate it.";
goto a_;
}
if ($iJ == 0) {
$M2 = " Please check <b>\"Enable Role Mapping\"</b> to activate it.";
// [PHPDeobfuscator] Implied goto
goto a_;
}
a_:
update_option("mo_ldap_local_message", "LDAP Group to WP role mapping has been updated." . $M2);
$this->show_success_message();
goto rJ;
}
if (empty($VZ)) {
goto Cr;
}
$UC = $_POST["selected_for_save_role_mapping_" . $qu];
if (!($UC == "true")) {
goto a7;
}
$td++;
$Sq = $_POST["mapping_group_name_" . $qu];
$nh[$td] = $Sq;
$WP["mo_ldap_local_mapping_key_" . $td] = trim($VZ);
$MS["mo_ldap_local_mapping_value_" . $td] = $_POST["mapping_value_" . $qu];
a7:
Cr:
$qu++;
$VZ = $_POST["mapping_key_" . $qu];
goto BJ;
case "mo_ldap_ldap_ou_based_role_mapping":
$ZD = $_POST["enable_ldap_role_mapping_based_on_ldap_ou"];
$F6 = 1;
$sf = array();
uN:
if (empty($_POST["mo_ldap_role_mapping_ou_value_" . $F6])) {
update_option("mo_ldap_local_ou_role_mapping_options", serialize($sf));
if ($ZD == 1) {
update_option("mo_ldap_local_enable_role_mapping_based_on_ldap_ou", 1);
update_option("mo_ldap_local_message", "Successfully saved Role Mapping based on LDAP OU");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto nc;
}
update_option("mo_ldap_local_enable_role_mapping_based_on_ldap_ou", 0);
update_option("mo_ldap_local_message", "Disabled Role Mapping based on LDAP OU");
$this->show_error_message();
nc:
goto rJ;
}
$ZX = array();
if (empty($_POST["mo_ldap_role_mapping_ou_value_" . $F6])) {
goto yw;
}
$ZX["ou_value"] = trim($_POST["mo_ldap_role_mapping_ou_value_" . $F6]);
$ZX["ou_based_wp_role_name"] = trim($_POST["mo_ldap_ou_mapping_role_name_" . $F6]);
yw:
array_push($sf, $ZX);
$F6++;
goto uN;
case "mo_ldap_local_enable_role_mapping":
$iJ = isset($_POST["enable_ldap_role_mapping"]) ? $_POST["enable_ldap_role_mapping"] : 0;
update_option("mo_ldap_local_enable_role_mapping", $iJ);
if ($iJ == 1) {
update_option("mo_ldap_local_message", "LDAP Group to WP role mapping has been enabled.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto bv;
}
update_option("mo_ldap_local_message", "LDAP Group to WP role mapping has been disabled.");
$this->show_error_message();
bv:
goto rJ;
case "mo_ldap_local_keep_existing_user_roles":
$wh = isset($_POST["keep_existing_user_roles"]) ? $_POST["keep_existing_user_roles"] : 0;
update_option("mo_ldap_local_keep_existing_user_roles", $wh);
if ($wh == 1) {
update_option("mo_ldap_local_message", "WP Roles of Existing users will not be removed.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto dB;
}
update_option("mo_ldap_local_message", "WP Roles of Existing users will be updated.");
$this->show_error_message();
dB:
goto rJ;
case "mo_ldap_fetch_recursive_groups_enable":
$Yl = isset($_POST["fetch_recursive_groups"]) ? $_POST["fetch_recursive_groups"] : 0;
update_option("mo_ldap_fetch_recursive_groups_enable", $Yl);
if ($Yl) {
update_option("mo_ldap_local_message", "Nested groups from the LDAP associated with the user will be fetched.");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Vz;
}
update_option("mo_ldap_local_message", "Nested groups from the LDAP associated with the user will not be fetched.");
$this->show_error_message();
Vz:
goto rJ;
case "mo_ldap_save_default_role":
if (!isset($_POST["mapping_value_default"])) {
goto LC;
}
update_option("mo_ldap_local_mapping_value_default", $_POST["mapping_value_default"]);
LC:
goto rJ;
case "mo_ldap_role_mapping_selection":
$kj = isset($_POST["mo_ldap_role_mapping_selected_tab"]) ? sanitize_text_field($_POST["mo_ldap_role_mapping_selected_tab"]) : 1;
update_option("mo_ldap_local_selected_role_mapping_subtab", $kj);
goto rJ;
case "mo_ldap_enable_attribute_mapping":
$WD = isset($_POST["mo_ldap_local_enable_attr_mapping"]) ? 1 : 0;
update_option("mo_ldap_local_enable_attr_mapping", $WD);
if ($WD == 1) {
update_option("mo_ldap_local_message", "LDAP Attribute Mapping Enabled");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Sd;
}
update_option("mo_ldap_local_message", "LDAP Attribute Mapping Disabled");
$this->show_error_message();
Sd:
goto rJ;
case "mo_ldap_enable_updating_ldap":
$Ow = isset($_POST["enable_update_ldap"]) ? 1 : 0;
update_option("mo_ldap_local_enable_update_ldap", $Ow);
if ($Ow == 1) {
update_option("mo_ldap_local_message", "Enabled updating information in LDAP when user edits profile");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto Bn;
}
update_option("mo_ldap_local_message", "Disabled updating information in LDAP when user edits profile");
$this->show_error_message();
Bn:
goto rJ;
case "mo_ldap_save_attribute_config":
update_option("mo_ldap_directory_server_value", isset($_POST["mo_ldap_directory_server_value"]) ? $_POST["mo_ldap_directory_server_value"] : "msad");
$NN = sanitize_text_field($_POST["mo_ldap_email_attribute"]);
$RA = sanitize_text_field($_POST["mo_ldap_phone_attribute"]);
$qT = sanitize_text_field($_POST["mo_ldap_fname_attribute"]);
$yB = sanitize_text_field($_POST["mo_ldap_lname_attribute"]);
$jd = sanitize_text_field($_POST["mo_ldap_nickname_attribute"]);
$tY = sanitize_text_field($_POST["mo_ldap_display_name_attribute"]);
update_option("mo_ldap_local_email_attribute", $NN);
update_option("mo_ldap_local_phone_attribute", $RA);
update_option("mo_ldap_local_fname_attribute", $qT);
update_option("mo_ldap_local_lname_attribute", $yB);
update_option("mo_ldap_local_nickname_attribute", $jd);
update_option("mo_ldap_local_display_name_attribute", $tY);
$Rv = unserialize(get_option("mo_ldap_local_custom_attributes"));
if (!Mo_Ldap_Local_Util::check_empty_or_null($Rv)) {
goto qe;
}
$Rv = array();
qe:
$RS = 1;
$OG = $_POST["mo_ldap_local_custom_attribute_1_name"];
qo:
if (!isset($OG)) {
if (empty($Rv)) {
goto s2;
}
update_option("mo_ldap_local_custom_attributes", serialize(array_unique($Rv)));
s2:
update_option("mo_ldap_local_message", "Successfully saved LDAP Attribute Configuration");
$this->show_success_message();
goto rJ;
}
if (empty($OG)) {
goto qC;
}
if (!(strpos($OG, " ") !== false)) {
goto a1;
}
$OG = str_replace(" ", '', $OG);
a1:
$Q0 = "mo_ldap_local_custom_attribute_" . strtolower(sanitize_text_field($OG));
$Rv[$Q0] = strtolower($OG);
qC:
$RS++;
$OG = $_POST["mo_ldap_local_custom_attribute_" . $RS . "_name"];
goto qo;
case "mo_ldap_delete_custom_attribute":
$ej = strtolower(sanitize_text_field($_POST["custom_attribute_name"]));
$sy = "mo_ldap_local_custom_attribute_" . $ej;
$fB = unserialize(get_option("mo_ldap_local_custom_attributes"));
unset($fB[$sy]);
if (!is_plugin_active("miniorange-ldap-third-party-integration-add-on/ldap-attributes-to-custom-usermeta.php")) {
goto Ej;
}
$rm = get_option("mo_ldap_attribute_usermeta_mapping");
foreach ($rm as $q_ => $zG) {
if (!(strcasecmp($ej, $zG) == 0)) {
}
unset($rm[$q_]);
update_option("mo_ldap_attribute_usermeta_mapping", $rm);
goto sD;
}
sD:
Ej:
update_option("mo_ldap_local_custom_attributes", serialize(array_unique($fB)));
do_action("mo_ldap_buddypress_update_attribute_mapping", $ej);
update_option("mo_ldap_local_message", "Successfully delete custom attribute: <b>" . $ej . "</b>");
$this->show_success_message();
goto rJ;
case "user_report_logs":
$Jb = get_option("user_logs_table_exists");
$IR = isset($_POST["mo_ldap_local_user_report_log"]) ? $_POST["mo_ldap_local_user_report_log"] : 0;
update_option("mo_ldap_local_user_report_log", $IR);
if (!($IR == 1 && $Jb != 1)) {
goto ZC;
}
$this->prefix_update_table();
ZC:
goto rJ;
case "keep_user_report_logs_on_unistall":
update_option("mo_ldap_local_keep_user_report_log_on_uninstall", isset($_POST["mo_ldap_local_keep_user_report_log"]) ? $_POST["mo_ldap_local_keep_user_report_log"] : 0);
goto rJ;
case "mo_ldap_pass":
$WE = isset($_POST["enable_ldap_login"]) ? 1 : 0;
update_option("mo_ldap_export", $WE);
if ($WE == 1) {
update_option("mo_ldap_local_message", "Service account password will be exported in encrypted fashion");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto HR;
}
update_option("mo_ldap_local_message", "Service account password will not be exported.");
$this->show_error_message();
HR:
goto rJ;
case "mo_ldap_export":
$jJ = get_option("mo_ldap_local_server_url");
if (!empty($jJ)) {
$this->miniorange_ldap_export();
// [PHPDeobfuscator] Implied goto
goto ik;
}
update_option("mo_ldap_local_message", "LDAP Configuration not set. Please configure LDAP Connection settings.");
$this->show_error_message();
ik:
goto rJ;
case "mo_ldap_import":
$o8 = $_FILES["mo_ldap_import_file"]["name"];
$SG = $_FILES["mo_ldap_import_file"]["size"];
$Pl = $_FILES["mo_ldap_import_file"]["tmp_name"];
$RW = $_FILES["mo_ldap_import_file"]["type"];
$RN = strtolower(pathinfo($o8, PATHINFO_EXTENSION));
if ($RN == "json") {
$Ej = file_get_contents($Pl);
$JW = json_decode($Ej, true);
error_log("Started importing uploaded configurations");
if (array_key_exists("ldap_Login", $JW) || array_key_exists("ldap_config", $JW) || array_key_exists("Role_Mapping", $JW) || array_key_exists("Attribute_Mapping", $JW) || array_key_exists("Dirsync_Ldap_To_Wp_Sync", $JW) || array_key_exists("Dirsync_Wp_To_Ldap_sync", $JW)) {
delete_option("mo_ldap_local_custom_attributes");
delete_option("mo_ldap_local_role_mapping_key_array");
delete_option("mo_ldap_local_role_mapping_value_array");
delete_option("mo_ldap_local_server_url_status");
delete_option("mo_ldap_local_service_account_status");
delete_option("mo_ldap_local_user_mapping_status");
delete_option("mo_ldap_local_username_status");
delete_option("mo_ldap_local_role_mapping_group_names");
delete_option("mo_ldap_local_ldap_protocol");
delete_option("mo_ldap_local_ldap_server_address");
delete_option("mo_ldap_local_ldap_port_number");
delete_option("mo_ldap_local_server_password");
delete_option("mo_ldap_local_role_mapping_count");
update_option("mo_ldap_local_enable_login", 0);
update_option("mo_ldap_local_enable_role_mapping", 0);
update_option("mo_ldap_local_enable_attr_mapping", 0);
update_option("mo_ldap_local_enable_update_ldap", 0);
delete_option("mo_ldap_local_enable_both_login");
update_option("mo_ldap_local_register_user", 0);
delete_option("mo_ldap_local_redirect_to");
delete_option("mo_ldap_local_custom_redirect");
update_option("mo_local_filter_check", 0);
update_option("mo_ldap_local_authorized_users_only", 0);
update_option("mo_ldap_local_keep_existing_user_roles", 0);
delete_option("mo_ldap_local_username_attribute");
$E1 = unserialize(Tab_ldap_Class_Names);
$wy = $JW["plugin_version"]["plugin_version"];
foreach ($JW as $zg => $k7) {
$L3 = call_user_func($E1[$zg] . "::getConstants");
foreach ($L3 as $k_ => $n_) {
if (!array_key_exists($k_, $k7)) {
goto lZ;
}
if (!($k_ == "mapping_count")) {
goto Mm;
}
$Bo = $k7[$k_];
Mm:
if ($k_ == "Role_mapping_key") {
if (!empty($wy)) {
goto qk;
}
$Yv = array();
$HZ = 1;
et:
if (!($HZ <= $Bo)) {
update_option("mo_ldap_local_role_mapping_key_raw_array", $Yv);
qk:
goto Kq;
}
$dc = sanitize_text_field($k7[$k_][$HZ]);
$Yv[$n_ . $HZ] = $dc;
$HZ++;
goto et;
}
if ($k_ == "Role_mapped_value") {
if (!empty($wy)) {
goto UD;
}
$Y1 = array();
$HZ = 1;
ae:
if (!($HZ <= $Bo)) {
update_option("mo_ldap_local_role_mapping_value_raw_array", $Y1);
UD:
goto Kq;
}
$dc = sanitize_text_field($k7[$k_][$HZ]);
$Y1[$n_ . $HZ] = $dc;
$HZ++;
goto ae;
}
if ($k_ == "Role_mapping_key_array") {
update_option("mo_ldap_local_role_mapping_key_array", serialize($k7["Role_mapping_key_array"]));
goto Kq;
}
if ($k_ == "Role_mapping_value_array") {
update_option("mo_ldap_local_role_mapping_value_array", serialize($k7["Role_mapping_value_array"]));
goto Kq;
}
if ($k_ == "Role_mapping_group_names") {
update_option("mo_ldap_local_role_mapping_group_names", serialize($k7["Role_mapping_group_names"]));
goto Kq;
}
if ($k_ == "custom_attribute_name") {
$RS = sizeof($k7[$k_]);
$jx = array();
$HZ = 1;
Pc:
if (!($HZ <= $RS)) {
update_option("mo_ldap_local_custom_attributes", serialize(array_unique($jx)));
// [PHPDeobfuscator] Implied goto
goto Kq;
}
$dc = sanitize_text_field($k7[$k_][$HZ]);
$jx["mo_ldap_local_custom_attribute_" . $dc] = $dc;
$HZ++;
goto Pc;
}
$dc = !empty(sanitize_text_field($k7[$k_])) ? sanitize_text_field($k7[$k_]) : $k7[$k_];
if (!($n_ == "mo_ldap_local_server_url" or $n_ == "mo_ldap_local_server_dn" or $n_ == "mo_ldap_local_search_base" or $n_ == "mo_ldap_local_search_filter" or $n_ == "mo_ldap_local_username_attribute")) {
goto In;
}
if ($n_ == "mo_ldap_local_username_attribute") {
if (!empty($wy)) {
goto kW;
}
$iI = explode(";", $dc);
$W5 = array("samaccountname", "mail", "userprincipalname", "uid", "cn");
$dc = array();
$by = '';
foreach ($iI as $k_ => $Y5) {
if (in_array(strtolower($Y5), $W5)) {
array_push($dc, strtolower($Y5));
// [PHPDeobfuscator] Implied goto
goto lx;
}
$by = $by . "," . strtolower($Y5);
lx:
}
if (!($by != '')) {
goto ip;
}
$by = trim($by, ",");
update_option("mo_ldap_local_extra_user_attribute", $by);
array_push($dc, "extraUserAttribute");
// [PHPDeobfuscator] Implied goto
goto ip;
}
$dc = Mo_Ldap_Local_Util::encrypt($dc);
ip:
kW:
In:
update_option($n_, $dc);
Kq:
lZ:
}
}
if (!empty($wy)) {
goto Df;
}
error_log("Importing changes for Version 23.0 and below");
$x3 = Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_server_url"));
$mX = "/[:]/";
$x3 = str_replace("//", '', $x3);
$Rd = preg_split($mX, $x3);
update_option("mo_ldap_local_ldap_protocol", $Rd[0]);
update_option("mo_ldap_local_ldap_server_address", Mo_Ldap_Local_Util::encrypt($Rd[1]));
update_option("mo_ldap_local_ldap_port_number", $Rd[2]);
$W0 = get_option("mo_ldap_local_role_mapping_key_raw_array");
$FS = get_option("mo_ldap_local_role_mapping_value_raw_array");
delete_option("mo_ldap_local_role_mapping_key_raw_array");
delete_option("mo_ldap_local_role_mapping_value_raw_array");
$Zf = array();
$HZ = 1;
AC:
if (!($HZ <= $Bo)) {
$Pu = count($Zf);
update_option("mo_ldap_local_role_mapping_count", $Pu);
$d8 = array();
$O2 = array();
$H4 = array();
$HZ = 1;
$cy = "/[=,]/";
foreach ($Zf as $k_ => $dc) {
$d8["mo_ldap_local_mapping_key_" . $HZ] = $k_;
$O2["mo_ldap_local_mapping_value_" . $HZ] = $dc;
$ly = preg_split($cy, $k_);
$H4[$HZ] = $ly[1];
$HZ++;
}
update_option("mo_ldap_local_role_mapping_key_array", serialize($d8));
update_option("mo_ldap_local_role_mapping_value_array", serialize($O2));
update_option("mo_ldap_local_role_mapping_group_names", serialize($H4));
Df:
$cq = get_option("mo_ldap_local_username_attribute");
if (!empty($cq)) {
goto SS;
}
update_option("mo_local_filter_check", 1);
SS:
update_option("mo_ldap_local_message", "The file was imported successfully");
$this->show_success_message();
// [PHPDeobfuscator] Implied goto
goto x3;
}
if (empty($Zf[$W0["mo_ldap_local_mapping_key_" . $HZ]])) {
$Zf[$W0["mo_ldap_local_mapping_key_" . $HZ]] = array($FS["mo_ldap_local_mapping_value_" . $HZ]);
// [PHPDeobfuscator] Implied goto
goto Qb;
}
$iH = $Zf[$W0["mo_ldap_local_mapping_key_" . $HZ]];
array_push($iH, $FS["mo_ldap_local_mapping_value_" . $HZ]);
$Zf[$W0["mo_ldap_local_mapping_key_" . $HZ]] = $iH;
Qb:
$HZ++;
goto AC;
}
update_option("mo_ldap_local_message", "Incorrect file uploaded! Please upload the file that was exported from this plugin");
$this->show_error_message();
goto x3;
}
update_option("mo_ldap_local_message", "Incorrect file uploaded! Please upload the file that was exported from this plugin");
$this->show_error_message();
x3:
goto rJ;
case "mo_ldap_local_login_send_query":
$e4 = sanitize_text_field($_POST["query"]);
$qo = sanitize_text_field($_POST["query_email"]);
$Ey = sanitize_text_field($_POST["query_phone"]);
$gq = Jp_hwfrqar_mzwhwzl_arvowfra::wa_zvweh_fmazpbrv();
if ($gq) {
$e4 = "[WP LDAP for Intranet (Free Trial single site)]: " . $e4;
// [PHPDeobfuscator] Implied goto
goto uo;
}
$e4 = "[WP LDAP for Intranet (Premium single site)]: " . $e4;
uo:
$this->mo_ldap_send_query($qo, $Ey, $e4);
goto rJ;
case "mo_ldap_login_send_query":
$qo = sanitize_text_field($_POST["inner_form_email_id"]);
$Ey = sanitize_text_field($_POST["inner_form_phone_id"]);
$e4 = sanitize_text_field($_POST["inner_form_query_id"]);
$C3 = get_option("mo_ldap_directory_server_value");
if (strcasecmp($C3, "msad") == 0) {
$C3 = "Microsoft Active Directory";
goto vE;
}
if (strcasecmp($C3, "openldap") == 0) {
$C3 = "OpenLDAP";
goto vE;
}
if (strcasecmp($C3, "freeipa") == 0) {
$C3 = "FreeIPA";
goto vE;
}
if (strcasecmp($C3, "jumpcloud") == 0) {
$C3 = "JumpCloud";
goto vE;
}
if (strcasecmp($C3, "other") == 0) {
$C3 = get_option("mo_ldap_directory_server_custom_value");
// [PHPDeobfuscator] Implied goto
goto vE;
}
$C3 = "Not Configured";
vE:
update_option("mo_ldap_local_directory_server", $C3);
$cB = $_POST["export_configuration_choice"];
if ($cB == "yes") {
$XX = $this->auto_email_ldap_export();
$XX = implode(" <br>", $XX);
$e4 = $e4 . " ,<br><br>Plugin Configuration:<br> " . $XX;
goto dw;
}
if ($cB == "no") {
$XX = "Configuration was not uploaded by user";
$e4 = $e4 . " ,<br><br>Plugin Configuration:<br> " . $XX;
// [PHPDeobfuscator] Implied goto
goto dw;
}
dw:
$gq = Jp_hwfrqar_mzwhwzl_arvowfra::wa_zvweh_fmazpbrv();
if ($gq) {
$e4 = "[WP LDAP for Intranet (Free Trial single site)]: " . $e4;
// [PHPDeobfuscator] Implied goto
goto Wa;
}
$e4 = "[WP LDAP for Intranet (Premium single site)]: " . $e4;
Wa:
$this->mo_ldap_send_query($qo, $Ey, $e4);
goto rJ;
case "mo_ldap_login_send_feature_request_query":
$qo = sanitize_text_field($_POST["query_email"]);
$Ey = sanitize_text_field($_POST["query_phone"]);
$e4 = sanitize_text_field($_POST["query"]);
$gq = Jp_hwfrqar_mzwhwzl_arvowfra::wa_zvweh_fmazpbrv();
if ($gq) {
$e4 = "[WP LDAP for Intranet (Free Trial single site)]: " . $e4;
// [PHPDeobfuscator] Implied goto
goto lG;
}
$e4 = "[WP LDAP for Intranet (Premium single site)]: " . $e4;
lG:
$this->mo_ldap_send_query($qo, $Ey, $e4);
goto rJ;
case "mo_ldap_local_fallback_login":
update_option("mo_ldap_local_enable_fallback_login", isset($_POST["mo_ldap_local_enable_fallback_login"]) ? $_POST["mo_ldap_local_enable_fallback_login"] : 0);
update_option("mo_ldap_local_message", "Fallback login using WordPress password enabled");
$this->show_success_message();
goto rJ;
case "mo_ldap_save_restrict_login_by_role":
$dm = isset($_POST["mo_ldap_local_restrict_user_by_role"]) ? $_POST["mo_ldap_local_restrict_user_by_role"] : 0;
update_option("mo_ldap_enable_role_restriction", $dm);
$rs = empty($_POST["mo_ldap_restrict_role"]) ? array() : $_POST["mo_ldap_restrict_role"];
update_option("mo_ldap_restricted_login_roles", serialize($rs));
goto rJ;
}
rJ:
Nr:
if (!(isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_feedback") == 0)) {
goto dJ;
}
$user = wp_get_current_user();
$hW = "Query :[WordPress LDAP/AD Plugin:] Plugin Deactivated: ";
$Tl = array_key_exists("query_feedback", $_POST) ? sanitize_textarea_field(wp_unslash($_POST["query_feedback"])) : false;
$es = '';
if (!isset($_POST["get_reply"])) {
goto Wv;
}
$es = sanitize_text_field(wp_unslash($_POST["get_reply"]));
Wv:
if (empty($es)) {
$es = "NO";
$hW .= "<strong><span style=\"color: red;\">[Follow up Needed : NO]</strong></span><br> ";
// [PHPDeobfuscator] Implied goto
goto EZ;
}
$es = "YES";
$hW .= "<strong><span style=\"color: green;\">[Follow up Needed : YES]</strong></span><br>";
EZ:
if (empty($Tl)) {
goto k8;
}
$hW .= "<br>Feedback : " . $Tl . "<br>";
k8:
$j9 = !empty(get_option("mo_ldap_plugin_version")) ? get_option("mo_ldap_plugin_version") : "26.0.1";
$hW .= "<br>Current Version Installed : " . $j9 . "<br>";
if (!isset($_POST["rate"])) {
goto eI;
}
$QP = sanitize_text_field(wp_unslash($_POST["rate"]));
$hW .= "<br>[Rating : " . $QP . "]<br>";
eI:
$qo = isset($_POST["query_mail"]) ? sanitize_email(wp_unslash($_POST["query_mail"])) : '';
$ar = "WordPress LDAP/AD Plugin Feedback (Premium Plugin)- " . $qo;
if (filter_var($qo, FILTER_VALIDATE_EMAIL)) {
goto RA;
}
$qo = get_option("mo_ldap_local_admin_email");
if (!empty($qo)) {
goto QA;
}
$qo = $user->user_email;
QA:
RA:
$Q2 = isset($_POST["company"]) ? sanitize_text_field(wp_unslash($_POST["company"])) : '';
$EW = new Mo_Ldap_Local_Customer();
if (is_null($EW)) {
dJ:
if (!(isset($_POST["option"]) && strcasecmp($_POST["option"], "mo_ldap_skip_feedback") == 0)) {
goto aD;
}
deactivate_plugins(__DIR__."/input.php");
update_option("mo_ldap_local_message", "Plugin deactivated successfully.");
$this->deactivate_error_message();
aD:
// [PHPDeobfuscator] Implied return
return;
}
$Qa = json_decode($EW->send_email_alert($ar, $qo, $hW, $Q2), true);
if (!(json_last_error() === JSON_ERROR_NONE)) {
goto og;
}
if (is_array($Qa) && array_key_exists("status", $Qa) && strcasecmp($Qa["status"], "ERROR") === 0) {
update_option("mo_ldap_local_message", $Qa["message"]);
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto Uj;
}
if ($Qa) {
goto sQ;
}
update_option("mo_ldap_local_message", "Error while submitting the query.");
$this->show_error_message();
sQ:
Uj:
og:
deactivate_plugins(__DIR__."/input.php");
update_option("mo_ldap_local_message", "Thank you for the feedback.");
$this->show_success_message();
wp_safe_redirect("plugins.php");
exit;
}
function mo_ldap_send_query($qo, $Ey, $e4)
{
if (Mo_Ldap_Local_Util::check_empty_or_null($qo) || Mo_Ldap_Local_Util::check_empty_or_null($e4)) {
update_option("mo_ldap_local_message", "Please submit your query along with email.");
$this->show_error_message();
return;
}
$cp = new Mo_Ldap_Local_Customer();
$Qa = json_decode($cp->submit_contact_us($qo, $Ey, $e4), true);
if (isset($Qa["status"]) && strcasecmp($Qa["status"], "CURL_ERROR") == 0) {
update_option("mo_ldap_local_message", $Qa["statusMessage"]);
$this->show_error_message();
goto Jb;
}
if (json_last_error() == JSON_ERROR_NONE) {
if ($Qa == false) {
update_option("mo_ldap_local_message", "Your query could not be submitted. Please try again.");
$this->show_error_message();
// [PHPDeobfuscator] Implied goto
goto US;
}
update_option("mo_ldap_local_message", "Thanks for getting in touch! We shall get back to you shortly.");
$this->show_success_message();
goto US;
}
US:
Jb:
}
function miniorange_ldap_export()
{
if (!(array_key_exists("option", $_POST) && $_POST["option"] == "mo_ldap_export")) {
// [PHPDeobfuscator] Implied return
return;
}
$s0 = get_option("active_plugins");
$jf = in_array("directory_sync/directory_sync.php", $s0);
$dn = array("Dirsync_Ldap_To_Wp_Sync" => "mo_option_ldap_dirsync_ldap_to_wp_sync", "Dirsync_Wp_To_Ldap_sync" => "mo_option_ldap_dirsync_wp_to_ldap_sync");
$E1 = unserialize(Tab_ldap_Class_Names);
$VA = get_option("mo_dirsync_ldap_to_wp_config_done");
$jv = get_option("mo_dirsync_wp_to_ldap_config_done");
if (!$jf) {
foreach ($dn as $Wu => $n_) {
if (!array_key_exists($Wu, $E1)) {
goto Nm;
}
unset($E1[$Wu]);
Nm:
}
// [PHPDeobfuscator] Implied goto
goto Tv;
}
if ($VA) {
goto fl;
}
if (!array_key_exists("Dirsync_Ldap_To_Wp_Sync", $E1)) {
goto hu;
}
unset($E1["Dirsync_Ldap_To_Wp_Sync"]);
hu:
fl:
if ($jv) {
goto L0;
}
if (!array_key_exists("Dirsync_Wp_To_Ldap_sync", $E1)) {
goto VB;
}
unset($E1["Dirsync_Wp_To_Ldap_sync"]);
VB:
L0:
Tv:
$JW = array();
foreach ($E1 as $k_ => $dc) {
$JW[$k_] = $this->mo_get_configuration_array($dc);
}
header("Content-Disposition: attachment; filename=miniorange-ldap-config.json");
echo json_encode($JW, "JSON_U^EWWY_UV__\\ASHES");
exit;
}
function mo_get_configuration_array($HM)
{
$L3 = call_user_func($HM . "::getConstants");
$Bo = get_option("mo_ldap_local_role_mapping_count");
$yz = array();
$is = array();
$oL = array();
$b9 = array();
foreach ($L3 as $k_ => $dc) {
if ($dc == "mo_ldap_local_server_url" or $dc == "mo_ldap_local_server_password" or $dc == "mo_ldap_local_server_dn" or $dc == "mo_ldap_local_search_base" or $dc == "mo_ldap_local_search_filter" or $dc == "mo_ldap_local_username_attribute") {
$Yj = 1;
// [PHPDeobfuscator] Implied goto
goto Yb;
}
$Yj = 0;
Yb:
if ($dc == "mo_ldap_local_mapping_key_") {
$B4 = unserialize(get_option("mo_ldap_local_role_mapping_key_array"));
$HZ = 1;
F1:
if (!($HZ <= $Bo)) {
$Sf = $is;
goto TN;
}
$is[$HZ] = $B4[$dc . $HZ];
$HZ++;
goto F1;
}
if ($dc == "mo_ldap_local_mapping_value_") {
$st = unserialize(get_option("mo_ldap_local_role_mapping_value_array"));
$HZ = 1;
i9:
if (!($HZ <= $Bo)) {
$Sf = $oL;
goto TN;
}
$oL[$HZ] = $st[$dc . $HZ];
$HZ++;
goto i9;
}
if ($dc == "mo_ldap_local_custom_attribute_") {
$Rv = unserialize(get_option("mo_ldap_local_custom_attributes"));
$HZ = 1;
foreach ($Rv as $Pt => $dc) {
$b9[$HZ++] = $dc;
}
$Sf = $b9;
// [PHPDeobfuscator] Implied goto
goto TN;
}
$Sf = get_option($dc);
TN:
if (!$Sf) {
goto wb;
}
if (!(@unserialize(strval($Sf)) !== false)) {
goto mE;
}
$Sf = unserialize(strval($Sf));
mE:
if ($Yj == 1) {
if ($dc == "mo_ldap_local_server_password" and get_option("mo_ldap_export") == "0") {
goto c0;
}
if ($dc == "mo_ldap_local_server_password" and get_option("mo_ldap_export") == "1") {
$yz[$k_] = $Sf;
goto X8;
}
if ($k_ == "user_attr") {
$yz[$k_] = $Sf;
// [PHPDeobfuscator] Implied goto
goto X8;
}
$yz[$k_] = Mo_Ldap_Local_Util::decrypt($Sf);
goto X8;
}
if ($dc == "mo_ldap_local_ou_role_mapping_options" || $dc == "mo_ldap_restricted_login_roles") {
$yz[$k_] = serialize($Sf);
// [PHPDeobfuscator] Implied goto
goto f1;
}
$yz[$k_] = $Sf;
f1:
X8:
wb:
c0:
}
return $yz;
}
function auto_email_ldap_export()
{
$lC = get_option("mo_ldap_local_directory_server");
$tH = get_option("mo_ldap_local_server_url") ? Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_server_url")) : '';
$Jo = get_option("mo_ldap_local_server_dn") ? Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_server_dn")) : '';
$yU = get_option("mo_ldap_local_search_base") ? Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_search_base")) : '';
$If = get_option("mo_ldap_local_search_filter") ? Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_search_filter")) : '';
$XX = array("Directory Server" => "Directory Server: " . $lC, "LDAP Server" => "LDAP Server: " . $tH, "Service Account DN" => "Service Account DN: " . $Jo, "Search Base" => "Search Base: " . $yU, "LDAP Search Filter" => "LDAP Search Filter: " . $If);
return $XX;
}
function test_attribute_configuration()
{
$eV = apply_filters("mo_check_config", '');
if (!(is_user_logged_in() && $eV)) {
goto LW;
}
if (!(current_user_can("administrator") && isset($_REQUEST["option"]))) {
goto i0;
}
if ($_REQUEST["option"] == "testattrconfig") {
$Dv = $_REQUEST["user"];
$gi = new Mo_Ldap_Local_Config();
$gi->test_attribute_configuration($Dv);
goto SZ;
}
if ($_REQUEST["option"] == "testrolemappingconfig") {
$Dv = $_REQUEST["user"];
$Y9 = new Mo_Ldap_Local_Role_Mapping();
$Y9->test_configuration($Dv);
goto SZ;
}
if ($_REQUEST["option"] == "searchbaselist") {
$gi = new Mo_Ldap_Local_Config();
$gi->show_search_bases_list();
goto SZ;
}
if ($_REQUEST["option"] == "fecthattributesforldapserver") {
$lC = get_option("mo_ldap_directory_server_value");
$oR = new DirectoryFactory();
$oR = $oR->selectDirectorySystem($lC);
$gi = new Mo_Ldap_Local_Config();
$gi->show_all_ldap_attributes($oR);
// [PHPDeobfuscator] Implied goto
goto SZ;
}
SZ:
i0:
LW:
}
function save_success_customer_config($Ij, $u4, $no, $hW)
{
update_option("mo_ldap_local_admin_customer_key", $Ij);
update_option("mo_ldap_local_admin_api_key", $u4);
update_option("mo_ldap_local_customer_token", $no);
update_option("mo_ldap_local_password", '');
update_option("mo_ldap_local_message", $hW);
$this->show_success_message();
}
function mo_ldap_local_settings_style()
{
wp_enqueue_style("mo_ldap_admin_settings_style", plugins_url("includes/css/style_settings.min.css", __DIR__."/input.php"), array(), "26.0.1");
wp_enqueue_style("mo_ldap_admin_settings_phone_style", plugins_url("includes/css/phone.min.css", __DIR__."/input.php"), array(), "26.0.1");
wp_enqueue_style("mo_ldap_admin_ldap_plugin_style", plugins_url("includes/css/mo_ldap_plugins_page.min.css", __DIR__."/input.php"), array(), "26.0.1");
wp_enqueue_style("mo_ldap_admin_font_awsome", plugins_url("includes/fonts/css/font-awesome.min.css", __DIR__."/input.php"), array(), "26.0.1");
}
function mo_ldap_local_settings_script()
{
wp_enqueue_script("mo_ldap_admin_settings_phone_script", plugins_url("includes/js/phone.js", __DIR__."/input.php"), array(), "26.0.1", false);
wp_enqueue_script("mo_ldap_admin_settings_script", plugins_url("includes/js/settings_page.js", __DIR__."/input.php"), array("jquery"), "26.0.1", false);
}
private function deactivate_error_message()
{
$oz = "error";
$hW = get_option("mo_ldap_local_message");
$tO = array("a" => array("href" => array(), "title" => array()), "br" => array(), "em" => array(), "strong" => array(), "b" => array(), "h1" => array(), "h2" => array(), "h3" => array(), "h4" => array(), "h5" => array(), "h6" => array(), "i" => array());
echo "<div id='error' class='" . esc_attr($oz) . "'> <p>" . wp_kses($hW, $tO) . "</p></div>";
}
function error_message()
{
$oz = "error";
$hW = get_option("mo_ldap_local_message");
echo "<div id='error' class='error'> <p>" . $hW . "</p></div>";
}
function success_message()
{
$oz = "updated";
$hW = get_option("mo_ldap_local_message");
echo "<div id='success' class='updated'> <p>" . $hW . "</p></div>";
}
function show_success_message()
{
remove_action("admin_notices", array($this, "error_message"));
add_action("admin_notices", array($this, "success_message"));
}
function show_error_message()
{
remove_action("admin_notices", array($this, "success_message"));
add_action("admin_notices", array($this, "error_message"));
}
function prefix_update_table()
{
global $uP;
global $wpdb;
$mx = $wpdb->get_charset_collate();
$gL = "CREATE TABLE if not exists`{$wpdb->base_prefix}user_report` (\r\n\t\t\t id int NOT NULL AUTO_INCREMENT,\r\n\t\t\t user_name varchar(50) NOT NULL,\r\n\t\t\t time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,\r\n\t\t\t Ldap_status varchar(250) NOT NULL,\r\n\t\t\t Ldap_error varchar(250) ,\r\n\t\t\t PRIMARY KEY (id)\r\n\t\t\t) {$mx};";
if (!function_exists("dbDelta")) {
require_once "ABSPATHwp-admin/includes/upgrade.php";
}
dbDelta($gL);
update_option("user_logs_table_exists", 1);
}
function mo_ldap_report_update($Dv, $o4, $AJ)
{
$YO = get_option("mo_ldap_local_user_report_log");
if (!($YO == 1)) {
goto co;
}
global $wpdb;
$Vo = $wpdb->prefix . "user_report";
$oj = $wpdb->get_row("SELECT id FROM {$Vo} WHERE user_name ='" . $Dv . "'");
$wpdb->insert($Vo, array("user_name" => $Dv, "time" => current_time("mysql"), "Ldap_status" => $o4, "Ldap_error" => $AJ));
co:
}
function mo_ldap_activate()
{
update_option("mo_ldap_local_host_name", "https://login.xecurify.com");
update_option("mo_ldap_local_register_user", 1);
$Zx = new DateTime("now");
$dU = $Zx->getTimestamp();
wp_schedule_event($dU, "daily", "mo_ldap_local_license_sync");
Jp_hwfrqar_mzwhwzl_arvowfra::efzwoezr_mzwhwzl();
}
function mo_ldap_local_deactivate()
{
do_action("flushcache");
Jp_hwfrqar_mzwhwzl_arvowfra::jrefzwoezr_mzwhwzl();
delete_option("mo_ldap_local_admin_email");
delete_option("mo_ldap_local_host_name");
delete_option("mo_ldap_local_default_config");
delete_option("mo_ldap_local_password");
delete_option("mo_ldap_local_admin_phone");
delete_option("mo_ldap_local_admin_customer_key");
delete_option("mo_ldap_local_admin_api_key");
delete_option("mo_ldap_local_customer_token");
delete_option("mo_ldap_local_message");
delete_option("mo_ldap_local_enable_login");
delete_option("mo_ldap_local_license_key");
delete_option("mo_ldap_local_license_verified");
delete_option("mo_ldap_plugin_version");
delete_option("mo_ldap_show_groups");
wp_clear_scheduled_hook("mo_ldap_local_license_sync");
}
function mo_ldap_local_license_sync()
{
$ho = !empty(get_option("mo_ldap_local_license_key")) ? Mo_Ldap_Local_Util::decrypt(get_option("mo_ldap_local_license_key")) : '';
if (empty($ho)) {
goto aW;
}
$D8 = new Mo_Ldap_Local_Customer();
$yq = json_decode($D8->XfskodsfhHJ($ho), true);
$nH = Jp_hwfrqar_mzwhwzl_arvowfra::bp_myjezr_hwfrqar_mzwhwzl($yq);
aW:
}
function update_status()
{
$wZ = get_option("mo_ldap_local_license_key");
if (empty($wZ)) {
goto CS;
}
$D8 = new Mo_Ldap_Local_Customer();
$D8->mo_ldap_local_update_status();
CS:
}
}
new Mo_Ldap_Local_Login();
Function Calls
None |
Stats
MD5 | 84e62794aa45e723a45cbf1627832c52 |
Eval Count | 0 |
Decode Time | 309 ms |