Exemplo n.º 1
0
 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;
     }
 }
Exemplo n.º 2
0
 function setNTSettings($post, $options)
 {
     $code = 'RD';
     $lcode = 'rd';
     foreach ($post as $ii => $pval) {
         if (!empty($pval['uName']) && !empty($pval['uPass'])) {
             if (!isset($options[$ii])) {
                 $options[$ii] = array();
             }
             if (isset($pval['uName'])) {
                 $options[$ii]['rdUName'] = trim($pval['uName']);
             }
             if (isset($pval['nName'])) {
                 $options[$ii]['nName'] = trim($pval['nName']);
             }
             if (isset($pval['uPass'])) {
                 $options[$ii]['rdPass'] = '******' . nsx_doEncode($pval['uPass']);
             } else {
                 $options[$ii]['rdPass'] = '';
             }
             if (empty($options[$ii]['rdSubRedditsList'])) {
                 $pass = substr($options[$ii]['rdPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options[$ii]['rdPass'], 5)) : $options[$ii]['rdPass'];
                 $loginInfo = doConnectToRD($options[$ii]['rdUName'], $pass);
                 if (is_array($loginInfo)) {
                     $options[$ii]['rdSubRedditsList'] = doGetSubredditsFromRD();
                 }
             }
             if (isset($pval['rdSubReddit'])) {
                 $options[$ii]['rdSubReddit'] = trim($pval['rdSubReddit']);
             }
             if (isset($pval['catSel'])) {
                 $options[$ii]['catSel'] = trim($pval['catSel']);
             } else {
                 $options[$ii]['catSel'] = 0;
             }
             if ($options[$ii]['catSel'] == '1' && trim($pval['catSelEd']) != '') {
                 $options[$ii]['catSelEd'] = trim($pval['catSelEd']);
             } else {
                 $options[$ii]['catSelEd'] = '';
             }
             if (isset($pval['postType'])) {
                 $options[$ii]['postType'] = $pval['postType'];
             }
             if (isset($pval['rdTitleFormat'])) {
                 $options[$ii]['rdTitleFormat'] = trim($pval['rdTitleFormat']);
             }
             if (isset($pval['rdTextFormat'])) {
                 $options[$ii]['rdTextFormat'] = trim($pval['rdTextFormat']);
             }
             if (isset($pval['apDoRD'])) {
                 $options[$ii]['doRD'] = $pval['apDoRD'];
             } else {
                 $options[$ii]['doRD'] = 0;
             }
             $options[$ii] = nxs_adjRpst($options[$ii], $pval);
             if (isset($pval['delayDays'])) {
                 $options[$ii]['nDays'] = trim($pval['delayDays']);
             }
             if (isset($pval['delayHrs'])) {
                 $options[$ii]['nHrs'] = trim($pval['delayHrs']);
             }
             if (isset($pval['delayMin'])) {
                 $options[$ii]['nMin'] = trim($pval['delayMin']);
             }
             if (isset($pval['qTLng'])) {
                 $options[$ii]['qTLng'] = trim($pval['qTLng']);
             }
         } elseif (count($pval) == 1) {
             if (isset($pval['apDo' . $code])) {
                 $options[$ii]['do' . $code] = $pval['apDo' . $code];
             } else {
                 $options[$ii]['do' . $code] = 0;
             }
         }
     }
     return $options;
 }