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 defined("\x5f\x4a\x45\x58\105\103") or die("\x52\x65\163\164\x72\151\143\x74\x6..
Decoded Output download
<?php
defined("_JEXEC") or die("Restricted access");
require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . "components" . DIRECTORY_SEPARATOR . "com_miniorange_dirsync" . DIRECTORY_SEPARATOR . "helpers" . DIRECTORY_SEPARATOR . "mo_ldap_utility.php";
jimport("joomla.plugin.plugin");
class plgSystemMiniorangedirsync extends JPlugin
{
public function onAfterInitialise()
{
$ms = MoLdapUtility::mo_ldap_get_details("#__miniorange_ntlm");
$PJ = JFactory::getSession();
$user = JFactory::getUser();
$oL = JFactory::getApplication();
if (!($user->id == 0)) {
goto pJ;
}
$user = JFactory::getUser();
if (!($user->id == 0 && $ms["enable_ntlm"] == 1)) {
goto Dp;
}
if (!isset($_SERVER["REMOTE_USER"])) {
goto zU;
}
$qe = $_SERVER["REMOTE_USER"];
$qe = array_pop(explode("\", $qe));
$yI = $this->check_user_in_ad($qe);
if (!($yI == '')) {
goto wx;
}
return;
wx:
$Rg = $this->get_user_from_joomla($yI);
if ($Rg) {
goto nl;
}
$vT = MoLdapUtility::mo_ldap_get_details("#__miniorange_dirsync_config");
$nH = $vT["ldap_server_url"];
$nH = MoLdapUtility::mo_ldap_decrypt($nH);
$Mc = $this->getConnection($nH);
if (!$Mc) {
goto q9;
}
$Qv = $vT["service_account_dn"];
$Qv = MoLdapUtility::mo_ldap_decrypt($Qv);
$QT = $vT["service_account_password"];
$QT = MoLdapUtility::mo_ldap_decrypt($QT);
$xq = $vT["search_base"];
$xq = MoLdapUtility::mo_ldap_decrypt($xq);
$oW = explode(";", $xq);
$sq = $vT["search_filter"];
$EH = str_replace("?", $qe, $sq);
$T9 = [$vT["email"], $vT["username"], $vT["name"]];
$XZ = null;
$NC = null;
$o1 = null;
$qd = array();
$i4 = @ldap_bind($Mc, $Qv, $QT);
$rY = 0;
eY:
if (!($rY < count($oW))) {
goto JN;
}
if (!($XZ = ldap_search($Mc, $oW[$rY], $EH, $T9))) {
goto n0;
}
$o1 = ldap_first_entry($Mc, $XZ);
$NC = ldap_get_entries($Mc, $XZ);
$oL = JFactory::getApplication();
if (!$NC["count"]) {
goto el;
}
$aq = $NC[0][$vT["email"]][0];
$zc = $NC[0][$vT["username"]][0];
$Dq = $NC[0][$vT["name"]][0];
el:
if (!(isset($aq) && $aq)) {
goto dd;
}
$qd["name"] = $Dq;
$qd["username"] = $zc;
$qd["email"] = $qd["email1"] = $qd["email2"] = JStringPunycode::emailToPunycode($aq);
$qd["password"] = $qd["password1"] = $qd["password2"] = JUserHelper::genRandomPassword();
$qd["activation"] = "0";
$qd["block"] = "0";
if (defined("JPATH_COMPONENT")) {
goto UR;
}
define("JPATH_COMPONENT", JPATH_BASE . "/components/");
UR:
$user = new JUser();
if ($user->bind($qd)) {
goto tZ;
}
throw new Exception("Could not bind data. Error: " . $user->getError());
tZ:
if ($user->save()) {
goto ep;
}
ep:
$Rg = $this->get_user_from_joomla($zc);
if (!($Rg != '')) {
goto OI;
}
$user = JUser::getInstance($Rg);
$QP = 0;
$PJ = JFactory::getSession();
$PJ->set("user", $user);
$oL->checkSession();
$hA = $PJ->getId();
$this->updateUsernameToSessionId($user->id, $user->username, $hA);
$user->setLastVisit();
$this->attributemapping($qe, $QP);
$this->groupmapping($qe, $QP);
$oL->redirect(JURI::root() . "index.php?");
OI:
dd:
n0:
Fy:
$rY++;
goto eY;
JN:
q9:
goto B2;
nl:
$user = JUser::getInstance($Rg);
$PJ = JFactory::getSession();
$PJ->set("user", $user);
$oL->checkSession();
$hA = $PJ->getId();
$this->updateUsernameToSessionId($user->id, $user->username, $hA);
$user->setLastVisit();
$QP = 1;
$this->attributemapping($qe, $QP);
$this->groupmapping($qe, $QP);
if (strpos(JURI::root(), $_SERVER["HTTP_HOST"])) {
goto hc;
}
$base_url = str_replace(array("http://", "https://"), '', JURI::root());
goto WJ;
hc:
$base_url = str_replace(array("http://" . $_SERVER["HTTP_HOST"], "https://" . $_SERVER["HTTP_HOST"]), '', JURI::root());
WJ:
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true)->select("group_id")->from($I8->quoteName("#__user_usergroup_map"))->where($I8->quoteName("user_id") . " = " . $I8->quote($user->id));
$I8->setQuery($bR);
$Ui = $I8->loadColumn();
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true)->select("*")->from($I8->quoteName("#__usergroups"))->where($I8->quoteName("parent_id") . " = " . $I8->quote(7) . "OR" . $I8->quoteName("parent_id") . " = " . $I8->quote(8));
$I8->setQuery($bR);
$YU = $I8->loadColumn();
array_push($YU, 7, 8);
$vT = array_intersect($Ui, $YU);
$GG = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '';
if (!($GG == '')) {
goto On;
}
$zC = !empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] !== "off" || $_SERVER["SERVER_PORT"] == 443 ? "https://" : "http://";
$GG = $zC . "{$_SERVER["HTTP_HOST"]}{$_SERVER["REQUEST_URI"]}";
On:
if (strpos($_SERVER["REQUEST_URI"], $base_url . "administrator/") === 0 || strpos($_SERVER["REQUEST_URI"], $base_url . "administrator/") || strpos($_SERVER["HTTP_REFERER"], $base_url . "administrator/") === 0 || strpos($_SERVER["HTTP_REFERER"], $base_url . "administrator/")) {
goto vL;
}
if (empty($GG)) {
goto jl;
}
$oL->redirect($GG);
goto FS;
jl:
$oL->redirect(JURI::root() . "index.php?");
FS:
goto CN;
vL:
if (!empty($vT)) {
goto dk;
}
if (empty($GG)) {
goto Em;
}
$oL->redirect($GG);
goto vS;
Em:
$oL->redirect(JURI::root() . "index.php?");
vS:
goto dS;
dk:
$oL->redirect(JURI::root() . "administrator/");
dS:
CN:
B2:
zU:
Dp:
pJ:
}
function attributemapping($qe, $QP)
{
$vT = MoLdapUtility::mo_ldap_get_details("#__miniorange_dirsync_config");
$Vy = JFactory::getUser();
$nH = $vT["ldap_server_url"];
$nH = MoLdapUtility::mo_ldap_decrypt($nH);
$Mc = self::getConnection($nH);
$Qv = $vT["service_account_dn"];
$Qv = MoLdapUtility::mo_ldap_decrypt($Qv);
$QT = $vT["service_account_password"];
$QT = MoLdapUtility::mo_ldap_decrypt($QT);
$xq = $vT["search_base"];
$xq = MoLdapUtility::mo_ldap_decrypt($xq);
$oW = explode(";", $xq);
$sq = $vT["search_filter"];
$EH = str_replace("?", $qe, $sq);
$XZ = null;
$NC = null;
$o1 = null;
$i4 = @ldap_bind($Mc, $Qv, $QT);
$rY = 0;
r3:
if (!($rY < count($oW))) {
goto LV;
}
$XZ = ldap_search($Mc, $oW[$rY], $EH);
$o1 = ldap_first_entry($Mc, $XZ);
$NC = ldap_get_entries($Mc, $XZ);
$qe = $NC[0][$vT["username"]][0];
$Wc = $NC[0][$vT["email"]][0];
$Dq = $NC[0][$vT["name"]][0];
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$X0 = array($I8->quoteName("email") . " = " . $I8->quote($Wc), $I8->quoteName("username") . " = " . $I8->quote($qe), $I8->quoteName("name") . " = " . $I8->quote($Dq));
$Z4 = array($I8->quoteName("id") . " = " . $I8->quote($Vy->id));
$bR->update($I8->quoteName("#__users"))->set($X0)->where($Z4);
$I8->setQuery($bR);
$BQ = $I8->execute();
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$bR->select(array("profile_key", "profile_value", "ordering"));
$bR->from($I8->quoteName("#__user_profiles"));
$bR->where($I8->quoteName("user_id") . " =" . $I8->quote($Vy->id));
$I8->setQuery($bR);
$O5 = $I8->loadRowList();
if (!$O5) {
goto Y_;
}
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$bR->delete($I8->quoteName("#__user_profiles"));
$bR->where($I8->quoteName("user_id") . " =" . $I8->quote($Vy->id));
$I8->setQuery($bR);
$O5 = $I8->execute();
Y_:
$yZ = $vT["user_profile_attributes"];
$nz = $Vy->id;
$Up = 0;
if (!(isset($yZ) && !empty($yZ))) {
goto LG;
}
$yZ = json_decode($yZ, true);
$lU = $this->selectMaxOrdering($nz);
foreach ($yZ as $vc) {
$um = strtolower($vc["attr_name"]);
$Do = strtolower($vc["attr_value"]);
if (!isset($NC[0][$Do][0])) {
goto GN;
}
if (is_array($NC[0][$Do])) {
goto Lj;
}
$Do = isset($NC[0][$Do]) ? $NC[0][$Do] : '';
goto Jj;
Lj:
$Do = isset($NC[0][$Do][0]) ? $NC[0][$Do][0] : '';
Jj:
GN:
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$Yi = array("user_id", "profile_key", "profile_value", "ordering");
$B1 = array($nz, $I8->quote("profile." . $um), $I8->quote($Do), ++$lU);
$bR->insert($I8->quoteName("#__user_profiles"))->columns($I8->quoteName($Yi))->values(implode(",", $B1));
$I8->setQuery($bR);
$I8->execute();
js:
}
Iq:
LG:
c_:
$rY++;
goto r3;
LV:
}
function groupmapping($qe, $QP)
{
$vT = MoLdapUtility::mo_ldap_get_details("#__miniorange_dirsync_config");
$nH = $vT["ldap_server_url"];
$nH = MoLdapUtility::mo_ldap_decrypt($nH);
$Mc = self::getConnection($nH);
$Qv = $vT["service_account_dn"];
$Qv = MoLdapUtility::mo_ldap_decrypt($Qv);
$QT = $vT["service_account_password"];
$QT = MoLdapUtility::mo_ldap_decrypt($QT);
$xq = $vT["search_base"];
$xq = MoLdapUtility::mo_ldap_decrypt($xq);
$oW = explode(";", $xq);
$sq = $vT["search_filter"];
$EH = str_replace("?", $qe, $sq);
$XZ = null;
$NC = null;
$o1 = null;
$T3 = MoLdapUtility::mo_ldap_get_details("#__miniorange_ldap_role_mapping");
$Vy = JFactory::getUser();
if (!($QP != 1 || $T3["disable_update_existing_users_role"] != 1)) {
goto pV;
}
$wl = $T3["mapping_value_default"];
if (isset($Vy->groups[8])) {
goto Kv;
}
$T1 = 1;
goto Du;
Kv:
$T1 = 0;
Du:
if (!($T3["enable_ldap_role_mapping"] && $T1)) {
goto DP;
}
JUserHelper::addUserToGroup($Vy->id, $wl);
if (!($QP != 1 || $T3["disable_update_existing_users_role"] != 1)) {
goto ZT;
}
foreach ($Vy->groups as $y6) {
if (!($y6 != $wl && $y6 != "8")) {
goto Qk;
}
JUserHelper::removeUserFromGroup($Vy->id, $y6);
Qk:
rG:
}
CI:
ZT:
DP:
pV:
if (!(($QP != 1 || $T3["disable_update_existing_users_role"] != 1) && $T3["enable_ldap_role_mapping"])) {
goto ff;
}
$i4 = @ldap_bind($Mc, $Qv, $QT);
if (!isset($T3["mapping_memberof_attribute"])) {
goto Xg;
}
$T9 = array($T3["mapping_memberof_attribute"]);
Xg:
$rY = 0;
e5:
if (!($rY < count($oW))) {
goto YD;
}
$XZ = ldap_search($Mc, $oW[$rY], $EH, $T9);
$o1 = ldap_first_entry($Mc, $XZ);
$NC = ldap_get_entries($Mc, $XZ);
$Jg = $T3["role_mapping_key_value"];
$Jg = json_decode($Jg, true);
$tt = $T3["role_mapping_groupvalue"];
$tt = json_decode($tt, true);
$Up = 1;
cM:
$rY++;
goto e5;
YD:
ff:
}
function get_user_from_joomla($qe)
{
$I8 = JFactory::getDBO();
$bR = $I8->getQuery(true)->select("id")->from("#__users")->where("username=" . $I8->quote($qe), "OR", "email=" . $I8->quote($qe));
$I8->setQuery($bR);
$eX = $I8->loadObject();
if ($eX != '') {
goto Z3;
}
return 0;
goto sz;
Z3:
return $eX->id;
sz:
}
function RegisterCurrentUser($Dq, $aq)
{
$oL = JFactory::getApplication();
$qd["name"] = isset($Dq) && !empty($Dq) ? $Dq : '';
$qd["username"] = $aq;
$qd["email"] = $qd["email1"] = $qd["email2"] = JStringPunycode::emailToPunycode($aq);
$qd["password"] = $qd["password1"] = $qd["password2"] = JUserHelper::genRandomPassword();
$qd["activation"] = "0";
$qd["block"] = "0";
jimport("joomla.application.component.model");
if (defined("JPATH_COMPONENT")) {
goto pU;
}
define("JPATH_COMPONENT", JPATH_BASE . "/components/");
pU:
$user = new JUser();
if ($user->bind($qd)) {
goto PP;
}
throw new Exception("Could not bind data. Error: " . $user->getError());
PP:
if ($user->save()) {
goto qb;
}
qb:
$eX = $this->get_user_from_joomla($aq);
if (!$eX) {
goto b3;
}
$user = JUser::getInstance($eX->id);
$PJ = JFactory::getSession();
$PJ->set("user", $user);
$oL->checkSession();
$hA = $PJ->getId();
$this->updateUsernameToSessionId($user->id, $user->username, $hA);
$user->setLastVisit();
$oL->redirect(JURI::root() . "index.php?");
b3:
}
function updateCurrentUserName($G6, $Dq)
{
if (!empty($Dq)) {
goto wJ;
}
return;
wJ:
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$X0 = array($I8->quoteName("name") . " = " . $I8->quote($Dq));
$Z4 = array($I8->quoteName("id") . " = " . $I8->quote($G6));
$bR->update($I8->quoteName("#__users"))->set($X0)->where($Z4);
$I8->setQuery($bR);
$vT = $I8->execute();
}
function updateUsernameToSessionId($Zq, $zc, $hA)
{
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$X0 = array($I8->quoteName("username") . " = " . $I8->quote($zc), $I8->quoteName("guest") . " = " . $I8->quote("0"), $I8->quoteName("userid") . " = " . $I8->quote($Zq));
$Z4 = array($I8->quoteName("session_id") . " = " . $I8->quote($hA));
$bR->update($I8->quoteName("#__session"))->set($X0)->where($Z4);
$I8->setQuery($bR);
$vT = $I8->execute();
}
function check_user_in_ad($qe)
{
$vT = MoLdapUtility::mo_ldap_get_details("#__miniorange_dirsync_config");
$nH = $vT["ldap_server_url"];
$nH = MoLdapUtility::mo_ldap_decrypt($nH);
$Mc = $this->getConnection($nH);
if (!$Mc) {
goto tb;
}
$Qv = $vT["service_account_dn"];
$Qv = MoLdapUtility::mo_ldap_decrypt($Qv);
$QT = $vT["service_account_password"];
$QT = MoLdapUtility::mo_ldap_decrypt($QT);
$xq = $vT["search_base"];
$xq = MoLdapUtility::mo_ldap_decrypt($xq);
$oW = explode(";", $xq);
$sq = $vT["search_filter"];
$EH = str_replace("?", $qe, $sq);
$XZ = null;
$NC = null;
$o1 = null;
$i4 = @ldap_bind($Mc, $Qv, $QT);
$rY = 0;
S2:
if (!($rY < count($oW))) {
goto mJ;
}
if ($XZ = ldap_search($Mc, $oW[$rY], $EH)) {
goto K9;
}
return '';
goto He;
K9:
$o1 = ldap_first_entry($Mc, $XZ);
$NC = ldap_get_entries($Mc, $XZ);
if ($o1) {
goto ku;
}
return '';
goto SM;
ku:
return $NC[0][$vT["username"]][0];
SM:
He:
nA:
$rY++;
goto S2;
mJ:
tb:
}
public function getConnection($nH)
{
$Mc = ldap_connect($nH);
if (!(version_compare(PHP_VERSION, "5.3.0") >= 0)) {
goto Ha;
}
ldap_set_option($Mc, LDAP_OPT_NETWORK_TIMEOUT, 5);
Ha:
ldap_set_option($Mc, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($Mc, LDAP_OPT_REFERRALS, 0);
return $Mc;
}
public static function selectMaxOrdering($nz)
{
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$bR->select("MAX(ordering)");
$bR->from($I8->quoteName("#__user_profiles"));
$bR->where($I8->quoteName("user_id") . " = " . $I8->quote($nz));
$I8->setQuery($bR);
$Sz = $I8->loadResult();
}
}
?>
Did this file decode correctly?
Original Code
<?php
defined("\x5f\x4a\x45\x58\105\103") or die("\x52\x65\163\164\x72\151\143\x74\x65\144\40\141\143\x63\x65\163\x73");
require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . "\x63\157\x6d\160\x6f\x6e\145\156\x74\163" . DIRECTORY_SEPARATOR . "\143\x6f\x6d\137\155\x69\156\151\157\162\x61\x6e\147\145\x5f\x64\x69\x72\x73\x79\156\143" . DIRECTORY_SEPARATOR . "\x68\x65\154\x70\x65\162\x73" . DIRECTORY_SEPARATOR . "\155\157\137\x6c\x64\x61\x70\137\x75\164\151\154\x69\164\171\x2e\x70\x68\x70";
jimport("\x6a\x6f\x6f\x6d\154\x61\56\160\154\x75\x67\x69\x6e\56\160\154\x75\147\151\156");
class plgSystemMiniorangedirsync extends JPlugin
{
public function onAfterInitialise()
{
$ms = MoLdapUtility::mo_ldap_get_details("\43\x5f\x5f\x6d\151\156\x69\x6f\162\141\x6e\147\145\x5f\156\x74\154\x6d");
$PJ = JFactory::getSession();
$user = JFactory::getUser();
$oL = JFactory::getApplication();
if (!($user->id == 0)) {
goto pJ;
}
$user = JFactory::getUser();
if (!($user->id == 0 && $ms["\145\156\x61\142\154\x65\x5f\156\x74\154\x6d"] == 1)) {
goto Dp;
}
if (!isset($_SERVER["\x52\x45\115\117\x54\x45\137\125\123\105\122"])) {
goto zU;
}
$qe = $_SERVER["\122\x45\115\x4f\124\105\137\x55\123\x45\x52"];
$qe = array_pop(explode("\x5c", $qe));
$yI = $this->check_user_in_ad($qe);
if (!($yI == '')) {
goto wx;
}
return;
wx:
$Rg = $this->get_user_from_joomla($yI);
if ($Rg) {
goto nl;
}
$vT = MoLdapUtility::mo_ldap_get_details("\43\x5f\137\x6d\151\x6e\151\x6f\162\x61\156\147\x65\x5f\x64\x69\x72\163\171\x6e\x63\137\x63\157\156\146\151\147");
$nH = $vT["\x6c\x64\x61\x70\x5f\x73\145\x72\x76\x65\x72\137\x75\162\x6c"];
$nH = MoLdapUtility::mo_ldap_decrypt($nH);
$Mc = $this->getConnection($nH);
if (!$Mc) {
goto q9;
}
$Qv = $vT["\x73\x65\162\x76\x69\143\145\137\x61\x63\143\157\165\156\x74\x5f\x64\156"];
$Qv = MoLdapUtility::mo_ldap_decrypt($Qv);
$QT = $vT["\163\145\162\166\x69\143\x65\137\x61\x63\143\x6f\x75\x6e\x74\x5f\x70\x61\163\x73\167\x6f\x72\x64"];
$QT = MoLdapUtility::mo_ldap_decrypt($QT);
$xq = $vT["\x73\145\x61\162\x63\x68\x5f\142\x61\x73\145"];
$xq = MoLdapUtility::mo_ldap_decrypt($xq);
$oW = explode("\x3b", $xq);
$sq = $vT["\x73\x65\x61\x72\x63\150\137\146\x69\x6c\164\145\x72"];
$EH = str_replace("\77", $qe, $sq);
$T9 = [$vT["\x65\x6d\x61\x69\x6c"], $vT["\x75\163\145\x72\x6e\141\x6d\x65"], $vT["\x6e\x61\155\145"]];
$XZ = null;
$NC = null;
$o1 = null;
$qd = array();
$i4 = @ldap_bind($Mc, $Qv, $QT);
$rY = 0;
eY:
if (!($rY < count($oW))) {
goto JN;
}
if (!($XZ = ldap_search($Mc, $oW[$rY], $EH, $T9))) {
goto n0;
}
$o1 = ldap_first_entry($Mc, $XZ);
$NC = ldap_get_entries($Mc, $XZ);
$oL = JFactory::getApplication();
if (!$NC["\143\x6f\x75\x6e\164"]) {
goto el;
}
$aq = $NC[0][$vT["\x65\x6d\141\151\154"]][0];
$zc = $NC[0][$vT["\165\163\x65\162\x6e\x61\x6d\145"]][0];
$Dq = $NC[0][$vT["\156\x61\155\x65"]][0];
el:
if (!(isset($aq) && $aq)) {
goto dd;
}
$qd["\x6e\x61\x6d\x65"] = $Dq;
$qd["\165\163\x65\162\x6e\x61\x6d\x65"] = $zc;
$qd["\145\155\x61\x69\x6c"] = $qd["\145\x6d\x61\151\154\x31"] = $qd["\145\x6d\x61\x69\x6c\62"] = JStringPunycode::emailToPunycode($aq);
$qd["\x70\x61\x73\163\x77\x6f\162\x64"] = $qd["\x70\x61\163\163\167\157\x72\144\61"] = $qd["\160\x61\x73\163\167\x6f\162\x64\62"] = JUserHelper::genRandomPassword();
$qd["\x61\143\x74\151\166\141\x74\x69\x6f\156"] = "\x30";
$qd["\142\154\157\x63\x6b"] = "\60";
if (defined("\x4a\x50\101\124\110\137\x43\x4f\115\x50\117\116\x45\x4e\124")) {
goto UR;
}
define("\112\120\101\124\x48\x5f\x43\117\115\x50\117\116\105\116\124", JPATH_BASE . "\57\x63\157\x6d\160\x6f\x6e\145\x6e\164\x73\x2f");
UR:
$user = new JUser();
if ($user->bind($qd)) {
goto tZ;
}
throw new Exception("\103\x6f\x75\154\x64\x20\156\x6f\x74\40\x62\151\156\x64\40\144\x61\x74\141\x2e\40\x45\x72\x72\x6f\x72\72\40" . $user->getError());
tZ:
if ($user->save()) {
goto ep;
}
ep:
$Rg = $this->get_user_from_joomla($zc);
if (!($Rg != '')) {
goto OI;
}
$user = JUser::getInstance($Rg);
$QP = 0;
$PJ = JFactory::getSession();
$PJ->set("\165\163\x65\x72", $user);
$oL->checkSession();
$hA = $PJ->getId();
$this->updateUsernameToSessionId($user->id, $user->username, $hA);
$user->setLastVisit();
$this->attributemapping($qe, $QP);
$this->groupmapping($qe, $QP);
$oL->redirect(JURI::root() . "\x69\156\x64\145\x78\56\160\150\x70\77");
OI:
dd:
n0:
Fy:
$rY++;
goto eY;
JN:
q9:
goto B2;
nl:
$user = JUser::getInstance($Rg);
$PJ = JFactory::getSession();
$PJ->set("\165\163\145\162", $user);
$oL->checkSession();
$hA = $PJ->getId();
$this->updateUsernameToSessionId($user->id, $user->username, $hA);
$user->setLastVisit();
$QP = 1;
$this->attributemapping($qe, $QP);
$this->groupmapping($qe, $QP);
if (strpos(JURI::root(), $_SERVER["\110\x54\x54\x50\137\x48\x4f\x53\x54"])) {
goto hc;
}
$base_url = str_replace(array("\150\x74\164\160\x3a\x2f\57", "\x68\164\164\160\163\x3a\57\57"), '', JURI::root());
goto WJ;
hc:
$base_url = str_replace(array("\150\x74\164\x70\x3a\x2f\57" . $_SERVER["\110\124\x54\x50\137\x48\117\x53\x54"], "\x68\x74\164\160\x73\72\57\57" . $_SERVER["\110\x54\x54\120\x5f\x48\x4f\123\x54"]), '', JURI::root());
WJ:
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true)->select("\147\162\157\x75\x70\137\x69\x64")->from($I8->quoteName("\x23\137\137\165\163\x65\x72\x5f\x75\x73\145\162\x67\x72\x6f\x75\160\x5f\155\141\160"))->where($I8->quoteName("\165\163\145\x72\x5f\151\x64") . "\x20\x3d\x20" . $I8->quote($user->id));
$I8->setQuery($bR);
$Ui = $I8->loadColumn();
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true)->select("\52")->from($I8->quoteName("\x23\x5f\x5f\165\x73\x65\162\147\x72\157\165\x70\163"))->where($I8->quoteName("\x70\x61\162\145\156\x74\137\151\x64") . "\40\75\x20" . $I8->quote(7) . "\117\122" . $I8->quoteName("\160\x61\x72\x65\156\x74\x5f\x69\x64") . "\40\75\x20" . $I8->quote(8));
$I8->setQuery($bR);
$YU = $I8->loadColumn();
array_push($YU, 7, 8);
$vT = array_intersect($Ui, $YU);
$GG = isset($_SERVER["\x48\x54\x54\120\x5f\122\x45\106\105\122\x45\x52"]) ? $_SERVER["\110\x54\x54\x50\x5f\x52\x45\x46\x45\x52\105\122"] : '';
if (!($GG == '')) {
goto On;
}
$zC = !empty($_SERVER["\110\x54\124\120\123"]) && $_SERVER["\x48\x54\x54\120\x53"] !== "\157\x66\x66" || $_SERVER["\123\x45\x52\126\x45\122\x5f\x50\117\122\124"] == 443 ? "\150\164\164\x70\163\72\57\57" : "\150\164\x74\x70\x3a\x2f\x2f";
$GG = $zC . "{$_SERVER["\110\124\124\x50\x5f\x48\117\x53\124"]}{$_SERVER["\x52\105\x51\125\105\123\124\137\x55\122\111"]}";
On:
if (strpos($_SERVER["\122\105\121\x55\105\123\x54\137\125\122\111"], $base_url . "\141\144\x6d\x69\x6e\151\x73\164\x72\141\x74\x6f\x72\x2f") === 0 || strpos($_SERVER["\x52\105\121\125\x45\x53\x54\137\125\122\x49"], $base_url . "\x61\x64\x6d\151\x6e\151\163\x74\162\x61\164\157\x72\57") || strpos($_SERVER["\x48\124\x54\x50\137\122\105\x46\105\x52\x45\x52"], $base_url . "\x61\x64\155\x69\156\x69\x73\164\162\141\164\x6f\x72\x2f") === 0 || strpos($_SERVER["\x48\x54\124\x50\x5f\122\x45\x46\x45\122\x45\x52"], $base_url . "\141\x64\x6d\x69\156\x69\163\164\x72\x61\164\157\x72\57")) {
goto vL;
}
if (empty($GG)) {
goto jl;
}
$oL->redirect($GG);
goto FS;
jl:
$oL->redirect(JURI::root() . "\x69\156\x64\145\x78\x2e\160\150\160\77");
FS:
goto CN;
vL:
if (!empty($vT)) {
goto dk;
}
if (empty($GG)) {
goto Em;
}
$oL->redirect($GG);
goto vS;
Em:
$oL->redirect(JURI::root() . "\151\156\x64\145\x78\x2e\x70\x68\x70\77");
vS:
goto dS;
dk:
$oL->redirect(JURI::root() . "\x61\144\x6d\x69\156\x69\163\x74\x72\141\x74\157\x72\57");
dS:
CN:
B2:
zU:
Dp:
pJ:
}
function attributemapping($qe, $QP)
{
$vT = MoLdapUtility::mo_ldap_get_details("\43\x5f\137\155\151\156\151\157\162\141\156\x67\145\137\144\151\162\x73\x79\156\143\137\143\157\x6e\146\151\147");
$Vy = JFactory::getUser();
$nH = $vT["\x6c\144\141\x70\x5f\163\x65\162\166\145\162\137\x75\162\154"];
$nH = MoLdapUtility::mo_ldap_decrypt($nH);
$Mc = self::getConnection($nH);
$Qv = $vT["\x73\x65\x72\x76\x69\x63\x65\x5f\141\x63\x63\157\x75\x6e\x74\x5f\144\x6e"];
$Qv = MoLdapUtility::mo_ldap_decrypt($Qv);
$QT = $vT["\x73\145\x72\166\x69\143\145\137\x61\x63\x63\157\x75\156\164\137\x70\x61\x73\x73\x77\157\162\x64"];
$QT = MoLdapUtility::mo_ldap_decrypt($QT);
$xq = $vT["\163\145\x61\162\143\x68\x5f\142\x61\x73\145"];
$xq = MoLdapUtility::mo_ldap_decrypt($xq);
$oW = explode("\73", $xq);
$sq = $vT["\x73\x65\x61\x72\x63\x68\137\x66\x69\154\x74\145\162"];
$EH = str_replace("\x3f", $qe, $sq);
$XZ = null;
$NC = null;
$o1 = null;
$i4 = @ldap_bind($Mc, $Qv, $QT);
$rY = 0;
r3:
if (!($rY < count($oW))) {
goto LV;
}
$XZ = ldap_search($Mc, $oW[$rY], $EH);
$o1 = ldap_first_entry($Mc, $XZ);
$NC = ldap_get_entries($Mc, $XZ);
$qe = $NC[0][$vT["\165\x73\x65\162\156\x61\155\x65"]][0];
$Wc = $NC[0][$vT["\145\x6d\141\x69\154"]][0];
$Dq = $NC[0][$vT["\x6e\141\x6d\x65"]][0];
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$X0 = array($I8->quoteName("\x65\x6d\x61\x69\x6c") . "\x20\x3d\40" . $I8->quote($Wc), $I8->quoteName("\x75\x73\145\x72\x6e\141\x6d\x65") . "\40\x3d\x20" . $I8->quote($qe), $I8->quoteName("\x6e\x61\155\x65") . "\x20\x3d\x20" . $I8->quote($Dq));
$Z4 = array($I8->quoteName("\151\144") . "\x20\75\40" . $I8->quote($Vy->id));
$bR->update($I8->quoteName("\43\137\x5f\x75\163\145\162\x73"))->set($X0)->where($Z4);
$I8->setQuery($bR);
$BQ = $I8->execute();
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$bR->select(array("\160\162\157\146\151\154\145\137\x6b\x65\x79", "\160\162\x6f\x66\151\x6c\x65\x5f\x76\x61\154\165\x65", "\157\162\144\145\162\x69\156\147"));
$bR->from($I8->quoteName("\x23\x5f\x5f\165\163\x65\x72\x5f\x70\162\157\x66\151\154\145\x73"));
$bR->where($I8->quoteName("\165\x73\145\162\x5f\151\x64") . "\40\75" . $I8->quote($Vy->id));
$I8->setQuery($bR);
$O5 = $I8->loadRowList();
if (!$O5) {
goto Y_;
}
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$bR->delete($I8->quoteName("\x23\x5f\x5f\x75\163\145\x72\x5f\160\162\157\x66\x69\154\x65\x73"));
$bR->where($I8->quoteName("\x75\x73\145\162\x5f\x69\x64") . "\x20\75" . $I8->quote($Vy->id));
$I8->setQuery($bR);
$O5 = $I8->execute();
Y_:
$yZ = $vT["\165\163\145\x72\x5f\x70\162\x6f\x66\x69\154\145\x5f\141\164\x74\162\151\142\165\x74\145\x73"];
$nz = $Vy->id;
$Up = 0;
if (!(isset($yZ) && !empty($yZ))) {
goto LG;
}
$yZ = json_decode($yZ, true);
$lU = $this->selectMaxOrdering($nz);
foreach ($yZ as $vc) {
$um = strtolower($vc["\141\x74\164\162\137\156\x61\155\x65"]);
$Do = strtolower($vc["\141\164\x74\162\x5f\x76\141\x6c\165\145"]);
if (!isset($NC[0][$Do][0])) {
goto GN;
}
if (is_array($NC[0][$Do])) {
goto Lj;
}
$Do = isset($NC[0][$Do]) ? $NC[0][$Do] : '';
goto Jj;
Lj:
$Do = isset($NC[0][$Do][0]) ? $NC[0][$Do][0] : '';
Jj:
GN:
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$Yi = array("\x75\x73\x65\162\137\x69\144", "\160\x72\x6f\x66\151\154\145\x5f\x6b\x65\x79", "\160\x72\157\x66\151\x6c\x65\x5f\x76\141\x6c\x75\x65", "\157\x72\x64\x65\162\151\156\x67");
$B1 = array($nz, $I8->quote("\160\162\157\146\151\154\145\56" . $um), $I8->quote($Do), ++$lU);
$bR->insert($I8->quoteName("\43\137\x5f\x75\x73\x65\162\x5f\160\162\157\x66\x69\x6c\145\163"))->columns($I8->quoteName($Yi))->values(implode("\x2c", $B1));
$I8->setQuery($bR);
$I8->execute();
js:
}
Iq:
LG:
c_:
$rY++;
goto r3;
LV:
}
function groupmapping($qe, $QP)
{
$vT = MoLdapUtility::mo_ldap_get_details("\x23\137\x5f\155\151\x6e\151\x6f\162\x61\156\x67\145\137\x64\151\162\x73\171\x6e\x63\x5f\x63\x6f\156\x66\x69\147");
$nH = $vT["\x6c\x64\141\160\x5f\x73\145\x72\166\x65\x72\x5f\165\162\154"];
$nH = MoLdapUtility::mo_ldap_decrypt($nH);
$Mc = self::getConnection($nH);
$Qv = $vT["\163\145\x72\x76\x69\143\145\x5f\141\x63\x63\x6f\x75\x6e\164\137\x64\156"];
$Qv = MoLdapUtility::mo_ldap_decrypt($Qv);
$QT = $vT["\x73\x65\x72\x76\x69\143\145\x5f\x61\143\x63\157\x75\x6e\164\137\160\141\163\163\x77\157\162\144"];
$QT = MoLdapUtility::mo_ldap_decrypt($QT);
$xq = $vT["\163\x65\141\162\x63\x68\137\x62\141\163\x65"];
$xq = MoLdapUtility::mo_ldap_decrypt($xq);
$oW = explode("\73", $xq);
$sq = $vT["\163\x65\141\x72\143\150\x5f\x66\x69\x6c\x74\145\162"];
$EH = str_replace("\77", $qe, $sq);
$XZ = null;
$NC = null;
$o1 = null;
$T3 = MoLdapUtility::mo_ldap_get_details("\43\137\137\155\151\156\151\x6f\x72\141\156\147\145\137\x6c\x64\x61\160\137\162\157\x6c\145\x5f\155\141\x70\160\x69\156\x67");
$Vy = JFactory::getUser();
if (!($QP != 1 || $T3["\x64\x69\x73\141\x62\x6c\x65\137\x75\160\x64\141\x74\x65\137\x65\x78\151\163\x74\x69\156\147\x5f\165\x73\x65\x72\163\137\x72\157\x6c\x65"] != 1)) {
goto pV;
}
$wl = $T3["\155\141\160\x70\x69\x6e\x67\137\x76\x61\x6c\x75\x65\137\x64\x65\146\x61\165\154\x74"];
if (isset($Vy->groups[8])) {
goto Kv;
}
$T1 = 1;
goto Du;
Kv:
$T1 = 0;
Du:
if (!($T3["\x65\156\x61\x62\x6c\145\137\154\144\x61\x70\137\x72\x6f\154\145\137\155\141\x70\x70\151\156\147"] && $T1)) {
goto DP;
}
JUserHelper::addUserToGroup($Vy->id, $wl);
if (!($QP != 1 || $T3["\x64\x69\x73\141\142\x6c\x65\137\165\160\144\141\x74\x65\137\x65\170\x69\x73\x74\x69\156\147\137\165\163\x65\162\163\137\162\x6f\x6c\145"] != 1)) {
goto ZT;
}
foreach ($Vy->groups as $y6) {
if (!($y6 != $wl && $y6 != "\70")) {
goto Qk;
}
JUserHelper::removeUserFromGroup($Vy->id, $y6);
Qk:
rG:
}
CI:
ZT:
DP:
pV:
if (!(($QP != 1 || $T3["\144\x69\x73\x61\x62\x6c\x65\137\165\160\144\141\164\x65\137\x65\x78\x69\x73\x74\x69\156\147\x5f\x75\163\145\x72\x73\x5f\162\x6f\x6c\x65"] != 1) && $T3["\x65\x6e\x61\142\x6c\x65\137\x6c\x64\x61\160\x5f\x72\x6f\154\145\137\x6d\141\x70\160\x69\156\147"])) {
goto ff;
}
$i4 = @ldap_bind($Mc, $Qv, $QT);
if (!isset($T3["\x6d\141\x70\160\151\x6e\147\x5f\155\145\x6d\142\x65\x72\157\x66\137\141\164\x74\x72\151\142\x75\164\x65"])) {
goto Xg;
}
$T9 = array($T3["\155\141\160\x70\151\x6e\x67\137\x6d\145\x6d\142\x65\162\157\146\137\x61\164\x74\x72\151\x62\165\164\x65"]);
Xg:
$rY = 0;
e5:
if (!($rY < count($oW))) {
goto YD;
}
$XZ = ldap_search($Mc, $oW[$rY], $EH, $T9);
$o1 = ldap_first_entry($Mc, $XZ);
$NC = ldap_get_entries($Mc, $XZ);
$Jg = $T3["\x72\x6f\154\145\x5f\x6d\141\x70\160\x69\x6e\147\x5f\x6b\145\171\137\166\141\x6c\165\x65"];
$Jg = json_decode($Jg, true);
$tt = $T3["\x72\157\154\145\137\155\x61\x70\160\x69\156\x67\137\x67\x72\157\x75\x70\166\141\154\165\x65"];
$tt = json_decode($tt, true);
$Up = 1;
cM:
$rY++;
goto e5;
YD:
ff:
}
function get_user_from_joomla($qe)
{
$I8 = JFactory::getDBO();
$bR = $I8->getQuery(true)->select("\x69\x64")->from("\x23\x5f\x5f\165\163\145\162\x73")->where("\165\x73\145\162\x6e\x61\x6d\145\75" . $I8->quote($qe), "\117\x52", "\145\x6d\141\x69\154\x3d" . $I8->quote($qe));
$I8->setQuery($bR);
$eX = $I8->loadObject();
if ($eX != '') {
goto Z3;
}
return 0;
goto sz;
Z3:
return $eX->id;
sz:
}
function RegisterCurrentUser($Dq, $aq)
{
$oL = JFactory::getApplication();
$qd["\x6e\141\155\145"] = isset($Dq) && !empty($Dq) ? $Dq : '';
$qd["\x75\163\145\x72\x6e\x61\155\x65"] = $aq;
$qd["\145\155\141\x69\x6c"] = $qd["\145\155\141\151\x6c\61"] = $qd["\145\x6d\x61\x69\154\x32"] = JStringPunycode::emailToPunycode($aq);
$qd["\x70\141\163\x73\167\x6f\162\144"] = $qd["\x70\141\163\163\167\x6f\162\x64\x31"] = $qd["\160\x61\x73\163\x77\x6f\x72\x64\62"] = JUserHelper::genRandomPassword();
$qd["\x61\143\164\x69\x76\141\164\x69\157\x6e"] = "\60";
$qd["\142\154\157\143\x6b"] = "\60";
jimport("\x6a\x6f\157\x6d\154\x61\x2e\x61\160\x70\x6c\151\x63\141\x74\x69\157\x6e\56\x63\157\155\x70\157\156\x65\156\164\x2e\155\x6f\144\145\154");
if (defined("\x4a\120\101\124\110\x5f\103\117\x4d\120\x4f\x4e\x45\116\124")) {
goto pU;
}
define("\x4a\120\x41\x54\110\137\103\x4f\x4d\x50\x4f\x4e\x45\x4e\124", JPATH_BASE . "\x2f\143\157\x6d\x70\157\x6e\145\156\x74\163\57");
pU:
$user = new JUser();
if ($user->bind($qd)) {
goto PP;
}
throw new Exception("\x43\x6f\x75\x6c\x64\40\x6e\x6f\164\40\x62\x69\156\144\x20\x64\141\x74\141\56\40\x45\x72\162\157\x72\x3a\40" . $user->getError());
PP:
if ($user->save()) {
goto qb;
}
qb:
$eX = $this->get_user_from_joomla($aq);
if (!$eX) {
goto b3;
}
$user = JUser::getInstance($eX->id);
$PJ = JFactory::getSession();
$PJ->set("\165\x73\x65\x72", $user);
$oL->checkSession();
$hA = $PJ->getId();
$this->updateUsernameToSessionId($user->id, $user->username, $hA);
$user->setLastVisit();
$oL->redirect(JURI::root() . "\151\x6e\x64\145\x78\x2e\160\150\160\77");
b3:
}
function updateCurrentUserName($G6, $Dq)
{
if (!empty($Dq)) {
goto wJ;
}
return;
wJ:
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$X0 = array($I8->quoteName("\156\141\155\145") . "\40\75\x20" . $I8->quote($Dq));
$Z4 = array($I8->quoteName("\151\144") . "\x20\x3d\40" . $I8->quote($G6));
$bR->update($I8->quoteName("\43\137\137\x75\163\145\162\x73"))->set($X0)->where($Z4);
$I8->setQuery($bR);
$vT = $I8->execute();
}
function updateUsernameToSessionId($Zq, $zc, $hA)
{
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$X0 = array($I8->quoteName("\165\x73\145\162\156\x61\x6d\x65") . "\40\75\40" . $I8->quote($zc), $I8->quoteName("\147\x75\x65\x73\x74") . "\40\x3d\40" . $I8->quote("\60"), $I8->quoteName("\165\163\145\162\x69\x64") . "\40\75\x20" . $I8->quote($Zq));
$Z4 = array($I8->quoteName("\x73\145\163\163\151\x6f\156\x5f\151\144") . "\x20\x3d\x20" . $I8->quote($hA));
$bR->update($I8->quoteName("\x23\x5f\137\163\x65\x73\x73\x69\157\156"))->set($X0)->where($Z4);
$I8->setQuery($bR);
$vT = $I8->execute();
}
function check_user_in_ad($qe)
{
$vT = MoLdapUtility::mo_ldap_get_details("\43\x5f\137\x6d\151\156\x69\157\x72\141\156\x67\145\x5f\144\x69\162\x73\171\156\143\137\143\x6f\x6e\x66\x69\x67");
$nH = $vT["\x6c\x64\x61\160\137\x73\145\x72\166\145\x72\137\165\x72\154"];
$nH = MoLdapUtility::mo_ldap_decrypt($nH);
$Mc = $this->getConnection($nH);
if (!$Mc) {
goto tb;
}
$Qv = $vT["\x73\145\162\x76\x69\143\x65\137\141\143\x63\157\x75\x6e\164\x5f\144\156"];
$Qv = MoLdapUtility::mo_ldap_decrypt($Qv);
$QT = $vT["\163\145\162\166\151\143\145\137\x61\x63\x63\157\165\x6e\164\137\x70\x61\163\163\x77\x6f\162\x64"];
$QT = MoLdapUtility::mo_ldap_decrypt($QT);
$xq = $vT["\x73\145\x61\x72\143\x68\137\x62\141\x73\145"];
$xq = MoLdapUtility::mo_ldap_decrypt($xq);
$oW = explode("\x3b", $xq);
$sq = $vT["\163\x65\x61\x72\143\x68\137\x66\151\154\164\x65\x72"];
$EH = str_replace("\x3f", $qe, $sq);
$XZ = null;
$NC = null;
$o1 = null;
$i4 = @ldap_bind($Mc, $Qv, $QT);
$rY = 0;
S2:
if (!($rY < count($oW))) {
goto mJ;
}
if ($XZ = ldap_search($Mc, $oW[$rY], $EH)) {
goto K9;
}
return '';
goto He;
K9:
$o1 = ldap_first_entry($Mc, $XZ);
$NC = ldap_get_entries($Mc, $XZ);
if ($o1) {
goto ku;
}
return '';
goto SM;
ku:
return $NC[0][$vT["\165\x73\x65\x72\156\x61\155\145"]][0];
SM:
He:
nA:
$rY++;
goto S2;
mJ:
tb:
}
public function getConnection($nH)
{
$Mc = ldap_connect($nH);
if (!(version_compare(PHP_VERSION, "\65\x2e\63\56\x30") >= 0)) {
goto Ha;
}
ldap_set_option($Mc, LDAP_OPT_NETWORK_TIMEOUT, 5);
Ha:
ldap_set_option($Mc, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($Mc, LDAP_OPT_REFERRALS, 0);
return $Mc;
}
public static function selectMaxOrdering($nz)
{
$I8 = JFactory::getDbo();
$bR = $I8->getQuery(true);
$bR->select("\115\101\130\50\157\x72\144\x65\x72\x69\x6e\147\x29");
$bR->from($I8->quoteName("\x23\x5f\137\165\163\x65\162\137\x70\x72\x6f\x66\151\154\145\x73"));
$bR->where($I8->quoteName("\165\163\145\x72\x5f\151\144") . "\40\75\40" . $I8->quote($nz));
$I8->setQuery($bR);
$Sz = $I8->loadResult();
}
}
Function Calls
None |
Stats
MD5 | 2e5be9c587597b9fec9dbf8ea6412f02 |
Eval Count | 0 |
Decode Time | 59 ms |