protected function insertExecute()
 {
     parent::insertExecute();
     $queryListIP = "INSERT INTO `FeedbacksListIP` SET ";
     $queryListIP .= "`ip` = '" . $this->insertValue['alias'] . "', ";
     $queryListIP .= "`status` = '" . $this->insertValue['status'] . "', ";
     $queryListIP .= "`comment` = " . InputValueHelper::mayByNull($this->insertValue['comment']) . "; ";
     $this->SQL_HELPER->insert($queryListIP);
     //        echo var_dump($queryListIP). '<hr>';
 }
 protected function updateExecute()
 {
     parent::updateExecute();
     $queryListIP = "UPDATE `FeedbacksListIP` SET ";
     $queryListIP .= "`ip` = '" . $this->insertValue['alias'] . "', ";
     $queryListIP .= "`status` = '" . $this->insertValue['status'] . "', ";
     $queryListIP .= "`comment` = " . InputValueHelper::mayByNull($this->insertValue['comment']) . " ";
     $queryListIP .= "WHERE `ip`='" . $this->editElement . "';";
     $this->SQL_HELPER->insert($queryListIP);
     //        echo var_dump($queryListIP). '<hr>';
 }
 protected function updateExecute()
 {
     parent::updateExecute();
     $queryContactsUnitsTypes = "UPDATE `ContactsUnitsTypes` SET ";
     $queryContactsUnitsTypes .= "`type` = '" . $this->insertValue['alias'] . "', ";
     $queryContactsUnitsTypes .= "`sequence` = '" . $this->insertValue['sequence'] . "', ";
     $queryContactsUnitsTypes .= "`show` = '" . $this->insertValue['show'] . "'";
     $queryContactsUnitsTypes .= " WHERE `type`='" . $this->editElement . "';";
     $queryContactsUnitsTypes_Lang = array();
     foreach ($this->langArray as $langData) {
         if (isset($this->insertValue['typeName'][$langData['lang']]) && $this->insertValue['typeName'][$langData['lang']] != null && $this->insertValue['typeName'][$langData['lang']] != "") {
             $query = "INSERT INTO `ContactsUnitsTypes_Lang` SET ";
             $query .= "`type` = '" . $this->insertValue['alias'] . "', ";
             $query .= "`lang` = '" . $langData['lang'] . "', ";
             $query .= "`typeName` = '" . $this->insertValue['typeName'][$langData['lang']] . "', ";
             $query .= "`topText` = " . InputValueHelper::mayByNull($this->insertValue['topText'][$langData['lang']]) . ", ";
             $query .= "`bottomText` = " . InputValueHelper::mayByNull($this->insertValue['bottomText'][$langData['lang']]) . "; ";
             $queryContactsUnitsTypes_Lang[] = $query;
         }
     }
     $queryContactsUnitsTypes_LangDel = "DELETE FROM  `ContactsUnitsTypes_Lang` WHERE  `type` = '" . $this->editElement . "';";
     if ($this->SQL_HELPER->insert($queryContactsUnitsTypes)) {
         $this->SQL_HELPER->insert($queryContactsUnitsTypes_LangDel);
         foreach ($queryContactsUnitsTypes_Lang as $queryContactsUnitsTypes_Lg) {
             $this->SQL_HELPER->insert($queryContactsUnitsTypes_Lg);
         }
         $this->uploadImage();
     } else {
         echo 'Данные не были добавлены. Попробуйте позже.';
     }
 }
 private function updatePassword()
 {
     if ($this->checkCaptcha()) {
         if ($this->checkPassword()) {
             if ($this->checkRepeatPassword()) {
                 if ($this->checkValueNewPassword()) {
                     $update = $this->getQueryForUpdatePassword();
                     if ($this->SQL_HELPER->insert($update)) {
                         $this->message = $this->localization->getText("checkPasswordTrue");
                         $this->yourUser->authorization($this->userData['login'], InputValueHelper::getPostValue('newPassword'));
                         //                            $this->message .= $this->getButtonExit();
                     } else {
                         $this->message = $this->localization->getText("dbError");
                         // если необходима запись в логи
                         //                            $this->message .= $this->reportError($update);
                     }
                 } else {
                     $this->message = $this->localization->getText("checkAllValueFalse") . "<br>";
                     if ($this->checkAllValueErrors != null) {
                         foreach ($this->checkAllValueErrors as $CVerror) {
                             $this->message .= "<br>" . $CVerror;
                         }
                         $this->message .= "<br>";
                     }
                 }
             } else {
                 $this->message = $this->localization->getText("checkRepeatPasswordFalse");
             }
         } else {
             $this->message = $this->localization->getText("checkPasswordFalse");
         }
     } else {
         $this->message = $this->localization->getText("checkCaptchaFalse");
     }
 }
 protected function insertExecute()
 {
     parent::insertExecute();
     $queryContactsWorkers = "INSERT INTO `ContactsWorkers` SET ";
     $queryContactsWorkers .= "`worker`='" . $this->insertValue['alias'] . "', ";
     $queryContactsWorkers .= "`post`='" . $this->insertValue['post'] . "', ";
     $queryContactsWorkers .= "`email1`='" . $this->insertValue['email1'] . "', ";
     $queryContactsWorkers .= "`email2`=" . InputValueHelper::mayByNull($this->insertValue['email2']) . ", ";
     $queryContactsWorkers .= "`phoneText1`=" . InputValueHelper::mayByNull($this->insertValue['phoneText1']) . ", ";
     $queryContactsWorkers .= "`phoneText2`=" . InputValueHelper::mayByNull($this->insertValue['phoneText2']) . ", ";
     $queryContactsWorkers .= "`phone1`=" . InputValueHelper::mayByNull($this->insertValue['phone1']) . ", ";
     $queryContactsWorkers .= "`phone2`=" . InputValueHelper::mayByNull($this->insertValue['phone2']) . ", ";
     $queryContactsWorkers .= "`additional1`=" . InputValueHelper::mayByNull($this->insertValue['additional1']) . ", ";
     $queryContactsWorkers .= "`additional2`=" . InputValueHelper::mayByNull($this->insertValue['additional2']) . "; ";
     $queryContactsWorkers_Lang = array();
     foreach ($this->langArray as $langData) {
         if (isset($this->insertValue['fio'][$langData['lang']]) && $this->insertValue['fio'][$langData['lang']] != null && $this->insertValue['fio'][$langData['lang']] != "") {
             $queryLang = "INSERT INTO `ContactsWorkers_Lang` SET ";
             $queryLang .= "`worker`='" . $this->insertValue['alias'] . "', ";
             $queryLang .= "`lang`='" . $langData['lang'] . "', ";
             $queryLang .= "`fio`='" . $this->insertValue['fio'][$langData['lang']] . "', ";
             $queryLang .= "`info`='" . $this->insertValue['info'][$langData['lang']] . "';";
             $queryContactsWorkers_Lang[] = $queryLang;
         }
     }
     $queryContactsUnitsWokers = array();
     if ($this->insertValue['units'] != null) {
         foreach ($this->insertValue['units'] as $unit) {
             $query = "INSERT INTO `ContactsUnitsWokers` SET ";
             $query .= "`unit`='" . $unit . "', ";
             $query .= "`worker`='" . $this->insertValue['alias'] . "';";
             $queryContactsUnitsWokers[] = $query;
         }
     }
     if ($this->SQL_HELPER->insert($queryContactsWorkers)) {
         foreach ($queryContactsWorkers_Lang as $queryContactsWorkers_Lg) {
             $this->SQL_HELPER->insert($queryContactsWorkers_Lg);
         }
         foreach ($queryContactsUnitsWokers as $queryContactsUnitsWoker) {
             $this->SQL_HELPER->insert($queryContactsUnitsWoker);
         }
     } else {
         echo 'Данные не были добавлены. Попробуйте позже.';
     }
 }
 private function getInsertSql($ip)
 {
     $this->getDataIPStatus($ip);
     $queryFeedbacks = "INSERT INTO `Feedbacks` SET ";
     $queryFeedbacks .= "`fio` = '" . $this->insertValue['fio'] . "', ";
     $queryFeedbacks .= "`title` = " . InputValueHelper::mayByNull($this->insertValue['title']) . ", ";
     $queryFeedbacks .= "`text` = '" . $this->insertValue['text'] . "', ";
     $queryFeedbacks .= "`email` = " . InputValueHelper::mayByNull($this->insertValue['email']) . ", ";
     $queryFeedbacks .= "`phone` = " . InputValueHelper::mayByNull($this->insertValue['phone']) . ", ";
     $queryFeedbacks .= "`ip` = '" . $ip . "', ";
     $queryFeedbacks .= "`date` = '" . date("Y-m-d h:i:s") . "', ";
     $queryFeedbacks .= "`rating` = '" . $this->insertValue['rating'] . "', ";
     $queryFeedbacks .= "`show` = '" . $this->status['showReview'] . "', ";
     $queryFeedbacks .= "`like` = '0', ";
     $queryFeedbacks .= "`dislike` = '0' ; ";
     return $queryFeedbacks;
 }
 protected function insertExecute()
 {
     parent::insertExecute();
     $queryWorkersPosts = "INSERT INTO `ContactsWorkersPosts` SET ";
     $queryWorkersPosts .= "`post`='" . $this->insertValue['alias'] . "', ";
     $queryWorkersPosts .= "`sequence`=" . InputValueHelper::mayByNull($this->insertValue['sequence']) . ";";
     $queryWorkersPosts_Lang = array();
     foreach ($this->langArray as $langData) {
         if (isset($this->insertValue['postName'][$langData['lang']]) && $this->insertValue['postName'][$langData['lang']] != null && $this->insertValue['postName'][$langData['lang']] != "") {
             $queryLang = "INSERT INTO `ContactsWorkersPosts_Lang` SET ";
             $queryLang .= "`post`='" . $this->insertValue['post'][$langData['lang']] . "',";
             $queryLang .= "`lang`='" . $this->insertValue['lang'][$langData['lang']] . "',";
             $queryLang .= "`postName`='" . $this->insertValue['postName'][$langData['lang']] . "';";
             $queryWorkersPosts_Lang[] = $queryLang;
         }
     }
     if ($this->SQL_HELPER->insert($queryWorkersPosts)) {
         foreach ($queryWorkersPosts_Lang as $queryWorkersPosts_Lg) {
             $this->SQL_HELPER->insert($queryWorkersPosts_Lg);
         }
     } else {
         echo 'Данные не были добавлены. Попробуйте позже.';
     }
 }
 protected function updateExecute()
 {
     parent::updateExecute();
     $queryFeedbacks = "UPDATE `Feedbacks` SET ";
     $queryFeedbacks .= "`ip` = '" . $this->insertValue['ip'] . "', ";
     $queryFeedbacks .= "`fio` = '" . $this->insertValue['fio'] . "', ";
     $queryFeedbacks .= "`title` = " . InputValueHelper::mayByNull($this->insertValue['title']) . ", ";
     $queryFeedbacks .= "`text` = '" . $this->insertValue['text'] . "', ";
     $queryFeedbacks .= "`email` = " . InputValueHelper::mayByNull($this->insertValue['email']) . ", ";
     $queryFeedbacks .= "`phone` = " . InputValueHelper::mayByNull($this->insertValue['phone']) . ", ";
     $queryFeedbacks .= "`date` = '" . date("Y-m-d h:i:s") . "', ";
     $queryFeedbacks .= "`rating` = 'noRating', ";
     $queryFeedbacks .= "`show` = '1', ";
     $queryFeedbacks .= "`like` = '" . $this->insertValue['like'] . "', ";
     $queryFeedbacks .= "`dislike` = '" . $this->insertValue['dislike'] . "' ";
     $queryFeedbacks .= "WHERE `id`='" . $this->editElement . "';";
     // 8(910)567-58-98
     // sokolovka@apelsin.ru
     $queryListIP = "INSERT INTO `FeedbacksListIP` SET ";
     $queryListIP .= "`ip` = '" . $this->insertValue['ip'] . "', ";
     $queryListIP .= "`status` = 'default';";
     $queryIsComments = "UPDATE `FeedbacksIsComments` SET ";
     $queryIsComments .= "`parentFeedback` = '" . $this->insertValue['parentFeedback'] . "' ";
     $queryIsComments .= "WHERE `feedback`='" . $this->editElement . "';";
     if ($this->getDataListIP($this->insertValue['ip']) == null) {
         $this->SQL_HELPER->insert($queryListIP);
         //            echo var_dump($queryListIP). '<hr>';
         $this->SQL_HELPER->insert($queryFeedbacks);
         //            echo var_dump($queryFeedbacks). '<hr>';
         $this->SQL_HELPER->insert($queryIsComments);
         //            echo var_dump($queryIsComments). '<hr>';
     } else {
         $this->SQL_HELPER->insert($queryFeedbacks);
         //            echo var_dump($queryFeedbacks). '<hr>';
         $this->SQL_HELPER->insert($queryIsComments);
         //            echo var_dump($queryIsComments). '<hr>';
     }
 }
 private function insertComments()
 {
     $ip = $_SERVER['REMOTE_ADDR'];
     $this->getDataIPStatus($ip);
     $queryFeedbacks = "INSERT INTO `Feedbacks` SET ";
     $queryFeedbacks .= "`fio` = '" . $this->insertValue['fio'] . "', ";
     $queryFeedbacks .= "`title` = " . InputValueHelper::mayByNull($this->insertValue['title']) . ", ";
     $queryFeedbacks .= "`text` = '" . $this->insertValue['text'] . "', ";
     $queryFeedbacks .= "`email` = " . InputValueHelper::mayByNull($this->insertValue['email']) . ", ";
     $queryFeedbacks .= "`phone` = " . InputValueHelper::mayByNull($this->insertValue['phone']) . ", ";
     $queryFeedbacks .= "`ip` = '" . $ip . "', ";
     $queryFeedbacks .= "`date` = '" . date("Y-m-d h:i:s") . "', ";
     $queryFeedbacks .= "`rating` = 'noRating', ";
     $queryFeedbacks .= "`show` = '1', ";
     $queryFeedbacks .= "`like` = '0', ";
     $queryFeedbacks .= "`dislike` = '0' ; ";
     $queryListIP = "INSERT INTO `FeedbacksListIP` SET ";
     $queryListIP .= "`ip` = '" . $ip . "', ";
     $queryListIP .= "`status` = 'default';";
     // если статус IP 'blocked'
     if ($this->status['status'] == 'blocked') {
         return ErrorHelper::getMessageError("Этот IP заблокирован. Вы не можете оставлять отзывы и комментарии ");
     }
     // проверка существования IP в таблице `FeedbacksListIP`
     if (!isset($this->status['ip'])) {
         $this->SQL_HELPER->insert($queryListIP);
         $this->SQL_HELPER->insert($queryFeedbacks);
         $addCom = $this->SQL_HELPER->lastInsertID();
         $this->SQL_HELPER->insert($this->queryFeedbacksIsComments($addCom));
     } else {
         if ($this->status['commentYourself'] == 0 && $this->getDataIP() == $ip) {
             ErrorHelper::getMessageError("Вы не можете комментировать свои отзывы");
         } else {
             $this->SQL_HELPER->insert($queryFeedbacks);
             $addCom = $this->SQL_HELPER->lastInsertID();
             $this->SQL_HELPER->insert($this->queryFeedbacksIsComments($addCom));
         }
     }
 }
 private function setQueryDays($day, $flag = true)
 {
     $keyHS = $day . 'H_s';
     $keyMS = $day . 'M_s';
     $keyHE = $day . 'H_e';
     $keyME = $day . 'M_e';
     $query = "`" . $keyHS . "` = " . InputValueHelper::mayByNull($this->insertValue[$keyHS]) . ", ";
     $query .= "`" . $keyMS . "` = " . InputValueHelper::mayByNull($this->insertValue[$keyMS]) . ", ";
     $query .= "`" . $keyHE . "` = " . InputValueHelper::mayByNull($this->insertValue[$keyHE]) . ", ";
     if ($flag == false) {
         $query .= "`" . $keyME . "` = " . InputValueHelper::mayByNull($this->insertValue[$keyME]) . " ";
     } else {
         $query .= "`" . $keyME . "` = " . InputValueHelper::mayByNull($this->insertValue[$keyME]) . ", ";
     }
     return $query;
 }
 protected function updateExecute()
 {
     parent::updateExecute();
     $queryWorkersPosts = "UPDATE `ContactsWorkersPosts` SET ";
     $queryWorkersPosts .= "`post`='" . $this->insertValue['alias'] . "', ";
     $queryWorkersPosts .= "`sequence`=" . InputValueHelper::mayByNull($this->insertValue['sequence']) . "";
     $queryWorkersPosts .= " WHERE `post`='" . $this->editElement . "';";
     $queryWorkersPosts_Lang = array();
     foreach ($this->langArray as $langData) {
         if (isset($this->insertValue['postName'][$langData['lang']]) && $this->insertValue['postName'][$langData['lang']] != null && $this->insertValue['postName'][$langData['lang']] != "") {
             $queryLang = "INSERT INTO `ContactsWorkersPosts_Lang` SET ";
             $queryLang .= "`post`='" . $this->insertValue['alias'] . "',";
             $queryLang .= "`lang`='" . $langData['lang'] . "',";
             $queryLang .= "`postName`='" . $this->insertValue['postName'][$langData['lang']] . "';";
             $queryWorkersPosts_Lang[] = $queryLang;
         }
     }
     $queryContactsUnitsTypes_LangDel = "DELETE FROM  `ContactsWorkersPosts_Lang` WHERE  `post` = '" . $this->editElement . "';";
     if ($this->SQL_HELPER->insert($queryWorkersPosts)) {
         $this->SQL_HELPER->insert($queryContactsUnitsTypes_LangDel);
         foreach ($queryWorkersPosts_Lang as $queryWorkersPosts_Lg) {
             $this->SQL_HELPER->insert($queryWorkersPosts_Lg);
         }
     } else {
         echo 'Данные не были добавлены. Попробуйте позже.';
     }
 }
 protected function insertExecute()
 {
     parent::insertExecute();
     $queryFeedbacks = "INSERT INTO `Feedbacks` SET ";
     $queryFeedbacks .= "`ip` = '" . $this->insertValue['ip'] . "', ";
     $queryFeedbacks .= "`fio` = '" . $this->insertValue['fio'] . "', ";
     $queryFeedbacks .= "`title` = " . InputValueHelper::mayByNull($this->insertValue['title']) . ", ";
     $queryFeedbacks .= "`text` = '" . $this->insertValue['text'] . "', ";
     $queryFeedbacks .= "`email` = " . InputValueHelper::mayByNull($this->insertValue['email']) . ", ";
     $queryFeedbacks .= "`phone` = " . InputValueHelper::mayByNull($this->insertValue['phone']) . ", ";
     $queryFeedbacks .= "`date` = '" . date("Y-m-d h:i:s") . "', ";
     $queryFeedbacks .= "`rating` = '" . $this->insertValue['rating'] . "', ";
     $queryFeedbacks .= "`show` = '" . $this->insertValue['show'] . "', ";
     $queryFeedbacks .= "`like` = '" . $this->insertValue['like'] . "', ";
     $queryFeedbacks .= "`dislike` = '" . $this->insertValue['dislike'] . "'; ";
     // 8(910)567-58-98
     // sokolovka@apelsin.ru
     $ip = $this->getDataListIP($this->insertValue['ip']);
     if ($ip == null) {
         $queryListIP = "INSERT INTO `FeedbacksListIP` SET ";
         $queryListIP .= "`ip` = '" . $this->insertValue['ip'] . "', ";
         $queryListIP .= "`status` = 'default';";
         $this->SQL_HELPER->insert($queryListIP);
         //            echo var_dump($queryListIP). '<hr>';
         $this->SQL_HELPER->insert($queryFeedbacks);
         $this->insertValue['alias'] = $this->SQL_HELPER->lastInsertID();
         //            echo var_dump($this->id). '<hr>';
         //            echo var_dump($queryFeedbacks). '<hr>';
     } else {
         $this->SQL_HELPER->insert($queryFeedbacks);
         //        echo var_dump($queryFeedbacks). '<hr>';
         $this->insertValue['alias'] = $this->SQL_HELPER->lastInsertID();
     }
 }
 protected function getOriginalPostValue($key)
 {
     return InputValueHelper::getOriginalPostValue($key);
 }
 private function addNewApplications()
 {
     $id = ID_GENERATOR::generateID();
     $fio = InputValueHelper::getPostValue('fio');
     $phone = InputValueHelper::getPostValue('phone');
     $message = InputValueHelper::getPostValue('message');
     $query = "INSERT INTO `UsersOnlineApplications`(`id`, `fio`, `phone`, `message`, `creation`,`totalStatus`,`changed`) VALUES ('" . $id . "','" . $fio . "','" . $phone . "','" . $message . "',now(),'created',now());";
     $this->SQL_HELPER->insert($query);
 }