コード例 #1
0
 function execute()
 {
     $event = Request::post('event');
     $eventList = connectionNotificationModel::getEventList();
     $locale = new Locales('connection');
     $list = $locale->getList();
     $this->smarty->assign('eventInfo', $eventList[$event]);
     $this->smarty->assign('lang', $list);
     $this->smarty->assign('event', connectionNotificationModel::create()->getEvent($event));
 }
コード例 #2
0
 function execute()
 {
     $locale = new Locales('connection');
     $list = $locale->getList();
     $notification = connectionNotificationModel::create()->where(array('id' => (int) Request::post('id')))->fetchOne();
     $eventList = connectionNotificationModel::getEventList();
     $this->smarty->assign('eventInfo', $eventList[$notification['event']]);
     $this->smarty->assign('lang', $list);
     $this->smarty->assign('notification', $notification);
 }
コード例 #3
0
 public static function run($event, $data = array(), $iso = 'ru')
 {
     $eventList = self::getEventList();
     if (!$eventList[$event]) {
         return false;
     }
     $model = connectionNotificationModel::create();
     $notification = $model->getEvent($event);
     Load::dependence('smarty');
     $smarty = Load::$dependences['smarty'];
     foreach ($data as $key => $value) {
         $smarty->assign($key, $value);
     }
     foreach ($notification as $item) {
         $to = $smarty->fetch('string:' . $item['to']);
         $title = $smarty->fetch('string:' . $item[$iso]['title']);
         $content = $smarty->fetch('string:' . $item[$iso]['content']);
         $headers = "Content-type: text/html; charset=utf-8 \r\n";
         $headers .= "From: " . Settings::getValue('admin_email_name', 'connection') . " <" . Settings::getValue('admin_email', 'connection') . ">\r\n";
         mail($to, $title, $content, $headers);
     }
 }
コード例 #4
0
 function execute()
 {
     $id = (int) Request::post('id');
     connectionNotificationModel::create()->where(array('id' => $id))->delete();
 }
コード例 #5
0
 public function add($feedback)
 {
     $from = null;
     $data = array();
     if (ConnectionHelper::isLogin()) {
         $user = ConnectionHelper::userLogin();
         $from = (int) $user['id'];
     } else {
         $ticket = array('subject' => htmlspecialchars($feedback['subject']), 'message' => nl2br(htmlspecialchars($feedback['message'])));
         connectionNotificationModel::run(connectionNotificationModel::EVENT_NEW_FEEDBACK_ANONIMUS, array('user' => array('name' => htmlspecialchars($feedback['name']), 'email' => htmlspecialchars($feedback['email'])), 'ticket' => $ticket), Language::getActiveLanguageISO());
         return $ticket;
     }
     foreach ($this->field as $field) {
         if (!isset($feedback) || empty($feedback)) {
             return false;
         } else {
             $data[$field] = htmlspecialchars($feedback[$field]);
         }
     }
     $data['message'] = nl2br($data['message']);
     if (is_null($from)) {
         if (!isset($feedback['email']) || empty($feedback['email']) || !filter_var($feedback['email'], FILTER_VALIDATE_EMAIL)) {
             return false;
         }
         if (!isset($feedback['name']) || empty($feedback['name'])) {
             return false;
         }
         $data['contact'] = array('email' => htmlspecialchars($feedback['email']), 'name' => htmlspecialchars($feedback['name']));
     } else {
         $data['contact'] = $from;
     }
     $data['status'] = self::FEEDBACK_STATUS_NEW;
     $data['date'] = strtotime('now');
     $data['url'] = md5($data['date'] . $data['subject'] . uniqid());
     $data['last_action'] = 'user';
     if (isset($feedback['attachment']) && is_array($feedback['attachment'])) {
         $data['attachment'] = $feedback['attachment'];
     }
     $id = $this->insert($data);
     $data['id'] = $id;
     connectionNotificationModel::run(connectionNotificationModel::EVENT_NEW_FEEDBACK, array('user' => ConnectionHelper::userLogin(), 'ticket' => $data), Language::getActiveLanguageISO());
     return $id;
 }
コード例 #6
0
 public function registration($array)
 {
     $data = array();
     if (!Validator::mapFields($this->regFields, $array, $data) || $this->getFromEmail($data['email'])) {
         return false;
     }
     $data['country'] = (int) $data['country'];
     //        $data['confirmation'] = true;
     $data['last_active'] = 0;
     $data['last_login'] = 0;
     $data['birth_date'] = (int) strtotime($data['birth_year'] . '-' . $data['birth_month'] . '-' . $data['birth_day']);
     $data['date'] = strtotime('now');
     $data['password'] = md5($data['password']);
     $data['status'] = self::STATUS_DRAFT;
     $data['lang'] = Language::getActiveLanguageISO();
     $data['confirmation_email_id'] = md5($data['email'] . $data['date']);
     $data['balance'] = (double) Settings::getValue('start_balance', 'connection');
     unset($data['birth_day']);
     unset($data['birth_month']);
     unset($data['birth_year']);
     $user = $this->insert($data);
     $this->addHistory($user, self::HISTORY_REGISTRATION);
     $this->changeStatus($user, self::STATUS_DRAFT);
     $userInfo = $this->getInfo((int) $user);
     connectionNotificationModel::run(connectionNotificationModel::EVENT_REGISTRATION, array('user' => $userInfo), Language::getActiveLanguageISO());
     connectionNotificationModel::run(connectionNotificationModel::EVENT_EMAIL_CONFIRMATION, array('user' => $userInfo, 'link' => 'http://' . Settings::getValue('domain', 'connection') . '/?confirm_email=' . $data['confirmation_email_id']), Language::getActiveLanguageISO());
     return true;
 }
コード例 #7
0
 function execute()
 {
     $notification = Request::post('notification');
     connectionNotificationModel::create()->add($notification);
 }