예제 #1
0
 public function change_membershipAction()
 {
     $this->setInvokeArg('noViewRenderer', true);
     Model_Membership::change_membership($this->getRequest()->getPost('id'));
 }
예제 #2
0
 public function membershipFormAction()
 {
     $this->view->order_info = Model_Membership::get(JO_Session::get('membership_id'));
     if (!$this->view->order_info) {
         return;
     }
     $this->view->currency = WM_Currency::getCurrency();
     if (JO_Registry::forceGet('paypal_sandbox_mode')) {
         $this->view->url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     } else {
         $this->view->url = 'https://www.paypal.com/cgi-bin/webscr';
     }
     $this->view->paypal_email = JO_Registry::forceGet('paypal_email');
     $this->view->return = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=success_membership');
     $this->view->notify_url = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=payments_paypal&action=callback_membership');
     $this->view->cancel_return = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=users&action=membership');
     $this->view->email = JO_Session::get('email');
     $this->view->first_name = JO_Session::get('firstname');
     $this->view->last_name = JO_Session::get('lastname');
 }
예제 #3
0
 public function success_membershipAction()
 {
     $this->{$this}->noViewRenderer(true);
     $request = $this->getRequest();
     $info = Model_Membership::get(JO_Session::get('membership_id'));
     if ($info && $info['paid'] == 'true') {
         Model_Membership::membershipIsPay($info['id']);
         JO_Session::set('msg_success', $this->translate('You have successfully made a payment!'));
     } else {
         JO_Session::clear('membership_id');
         JO_Session::set('msg_error', $this->translate('There was error with your payment!'));
     }
     $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=membership'));
 }
예제 #4
0
 public function pay_membershipAction()
 {
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     if (!JO_Session::get('user_id')) {
         JO_Session::set('msg_error', $this->translate('You must be logged to change your profile'));
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     if ($request->issetPost('item_id')) {
         if ($request->getPost('licence') == 'personal') {
             $item = Model_Items::get($request->getPost('item_id'));
             $downloads = Model_Membership::getByUser(JO_Session::get('user_id'));
             if (!$downloads) {
                 JO_Session::set('msg_error', $this->translate('Your membership download quota has been exhausted.'));
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=membership'));
             } else {
                 Model_Orders::buy($item, $item['price']);
                 Model_Membership::buy(JO_Session::get('user_id'));
                 JO_Session::set('msg_success', $this->translate('You have successfully bought this item.'));
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=downloads'));
             }
         } elseif ($request->getPost('licence') == 'extended') {
             JO_Session::set('msg_error', $this->translate('Membership customers can only purchase items with personal license.'));
         }
     }
     $this->redirect($request->getServer('HTTP_REFERER'));
 }
예제 #5
0
 private function getForm()
 {
     $request = $this->getRequest();
     $id = $request->getQuery('id');
     if ($id) {
         $info = Model_Membership::get($id);
     }
     $this->view->languages = array();
     $this->view->def_lang = false;
     $languages = Model_Language::getLanguages();
     if ($languages) {
         $this->view->languages = $languages;
         foreach ($languages as $language) {
             if ($language['language_id'] == JO_Registry::get('default_config_language_id')) {
                 $this->view->def_lang = $language['code'];
             }
         }
     }
     if ($request->getPost('status')) {
         $this->view->status = $request->getPost('status');
     } elseif (isset($info)) {
         $this->view->status = $info[0]['status'];
     } else {
         $this->view->status = 'false';
     }
     if ($request->getPost('price')) {
         $this->view->price = $request->getPost('price');
     } elseif (isset($info)) {
         $this->view->price = $info[0]['price'];
     } else {
         $this->view->price = 0;
     }
     if ($request->getPost('max_items_cnt')) {
         $this->view->max_items_cnt = $request->getPost('max_items_cnt');
     } elseif (isset($info)) {
         $this->view->max_items_cnt = $info[0]['max_items_cnt'];
     } else {
         $this->view->max_items_cnt = 0;
     }
     if ($request->getPost('order_index')) {
         $this->view->order_index = $request->getPost('order_index');
     } elseif (isset($info)) {
         $this->view->order_index = $info[0]['order_index'];
     } else {
         $this->view->order_index = Model_Membership::getMaxPosition();
     }
     if ($request->getPost('description')) {
         $this->view->description = $request->getPost('description');
     } elseif (isset($info)) {
         $this->view->description = array();
         foreach ($info as $i) {
             $this->view->description[$i['lid']] = $i['description'];
         }
     } else {
         $this->view->description = '';
     }
 }
예제 #6
0
파일: Author.php 프로젝트: noikiy/PD
 public static function authorHeader($user)
 {
     $view = JO_View::getInstance();
     $model_images = new Helper_Images();
     $request = JO_Request::getInstance();
     $view->my_profile = JO_Session::get('username') == $user['username'] ? true : false;
     $cnts = Model_Items::getPortfolioCounts($user['user_id']);
     $view->portfolio_link = WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'username']));
     $action = $request->getAction();
     $controller = $request->getController();
     $list_type = $request->getParam('list_type');
     if (JO_Session::get('user_id')) {
         if ($view->my_profile) {
             if (in_array($action, array('dashboard', 'edit', 'earnings', 'statement', 'withdrawal', 'deposit', 'membership'))) {
                 $view->stats = array(array('name' => $view->translate('Dashboard'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=dashboard'), 'is_selected' => $action == 'dashboard' ? true : false), array('name' => $view->translate('Settings'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit'), 'is_selected' => $action == 'edit' ? true : false), array('name' => $view->translate('Earnings'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=earnings'), 'is_selected' => $action == 'earnings' ? true : false), array('name' => $view->translate('Statement'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=statement'), 'is_selected' => $action == 'statement' ? true : false), array('name' => $view->translate('Withdrawal'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=withdrawal'), 'is_selected' => $action == 'withdrawal' ? true : false), array('name' => $view->translate('Deposit'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=deposit'), 'is_selected' => $action == 'deposit' ? true : false));
                 $membership = Model_Membership::getAll();
                 if ($membership) {
                     $view->stats[] = array('name' => $view->translate('Membership'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=membership'), 'is_selected' => $action == 'membership' ? true : false);
                 }
                 $user['edit_link'] = array('name' => $view->translate('Portfolio'), 'href' => $view->portfolio_link);
             } else {
                 $view->portfolio = true;
                 $view->stats = array(array('name' => $cnts[4]['total'] . ' ' . $view->translate('Items'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'&', '-', $user['username'])), 'is_selected' => $action == 'index' && $controller == 'users' ? true : false), array('name' => $cnts[0]['total'] . ' ' . $view->translate('Collections'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=collections&username='******'&', '-', $user['username'])), 'is_selected' => in_array($action, array('collections', 'view_collection')) ? true : false), array('name' => $cnts[1]['total'] . ' ' . $view->translate('Downloads'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=downloads&username='******'&', '-', $user['username'])), 'is_selected' => $action == 'downloads' ? true : false), array('name' => $cnts[2]['total'] . ' ' . $view->translate('Following'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=following&username='******'&', '-', $user['username'])), 'is_selected' => $action == 'following' && $list_type != 'followers' ? true : false), array('name' => $cnts[3]['total'] . ' ' . $view->translate('Followers'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=followers&username='******'&', '-', $user['username'])), 'is_selected' => $list_type == 'followers' ? true : false));
                 $user['edit_link'] = array('name' => $view->translate('My account'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=dashboard'));
             }
         } else {
             $following = JO_Session::get('following');
             if ($following) {
                 $is_followed = JO_Array::multi_array_search($following, 'username', $user['username']);
             }
             if (!empty($is_followed)) {
                 $user['edit_link'] = array('name' => $view->translate('Unfollow'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=unfollow&username='******'&', '-', $user['username'])));
             } else {
                 $user['edit_link'] = array('name' => $view->translate('Follow'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&username='******'&', '-', $user['username'])));
             }
         }
     }
     if (!isset($view->stats)) {
         $view->portfolio = true;
         $view->stats = array(array('name' => $cnts[4]['total'] . ' ' . $view->translate('Items'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'&', '-', $user['username'])), 'is_selected' => $action == 'index' && $controller == 'users' ? true : false), array('name' => $cnts[0]['total'] . ' ' . $view->translate('Collections'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=collections&username='******'&', '-', $user['username'])), 'is_selected' => in_array($action, array('collections', 'view_collection')) ? true : false), array('name' => $cnts[2]['total'] . ' ' . $view->translate('Following'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=following&username='******'&', '-', $user['username'])), 'is_selected' => $action == 'following' && $list_type != 'followers' ? true : false), array('name' => $cnts[3]['total'] . ' ' . $view->translate('Followers'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=followers&username='******'&', '-', $user['username'])), 'is_selected' => $list_type == 'followers' ? true : false));
     }
     if ($user['country_id']) {
         $country = Model_Countries::get($user['country_id']);
         $user['country_name'] = (!empty($user['live_city']) ? $user['live_city'] . ', ' : '') . $country['name'];
     }
     $user['register_datetime'] = JO_Date::getInstance($user['register_datetime'], 'MM yy')->getDate();
     $time_parts = explode(' ', $user['register_datetime']);
     if (mb_strlen($time_parts[0], 'UTF-8') > 5) {
         $user['register_datetime'] = mb_substr($time_parts[0], 0, 3, 'UTF-8') . '. ' . $time_parts[1];
     }
     if ($user['user_site']) {
         $pos = mb_stripos($user['user_site'], 'http://', 'UTF-8');
         if ($pos === 0) {
             $user['user_site'] = str_replace('http://', '', mb_strtolower($user['user_site'], 'UTF-8'));
         }
         if (strlen($user['user_site']) > 22) {
             $pos = mb_stripos($user['user_site'], '/', 15, 'UTF-8');
             if ($pos !== false) {
                 $user['user_site'] = str_replace('/', '/​', $user['user_site']);
             }
         }
     }
     $view->badges = self::userBadges($user);
     if ($user['social']) {
         $user['social'] = unserialize($user['social']);
     }
     if ($user['avatar']) {
         $user['avatar'] = $model_images->resize($user['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true);
     } else {
         $user['avatar'] = 'data/themes/images/noavatar.png';
     }
     $view->user = $user;
     return $view->renderByModule('single_user/author_header', 'users', 'themes');
 }