@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
| 15 | 15 | |
| 16 | -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; |
|
| 16 | +defined('NEWBB_FUNCTIONS_INI') || include __DIR__.'/functions.ini.php'; |
|
| 17 | 17 | define('NEWBB_FUNCTIONS_READ_LOADED', true); |
| 18 | 18 | |
| 19 | 19 | if (!defined('NEWBB_FUNCTIONS_READ')) { |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
| 13 | 13 | |
| 14 | -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; |
|
| 14 | +defined('NEWBB_FUNCTIONS_INI') || include __DIR__.'/functions.ini.php'; |
|
| 15 | 15 | define('NEWBB_FUNCTIONS_RECON_LOADED', true); |
| 16 | 16 | |
| 17 | 17 | if (!defined('NEWBB_FUNCTIONS_RECON')) { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
| 13 | 13 | |
| 14 | -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; |
|
| 14 | +defined('NEWBB_FUNCTIONS_INI') || include __DIR__.'/functions.ini.php'; |
|
| 15 | 15 | define('NEWBB_FUNCTIONS_RPC_LOADED', true); |
| 16 | 16 | |
| 17 | 17 | if (!defined('NEWBB_FUNCTIONS_RPC')) { |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | } else { |
| 33 | 33 | $charset = _CHARSET; |
| 34 | 34 | } |
| 35 | - header('Content-Type: text/xml; charset="' . $charset . '"'); |
|
| 35 | + header('Content-Type: text/xml; charset="'.$charset.'"'); |
|
| 36 | 36 | if ($error) { |
| 37 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
| 37 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
| 38 | 38 | echo '<response>\n'; |
| 39 | 39 | echo '<error>1</error>\n'; |
| 40 | 40 | echo '<message>$error_message</message>\n'; |
| 41 | 41 | echo '</response>'; |
| 42 | 42 | exit(); |
| 43 | 43 | } else { |
| 44 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
| 44 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
| 45 | 45 | echo '<response>\n'; |
| 46 | 46 | echo '<error>0</error>\n'; |
| 47 | 47 | echo '</response>'; |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | // MENU handler |
| 75 | 75 | /* You could remove anyone by commenting out in order to disable it */ |
| 76 | 76 | $customConfig['valid_menumodes'] = [ |
| 77 | - 0 => _MD_NEWBB_MENU_SELECT, // for selectbox |
|
| 77 | + 0 => _MD_NEWBB_MENU_SELECT, // for selectbox |
|
| 78 | 78 | //1 => _MD_NEWBB_MENU_CLICK, // for "click to expand" |
| 79 | 79 | //2 => _MD_NEWBB_MENU_HOVER // for "mouse hover to expand" |
| 80 | 80 | ]; |
@@ -72,8 +72,8 @@ |
||
| 72 | 72 | // MENU handler |
| 73 | 73 | /* You could remove anyone by commenting out in order to disable it */ |
| 74 | 74 | $valid_menumodes = [ |
| 75 | - 0 => _MD_NEWBB_MENU_SELECT, // for selectbox |
|
| 76 | - 1 => _MD_NEWBB_MENU_CLICK, // for 'click to expand' |
|
| 75 | + 0 => _MD_NEWBB_MENU_SELECT, // for selectbox |
|
| 76 | + 1 => _MD_NEWBB_MENU_CLICK, // for 'click to expand' |
|
| 77 | 77 | 2 => _MD_NEWBB_MENU_HOVER // for 'mouse hover to expand' |
| 78 | 78 | ]; |
| 79 | 79 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
| 15 | 15 | |
| 16 | -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; |
|
| 16 | +defined('NEWBB_FUNCTIONS_INI') || include __DIR__.'/functions.ini.php'; |
|
| 17 | 17 | define('NEWBB_FUNCTIONS_FORUM_LOADED', true); |
| 18 | 18 | |
| 19 | 19 | if (!defined('NEWBB_FUNCTIONS_FORUM')) { |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | $groups = $xoopsUser->getGroups(); |
| 41 | 41 | } |
| 42 | 42 | sort($groups); |
| 43 | - $groupKey = 'forumselect_' . $permission . '_' . md5(implode(',', $groups)); |
|
| 44 | - $forums = $cacheHelper->cacheRead($groupKey, function () use ($categories, $permission) { |
|
| 43 | + $groupKey = 'forumselect_'.$permission.'_'.md5(implode(',', $groups)); |
|
| 44 | + $forums = $cacheHelper->cacheRead($groupKey, function() use ($categories, $permission) { |
|
| 45 | 45 | /** @var Newbb\CategoryHandler $categoryHandler */ |
| 46 | 46 | $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
| 47 | 47 | $categories = $categoryHandler->getByPermission($permission, ['cat_id', 'cat_order', 'cat_title'], false); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | if ($categoryDelimiter) { |
| 62 | 62 | $box .= "<option value=0> </option>\n"; |
| 63 | 63 | } |
| 64 | - $box .= "<option value='" . (-1 * $key) . "'>[" . $categories[$key]['cat_title'] . "]</option>\n"; |
|
| 64 | + $box .= "<option value='".(-1 * $key)."'>[".$categories[$key]['cat_title']."]</option>\n"; |
|
| 65 | 65 | if (empty($forums[$key])) { |
| 66 | 66 | continue; |
| 67 | 67 | } |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | if ($see && in_array($f, $value)) { |
| 70 | 70 | continue; |
| 71 | 71 | } |
| 72 | - $box .= "<option value='{$f}' " . (in_array($f, $value) ? ' selected' : '') . '>' . $forum['prefix'] . $forum['forum_name'] . "</option>\n"; |
|
| 72 | + $box .= "<option value='{$f}' ".(in_array($f, $value) ? ' selected' : '').'>'.$forum['prefix'].$forum['forum_name']."</option>\n"; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | } else { |
| 76 | - $box .= '<option value=0>' . _MD_NEWBB_NOFORUMINDB . "</option>\n"; |
|
| 76 | + $box .= '<option value=0>'._MD_NEWBB_NOFORUMINDB."</option>\n"; |
|
| 77 | 77 | } |
| 78 | 78 | unset($forums, $categories); |
| 79 | 79 | |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function newbbMakeJumpbox($forum_id = 0) |
| 88 | 88 | { |
| 89 | - $box = '<form name="forum_jumpbox" method="get" action="' . XOOPS_URL . '/modules/newbb/viewforum.php" onsubmit="javascript: if (document.forum_jumpbox.forum.value < 1) {return false;}">'; |
|
| 89 | + $box = '<form name="forum_jumpbox" method="get" action="'.XOOPS_URL.'/modules/newbb/viewforum.php" onsubmit="javascript: if (document.forum_jumpbox.forum.value < 1) {return false;}">'; |
|
| 90 | 90 | $box .= '<select class="select" name="forum" onchange="if (this.options[this.selectedIndex].value >0) { document.forms.forum_jumpbox.submit();}">'; |
| 91 | - $box .= '<option value=0>-- ' . _MD_NEWBB_SELFORUM . ' --</option>'; |
|
| 91 | + $box .= '<option value=0>-- '._MD_NEWBB_SELFORUM.' --</option>'; |
|
| 92 | 92 | $box .= newbbForumSelectBox($forum_id); |
| 93 | - $box .= "</select> <input type='submit' class='button' value='" . _GO . "' /></form>"; |
|
| 93 | + $box .= "</select> <input type='submit' class='button' value='"._GO."' /></form>"; |
|
| 94 | 94 | unset($forums, $categories); |
| 95 | 95 | |
| 96 | 96 | return $box; |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | $xoopsTpl->assign('category', ['id' => $forumObject->getVar('cat_id'), 'title' => $categoryObject->getVar('cat_title')]); |
| 52 | 52 | $xoopsTpl->assign('parentforum', $forumHandler->getParents($forumObject)); |
| 53 | 53 | $xoopsTpl->assign([ |
| 54 | - 'forum_id' => $forumObject->getVar('forum_id'), |
|
| 55 | - 'forum_name' => $forumObject->getVar('forum_name') |
|
| 56 | - ]); |
|
| 54 | + 'forum_id' => $forumObject->getVar('forum_id'), |
|
| 55 | + 'forum_name' => $forumObject->getVar('forum_name') |
|
| 56 | + ]); |
|
| 57 | 57 | |
| 58 | 58 | if (!is_object($topicObject)) { |
| 59 | 59 | $topicObject = $topicHandler->create(); |
@@ -74,24 +74,24 @@ discard block |
||
| 74 | 74 | $xoopsTpl->assign('form_title', $form_title); |
| 75 | 75 | |
| 76 | 76 | foreach ([ |
| 77 | - 'start', |
|
| 78 | - 'topic_id', |
|
| 79 | - 'post_id', |
|
| 80 | - 'pid', |
|
| 81 | - 'isreply', |
|
| 82 | - 'isedit', |
|
| 83 | - 'contents_preview' |
|
| 84 | - ] as $getint) { |
|
| 77 | + 'start', |
|
| 78 | + 'topic_id', |
|
| 79 | + 'post_id', |
|
| 80 | + 'pid', |
|
| 81 | + 'isreply', |
|
| 82 | + 'isedit', |
|
| 83 | + 'contents_preview' |
|
| 84 | + ] as $getint) { |
|
| 85 | 85 | ${$getint} = Request::getInt($getint, (!empty(${$getint}) ? ${$getint} : 0), 'GET'); // isset($_GET[$getint]) ? (int)($_GET[$getint]) : ((!empty(${$getint})) ? ${$getint} : 0); |
| 86 | 86 | } |
| 87 | 87 | foreach ([ |
| 88 | - 'order', |
|
| 89 | - 'viewmode', |
|
| 90 | - 'hidden', |
|
| 91 | - 'newbb_form', |
|
| 92 | - 'icon', |
|
| 93 | - 'op' |
|
| 94 | - ] as $getstr) { |
|
| 88 | + 'order', |
|
| 89 | + 'viewmode', |
|
| 90 | + 'hidden', |
|
| 91 | + 'newbb_form', |
|
| 92 | + 'icon', |
|
| 93 | + 'op' |
|
| 94 | + ] as $getstr) { |
|
| 95 | 95 | ${$getstr} = Request::getString($getstr, (!empty(${$getstr}) ? ${$getstr} : ''), 'GET'); //isset($_GET[$getstr]) ? $_GET[$getstr] : ((!empty(${$getstr})) ? ${$getstr} : ''); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | if (empty($postParentObject)) { |
| 67 | 67 | $postParentObject = $postHandler->get($pid); |
| 68 | 68 | } |
| 69 | - $form_title = _MD_NEWBB_REPLY . ': <a href="' . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}&post_id={$pid}\" rel=\"external\">" . $postParentObject->getVar('subject') . '</a>'; |
|
| 69 | + $form_title = _MD_NEWBB_REPLY.': <a href="'.XOOPS_URL."/modules/newbb/viewtopic.php?topic_id={$topic_id}&post_id={$pid}\" rel=\"external\">".$postParentObject->getVar('subject').'</a>'; |
|
| 70 | 70 | } else { |
| 71 | - $form_title = _EDIT . ': <a href="' . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id={$post_id}\" rel=\"external\">" . $postObject->getVar('subject') . '</a>'; |
|
| 71 | + $form_title = _EDIT.': <a href="'.XOOPS_URL."/modules/newbb/viewtopic.php?post_id={$post_id}\" rel=\"external\">".$postObject->getVar('subject').'</a>'; |
|
| 72 | 72 | $editby = true; |
| 73 | 73 | } |
| 74 | 74 | $xoopsTpl->assign('form_title', $form_title); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | //$filname = XOOPS_URL.$_SERVER['REQUEST_URI']; |
| 103 | 103 | |
| 104 | -$forum_form = new \XoopsThemeForm(htmlspecialchars(@$form_title, ENT_QUOTES | ENT_HTML5), 'form_post', XOOPS_URL . '/modules/newbb/post.php', 'post', true); |
|
| 104 | +$forum_form = new \XoopsThemeForm(htmlspecialchars(@$form_title, ENT_QUOTES | ENT_HTML5), 'form_post', XOOPS_URL.'/modules/newbb/post.php', 'post', true); |
|
| 105 | 105 | $forum_form->setExtra('enctype="multipart/form-data"'); |
| 106 | 106 | |
| 107 | 107 | if ($editby) { |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $icons_radio = new \XoopsFormRadio(_MD_NEWBB_MESSAGEICON, 'icon', $icon); |
| 144 | 144 | $subject_icons = \XoopsLists::getSubjectsList(); |
| 145 | 145 | foreach ($subject_icons as $iconfile) { |
| 146 | - $icons_radio->addOption($iconfile, '<img src="' . XOOPS_URL . '/images/subject/' . $iconfile . '" alt="" />'); |
|
| 146 | + $icons_radio->addOption($iconfile, '<img src="'.XOOPS_URL.'/images/subject/'.$iconfile.'" alt="" />'); |
|
| 147 | 147 | } |
| 148 | 148 | $forum_form->addElement($icons_radio); |
| 149 | 149 | |
@@ -251,18 +251,18 @@ discard block |
||
| 251 | 251 | $upload_tray = new \XoopsFormElementTray(_MD_NEWBB_ATTACHMENT); |
| 252 | 252 | $upload_tray->addElement(new \XoopsFormFile('', 'userfile', $forumObject->getVar('attach_maxkb') * 1024)); |
| 253 | 253 | $upload_tray->addElement(new \XoopsFormButton('', 'contents_upload', _MD_NEWBB_UPLOAD, 'submit')); |
| 254 | - $upload_tray->addElement(new \XoopsFormLabel('<br><br>' . _MD_NEWBB_MAX_FILESIZE . ':', $forumObject->getVar('attach_maxkb') . 'Kb; ')); |
|
| 254 | + $upload_tray->addElement(new \XoopsFormLabel('<br><br>'._MD_NEWBB_MAX_FILESIZE.':', $forumObject->getVar('attach_maxkb').'Kb; ')); |
|
| 255 | 255 | $extensions = trim(str_replace('|', ' ', $forumObject->getVar('attach_ext'))); |
| 256 | 256 | $extensions = (empty($extensions) || '*' === $extensions) ? _ALL : $extensions; |
| 257 | - $upload_tray->addElement(new \XoopsFormLabel(_MD_NEWBB_ALLOWED_EXTENSIONS . ':', $extensions)); |
|
| 258 | - $upload_tray->addElement(new \XoopsFormLabel('<br>' . sprintf(_MD_NEWBB_MAXPIC, $GLOBALS['xoopsModuleConfig']['max_img_height'], $GLOBALS['xoopsModuleConfig']['max_img_width']))); |
|
| 257 | + $upload_tray->addElement(new \XoopsFormLabel(_MD_NEWBB_ALLOWED_EXTENSIONS.':', $extensions)); |
|
| 258 | + $upload_tray->addElement(new \XoopsFormLabel('<br>'.sprintf(_MD_NEWBB_MAXPIC, $GLOBALS['xoopsModuleConfig']['max_img_height'], $GLOBALS['xoopsModuleConfig']['max_img_width']))); |
|
| 259 | 259 | $forum_form->addElement($upload_tray); |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if (!empty($attachments) && is_array($attachments) && count($attachments)) { |
| 263 | 263 | $delete_attach_checkbox = new \XoopsFormCheckBox(_MD_NEWBB_THIS_FILE_WAS_ATTACHED_TO_THIS_POST, 'delete_attach[]'); |
| 264 | 264 | foreach ($attachments as $key => $attachment) { |
| 265 | - $attach = ' ' . _DELETE . ' <a href=' . XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachment['name_saved'] . ' rel="external">' . $attachment['nameDisplay'] . '</a><br>'; |
|
| 265 | + $attach = ' '._DELETE.' <a href='.XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['dir_attachments'].'/'.$attachment['name_saved'].' rel="external">'.$attachment['nameDisplay'].'</a><br>'; |
|
| 266 | 266 | $delete_attach_checkbox->addOption($key, $attach); |
| 267 | 267 | } |
| 268 | 268 | $forum_form->addElement($delete_attach_checkbox); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $delete_attach_checkbox = new \XoopsFormCheckBox(_MD_NEWBB_REMOVE, 'delete_tmp[]'); |
| 274 | 274 | $url_prefix = str_replace(XOOPS_ROOT_PATH, XOOPS_URL, XOOPS_CACHE_PATH); |
| 275 | 275 | foreach ($attachments_tmp as $key => $attachment) { |
| 276 | - $attach = ' <a href="' . $url_prefix . '/' . $attachment[0] . '" rel="external">' . $attachment[1] . '</a><br>'; |
|
| 276 | + $attach = ' <a href="'.$url_prefix.'/'.$attachment[0].'" rel="external">'.$attachment[1].'</a><br>'; |
|
| 277 | 277 | $delete_attach_checkbox->addOption($key, $attach); |
| 278 | 278 | } |
| 279 | 279 | $forum_form->addElement($delete_attach_checkbox); |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | $karma_select = new \XoopsFormSelect('', 'post_karma', $post_karma); |
| 298 | 298 | $karma_select->addOptionArray($karma_array); |
| 299 | - $radiobox->addOption('require_karma', _MD_NEWBB_REQUIRE_KARMA . $karma_select->render()); |
|
| 299 | + $radiobox->addOption('require_karma', _MD_NEWBB_REQUIRE_KARMA.$karma_select->render()); |
|
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | $radiobox->addOption('require_null', _MD_NEWBB_REQUIRE_NULL); |
@@ -327,11 +327,11 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | $cancel_button = new \XoopsFormButton('', 'cancel', _CANCEL, 'button'); |
| 329 | 329 | if (!empty($topic_id)) { |
| 330 | - $extra = XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . (int)$topic_id; |
|
| 330 | + $extra = XOOPS_URL.'/modules/newbb/viewtopic.php?topic_id='.(int)$topic_id; |
|
| 331 | 331 | } else { |
| 332 | - $extra = XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $forumObject->getVar('forum_id'); |
|
| 332 | + $extra = XOOPS_URL.'/modules/newbb/viewforum.php?forum='.$forumObject->getVar('forum_id'); |
|
| 333 | 333 | } |
| 334 | -$cancel_button->setExtra("onclick='location=\"" . $extra . "\"'"); |
|
| 334 | +$cancel_button->setExtra("onclick='location=\"".$extra."\"'"); |
|
| 335 | 335 | $cancel_button->setExtra("tabindex='6'"); |
| 336 | 336 | |
| 337 | 337 | if (!empty($isreply) && !empty($hidden)) { |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | $preview_button = new \XoopsFormButton('', 'btn_preview', _PREVIEW, 'button'); |
| 347 | 347 | $preview_button->setExtra("tabindex='5'"); |
| 348 | -$preview_button->setExtra('onclick="window.document.forms.' . $forum_form->getName() . '.contents_preview.value=1; window.document.forms.' . $forum_form->getName() . '.submit() ;"'); |
|
| 348 | +$preview_button->setExtra('onclick="window.document.forms.'.$forum_form->getName().'.contents_preview.value=1; window.document.forms.'.$forum_form->getName().'.submit() ;"'); |
|
| 349 | 349 | $forum_form->addElement(new \XoopsFormHidden('contents_preview', 0)); |
| 350 | 350 | |
| 351 | 351 | $button_tray->addElement($preview_button); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
| 13 | 13 | |
| 14 | -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; |
|
| 14 | +defined('NEWBB_FUNCTIONS_INI') || include __DIR__.'/functions.ini.php'; |
|
| 15 | 15 | define('NEWBB_FUNCTIONS_TOPIC_LOADED', true); |
| 16 | 16 | |
| 17 | 17 | if (!defined('NEWBB_FUNCTIONS_TOPIC')) { |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | if (empty($prefixName)) { |
| 43 | 43 | return $topicTitle; |
| 44 | 44 | } |
| 45 | - $topicPrefix = $prefixColor ? '<em style="font-style: normal; color: ' . $prefixColor . ';">[' . $prefixName . ']</em> ' : '[' . $prefixName . '] '; |
|
| 45 | + $topicPrefix = $prefixColor ? '<em style="font-style: normal; color: '.$prefixColor.';">['.$prefixName.']</em> ' : '['.$prefixName.'] '; |
|
| 46 | 46 | |
| 47 | - return $topicPrefix . $topicTitle; |
|
| 47 | + return $topicPrefix.$topicTitle; |
|
| 48 | 48 | } |
| 49 | 49 | } |
@@ -39,24 +39,24 @@ discard block |
||
| 39 | 39 | function newbbAttachmentImage($source) |
| 40 | 40 | { |
| 41 | 41 | $img_path = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments']); |
| 42 | - $img_url = XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments']; |
|
| 43 | - $thumb_path = $img_path . '/thumbs'; |
|
| 44 | - $thumb_url = $img_url . '/thumbs'; |
|
| 42 | + $img_url = XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['dir_attachments']; |
|
| 43 | + $thumb_path = $img_path.'/thumbs'; |
|
| 44 | + $thumb_url = $img_url.'/thumbs'; |
|
| 45 | 45 | |
| 46 | - $thumb = $thumb_path . '/' . $source; |
|
| 47 | - $image = $img_path . '/' . $source; |
|
| 48 | - $thumb_url = $thumb_url . '/' . $source; |
|
| 49 | - $image_url = $img_url . '/' . $source; |
|
| 46 | + $thumb = $thumb_path.'/'.$source; |
|
| 47 | + $image = $img_path.'/'.$source; |
|
| 48 | + $thumb_url = $thumb_url.'/'.$source; |
|
| 49 | + $image_url = $img_url.'/'.$source; |
|
| 50 | 50 | |
| 51 | 51 | $imginfo = @getimagesize($image); |
| 52 | - $img_info = (count($imginfo) > 0) ? $imginfo[0] . 'X' . $imginfo[1] . ' px' : ''; |
|
| 52 | + $img_info = (count($imginfo) > 0) ? $imginfo[0].'X'.$imginfo[1].' px' : ''; |
|
| 53 | 53 | |
| 54 | 54 | if ($GLOBALS['xoopsModuleConfig']['max_image_width'] > 0 |
| 55 | 55 | && $GLOBALS['xoopsModuleConfig']['max_image_height'] > 0) { |
| 56 | 56 | if ($imginfo[0] > $GLOBALS['xoopsModuleConfig']['max_image_width'] |
| 57 | 57 | || $imginfo[1] > $GLOBALS['xoopsModuleConfig']['max_image_height']) { |
| 58 | 58 | //if (!file_exists($thumb_path.'/'.$source) && $imginfo[0] > $GLOBALS['xoopsModuleConfig']['max_img_width']) { |
| 59 | - if (!file_exists($thumb_path . '/' . $source)) { |
|
| 59 | + if (!file_exists($thumb_path.'/'.$source)) { |
|
| 60 | 60 | newbbCreateThumbnail($source, $GLOBALS['xoopsModuleConfig']['max_image_width']); |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -65,28 +65,28 @@ discard block |
||
| 65 | 65 | || $imginfo[1] > $GLOBALS['xoopsModuleConfig']['max_image_height']) { |
| 66 | 66 | $pseudo_width = $GLOBALS['xoopsModuleConfig']['max_image_width']; |
| 67 | 67 | $pseudo_height = $GLOBALS['xoopsModuleConfig']['max_image_width'] * ($imginfo[1] / $imginfo[0]); |
| 68 | - $pseudo_size = "width='" . $pseudo_width . "px' height='" . $pseudo_height . "px'"; |
|
| 68 | + $pseudo_size = "width='".$pseudo_width."px' height='".$pseudo_height."px'"; |
|
| 69 | 69 | } |
| 70 | 70 | // irmtfan to fix Undefined variable: pseudo_height |
| 71 | 71 | if (!empty($pseudo_height) && $GLOBALS['xoopsModuleConfig']['max_image_height'] > 0 |
| 72 | 72 | && $pseudo_height > $GLOBALS['xoopsModuleConfig']['max_image_height']) { |
| 73 | 73 | $pseudo_height = $GLOBALS['xoopsModuleConfig']['max_image_height']; |
| 74 | 74 | $pseudo_width = $GLOBALS['xoopsModuleConfig']['max_image_height'] * ($imginfo[0] / $imginfo[1]); |
| 75 | - $pseudo_size = "width='" . $pseudo_width . "px' height='" . $pseudo_height . "px'"; |
|
| 75 | + $pseudo_size = "width='".$pseudo_width."px' height='".$pseudo_height."px'"; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if (file_exists($thumb)) { |
| 80 | - $attachmentImage = '<a href="' . $image_url . '" title="' . $source . ' ' . $img_info . '" target="_blank">'; |
|
| 80 | + $attachmentImage = '<a href="'.$image_url.'" title="'.$source.' '.$img_info.'" target="_blank">'; |
|
| 81 | 81 | // $attachmentImage .= '<img src="' . $thumb_url . '" alt="' . $source . ' ' . $img_info . '" />'; |
| 82 | - $attachmentImage .= '<img src="' . $image_url . '" ' . $pseudo_size . ' alt="' . $source . ' ' . $img_info . '" />'; |
|
| 82 | + $attachmentImage .= '<img src="'.$image_url.'" '.$pseudo_size.' alt="'.$source.' '.$img_info.'" />'; |
|
| 83 | 83 | $attachmentImage .= '</a>'; |
| 84 | 84 | } elseif (!empty($pseudo_size)) { |
| 85 | - $attachmentImage = '<a href="' . $image_url . '" title="' . $source . ' ' . $img_info . '" target="_blank">'; |
|
| 86 | - $attachmentImage .= '<img src="' . $image_url . '" ' . $pseudo_size . ' alt="' . $source . ' ' . $img_info . '" />'; |
|
| 85 | + $attachmentImage = '<a href="'.$image_url.'" title="'.$source.' '.$img_info.'" target="_blank">'; |
|
| 86 | + $attachmentImage .= '<img src="'.$image_url.'" '.$pseudo_size.' alt="'.$source.' '.$img_info.'" />'; |
|
| 87 | 87 | $attachmentImage .= '</a>'; |
| 88 | 88 | } elseif (file_exists($image)) { |
| 89 | - $attachmentImage = '<img src="' . $image_url . '" alt="' . $source . ' ' . $img_info . '" />'; |
|
| 89 | + $attachmentImage = '<img src="'.$image_url.'" alt="'.$source.' '.$img_info.'" />'; |
|
| 90 | 90 | } else { |
| 91 | 91 | $attachmentImage = ''; |
| 92 | 92 | } |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $cmd = ''; |
| 105 | 105 | $img_path = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments']); |
| 106 | - $thumb_path = $img_path . '/thumbs'; |
|
| 107 | - $src_file = $img_path . '/' . $source; |
|
| 108 | - $new_file = $thumb_path . '/' . $source; |
|
| 106 | + $thumb_path = $img_path.'/thumbs'; |
|
| 107 | + $src_file = $img_path.'/'.$source; |
|
| 108 | + $new_file = $thumb_path.'/'.$source; |
|
| 109 | 109 | //$imageLibs = newbb_getImageLibs(); |
| 110 | 110 | |
| 111 | 111 | if (!filesize($src_file) || !is_readable($src_file)) { |
@@ -131,14 +131,14 @@ discard block |
||
| 131 | 131 | if (1 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) { |
| 132 | 132 | if (preg_match("#[A-Z]:|\\\\#Ai", __FILE__)) { |
| 133 | 133 | $cur_dir = __DIR__; |
| 134 | - $src_file_im = '"' . $cur_dir . '\\' . str_replace('/', '\\', $src_file) . '"'; |
|
| 135 | - $new_file_im = '"' . $cur_dir . '\\' . str_replace('/', '\\', $new_file) . '"'; |
|
| 134 | + $src_file_im = '"'.$cur_dir.'\\'.str_replace('/', '\\', $src_file).'"'; |
|
| 135 | + $new_file_im = '"'.$cur_dir.'\\'.str_replace('/', '\\', $new_file).'"'; |
|
| 136 | 136 | } else { |
| 137 | 137 | $src_file_im = @escapeshellarg($src_file); |
| 138 | 138 | $new_file_im = @escapeshellarg($new_file); |
| 139 | 139 | } |
| 140 | - $path = empty($GLOBALS['xoopsModuleConfig']['path_magick']) ? '' : $GLOBALS['xoopsModuleConfig']['path_magick'] . '/'; |
|
| 141 | - $magick_command = $path . 'convert -quality 85 -antialias -sample ' . $newWidth . 'x' . $newHeight . ' ' . $src_file_im . ' +profile "*" ' . str_replace('\\', '/', $new_file_im) . ''; |
|
| 140 | + $path = empty($GLOBALS['xoopsModuleConfig']['path_magick']) ? '' : $GLOBALS['xoopsModuleConfig']['path_magick'].'/'; |
|
| 141 | + $magick_command = $path.'convert -quality 85 -antialias -sample '.$newWidth.'x'.$newHeight.' '.$src_file_im.' +profile "*" '.str_replace('\\', '/', $new_file_im).''; |
|
| 142 | 142 | |
| 143 | 143 | @passthru($magick_command); |
| 144 | 144 | if (file_exists($new_file)) { |
@@ -147,13 +147,13 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (2 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) { |
| 150 | - $path = empty($GLOBALS['xoopsModuleConfig']['path_netpbm']) ? '' : $GLOBALS['xoopsModuleConfig']['path_netpbm'] . '/'; |
|
| 150 | + $path = empty($GLOBALS['xoopsModuleConfig']['path_netpbm']) ? '' : $GLOBALS['xoopsModuleConfig']['path_netpbm'].'/'; |
|
| 151 | 151 | if (preg_match("/\.png/", $source)) { |
| 152 | - $cmd = $path . "pngtopnm $src_file | " . $path . "pnmscale -xysize $newWidth $newHeight | " . $path . "pnmtopng > $new_file"; |
|
| 152 | + $cmd = $path."pngtopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ".$path."pnmtopng > $new_file"; |
|
| 153 | 153 | } elseif (preg_match("/\.(jpg|jpeg)/", $source)) { |
| 154 | - $cmd = $path . "jpegtopnm $src_file | " . $path . "pnmscale -xysize $newWidth $newHeight | " . $path . "ppmtojpeg -quality=90 > $new_file"; |
|
| 154 | + $cmd = $path."jpegtopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ".$path."ppmtojpeg -quality=90 > $new_file"; |
|
| 155 | 155 | } elseif (preg_match("/\.gif/", $source)) { |
| 156 | - $cmd = $path . "giftopnm $src_file | " . $path . "pnmscale -xysize $newWidth $newHeight | ppmquant 256 | " . $path . "ppmtogif > $new_file"; |
|
| 156 | + $cmd = $path."giftopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ppmquant 256 | ".$path."ppmtogif > $new_file"; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | @exec($cmd, $output, $retval); |