Guest User

unzend.com_ioncube_decoder82

a guest
May 15th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 16.82 KB | None | 0 0
  1. <?php
  2.  
  3. ioncube decoder https://www.unzend.com
  4. define("ADMINAREA", true);
  5. require("../init.php");
  6. $aInt = new WHMCS\Admin("My Account", false);
  7. $aInt->title = $aInt->lang("global", "myaccount");
  8. $aInt->sidebar = "config";
  9. $aInt->icon = "home";
  10. $aInt->helplink = "My Account";
  11. $aInt->requiredFiles(array( "ticketfunctions" ));
  12. $action = $whmcs->get_req_var("action");
  13. $errormessage = "";
  14. $twofa = new WHMCS\TwoFactorAuthentication();
  15. $twofa->setAdminID($_SESSION["adminid"]);
  16. if( $whmcs->get_req_var("2fasetup") )
  17. {
  18.     $output = "";
  19.     if( $twofa->isActiveAdmins() )
  20.     {
  21.         if( $twofa->isEnabled() )
  22.         {
  23.             $disabled = $incorrect = false;
  24.             if( $password = $whmcs->get_req_var("pwverify") )
  25.             {
  26.                 $auth = new WHMCS\Auth();
  27.                 $auth->getInfobyID($_SESSION["adminid"]);
  28.                 if( $auth->comparePassword($password) )
  29.                 {
  30.                     $twofa->disableUser();
  31.                     $disabled = true;
  32.                 }
  33.                 else
  34.                 {
  35.                     $incorrect = true;
  36.                 }
  37.  
  38.             }
  39.  
  40.             if( !$disabled )
  41.             {
  42.                 $output .= "<p>" . $aInt->lang("twofa", "disableintro") . "</p>";
  43.                 if( $incorrect )
  44.                 {
  45.                     $output .= "<div class=\"errorbox\"><strong>Password Incorrect</strong>" . "<br />Please try again...</div>";
  46.                 }
  47.  
  48.                 $output .= "<form onsubmit=\"dialogSubmit();return false\"><input type=\"hidden\" name=\"2fasetup\" value=\"1\" /><p align=\"center\">" . $aInt->lang("fields", "password") . ": <input type=\"password\" name=\"pwverify\" value=\"\" class=\"form-control input-inline input-250\" /><p><p align=\"center\"><input type=\"button\" value=\"" . $aInt->lang("global", "disable") . "\" class=\"btn btn-primary\" onclick=\"dialogSubmit()\" /></p></form>";
  49.             }
  50.             else
  51.             {
  52.                 $output .= "<p>" . $aInt->lang("twofa", "disabledconfirmation") . "</p>";
  53.             }
  54.  
  55.         }
  56.         else
  57.         {
  58.             $modules = $twofa->getAvailableModules();
  59.             if( isset($module) && in_array($module, $modules) )
  60.             {
  61.                 $output = $twofa->moduleCall("activate", $module);
  62.                 if( is_array($output) && isset($output["completed"]) )
  63.                 {
  64.                     $msg = (isset($output["msg"]) ? $output["msg"] : "");
  65.                     $settings = (isset($output["settings"]) ? $output["settings"] : array(  ));
  66.                     $backupcode = $twofa->activateUser($module, $settings);
  67.                     $output = "";
  68.                     if( $backupcode )
  69.                     {
  70.                         $output = "<div align=\"center\"><h2>" . $aInt->lang("twofa", "activationcomplete") . "</h2>";
  71.                         if( $msg )
  72.                         {
  73.                             $output .= "<div style=\"margin:20px;padding:10px;background-color:#f7f7f7;border:1px dashed #cccccc;text-align:center;\">" . $msg . "</div>";
  74.                         }
  75.  
  76.                         $output .= "<h2>" . $aInt->lang("twofa", "backupcodeis") . ":</h2><div style=\"margin:20px auto;padding:10px;width:280px;background-color:#F2D4CE;border:1px dashed #AE432E;text-align:center;font-size:20px;\">" . $backupcode . "</div><p>" . $aInt->lang("twofa", "backupcodeexpl") . "</p>";
  77.                     }
  78.                     else
  79.                     {
  80.                         $output = $aInt->lang("twofa", "activationerror");
  81.                     }
  82.  
  83.                 }
  84.  
  85.                 if( !$output )
  86.                 {
  87.                     $output .= $aInt->lang("twofa", "generalerror");
  88.                 }
  89.  
  90.             }
  91.             else
  92.             {
  93.                 if( $twofa->isForced() )
  94.                 {
  95.                     $output .= "<div class=\"infobox\">" . $aInt->lang("twofa", "enforced") . "</div>";
  96.                 }
  97.  
  98.                 $output .= "<p>" . $aInt->lang("twofa", "activateintro") . "</p>\n        <form><input type=\"hidden\" name=\"2fasetup\" value=\"1\" />";
  99.                 if( 1 < count($modules) )
  100.                 {
  101.                     $output .= "<p>" . $aInt->lang("twofa", "choose") . "</p>";
  102.                     $mod = new WHMCS\Module\Security();
  103.                     $first = true;
  104.                     foreach( $modules as $module )
  105.                     {
  106.                         $mod->load($module);
  107.                         $configarray = $mod->call("config");
  108.                         $output .= " &nbsp;&nbsp;&nbsp;&nbsp; <label class=\"radio-inline\"><input type=\"radio\" name=\"module\" value=\"" . $module . "\"" . (($first ? " checked" : "")) . " /> " . ((isset($configarray["FriendlyName"]["Value"]) ? $configarray["FriendlyName"]["Value"] : ucfirst($module))) . "</label><br />";
  109.                         $first = false;
  110.                     }
  111.                 }
  112.                 else
  113.                 {
  114.                     $output .= "<input type=\"hidden\" name=\"module\" value=\"" . $modules[0] . "\" />";
  115.                 }
  116.  
  117.                 $output .= "<p align=\"center\"><br /><input type=\"button\" value=\"" . $aInt->lang("twofa", "getstarted") . " &raquo;\" onclick=\"dialogSubmit()\" class=\"btn btn-primary\" /></form>";
  118.             }
  119.  
  120.         }
  121.  
  122.     }
  123.     else
  124.     {
  125.         $output .= "Two-Factor Authentication not enabled";
  126.     }
  127.  
  128.     $aInt->setBodyContent(array( "body" => $output ));
  129.     $aInt->output();
  130.     throw new WHMCS\Exception\ProgramExit();
  131. }
  132.  
  133. $file = new WHMCS\File\Directory($whmcs->get_admin_folder_name() . DIRECTORY_SEPARATOR . "templates");
  134. $adminTemplates = $file->getSubdirectories();
  135. if( $action == "save" )
  136. {
  137.     check_token("WHMCS.admin.default");
  138.     if( defined("DEMO_MODE") )
  139.     {
  140.         redir("demo=1");
  141.     }
  142.  
  143.     $newPassword = $whmcs->get_req_var("password");
  144.     $newPassword = ($newPassword ? trim($newPassword) : "");
  145.     $passwordRetype = $whmcs->get_req_var("password2");
  146.     $passwordRetype = ($passwordRetype ? trim($passwordRetype) : "");
  147.     $template = $whmcs->getFromRequest("template");
  148.     $language = $whmcs->getFromRequest("language");
  149.     $firstname = $whmcs->getFromRequest("firstname");
  150.     $lastname = $whmcs->getFromRequest("lastname");
  151.     $email = $whmcs->getFromRequest("email");
  152.     $signature = $whmcs->getFromRequest("signature");
  153.     $notes = $whmcs->getFromRequest("notes");
  154.     $ticketnotify = $whmcs->getFromRequest("ticketnotify");
  155.     if( !$auth instanceof WHMCS\Auth )
  156.     {
  157.         $auth = new WHMCS\Auth();
  158.     }
  159.  
  160.     $currentPasswd = $whmcs->get_req_var("currentPasswd");
  161.     $auth->getInfobyID($_SESSION["adminid"]);
  162.     if( $auth->comparePassword($currentPasswd) )
  163.     {
  164.         if( $newPassword != $passwordRetype )
  165.         {
  166.             $errormessage = $aInt->lang("administrators", "pwmatcherror");
  167.             $action = "edit";
  168.         }
  169.         else
  170.         {
  171.             if( WHMCS\Database\Capsule::table("tblticketdepartments")->where("email", "=", $email)->count() )
  172.             {
  173.                 $errormessage = AdminLang::trans("administrators.emailCannotBeSupport");
  174.                 $action = "edit";
  175.             }
  176.             else
  177.             {
  178.                 $currentDetails = WHMCS\User\Admin::find(WHMCS\Session::get("adminid"));
  179.                 if( !in_array($template, $adminTemplates) )
  180.                 {
  181.                     $template = $adminTemplates[0];
  182.                 }
  183.  
  184.                 $language = WHMCS\Language\AdminLanguage::getValidLanguageName($language);
  185.                 if( $email != $currentDetails->email )
  186.                 {
  187.                     $currentDetails->email = $email;
  188.                 }
  189.  
  190.                 $currentDetails->firstName = $firstname;
  191.                 $currentDetails->lastName = $lastname;
  192.                 $currentDetails->signature = $signature;
  193.                 $currentDetails->notes = $notes;
  194.                 $currentDetails->template = $template;
  195.                 $currentDetails->language = $language;
  196.                 $currentDetails->receivesTicketNotifications = ($ticketnotify ?: array(  ));
  197.                 $currentDetails->passwordResetKey = "";
  198.                 $currentDetails->passwordResetData = "";
  199.                 $currentDetails->passwordResetExpiry = "0000-00-00 00:00:00";
  200.                 if( $currentDetails->validate() )
  201.                 {
  202.                     $currentDetails->save();
  203.                     if( $newPassword )
  204.                     {
  205.                         $auth->getInfobyID(WHMCS\Session::get("adminid"));
  206.                         if( $auth->generateNewPasswordHashAndStore($newPassword) )
  207.                         {
  208.                             $auth->generateNewPasswordHashAndStoreForApi(md5($newPassword));
  209.                             $auth->setSessionVars();
  210.                         }
  211.  
  212.                     }
  213.  
  214.                     unset($_SESSION["adminlang"]);
  215.                     logActivity("Administrator Account Modified (" . $firstname . " " . $lastname . ")");
  216.                     redir("success=true");
  217.                 }
  218.                 else
  219.                 {
  220.                     $errormessage = implode("<br>", $currentDetails->errors()->all());
  221.                 }
  222.  
  223.             }
  224.  
  225.         }
  226.  
  227.     }
  228.     else
  229.     {
  230.         $errormessage = $aInt->lang("administrators", "currentPassError");
  231.     }
  232.  
  233. }
  234.  
  235. WHMCS\Session::release();
  236. $result = select_query("tbladmins", "tbladmins.*,tbladminroles.name,tbladminroles.supportemails", array( "tbladmins.id" => $_SESSION["adminid"] ), "", "", "", "tbladminroles ON tbladminroles.id=tbladmins.roleid");
  237. $data = mysql_fetch_array($result);
  238. $supportEmailsEnabled = (bool) $data["supportemails"];
  239. if( !$errormessage )
  240. {
  241.     $firstname = $data["firstname"];
  242.     $lastname = $data["lastname"];
  243.     $email = $data["email"];
  244.     $signature = $data["signature"];
  245.     $notes = $data["notes"];
  246.     $template = $data["template"];
  247.     $language = $data["language"];
  248.     $ticketnotifications = $data["ticketnotifications"];
  249.     $ticketnotify = explode(",", $ticketnotifications);
  250. }
  251. else
  252. {
  253.     if( !is_array($ticketnotify) )
  254.     {
  255.         $ticketnotify = array(  );
  256.     }
  257.  
  258. }
  259.  
  260. $username = $data["username"];
  261. $adminrole = $data["name"];
  262. $language = WHMCS\Language\AdminLanguage::getValidLanguageName($language);
  263. ob_start();
  264. $infobox = "";
  265. if( defined("DEMO_MODE") )
  266. {
  267.     infoBox("Demo Mode", "Actions on this page are unavailable while in demo mode. Changes will not be saved.");
  268. }
  269.  
  270. if( $whmcs->get_req_var("success") )
  271. {
  272.     infoBox($aInt->lang("administrators", "changesuccess"), $aInt->lang("administrators", "changesuccessinfo2"));
  273. }
  274.  
  275. if( !empty($errormessage) )
  276. {
  277.     infoBox($aInt->lang("global", "validationerror"), $errormessage, "error");
  278. }
  279.  
  280. echo $infobox;
  281. echo "\n<form method=\"post\" action=\"";
  282. echo $whmcs->getPhpSelf();
  283. echo "?action=save\">\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"20%\" class=\"fieldlabel\">";
  284. echo $aInt->lang("fields", "username");
  285. echo "</td><td class=\"fieldarea\"><b>";
  286. echo $username;
  287. echo "</b></td></tr>\n<tr><td class=\"fieldlabel\">";
  288. echo $aInt->lang("administrators", "role");
  289. echo "</td><td class=\"fieldarea\"><strong>";
  290. echo $adminrole;
  291. echo "</strong></td></tr>\n<tr><td class=\"fieldlabel\">";
  292. echo $aInt->lang("fields", "firstname");
  293. echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"firstname\" class=\"form-control input-250\" value=\"";
  294. echo $firstname;
  295. echo "\"></td></tr>\n<tr><td class=\"fieldlabel\">";
  296. echo $aInt->lang("fields", "lastname");
  297. echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"lastname\" class=\"form-control input-250\" value=\"";
  298. echo $lastname;
  299. echo "\"></td></tr>\n<tr><td class=\"fieldlabel\">";
  300. echo $aInt->lang("fields", "email");
  301. echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"email\" class=\"form-control input-400\" value=\"";
  302. echo $email;
  303. echo "\"></td></tr>\n<tr><td class=\"fieldlabel\">";
  304. echo $aInt->lang("administrators", "ticketnotifications");
  305. echo "</td><td class=\"fieldarea\">\n";
  306. if( !$supportEmailsEnabled )
  307. {
  308.     echo "<div class=\"alert alert-warning top-margin-10 bottom-margin-10\"><i class=\"fas fa-exclamation-triangle\"></i> &nbsp; " . $aInt->lang("administrators", "ticketNotificationsUnavailable") . "</div>";
  309. }
  310.  
  311. echo "<div class=\"row\">\n    <div class=\"col-sm-10 col-sm-offset-1\">\n        <div class=\"row\">";
  312. $nodepartments = true;
  313. $supportdepts = getAdminDepartmentAssignments();
  314. foreach( $supportdepts as $deptid )
  315. {
  316.     $deptname = get_query_val("tblticketdepartments", "name", array( "id" => $deptid ));
  317.     if( $deptname )
  318.     {
  319.         echo "<div class=\"col-sm-6\">\n            <label class=\"checkbox-inline\">\n                <input type=\"checkbox\" name=\"ticketnotify[]\" value=\"" . $deptid . "\"" . ((in_array($deptid, $ticketnotify) ? " checked" : "")) . (($supportEmailsEnabled ? "" : " disabled")) . " />\n                " . $deptname . "\n            </label>\n        </div>";
  320.         $nodepartments = false;
  321.     }
  322.  
  323. }
  324. if( $nodepartments )
  325. {
  326.     echo "<div class=\"col-xs-12\">" . $aInt->lang("administrators", "nosupportdeptsassigned") . "</div>";
  327. }
  328.  
  329. echo "</div>\n    </div>\n</div></div>\n</td></tr>\n<tr><td class=\"fieldlabel\">";
  330. echo $aInt->lang("administrators", "supportsig");
  331. echo "</td><td class=\"fieldarea\"><textarea name=\"signature\" rows=\"4\" class=\"form-control\">";
  332. echo $signature;
  333. echo "</textarea></td></tr>\n<tr><td class=\"fieldlabel\">";
  334. echo $aInt->lang("global", "mynotes");
  335. echo "</td><td class=\"fieldarea\"><textarea name=\"notes\" rows=\"4\" class=\"form-control\">";
  336. echo $notes;
  337. echo "</textarea></td></tr>\n<tr><td class=\"fieldlabel\">";
  338. echo $aInt->lang("fields", "template");
  339. echo "</td><td class=\"fieldarea\"><select name=\"template\" class=\"form-control select-inline\">";
  340. foreach( $adminTemplates as $temp )
  341. {
  342.     echo "<option value=\"" . $temp . "\"";
  343.     if( $temp == $template )
  344.     {
  345.         echo " selected";
  346.     }
  347.  
  348.     echo ">" . ucfirst($temp) . "</option>";
  349. }
  350. echo "</select></td></tr>\n<tr><td class=\"fieldlabel\">";
  351. echo $aInt->lang("global", "language");
  352. echo "</td><td class=\"fieldarea\"><select name=\"language\" class=\"form-control select-inline\">";
  353. foreach( WHMCS\Language\AdminLanguage::getLanguages() as $lang )
  354. {
  355.     echo "<option value=\"" . $lang . "\"";
  356.     if( $lang == $language )
  357.     {
  358.         echo " selected=\"selected\"";
  359.     }
  360.  
  361.     echo ">" . ucfirst($lang) . "</option>";
  362. }
  363. echo "</select></td></tr>\n";
  364. if( $twofa->isActiveAdmins() )
  365. {
  366.     echo "<tr>\n    <td class=\"fieldlabel\">" . $aInt->lang("twofa", "title") . "</td>\n    <td class=\"fieldarea\">\n        <input type=\"checkbox\"" . (($twofa->isEnabled() ? " checked" : "")) . " class=\"twofa-toggle-switch\" /> &nbsp;";
  367.     if( $twofa->isEnabled() )
  368.     {
  369.         echo "<a href=\"myaccount.php?2fasetup=1\" class=\"open-modal twofa-config-link\" data-modal-title=\"" . $aInt->lang("twofa", "disable", 1) . "\">" . $aInt->lang("twofa", "disableclickhere") . "</a>";
  370.     }
  371.     else
  372.     {
  373.         echo "<a href=\"myaccount.php?2fasetup=1\" class=\"open-modal twofa-config-link\" data-modal-title=\"" . $aInt->lang("twofa", "enable", 1) . "\">" . $aInt->lang("twofa", "enableclickhere") . "</a>";
  374.     }
  375.  
  376.     echo "</td>\n</tr>";
  377. }
  378.  
  379. echo "</table>\n\n<p>";
  380. echo $aInt->lang("administrators", "entertochange");
  381. echo "</p>\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"20%\" class=\"fieldlabel\">";
  382. echo $aInt->lang("fields", "password");
  383. echo "</td><td class=\"fieldarea\"><input type=\"password\" name=\"password\" class=\"form-control input-250\" autocomplete=\"off\"></td></tr>\n<tr><td class=\"fieldlabel\" >";
  384. echo $aInt->lang("fields", "confpassword");
  385. echo "</td><td class=\"fieldarea\"><input type=\"password\" name=\"password2\" class=\"form-control input-250\" autocomplete=\"off\"></td></tr>\n</table>\n\n<p>\n    ";
  386. echo $aInt->lang("administrators", "confirmAdminPasswd");
  387. echo "</p>\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n    <tr>\n        <td width=\"20%\" class=\"fieldlabel\">";
  388. echo $aInt->lang("fields", "confpassword");
  389. echo "</td>\n        <td class=\"fieldarea\">\n            <input type=\"password\" name=\"currentPasswd\" class=\"form-control input-250\" autocomplete=\"off\" required>\n        </td>\n    </tr>\n</table>\n\n<div class=\"btn-container\">\n    <input type=\"submit\" value=\"";
  390. echo $aInt->lang("global", "savechanges");
  391. echo "\" class=\"btn btn-primary\">\n    <input type=\"reset\" value=\"";
  392. echo $aInt->lang("global", "cancelchanges");
  393. echo "\" class=\"btn btn-default\" />\n</div>\n\n</form>\n\n";
  394. $aInt->jquerycode = "\njQuery(\".twofa-toggle-switch\").bootstrapSwitch(\n    {\n        \"size\": \"mini\",\n        \"onColor\": \"success\",\n        \"onSwitchChange\": function(event, state)\n        {\n            \$(\".twofa-config-link\").click();\n        }\n    }\n);";
  395. if( $whmcs->get_req_var("2faenforce") )
  396. {
  397.     $aInt->jquerycode .= "\$(\".twofa-config-link\").click();";
  398. }
  399.  
  400. $content = ob_get_contents();
  401. ob_end_clean();
  402. $aInt->content = $content;
  403. $aInt->display();
Add Comment
Please, Sign In to add comment