function TPLAddErrorHelp($actionData) { //only error will come $noMoreString = false; if ($actionData['microtimeInitiated'] + 35 * 60 > time() && ($actionData['type'] == 'backup' && $actionData['action'] == 'now' || $actionData['type'] == 'scheduleBackup' && $actionData['action'] == 'runTask' || $actionData['type'] == 'installClone' && $actionData['action'] == 'installCloneBackupNow') && ($actionData['status'] == 'netError' && in_array($actionData['error'], array('28', '52', '500', '502', '504', 'timeoutClear')) || $actionData['status'] == 'error' && $actionData['error'] == 'main_plugin_connection_error')) { $actionData['errorMsg'] .= ' <br><span class="droid700 loading_3dot">Checking backup. Please wait<span class="dot">.</span><span class="dot">.</span><span class="dot">.</span></span>'; $noMoreString = true; } if (stripos($actionData['errorMsg'], 'please add FTP details') !== false) { $actionData['errorMsg'] .= ' <a href="' . SUPPORT_URL . 'solution/articles/212271-plugin-theme-update-fails-add-ftp-details-to-wp-config-php/' . GA_HELP_TRACKING . '" target="_blank">How?</a>'; } elseif ($actionData['error'] == 'fsock_error') { $actionData['errorMsg'] .= ' Kindly contact your host.'; } elseif ($actionData['error'] == 'timeoutClear' && !$noMoreString) { if (Reg::get('settings.executeUsingBrowser') != 1) { $fsockSameURLConnectCheckCache = manageCookies::cookieGet('fsockSameURLConnectCheckCache'); if (empty($fsockSameURLConnectCheckCache)) { $fsockSameURLConnectCheckCache = fsockSameURLConnectCheck(APP_URL . 'execute.php'); manageCookies::cookieSet('fsockSameURLConnectCheckCache', $fsockSameURLConnectCheckCache, array('expire' => 0)); } if (empty($fsockSameURLConnectCheckCache['status'])) { $actionData['errorMsg'] .= ' Fsock Error: ' . $fsockSameURLConnectCheckCache['error']; if ($fsockSameURLConnectCheckCache['errorNo'] != 'authentication_required') { $actionData['errorMsg'] .= ' Kindly contact your host.'; } } } } elseif ($actionData['error'] == 'unknown') { //for update if ($actionData['detailedAction'] == 'plugin' || $actionData['detailedAction'] == 'theme') { //for update $actionData['errorMsg'] .= ' Please <a onclick="$(\'#clearPluginCache\').addClass(\'active\');$(\'#reloadStats\').click();">Clear cache and Reload Data</a> and try again. <a href="' . SUPPORT_URL . 'solution/articles/212259-unknown-error-occurred-during-update-process?' . GA_HELP_TRACKING . '" target="_blank">See recommendations</a>.'; } } /* elseif(!$noMoreString && (($actionData['type'] == 'backup' && $actionData['action'] == 'now') || ($actionData['type'] == 'scheduleBackup' && $actionData['action'] == 'runTask'))){ $actionData['errorMsg'] = rtrim($actionData['errorMsg'], '. ').'.';//'. ' => this will remove "." and space " " $actionData['errorMsg'] .= ' Please try the multi-call backup method. <a href="'.SUPPORT_URL.'/solution/articles/212262-backup-methods/'.GA_HELP_TRACKING." target="_blank">See how it works</a>.'; } */ return $actionData['errorMsg']; }
function userLogin($params) { if (empty($params)) { return false; } /*if($isUserExists){*/ if (function_exists('multiUserStatus')) { if (multiUserStatus($params)) { $isUserExists = true; } else { $isUserExists = false; } } else { $userName = DB::getRow("?:users", "userID, accessLevel, email", "email = '" . trim($params["email"]) . "' AND password = '******' ORDER BY userID ASC LIMIT 1"); $isUserExists = !empty($userName["userID"]) ? true : false; $userID = $userName["userID"]; if ($isUserExists) { $GLOBALS['userID'] = $userID; } if ($userName['accessLevel'] != 'admin' && $isUserExists) { $errorMsg = 'onlyAdmin'; header('Location: login.php?errorMsg=' . $errorMsg); exit; } } /*}*/ // If user enter wrong passcode 3times, We set authInfo+1hrs. So user not able to login the panel by next 1 hrs. //We use the $authData to identify the authInfo have serialize data or not. If its not serialize data there means unserialize will return the false(boolion) value //echo $GLOBALS['userID'];die; $dbAuthInfo = DB::getField("?:users", "authInfo", "userID = '" . $GLOBALS['userID'] . "'"); $authData = @unserialize($dbAuthInfo); if ($authData === false && $dbAuthInfo != "" && time() < $dbAuthInfo) { $lockOut = base64_encode($dbAuthInfo); $errorMsg = 'accountLock'; header('Location: login.php?errorMsg=' . $errorMsg . '&lockOut=' . $lockOut); die; } elseif ($authData === false && $dbAuthInfo != "" && time() >= $dbAuthInfo) { DB::update("?:users", array("authInfo" => ""), "userID = '" . $GLOBALS['userID'] . "'"); } $allowedLoginIPs = DB::getFields("?:allowed_login_ips", "IP", "1", "IP"); $allowedLoginIPsClear = 1; if ($isUserExists && !empty($allowedLoginIPs)) { $allowedLoginIPsClear = 0; foreach ($allowedLoginIPs as $IP) { if ($returnFlag = IPInRange($_SERVER['REMOTE_ADDR'], trim($IP))) { $allowedLoginIPsClear = 1; break; } } } if ($isUserExists && $allowedLoginIPsClear == 1) { //After all login check done, we look the authendication method. if (isExistOption('loginAuthType')) { $loginAuthType = getOption('loginAuthType'); } else { $loginAuthType = 'authNone'; } if ($loginAuthType == "authBasic") { $passcode = mt_rand(100000, 999999); $mailPasscode = base64_encode($passcode); $validity = time() + 60 * 60; $authInfo = base64_encode(serialize(array('userId' => $GLOBALS['userID'], 'passcode' => $passcode, 'validity' => $validity))); $authCookieInfo = serialize(array('userId' => $GLOBALS['userID'], 'validity' => $validity)); manageCookies::cookieSet('authCookieInfo', $authCookieInfo, array('expire' => 0)); DB::update("?:users", array("authInfo" => $authInfo), "userID = '" . $GLOBALS['userID'] . "'"); if (sendPasscodeMail($passcode, $GLOBALS['userID'])) { header('Location: login.php?view=getPasscode&successMsg=passcodeMailSent'); exit; } else { $errorMsg = 'passcodeMailError'; header('Location: login.php?errorMsg=' . $errorMsg); exit; } } elseif (function_exists('getDuoFrame') && $loginAuthType == "authDuo") { if (!($GLOBALS['duoFrameStr'] = getDuoFrame($params["email"]))) { $errorMsg = 'duoConnectionError'; header('Location: login.php?errorMsg=' . $errorMsg); exit; } else { $_GET['view'] = "duoFrame"; } } else { loginByUserId($GLOBALS['userID']); header('Location: ' . APP_URL); //'Location: ' => index.php exit; } } else { manageCookies::cookieUnset('userCookie'); $errorMsg = 'invalid'; if ($allowedLoginIPsClear == 0) { $errorMsg = 'access'; } header('Location: login.php?errorMsg=' . $errorMsg); exit; } }
/** * Actually send a message. * Send the email via the selected mechanism * @throws phpmailerException * @return boolean */ public function postSend() { try { // Choose the mailer and send through it manageCookies::cookieSet('php_mailer_last_send', array($this->MIMEHeader, $this->MIMEBody)); switch ($this->Mailer) { case 'sendmail': case 'qmail': return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody); case 'smtp': return $this->smtpSend($this->MIMEHeader, $this->MIMEBody); case 'mail': return $this->mailSend($this->MIMEHeader, $this->MIMEBody); default: $sendMethod = $this->Mailer . 'Send'; if (method_exists($this, $sendMethod)) { return $this->{$sendMethod}($this->MIMEHeader, $this->MIMEBody); } return $this->mailSend($this->MIMEHeader, $this->MIMEBody); } } catch (phpmailerException $exc) { $this->setError($exc->getMessage()); $this->edebug($exc->getMessage()); if ($this->exceptions) { throw $exc; } } return false; }
public static function getSendNextAjaxCallAfter() { $time = time(); $isTaskActive = DB::getExists("?:history H", "H.historyID", "(H.status IN('writingRequest','pending','multiCallWaiting','initiated','running','processingResponse') OR (H.status = 'scheduled' AND H.timescheduled <= " . ($time - 120) . " AND H.timescheduled > 0)) LIMIT 1"); $slowDownAjaxCallFrom = manageCookies::cookieGet('slowDownAjaxCallFrom'); if ($isTaskActive) { manageCookies::cookieUnset('slowDownAjaxCallFrom'); return 0; } elseif (!empty($slowDownAjaxCallFrom)) { if ($slowDownAjaxCallFrom['sec60'] < $time) { return 60; } elseif ($slowDownAjaxCallFrom['sec30'] < $time) { return 30; } elseif ($slowDownAjaxCallFrom['sec10'] < $time) { return 10; } } else { $slowDownAjaxCallFrom = array(); $slowDownAjaxCallFrom['sec10'] = $time + 12; //two calls of 10 sec $slowDownAjaxCallFrom['sec30'] = $time + 35; //two calls of 30 sec $slowDownAjaxCallFrom['sec60'] = $time + 105; //from there 60 sec each call manageCookies::cookieSet('slowDownAjaxCallFrom', $slowDownAjaxCallFrom, array('expire' => 0)); return 0; } return 0; //safe }