public function getBoardsAction()
 {
     $email = Mage::getStoreConfig('besociable/pinterest/email');
     $password = Mage::getStoreConfig('besociable/pinterest/password');
     if ($email != '' && $password != '') {
         $loginError = doConnectToPinterest($email, $password);
         if (!$loginError) {
             $re = doGetBoardsFromPinterest();
             if (count($re)) {
                 Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("sociable")->__('Here is the list of your Pinterest board(s): '));
                 $i = 1;
                 foreach ($re as $item) {
                     $result = $i . '. ' . $item['label'] . ' (' . $item['value'] . ')<a href="#" onClick="$(\'besociable_pinterest_boardid\').value=\'' . $item['value'] . '\'"> ' . Mage::helper("sociable")->__('Use this board') . ' </a>';
                     Mage::getSingleton("adminhtml/session")->addSuccess($result);
                     $i++;
                 }
             } else {
                 Mage::getSingleton("adminhtml/session")->addError(Mage::helper("sociable")->__('No board found! Please create a board.'));
             }
         } else {
             Mage::getSingleton("adminhtml/session")->addError(Mage::helper("sociable")->__('Login error!'));
         }
         //echo Mage::helper("sociable")->__('<a href="%s">Click here</a> to go back.', $this->getUrl('adminhtml/system_config/edit', array('section'=>'besociable')));
     } else {
         Mage::getSingleton("adminhtml/session")->addError(Mage::helper("sociable")->__('Please check your data!'));
     }
     $this->_redirect("*/system_config/edit/section/besociable/");
 }
 function nxs_getBrdsOrCats_ajax()
 {
     global $nxs_gCookiesArr;
     check_ajax_referer('nxsSsPageWPN');
     global $plgn_NS_SNAutoPoster;
     if (!isset($plgn_NS_SNAutoPoster)) {
         return;
     }
     $options = $plgn_NS_SNAutoPoster->nxs_options;
     if (get_magic_quotes_gpc() || $_POST['nxs_mqTest'] == "\\'") {
         $_POST['u'] = stripslashes($_POST['u']);
         $_POST['p'] = stripslashes($_POST['p']);
     }
     $_POST['p'] = trim($_POST['p']);
     $u = trim($_POST['u']);
     if ($_POST['ty'] == 'pn') {
         $loginError = doConnectToPinterest($_POST['u'], substr($_POST['p'], 0, 5) == 'g9c1a' ? nsx_doDecode(substr($_POST['p'], 5)) : $_POST['p']);
         if ($loginError !== false) {
             echo $loginError;
             return "BAD USER/PASS";
         }
         $gPNBoards = doGetBoardsFromPinterest();
         $options['pn'][$_POST['ii']]['pnBoardsList'] = base64_encode($gPNBoards);
         $options['pn'][$_POST['ii']]['pnSvC'] = serialize($nxs_gCookiesArr);
         if (is_array($options)) {
             update_option('NS_SNAutoPoster', $options);
         }
         echo $gPNBoards;
         die;
     }
     if ($_POST['ty'] == 'rd') {
         $loginError = doConnectToRD($_POST['u'], substr($_POST['p'], 0, 5) == 'g9c1a' ? nsx_doDecode(substr($_POST['p'], 5)) : $_POST['p']);
         if (!is_array($loginError)) {
             echo $loginError;
             return "BAD USER/PASS";
         }
         $gBoards = doGetSubredditsFromRD();
         $options['rd'][$_POST['ii']]['rdSubRedditsList'] = base64_encode($gBoards);
         if (is_array($options)) {
             update_option('NS_SNAutoPoster', $options);
         }
         echo $gBoards;
         die;
     }
 }