예제 #1
0
function TryToLoginUsingCookie()
{
    $CookieName = "unvusrid";
    if (isset($_SESSION['unvusrid'])) {
        // Продлить срок жизни cookies до 60 дней
        SetCookie($CookieName, Encrypt_Blowfish($_SESSION['unvusrid']), time() + 3600 * 24 * 60, "/");
        // время жизни 60 дней
        unset($_SESSION['unvusrid']);
    }
    if (isset($_COOKIE[$CookieName]) && GetUserID() == 0) {
        LoginUsingUniversalID(Decrypt_Blowfish($_COOKIE[$CookieName]));
    }
}
 public function recoveryAction()
 {
     if (Tools::isPost()) {
         $email = POSTStrAsSQLStr('email');
         $sql = "select ID, PasswordHash " . "from Users " . "where (Email = '{$email}');";
         $user = $this->db->query($sql)->fetch();
         if (!empty($email) && !empty($user['ID'])) {
             $content = array('title' => 'Восстановление пароля', 'template' => 'user-password-recovery', 'data' => array('[year]' => date("Y", time()), '[url]' => URL . 'auth/resetpassword?m=' . Encrypt_Blowfish($email) . '&h=' . Encrypt_Blowfish($user['PasswordHash'])));
             $vSendResult = SendEmailSMTP('', '', $email, $content);
             if ($vSendResult !== true) {
                 return AddAlertMessage('danger', 'Ошибка при отправке письма!', '/');
             } else {
                 return AddAlertMessage('success', 'Инструкция по восстановлению пароля отправлена на почту.', '/');
             }
         } else {
             return AddAlertMessage('danger', 'Указанный E-mail не найден.', '/auth/recovery');
         }
     }
     $this->view->breadcrumbs = array(array('url' => '/auth/recovery', 'title' => 'Восстановление пароля'));
     $this->view->meta = array('meta_title' => 'Восстановление пароля', 'meta_description' => 'Восстановление пароля', 'meta_keywords' => '');
     $this->view->generate();
 }
      "select ID ".
      "from CatalogRatings ".
      "where (CatalogItemID = $id) ".
      "and (UserID $vUserID) ".
      "and (UnknownUserGUID $vUnknownUserGUID) ".
   ") limit 1;";*/
 if (POSTBoolAsSQLStr('PriorNotifyStateEdt') != $IsNotifyRecipientActive) {
     if ($IsNotifyRecipientActive == '1') {
         Emails_AddNotifyRecipient(1, $id, $OwnerEmail);
     } else {
         Emails_DeleteNotifyRecipient(1, $id, $OwnerEmail);
     }
 }
 $sql = "select CategoryID, Name from Articles where (ID = {$id});";
 $rec = GetMainConnection()->query($sql)->fetch();
 $vBodyParam = array('[year]' => date("Y", time()), '[name]' => $UserName, '[msgbody]' => $Comment, '[doclink]' => URL . 'articles/c-' . $rec['CategoryID'] . '/a-' . $id, '[unsubscribe]' => URL . 'email/unsubscribe/' . Encrypt_Blowfish('1||' . $id, EMAIL_BLOWFISHGUID));
 $vBody = Emails_PrepareBodyUseTemplate('article_comment', $vBodyParam);
 Emails_AddNotify(1, $id, 'Новый комментарий к статье: "' . $rec['Name'] . '"', $vBody, $OwnerEmail);
 /*$content = array(
       'title' => 'Re: '.$rec['MessageSubject'],
       'template' => 'answercontactus',
       'data' => array('[year]' => date("Y",time()), 
                       '[name]' => $rec['UserName'], 
                       '[msgbody]' => $vAnswerText
                      )
   );
   $vSendResult = SendEmailSMTP('*****@*****.**', $name, '*****@*****.**', $content, null, SMTP_CC);*/
 /*AddTaskForSendEmail_UseBody('*****@*****.**', 
    'name 1',
    '*****@*****.**', 
    'name 2',