function doPostToNT($options, $message) { $badOut = array('pgID' => '', 'isPosted' => 0, 'pDate' => date('Y-m-d H:i:s'), 'Error' => ''); //## Check settings if (!is_array($options)) { $badOut['Error'] = 'No Options'; return $badOut; } if (!isset($options['ytUName']) || trim($options['ytPass']) == '') { $badOut['Error'] = 'Not Configured'; return $badOut; } $email = $options['ytUName']; $pass = substr($options['ytPass'], 0, 5) == 'n5g9a' ? nsx_doDecode(substr($options['ytPass'], 5)) : $options['ytPass']; //## Format if (!empty($message['pText'])) { $msg = $message['pText']; } else { $msg = nxs_doFormatMsg($options['ytMsgFormat'], $message); } $nt = new nxsAPI_GP(); if (!empty($options['ck'])) { $nt->ck = $options['ck']; } $nt->debug = false; $loginError = $nt->connect($email, $pass, 'YT'); if (!$loginError) { $result = $nt->postYT($msg, $options['ytPageID'], $message['videoURL'], $options['ytGPPageID']); } else { $badOut['Error'] = "Login/Connection Error: " . print_r($loginError, true); return $badOut; } if (is_array($result) && $result['isPosted'] == '1') { nxs_save_glbNtwrks('yt', $options['ii'], $nt->ck, 'ck'); } return $result; }
if (!function_exists("doPostToYouTube")) {function doPostToYouTube($msg, $ytUrl, $vURL = '', $ytGPPageID=''){ global $nxs_gCookiesArr; $nt = new nxsAPI_GP(); $nt->debug = false; if (!empty($nxs_gCookiesArr)) $nt->ck = $nxs_gCookiesArr; $ret = $nt->postYT($msg, $ytUrl, $vURL, $ytGPPageID); if (is_array($ret) && !empty($ret['isPosted'])) return array("code"=>"OK", "post_id"=>$ret['postID'], "post_url"=>$ret['postURL']); else return $ret; }}