public function indexAction()
 {
     $this->noLayout(true);
     $settings = Model_Extensions::getSettingsPairs('facebook');
     if (isset($settings['facebook_module_status_enable']) && $settings['facebook_module_status_enable']) {
         if (isset($settings['facebook_get_user_avatar']) && $settings['facebook_get_user_avatar']) {
             $request = $this->getRequest();
             $facebook = new Helper_Modules_Facebook();
             if ($facebook->checkValidAppId()) {
                 $connectObject = new Model_Facebook_Login();
                 $user_info = $connectObject->getDataByUserId(JO_Session::get('user[user_id]'));
                 $this->view->facebook_connect = false;
                 if ($user_info) {
                     $this->view->facebook_connect = true;
                 }
                 $this->view->facebook_connect_avatar = WM_Router::create($request->getBaseUrl() . '?controller=modules_facebook_useravatar&action=get_avatar');
             } else {
                 $this->noViewRenderer(true);
             }
         } else {
             $this->noViewRenderer(true);
         }
     } else {
         $this->noViewRenderer(true);
     }
 }
示例#2
0
 public function indexAction()
 {
     $settings = Model_Extensions::getSettingsPairs('facebook');
     $this->noLayout(true);
     if (isset($settings['facebook_module_status_enable']) && $settings['facebook_module_status_enable']) {
         if (isset($settings['facebook_login_with_facebook']) && $settings['facebook_login_with_facebook']) {
             $request = $this->getRequest();
             $facebook = new Helper_Modules_Facebook();
             if ($facebook->checkValidAppId()) {
                 $connectObject = new Model_Facebook_Login();
                 $user_info = $connectObject->getDataByUserId(JO_Session::get('user[user_id]'));
                 $this->view->facebook_connect = false;
                 $this->view->facebook_timeline = false;
                 if ($user_info) {
                     $this->view->facebook_connect = true;
                     $this->view->facebook_timeline = $user_info['timeline'];
                 }
                 $this->view->site_name = Helper_Config::get('site_name');
                 $this->view->facebook_connect_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_facebook_connect&action=connect');
                 $this->view->facebook_timeline_connect_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_facebook_connect&action=timeline');
                 $this->view->facebook_invites_fb = WM_Router::create($request->getBaseUrl() . '?controller=modules_facebook_invates');
                 $this->view->add_pin_to_facebook_timeline = isset($settings['facebook_add_pin_to_facebook_timeline']) && $settings['facebook_add_pin_to_facebook_timeline'];
                 /////////
             } else {
                 $this->noViewRenderer(true);
             }
         } else {
             $this->noViewRenderer(true);
         }
     } else {
         $this->noViewRenderer(true);
     }
 }
 public function indexAction()
 {
     if (!WM_Users::allow('edit', 'modules')) {
         JO_Session::set('error_permision', $this->translate('You do not have permission to this action'));
         $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_oauth/');
     }
     $request = $this->getRequest();
     if (JO_Session::get('successfu_edite')) {
         $this->view->successfu_edite = true;
         JO_Session::clear('successfu_edite');
     }
     if ($request->isPost()) {
         //validate app id
         $validate = new Helper_Modules_Facebook($request->getPost('facebook[facebook_oauth_key]'), $request->getPost('facebook[facebook_oauth_secret]'));
         if ($validate->checkValidAppId()) {
             Model_Settings::updateAll(array('facebook' => $request->getPost('facebook')));
             JO_Session::set('successfu_edite', true);
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/modules_oauth_facebook/');
         } else {
             $this->view->error = $this->translate('Invalid appID');
         }
     }
     $this->view->modules_url = $this->getRequest()->getModule() . '/modules';
     $this->view->modules_oauth_url = $this->getRequest()->getModule() . '/modules_oauth';
     $methods = $this->getClassResources();
     $this->view->methods = array();
     $ignore = array('index', 'error404', 'install', 'uninstall');
     foreach ($methods as $type => $mods) {
         foreach ($mods as $key => $value) {
             if (in_array($value, $ignore)) {
                 continue;
             }
             if ($type == 'actions') {
                 $this->view->methods[$type][] = array('title' => $this->translate($value), 'edit' => $this->getRequest()->getModule() . '/modules_oauth_facebook/' . strtolower($value));
             } elseif ($type == 'radio') {
                 $this->view->methods[$type][] = array('title' => $this->translate(str_replace('_', ' ', $value)), 'key' => 'facebook_' . strtolower($value));
             }
         }
     }
     $store_config = Model_Settings::getSettingsPairs(array('filter_group' => 'facebook'));
     foreach ($store_config as $key => $data) {
         if ($request->issetPost('facebook[' . $key . ']')) {
             $this->view->{$key} = $request->getPost('facebook[' . $key . ']');
         } else {
             $this->view->{$key} = $data;
         }
     }
 }
 public function indexAction($next = null)
 {
     $this->noLayout(true);
     JO_Session::clear('facebook_user_data_register');
     $settings = Model_Extensions::getSettingsPairs('facebook');
     if (isset($settings['facebook_module_status_enable']) && $settings['facebook_module_status_enable']) {
         if (Helper_Config::get('enable_free_registration') && isset($settings['facebook_register_with_facebook']) && $settings['facebook_register_with_facebook']) {
             $request = $this->getRequest();
             $facebook = new Helper_Modules_Facebook();
             if ($facebook->checkValidAppId()) {
                 $this->view->login_url = $facebook->getLoginUrl($next, 'modules_facebook_register');
             } else {
                 $this->noViewRenderer(true);
             }
         } else {
             $this->noViewRenderer(true);
         }
     } else {
         $this->noViewRenderer(true);
     }
 }