@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public function listBlocks(): void |
| 69 | 69 | { |
| 70 | 70 | global $xoopsModule, $pathIcon16; |
| 71 | - require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
| 71 | + require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 72 | 72 | // xoops_loadLanguage('admin', 'system'); |
| 73 | 73 | // xoops_loadLanguage('admin/blocksadmin', 'system'); |
| 74 | 74 | // xoops_loadLanguage('admin/groups', 'system'); |
@@ -88,16 +88,16 @@ discard block |
||
| 88 | 88 | $moduleList[-1] = \_AM_SYSTEM_BLOCKS_TOPPAGE; |
| 89 | 89 | $moduleList[0] = \_AM_SYSTEM_BLOCKS_ALLPAGES; |
| 90 | 90 | \ksort($moduleList); |
| 91 | - echo "<h4 style='text-align:left;'>" . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'BADMIN') . '</h4>'; |
|
| 92 | - echo "<form action='" . $_SERVER['SCRIPT_NAME'] . "' name='blockadmin' method='post'>"; |
|
| 91 | + echo "<h4 style='text-align:left;'>".\constant('CO_'.$this->moduleDirNameUpper.'_'.'BADMIN').'</h4>'; |
|
| 92 | + echo "<form action='".$_SERVER['SCRIPT_NAME']."' name='blockadmin' method='post'>"; |
|
| 93 | 93 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
| 94 | 94 | echo "<table width='100%' class='outer' cellpadding='4' cellspacing='1'> |
| 95 | - <tr valign='middle'><th align='center'>" . \_AM_SYSTEM_BLOCKS_TITLE . "</th><th align='center' nowrap='nowrap'>" . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'SIDE') . '<br>' . _LEFT . '-' . _CENTER . '-' . _RIGHT . "</th> |
|
| 96 | - <th align='center'>" . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'WEIGHT') . "</th> |
|
| 97 | - <th align='center'>" . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'VISIBLE') . "</th><th align='center'>" . \_AM_SYSTEM_BLOCKS_VISIBLEIN . "</th> |
|
| 98 | - <th align='center'>" . \_AM_SYSTEM_ADGS . "</th> |
|
| 99 | - <th align='center'>" . \_AM_SYSTEM_BLOCKS_BCACHETIME . "</th> |
|
| 100 | - <th align='center'>" . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'ACTION') . '</th> |
|
| 95 | + <tr valign='middle'><th align='center'>" . \_AM_SYSTEM_BLOCKS_TITLE."</th><th align='center' nowrap='nowrap'>".\constant('CO_'.$this->moduleDirNameUpper.'_'.'SIDE').'<br>'._LEFT.'-'._CENTER.'-'._RIGHT."</th> |
|
| 96 | + <th align='center'>" . \constant('CO_'.$this->moduleDirNameUpper.'_'.'WEIGHT')."</th> |
|
| 97 | + <th align='center'>" . \constant('CO_'.$this->moduleDirNameUpper.'_'.'VISIBLE')."</th><th align='center'>".\_AM_SYSTEM_BLOCKS_VISIBLEIN."</th> |
|
| 98 | + <th align='center'>" . \_AM_SYSTEM_ADGS."</th> |
|
| 99 | + <th align='center'>" . \_AM_SYSTEM_BLOCKS_BCACHETIME."</th> |
|
| 100 | + <th align='center'>" . \constant('CO_'.$this->moduleDirNameUpper.'_'.'ACTION').'</th> |
|
| 101 | 101 | </tr>'; |
| 102 | 102 | $blockArray = \XoopsBlock::getByModule($xoopsModule->mid()); |
| 103 | 103 | $blockCount = \count($blockArray); |
@@ -117,14 +117,14 @@ discard block |
||
| 117 | 117 | ]; |
| 118 | 118 | foreach ($blockArray as $i) { |
| 119 | 119 | $groupsPermissions = $grouppermHandler->getGroupIds('block_read', $i->getVar('bid')); |
| 120 | - $sql = 'SELECT module_id FROM ' . $this->db->prefix('block_module_link') . ' WHERE block_id=' . $i->getVar('bid'); |
|
| 120 | + $sql = 'SELECT module_id FROM '.$this->db->prefix('block_module_link').' WHERE block_id='.$i->getVar('bid'); |
|
| 121 | 121 | $result = $this->db->query($sql); |
| 122 | 122 | $modules = []; |
| 123 | 123 | if (!$result instanceof \mysqli_result) { |
| 124 | - \trigger_error("Query Failed! SQL: $sql Error: " . $this->db->error(), \E_USER_ERROR); |
|
| 124 | + \trigger_error("Query Failed! SQL: $sql Error: ".$this->db->error(), \E_USER_ERROR); |
|
| 125 | 125 | } |
| 126 | 126 | while (false !== ($row = $this->db->fetchArray($result))) { |
| 127 | - $modules[] = (int)$row['module_id']; |
|
| 127 | + $modules[] = (int) $row['module_id']; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $cachetimeOptions = ''; |
@@ -174,46 +174,46 @@ discard block |
||
| 174 | 174 | $title = $i->getVar('title'); |
| 175 | 175 | } |
| 176 | 176 | $name = $i->getVar('name'); |
| 177 | - echo "<tr valign='top'><td class='$class' align='center'><input type='text' name='title[" . $i->getVar('bid') . "]' value='" . $title . "'></td> |
|
| 177 | + echo "<tr valign='top'><td class='$class' align='center'><input type='text' name='title[".$i->getVar('bid')."]' value='".$title."'></td> |
|
| 178 | 178 | <td class='$class' align='center' nowrap='nowrap'><div align='center' > |
| 179 | - <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_LEFT . "'$ssel2> |
|
| 180 | - <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_CENTER . "'$ssel3> |
|
| 181 | - <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_RIGHT . "'$ssel4> |
|
| 179 | + <input type='radio' name='side[".$i->getVar('bid')."]' value='".\XOOPS_CENTERBLOCK_LEFT."'$ssel2> |
|
| 180 | + <input type='radio' name='side[".$i->getVar('bid')."]' value='".\XOOPS_CENTERBLOCK_CENTER."'$ssel3> |
|
| 181 | + <input type='radio' name='side[".$i->getVar('bid')."]' value='".\XOOPS_CENTERBLOCK_RIGHT."'$ssel4> |
|
| 182 | 182 | </div> |
| 183 | 183 | <div> |
| 184 | - <span style='float:right;'><input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_SIDEBLOCK_RIGHT . "'$ssel1></span> |
|
| 185 | - <div align='left'><input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_SIDEBLOCK_LEFT . "'$ssel0></div> |
|
| 184 | + <span style='float:right;'><input type='radio' name='side[".$i->getVar('bid')."]' value='".\XOOPS_SIDEBLOCK_RIGHT."'$ssel1></span> |
|
| 185 | + <div align='left'><input type='radio' name='side[".$i->getVar('bid')."]' value='".\XOOPS_SIDEBLOCK_LEFT."'$ssel0></div> |
|
| 186 | 186 | </div> |
| 187 | 187 | <div align='center'> |
| 188 | - <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_BOTTOMLEFT . "'$ssel5> |
|
| 189 | - <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_BOTTOM . "'$ssel7> |
|
| 190 | - <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_BOTTOMRIGHT . "'$ssel6> |
|
| 188 | + <input type='radio' name='side[".$i->getVar('bid')."]' value='".\XOOPS_CENTERBLOCK_BOTTOMLEFT."'$ssel5> |
|
| 189 | + <input type='radio' name='side[".$i->getVar('bid')."]' value='".\XOOPS_CENTERBLOCK_BOTTOM."'$ssel7> |
|
| 190 | + <input type='radio' name='side[".$i->getVar('bid')."]' value='".\XOOPS_CENTERBLOCK_BOTTOMRIGHT."'$ssel6> |
|
| 191 | 191 | </div> |
| 192 | 192 | </td> |
| 193 | - <td class='$class' align='center'><input type='text' name='weight[" . $i->getVar('bid') . "]' value='" . $i->getVar('weight') . "' size='5' maxlength='5'></td> |
|
| 194 | - <td class='$class' align='center' nowrap><input type='radio' name='visible[" . $i->getVar('bid') . "]' value='1'$sel1>" . _YES . " <input type='radio' name='visible[" . $i->getVar('bid') . "]' value='0'$sel0>" . _NO . '</td>'; |
|
| 193 | + <td class='$class' align='center'><input type='text' name='weight[".$i->getVar('bid')."]' value='".$i->getVar('weight')."' size='5' maxlength='5'></td> |
|
| 194 | + <td class='$class' align='center' nowrap><input type='radio' name='visible[".$i->getVar('bid')."]' value='1'$sel1>"._YES." <input type='radio' name='visible[".$i->getVar('bid')."]' value='0'$sel0>"._NO.'</td>'; |
|
| 195 | 195 | |
| 196 | - echo "<td class='$class' align='center'><select size='5' name='bmodule[" . $i->getVar('bid') . "][]' id='bmodule[" . $i->getVar('bid') . "][]' multiple='multiple'>"; |
|
| 196 | + echo "<td class='$class' align='center'><select size='5' name='bmodule[".$i->getVar('bid')."][]' id='bmodule[".$i->getVar('bid')."][]' multiple='multiple'>"; |
|
| 197 | 197 | foreach ($moduleList as $k => $v) { |
| 198 | - echo "<option value='$k'" . (\in_array($k, $modules) ? " selected='selected'" : '') . ">$v</option>"; |
|
| 198 | + echo "<option value='$k'".(\in_array($k, $modules) ? " selected='selected'" : '').">$v</option>"; |
|
| 199 | 199 | } |
| 200 | 200 | echo '</select></td>'; |
| 201 | 201 | |
| 202 | - echo "<td class='$class' align='center'><select size='5' name='groups[" . $i->getVar('bid') . "][]' id='groups[" . $i->getVar('bid') . "][]' multiple='multiple'>"; |
|
| 202 | + echo "<td class='$class' align='center'><select size='5' name='groups[".$i->getVar('bid')."][]' id='groups[".$i->getVar('bid')."][]' multiple='multiple'>"; |
|
| 203 | 203 | foreach ($groups as $grp) { |
| 204 | - echo "<option value='" . $grp->getVar('groupid') . "' " . (\in_array($grp->getVar('groupid'), $groupsPermissions) ? " selected='selected'" : '') . '>' . $grp->getVar('name') . '</option>'; |
|
| 204 | + echo "<option value='".$grp->getVar('groupid')."' ".(\in_array($grp->getVar('groupid'), $groupsPermissions) ? " selected='selected'" : '').'>'.$grp->getVar('name').'</option>'; |
|
| 205 | 205 | } |
| 206 | 206 | echo '</select></td>'; |
| 207 | 207 | |
| 208 | 208 | // Cache lifetime |
| 209 | - echo '<td class="' . $class . '" align="center"> <select name="bcachetime[' . $i->getVar('bid') . ']" size="1">' . $cachetimeOptions . '</select> |
|
| 209 | + echo '<td class="'.$class.'" align="center"> <select name="bcachetime['.$i->getVar('bid').']" size="1">'.$cachetimeOptions.'</select> |
|
| 210 | 210 | </td>'; |
| 211 | 211 | |
| 212 | 212 | // Actions |
| 213 | 213 | |
| 214 | 214 | echo "<td class='$class' align='center'> |
| 215 | - <a href='blocksadmin.php?op=edit&bid=" . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/edit.png' . " alt='" . _EDIT . "' title='" . _EDIT . "'></a> |
|
| 216 | - <a href='blocksadmin.php?op=clone&bid=" . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/editcopy.png' . " alt='" . _CLONE . "' title='" . _CLONE . "'></a>"; |
|
| 215 | + <a href='blocksadmin.php?op=edit&bid=".$i->getVar('bid')."'><img src=".$pathIcon16.'/edit.png'." alt='"._EDIT."' title='"._EDIT."'></a> |
|
| 216 | + <a href='blocksadmin.php?op=clone&bid=" . $i->getVar('bid')."'><img src=".$pathIcon16.'/editcopy.png'." alt='"._CLONE."' title='"._CLONE."'></a>"; |
|
| 217 | 217 | // if ('S' !== $i->getVar('block_type') && 'M' !== $i->getVar('block_type')) { |
| 218 | 218 | // echo " <a href='" . XOOPS_URL . '/modules/system/admin.php?fct=blocksadmin&op=delete&bid=' . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/delete.png' . " alt='" . _DELETE . "' title='" . _DELETE . "'> |
| 219 | 219 | // </a>"; |
@@ -222,22 +222,22 @@ discard block |
||
| 222 | 222 | // if ('S' !== $i->getVar('block_type') && 'M' !== $i->getVar('block_type')) { |
| 223 | 223 | if (!\in_array($i->getVar('block_type'), ['M', 'S'])) { |
| 224 | 224 | echo " |
| 225 | - <a href='blocksadmin.php?op=delete&bid=" . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/delete.png' . " alt='" . _DELETE . "' title='" . _DELETE . "'> |
|
| 225 | + <a href='blocksadmin.php?op=delete&bid=" . $i->getVar('bid')."'><img src=".$pathIcon16.'/delete.png'." alt='"._DELETE."' title='"._DELETE."'> |
|
| 226 | 226 | </a>"; |
| 227 | 227 | } |
| 228 | 228 | echo " |
| 229 | - <input type='hidden' name='oldtitle[" . $i->getVar('bid') . "]' value='" . $i->getVar('title') . "'> |
|
| 230 | - <input type='hidden' name='oldside[" . $i->getVar('bid') . "]' value='" . $i->getVar('side') . "'> |
|
| 231 | - <input type='hidden' name='oldweight[" . $i->getVar('bid') . "]' value='" . $i->getVar('weight') . "'> |
|
| 232 | - <input type='hidden' name='oldvisible[" . $i->getVar('bid') . "]' value='" . $i->getVar('visible') . "'> |
|
| 233 | - <input type='hidden' name='oldgroups[" . $i->getVar('groups') . "]' value='" . $i->getVar('groups') . "'> |
|
| 234 | - <input type='hidden' name='oldbcachetime[" . $i->getVar('bid') . "]' value='" . $i->getVar('bcachetime') . "'> |
|
| 235 | - <input type='hidden' name='bid[" . $i->getVar('bid') . "]' value='" . $i->getVar('bid') . "'> |
|
| 229 | + <input type='hidden' name='oldtitle[" . $i->getVar('bid')."]' value='".$i->getVar('title')."'> |
|
| 230 | + <input type='hidden' name='oldside[" . $i->getVar('bid')."]' value='".$i->getVar('side')."'> |
|
| 231 | + <input type='hidden' name='oldweight[" . $i->getVar('bid')."]' value='".$i->getVar('weight')."'> |
|
| 232 | + <input type='hidden' name='oldvisible[" . $i->getVar('bid')."]' value='".$i->getVar('visible')."'> |
|
| 233 | + <input type='hidden' name='oldgroups[" . $i->getVar('groups')."]' value='".$i->getVar('groups')."'> |
|
| 234 | + <input type='hidden' name='oldbcachetime[" . $i->getVar('bid')."]' value='".$i->getVar('bcachetime')."'> |
|
| 235 | + <input type='hidden' name='bid[" . $i->getVar('bid')."]' value='".$i->getVar('bid')."'> |
|
| 236 | 236 | </td></tr> |
| 237 | 237 | "; |
| 238 | 238 | $class = ('even' === $class) ? 'odd' : 'even'; |
| 239 | 239 | } |
| 240 | - echo "<tr><td class='foot' align='center' colspan='8'> <input type='hidden' name='op' value='order'>" . $GLOBALS['xoopsSecurity']->getTokenHTML() . "<input type='submit' name='submit' value='" . _SUBMIT . "'></td></tr></table></form><br><br>"; |
|
| 240 | + echo "<tr><td class='foot' align='center' colspan='8'> <input type='hidden' name='op' value='order'>".$GLOBALS['xoopsSecurity']->getTokenHTML()."<input type='submit' name='submit' value='"._SUBMIT."'></td></tr></table></form><br><br>"; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | public function deleteBlock(int $bid): void |
@@ -268,18 +268,18 @@ discard block |
||
| 268 | 268 | \xoops_loadLanguage('admin/groups', 'system'); |
| 269 | 269 | |
| 270 | 270 | $myblock = new \XoopsBlock($bid); |
| 271 | - $sql = 'SELECT module_id FROM ' . $this->db->prefix('block_module_link') . ' WHERE block_id=' . $bid; |
|
| 271 | + $sql = 'SELECT module_id FROM '.$this->db->prefix('block_module_link').' WHERE block_id='.$bid; |
|
| 272 | 272 | $result = $this->db->query($sql); |
| 273 | 273 | $modules = []; |
| 274 | 274 | if ($result instanceof \mysqli_result) { |
| 275 | 275 | while (false !== ($row = $this->db->fetchArray($result))) { |
| 276 | - $modules[] = (int)$row['module_id']; |
|
| 276 | + $modules[] = (int) $row['module_id']; |
|
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | $isCustom = \in_array($myblock->getVar('block_type'), ['C', 'E']); |
| 280 | 280 | $block = [ |
| 281 | - 'title' => $myblock->getVar('title') . ' Clone', |
|
| 282 | - 'form_title' => \constant('CO_' . $this->moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK'), |
|
| 281 | + 'title' => $myblock->getVar('title').' Clone', |
|
| 282 | + 'form_title' => \constant('CO_'.$this->moduleDirNameUpper.'_'.'BLOCKS_CLONEBLOCK'), |
|
| 283 | 283 | 'name' => $myblock->getVar('name'), |
| 284 | 284 | 'side' => $myblock->getVar('side'), |
| 285 | 285 | 'weight' => $myblock->getVar('weight'), |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | 'template' => $myblock->getVar('template'), |
| 296 | 296 | 'options' => $myblock->getVar('options'), |
| 297 | 297 | ]; |
| 298 | - echo '<a href="blocksadmin.php">' . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'BADMIN') . '</a> <span style="font-weight:bold;">»»</span> ' . \_AM_SYSTEM_BLOCKS_CLONEBLOCK . '<br><br>'; |
|
| 298 | + echo '<a href="blocksadmin.php">'.\constant('CO_'.$this->moduleDirNameUpper.'_'.'BADMIN').'</a> <span style="font-weight:bold;">»»</span> '.\_AM_SYSTEM_BLOCKS_CLONEBLOCK.'<br><br>'; |
|
| 299 | 299 | // $form = new Blockform(); |
| 300 | 300 | // $form->render(); |
| 301 | 301 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | // $newid = $clone->store(); //see https://github.com/XOOPS/XoopsCore25/issues/1105 |
| 339 | 339 | if ($clone->store()) { |
| 340 | - $newid = $clone->id(); //get the id of the cloned block |
|
| 340 | + $newid = $clone->id(); //get the id of the cloned block |
|
| 341 | 341 | } |
| 342 | 342 | if (!$newid) { |
| 343 | 343 | // \xoops_cp_header(); |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | if ('' !== $clone->getVar('template')) { |
| 349 | 349 | /** @var \XoopsTplfileHandler $tplfileHandler */ |
| 350 | 350 | $tplfileHandler = \xoops_getHandler('tplfile'); |
| 351 | - $btemplate = $tplfileHandler->find($GLOBALS['xoopsConfig']['template_set'], 'block', (string)$bid); |
|
| 351 | + $btemplate = $tplfileHandler->find($GLOBALS['xoopsConfig']['template_set'], 'block', (string) $bid); |
|
| 352 | 352 | if (\count($btemplate) > 0) { |
| 353 | 353 | $tplclone = $btemplate[0]->xoopsClone(); |
| 354 | 354 | $tplclone->setVar('tpl_id', 0); |
@@ -358,12 +358,12 @@ discard block |
||
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | foreach ($bmodule as $bmid) { |
| 361 | - $sql = 'INSERT INTO ' . $this->db->prefix('block_module_link') . ' (block_id, module_id) VALUES (' . $newid . ', ' . $bmid . ')'; |
|
| 361 | + $sql = 'INSERT INTO '.$this->db->prefix('block_module_link').' (block_id, module_id) VALUES ('.$newid.', '.$bmid.')'; |
|
| 362 | 362 | $this->db->query($sql); |
| 363 | 363 | } |
| 364 | 364 | //$groups = &$GLOBALS['xoopsUser']->getGroups(); |
| 365 | 365 | foreach ($groups as $iValue) { |
| 366 | - $sql = 'INSERT INTO ' . $this->db->prefix('group_permission') . ' (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (' . $iValue . ', ' . $newid . ", 1, 'block_read')"; |
|
| 366 | + $sql = 'INSERT INTO '.$this->db->prefix('group_permission').' (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES ('.$iValue.', '.$newid.", 1, 'block_read')"; |
|
| 367 | 367 | $this->db->query($sql); |
| 368 | 368 | } |
| 369 | 369 | $this->helper->redirect('admin/blocksadmin.php?op=list', 1, _AM_DBUPDATED); |
@@ -392,12 +392,12 @@ discard block |
||
| 392 | 392 | \xoops_loadLanguage('admin/groups', 'system'); |
| 393 | 393 | // mpu_adm_menu(); |
| 394 | 394 | $myblock = new \XoopsBlock($bid); |
| 395 | - $sql = 'SELECT module_id FROM ' . $this->db->prefix('block_module_link') . ' WHERE block_id=' . $bid; |
|
| 395 | + $sql = 'SELECT module_id FROM '.$this->db->prefix('block_module_link').' WHERE block_id='.$bid; |
|
| 396 | 396 | $result = $this->db->query($sql); |
| 397 | 397 | $modules = []; |
| 398 | 398 | if ($result instanceof \mysqli_result) { |
| 399 | 399 | while (false !== ($row = $this->db->fetchArray($result))) { |
| 400 | - $modules[] = (int)$row['module_id']; |
|
| 400 | + $modules[] = (int) $row['module_id']; |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | $isCustom = \in_array($myblock->getVar('block_type'), ['C', 'E']); |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | 'template' => $myblock->getVar('template'), |
| 420 | 420 | 'options' => $myblock->getVar('options'), |
| 421 | 421 | ]; |
| 422 | - echo '<a href="blocksadmin.php">' . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'BADMIN') . '</a> <span style="font-weight:bold;">»»</span> ' . \_AM_SYSTEM_BLOCKS_EDITBLOCK . '<br><br>'; |
|
| 422 | + echo '<a href="blocksadmin.php">'.\constant('CO_'.$this->moduleDirNameUpper.'_'.'BADMIN').'</a> <span style="font-weight:bold;">»»</span> '.\_AM_SYSTEM_BLOCKS_EDITBLOCK.'<br><br>'; |
|
| 423 | 423 | |
| 424 | 424 | echo $this->render($block); |
| 425 | 425 | } |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | $this->db->query($sql); |
| 460 | 460 | } else { |
| 461 | 461 | foreach ($bmodule as $bmid) { |
| 462 | - $sql = \sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (%u, %d)', $this->db->prefix('block_module_link'), $bid, (int)$bmid); |
|
| 462 | + $sql = \sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (%u, %d)', $this->db->prefix('block_module_link'), $bid, (int) $bmid); |
|
| 463 | 463 | $this->db->query($sql); |
| 464 | 464 | } |
| 465 | 465 | } |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $this->db->query($sql); |
| 473 | 473 | } |
| 474 | 474 | } |
| 475 | - $this->helper->redirect('admin/blocksadmin.php', 1, \constant('CO_' . $this->moduleDirNameUpper . '_' . 'UPDATE_SUCCESS')); |
|
| 475 | + $this->helper->redirect('admin/blocksadmin.php', 1, \constant('CO_'.$this->moduleDirNameUpper.'_'.'UPDATE_SUCCESS')); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | public function orderBlock( |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | $this->db->query($sql); |
| 499 | 499 | } else { |
| 500 | 500 | foreach ($bmodule[$i] as $bmid) { |
| 501 | - $sql = \sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (%u, %d)', $this->db->prefix('block_module_link'), $bid[$i], (int)$bmid); |
|
| 501 | + $sql = \sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (%u, %d)', $this->db->prefix('block_module_link'), $bid[$i], (int) $bmid); |
|
| 502 | 502 | $this->db->query($sql); |
| 503 | 503 | } |
| 504 | 504 | } |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - $this->helper->redirect('admin/blocksadmin.php', 1, \constant('CO_' . $this->moduleDirNameUpper . '_' . 'UPDATE_SUCCESS')); |
|
| 516 | + $this->helper->redirect('admin/blocksadmin.php', 1, \constant('CO_'.$this->moduleDirNameUpper.'_'.'UPDATE_SUCCESS')); |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | public function render(?array $block = null) |
@@ -537,9 +537,9 @@ discard block |
||
| 537 | 537 | 9 => \_AM_SYSTEM_BLOCKS_CBBOTTOM, |
| 538 | 538 | ]); |
| 539 | 539 | $form->addElement($sideSelect); |
| 540 | - $form->addElement(new \XoopsFormText(\constant('CO_' . $this->moduleDirNameUpper . '_' . 'WEIGHT'), 'bweight', 2, 5, $block['weight'])); |
|
| 541 | - $form->addElement(new \XoopsFormRadioYN(\constant('CO_' . $this->moduleDirNameUpper . '_' . 'VISIBLE'), 'bvisible', $block['visible'])); |
|
| 542 | - $modSelect = new \XoopsFormSelect(\constant('CO_' . $this->moduleDirNameUpper . '_' . 'VISIBLEIN'), 'bmodule', $block['modules'], 5, true); |
|
| 540 | + $form->addElement(new \XoopsFormText(\constant('CO_'.$this->moduleDirNameUpper.'_'.'WEIGHT'), 'bweight', 2, 5, $block['weight'])); |
|
| 541 | + $form->addElement(new \XoopsFormRadioYN(\constant('CO_'.$this->moduleDirNameUpper.'_'.'VISIBLE'), 'bvisible', $block['visible'])); |
|
| 542 | + $modSelect = new \XoopsFormSelect(\constant('CO_'.$this->moduleDirNameUpper.'_'.'VISIBLEIN'), 'bmodule', $block['modules'], 5, true); |
|
| 543 | 543 | /** @var \XoopsModuleHandler $moduleHandler */ |
| 544 | 544 | $moduleHandler = \xoops_getHandler('module'); |
| 545 | 545 | $criteria = new \CriteriaCompo(new \Criteria('hasmain', '1')); |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | $form->addElement(new \XoopsFormText(\_AM_SYSTEM_BLOCKS_TITLE, 'btitle', 50, 255, $block['title']), false); |
| 554 | 554 | if ($block['is_custom']) { |
| 555 | 555 | $textarea = new \XoopsFormDhtmlTextArea(\_AM_SYSTEM_BLOCKS_CONTENT, 'bcontent', $block['content'], 15, 70); |
| 556 | - $textarea->setDescription('<span style="font-size:x-small;font-weight:bold;">' . \_AM_SYSTEM_BLOCKS_USEFULTAGS . '</span><br><span style="font-size:x-small;font-weight:normal;">' . \sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL . '/') . '</span>'); |
|
| 556 | + $textarea->setDescription('<span style="font-size:x-small;font-weight:bold;">'.\_AM_SYSTEM_BLOCKS_USEFULTAGS.'</span><br><span style="font-size:x-small;font-weight:normal;">'.\sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL.'/').'</span>'); |
|
| 557 | 557 | $form->addElement($textarea, true); |
| 558 | 558 | $ctypeSelect = new \XoopsFormSelect(\_AM_SYSTEM_BLOCKS_CTYPE, 'bctype', $block['ctype']); |
| 559 | 559 | $ctypeSelect->addOptionArray([ |
@@ -569,11 +569,11 @@ discard block |
||
| 569 | 569 | $tplfileHandler = \xoops_getHandler('tplfile'); |
| 570 | 570 | $btemplate = $tplfileHandler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block['bid']); |
| 571 | 571 | if (\count($btemplate) > 0) { |
| 572 | - $form->addElement(new \XoopsFormLabel(\_AM_SYSTEM_BLOCKS_CONTENT, '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=tplsets&op=edittpl&id=' . $btemplate[0]->getVar('tpl_id') . '">' . \_AM_SYSTEM_BLOCKS_EDITTPL . '</a>')); |
|
| 572 | + $form->addElement(new \XoopsFormLabel(\_AM_SYSTEM_BLOCKS_CONTENT, '<a href="'.XOOPS_URL.'/modules/system/admin.php?fct=tplsets&op=edittpl&id='.$btemplate[0]->getVar('tpl_id').'">'.\_AM_SYSTEM_BLOCKS_EDITTPL.'</a>')); |
|
| 573 | 573 | } else { |
| 574 | 574 | $btemplate2 = $tplfileHandler->find('default', 'block', $block['bid']); |
| 575 | 575 | if (\count($btemplate2) > 0) { |
| 576 | - $form->addElement(new \XoopsFormLabel(\_AM_SYSTEM_BLOCKS_CONTENT, '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=tplsets&op=edittpl&id=' . $btemplate2[0]->getVar('tpl_id') . '" target="_blank">' . \_AM_SYSTEM_BLOCKS_EDITTPL . '</a>')); |
|
| 576 | + $form->addElement(new \XoopsFormLabel(\_AM_SYSTEM_BLOCKS_CONTENT, '<a href="'.XOOPS_URL.'/modules/system/admin.php?fct=tplsets&op=edittpl&id='.$btemplate2[0]->getVar('tpl_id').'" target="_blank">'.\_AM_SYSTEM_BLOCKS_EDITTPL.'</a>')); |
|
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | 579 | } |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | if ($considerHtml) { |
| 61 | 61 | // if the plain text is shorter than the maximum length, return the whole text |
| 62 | - if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) { |
|
| 62 | + if (mb_strlen(\preg_replace('/<.*?'.'>/', '', $text)) <= $length) { |
|
| 63 | 63 | return $text; |
| 64 | 64 | } |
| 65 | 65 | // splits all html-tags to scanable lines |
| 66 | - \preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, \PREG_SET_ORDER); |
|
| 66 | + \preg_match_all('/(<.+?'.'>)?([^<>]*)/s', $text, $lines, \PREG_SET_ORDER); |
|
| 67 | 67 | $total_length = mb_strlen($ending); |
| 68 | 68 | $open_tags = []; |
| 69 | 69 | $truncate = ''; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | unset($open_tags[$pos]); |
| 82 | 82 | } |
| 83 | 83 | // if tag is an opening tag |
| 84 | - } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { |
|
| 84 | + } elseif (\preg_match('/^<\s*([^\s>!]+).*?'.'>$/s', $line_matchings[1], $tag_matchings)) { |
|
| 85 | 85 | // add tag to the beginning of $open_tags list |
| 86 | 86 | \array_unshift($open_tags, \mb_strtolower($tag_matchings[1])); |
| 87 | 87 | } |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | // calculate the length of the plain text part of the line; handle entities as one character |
| 92 | 92 | $content_length = mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); |
| 93 | - if ($total_length + $content_length > $length) { |
|
| 93 | + if ($total_length+$content_length > $length) { |
|
| 94 | 94 | // the number of characters which are left |
| 95 | - $left = $length - $total_length; |
|
| 95 | + $left = $length-$total_length; |
|
| 96 | 96 | $entities_length = 0; |
| 97 | 97 | // search for html entities |
| 98 | 98 | if (\preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, \PREG_OFFSET_CAPTURE)) { |
| 99 | 99 | // calculate the real length of all entities in the legal range |
| 100 | 100 | foreach ($entities[0] as $entity) { |
| 101 | - if ($left >= $entity[1] + 1 - $entities_length) { |
|
| 101 | + if ($left >= $entity[1]+1-$entities_length) { |
|
| 102 | 102 | $left--; |
| 103 | 103 | $entities_length += mb_strlen($entity[0]); |
| 104 | 104 | } else { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | - $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length); |
|
| 110 | + $truncate .= mb_substr($line_matchings[2], 0, $left+$entities_length); |
|
| 111 | 111 | // maximum lenght is reached, so get off the loop |
| 112 | 112 | break; |
| 113 | 113 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | if (mb_strlen($text) <= $length) { |
| 124 | 124 | return $text; |
| 125 | 125 | } |
| 126 | - $truncate = mb_substr($text, 0, $length - mb_strlen($ending)); |
|
| 126 | + $truncate = mb_substr($text, 0, $length-mb_strlen($ending)); |
|
| 127 | 127 | } |
| 128 | 128 | // if the words shouldn't be cut in the middle... |
| 129 | 129 | if (!$exact) { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | if ($considerHtml) { |
| 140 | 140 | // close all unclosed html-tags |
| 141 | 141 | foreach ($open_tags as $tag) { |
| 142 | - $truncate .= '</' . $tag . '>'; |
|
| 142 | + $truncate .= '</'.$tag.'>'; |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $new_id = false; |
| 210 | 210 | $table = $GLOBALS['xoopsDB']->prefix($tableName); |
| 211 | 211 | // copy content of the record you wish to clone |
| 212 | - $sql = "SELECT * FROM $table WHERE $idField='" . $id . "' "; |
|
| 212 | + $sql = "SELECT * FROM $table WHERE $idField='".$id."' "; |
|
| 213 | 213 | $result = $GLOBALS['xoopsDB']->query($sql); |
| 214 | 214 | if ($result instanceof \mysqli_result) { |
| 215 | 215 | $tempTable = $GLOBALS['xoopsDB']->fetchArray($result, \MYSQLI_ASSOC); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | // set the auto-incremented id's value to blank. |
| 221 | 221 | unset($tempTable[$id_field]); |
| 222 | 222 | // insert cloned copy of the original record |
| 223 | - $sql = "INSERT INTO $table (" . \implode(', ', \array_keys($tempTable)) . ") VALUES ('" . \implode("', '", \array_values($tempTable)) . "')"; |
|
| 223 | + $sql = "INSERT INTO $table (".\implode(', ', \array_keys($tempTable)).") VALUES ('".\implode("', '", \array_values($tempTable))."')"; |
|
| 224 | 224 | $result = $GLOBALS['xoopsDB']->queryF($sql); |
| 225 | 225 | if (!$result) { |
| 226 | 226 | \trigger_error($GLOBALS['xoopsDB']->error()); |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * Copyright (c) Hervé Thouzard of Instant Zero (https://www.instant-zero.com) |
| 9 | 9 | * **************************************************************************** |
| 10 | 10 | */ |
| 11 | -require_once XOOPS_ROOT_PATH . '/kernel/object.php'; |
|
| 11 | +require_once XOOPS_ROOT_PATH.'/kernel/object.php'; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Class MyiframeBaseHandler |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public function get($id) |
| 37 | 37 | { |
| 38 | 38 | $ret = null; |
| 39 | - $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id; |
|
| 39 | + $sql = 'SELECT * FROM '.$this->db->prefix('myiframe').' WHERE frame_frameid='.(int) $id; |
|
| 40 | 40 | if (!$result = $this->db->query($sql)) { |
| 41 | 41 | return $ret; |
| 42 | 42 | } |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | { |
| 159 | 159 | $ret = []; |
| 160 | 160 | $limit = $start = 0; |
| 161 | - $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe'); |
|
| 161 | + $sql = 'SELECT * FROM '.$this->db->prefix('myiframe'); |
|
| 162 | 162 | if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { |
| 163 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 163 | + $sql .= ' '.$criteria->renderWhere(); |
|
| 164 | 164 | if ('' !== $criteria->getSort()) { |
| 165 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 165 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
| 166 | 166 | } |
| 167 | 167 | $limit = $criteria->getLimit(); |
| 168 | 168 | $start = $criteria->getStart(); |
@@ -187,9 +187,9 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public function getCount(\CriteriaCompo $criteria = null) |
| 189 | 189 | { |
| 190 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('myiframe'); |
|
| 190 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('myiframe'); |
|
| 191 | 191 | if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { |
| 192 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 192 | + $sql .= ' '.$criteria->renderWhere(); |
|
| 193 | 193 | } |
| 194 | 194 | $result = $this->db->query($sql); |
| 195 | 195 | if (!$result) { |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function deleteAll(\CriteriaCompo $criteria = null) |
| 208 | 208 | { |
| 209 | - $sql = 'DELETE FROM ' . $this->db->prefix('myiframe'); |
|
| 209 | + $sql = 'DELETE FROM '.$this->db->prefix('myiframe'); |
|
| 210 | 210 | if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { |
| 211 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 211 | + $sql .= ' '.$criteria->renderWhere(); |
|
| 212 | 212 | } |
| 213 | 213 | if (!$result = $this->db->query($sql)) { |
| 214 | 214 | return false; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function updatehits($frame_id): void |
| 224 | 224 | { |
| 225 | - $sql = \sprintf('UPDATE %s SET frame_hits = frame_hits+1 WHERE frame_frameid="%u"', $this->db->prefix('myiframe'), (int)$frame_id); |
|
| 225 | + $sql = \sprintf('UPDATE %s SET frame_hits = frame_hits+1 WHERE frame_frameid="%u"', $this->db->prefix('myiframe'), (int) $frame_id); |
|
| 226 | 226 | $this->db->queryF($sql); |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * Copyright (c) Hervé Thouzard of Instant Zero (https://www.instant-zero.com) |
| 9 | 9 | * **************************************************************************** |
| 10 | 10 | */ |
| 11 | -require_once XOOPS_ROOT_PATH . '/kernel/object.php'; |
|
| 11 | +require_once XOOPS_ROOT_PATH.'/kernel/object.php'; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Class Myiframe |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if (\is_array($id)) { |
| 43 | 43 | $this->assignVars($id); |
| 44 | 44 | } else { |
| 45 | - $this->load((int)$id); |
|
| 45 | + $this->load((int) $id); |
|
| 46 | 46 | } |
| 47 | 47 | } else { |
| 48 | 48 | $this->setNew(); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function load($id): void |
| 56 | 56 | { |
| 57 | - $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id; |
|
| 57 | + $sql = 'SELECT * FROM '.$this->db->prefix('myiframe').' WHERE frame_frameid='.(int) $id; |
|
| 58 | 58 | $myrow = $this->db->fetchArray($this->db->query($sql)); |
| 59 | 59 | $this->assignVars($myrow); |
| 60 | 60 | if (!$myrow) { |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined.'); |
| 10 | 10 | |
| 11 | -require_once __DIR__ . '/preloads/autoloader.php'; |
|
| 11 | +require_once __DIR__.'/preloads/autoloader.php'; |
|
| 12 | 12 | |
| 13 | 13 | $moduleDirName = \basename(__DIR__); |
| 14 | 14 | $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | if (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $modversion['dirname'] && $xoopsModule->getVar('isactive')) { |
| 74 | 74 | $i = 0; |
| 75 | - require_once XOOPS_ROOT_PATH . '/modules/myiframe/include/functions.php'; |
|
| 75 | + require_once XOOPS_ROOT_PATH.'/modules/myiframe/include/functions.php'; |
|
| 76 | 76 | $myts = \MyTextSanitizer::getInstance(); |
| 77 | 77 | if (myiframe_getmoduleoption('showinmenu')) { |
| 78 | - $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' ORDER BY frame_description'; |
|
| 78 | + $sql = 'SELECT * FROM '.$GLOBALS['xoopsDB']->prefix('myiframe').' ORDER BY frame_description'; |
|
| 79 | 79 | $result = $GLOBALS['xoopsDB']->query($sql); |
| 80 | 80 | while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
| 81 | 81 | if ('' !== xoops_trim($myrow['frame_description'])) { |
| 82 | 82 | $modversion['sub'][$i]['name'] = htmlspecialchars($myrow['frame_description']); |
| 83 | - $modversion['sub'][$i]['url'] = 'index.php?iframeid=' . (int)$myrow['frame_frameid']; |
|
| 83 | + $modversion['sub'][$i]['url'] = 'index.php?iframeid='.(int) $myrow['frame_frameid']; |
|
| 84 | 84 | $i++; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | // Make Sample button visible? |
| 108 | 108 | $modversion['config'][] = [ |
| 109 | 109 | 'name' => 'displaySampleButton', |
| 110 | - 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', |
|
| 111 | - 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', |
|
| 110 | + 'title' => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON', |
|
| 111 | + 'description' => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON_DESC', |
|
| 112 | 112 | 'formtype' => 'yesno', |
| 113 | 113 | 'valuetype' => 'int', |
| 114 | 114 | 'default' => 1, |