XoopsModules25x /
assessment
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 | ### Mastop InfoDigital - Paix�o por Internet |
||
| 4 | ### ============================================================= |
||
| 5 | ### Arquivo para Utiliza��o do Editor Mastop Publish no site |
||
| 6 | ### ============================================================= |
||
| 7 | ### Developer: Fernando Santos (topet05), [email protected] |
||
| 8 | ### Copyright: Mastop InfoDigital � 2003-2007 |
||
| 9 | ### ------------------------------------------------------------- |
||
| 10 | ### www.mastop.com.br |
||
| 11 | ### ============================================================= |
||
| 12 | ### $Id: formmpublishtextarea.php,v 1.4 2007/03/10 20:00:10 topet05 Exp $ |
||
| 13 | ### ============================================================= |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Class XoopsFormMPublishTextArea |
||
| 17 | */ |
||
| 18 | class XoopsFormMPublishTextArea extends XoopsFormElement |
||
|
0 ignored issues
–
show
|
|||
| 19 | { |
||
| 20 | public $value; |
||
| 21 | public $name; |
||
| 22 | public $width = '100%'; |
||
| 23 | public $height = '400px'; |
||
| 24 | public $moduleDir = 'mastop_publish'; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Constructor |
||
| 28 | * |
||
| 29 | * @param array $configs Editor Options |
||
| 30 | * @return XoopsFormMPublishTextArea |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Adding a
@return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.
Adding a Please refer to the PHP core documentation on constructors. Loading history...
|
|||
| 31 | */ |
||
| 32 | public function __construct($configs) |
||
| 33 | { |
||
| 34 | if (!empty($configs)) { |
||
| 35 | foreach ($configs as $key => $val) { |
||
| 36 | if (method_exists($this, 'set' . ucfirst($key))) { |
||
| 37 | $this->{'set' . ucfirst($key)}($val); |
||
| 38 | } else { |
||
| 39 | $this->$key = $val; |
||
| 40 | } |
||
| 41 | } |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param array $configs |
||
| 47 | */ |
||
| 48 | public function setConfig($configs) |
||
| 49 | { |
||
| 50 | foreach ($configs as $key => $val) { |
||
| 51 | $this->$key = $val; |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param bool $encode |
||
| 57 | * @return mixed |
||
| 58 | */ |
||
| 59 | public function getName($encode = true) |
||
| 60 | { |
||
| 61 | return $this->name; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @param string $value |
||
| 66 | */ |
||
| 67 | public function setName($value) |
||
| 68 | { |
||
| 69 | $this->name = $value; |
||
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @return string |
||
| 74 | */ |
||
| 75 | public function getmoduleDir() |
||
| 76 | { |
||
| 77 | return $this->moduleDir; |
||
| 78 | } |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @param $value |
||
| 82 | */ |
||
| 83 | public function setmoduleDir($value) |
||
| 84 | { |
||
| 85 | $this->moduleDir = $value; |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @return mixed |
||
| 90 | */ |
||
| 91 | public function getValue() |
||
| 92 | { |
||
| 93 | return $this->value; |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @param $value |
||
| 98 | */ |
||
| 99 | public function setValue($value) |
||
| 100 | { |
||
| 101 | $this->value = $value; |
||
| 102 | } |
||
| 103 | |||
| 104 | /** |
||
| 105 | * @param $width |
||
| 106 | */ |
||
| 107 | public function setWidth($width) |
||
| 108 | { |
||
| 109 | if (!empty($width)) { |
||
| 110 | $this->width = $width; |
||
| 111 | } |
||
| 112 | } |
||
| 113 | |||
| 114 | /** |
||
| 115 | * @return string |
||
| 116 | */ |
||
| 117 | public function getWidth() |
||
| 118 | { |
||
| 119 | return $this->width; |
||
| 120 | } |
||
| 121 | |||
| 122 | /** |
||
| 123 | * @param $height |
||
| 124 | */ |
||
| 125 | public function setHeight($height) |
||
| 126 | { |
||
| 127 | if (!empty($height)) { |
||
| 128 | $this->height = $height; |
||
| 129 | } |
||
| 130 | } |
||
| 131 | |||
| 132 | /** |
||
| 133 | * @return string |
||
| 134 | */ |
||
| 135 | public function getHeight() |
||
| 136 | { |
||
| 137 | return $this->height; |
||
| 138 | } |
||
| 139 | |||
| 140 | /** |
||
| 141 | * Prepare HTML for output |
||
| 142 | * |
||
| 143 | * @return string HTML |
||
| 144 | */ |
||
| 145 | |||
| 146 | public function render() |
||
|
0 ignored issues
–
show
render uses the super-global variable $GLOBALS which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
Loading history...
|
|||
| 147 | { |
||
| 148 | global $xoopsUser, $xoopsConfig; |
||
|
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
Loading history...
|
|||
| 149 | if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $this->getmoduleDir() . '/language/' . $xoopsConfig['language'] . '/modinfo.php')) { |
||
| 150 | include_once XOOPS_ROOT_PATH . '/modules/' . $this->getmoduleDir() . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
||
| 151 | include_once XOOPS_ROOT_PATH . '/modules/' . $this->getmoduleDir() . '/language/' . $xoopsConfig['language'] . '/admin.php'; |
||
| 152 | } else { |
||
| 153 | include_once XOOPS_ROOT_PATH . '/modules/' . $this->getmoduleDir() . '/language/portuguesebr/modinfo.php'; |
||
| 154 | include_once XOOPS_ROOT_PATH . '/modules/' . $this->getmoduleDir() . '/language/portuguesebr/admin.php'; |
||
| 155 | } |
||
| 156 | $moduleHandler = xoops_getHandler('module'); |
||
| 157 | $module = $moduleHandler->getByDirname(MPU_MOD_DIR); |
||
| 158 | $configHandler = xoops_getHandler('config'); |
||
| 159 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
||
| 160 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||
|
0 ignored issues
–
show
$groups is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 161 | $module_id = $module->getVar('mid'); |
||
|
0 ignored issues
–
show
$module_id is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 162 | $url = XOOPS_URL . $moduleConfig['mpu_conf_wysiwyg_path']; |
||
| 163 | if (!empty($xoopsUser) && is_object($xoopsUser) && $moduleConfig['mpu_conf_wysiwyg']) { |
||
| 164 | if (!$xoopsUser->isAdmin()) { |
||
| 165 | echo ' |
||
| 166 | <!-- TinyMCE --> |
||
| 167 | <script language="javascript" type="text/javascript" src="' . $url . '/tiny_mce.js"></script> |
||
| 168 | <script language="javascript" type="text/javascript"> |
||
| 169 | tinyMCE.init({ |
||
| 170 | mode : "textareas", |
||
| 171 | theme : "simple", |
||
| 172 | language : "' . $moduleConfig['mpu_conf_wysiwyg_lang'] . '", |
||
| 173 | editor_selector : "mpu_wysiwyg", |
||
| 174 | disk_cache : true, |
||
| 175 | debug : false, |
||
| 176 | plugins : "' . $moduleConfig['mpu_conf_wysiwyg_plugins'] . '", |
||
| 177 | theme_advanced_buttons1_add_before : "' . $moduleConfig['mpu_conf_wysiwyg_bt1b'] . '", |
||
| 178 | theme_advanced_buttons1_add : "' . $moduleConfig['mpu_conf_wysiwyg_bt1'] . '", |
||
| 179 | theme_advanced_buttons2_add : "' . $moduleConfig['mpu_conf_wysiwyg_bt2'] . '", |
||
| 180 | theme_advanced_buttons2_add_before: "' . $moduleConfig['mpu_conf_wysiwyg_bt2b'] . '", |
||
| 181 | theme_advanced_buttons3_add_before : "' . $moduleConfig['mpu_conf_wysiwyg_bt3b'] . '", |
||
| 182 | theme_advanced_buttons3_add : "' . $moduleConfig['mpu_conf_wysiwyg_bt3'] . '", |
||
| 183 | theme_advanced_buttons4 : "' . $moduleConfig['mpu_conf_wysiwyg_bt4'] . '", |
||
| 184 | theme_advanced_toolbar_location : "top", |
||
| 185 | theme_advanced_toolbar_align : "left", |
||
| 186 | theme_advanced_path_location : "bottom", |
||
| 187 | content_css : "' . XOOPS_THEME_URL . '/' . $GLOBALS['xoopsConfig']['theme_set'] . '/style.css", |
||
| 188 | plugin_insertdate_dateFormat : "' . $moduleConfig['mpu_conf_wysiwyg_frmtdata'] . '", |
||
| 189 | plugin_insertdate_timeFormat : "' . $moduleConfig['mpu_conf_wysiwyg_frmthora'] . '", |
||
| 190 | extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", |
||
| 191 | theme_advanced_resize_horizontal : true, |
||
| 192 | theme_advanced_resizing : true, |
||
| 193 | nonbreaking_force_tab : true, |
||
| 194 | apply_source_formatting : true, |
||
| 195 | convert_urls : false |
||
| 196 | }); |
||
| 197 | </script> |
||
| 198 | <!-- /TinyMCE -->'; |
||
| 199 | } else { |
||
| 200 | if ($moduleConfig['mpu_conf_gzip']) { |
||
| 201 | echo ' |
||
| 202 | <!-- TinyMCE --> |
||
| 203 | <script language="javascript" type="text/javascript" src="' . $url . '/tiny_mce_gzip.js"></script> |
||
| 204 | <script language="javascript" type="text/javascript"> |
||
| 205 | tinyMCE_GZ.init({ |
||
| 206 | plugins : "' . $moduleConfig['mpu_conf_wysiwyg_plugins'] . '", |
||
| 207 | themes : "advanced", |
||
| 208 | languages : "' . $moduleConfig['mpu_conf_wysiwyg_lang'] . '", |
||
| 209 | disk_cache : true, |
||
| 210 | debug : false |
||
| 211 | }); |
||
| 212 | </script> |
||
| 213 | <script language="javascript" type="text/javascript"> |
||
| 214 | tinyMCE.init({ |
||
| 215 | mode : "textareas", |
||
| 216 | theme : "advanced", |
||
| 217 | language : "' . $moduleConfig['mpu_conf_wysiwyg_lang'] . '", |
||
| 218 | editor_selector : "mpu_wysiwyg", |
||
| 219 | disk_cache : true, |
||
| 220 | debug : false, |
||
| 221 | plugins : "' . $moduleConfig['mpu_conf_wysiwyg_plugins'] . '", |
||
| 222 | theme_advanced_buttons1_add_before : "' . $moduleConfig['mpu_conf_wysiwyg_bt1b'] . '", |
||
| 223 | theme_advanced_buttons1_add : "' . $moduleConfig['mpu_conf_wysiwyg_bt1'] . '", |
||
| 224 | theme_advanced_buttons2_add : "' . $moduleConfig['mpu_conf_wysiwyg_bt2'] . '", |
||
| 225 | theme_advanced_buttons2_add_before: "' . $moduleConfig['mpu_conf_wysiwyg_bt2b'] . '", |
||
| 226 | theme_advanced_buttons3_add_before : "' . $moduleConfig['mpu_conf_wysiwyg_bt3b'] . '", |
||
| 227 | theme_advanced_buttons3_add : "' . $moduleConfig['mpu_conf_wysiwyg_bt3'] . '", |
||
| 228 | theme_advanced_buttons4 : "' . $moduleConfig['mpu_conf_wysiwyg_bt4'] . '", |
||
| 229 | theme_advanced_toolbar_location : "top", |
||
| 230 | theme_advanced_toolbar_align : "left", |
||
| 231 | theme_advanced_path_location : "bottom", |
||
| 232 | content_css : "' . XOOPS_THEME_URL . '/' . $GLOBALS['xoopsConfig']['theme_set'] . '/style.css", |
||
| 233 | plugin_insertdate_dateFormat : "' . $moduleConfig['mpu_conf_wysiwyg_frmtdata'] . '", |
||
| 234 | plugin_insertdate_timeFormat : "' . $moduleConfig['mpu_conf_wysiwyg_frmthora'] . '", |
||
| 235 | extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", |
||
| 236 | external_link_list_url : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/include/mpu_files_list.js.php", |
||
| 237 | external_image_list_url : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/include/mpu_image_list.js.php", |
||
| 238 | media_external_list_url : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/include/mpu_media_list.js.php", |
||
| 239 | file_browser_callback : "mpu_chama_browser", |
||
| 240 | theme_advanced_resize_horizontal : true, |
||
| 241 | theme_advanced_resizing : true, |
||
| 242 | nonbreaking_force_tab : true, |
||
| 243 | apply_source_formatting : true, |
||
| 244 | convert_urls : false |
||
| 245 | });'; |
||
| 246 | View Code Duplication | if ($xoopsUser->isAdmin($module->getVar('mid'))) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
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. Loading history...
|
|||
| 247 | echo ' |
||
| 248 | function mpu_chama_browser(field_name, url, type, win) |
||
| 249 | { |
||
| 250 | if (type == "image") { |
||
| 251 | tinyMCE.addToLang("",{ |
||
| 252 | browser_procurar : "' . MPU_ADM_BROWSER_TITULO . '", |
||
| 253 | browser_gimg_title : "' . _IMGMANAGER . '", |
||
| 254 | browser_ger_imagens : "' . MPU_ADM_BROWSER_GER_IMG . '", |
||
| 255 | browser_nova_imagem : "' . MPU_ADM_BROWSER_NIMG . '", |
||
| 256 | browser_nova_cat : "' . MPU_ADM_BROWSER_NCAT . '" |
||
| 257 | }); |
||
| 258 | tinyMCE.openWindow({ |
||
| 259 | file : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/admin/browser_image.php", |
||
| 260 | width : 550 + tinyMCE.getLang("lang_media_delta_width", 0), |
||
| 261 | height : 380 + tinyMCE.getLang("lang_media_delta_height", 0), |
||
| 262 | close_previous : "no" |
||
| 263 | }, { |
||
| 264 | win: win, |
||
| 265 | campo: field_name, |
||
| 266 | url : url, |
||
| 267 | inline : "yes", |
||
| 268 | resizable : "yes", |
||
| 269 | editor_id: "' . $this->getName() . '" |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 270 | }); |
||
| 271 | } elseif (type == "media") { |
||
| 272 | tinyMCE.addToLang("",{ |
||
| 273 | browser_procurar : "' . MPU_ADM_BROWSER_TITULO . '", |
||
| 274 | browser_ger_medias : "' . MPU_ADM_BROWSER_GER_MED . '", |
||
| 275 | browser_media_title : "' . MPU_ADM_BROWSER_MED_TITULO . '", |
||
| 276 | browser_nova_media : "' . MPU_ADM_NMEDIA . '" |
||
| 277 | }); |
||
| 278 | tinyMCE.openWindow({ |
||
| 279 | file : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/admin/browser_media.php", |
||
| 280 | width : 550 + tinyMCE.getLang("lang_media_delta_width", 0), |
||
| 281 | height : 380 + tinyMCE.getLang("lang_media_delta_height", 0), |
||
| 282 | close_previous : "no" |
||
| 283 | }, { |
||
| 284 | win: win, |
||
| 285 | campo: field_name, |
||
| 286 | url : url, |
||
| 287 | inline : "yes", |
||
| 288 | resizable : "yes", |
||
| 289 | editor_id: "' . $this->getName() . '" |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 290 | }); |
||
| 291 | } elseif (type == "file") { |
||
| 292 | tinyMCE.addToLang("",{ |
||
| 293 | browser_procurar : "' . MPU_ADM_BROWSER_TITULO . '", |
||
| 294 | browser_ger_files : "' . MPU_ADM_BROWSER_GER_FIL . '", |
||
| 295 | browser_file_title : "' . MPU_ADM_BROWSER_FIL_TITULO . '", |
||
| 296 | browser_novo_file : "' . MPU_ADM_NFILE . '" |
||
| 297 | }); |
||
| 298 | tinyMCE.openWindow({ |
||
| 299 | file : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/admin/browser_files.php", |
||
| 300 | width : 550 + tinyMCE.getLang("lang_media_delta_width", 0), |
||
| 301 | height : 380 + tinyMCE.getLang("lang_media_delta_height", 0), |
||
| 302 | close_previous : "no" |
||
| 303 | }, { |
||
| 304 | win: win, |
||
| 305 | campo: field_name, |
||
| 306 | url : url, |
||
| 307 | inline : "yes", |
||
| 308 | resizable : "yes", |
||
| 309 | editor_id: "' . $this->getName() . '" |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 310 | }); |
||
| 311 | } |
||
| 312 | |||
| 313 | return false; |
||
| 314 | } |
||
| 315 | </script> |
||
| 316 | <!-- /TinyMCE --> |
||
| 317 | '; |
||
| 318 | } else { |
||
| 319 | echo ' |
||
| 320 | function mpu_chama_browser(field_name, url, type, win) |
||
| 321 | { |
||
| 322 | if (type == "image") { |
||
| 323 | tinyMCE.addToLang("",{ |
||
| 324 | browser_procurar : "' . MPU_ADM_BROWSER_TITULO . '", |
||
| 325 | browser_gimg_title : "' . _IMGMANAGER . '", |
||
| 326 | browser_ger_imagens : "' . MPU_ADM_BROWSER_GER_IMG . '", |
||
| 327 | browser_nova_imagem : "' . MPU_ADM_BROWSER_NIMG . '", |
||
| 328 | browser_nova_cat : "' . MPU_ADM_BROWSER_NCAT . '" |
||
| 329 | }); |
||
| 330 | tinyMCE.openWindow({ |
||
| 331 | file : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/admin/browser_image.php", |
||
| 332 | width : 550 + tinyMCE.getLang("lang_media_delta_width", 0), |
||
| 333 | height : 380 + tinyMCE.getLang("lang_media_delta_height", 0), |
||
| 334 | close_previous : "no" |
||
| 335 | }, { |
||
| 336 | win: win, |
||
| 337 | campo: field_name, |
||
| 338 | url : url, |
||
| 339 | inline : "yes", |
||
| 340 | resizable : "yes", |
||
| 341 | editor_id: "' . $this->getName() . '" |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 342 | }); |
||
| 343 | } |
||
| 344 | |||
| 345 | return false; |
||
| 346 | } |
||
| 347 | </script> |
||
| 348 | <!-- /TinyMCE --> |
||
| 349 | '; |
||
| 350 | } |
||
| 351 | } else { |
||
| 352 | echo ' |
||
| 353 | <!-- TinyMCE --> |
||
| 354 | <script language="javascript" type="text/javascript" src="' . $url . '/tiny_mce.js"></script> |
||
| 355 | <script language="javascript" type="text/javascript"> |
||
| 356 | tinyMCE.init({ |
||
| 357 | mode : "textareas", |
||
| 358 | theme : "advanced", |
||
| 359 | language : "' . $moduleConfig['mpu_conf_wysiwyg_lang'] . '", |
||
| 360 | editor_selector : "mpu_wysiwyg", |
||
| 361 | disk_cache : true, |
||
| 362 | debug : false, |
||
| 363 | plugins : "' . $moduleConfig['mpu_conf_wysiwyg_plugins'] . '", |
||
| 364 | theme_advanced_buttons1_add_before : "' . $moduleConfig['mpu_conf_wysiwyg_bt1b'] . '", |
||
| 365 | theme_advanced_buttons1_add : "' . $moduleConfig['mpu_conf_wysiwyg_bt1'] . '", |
||
| 366 | theme_advanced_buttons2_add : "' . $moduleConfig['mpu_conf_wysiwyg_bt2'] . '", |
||
| 367 | theme_advanced_buttons2_add_before: "' . $moduleConfig['mpu_conf_wysiwyg_bt2b'] . '", |
||
| 368 | theme_advanced_buttons3_add_before : "' . $moduleConfig['mpu_conf_wysiwyg_bt3b'] . '", |
||
| 369 | theme_advanced_buttons3_add : "' . $moduleConfig['mpu_conf_wysiwyg_bt3'] . '", |
||
| 370 | theme_advanced_buttons4 : "' . $moduleConfig['mpu_conf_wysiwyg_bt4'] . '", |
||
| 371 | theme_advanced_toolbar_location : "top", |
||
| 372 | theme_advanced_toolbar_align : "left", |
||
| 373 | theme_advanced_path_location : "bottom", |
||
| 374 | content_css : "' . XOOPS_THEME_URL . '/' . $GLOBALS['xoopsConfig']['theme_set'] . '/style.css", |
||
| 375 | plugin_insertdate_dateFormat : "' . $moduleConfig['mpu_conf_wysiwyg_frmtdata'] . '", |
||
| 376 | plugin_insertdate_timeFormat : "' . $moduleConfig['mpu_conf_wysiwyg_frmthora'] . '", |
||
| 377 | extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", |
||
| 378 | external_link_list_url : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/include/mpu_link_list.js", |
||
| 379 | external_image_list_url : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/include/mpu_image_list.js.php", |
||
| 380 | media_external_list_url : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/include/mpu_media_list.js", |
||
| 381 | file_browser_callback : "mpu_chama_browser", |
||
| 382 | theme_advanced_resize_horizontal : true, |
||
| 383 | theme_advanced_resizing : true, |
||
| 384 | nonbreaking_force_tab : true, |
||
| 385 | apply_source_formatting : true, |
||
| 386 | convert_urls : false |
||
| 387 | });'; |
||
| 388 | View Code Duplication | if ($xoopsUser->isAdmin($module->getVar('mid'))) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
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. Loading history...
|
|||
| 389 | echo ' |
||
| 390 | function mpu_chama_browser(field_name, url, type, win) |
||
| 391 | { |
||
| 392 | if (type == "image") { |
||
| 393 | tinyMCE.addToLang("",{ |
||
| 394 | browser_procurar : "' . MPU_ADM_BROWSER_TITULO . '", |
||
| 395 | browser_gimg_title : "' . _IMGMANAGER . '", |
||
| 396 | browser_ger_imagens : "' . MPU_ADM_BROWSER_GER_IMG . '", |
||
| 397 | browser_nova_imagem : "' . MPU_ADM_BROWSER_NIMG . '", |
||
| 398 | browser_nova_cat : "' . MPU_ADM_BROWSER_NCAT . '" |
||
| 399 | }); |
||
| 400 | tinyMCE.openWindow({ |
||
| 401 | file : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/admin/browser_image.php", |
||
| 402 | width : 550 + tinyMCE.getLang("lang_media_delta_width", 0), |
||
| 403 | height : 380 + tinyMCE.getLang("lang_media_delta_height", 0), |
||
| 404 | close_previous : "no" |
||
| 405 | }, { |
||
| 406 | win: win, |
||
| 407 | campo: field_name, |
||
| 408 | url : url, |
||
| 409 | inline : "yes", |
||
| 410 | resizable : "yes", |
||
| 411 | editor_id: "' . $this->getName() . '" |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 412 | }); |
||
| 413 | } elseif (type == "media") { |
||
| 414 | tinyMCE.addToLang("",{ |
||
| 415 | browser_procurar : "' . MPU_ADM_BROWSER_TITULO . '", |
||
| 416 | browser_ger_medias : "' . MPU_ADM_BROWSER_GER_MED . '", |
||
| 417 | browser_media_title : "' . MPU_ADM_BROWSER_MED_TITULO . '", |
||
| 418 | browser_nova_media : "' . MPU_ADM_NMEDIA . '" |
||
| 419 | }); |
||
| 420 | tinyMCE.openWindow({ |
||
| 421 | file : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/admin/browser_media.php", |
||
| 422 | width : 550 + tinyMCE.getLang("lang_media_delta_width", 0), |
||
| 423 | height : 380 + tinyMCE.getLang("lang_media_delta_height", 0), |
||
| 424 | close_previous : "no" |
||
| 425 | }, { |
||
| 426 | win: win, |
||
| 427 | campo: field_name, |
||
| 428 | url : url, |
||
| 429 | inline : "yes", |
||
| 430 | resizable : "yes", |
||
| 431 | editor_id: "' . $this->getName() . '" |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 432 | }); |
||
| 433 | } elseif (type == "file") { |
||
| 434 | tinyMCE.addToLang("",{ |
||
| 435 | browser_procurar : "' . MPU_ADM_BROWSER_TITULO . '", |
||
| 436 | browser_ger_files : "' . MPU_ADM_BROWSER_GER_FIL . '", |
||
| 437 | browser_file_title : "' . MPU_ADM_BROWSER_FIL_TITULO . '", |
||
| 438 | browser_novo_file : "' . MPU_ADM_NFILE . '" |
||
| 439 | }); |
||
| 440 | tinyMCE.openWindow({ |
||
| 441 | file : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/admin/browser_files.php", |
||
| 442 | width : 550 + tinyMCE.getLang("lang_media_delta_width", 0), |
||
| 443 | height : 380 + tinyMCE.getLang("lang_media_delta_height", 0), |
||
| 444 | close_previous : "no" |
||
| 445 | }, { |
||
| 446 | win: win, |
||
| 447 | campo: field_name, |
||
| 448 | url : url, |
||
| 449 | inline : "yes", |
||
| 450 | resizable : "yes", |
||
| 451 | editor_id: "' . $this->getName() . '" |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 452 | }); |
||
| 453 | } |
||
| 454 | |||
| 455 | return false; |
||
| 456 | } |
||
| 457 | </script> |
||
| 458 | <!-- /TinyMCE -->'; |
||
| 459 | } else { |
||
| 460 | echo ' |
||
| 461 | function mpu_chama_browser(field_name, url, type, win) |
||
| 462 | { |
||
| 463 | if (type == "image") { |
||
| 464 | tinyMCE.addToLang("",{ |
||
| 465 | browser_procurar : "' . MPU_ADM_BROWSER_TITULO . '", |
||
| 466 | browser_gimg_title : "' . _IMGMANAGER . '", |
||
| 467 | browser_ger_imagens : "' . MPU_ADM_BROWSER_GER_IMG . '", |
||
| 468 | browser_nova_imagem : "' . MPU_ADM_BROWSER_NIMG . '", |
||
| 469 | browser_nova_cat : "' . MPU_ADM_BROWSER_NCAT . '" |
||
| 470 | }); |
||
| 471 | tinyMCE.openWindow({ |
||
| 472 | file : "' . XOOPS_URL . '/modules/' . MPU_MOD_DIR . '/admin/browser_image.php", |
||
| 473 | width : 550 + tinyMCE.getLang("lang_media_delta_width", 0), |
||
| 474 | height : 380 + tinyMCE.getLang("lang_media_delta_height", 0), |
||
| 475 | close_previous : "no" |
||
| 476 | }, { |
||
| 477 | win: win, |
||
| 478 | campo: field_name, |
||
| 479 | url : url, |
||
| 480 | inline : "yes", |
||
| 481 | resizable : "yes", |
||
| 482 | editor_id: "' . $this->getName() . '" |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 483 | }); |
||
| 484 | } |
||
| 485 | |||
| 486 | return false; |
||
| 487 | } |
||
| 488 | </script> |
||
| 489 | <!-- /TinyMCE -->'; |
||
| 490 | } |
||
| 491 | } |
||
| 492 | } |
||
| 493 | // this is sooooo dirty and ugly, but the xoops-validation-script never gets the correct content, so I had to add a blank at the end of the textarea |
||
| 494 | $form = '<textarea id="' . $this->getName() . '" name="' . $this->getName() . '" rows="1" cols="1" style="width:' . $this->getWidth() . '; height:' . $this->getHeight() . '" class="mpu_wysiwyg">' . $this->getValue() . ' </textarea>'; |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 495 | $form .= $this->_renderSmileys(1); |
||
| 496 | } else { |
||
| 497 | $hiddenText = 'xoopsHiddenText'; |
||
| 498 | $form = "<a name='moresmiley'></a><img onmouseover='style.cursor=\"hand\"' src='" |
||
| 499 | . XOOPS_URL |
||
| 500 | . "/assets/images/url.gif' alt='url' onclick='xoopsCodeUrl(\"" |
||
| 501 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 502 | . '", "' |
||
| 503 | . htmlspecialchars(_ENTERURL, ENT_QUOTES) |
||
| 504 | . '", "' |
||
| 505 | . htmlspecialchars(_ENTERWEBTITLE, ENT_QUOTES) |
||
| 506 | . "\");' /> <img onmouseover='style.cursor=\"hand\"' src='" |
||
| 507 | . XOOPS_URL |
||
| 508 | . "/assets/images/email.gif' alt='email' onclick='xoopsCodeEmail(\"" |
||
| 509 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 510 | . '", "' |
||
| 511 | . htmlspecialchars(_ENTEREMAIL, ENT_QUOTES) |
||
| 512 | . "\");' /> <img onclick='xoopsCodeImg(\"" |
||
| 513 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 514 | . '", "' |
||
| 515 | . htmlspecialchars(_ENTERIMGURL, ENT_QUOTES) |
||
| 516 | . '", "' |
||
| 517 | . htmlspecialchars(_ENTERIMGPOS, ENT_QUOTES) |
||
| 518 | . '", "' |
||
| 519 | . htmlspecialchars(_IMGPOSRORL, ENT_QUOTES) |
||
| 520 | . '", "' |
||
| 521 | . htmlspecialchars(_ERRORIMGPOS, ENT_QUOTES) |
||
| 522 | . "\");' onmouseover='style.cursor=\"hand\"' src='" |
||
| 523 | . XOOPS_URL |
||
| 524 | . "/assets/images/imgsrc.gif' alt='imgsrc' /> <img onmouseover='style.cursor=\"hand\"' onclick='openWithSelfMain(\"" |
||
| 525 | . XOOPS_URL |
||
| 526 | . '/imagemanager.php?target=' |
||
| 527 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 528 | . "\",\"imgmanager\",400,430);' src='" |
||
| 529 | . XOOPS_URL |
||
| 530 | . "/assets/images/image.gif' alt='image' /> <img src='" |
||
| 531 | . XOOPS_URL |
||
| 532 | . "/assets/images/code.gif' onmouseover='style.cursor=\"hand\"' alt='code' onclick='xoopsCodeCode(\"" |
||
| 533 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 534 | . '", "' |
||
| 535 | . htmlspecialchars(_ENTERCODE, ENT_QUOTES) |
||
| 536 | . "\");' /> <img onclick='xoopsCodeQuote(\"" |
||
| 537 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 538 | . '", "' |
||
| 539 | . htmlspecialchars(_ENTERQUOTE, ENT_QUOTES) |
||
| 540 | . "\");' onmouseover='style.cursor=\"hand\"' src='" |
||
| 541 | . XOOPS_URL |
||
| 542 | . "/assets/images/quote.gif' alt='quote' /><br />\n"; |
||
| 543 | |||
| 544 | $sizearray = array('xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'); |
||
| 545 | $form .= "<select id='" . $this->getName() . "Size' onchange='setVisible(\"" . $hiddenText . '");setElementSize("' . $hiddenText . "\",this.options[this.selectedIndex].value);'>\n"; |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 546 | $form .= "<option value='SIZE'>" . _SIZE . "</option>\n"; |
||
| 547 | foreach ($sizearray as $size) { |
||
| 548 | $form .= "<option value='$size'>$size</option>\n"; |
||
| 549 | } |
||
| 550 | $form .= "</select>\n"; |
||
| 551 | $fontarray = array('Arial', 'Courier', 'Georgia', 'Helvetica', 'Impact', 'Verdana'); |
||
| 552 | $form .= "<select id='" . $this->getName() . "Font' onchange='setVisible(\"" . $hiddenText . '");setElementFont("' . $hiddenText . "\",this.options[this.selectedIndex].value);'>\n"; |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 553 | $form .= "<option value='FONT'>" . _FONT . "</option>\n"; |
||
| 554 | foreach ($fontarray as $font) { |
||
| 555 | $form .= "<option value='$font'>$font</option>\n"; |
||
| 556 | } |
||
| 557 | $form .= "</select>\n"; |
||
| 558 | $colorarray = array('00', '33', '66', '99', 'CC', 'FF'); |
||
| 559 | $form .= "<select id='" . $this->getName() . "Color' onchange='setVisible(\"" . $hiddenText . '");setElementColor("' . $hiddenText . "\",this.options[this.selectedIndex].value);'>\n"; |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 560 | $form .= "<option value='COLOR'>" . _COLOR . "</option>\n"; |
||
| 561 | foreach ($colorarray as $color1) { |
||
| 562 | foreach ($colorarray as $color2) { |
||
| 563 | foreach ($colorarray as $color3) { |
||
| 564 | $form .= "<option value='" . $color1 . $color2 . $color3 . '\' style=\'background-color:#' . $color1 . $color2 . $color3 . ';color:#' . $color1 . $color2 . $color3 . ";'>#" . $color1 . $color2 . $color3 . "</option>\n"; |
||
| 565 | } |
||
| 566 | } |
||
| 567 | } |
||
| 568 | $form .= "</select><span id='" . $hiddenText . '\'>' . _EXAMPLE . "</span>\n"; |
||
| 569 | $form .= "<br />\n"; |
||
| 570 | $form .= "<img onclick='javascript:setVisible(\"" |
||
| 571 | . $hiddenText |
||
| 572 | . '");makeBold("' |
||
| 573 | . $hiddenText |
||
| 574 | . "\");' onmouseover='style.cursor=\"hand\"' src='" |
||
| 575 | . XOOPS_URL |
||
| 576 | . "/assets/images/bold.gif' alt='bold' /> <img onclick='javascript:setVisible(\"" |
||
| 577 | . $hiddenText |
||
| 578 | . '");makeItalic("' |
||
| 579 | . $hiddenText |
||
| 580 | . "\");' onmouseover='style.cursor=\"hand\"' src='" |
||
| 581 | . XOOPS_URL |
||
| 582 | . "/assets/images/italic.gif' alt='italic' /> <img onclick='javascript:setVisible(\"" |
||
| 583 | . $hiddenText |
||
| 584 | . '");makeUnderline("' |
||
| 585 | . $hiddenText |
||
| 586 | . "\");' onmouseover='style.cursor=\"hand\"' src='" |
||
| 587 | . XOOPS_URL |
||
| 588 | . "/assets/images/underline.gif' alt='underline' /> <img onclick='javascript:setVisible(\"" |
||
| 589 | . $hiddenText |
||
| 590 | . '");makeLineThrough("' |
||
| 591 | . $hiddenText |
||
| 592 | . "\");' src='" |
||
| 593 | . XOOPS_URL |
||
| 594 | . "/assets/images/linethrough.gif' alt='linethrough' onmouseover='style.cursor=\"hand\"' /> <input type='text' id='" |
||
| 595 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 596 | . "Addtext' size='20' /> <input type='button' onclick='xoopsCodeText(\"" |
||
| 597 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 598 | . '", "' |
||
| 599 | . $hiddenText |
||
| 600 | . '", "' |
||
| 601 | . htmlspecialchars(_ENTERTEXTBOX, ENT_QUOTES) |
||
| 602 | . "\")' class='formButton' value='" |
||
| 603 | . _ADD |
||
| 604 | . '\' /><br /><br /><textarea id=\'' |
||
| 605 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 606 | . '\' name=\'' |
||
| 607 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 608 | . '\' onselect="xoopsSavePosition(\'' |
||
| 609 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 610 | . '\');" onclick="xoopsSavePosition(\'' |
||
| 611 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 612 | . '\');" onkeyup="xoopsSavePosition(\'' |
||
| 613 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 614 | . '\');" cols=\'50\' rows=\'20\' ' |
||
| 615 | . $this->getExtra() |
||
| 616 | . " style='width:100%; height: 400px;'>" |
||
| 617 | . $this->getValue() |
||
| 618 | . "</textarea><br />\n"; |
||
| 619 | $form .= $this->_renderSmileys(0); |
||
| 620 | } |
||
| 621 | |||
| 622 | return $form; |
||
| 623 | } |
||
| 624 | |||
| 625 | /** |
||
| 626 | * @param $visual |
||
| 627 | * |
||
| 628 | * @return string |
||
| 629 | */ |
||
| 630 | public function _renderSmileys($visual) |
||
| 631 | { |
||
| 632 | if (!$visual) { |
||
| 633 | $myts = MyTextSanitizer::getInstance(); |
||
| 634 | $smiles =& $myts->getSmileys(); |
||
| 635 | $ret = ''; |
||
| 636 | if (empty($smileys)) { |
||
|
0 ignored issues
–
show
The variable
$smileys does not exist. Did you mean $smiles?
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name. The variable may have been renamed without also renaming all references. Loading history...
|
|||
| 637 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
||
| 638 | if ($result = $db->query('SELECT * FROM ' . $db->prefix('smiles') . ' WHERE display=1')) { |
||
| 639 | while ($smiles = $db->fetchArray($result)) { |
||
| 640 | $ret .= "<img onclick='xoopsCodeSmilie(\"" |
||
| 641 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 642 | . '", " ' |
||
| 643 | . $smiles['code'] |
||
| 644 | . " \");' onmouseover='style.cursor=\"hand\"' src='" |
||
| 645 | . XOOPS_UPLOAD_URL |
||
| 646 | . '/' |
||
| 647 | . htmlspecialchars($smiles['smile_url'], ENT_QUOTES) |
||
| 648 | . '\' alt=\'\' />'; |
||
| 649 | } |
||
| 650 | } |
||
| 651 | } else { |
||
| 652 | $count = count($smiles); |
||
| 653 | for ($i = 0; $i < $count; ++$i) { |
||
| 654 | if ($smiles[$i]['display'] == 1) { |
||
| 655 | $ret .= "<img onclick='xoopsCodeSmilie(\"" |
||
| 656 | . $this->getName() |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 657 | . '", " ' |
||
| 658 | . $smiles[$i]['code'] |
||
| 659 | . " \");' onmouseover='style.cursor=\"hand\"' src='" |
||
| 660 | . XOOPS_UPLOAD_URL |
||
| 661 | . '/' |
||
| 662 | . $myts->oopsHtmlSpecialChars($smiles['smile_url']) |
||
| 663 | . '\' border=\'0\' alt=\'\' />'; |
||
| 664 | } |
||
| 665 | } |
||
| 666 | } |
||
| 667 | $ret .= " [<a href='#moresmiley' onclick='javascript:openWithSelfMain(\"" . XOOPS_URL . '/misc.php?action=showpopups&type=smilies&target=' . $this->getName() . "\",\"smilies\",300,475);'>" . _MORE . '</a>]'; |
||
|
0 ignored issues
–
show
Loading history...
|
|||
| 668 | } else { |
||
| 669 | $myts = MyTextSanitizer::getInstance(); |
||
| 670 | $smiles =& $myts->getSmileys(); |
||
| 671 | $ret = ''; |
||
| 672 | if (empty($smileys)) { |
||
|
0 ignored issues
–
show
The variable
$smileys does not exist. Did you mean $smiles?
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name. The variable may have been renamed without also renaming all references. Loading history...
|
|||
| 673 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
||
| 674 | if ($result = $db->query('SELECT * FROM ' . $db->prefix('smiles') . ' WHERE display=1')) { |
||
| 675 | while ($smiles = $db->fetchArray($result)) { |
||
| 676 | $ret .= "<img onclick=\"tinyMCE.execCommand('mceInsertContent',false,'<img src=\'" |
||
| 677 | . XOOPS_UPLOAD_URL |
||
| 678 | . '/' |
||
| 679 | . htmlspecialchars($smiles['smile_url'], ENT_QUOTES) |
||
| 680 | . '\');" onmouseover=\'style.cursor="hand"\' src=\'' |
||
| 681 | . XOOPS_UPLOAD_URL |
||
| 682 | . '/' |
||
| 683 | . htmlspecialchars($smiles['smile_url'], ENT_QUOTES) |
||
| 684 | . '\' alt=\'' |
||
| 685 | . $smiles['emotion'] |
||
| 686 | . '\' />'; |
||
| 687 | } |
||
| 688 | } |
||
| 689 | } else { |
||
| 690 | $count = count($smiles); |
||
| 691 | for ($i = 0; $i < $count; ++$i) { |
||
| 692 | if ($smiles[$i]['display'] == 1) { |
||
| 693 | $ret .= "<img onclick=\"tinyMCE.execCommand('mceInsertContent',false,'<img src=\'" |
||
| 694 | . XOOPS_UPLOAD_URL |
||
| 695 | . '/' |
||
| 696 | . htmlspecialchars($smiles[$i]['smile_url'], ENT_QUOTES) |
||
| 697 | . '\');" onmouseover=\'style.cursor="hand"\' src=\'' |
||
| 698 | . XOOPS_UPLOAD_URL |
||
| 699 | . '/' |
||
| 700 | . $myts->oopsHtmlSpecialChars($smiles[$i]['smile_url']) |
||
| 701 | . '\' border=\'0\' alt=\'' |
||
| 702 | . $smiles[$i]['emotion'] |
||
| 703 | . '\' />'; |
||
| 704 | } |
||
| 705 | } |
||
| 706 | } |
||
| 707 | } |
||
| 708 | |||
| 709 | return $ret; |
||
| 710 | } |
||
| 711 | } |
||
| 712 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.