adamjakab /
SuiteCRM
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | require_once("include/social/facebook/facebook_sdk/src/facebook.php"); |
||
| 3 | |||
| 4 | |||
| 5 | class facebook_helper{ |
||
| 6 | |||
| 7 | var $facebook; |
||
| 8 | |||
| 9 | function __construct() { |
||
| 10 | require_once("custom/modules/Connectors/connectors/sources/ext/rest/facebook/config.php"); |
||
| 11 | |||
| 12 | $fb_config = array( |
||
| 13 | 'appId' => $config['properties']['appid'], |
||
| 14 | 'secret' => $config['properties']['secret'] |
||
| 15 | ); |
||
| 16 | $this->facebook = new Facebook($fb_config); |
||
| 17 | } |
||
| 18 | function get_my_user(){ |
||
| 19 | try { |
||
| 20 | // Proceed knowing you have a logged in user who's authenticated. |
||
| 21 | return $this->facebook->api('/me'); |
||
| 22 | } catch (FacebookApiException $e) { |
||
| 23 | error_log($e); |
||
| 24 | $user = null; |
||
| 25 | } |
||
| 26 | } |
||
| 27 | function get_my_newsfeed(){ |
||
| 28 | return $this->facebook->api('me/home'); //get my news feed |
||
| 29 | } |
||
| 30 | function get_other_newsfeed($user, $limit = "100"){ |
||
| 31 | return $this->facebook->api('/' . $user . '/feed?limit=' . $limit); |
||
| 32 | } |
||
| 33 | function get_login_url($url){ |
||
| 34 | $params = array( |
||
| 35 | 'scope' => 'read_stream, publish_stream' |
||
| 36 | |||
| 37 | ); |
||
| 38 | |||
| 39 | |||
| 40 | return $this->facebook->getLoginUrl($params); |
||
| 41 | } |
||
| 42 | function get_logout_url(){ |
||
| 43 | return $this->facebook->getLogoutUrl(); |
||
| 44 | } |
||
| 45 | function get_facebook_user($username){ |
||
| 46 | return $this->facebook->api('/' . $username); |
||
| 47 | } |
||
| 48 | |||
| 49 | function process_feed($story){ |
||
| 50 | switch($story['type']){ |
||
| 51 | case "status": |
||
| 52 | return $this->status($story); |
||
| 53 | break; |
||
|
0 ignored issues
–
show
|
|||
| 54 | case "photo": |
||
| 55 | return $this->photo_status($story); |
||
| 56 | break; |
||
|
0 ignored issues
–
show
break is not strictly necessary here and could be removed.
The break statement is not necessary if it is preceded for example by a return statement: switch ($x) {
case 1:
return 'foo';
break; // This break is not necessary and can be left off.
}
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive. Loading history...
|
|||
| 57 | case "link": |
||
| 58 | return $this->link_type($story); |
||
| 59 | break; |
||
|
0 ignored issues
–
show
break is not strictly necessary here and could be removed.
The break statement is not necessary if it is preceded for example by a return statement: switch ($x) {
case 1:
return 'foo';
break; // This break is not necessary and can be left off.
}
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive. Loading history...
|
|||
| 60 | case "video": |
||
| 61 | return $this->video_type($story); |
||
| 62 | break; |
||
|
0 ignored issues
–
show
break is not strictly necessary here and could be removed.
The break statement is not necessary if it is preceded for example by a return statement: switch ($x) {
case 1:
return 'foo';
break; // This break is not necessary and can be left off.
}
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive. Loading history...
|
|||
| 63 | } |
||
| 64 | } |
||
| 65 | |||
| 66 | function photo_status($story){ |
||
| 67 | |||
| 68 | |||
| 69 | $string .= "<div style=' margin: 0 auto; background-color: #F7F7F7; height:160px; width:389px; ; border:1px solid #cccccc'>"; |
||
| 70 | $string .= '<div style="padding: 3px; width: 100%;">' .$story['from']['name'] . '</div>'; |
||
| 71 | $string .= '<img src=https://graph.facebook.com/' . $story['from']['id'] . '/picture>'; |
||
| 72 | $string .= '<img src=https://graph.facebook.com/' . $story['to']['id'] . '/picture>'; |
||
| 73 | $string .= '<p>' .$story['story'] .'</p>'; |
||
| 74 | $string .= '<p>' .$story['message'] .'</p>'; |
||
| 75 | $string .= "</div>"; |
||
| 76 | return $string; |
||
| 77 | } |
||
| 78 | |||
| 79 | function status($story){ |
||
| 80 | |||
| 81 | $to_name = $this->get_to($story); |
||
| 82 | |||
| 83 | $string .= "<div style=' margin: 0 auto; background-color: #F7F7F7; height:160px; width:389px; ; border:1px solid #cccccc'>"; |
||
| 84 | $string .= '<div style="padding: 3px; width: 100%;">' .$story['from']['name'] . '</div>'; |
||
| 85 | |||
| 86 | if($story['status_type'] == 'approved_friend'){ |
||
| 87 | $string .= '<img src=https://graph.facebook.com/' . $story['story_tags']['0']['0']['id']. '/picture>'; |
||
| 88 | $string .= '<img src=https://graph.facebook.com/' . $story['story_tags']['18']['0']['id']. '/picture>'; |
||
| 89 | }else{ |
||
| 90 | $string .= '<img src=https://graph.facebook.com/' . $story['from']['id'] . '/picture>'; |
||
| 91 | $string .= '<img src=https://graph.facebook.com/' . $story['to']['id'] . '/picture>'; |
||
| 92 | } |
||
| 93 | |||
| 94 | $string .= '<img src=https://graph.facebook.com/' . $story['story_tags']['0']['0']['id']. '/picture>'; |
||
| 95 | |||
| 96 | |||
| 97 | $string .= '<p>' .$story['story'] .'</p>'; |
||
| 98 | $string .= '<p>' .$story['message'] .'</p>'; |
||
| 99 | $string .= "</div>"; |
||
| 100 | |||
| 101 | return $string; |
||
| 102 | |||
| 103 | |||
| 104 | } |
||
| 105 | function link_type($story){ |
||
| 106 | $string .= "<div style='margin: 0 auto; background-color: #F7F7F7; height:160px; width:389px; ; border:1px solid #cccccc'>"; |
||
| 107 | $string .= '<div style="padding: 3px; width: 100%;">' . $story['message'] . '</div>'; |
||
| 108 | |||
| 109 | $string .= '<a style="padding: 5px; float:left;" href="' . $story['link'] . '"><img style=float:left; src="' . $story['picture'] . '"/></a>'; |
||
| 110 | $string .= '<a href="' . $story['link'] . '">' .$story['description'] .'</a>'; |
||
| 111 | $string .= '<p>' . $story['caption'] . '</p>'; |
||
| 112 | $string .= "</div>"; |
||
| 113 | return $string; |
||
| 114 | |||
| 115 | |||
| 116 | } |
||
| 117 | |||
| 118 | function video_type($story){ |
||
| 119 | |||
| 120 | $string = ''; |
||
| 121 | $string .= "<div style=' margin: 0 auto; background-color: #F7F7F7; height:160px; width:389px; ; border:1px solid #cccccc'>"; |
||
| 122 | $string .= '<div style="padding: 3px; width: 100%;">' . $story['from']['name'] .' Shared a video with '. $story['message'] . '</div>'; |
||
| 123 | |||
| 124 | $string .= '<a style="padding: 5px; float:left;" href="' . $story['link'] . '"><img style=float:left; src="' . $story['picture'] . '"/></a>'; |
||
| 125 | $string .= '<a href="' . $story['link'] . '">' .$story['description'] .'</a>'; |
||
| 126 | $string .= '<p>' . $story['caption'] . '</p>'; |
||
| 127 | $string .= "</div>"; |
||
| 128 | return $string; |
||
| 129 | } |
||
| 130 | |||
| 131 | function get_to($story){ |
||
| 132 | |||
| 133 | $value = ''; |
||
| 134 | |||
| 135 | foreach($story as $field => $value){ |
||
| 136 | if(isset($story[$field]['data'][0]['name'])){ |
||
| 137 | $value = $story['data']['0']['name']; |
||
| 138 | break; |
||
| 139 | } |
||
| 140 | if($field == 'to'){ |
||
| 141 | $value = $story['data']['0']['name']; |
||
| 142 | |||
| 143 | break; |
||
| 144 | } |
||
| 145 | } |
||
| 146 | |||
| 147 | return $value; |
||
| 148 | |||
| 149 | } |
||
| 150 | } |
||
| 151 | ?> |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.