Skip to content
This repository was archived by the owner on Sep 5, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions classes/facebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,20 @@ protected function makeRequest($url, $params, $ch=null) {
}

curl_setopt_array($ch, $opts);

$ini = eZINI::instance();
$proxy = $ini->variable( 'ProxySettings', 'ProxyServer' );
if ( $proxy )
{
curl_setopt( $ch, CURLOPT_PROXY, $proxy );
$userName = $ini->variable( 'ProxySettings', 'User' );
$password = $ini->variable( 'ProxySettings', 'Password' );
if ( $userName )
{
curl_setopt( $ch, CURLOPT_PROXYUSERPWD, "$userName:$password" );
}
}

$result = curl_exec($ch);
if ($result === false) {
$e = new FacebookApiException(array(
Expand Down
14 changes: 14 additions & 0 deletions classes/ngpush_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public static function save_token( $SettingsBlock, $Token, $TokenSuffix = false
$fileHandler->storeContents( $Token );

$storedToken = $fileHandler->fetchContents();

if ( $storedToken !== false )
return true;

Expand Down Expand Up @@ -73,6 +74,19 @@ public function curl_redir_exec($ch, $content = '')
$new_url = $url['scheme'] . '://' . $url['host'] . $url['path'] . ($url['query'] ? '?' . $url['query'] : '');
curl_setopt($ch, CURLOPT_URL, $new_url);

$ini = eZINI::instance();
$proxy = $ini->variable( 'ProxySettings', 'ProxyServer' );
if ( $proxy )
{
curl_setopt( $ch, CURLOPT_PROXY, $proxy );
$userName = $ini->variable( 'ProxySettings', 'User' );
$password = $ini->variable( 'ProxySettings', 'Password' );
if ( $userName )
{
curl_setopt( $ch, CURLOPT_PROXYUSERPWD, "$userName:$password" );
}
}

return self::curl_redir_exec($ch, $data2);
}
else
Expand Down
14 changes: 14 additions & 0 deletions classes/ngpush_facebook_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ public function getPageToken($Token, $Id)
$ch = curl_init($url);
curl_setopt_array($ch, $options);


$ini = eZINI::instance();
$proxy = $ini->variable( 'ProxySettings', 'ProxyServer' );
if ( $proxy )
{
curl_setopt( $ch, CURLOPT_PROXY, $proxy );
$userName = $ini->variable( 'ProxySettings', 'User' );
$password = $ini->variable( 'ProxySettings', 'Password' );
if ( $userName )
{
curl_setopt( $ch, CURLOPT_PROXYUSERPWD, "$userName:$password" );
}
}

$content = curl_exec($ch);
$errno = curl_errno($ch);
$errmsg = curl_error($ch);
Expand Down
13 changes: 13 additions & 0 deletions classes/ngpush_facebook_feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ public function push($Account, $Arguments)
$ch = curl_init($url);
curl_setopt_array($ch, $options);

$ini = eZINI::instance();
$proxy = $ini->variable( 'ProxySettings', 'ProxyServer' );
if ( $proxy )
{
curl_setopt( $ch, CURLOPT_PROXY, $proxy );
$userName = $ini->variable( 'ProxySettings', 'User' );
$password = $ini->variable( 'ProxySettings', 'Password' );
if ( $userName )
{
curl_setopt( $ch, CURLOPT_PROXYUSERPWD, "$userName:$password" );
}
}

$content = curl_exec($ch);
$errno = curl_errno($ch);
$errmsg = curl_error($ch);
Expand Down
13 changes: 13 additions & 0 deletions classes/twitteroauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,19 @@ function http($url, $method, $postfields = NULL) {
curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
curl_setopt($ci, CURLOPT_HEADER, FALSE);

$ini = eZINI::instance();
$proxy = $ini->variable( 'ProxySettings', 'ProxyServer' );
if ( $proxy )
{
curl_setopt( $ci, CURLOPT_PROXY, $proxy );
$userName = $ini->variable( 'ProxySettings', 'User' );
$password = $ini->variable( 'ProxySettings', 'Password' );
if ( $userName )
{
curl_setopt( $ci, CURLOPT_PROXYUSERPWD, "$userName:$password" );
}
}

switch ($method) {
case 'POST':
curl_setopt($ci, CURLOPT_POST, TRUE);
Expand Down
41 changes: 40 additions & 1 deletion modules/push/save_access_token.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
$saveStatus = false;

$NGPushIni = eZINI::instance( 'ngpush.ini' );
$ini = eZINI::instance();
$proxy_server = $ini->variable( 'ProxySettings', 'ProxyServer' );

switch ($Params['Case']) {
case 'twitter':
Expand Down Expand Up @@ -44,7 +46,44 @@
. "client_id=" . $NGPushIni->variable( $settingsBlock, 'AppId') . "&redirect_uri=" . urlencode($redirectUrl)
. "&client_secret=" . $NGPushIni->variable( $settingsBlock, 'AppSecret') . "&code=" . $accessToken[1];

$response = file_get_contents($token_url);

//proxy
if($proxy_server!=null){

//if exists remove http or https from url
$proxy_server = preg_replace('#^https?://#', '', $proxy_server);

$userName = $ini->variable( 'ProxySettings', 'User' );
$password = $ini->variable( 'ProxySettings', 'Password' );

//econde username and password
$auth = base64_encode("$userName:$password");

//both http and https
$opts = array(
'http' => array (
'method'=>'GET',
'proxy'=>$proxy_server,
'request_fulluri' => true,
'header'=> "Proxy-Authorization: Basic $auth"

),
'https' => array (
'method'=>'GET',
'proxy'=>$proxy_server,
'request_fulluri' => true,
'header'=> "Proxy-Authorization: Basic $auth"
)
);

$ctx = stream_context_create($opts);
$response = file_get_contents($token_url,false,$ctx);

//no proxy
}else{
$response = file_get_contents($token_url);
}

$params = null;
parse_str($response, $params);

Expand Down