public function updateBid(Bid $bid)
 {
     $connection = ConnectionManager::getConnection();
     $amount = (double) $bid->amount;
     $timeOfBid = $bid->timeOfBid->format("Y-m-d H:i:s");
     $bidderID = (int) $bid->bidderID;
     $auctionID = (int) $bid->auctionID;
     if ($this->isValidBid($bid)) {
         $auctionManager = new AuctionManager();
         $bidder = (int) $auctionManager->getAuctionDetail($auctionID)->highestBidderID;
         $sql = "\n              INSERT INTO bid (amount, time_of_bid, auction_id, bidder_id)\n              VALUES ({$amount}, '{$timeOfBid}', {$auctionID}, {$bidderID})";
         if ($connection->query($sql) === TRUE) {
             $email = new EmailManager();
             if ($bidder != 0) {
                 $email->highestBidder($bid, $bidder);
             }
             $email->watcherEmail($auctionID, $amount);
             Alerter::showAlert("Your bid was posted successfully");
         } else {
             Alerter::showAlert("Error: " . $sql . " " . $connection->error);
         }
     } else {
         Alerter::showAlert("Your bid needs to be higher than the current highest bid and the starting price!");
     }
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Cmspage the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = EmailManager::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #3
0
 public function createNew($email)
 {
     $newUser = new FrontendUser();
     $newUser->username = $email;
     $newUser->email = $email;
     $password = PasswordGenerator::createSimple();
     $newUser->password = $password;
     try {
         if ($newUser->save()) {
             EmailManager::sendUserInfo($newUser, $password);
         }
     } catch (Exception $e) {
         return $this->checkIfExists($email);
     }
     return $newUser;
 }
public static function Send($email){

		$data = array(
		'from' => $email->from,
		'to' => $email->to,
		'subject' => $email->subject,
		'message' => $email->message,
		'content_type' => $email->content_type
		);	


		list($header, $content) = EmailManager::PostRequest(
			"http://www.aventurasmayas.com/paypal/newmail.php",    // the url to post to
			$PHP_SELF,         // the url of the post script "this file"
			$data
		);
		return true;
}
Example #5
0
 /**
  * Список фолдингов
  */
 public static function listFoldings()
 {
     $managers = array(MagManager::inst(), BlogManager::inst(), TrainManager::inst());
     $foldings = array();
     foreach ($managers as $manager) {
         if ($manager instanceof RubricsProcessor) {
             $foldings[] = $manager->getRubricsFolding();
         }
         if ($manager instanceof PostsProcessor) {
             $foldings[] = $manager->getFolding();
         }
     }
     //Фолдинги
     $foldings[] = PopupPagesManager::inst();
     $foldings[] = PluginsManager::inst();
     $foldings[] = IdentPagesManager::inst();
     $foldings[] = TimeLineManager::inst();
     $foldings[] = TemplateMessages::inst();
     $foldings[] = UserPointsManager::inst();
     $foldings[] = StockManager::inst();
     $foldings[] = HelpManager::inst();
     $foldings[] = EmailManager::inst();
     $foldings[] = PSForm::inst();
     $foldings[] = DialogManager::inst();
     //Библиотеки
     $foldings[] = PoetsManager::inst();
     $foldings[] = ScientistsManager::inst();
     //Админские страницы
     $foldings[] = APagesResources::inst();
     //Базовые страницы
     $foldings[] = BasicPagesManager::inst();
     //Построитель страниц
     $foldings[] = PageBuilder::inst();
     //Управление списком предпросмотра постов
     $foldings[] = ShowcasesCtrlManager::inst();
     //Элементы в правой панели навигации
     $foldings[] = ClientBoxManager::inst();
     //Все фолдинги системы
     return $foldings;
 }
Example #6
0
 private function __construct()
 {
     PsProfiler::inst(__CLASS__)->start(__FUNCTION__);
     //Фолдинги
     $this->foldings[] = PopupPagesManager::inst();
     $this->foldings[] = PluginsManager::inst();
     $this->foldings[] = TimeLineManager::inst();
     $this->foldings[] = UserPointsManager::inst();
     $this->foldings[] = StockManager::inst();
     $this->foldings[] = HelpManager::inst();
     $this->foldings[] = EmailManager::inst();
     $this->foldings[] = PSForm::inst();
     $this->foldings[] = DialogManager::inst();
     //Библиотеки
     $this->foldings[] = PoetsManager::inst();
     $this->foldings[] = ScientistsManager::inst();
     //Админские страницы
     $this->foldings[] = APagesResources::inst();
     /*
      * Выделим различные подклассы фолдингов
      */
     foreach ($this->foldings as $folding) {
         //Фолдинги библиотек
         if ($folding instanceof LibResources) {
             $this->libs[] = $folding;
         }
         //Фолдинги для баблов
         if ($folding instanceof BubbledFolding) {
             $this->bubbles[] = $folding;
         }
         //Фолдинги, предоставляющие панели
         if ($folding instanceof PanelFolding) {
             $this->panels[] = $folding;
         }
     }
     PsProfiler::inst(__CLASS__)->stop();
 }
Example #7
0
if (!defined('AET_IN')) {
    die("No Access");
}
// Check for parameter
if (!isset($cmdParameters['modify-virtualhost'])) {
    Log::error('Missing parameter');
    exit(9);
}
$vhost = new VirtualHost($db);
$vhost->domainName = $cmdParameters['modify-virtualhost'];
$rc = $vhost->get();
if ($rc === false) {
    Log::error('Unknown virtual host');
    exit(9);
}
$emailManager = new EmailManager($vhost);
if (isset($cmdParameters['add-email'])) {
    if (!isset($cmdParameters['password'])) {
        if (isset($cmdParameters['password-file'])) {
            if (!is_file($cmdParameters['password-file'])) {
                Log::error('Error while opening the password file');
                exit(9);
            }
            $cmdParameters['password'] = file_get_contents($cmdParameters['password-file']);
            if ($cmdParameters['password'] === false) {
                Log::error('Error while reading the password file');
                exit(9);
            }
        } else {
            Log::error('Password not defined');
            exit(9);
Example #8
0
 public function sendNotifications()
 {
     $pdf = Yii::app()->pdfGenerator;
     $pdfFileNames = array();
     $orderBooking = $this->getOrderBooking();
     foreach ($this->itemsOnePerGroup as $item) {
         if ($item instanceof HotelTripElement) {
             if ($item->hotelBookerId) {
                 if ($pdfFileInfo = $pdf->forHotelItem($item)) {
                     $pdfFileNames[] = array('type' => 'hotel', 'filename' => $pdfFileInfo['realName'], 'visibleName' => $pdfFileInfo['visibleName']);
                 } else {
                     return false;
                 }
             }
         } elseif ($item instanceof FlightTripElement) {
             if ($item->flightBookerId) {
                 if ($pdfFileInfo = $pdf->forFlightItem($item)) {
                     $pdfFileNames[] = array('type' => 'avia', 'filename' => $pdfFileInfo['realName'], 'visibleName' => $pdfFileInfo['visibleName']);
                 }
             }
         }
     }
     EmailManager::sendEmailOrderInfo(array('orderBookingId' => $orderBooking->readableId, 'email' => $orderBooking->email), $pdfFileNames);
     SmsManager::sendSmsOrderInfo($orderBooking->phone, array('email' => $orderBooking->email, 'orderBookingId' => $orderBooking->readableId));
 }
Example #9
0
 private function __construct()
 {
     PsProfiler::inst(__CLASS__)->start(__FUNCTION__);
     $managers = array(MagManager::inst(), BlogManager::inst(), TrainManager::inst());
     foreach ($managers as $manager) {
         //Соберём типы постов
         $this->postTypes[] = $manager->getPostType();
         if ($manager instanceof RubricsProcessor) {
             $this->rubricsProcessors[$manager->getPostType()] = $manager;
             $this->foldings[] = $manager->getRubricsFolding();
         }
         if ($manager instanceof PostsProcessor) {
             $this->postsProcessors[$manager->getPostType()] = $manager;
             $this->foldings[] = $manager->getFolding();
         }
         if ($manager instanceof CommentsProcessor) {
             $this->commentProcessors[$manager->getPostType()] = $manager;
             $this->discussionControllers[$manager->getDiscussionController()->getDiscussionUnique()] = $manager->getDiscussionController();
         }
         if ($manager instanceof PagePreloadListener) {
             $this->pagePreloadListeners[] = $manager;
         }
         if ($manager instanceof NewsProvider) {
             $this->newsProviders[$manager->getNewsEventType()] = $manager;
         }
     }
     //Контроллеры дискуссий
     $this->discussionControllers[FeedbackManager::inst()->getDiscussionUnique()] = FeedbackManager::inst();
     //Фолдинги
     $this->foldings[] = PopupPagesManager::inst();
     $this->foldings[] = PluginsManager::inst();
     $this->foldings[] = IdentPagesManager::inst();
     $this->foldings[] = TimeLineManager::inst();
     $this->foldings[] = TemplateMessages::inst();
     $this->foldings[] = UserPointsManager::inst();
     $this->foldings[] = StockManager::inst();
     $this->foldings[] = HelpManager::inst();
     $this->foldings[] = EmailManager::inst();
     $this->foldings[] = PSForm::inst();
     $this->foldings[] = DialogManager::inst();
     //Библиотеки
     $this->foldings[] = PoetsManager::inst();
     $this->foldings[] = ScientistsManager::inst();
     //Админские страницы
     $this->foldings[] = APagesResources::inst();
     //Базовые страницы
     $this->foldings[] = BasicPagesManager::inst();
     //Построитель страниц
     $this->foldings[] = PageBuilder::inst();
     //Управление списком предпросмотра постов
     $this->foldings[] = ShowcasesCtrlManager::inst();
     //Элементы в правой панели навигации
     $this->foldings[] = ClientBoxManager::inst();
     /*
      * Выделим различные подклассы фолдингов
      */
     foreach ($this->foldings as $folding) {
         //Фолдинги библиотек
         if ($folding instanceof LibResources) {
             $this->libs[] = $folding;
         }
         //Фолдинги обработчиков постов
         if ($folding instanceof PostFoldedResources) {
             $this->postProcessorFoldings[] = $folding;
         }
         //Фолдинги для баблов
         if ($folding instanceof BubbledFolding) {
             $this->bubbles[] = $folding;
         }
         //Фолдинги, предоставляющие панели
         if ($folding instanceof PanelFolding) {
             $this->panels[] = $folding;
         }
         //Фолдинги, финализирующие контент страницы
         if ($folding instanceof PageFinalizerFolding) {
             $this->pageFinaliseFoldings[] = $folding;
         }
         //Индексированный список фолдингов
         $this->folding2unique[$folding->getUnique()] = $folding;
         //Префиксы smarty к фолдингам
         $this->folding2smartyPrefix[$folding->getSmartyPrefix()] = $folding;
         //Префиксы классов к фолдингам
         if ($folding->getClassPrefix()) {
             $this->folding2classPrefix[$folding->getClassPrefix()] = $folding;
         }
     }
     PsProfiler::inst(__CLASS__)->stop();
 }
 /**
  * Регистрация страниц SDK
  */
 private function registerSdkFoldings()
 {
     $this->register(PopupPagesManager::inst());
     $this->register(PluginsManager::inst());
     $this->register(TimeLineManager::inst());
     $this->register(UserPointsManager::inst());
     $this->register(StockManager::inst());
     $this->register(HelpManager::inst());
     $this->register(EmailManager::inst());
     $this->register(PSForm::inst());
     $this->register(DialogManager::inst());
     $this->register(PageBuilder::inst());
     //Библиотеки
     $this->register(PoetsManager::inst());
     $this->register(ScientistsManager::inst());
     //Админские страницы
     $this->register(APagesResources::inst());
 }
Example #11
0
 function contactAction()
 {
     try {
         // Check if the form is posted.
         if ($this->getRequest()->isPost()) {
             // [Xinghao] Get form data.
             $this->view->formData = $this->getRequest()->getPost();
             //print_r($this->view->formData);
             $this->indexAction();
             //$this->view->tab = $this->view->detailTab->getFormTabName();
             $this->view->detailTab->setTabSequence($this->view->detailTab->formTabSeq);
             $form = $this->view->detailTab->getForm();
             if ($form->isValid($this->view->formData)) {
                 $this->view->detailTab->setDisplayForm(false);
                 //	print_r($this->view->detailTab->getPostingDataForContactForm());
                 EmailManager::sentContactEmail($this->view->formData, $this->view->detailTab->getPostingDataForContactForm());
                 /*
                 					Email::sendMail($this->view->formData["email_from"],
                 									$this->view->formData["fullname"],
                 									"Query form " . $this->view->formData["fullname"],
                 									$this->view->formData["question"]);
                 */
             } else {
                 $this->view->detailTab->setDisplayForm(true);
             }
             $this->renderScript('posting/index.phtml');
         } else {
             //TODO::redirect ot 404 page.
         }
     } catch (Exception $e) {
         logError("contactAction: ", $e);
         echo $e;
     }
 }
Example #12
0
 public function actionNewPassword($key = false)
 {
     if ($key) {
         $user = User::model()->findByAttributes(array('recover_pwd_key' => $key));
         if ($user && time() < strtotime($user->recover_pwd_expiration)) {
             $model = new NewPasswordForm();
             if (isset($_POST['NewPasswordForm'])) {
                 $model->attributes = $_POST['NewPasswordForm'];
                 if ($model->validate()) {
                     $user->password = $model->password;
                     $user->recover_pwd_key = '';
                     $user->recover_pwd_expiration = date('Y-m-d h:i:s', time() - 1);
                     if ($user->save()) {
                         Yii::app()->user->setFlash('success', 'You have successfully changed your password. You may now use it to login to Present Value.');
                     } else {
                         $model->addErrors($user->errors);
                     }
                 }
             }
             $this->render('newPassword', array('model' => $model));
         } else {
             throw new CHttpException(404, 'Not found or this link already expired');
         }
     } else {
         $model = new ForgotPasswordForm();
         if (isset($_POST['ForgotPasswordForm'])) {
             $model->attributes = $_POST['ForgotPasswordForm'];
             if ($model->validate()) {
                 $user = User::model()->findByAttributes(array('email' => $model->email));
                 if ($user) {
                     Yii::app()->user->setFlash('success', 'You will receive an email shortly with instructions to create a new password.');
                     EmailManager::sendRecoveryPassword($user);
                     $this->refresh();
                 } else {
                     $model->addError('email', 'Email address not found');
                 }
             }
         }
         $this->render('recoveryPassword', array('model' => $model));
     }
 }
Example #13
0
 public function actionNewPassword($key = false)
 {
     if ($key) {
         $user = FrontendUser::model()->findByAttributes(array('recover_pwd_key' => $key));
         if ($user && time() < strtotime($user->recover_pwd_expiration)) {
             $model = new NewPasswordForm();
             if (isset($_POST['NewPasswordForm'])) {
                 $model->attributes = $_POST['NewPasswordForm'];
                 if ($model->validate()) {
                     $user->password = $model->password;
                     $user->recover_pwd_key = '';
                     $user->recover_pwd_expiration = date('Y-m-d h:i:s', time() - 1);
                     if ($user->save()) {
                         echo '{"status": "ok"}';
                     } else {
                         echo json_encode(array('status' => 'fail', 'errors' => CHtml::errorSummary($user)));
                     }
                 } else {
                     echo json_encode(array('status' => 'fail', 'errors' => CHtml::errorSummary($model)));
                 }
             }
         } else {
             throw new CHttpException(404, 'Not found or this link already expired');
         }
     } else {
         $model = new ForgotPasswordForm();
         if (isset($_POST['ForgotPasswordForm'])) {
             $model->attributes = $_POST['ForgotPasswordForm'];
             if ($model->validate()) {
                 $user = FrontendUser::model()->findByAttributes(array('email' => $model->email));
                 if ($user) {
                     Yii::app()->user->setFlash('success', 'Вы получите письмо с инструкциями как восстановить ваш пароль.');
                     EmailManager::sendRecoveryPassword($user);
                     $this->refresh();
                 } else {
                     $model->addError('email', 'Email address not found');
                 }
             }
         }
         $this->render('recoveryPassword', array('model' => $model));
     }
 }