public function response() { $error_code = $this->getMessage(); $error_list = Lang::load('error/user', $error_code); if (!isset($error_list[$error_code])) { $error_code = \Model_Error::ER00001; } $error_message = $error_list[$error_code]; $params = array('error_code' => $error_code, 'error_message' => $error_message, 'line' => $this->getLine(), 'file' => $this->getFile(), 'url' => Uri::main(), 'input' => print_r(Input::all(), true), 'real_ip' => Input::real_ip(), 'user_agent' => Input::user_agent(), 'user_id' => Auth::get_user_id(), 'occurred_at' => date('Y/m/d H:i:s')); $email = new Model_Email(); $email->sendMailByParams('error', $params); $response = \Request::forge('errors/index', false)->execute($params)->response(); return $response; }
public function sendConfirmEmail() { if ($this->email_verified == 'True') { return false; } $this->generate_key(); $html_email = View::factory('register/verify_email_html'); $text_email = View::factory('register/verify_email_text'); $link = url::site('register/verify/?' . 'key=' . $this->activation_key . '&id=' . $this->id); View::bind_global('link', $link); $email = new Model_Email(); $email->message(array($this->email => $this->fullname()), '[Code-Wars] Welcome to Code-Wars', $html_email, $text_email); $this->new_email = false; $this->save(); return true; }
public static function send($to, $from, $title, $body = '', $attachmendImagesBody = false) { $mail = new JO_Mailer_Base(); // $mail->attachmendImagesBody = $attachmendImagesBody; $mail->attachmendImagesBody = false; if (Helper_Config::get('mail_smtp')) { $mail->SMTPAuth = true; $mail->IsSMTP(); $mail->Host = Helper_Config::get('mail_smtp_host'); $mail->Port = Helper_Config::get('mail_smtp_port'); $mail->Username = Helper_Config::get('mail_smtp_user'); $mail->Password = Helper_Config::get('mail_smtp_password'); } $mail->SetFrom($from, ''); $mail->AddReplyTo($from, ""); $mail->Subject = $title; $mail->AltBody = self::translate("To view the message, please use an HTML compatible email viewer!"); // optional, comment out and test $mail->MsgHTML($body, BASE_PATH); $mail->AddAddress($to, ""); $result = $mail->Send(); if ($result) { return true; } else { self::$error = $mail->ErrorInfo; return false; } }
public function indexAction() { $request = $this->getRequest(); $this->view->invate_limit = 5; if ($request->isPost()) { $emails = array(); $this->view->send = array(); for ($i = 1; $i < $this->view->invate_limit; $i++) { $this->view->send[$i] = array('success' => false, 'error' => false); $validate = new Helper_Validate(); if ($request->getPost('email-' . $i) != $this->translate('Email Adress ' . $i)) { $validate->_set_rules($request->getPost('email-' . $i), $this->translate('Email Adress ' . $i), 'not_empty;min_length[5];max_length[100];email'); if ($validate->_valid_form()) { $shared_content = Model_Users::sharedContentInvate($request->getPost('email-' . $i)); if ($shared_content == 1) { $this->view->send[$i]['error'] = $this->translate('With this email address is already registered users!'); } else { if ($shared_content == 2) { $this->view->send[$i]['error'] = $this->translate('To this email has been sent an invitation!'); } else { $inser_key = Model_Users::sharedContent($request->getPost('email-' . $i)); if ($inser_key == -1) { $this->view->send[$i]['error'] = $this->translate('There was an error. Please try again later!'); } else { $this->view->shared_content = WM_Router::create($request->getBaseUrl() . '?controller=users&action=register&user_id=' . JO_Session::get('user[user_id]') . '&key=' . $inser_key); $this->view->header_title = JO_Registry::get('site_name'); $this->view->self_firstname = JO_Session::get('user[firstname]'); $this->view->Recipient_message = $request->getPost('note') != $this->translate('Add a personal note') ? $request->getPost('note') : ''; $result = Model_Email::send($request->getPost('email-' . $i), JO_Registry::get('noreply_mail'), sprintf($this->translate('New invate for %s from %s'), JO_Registry::get('site_name'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]')), $this->view->render('send_invate', 'mail')); if ($result) { $this->view->send[$i]['success'] = $this->translate('The invitation was sent successfully!'); } else { $this->view->send[$i]['error'] = $this->translate('There was an error. Please try again later!'); } } } } } else { $this->view->send[$i]['error'] = strip_tags($validate->_get_error_messages()); } } } if ($request->isXmlHttpRequest()) { echo $this->renderScript('json'); exit; } else { JO_Session::set('result_from_invate', $this->view->send); $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=invites')); } } if (JO_Session::get('result_from_invate')) { $this->view->result_from_invate = JO_Session::get('result_from_invate'); JO_Session::clear('result_from_invate'); } $this->view->invites = WM_Router::create($request->getBaseUrl() . '?controller=invites'); $this->view->invites_fb = WM_Router::create($request->getBaseUrl() . '?controller=invites&action=facebook'); $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); }
public function new_image($image) { $project = $image->project; foreach ($project->team->find_all() as $user) { if ($user->email != Auth::instance()->get_user()->email) { Model_Email::factory()->new_image($user->email, $image); } } }
public function resetAction() { $request = $this->getRequest(); if (!JO_Session::get('user[user_id]')) { $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login')); } $done = $request->issetQuery('done'); $this->view->success = false; if ($done) { $this->view->success = true; } if ($request->isPost()) { $validate = new Helper_Validate(); $validate->_set_rules($request->getPost('email'), $this->translate('E-mail'), 'not_empty;min_length[5];max_length[100];email'); if ($validate->_valid_form()) { $result = Model_Users::forgotPassword($request->getPost('email')); if ($result) { if ($result['status']) { $new_password = Model_Users::generatePassword(8); $key_forgot = md5($result['user_id'] . md5($new_password)); $add_new_pass = Model_Users::edit($result['user_id'], array('new_password' => $new_password, 'new_password_key' => $key_forgot)); if ($add_new_pass) { $is_mail_smtp = JO_Registry::forceGet('config_mail_smtp'); $mail = new JO_Mail(); if ($is_mail_smtp) { $mail->setSMTPParams(JO_Registry::forceGet('config_mail_smtp_host'), JO_Registry::forceGet('config_mail_smtp_port'), JO_Registry::forceGet('config_mail_smtp_user'), JO_Registry::forceGet('config_mail_smtp_password')); } $this->view->new_password = $new_password; $this->view->user_info = $result; $this->view->forgot_password_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&user_id=' . $result['user_id'] . '&key=' . $key_forgot); $this->view->header_title = JO_Registry::get('site_name'); $this->view->base_href = WM_Router::create($request->getBaseUrl()); $result_send = Model_Email::send($result['email'], Helper_Config::get('noreply_mail'), $this->translate('Request for forgotten password') . ' ' . JO_Registry::get('site_name'), $this->view->render('send_forgot_password_request', 'mail')); if ($result_send) { $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=password&action=reset&done=')); } else { $this->view->error = $this->translate('There was an error. Please try again later!'); } } else { $this->view->error = $this->translate('There was a problem with the record. Please try again!'); } } else { $this->view->error = $this->translate('This profile is not active.'); } } else { $this->view->error = $this->translate('E-mail address was not found!'); } } else { $this->view->error = $validate->_get_error_messages(); } } $this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=password&action=reset'); $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); }
/** * ユーザーにメールを送信 * * @access private * @param array * @return bool */ private function sendMailToUser($args) { $email = new \Model_Email(); $params = array(); foreach ($args as $key => $value) { foreach (array_keys($value->properties()) as $column) { $params["{$key}.{$column}"] = $value->get($column); } } $entry = $args['entry']; $entry_styles = \Config::get('master.entry_styles'); $params['fleamarket_entry_style.entry_style_name'] = $entry_styles[$entry->fleamarket_entry_style->entry_style_id]; $params['fleamarket_entry_styles.entry_style_name'] = implode('/', array_map(function ($obj) use($entry_styles) { return $entry_styles[$obj->entry_style_id]; }, $entry->fleamarket->fleamarket_entry_styles)); try { $email->sendMailByParams('send_mail_to_user_waiting_reservation', $params, $args['entry']->user->email); } catch (\Exception $e) { return false; } return true; }
public function action_recover_request() { $view = View::factory('login/recover'); if ('POST' == $_SERVER['REQUEST_METHOD']) { $post = new Validate($_POST); $post->rules('email', array('not_empty' => array(), 'email' => array())); if ($post->check()) { $user = ORM::factory('user')->where('email', '=', $post['email'])->find(); if ('True' == $user->email_verified) { $user->generate_key(); $user->save(); /* //send an email $q = new Pheanstalk_Model('codewars-email'); $q->put('password:'******'login/recover_email_html'); $text_email = View::factory('login/recover_email_text'); $link = url::site('login/recover/?' . 'key=' . $user->activation_key . '&id=' . $user->id); View::bind_global('link', $link); $email = new Model_Email(); $messages = $email->message(array($user->email => $user->fullname()), '[Code-Wars] Password Recovery', $html_email, $text_email); if (false === $messages) { $view->set('message', 'Looks like email has not been configured serverside'); } else { $view = View::factory('login/recover_sent'); } } else { $view->set('message', 'Your email address was not verified we can not send you a password recovery email'); } } else { $view->set('message', $post->errors('login_errors')); } } $this->request->response = $view; }
public function indexAction() { $request = $this->getRequest(); if (JO_Session::get('user[user_id]')) { $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl())); } if (Helper_Config::get('enable_free_registration')) { $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=register')); } $this->view->login = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'); if (JO_Session::get('successfu_edite')) { $this->view->successfu_edite = true; JO_Session::clear('successfu_edite'); } if ($request->isPost()) { $validate = new Helper_Validate(); $validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email'); if ($validate->_valid_form()) { $shared_contentObject = new Model_Users_Invate(); $shared_content = $shared_contentObject->isInvatedByEmail($request->getPost('email')); if ($shared_content == 1) { $this->view->error = $this->translate('This e-mail address is already registered'); } else { if ($shared_content == 2) { $this->view->error = $this->translate('This e-mail address is already registered'); } else { if (($key = Model_Users::addSharedContent($request->getPost('email'))) !== false) { JO_Session::set('successfu_edite', true); if (Helper_Config::get('not_ri')) { Model_Email::send(Helper_Config::get('report_mail'), Helper_Config::get('noreply_mail'), $this->translate('New invitation request'), $this->translate('Hello, there is new invitation request in ') . ' ' . Helper_Config::get('site_name')); } $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing')); } else { $this->view->error = $this->translate('There was an error. Please try again later!'); } } } } else { $this->view->error = $validate->_get_error_messages(); } } $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); }
public function sendWelcomeAction() { if (JO_Session::get('user[user_id]')) { new Model_Users_Edit(JO_Session::get('user[user_id]'), array('first_login' => '0')); JO_Session::clear('category_id'); $this->view->user_info = JO_Session::get('user'); $this->view->user_info['first_login'] = 0; JO_Session::set('user', $this->view->user_info); $template = Model_Notification::getTemplate('welcome'); if ($template) { $template_data = array('user_id' => JO_Session::get('user[user_id]'), 'user_firstname' => JO_Session::get('user[firstname]'), 'user_lastname' => JO_Session::get('user[lastname]'), 'user_fullname' => JO_Session::get('user[fullname]'), 'user_username' => JO_Session::get('user[username]'), 'site_url' => $this->getRequest()->getBaseUrl(), 'site_name' => Helper_Config::get('site_name'), 'mail_footer' => html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8')); if (!$template['title']) { $template['title'] = $this->translate('Welcome to ${site_name}!'); } $title = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data); $body = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data); Model_Email::send(JO_Session::get('user[email]'), Helper_Config::get('noreply_mail'), $title, $body); } } $this->noViewRenderer(true); }
public function post_setemail() { $code = 0; $message = "ok"; $email = Input::post("email", null); if ($email != null) { $mail = Model_Email::forge(); $mail->email = $email; $mail->save(); $body = View::forge("email/email"); $sendmail = Email::forge("JIS"); $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name")); $sendmail->to($mail->email); $sendmail->subject("Thanks for your interest in our classroom. / Game-bootcamp"); $sendmail->html_body(htmlspecialchars_decode($body)); $sendmail->send(); } else { $code = 500; $message = "email error."; } $this->response(array('code' => $code, 'message' => $message)); }
public static function send($to, $from, $title, $body = '') { /*$is_mail_smtp = JO_Registry::forceGet('config_mail_smtp'); $mail = new JO_Mail; if($is_mail_smtp) { $mail->setSMTPParams(JO_Registry::forceGet('config_mail_smtp_host'), JO_Registry::forceGet('config_mail_smtp_port'), JO_Registry::forceGet('config_mail_smtp_user'), JO_Registry::forceGet('config_mail_smtp_password')); } $mail->setFrom( $from ); $mail->setReturnPath( $from ); $mail->setSubject( $title ); $mail->setHTML( $body ); return (int)$mail->send(array( $to ), ($is_mail_smtp ? 'smtp' : 'mail'));*/ $mail = new JO_Mailer_Base(); if (JO_Registry::forceGet('config_mail_smtp')) { $mail->SMTPAuth = true; $mail->IsSMTP(); $mail->Host = JO_Registry::forceGet('config_mail_smtp_host'); $mail->Port = JO_Registry::forceGet('config_mail_smtp_port'); $mail->Username = JO_Registry::forceGet('config_mail_smtp_user'); $mail->Password = JO_Registry::forceGet('config_mail_smtp_password'); } $mail->SetFrom($from, ''); $mail->AddReplyTo($from, ""); $mail->Subject = $title; $mail->AltBody = self::translate("To view the message, please use an HTML compatible email viewer!"); // optional, comment out and test $mail->MsgHTML($body, BASE_PATH); $mail->AddAddress($to, ""); $result = $mail->Send(); if ($result) { return true; } else { self::$error = $mail->ErrorInfo; return false; } }
public function indexAction() { if (!WM_Users::allow('create', $this->getRequest()->getController())) { $this->forward('error', 'noPermission'); } $request = $this->getRequest(); $this->view->user = $request->getPost('user'); $this->view->title = $request->getPost('title'); $this->view->description = $request->getPost('description'); $this->view->users = Model_Users::getUsers(array('filter_email' => '@')); if (JO_Session::get('successfu_edite')) { $this->view->successfu_edite = true; JO_Session::clear('successfu_edite'); } $this->view->errors = array(); if ($request->isPost()) { if ($this->getRequest()->issetPost('user')) { $result = ''; if ($this->getRequest()->getPost('user') == 'all') { $email_list = Model_Users::getUsers(array('filter_email' => '@')); foreach ($email_list as $email) { if (JO_Validate::validateEmail($email["email"])) { $result = Model_Email::send($email["email"], Helper_Config::get('noreply_mail'), $this->getRequest()->getPost('title'), html_entity_decode($this->getRequest()->getPost('description'), ENT_QUOTES, 'utf-8')); } } } elseif (JO_Validate::validateEmail($this->getRequest()->getPost('user'))) { $result = Model_Email::send($this->getRequest()->getPost('user'), Helper_Config::get('noreply_mail'), $this->getRequest()->getPost('title'), html_entity_decode($this->getRequest()->getPost('description'), ENT_QUOTES, 'utf-8')); } if ($result) { JO_Session::set('successfu_edite', true); $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/massmail/'); } else { $this->view->errors['no_emails'] = $this->translate('There was an error with sending the mail!'); } } } }
public function repinAction() { $request = $this->getRequest(); $pin_id = $request->getRequest('pin_id'); $pin_info = Model_Pins::getPin($pin_id); if (!$pin_info) { $this->forward('error', 'error404'); } $model_images = new Helper_Images(); $this->view->title = $pin_info['title']; $this->view->price = $pin_info['price']; $image = Helper_Uploadimages::pin($pin_info, '_B'); if ($image) { $this->view->media = $image['original']; } else { $this->view->media = false; } $this->view->is_video = $pin_info['is_video'] ? 'true' : 'false'; $this->view->is_article = $pin_info['is_article'] ? 'true' : 'false'; $this->view->from = $pin_info['from']; $this->view->description = $pin_info['description']; $this->view->from_url = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=repin&pin_id=' . $pin_id); $this->view->createBoard = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create'); $boards = Model_Boards::getBoards(array('filter_user_id' => JO_Session::get('user[user_id]'), 'order' => 'boards.sort_order', 'sort' => 'ASC', 'friendly' => JO_Session::get('user[user_id]'))); $this->view->boards = array(); if ($boards) { foreach ($boards as $board) { $this->view->boards[] = array('board_id' => $board['board_id'], 'title' => $board['title']); } } //////////// Categories //////////// $this->view->categories = array(); $categories = Model_Categories::getCategories(array('filter_status' => 1)); foreach ($categories as $category) { $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']); $this->view->categories[] = $category; } $this->view->popup_main_box = $this->view->render('repin', 'pin'); $this->view->is_article = $pin_info['is_article'] ? 'true' : 'false'; if ($request->isPost()) { $result = Model_Pins::create(array('title' => $pin_info['title'], 'from' => $pin_info['from'], 'image' => $this->view->media, 'is_video' => $pin_info['is_video'] ? 'true' : 'false', 'is_article' => $pin_info['is_article'] ? 'true' : 'false', 'description' => $request->getPost('message'), 'price' => $request->getPost('price'), 'board_id' => $request->getPost('board_id'), 'via' => $pin_info['user_id'], 'repin_from' => $pin_info['pin_id'], 'from_repin' => $pin_info['from'])); if ($result) { $this->view->pin_url = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $result); $this->view->popup_main_box = $this->view->render('success', 'addpin'); //add history Model_History::addHistory($pin_info['user_id'], Model_History::REPIN, $result); if ($pin_info['user']['email_interval'] == 1 && $pin_info['user']['repins_email']) { $this->view->user_info = $pin_info['user']; $this->view->profile_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')); $this->view->full_name = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]'); $this->view->text_email = $this->translate('repin your'); $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin_id); Model_Email::send($pin_info['user']['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('repin your pin'), $this->view->render('repin_pin', 'mail')); } } } $this->setViewChange('index'); if ($request->isXmlHttpRequest()) { $this->noViewRenderer(true); echo $this->view->popup_main_box; $this->view->is_popup = true; } else { $this->view->pins_details = $this->view->popup_main_box; $this->view->is_popup = false; $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'pin/left_part'); } }
/** * ユーザにテンプレートのメールを送信します * lang/ja/email配下のテンプレートを利用します。 * * @access public * @param string $subject * @param string $body * @return bool * @author shimma * * @todo 日本語のエラー表示を正しいものに変換する */ public function sendmail($template_name, $params = array()) { try { $email = new \Model_Email(); $email->sendMailByParams($template_name, $params, $this->email); } catch (\Exception $e) { throw new \SystemException(\Model_Error::ER00303); } }
public function indexAction() { $request = $this->getRequest(); $this->view->invate_limit = 5; if ($request->isPost()) { $emails = array(); $this->view->send = array(); for ($i = 1; $i < $this->view->invate_limit; $i++) { $this->view->send[$i] = array('success' => false, 'error' => false); $validate = new Helper_Validate(); if ($request->getPost('email-' . $i) != $this->translate('Email Adress ' . $i)) { $validate->_set_rules($request->getPost('email-' . $i), $this->translate('Email Adress ' . $i), 'not_empty;min_length[5];max_length[100];email'); if ($validate->_valid_form()) { $shared_content = Model_Users::sharedContentInvate($request->getPost('email-' . $i)); if ($shared_content == 1) { $this->view->send[$i]['error'] = $this->translate('With this email address is already registered users!'); } else { if ($shared_content == 2) { $this->view->send[$i]['error'] = $this->translate('To this email has been sent an invitation!'); } else { $inser_key = Model_Users::sharedContent($request->getPost('email-' . $i)); if ($inser_key == -1) { $this->view->send[$i]['error'] = $this->translate('There was an error. Please try again later!'); } else { $template = Model_Notification::getTemplate('send_invate'); if ($template) { $template_data = array('user_id' => JO_Session::get('user[user_id]'), 'user_firstname' => JO_Session::get('user[firstname]'), 'user_lastname' => JO_Session::get('user[lastname]'), 'user_fullname' => JO_Session::get('user[fullname]'), 'user_message' => $request->getPost('note') != $this->translate('Add a personal note') ? $request->getPost('note') : '', 'site_url' => $request->getBaseUrl(), 'site_name' => Helper_Config::get('site_name'), 'invate_url' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=register&user_id=' . JO_Session::get('user[user_id]') . '&key=' . $inser_key), 'mail_footer' => html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8')); if (!$template['title']) { $template['title'] = $this->translate('Join and create your own pinboards'); } $title = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data); $template = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data); $result = Model_Email::send($request->getPost('email-' . $i), Helper_Config::get('noreply_mail'), $title, $template); if ($result) { $this->view->send[$i]['success'] = $this->translate('The invitation was sent successfully!'); } else { $this->view->send[$i]['error'] = $this->translate('There was an error. Please try again later!'); } } else { $this->view->send[$i]['error'] = $this->translate('There was an error. Please try again later!'); } } } } } else { $this->view->send[$i]['error'] = strip_tags($validate->_get_error_messages()); } } } if ($request->isXmlHttpRequest()) { echo $this->renderScript('json'); exit; } else { JO_Session::set('result_from_invate', $this->view->send); $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=invites')); } } if (JO_Session::get('result_from_invate')) { $this->view->result_from_invate = JO_Session::get('result_from_invate'); JO_Session::clear('result_from_invate'); } $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'methodsforinvates' => 'invates/methodsforinvates'); }
public function reportCommentAction() { $request = $this->getRequest(); $comment_id = $request->getRequest('comment_id'); $comment_info = new Model_Pins_GetComment($comment_id); if (!$comment_info->count()) { $this->forward('error', 'error404'); } $comment_info = $comment_info->data; $reportcategories = new Model_Pins_CommentReportCategories(); $this->view->reportcategories = $reportcategories->toArray(); $this->view->url_form = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=reportComment&comment_id=' . $comment_id); $this->view->comment_id = $comment_id; $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $comment_info['pin_id']); if ($request->issetPost('report_category')) { $this->view->report_category = $request->getPost('report_category'); } else { if ($this->view->reportcategories) { list($firstKey) = array_keys($this->view->reportcategories); $this->view->report_category = $firstKey; } else { $this->view->report_category = 0; } } $this->view->comment_is = true; $this->view->pin_id = $comment_info['pin_id']; $this->setViewChange('report'); if ($request->isPost()) { $this->view->is_posted = true; if (Model_Pins::commentIsReported($comment_id)) { $this->view->error = $this->translate('You are already reported this comment!'); } else { $result = Model_Pins::reportComment($comment_id, $request->getPost('report_category'), $request->getPost('report_message')); if (!$result) { $this->view->error = $this->translate('Error reporting experience. Try again!'); } else { if (Helper_Config::get('not_rc')) { Model_Email::send(Helper_Config::get('report_mail'), Helper_Config::get('noreply_mail'), $this->translate('New reported comment'), $this->translate('Hello, there is new reported comment in ') . ' ' . Helper_Config::get('site_name')); } $terms = Model_Pages::getPage(Helper_Config::get('page_terms')); if ($terms) { $this->view->terms = $terms['title']; } $this->view->terms_href = WM_Router::create($request->getBaseUrl() . '?controller=about&action=terms'); $this->setViewChange('message_report'); } } } $this->noLayout(true); }
public function action_index() { $data = array(); $id = $this->request->param('id'); $emails = new Model_Email(); $material = new Model_Material('group'); if (isset($_POST['send'])) { $fields = $material->getFields2($_POST['template'], TRUE); //отправляем письмо $config = Kohana::$config->load('email'); Email::connect($config); $subject = Arr::get($fields, 'title'); $from = $config['options']['username']; $message = Arr::get($fields, 'text'); //генерируем уникальный разделитель $bound = "--" . md5(uniqid(time())); foreach ($_POST['check_name'] as $subscriberId) { $subscriber = $emails->getSubscriber($subscriberId); $message = str_replace('@#subscriber#@', $subscriber['name'], $message); $subject = str_replace('@#subscriber#@', $subscriber['name'], $subject); $message = str_replace('@#site#@', Kohana::$base_url, $message); $mail_header = "MIME-Version: 1.0;\r\n"; $mail_header .= "Content-Type: multipart/mixed; boundary=\"{$bound}\"\r\n"; $mail_header .= "Отправитель: <" . $from . ">\r\n"; $mail_header .= "Для ответа <" . $from . ">\r\n"; $mail_header .= "Subject: {$subject} \n"; //прикрепляем файл //путь к файлу $file_path = DOCROOT . '/img/user/novost-1_859f1ca6ad9b29c3475.png'; //если файл найден, прикрепляем его к сообщению if (file_exists($file_path)) { $file_name = basename($file_path); $fa = fopen($file_path, "rb"); if ($fa) { $multipart_message = "\r\n--{$bound}\r\n"; $multipart_message .= "Content-Type: text/html; charset=UTF-8\r\n"; $multipart_message .= "Content-Transfer-Encoding: base64\r\n"; $multipart_message .= "\r\n"; $multipart_message .= chunk_split(base64_encode($message)); $multipart_message .= "\r\n\r\n--{$bound}\r\n"; $multipart_message .= "Content-Type: application/octet-stream; name=\"{$file_name}\"\r\n"; $multipart_message .= "Content-Transfer-Encoding: base64\r\n"; $multipart_message .= "Content-Disposition: attachment; filename=\"{$file_name}\"\r\n"; $multipart_message .= "\r\n"; $multipart_message .= chunk_split(base64_encode(fread($fa, filesize($file_path)))); fclose($fa); //передаем текст сообщения и прикрепленный файл в переменную $message = $multipart_message; } else { $message = $message; } } else { //если файл не существует передаем текстовое сообщение $message = $message; } // var_dump($message); try { if (mail($subscriber['email'], $subject, $message, $mail_header)) { // if(Email::send($subscriber['email'], $from, $subject, $message, $html = TRUE)) $this->messages[] = 'Успешная отправка на ' . $subscriber['email']; } else { $this->errors[] = 'Ошибка отправки на ' . $subscriber['email']; } } catch (Exception $e) { $this->errors[] = 'Ошибка отправки на ' . $subscriber['email']; } } } if ($id == NULL) { $this->templates = $material->getMaterials(59, 100, 0, '', array(), array('text')); $data['emails'] = $emails->getEmails(); } $this->template->content = View::factory('admin/admEmails', array('data' => $data, 'user' => $this->user, 'templates' => $this->templates, 'errors' => $this->errors, 'messages' => $this->messages)); }
/** * ユーザーにメールを送信 * * @para $contact Model_Contact * @access private * @return void */ private function sendMailToUserAndAdmin($contact) { $params = array(); foreach (array('contact_id', 'last_name', 'first_name', 'subject', 'email', 'tel', 'contents') as $key) { $params[$key] = $contact->get($key); } $params['inquiry_type_label'] = $contact->inquiry_type_label(); $email = new Model_Email(); $email->sendMailByParams("inquiry/user", $params, array($contact->email)); $email->sendMailByParams("inquiry/admin", $params, '', array('reply_to' => $contact->email)); }
public function sendWeeklyAction() { $request = $this->getRequest(); $this->view->base_href = $request->getBaseUrl(); $this->view->site_name = JO_Registry::get('site_name'); $this->view->on_facebook = JO_Registry::get('config_on_facebook'); $this->view->site_logo = $this->view->base_href . 'data/images/logo.png'; if (JO_Registry::get('site_logo') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('site_logo'))) { $this->view->site_logo = $this->view->base_href . 'uploads' . JO_Registry::get('site_logo'); } $this->view->settings = WM_Router::create($this->view->base_href . '?controller=prefs'); $goodies = Model_Pages::getPage(JO_Registry::get('page_goodies')); if ($goodies) { //$this->view->pin_it = WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_goodies')); $this->view->pin_it = 'http://amatteur.com/apps'; } $this->view->pages = array(); $page = Model_Pages::getPage(JO_Registry::get('page_privacy_policy')); if ($page) { $this->view->pages[] = array('title' => $page['title'], 'href' => WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_privacy_policy'))); } $page = Model_Pages::getPage(JO_Registry::get('page_terms')); if ($page) { $this->view->pages[] = array('title' => $page['title'], 'href' => WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_privacy_policy'))); } $histories = Model_History::getHistoryToday(array('week_range' => WM_Date::x_week_range($this->now))); $no_avatar = JO_Registry::get('no_avatar'); if ($histories) { $model_images = new Helper_Images(); /* BOARDS */ $this->view->popular_bards = array(); $populars = Model_Boards::getBoards(array('start' => 0, 'limit' => 6, 'sort' => 'DESC', 'order' => 'boards.total_views', 'where' => new JO_Db_Expr('pins > 4'))); if ($populars) { foreach ($populars as $board) { $board['href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); $board['thumbs'] = array(); $get_big = false; for ($i = 0; $i < 5; $i++) { $image = isset($board['pins_array'][$i]) ? $board['pins_array'][$i]['image'] : false; if ($image) { if ($get_big) { $size = '_A'; } else { $size = '_C'; $get_big = true; } $data_img = call_user_func(array(Helper_Pin::formatUploadModule($board['pins_array'][$i]['store']), 'getPinImage'), $board['pins_array'][$i], $size); if ($data_img) { $board['thumbs'][] = $data_img['image']; } else { $board['thumbs'][] = false; } } else { $board['thumbs'][] = false; } } $board['user'] = Model_Users::getUser($board['user_id']); $board['user']['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $board['user_id']); $avatar = Helper_Uploadimages::avatar($board['user'], '_A'); $board['user']['avatar'] = $avatar['image']; $this->view->popular_bards[] = $board; } } /* VIDEO */ // $this->view->video = array(); // $video = Model_Pins::getPins(array( // 'start' => 0, // 'limit' => 1, // 'filter_is_video' => 1 // )); // // if($video) { // foreach($video AS $pin) { // $pin['thumb'] = $model_images->resizeWidth($pin['image'], 194); // $pin['thumb_width'] = $model_images->getSizes('width'); // $pin['thumb_height'] = $model_images->getSizes('height'); // $pin['description'] = Helper_Pin::descriptionFix($pin['description']); // $pin['href'] = WM_Router::create( $request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['pin_id'] ); // // } // } /* HISTORY */ foreach ($histories as $history) { if (!isset($history['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($history, '_B'); $history['avatar'] = $avatar['image']; $history['user_followers'] = WM_Router::create($this->view->base_href . '?controller=users&action=followers&user_id=' . $history['user_id']); $history['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $history['user_id']); $history['history_comments_total'] = count($history['history_comments']); $history['history_follow_total'] = count($history['history_follow']); $history['history_like_total'] = count($history['history_like']); $history['history_repin_total'] = count($history['history_repin']); $history['history_event_total'] = count($history['history_event']); /////comments if ($history['history_comments_total']) { foreach ($history['history_comments'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_comments'][$k]['avatar'] = $avatar['image']; $history['history_comments'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } /////follow if ($history['history_follow_total']) { foreach ($history['history_follow'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_follow'][$k]['avatar'] = $avatar['image']; $history['history_follow'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } /////like if ($history['history_like_total']) { foreach ($history['history_like'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_like'][$k]['avatar'] = $avatar['image']; $history['history_like'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } /////repin if ($history['history_repin_total']) { foreach ($history['history_repin'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_repin'][$k]['avatar'] = $avatar['image']; $history['history_repin'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } ////events if ($history['history_event_total']) { foreach ($history['history_event'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::event($v, '_A'); $history['history_event'][$k]['avatar'] = $avatar['image']; $history['history_event'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } $this->view->events = array(); $this->view->event = array(); $dataEvents = array('filter_cron' => $history['user_id']); $events = Model_Events::getEvents($dataEvents); if ($events) { foreach ($events as $key => $event) { $href = ""; $view = JO_View::getInstance(); $view->loged = JO_Session::get('user[user_id]'); $model_images = new Helper_Images(); $avatar = Helper_Uploadimages::avatar($event, '_B'); $event['avatar'] = $avatar['image']; $event['thumbs'] = $avatar['image']; $event["sport_category"] = Model_Boards::getCategoryTitle($event["sport_category"]); $data = array('filter_user_id' => $event["user_id"]); $users = Model_Users::getUsers($data); if ($users) { $event['fullname'] = $users[0]["fullname"]; $event['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']); $href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']); } //$view->boxeventdetail = WM_Router::create($request->getBaseUrl() . '?controller=events&action=boxeventdetail&event_id=' . $event['event_id']); $view->boxeventdetail = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']); $this->view->event[] = $event; $view->event = $event; $this->view->events[] = $view->render('boxEvent', 'events'); } } /* PINS */ $likes = Model_History::getHistory(array('history_action' => Model_History::LIKEPIN, 'start' => 0, 'limit' => 30), 'from_user_id', $history['user_id']); $history['pins_likes'] = array(); if ($likes) { $temp = array(); foreach ($likes as $like) { $temp[$like['pin_id']] = $like['pin_id']; } if ($temp) { $pins = Model_Pins::getPins(array('start' => 0, 'limit' => 9, 'filter_id_in' => implode(',', $temp))); if ($pins) { foreach ($pins as $pin) { $image = call_user_func(array(Helper_Pin::formatUploadModule($pin['store']), 'getPinImage'), $pin, '_B'); if ($image) { $pin['thumb'] = $image['image']; $pin['thumb_width'] = $image['width']; $pin['thumb_height'] = $image['height']; } else { continue; } $pin['description'] = Helper_Pin::descriptionFix($pin['description']); $pin['href'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['pin_id']); $pin['onto_href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $pin['user_id'] . '&board_id=' . $pin['board_id']); $pin['price_formated'] = WM_Currency::format($pin['price']); $avatar = Helper_Uploadimages::avatar($pin['user'], '_A'); $pin['user']['avatar'] = $avatar['image']; $pin['user']['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $pin['user_id']); $pin['via_profile'] = array(); if ($pin['via'] && $pin['user_via']) { $pin['via_profile'] = array('profile' => WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $pin['via']), 'fullname' => $pin['user_via']['fullname']); } $history['pins_likes'][] = $pin; } } } } $this->view->history = $history; $html = $this->view->render('sendWeekly', 'crons'); Model_Email::send($history['email'], JO_Registry::get('noreply_mail'), sprintf($this->translate('Weekly %s'), $this->view->site_name), $html); } } }
public function indexAction() { $request = $this->getRequest(); if (!JO_Session::get('user[user_id]')) { $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&popup=true&next=' . urlencode($request->getFullUrl()))); } $this->view->createBoard = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create'); $boards = Model_Boards::getBoards(array('filter_user_id' => JO_Session::get('user[user_id]'), 'order' => 'boards.sort_order', 'sort' => 'ASC', 'friendly' => JO_Session::get('user[user_id]'))); $this->view->boards = array(); if ($boards) { foreach ($boards as $board) { $this->view->boards[] = array('board_id' => $board['board_id'], 'title' => $board['title']); } } //////////// Categories //////////// $this->view->categories = array(); $categories = Model_Categories::getCategories(array('filter_status' => 1)); foreach ($categories as $category) { $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']); $this->view->categories[] = $category; } $this->view->title = JO_Utf8::convertToUtf8($request->getQuery('title')); $this->view->url = JO_Utf8::convertToUtf8(urldecode($request->getQuery('url'))); $this->view->media = JO_Utf8::convertToUtf8($request->getQuery('media')); $this->view->is_video = JO_Utf8::convertToUtf8($request->getQuery('is_video')); $this->view->description = JO_Utf8::convertToUtf8($request->getQuery('description')); $this->view->charset = JO_Utf8::convertToUtf8($request->getQuery('charset')); if (!trim($this->view->description)) { $this->view->description = $this->view->title; } if (JO_Session::get('success_added')) { $this->view->pin_url = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . JO_Session::get('success_added')); $this->setViewChange('success'); JO_Session::clear('success_added'); } else { if ($request->isPost()) { $result = Model_Pins::create(array('title' => $this->view->title, 'from' => $this->view->url, 'image' => $this->view->media, 'is_video' => $this->view->is_video, 'description' => $request->getPost('message'), 'price' => $request->getPost('price'), 'board_id' => $request->getPost('board_id'), 'pinmarklet' => 1)); if ($result) { Model_History::addHistory(0, Model_History::ADDPIN, $result); $session_user = JO_Session::get('user[user_id]'); $group = Model_Boards::isGroupBoard($request->getPost('board_id')); if ($group) { $users = explode(',', $group); foreach ($users as $user_id) { if ($user_id != $session_user) { $user_data = Model_Users::getUser($user_id); if ($user_data && $user_data['email_interval'] == 1 && $user_data['groups_pin_email']) { $this->view->user_info = $user_data; $this->view->profile_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')); $this->view->full_name = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]'); $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $result); $board_info = Model_Boards::getBoard($request->getPost('board_id')); if ($board_info) { $this->view->board_title = $board_info['title']; $this->view->board_href = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id']); } Model_Email::send($user_data['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('added new pin to a group board'), $this->view->render('group_board', 'mail')); } } } } JO_Session::set('success_added', $result); $this->redirect($request->getBaseUrl() . '?controller=bookmarklet'); } } } }
public function inviteAction() { if (!WM_Users::allow('create', $this->getRequest()->getController())) { echo $this->translate('You do not have permission to this action'); } else { $this->setInvokeArg('noViewRenderer', true); $info = Model_Users::getWait($this->getRequest()->getPost('id')); if ($info) { $this->view->shared_content = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=register&user_id=-1&key=' . $info['key']); $result = Model_Email::send($info['email'], Helper_Config::get('noreply_mail'), sprintf($this->translate('You have been invited to join %s'), Helper_Config::get('site_name')), $this->view->render('invite', 'invites')); Model_Users::invite($this->getRequest()->getPost('id')); } } }
public function indexAction() { $request = $this->getRequest(); if (JO_Session::get('user[user_id]')) { $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl())); } if (JO_Registry::get('enable_free_registration')) { $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=register')); } if ($this->getLayout()->meta_title) { $this->getLayout()->placeholder('title', $this->getLayout()->meta_title . ' - ' . JO_Registry::get('meta_title')); } else { $this->getLayout()->placeholder('title', JO_Registry::get('meta_title')); } if ($this->getLayout()->meta_description) { $this->getLayout()->placeholder('description', $this->getLayout()->meta_description); } else { $this->getLayout()->placeholder('description', JO_Registry::get('meta_description')); } if ($this->getLayout()->meta_keywords) { $this->getLayout()->placeholder('keywords', $this->getLayout()->meta_keywords); } else { $this->getLayout()->placeholder('keywords', JO_Registry::get('meta_keywords')); } $this->getLayout()->placeholder('site_name', JO_Registry::get('site_name')); $this->view->site_name = JO_Registry::get('site_name'); $this->view->meta_title = JO_Registry::get('meta_title'); $this->getLayout()->placeholder('google_analytics', html_entity_decode(JO_Registry::get('google_analytics'), ENT_QUOTES, 'utf-8')); $this->view->baseUrl = $request->getBaseUrl(); $this->view->site_logo = $request->getBaseUrl() . 'data/images/logo.png'; if (JO_Registry::get('site_logo') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('site_logo'))) { $this->view->site_logo = $request->getBaseUrl() . 'uploads' . JO_Registry::get('site_logo'); } $this->view->login = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'); if (JO_Session::get('successfu_edite')) { $this->view->successfu_edite = true; JO_Session::clear('successfu_edite'); } if ($request->isPost()) { $validate = new Helper_Validate(); $validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email'); if ($validate->_valid_form()) { $shared_content = Model_Users::sharedContentInvate($request->getPost('email')); if ($shared_content == 1) { $this->view->error = $this->translate('This e-mail address is already registered'); } else { if ($shared_content == 2) { $this->view->error = $this->translate('This e-mail address is already registered'); } else { if (($key = Model_Users::addSharedContent($request->getPost('email'))) !== false) { JO_Session::set('successfu_edite', true); if (JO_Registry::get('not_ri')) { Model_Email::send(JO_Registry::get('report_mail'), JO_Registry::get('noreply_mail'), $this->translate('New invitation request'), $this->translate('Hello, there is new invitation request in ') . ' ' . JO_Registry::get('site_name')); } $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing')); } else { $this->view->error = $this->translate('There was an error. Please try again later!'); } } } } else { $this->view->error = $validate->_get_error_messages(); } } // $this->view->children = array( // 'header_part' => 'layout/header_part', // 'footer_part' => 'layout/footer_part' // ); }
public function fromfileAction() { $request = $this->getRequest(); $this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=addpin&action=upload_images'); $this->view->upload_action = WM_Router::create($request->getBaseUrl() . '?controller=addpin&action=upload_imagesView'); $this->view->popup_main_box = $this->view->render('fromfile', 'addpin'); if ($request->isPost()) { $result = Model_Pins::create(array('title' => $request->getPost('title'), 'from' => '', 'image' => BASE_PATH . JO_Session::get('upload_from_file'), 'is_video' => $request->getPost('is_video'), 'is_article' => $request->getPost('is_article'), 'description' => $request->getPost('message'), 'price' => $request->getPost('price'), 'board_id' => $request->getPost('board_id'))); if ($result) { Model_History::addHistory(0, Model_History::ADDPIN, $result); if (JO_Registry::get('isMobile')) { $this->redirect('/'); } $session_user = JO_Session::get('user[user_id]'); $group = Model_Boards::isGroupBoard($request->getPost('board_id')); if ($group) { $users = explode(',', $group); foreach ($users as $user_id) { if ($user_id != $session_user) { $user_data = Model_Users::getUser($user_id); if ($user_data && $user_data['email_interval'] == 1 && $user_data['groups_pin_email']) { $this->view->user_info = $user_data; $this->view->profile_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')); $this->view->full_name = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]'); $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $result); $board_info = Model_Boards::getBoard($request->getPost('board_id')); if ($board_info) { $this->view->board_title = $board_info['title']; $this->view->board_href = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id']); } Model_Email::send($user_data['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('added new pin to a group board'), $this->view->render('group_board', 'mail')); } } } } $this->view->pin_url = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $result); $this->view->popup_main_box = $this->view->render('success', 'addpin'); if (JO_Session::get('upload_from_file')) { @unlink(BASE_PATH . JO_Session::get('upload_from_file')); JO_Session::clear('upload_from_file'); JO_Session::clear('upload_from_file_name'); } } } $this->setViewChange('index'); if ($request->isXmlHttpRequest()) { $this->view->popup = true; echo $this->view->popup_main_box; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'layout/left_part'); } }
public function pinMediaCallbackAction() { $request = $this->getRequest(); if (JO_Session::get('user[user_id]')) { $media = Model_Instagram_Media::getMedia($request->getPost('media_id')); if ($media) { if ($media['user_id'] == JO_Session::get('user[user_id]')) { $result = new Model_Pins_Create(array('title' => $media['title'], 'from' => $media['from'], 'image' => $media['media'], 'description' => $media['title'], 'board_id' => JO_Session::get('instagram_media[board_id]'))); if ($result->count()) { $result = $result->data; $this->view->pin_url = WM_Router::pinAction($result['pin_id']); Model_Instagram_Media::setPinMedia($media['media_id'], $result['pin_id']); ///add history new Model_History_AddHistory(JO_Session::get('user[user_id]'), Model_History_Abstract::ADDPIN, $result['pin_id']); //send notification $users = new Model_Users_GroupBoardUsers(JO_Session::get('instagram_media[board_id]')); if ($users->count()) { $template = Model_Notification::getTemplate('group_board'); if ($template) { $pin_info = new Model_Pins_Pin($result['pin_id']); if ($pin_info->count()) { $mail_footer = html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8'); foreach ($users as $user) { if ($user['email_interval'] == 1 && $user['groups_pin_email']) { $template_data = array('user_id' => $user['user_id'], 'user_firstname' => $user['firstname'], 'user_lastname' => $user['lastname'], 'user_fullname' => $user['fullname'], 'user_username' => $user['username'], 'author_url' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $pin_info['user_user_id']), 'author_fullname' => $pin_info['user_fullname'], 'board_url' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $pin_info['user_user_id'] . '&board_id=' . $pin_info['board_board_id']), 'board_name' => $pin_info['board_title'], 'pin_url' => WM_Router::pinAction($pin_info['pin_pin_id']), 'mail_footer' => $mail_footer); if (!$template['title']) { $template['title'] = '${author_fullname} ' . $this->translate('added new pin to a group board'); } $title = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data); $body = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data); Model_Email::send($user['email'], Helper_Config::get('noreply_mail'), $title, $body); } } } } } $this->view->ok = true; } else { $this->view->error = $this->translate('There was a problem with the record. Please try again!'); } } else { $this->view->error = $this->translate('Private media!'); } } else { $this->view->error = $this->translate('Media not found!'); } } else { $this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'); } echo $this->renderScript('json'); }
public function indexAction() { $request = $this->getRequest(); //JO_Session::clear('categoria_id'); //para las APP's if (isset($_POST['token']) && $_POST['token'] == md5($_POST['userid'])) { $_SESSION['token'] = $_POST['token']; JO_Session::set('token', $_POST['token']); $result = Model_Users::checkLoginAPP($_POST['userid']); if ($result) { if ($result['status']) { @setcookie('csrftoken_', md5($result['user_id'] . $request->getDomain() . $result['date_added']), time() + 86400 * 366 * 5, '/', '.' . $request->getDomain()); JO_Session::set(array('user' => $result)); } } } if ($request->getParam('direct_path') == 'true') { if (JO_Session::get('user[user_id]') && JO_Session::get('category_id')) { Model_Users::edit(JO_Session::get('user[user_id]'), array('first_login' => '0')); JO_Session::clear('category_id'); $this->view->user_info = JO_Session::get('user'); Model_Email::send(JO_Session::get('user[email]'), JO_Registry::get('noreply_mail'), sprintf($this->translate('Welcome to %s!'), JO_Registry::get('site_name')), $this->view->render('welcome', 'mail')); } $this->redirect($request->getBaseUrl()); } /*$img = JO_Phpthumb::getInstance(); var_dump($img->isValidImplementation('imagick')); exit; $img = JO_Phpthumb_Factory::create('http://www.desiredanimations.com/wp-content/uploads/2011/08/Cars-2.jpg'); $img->adaptiveResize(250, 250)->createReflection(40, 40, 80, true, '#a4a4a4'); $img->show(); exit;*/ $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit')); if (JO_Session::get('user[user_id]')) { $data['following_users_from_user_id'] = JO_Session::get('user[user_id]'); $data['filter_marker'] = $request->getRequest('marker'); } else { $data['filter_rand'] = true; } $this->view->pins = ''; //error_log("INICIO PINS: ".date("Y-m-d H:i:s")); $pins = Model_Pins::getPins($data); //error_log("EMPIEZAN PINES: ".self::udate("Y-m-d H:i:s:u")); if ($pins) { $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "' AND position BETWEEN '" . (int) $data['start'] . "' AND '" . (int) $data['limit'] . "'")); $pp = JO_Registry::get('config_front_limit'); $cuentaPins = 0; foreach ($pins as $row => $pin) { $cuentaPins = $cuentaPins + 1; ///banners $key = $row + ($pp * $page - $pp); if (isset($banners[$key])) { $this->view->pins .= Helper_Banners::returnHtml($banners[$key]); } //pins //error_log("EMPIEZA PIN(".$cuentaPins."): ".self::udate("Y-m-d H:i:s:u")); $this->view->pins .= Helper_Pin::returnHtml($pin); //error_log("FIN PIN(".$cuentaPins."): ".self::udate("Y-m-d H:i:s:u")); } //error_log("FIN BUCLE (".$cuentaPins." PINS): ".date("Y-m-d H:i:s")); if (JO_Session::get('user[user_id]')) { // JO_Registry::set('marker', Model_Pins::getMaxPin($data)); } } //error_log("FIN PINES(".$cuentaPins."): ".self::udate("Y-m-d H:i:s:u")); if (!$request->isXmlHttpRequest() && JO_Session::get('user[user_id]')) { $history = Model_History::getHistory(array('start' => 0, 'limit' => 10, 'sort' => 'DESC', 'order' => 'history_id')); $model_images = new Helper_Images(); foreach ($history as $key => $data) { if (!isset($data['user']['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($data['user'], '_A'); $history[$key]['user']['avatar'] = $avatar['image']; if ($data['history_action'] == Model_History::REPIN) { $history[$key]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $data['pin_id']); } else { $history[$key]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $data['from_user_id']); } } $this->view->history = $history; } if ($request->isXmlHttpRequest()) { echo $this->view->pins; // echo $this->renderScript('json'); $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); } // if((int)JO_Registry::get('config_cache_live')) { // $http = new JO_Http(); // $http->setTimeout(1); // $http->execute($request->getBaseUrl() . '?action=generateCache'); // } }
public function createAction() { $request = $this->getRequest(); if (JO_Session::get('user[user_id]')) { if ($request->isPost()) { $validate = new Helper_Validate(); $validate->_set_rules($request->getPost('newboard'), $this->translate('Board Name'), 'not_empty;min_length[3];max_length[100]'); $validate->_set_rules($request->getPost('category_id'), $this->translate('Board Category'), 'not_empty'); if ($validate->_valid_form()) { $postData = array_merge($request->getPost(), array('title' => $request->getPost('newboard'))); if (Helper_Config::get('config_private_boards')) { $postData['public'] = (int) (!$request->issetPost('public')); } $result = new Model_Boards_Create($postData); if ($result->board_id) { $this->view->redirect = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . JO_Session::get('user[user_id]') . '&board_id=' . $result->board_id); $this->view->created = true; //send notifications if (is_array($request->getPost('friends'))) { $template = Model_Notification::getTemplate('board_invite'); if ($template) { $mail_footer = html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8'); foreach ($request->getPost('friends') as $user_id) { $user = new Model_Users_User($user_id); if ($user->count()) { if ($user['email_interval'] == 1 && $user['groups_pin_email']) { $template_data = array('user_id' => $user['user_id'], 'user_firstname' => $user['firstname'], 'user_lastname' => $user['lastname'], 'user_fullname' => $user['fullname'], 'user_username' => $user['username'], 'author_url' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')), 'author_fullname' => JO_Session::get('user[fullname]'), 'board_url' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . JO_Session::get('user[user_id]') . '&board_id=' . $result->board_id), 'board_name' => $request->getPost('newboard'), 'mail_footer' => $mail_footer); if (!$template['title']) { $template['title'] = '${author_fullname} ' . $this->translate('invited you to add pins'); } $title = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data); $body = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data); Model_Email::send($user['email'], Helper_Config::get('noreply_mail'), $title, $body); } } } } } } else { $this->view->error = $this->translate('There was a problem with the record. Please try again!'); } } else { $this->view->error = $validate->_get_error_messages(); } echo $this->renderScript('json'); } else { $this->view->avatars = Helper_Uploadimages::userAvatars(JO_Session::get('user')); $this->view->fullname = JO_Session::get('user[fullname]'); $this->view->userhref = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')); $this->view->friends_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=friends'); $this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create'); $this->view->private = 1; /////private boards $this->view->enable_private_boards = Helper_Config::get('config_private_boards'); $private_boards = Model_Pages::getPage(Helper_Config::get('page_private_boards')); if ($private_boards) { $this->view->text_private_boards = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . Helper_Config::get('page_private_boards')); } //////////// Categories //////////// $this->view->categories = Model_Categories::getCategories(array('filter_status' => 1)); $this->view->config_board_description_enable = Helper_Config::get('config_board_description_enable'); $this->view->popup_main_box = $this->view->render('popup_form', 'boards'); $this->setViewChange('form'); if ($request->isXmlHttpRequest()) { $this->view->popup = true; echo $this->view->popup_main_box; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'layout/left_part'); } } } else { $this->view->redirect = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'); // echo $this->renderScript('json'); $this->setViewChange('redirect'); } }
public function header_partAction() { $request = $this->getRequest(); if (JO_Session::get('user[user_id]') && JO_Session::get('category_id')) { Model_Users::edit(JO_Session::get('user[user_id]'), array('first_login' => '0')); JO_Session::clear('category_id'); $this->view->user_info = JO_Session::get('user'); Model_Email::send(JO_Session::get('user[email]'), JO_Registry::get('noreply_mail'), sprintf($this->translate('Welcome to %s!'), JO_Registry::get('site_name')), $this->view->render('welcome', 'mail')); } $this->view->og_namespace = trim(JO_Registry::get('og_namespace')); $this->view->og_recipe = trim(JO_Registry::get('og_recipe')); if (!$this->view->og_recipe) { $this->view->og_namespace = ''; } $this->view->show_landing = !JO_Registry::get('enable_free_registration'); $to_title = ''; if (JO_Session::get('user[user_id]')) { $to_title = JO_Session::get('user[fullname]') . ' / '; } if ($this->getLayout()->meta_title) { $this->getLayout()->placeholder('title', $this->getLayout()->meta_title . ' - ' . JO_Registry::get('meta_title')); } else { $this->getLayout()->placeholder('title', $to_title . JO_Registry::get('meta_title')); } if ($this->getLayout()->meta_description) { $this->getLayout()->placeholder('description', $this->getLayout()->meta_description); } else { $this->getLayout()->placeholder('description', JO_Registry::get('meta_description')); } if ($this->getLayout()->meta_keywords) { $this->getLayout()->placeholder('keywords', $this->getLayout()->meta_keywords); } else { $this->getLayout()->placeholder('keywords', JO_Registry::get('meta_keywords')); } $this->getLayout()->placeholder('site_name', JO_Registry::get('site_name')); $this->view->site_name = JO_Registry::get('site_name'); $this->view->meta_title = JO_Registry::get('meta_title'); $this->getLayout()->placeholder('google_analytics', html_entity_decode(JO_Registry::get('google_analytics'), ENT_QUOTES, 'utf-8')); $this->view->baseUrl = $request->getBaseUrl(); $this->view->site_logo = $request->getBaseUrl() . 'data/images/logo.png'; if (JO_Registry::get('site_logo') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('site_logo'))) { $this->view->site_logo = $request->getBaseUrl() . 'uploads' . JO_Registry::get('site_logo'); } if (JO_Registry::get('favicon') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('favicon'))) { $this->getLayout()->placeholder('favicon', $request->getBaseUrl() . 'uploads' . JO_Registry::get('favicon')); } $this->getLayout()->placeholder('site_logo', $this->view->site_logo); $this->view->show_header_invate = !JO_Session::get('user[user_id]'); if (!JO_Session::get('user[user_id]')) { switch (true) { case $request->getAction() == 'login': $this->view->show_header_invate = true; case $request->getAction() == 'register': $this->view->show_header_invate = true; break; } } $this->view->controller_open = $request->getController(); $this->view->show_header_line = !in_array($request->getController(), array('pin')); $this->view->show_slider = !in_array($request->getController(), array('users', 'pin', 'settings', 'prefs', 'password')); if ($request->getController() == 'users') { $this->view->show_header_line = false; } //==== brand =====// $this->view->show_brand = true; if (JO_Registry::get('license_powered_check') == 'false' && JO_Registry::get('config_hide_brand')) { $this->view->show_brand = false; } ////////// CURRENCY //autoupdate currency if set if (JO_Registry::get('config_currency_auto_update')) { WM_Currency::updateCurrencies(); } $currencies = WM_Currency::getCurrencies(); $price_left = array(); $price_right = array(); if ($currencies) { foreach ($currencies as $currency) { if (trim($currency['symbol_left'])) { $price_left[] = preg_quote(trim($currency['symbol_left'])); } if (trim($currency['symbol_right'])) { $price_right[] = preg_quote(trim($currency['symbol_right'])); } } } $this->view->price_left = implode('|', $price_left); $this->view->price_right = implode('|', $price_right); //////////// Categories //////////// $this->view->categories = array(); $categories1 = array("0" => array("category_id" => "9999", "title" => "TODO", "image" => "")); $this->view->category_active = false; $categories2 = Model_Categories::getCategories(array('filter_status' => 1)); $categories = array_merge($categories1, $categories2); $x = 0; foreach ($categories as $category) { if ($x == 0) { $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']); $category['href'] = WM_Router::create($request->getBaseUrl() . '?controller=all&category_id=' . $category['category_id']); if ($request->getRequest('category_id') == 9999) { $category['active'] = TRUE; $this->view->category_active = $category['title']; } else { $category['active'] = FALSE; } $this->view->categories[] = $category; } else { $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']); $category['href'] = WM_Router::create($request->getBaseUrl() . '?controller=category&category_id=' . $category['category_id']); $category['active'] = $category['category_id'] == $request->getRequest('category_id'); if ($category['active']) { $this->view->category_active = $category['title']; } else { $i = 0; foreach ($category['subcategories'] as $subcategory) { $category['subcategories'][$i]['active'] = $subcategory['category_id'] == $request->getRequest('category_id'); if ($category['subcategories'][$i]['active']) { $this->view->category_active = $subcategory['title']; } $i++; } } $this->view->categories[] = $category; } $x = 1; } ////////////////////////////// USER MENU /////////////////////////// $this->view->is_loged = JO_Session::get('user[user_id]'); if ($this->view->is_loged) { $model_images = new Helper_Images(); $avatar = Helper_Uploadimages::avatar(JO_Session::get('user'), '_A'); $this->view->self_avatar = $avatar['image']; $this->view->self_profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $this->view->is_loged); $this->view->mails = WM_Router::create($request->getBaseUrl() . '?controller=users&action=mails'); $this->view->self_firstname = JO_Session::get('user[firstname]'); $this->view->logout = WM_Router::create($request->getBaseUrl() . '?controller=users&action=logout'); $this->view->invites = WM_Router::create($request->getBaseUrl() . '?controller=invites'); $this->view->invites_fb = WM_Router::create($request->getBaseUrl() . '?controller=invites&action=facebook'); $this->view->user_pins = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $this->view->is_loged); $this->view->user_pins_likes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $this->view->is_loged . '&filter=likes'); $this->view->settings = WM_Router::create($request->getBaseUrl() . '?controller=settings'); } $this->view->login = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'); $this->view->landing = WM_Router::create($request->getBaseUrl() . '?controller=landing'); $this->view->site_name = JO_Registry::get('site_name'); $this->view->registration = WM_Router::create($request->getBaseUrl() . '?controller=users&action=register'); $category_id = null; if ($request->getRequest('category_id')) { $category_id = $request->getRequest('category_id'); ////////////////////////////// GIFTS /////////////////////////// $this->view->gifts = WM_Router::create($request->getBaseUrl() . '?controller=gifts&category_id=' . $category_id); $this->view->gifts1 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=1&price_to=20&category_id=' . $category_id); $this->view->gifts2 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=20&price_to=50&category_id=' . $category_id); $this->view->gifts3 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=50&price_to=100&category_id=' . $category_id); $this->view->gifts4 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=100&price_to=200&category_id=' . $category_id); $this->view->gifts5 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=200&price_to=500&category_id=' . $category_id); $this->view->gifts6 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=500&category_id=' . $category_id); //////////// Video //////////// $this->view->video_url = WM_Router::create($request->getBaseUrl() . '?controller=videos&category_id=' . $category_id); /* //////////// Popular //////////// $this->view->popular_url = WM_Router::create( $request->getBaseUrl() . '?controller=popular&category_id='.$category_id ); */ //////////// Articles //////////// $this->view->article_url = WM_Router::create($request->getBaseUrl() . '?controller=articles&category_id=' . $category_id); //////////// Ranking //////////// $this->view->pinTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=1&category_id=' . $category_id); $this->view->pinTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=2&category_id=' . $category_id); $this->view->profileTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=3&category_id=' . $category_id); $this->view->profileTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=4&category_id=' . $category_id); } else { ////////////////////////////// GIFTS /////////////////////////// $this->view->gifts = WM_Router::create($request->getBaseUrl() . '?controller=gifts'); $this->view->gifts1 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=1&price_to=20'); $this->view->gifts2 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=20&price_to=50'); $this->view->gifts3 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=50&price_to=100'); $this->view->gifts4 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=100&price_to=200'); $this->view->gifts5 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=200&price_to=500'); $this->view->gifts6 = WM_Router::create($request->getBaseUrl() . '?controller=gifts&price_from=500'); //////////// Video //////////// $this->view->video_url = WM_Router::create($request->getBaseUrl() . '?controller=videos'); /* //////////// Popular //////////// $this->view->popular_url = WM_Router::create( $request->getBaseUrl() . '?controller=popular' ); */ //////////// Articles //////////// $this->view->article_url = WM_Router::create($request->getBaseUrl() . '?controller=articles'); //////////// Ranking //////////// $this->view->pinTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=1'); $this->view->pinTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=2'); $this->view->profileTop7_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=3'); $this->view->profileTop_url = WM_Router::create($request->getBaseUrl() . '?controller=toppins&index_id=4'); } //////////// Popular //////////// $this->view->popular_url = WM_Router::create($request->getBaseUrl() . '?controller=premiostt'); //////////// ALL PINS //////////// $this->view->all_url = WM_Router::create($request->getBaseUrl() . '?controller=all'); //////////// activate //////////// $this->view->activate_url = WM_Router::create($request->getBaseUrl() . '?controller=index&action=indexActivate'); //////////// Eventtos //////////// $this->view->events_url = WM_Router::create($request->getBaseUrl() . '?controller=events'); //////////// Volunttarios //////////// if ($this->view->is_loged) { $this->view->voluntarios_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=voluntarioMenuPopup&user_id=' . $this->view->is_loged); } else { $this->view->voluntarios_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=voluntarioMenuPopup'); } ////////////////////////////// SEARCH /////////////////////////// //$this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search'); if (in_array($request->getAction(), array('advanced', 'page', 'view'))) { $with_action = $request->getAction(); $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search&action=' . $request->getAction()); } elseif (in_array($request->getAction(), array('advanced', 'advanced'))) { $with_action = $request->getAction(); $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search&action=' . $request->getAction()); } else { $with_action = 0; $this->view->search_action = WM_Router::create($request->getBaseUrl() . '?controller=search'); } //$this->view->search_autocomplete = WM_Router::create($request->getBaseUrl() . '?controller=search&action=autocomplete'); if (strpos($this->view->search, '?') !== false) { $this->view->show_hidden = true; $this->view->with_action = $with_action; } //$this->view->keywords = $request->issetQuery('q') ? $request->getQuery('q') : $this->translate('Search...'); /* if(in_array($request->getAction(), array('amatteur'))) { $with_action = 0; $this->view->search_action_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search'); } elseif( in_array($request->getAction(), array('activate', 'services')) ) { $with_action = $request->getAction(); $this->view->search_action_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search&action='.$request->getAction()); } else { $with_action = 0; $this->view->search_action_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search'); } $this->view->search_autocomplete_advanced = WM_Router::create($request->getBaseUrl() . '?controller=search&action=autocomplete'); if(strpos($this->view->search_advanced, '?') !== false) { $this->view->show_hidden = true; $this->view->with_action = $with_action; } $this->view->keywords = $request->issetQuery('q') ? $request->getQuery('q') : $this->translate('Search...'); */ $this->view->search_url = WM_Router::create($request->getBaseUrl() . '?controller=search&action=advanced?id=amatteur'); ////////////////////////////// ADD PIN /////////////////////////// $this->view->addPin = WM_Router::create($request->getBaseUrl() . '?controller=addpin'); ////////////////////////////// MAILS /////////////////////////// $this->view->addMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=create'); $this->view->stateMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=state'); $this->view->viewMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=view'); ////////////////////////////// FULL URL /////////////////////////// $this->view->full_url_js = false; switch (true) { case 'index' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl()); break; case 'search' == $request->getController(): if (in_array($request->getAction(), array('index', 'page', 'view'))) { $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=search&q=' . $request->getRequest('q')); } else { $parametros = ""; $this->view->keywords = $request->issetQuery('location') ? $request->getQuery('location') : $this->translate('Search...'); /* if ($request->issetPost('firstname')) { $parametros .= "&firstname=". $request->getPost('firstname'); } if ($request->issetPost('words')) { $parametros .= "&words=". $request->getPost('words'); } if ($request->issetPost('location')) { $parametros .= "&location=". $request->getPost('location'); } if ($request->issetPost('sport_category_1')) { $parametros .= "&sport_category_1=". $request->getPost('sport_category_1'); } if ($request->issetPost('sport_category_2')) { $parametros .= "&sport_category_2=". $request->getPost('sport_category_2'); } if ($request->issetPost('sport_category_3')) { $parametros .= "&sport_category_3=". $request->getPost('sport_category_3'); } if ($request->issetPost('type_user')) { $parametros .= "&type_user="******"&gender=". $request->getRequest('gender'); } //location if ($request->issetPost('location')) { $parametros .= "&location=". $request->getPost('location'); } //sport category if ($request->issetPost('sport_category')) { $parametros .= "&sport_category=". $request->getPost('sport_category'); } //age if ($request->issetPost('age')) { $parametros .= "&age=". $request->getPost('age'); } //level if ($request->issetPost('level')) { $parametros .= "&level=". $request->getPost('level'); } //option1 if ($request->issetPost('option1')) { $parametros .= "&option1=". $request->getPost('option1'); } //option2 if ($request->issetPost('option2')) { $parametros .= "&option2=". $request->getPost('option2'); } //option3 if ($request->issetPost('option3')) { $parametros .= "&option3=". $request->getPost('option3'); } //option4 if ($request->issetPost('option4')) { $parametros .= "&option4=". $request->getPost('option4'); } //option5 if ($request->issetPost('option5')) { $parametros .= "&option5=". $request->getPost('option5'); } //option6 if ($request->issetPost('option6')) { $parametros .= "&option6=". $request->getPost('option6'); } //option7 if ($request->issetPost('option7')) { $parametros .= "&option7=". $request->getPost('option7'); } //option8 if ($request->issetPost('option8')) { $parametros .= "&option8=". $request->getPost('option8'); } //option9 if ($request->issetPost('option9')) { $parametros .= "&option9=". $request->getPost('option9'); } //option10 if ($request->issetPost('option10')) { $parametros .= "&option10=". $request->getPost('option10'); } //option11 if ($request->issetPost('option11')) { $parametros .= "&option11=". $request->getPost('option11'); } //option12 if ($request->issetPost('option12')) { $parametros .= "&option12=". $request->getPost('option12'); } //option13 if ($request->issetPost('option13')) { $parametros .= "&option13=". $request->getPost('option13'); } //option14 if ($request->issetPost('option14')) { $parametros .= "&option14=". $request->getPost('option14'); } //option15 if ($request->issetPost('option15')) { $parametros .= "&option15=". $request->getPost('option15'); } //option16 if ($request->issetPost('option16')) { $parametros .= "&option16=". $request->getPost('option16'); } //option17 if ($request->issetPost('option17')) { $parametros .= "&option17=". $request->getPost('option17'); } //option18 if ($request->issetPost('option18')) { $parametros .= "&option18=". $request->getPost('option18'); } * */ if ($request->issetRequest('zoom')) { $parametros .= "&zoom=" . $request->getRequest('zoom'); } if ($request->issetRequest('id')) { $parametros .= "&id=" . $request->getRequest('id'); } if ($request->issetRequest('firstname')) { $parametros .= "&firstname=" . $request->getRequest('firstname'); } if ($request->issetRequest('words')) { $parametros .= "&words=" . $request->getRequest('words'); } if ($request->issetRequest('location')) { $parametros .= "&location=" . $request->getRequest('location'); } if ($request->issetRequest('sport_category_1')) { $parametros .= "&sport_category_1=" . $request->getRequest('sport_category_1'); } if ($request->issetRequest('sport_category_2')) { $parametros .= "&sport_category_2=" . $request->getRequest('sport_category_2'); } if ($request->issetRequest('sport_category_3')) { $parametros .= "&sport_category_3=" . $request->getRequest('sport_category_3'); } if ($request->issetRequest('type_user')) { $parametros .= "&type_user="******"&gender=" . $request->getRequest('gender'); } //location if ($request->issetRequest('location')) { $parametros .= "&location=" . $request->getRequest('location'); } //sport category if ($request->issetRequest('sport_category')) { $parametros .= "&sport_category=" . $request->getRequest('sport_category'); } //age if ($request->issetRequest('age')) { $parametros .= "&age=" . $request->getRequest('age'); } //level if ($request->issetRequest('level')) { $parametros .= "&level=" . $request->getRequest('level'); } //option1 if ($request->issetRequest('option1')) { $parametros .= "&option1=" . $request->getRequest('option1'); } //option2 if ($request->issetRequest('option2')) { $parametros .= "&option2=" . $request->getRequest('option2'); } //option3 if ($request->issetRequest('option3')) { $parametros .= "&option3=" . $request->getRequest('option3'); } //option4 if ($request->issetRequest('option4')) { $parametros .= "&option4=" . $request->getRequest('option4'); } //option5 if ($request->issetRequest('option5')) { $parametros .= "&option5=" . $request->getRequest('option5'); } //option6 if ($request->issetRequest('option6')) { $parametros .= "&option6=" . $request->getRequest('option6'); } //option7 if ($request->issetRequest('option7')) { $parametros .= "&option7=" . $request->getRequest('option7'); } //option8 if ($request->issetRequest('option8')) { $parametros .= "&option8=" . $request->getRequest('option8'); } //option9 if ($request->issetRequest('option9')) { $parametros .= "&option9=" . $request->getRequest('option9'); } //option10 if ($request->issetRequest('option10')) { $parametros .= "&option10=" . $request->getRequest('option10'); } //option11 if ($request->issetRequest('option11')) { $parametros .= "&option11=" . $request->getRequest('option11'); } //option12 if ($request->issetRequest('option12')) { $parametros .= "&option12=" . $request->getRequest('option12'); } //option13 if ($request->issetRequest('option13')) { $parametros .= "&option13=" . $request->getRequest('option13'); } //option14 if ($request->issetRequest('option14')) { $parametros .= "&option14=" . $request->getRequest('option14'); } //option15 if ($request->issetRequest('option15')) { $parametros .= "&option15=" . $request->getRequest('option15'); } //option16 if ($request->issetRequest('option16')) { $parametros .= "&option16=" . $request->getRequest('option16'); } //option17 if ($request->issetRequest('option17')) { $parametros .= "&option17=" . $request->getRequest('option17'); } //option18 if ($request->issetRequest('option18')) { $parametros .= "&option18=" . $request->getRequest('option18'); } $parametros .= "&kk=kk"; $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=search&action=' . $request->getAction() . '&q=' . $request->getRequest('q') . '&id=' . $request->getRequest('id') . $parametros); } break; case 'all' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=all'); break; case 'videos' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=videos'); break; case 'popular' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=popular'); break; case 'category' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=category&category_id=' . $request->getRequest('category_id')); break; case 'source' == $request->getController(): $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=source&source_id=' . $request->getRequest('source_id')); break; case 'boards' == $request->getController() && in_array($request->getAction(), array('index', 'page')): $url = ''; if ($request->getRequest('user_id')) { $url = '&user_id=' . $request->getRequest('user_id'); } $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view' . $url . '&board_id=' . $request->getRequest('board_id')); break; case 'gifts' == $request->getController(): $url = ''; if ($request->issetParam('price_from')) { $url .= (int) $request->getRequest('price_from'); } if ($request->issetParam('price_to')) { $url .= ':' . (int) $request->getRequest('price_to'); } $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=gifts' . ($url ? '&action=' . $url : '')); break; case 'users' == $request->getController(): if (in_array($request->getAction(), array('pins', 'followers', 'following', 'likers', 'liking', 'activity')) && $request->getRequest('user_id')) { $this->view->full_url_js = WM_Router::create($request->getBaseUrl() . '?controller=users&action=' . $request->getAction() . '&user_id=' . $request->getRequest('user_id') . ($request->getQuery('filter') ? '&filter=' . $request->getQuery('filter') : '')); } break; } if ($request->getRequest('user_id')) { $user_info = Model_Users::getUser($request->getRequest('user_id')); if ($user_info && $user_info['dont_search_index']) { $this->getLayout()->placeholder('inhead', '<meta name="robots" content="noindex"/>'); } } ////////////////////////////// ABOUT MENU /////////////////////////// $this->view->about_menu = array(); $has = false; if (is_array(JO_Registry::forceGet('about_menu'))) { foreach (JO_Registry::forceGet('about_menu') as $row => $page_id) { if ($row == 0) { $class = 'first'; } else { if (count(JO_Registry::forceGet('about_menu')) - 1 == $row) { $class = 'last'; } else { $class = ''; } } // $class = $row==0?' first':''; if ($page_id == -1) { $has = true; } else { $pinfo = Model_Pages::getPage($page_id); if ($pinfo && $pinfo['status']) { if ($has) { $class .= " group"; $has = false; } $this->view->about_menu[] = array('class' => trim($class), 'title' => $pinfo['title'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_id)); } } } } ////////////////////////////// NEW PASSWORD /////////////////////////// $this->view->show_new_password = false; if (JO_Session::get('user[user_id]') && JO_Session::get('user[email]') != JO_Session::get('user[new_email]')) { switch (true) { case 'index' == $request->getController(): case 'all' == $request->getController(): case 'category' == $request->getController(): case 'videos' == $request->getController(): case 'popular' == $request->getController(): case 'gifts' == $request->getController(): $this->view->show_new_password = true; break; } } ////////////////////////////// Board category /////////////////////////// if (is_array($board_info = JO_Registry::forceGet('board_category_change'))) { $this->view->board_category_change = array('title' => $board_info['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board_info['user_id'] . '&board_id=' . $board_info['board_id'])); } }
public function followAction() { $this->noViewRenderer(true); $request = $this->getRequest(); if ($request->isXmlHttpRequest()) { if ((int) JO_Session::get('user[user_id]')) { $user_id = $request->getRequest('user_id'); $user_info = new Model_Users_User($user_id); if ($user_info->count()) { $follow = new Model_Users_Follow($user_id); if ($user_info['following_user']) { $result = $follow->unfollowUser(); if ($result === true) { new Model_History_AddHistory($user_id, Model_History_Abstract::UNFOLLOW_USER); $this->view->ok = $this->translate('Follow'); $this->view->classs = 'add'; $this->view->boardauthorid = $user_id; } else { $this->view->error = $this->translate('There was a problem with the record. Please try again!'); } } else { $result = $follow->followUser(); if ($result === true) { new Model_History_AddHistory($user_id, Model_History_Abstract::FOLLOW_USER); $this->view->ok = $this->translate('Unfollow'); $this->view->classs = 'remove'; $this->view->boardauthorid = $user_id; if ($user_info['email_interval'] && $user_info['follows_email']) { $template = Model_Notification::getTemplate('follow_user'); if ($template) { $template_data = array('user_id' => $user_info['user_id'], 'user_firstname' => $user_info['firstname'], 'user_lastname' => $user_info['lastname'], 'user_fullname' => $user_info['fullname'], 'user_username' => $user_info['username'], 'author_url' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')), 'author_fullname' => JO_Session::get('user[fullname]'), 'mail_footer' => html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8')); if (!$template['title']) { $template['title'] = '${author_fullname} ' . $this->translate('now follow you'); } $title = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data); $body = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data); Model_Email::send($user_info['email'], Helper_Config::get('noreply_mail'), $title, $body); } } } else { $this->view->error = $this->translate('There was a problem with the record. Please try again!'); } } } else { $this->view->error = $this->translate('There was a problem with the record. Please try again!'); } } else { $this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=landing'); } } else { $this->forward('error', 'error404'); } echo $this->renderScript('json'); }
public function indexAction() { $request = $this->getRequest(); if (!JO_Session::get('user[user_id]')) { $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&popup=true&next=' . urlencode($request->getFullUrl()))); } $this->view->createBoard = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=create'); $boards = new Model_Boards_BoardsWithShared(array('filter_user_id' => JO_Session::get('user[user_id]'))); $this->view->boards = array(); if ($boards->count()) { foreach ($boards as $board) { $this->view->boards[] = array('board_id' => $board['board_board_id'], 'title' => $board['board_title']); } } ///////////////// Extension on create ////////////////// $this->view->form_extensions = array(); $extensions = Model_Extensions::getByMethod('pin_oncreateform'); if ($extensions) { $front = JO_Front::getInstance(); foreach ($extensions as $id => $ext) { $this->view->form_extensions[] = array('html' => $this->view->callChildren('modules_' . $ext . '_oncreateform'), 'view' => $this->view->callChildrenView('modules_' . $ext . '_oncreateform'), 'key' => $ext); } } $this->view->title = JO_Utf8::convertToUtf8($request->getQuery('title')); $this->view->url = JO_Utf8::convertToUtf8(urldecode($request->getQuery('url'))); $this->view->media = JO_Utf8::convertToUtf8($request->getQuery('media')); $this->view->is_video = JO_Utf8::convertToUtf8($request->getQuery('is_video')); $this->view->description = JO_Utf8::convertToUtf8($request->getQuery('description')); $this->view->charset = JO_Utf8::convertToUtf8($request->getQuery('charset')); if (is_array($request->getPost())) { foreach ($request->getPost() as $k => $v) { $this->view->{$k} = $v; } } if (!trim($this->view->description)) { $this->view->description = $this->view->title; } if (JO_Session::get('success_added')) { return $this->success(); } else { if ($request->isPost()) { $validate = new Helper_Validate(); $validate->_set_rules($request->getPost('description'), $this->translate('Description'), 'not_empty;min_length[1];max_length[500]'); $validate->_set_rules($request->getPost('board_id'), $this->translate('Board'), 'not_empty;'); if ($validate->_valid_form()) { $result = new Model_Pins_Create($request->getPost()); if ($result->count()) { $result = $result->data; ///add history new Model_History_AddHistory(JO_Session::get('user[user_id]'), Model_History_Abstract::ADDPIN, $result['pin_id']); //send notification $users = new Model_Users_GroupBoardUsers($request->getPost('board_id')); if ($users->count()) { $template = Model_Notification::getTemplate('group_board'); if ($template) { $pin_info = new Model_Pins_Pin($result['pin_id']); if ($pin_info->count()) { $mail_footer = html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8'); foreach ($users as $user) { if ($user['email_interval'] == 1 && $user['groups_pin_email']) { $template_data = array('user_id' => $user['user_id'], 'user_firstname' => $user['firstname'], 'user_lastname' => $user['lastname'], 'user_fullname' => $user['fullname'], 'user_username' => $user['username'], 'author_url' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $pin_info['user_user_id']), 'author_fullname' => $pin_info['user_fullname'], 'board_url' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $pin_info['user_user_id'] . '&board_id=' . $pin_info['board_board_id']), 'board_name' => $pin_info['board_title'], 'pin_url' => WM_Router::pinAction($result['pin_id']), 'mail_footer' => $mail_footer); if (!$template['title']) { $template['title'] = '${author_fullname} ' . $this->translate('added new pin to a group board'); } $title = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data); $body = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data); Model_Email::send($user['email'], Helper_Config::get('noreply_mail'), $title, $body); } } } } } JO_Session::set('success_added', $result['pin_id']); $this->redirect($request->getBaseUrl() . '?controller=bookmarklet'); } else { if ($result->error) { $this->view->error = $result->error; } else { $this->view->error = $this->translate('There was a problem with the record. Please try again!'); } } } else { $this->view->error = $validate->_get_error_messages(); } } } }