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 | /* |
||
3 | * You may not change or alter any portion of this comment or credits |
||
4 | * of supporting developers from this source code or any supporting source code |
||
5 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
6 | * This program is distributed in the hope that it will be useful, |
||
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
9 | * |
||
10 | * to use the provider: |
||
11 | * $shot = new MylinksThumbshots(); |
||
12 | * $shot->setProviderPrivateKey(my_key); |
||
13 | * $shot->setShotSize(array('width'=>120)); |
||
14 | * $shot->setSiteUrl("http://site_to_capture"); |
||
15 | * $mylinks_shotprovider = $shot->getProviderUrl(); |
||
16 | * |
||
17 | * Then in the template use something like: |
||
18 | * <img src='<{$mylinks_shotprovider}>' target='_blank' alt='' style='margin: 3px 7px;'> |
||
19 | * and at the bottom of the page show the attribution |
||
20 | * echo $shot->getAttribution(); |
||
21 | */ |
||
22 | |||
23 | /** |
||
24 | * MyLinks category.php |
||
25 | * |
||
26 | * Xoops mylinks - a multicategory links module |
||
27 | * |
||
28 | * @copyright :: {@link http://xoops.org/ XOOPS Project} |
||
29 | * @copyright :: {@link http://www.zyspec.com ZySpec Incorporated} |
||
30 | * @license :: {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} |
||
31 | * @package :: mylinks |
||
32 | * @subpackage:: class |
||
33 | * @author :: zyspec <[email protected]> |
||
34 | */ |
||
35 | require_once XOOPS_ROOT_PATH . '/modules/mylinks/class/thumbplugin.interface.php'; |
||
36 | |||
37 | /** |
||
38 | * Class MylinksHeartrails |
||
39 | */ |
||
40 | class MylinksHeartrails implements MylinksThumbPlugin |
||
41 | { |
||
42 | private $image_width = 0; |
||
43 | private $image_height = 0; |
||
44 | protected $image_ratio = 1.33; // (4:3) |
||
45 | private $site_url = null; |
||
46 | private $key = null; |
||
47 | private $attribution = ''; |
||
48 | private $provider_url = 'http://capture.heartrails.com'; |
||
49 | private $provider_name = 'Heartrails'; |
||
50 | |||
51 | /** |
||
52 | * MylinksHeartrails constructor. |
||
53 | */ |
||
54 | public function __construct() |
||
55 | { |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @return string |
||
60 | */ |
||
61 | public function getProviderUrl() |
||
62 | { |
||
63 | $query = '/' . $this->image_width . 'x' . $this->image_height . '/cool?' . $this->getSiteUrl(); |
||
64 | $providerUrl = $this->provider_url . $query; |
||
65 | |||
66 | return $providerUrl; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return string |
||
71 | */ |
||
72 | public function getProviderName() |
||
73 | { |
||
74 | return $this->provider_name; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @param $sz |
||
79 | * @return mixed|void |
||
80 | */ |
||
81 | public function setShotSize($sz) |
||
82 | { |
||
83 | if (isset($sz)) { |
||
84 | View Code Duplication | if (is_array($sz)) { |
|
0 ignored issues
–
show
|
|||
85 | if (array_key_exists('width', $sz)) { |
||
86 | $this->image_width = (int)$sz['width']; |
||
87 | if (array_key_exists('height', $sz)) { |
||
88 | $this->image_height = (int)$sz['height']; |
||
89 | } else { |
||
90 | $this->image_height = (int)($this->image_width / $this->image_ratio); |
||
91 | } |
||
92 | } else { |
||
93 | $this->image_width = (int)$sz; |
||
94 | $this->image_height = (int)($sz / $this->image_ratio); |
||
95 | } |
||
96 | } |
||
97 | } |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * @return array |
||
102 | */ |
||
103 | public function getShotSize() |
||
104 | { |
||
105 | return array('width' => $this->image_width, 'height' => $this->image_height); |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * @param $url |
||
110 | * @return mixed|void |
||
111 | */ |
||
112 | public function setSiteUrl($url) |
||
113 | { |
||
114 | //@todo: sanitize url; |
||
115 | $this->site_url = formatURL($url); |
||
116 | } |
||
117 | |||
118 | /** |
||
119 | * @return string |
||
120 | */ |
||
121 | public function getSiteUrl() |
||
122 | { |
||
123 | return urlencode($this->site_url); |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * @param null $attr |
||
128 | */ |
||
129 | public function setAttribution($attr = null) |
||
130 | { |
||
131 | $this->attribution = $attr; |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * @param int $allowhtml |
||
136 | * @return string |
||
137 | */ |
||
138 | public function getAttribution($allowhtml = 0) |
||
139 | { |
||
140 | if ($allowhtml) { |
||
141 | return $this->attribution; |
||
142 | } else { |
||
143 | $myts = MyTextSanitizer::getInstance(); |
||
144 | |||
145 | return $myts->htmlSpecialChars($this->attribution); |
||
146 | } |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * @param $key |
||
151 | * @return bool |
||
152 | */ |
||
153 | public function setProviderPublicKey($key) |
||
154 | { |
||
155 | return false; |
||
156 | } |
||
157 | |||
158 | /** |
||
159 | * @return bool |
||
160 | */ |
||
161 | public function getProviderPublicKey() |
||
162 | { |
||
163 | return false; |
||
164 | } |
||
165 | |||
166 | /** |
||
167 | * @param $key |
||
168 | * @return bool |
||
169 | */ |
||
170 | public function setProviderPrivateKey($key) |
||
171 | { |
||
172 | return false; |
||
173 | } |
||
174 | |||
175 | /** |
||
176 | * @return bool |
||
177 | */ |
||
178 | public function getProviderPrivateKey() |
||
179 | { |
||
180 | return false; |
||
181 | } |
||
182 | } |
||
183 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.