@@ -19,8 +19,8 @@ |
||
| 19 | 19 | class SmartFormUploadElement extends \XoopsFormFile |
| 20 | 20 | { |
| 21 | 21 | /** |
| 22 | - * @param $object |
|
| 23 | - * @param $key |
|
| 22 | + * @param string $object |
|
| 23 | + * @param string $key |
|
| 24 | 24 | */ |
| 25 | 25 | public function SmartFormFileElement($object, $key) |
| 26 | 26 | { |
@@ -164,7 +164,7 @@ |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | - * @param $field |
|
| 167 | + * @param string $field |
|
| 168 | 168 | * @return bool |
| 169 | 169 | */ |
| 170 | 170 | public function fieldExists($field) |
@@ -38,15 +38,15 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
| 40 | 40 | if (!defined('SMARTOBJECT_ROOT_PATH')) { |
| 41 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
| 41 | + require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
| 42 | 42 | } |
| 43 | 43 | /** |
| 44 | 44 | * Include the language constants for the SmartObjectDBUpdater |
| 45 | 45 | */ |
| 46 | 46 | global $xoopsConfig; |
| 47 | -$common_file = SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/smartdbupdater.php'; |
|
| 47 | +$common_file = SMARTOBJECT_ROOT_PATH.'language/'.$xoopsConfig['language'].'/smartdbupdater.php'; |
|
| 48 | 48 | if (!file_exists($common_file)) { |
| 49 | - $common_file = SMARTOBJECT_ROOT_PATH . 'language/english/smartdbupdater.php'; |
|
| 49 | + $common_file = SMARTOBJECT_ROOT_PATH.'language/english/smartdbupdater.php'; |
|
| 50 | 50 | } |
| 51 | 51 | include $common_file; |
| 52 | 52 | |
@@ -143,20 +143,20 @@ discard block |
||
| 143 | 143 | public function getExistingFieldsArray() |
| 144 | 144 | { |
| 145 | 145 | global $xoopsDB; |
| 146 | - $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $this->name()); |
|
| 146 | + $result = $xoopsDB->query('SHOW COLUMNS FROM '.$this->name()); |
|
| 147 | 147 | while (false !== ($existing_field = $xoopsDB->fetchArray($result))) { |
| 148 | 148 | $fields[$existing_field['Field']] = $existing_field['Type']; |
| 149 | 149 | if ('YES' !== $existing_field['Null']) { |
| 150 | 150 | $fields[$existing_field['Field']] .= ' NOT NULL'; |
| 151 | 151 | } |
| 152 | 152 | if ($existing_field['Extra']) { |
| 153 | - $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra']; |
|
| 153 | + $fields[$existing_field['Field']] .= ' '.$existing_field['Extra']; |
|
| 154 | 154 | } |
| 155 | 155 | if (!(null === $existing_field['Default']) |
| 156 | 156 | && ($existing_field['Default'] |
| 157 | 157 | || '' === $existing_field['Default'] |
| 158 | 158 | || 0 == $existing_field['Default'])) { |
| 159 | - $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'"; |
|
| 159 | + $fields[$existing_field['Field']] .= " default '".$existing_field['Default']."'"; |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | $query = sprintf('INSERT INTO %s VALUES (%s)', $this->name(), $data); |
| 243 | 243 | $ret = $xoopsDB->query($query); |
| 244 | 244 | if (!$ret) { |
| 245 | - echo ' ' . sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()) . '<br>'; |
|
| 245 | + echo ' '.sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()).'<br>'; |
|
| 246 | 246 | } else { |
| 247 | - echo ' ' . sprintf(_SDU_MSG_ADD_DATA, $this->name()) . '<br>'; |
|
| 247 | + echo ' '.sprintf(_SDU_MSG_ADD_DATA, $this->name()).'<br>'; |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
@@ -396,13 +396,13 @@ discard block |
||
| 396 | 396 | { |
| 397 | 397 | global $xoopsDB; |
| 398 | 398 | $query = $this->getStructure(); |
| 399 | - $query = 'CREATE TABLE `' . $this->name() . '` (' . $query . ") ENGINE=MyISAM COMMENT='The SmartFactory <www.smartfactory.ca>'"; |
|
| 399 | + $query = 'CREATE TABLE `'.$this->name().'` ('.$query.") ENGINE=MyISAM COMMENT='The SmartFactory <www.smartfactory.ca>'"; |
|
| 400 | 400 | //xoops_debug($query); |
| 401 | 401 | $ret = $xoopsDB->query($query); |
| 402 | 402 | if (!$ret) { |
| 403 | - echo ' ' . sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()) . ' (' . $xoopsDB->error() . ')<br>'; |
|
| 403 | + echo ' '.sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()).' ('.$xoopsDB->error().')<br>'; |
|
| 404 | 404 | } else { |
| 405 | - echo ' ' . sprintf(_SDU_MSG_CREATE_TABLE, $this->name()) . '<br>'; |
|
| 405 | + echo ' '.sprintf(_SDU_MSG_CREATE_TABLE, $this->name()).'<br>'; |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | return $ret; |
@@ -420,11 +420,11 @@ discard block |
||
| 420 | 420 | $query = sprintf('DROP TABLE %s', $this->name()); |
| 421 | 421 | $ret = $xoopsDB->query($query); |
| 422 | 422 | if (!$ret) { |
| 423 | - echo ' ' . sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()) . ' (' . $xoopsDB->error() . ')<br>'; |
|
| 423 | + echo ' '.sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()).' ('.$xoopsDB->error().')<br>'; |
|
| 424 | 424 | |
| 425 | 425 | return false; |
| 426 | 426 | } else { |
| 427 | - echo ' ' . sprintf(_SDU_MSG_DROP_TABLE, $this->name()) . '<br>'; |
|
| 427 | + echo ' '.sprintf(_SDU_MSG_DROP_TABLE, $this->name()).'<br>'; |
|
| 428 | 428 | |
| 429 | 429 | return true; |
| 430 | 430 | } |
@@ -450,9 +450,9 @@ discard block |
||
| 450 | 450 | $ret = $ret && $xoopsDB->query($query); |
| 451 | 451 | if ($alteredField['showerror']) { |
| 452 | 452 | if (!$ret) { |
| 453 | - echo ' ' . sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()) . ' (' . $xoopsDB->error() . ')<br>'; |
|
| 453 | + echo ' '.sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()).' ('.$xoopsDB->error().')<br>'; |
|
| 454 | 454 | } else { |
| 455 | - echo ' ' . sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()) . '<br>'; |
|
| 455 | + echo ' '.sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()).'<br>'; |
|
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | } |
@@ -475,9 +475,9 @@ discard block |
||
| 475 | 475 | //echo $query; |
| 476 | 476 | $ret = $ret && $xoopsDB->query($query); |
| 477 | 477 | if (!$ret) { |
| 478 | - echo ' ' . sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()) . '<br>'; |
|
| 478 | + echo ' '.sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()).'<br>'; |
|
| 479 | 479 | } else { |
| 480 | - echo ' ' . sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()) . '<br>'; |
|
| 480 | + echo ' '.sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()).'<br>'; |
|
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | |
@@ -498,9 +498,9 @@ discard block |
||
| 498 | 498 | $query = sprintf('UPDATE %s SET %s = %s', $this->name(), $updatedField['name'], $updatedField['value']); |
| 499 | 499 | $ret = $ret && $xoopsDB->query($query); |
| 500 | 500 | if (!$ret) { |
| 501 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . ' (' . $xoopsDB->error() . ')<br>'; |
|
| 501 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).' ('.$xoopsDB->error().')<br>'; |
|
| 502 | 502 | } else { |
| 503 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>'; |
|
| 503 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>'; |
|
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | 506 | |
@@ -521,9 +521,9 @@ discard block |
||
| 521 | 521 | //echo $query."<br>"; |
| 522 | 522 | $ret = $ret && $xoopsDB->query($query); |
| 523 | 523 | if (!$ret) { |
| 524 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . ' (' . $xoopsDB->error() . ')<br>'; |
|
| 524 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).' ('.$xoopsDB->error().')<br>'; |
|
| 525 | 525 | } else { |
| 526 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>'; |
|
| 526 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>'; |
|
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | 529 | |
@@ -544,9 +544,9 @@ discard block |
||
| 544 | 544 | $query = sprintf('ALTER TABLE %s DROP %s', $this->name(), $droppedField); |
| 545 | 545 | $ret = $ret && $xoopsDB->query($query); |
| 546 | 546 | if (!$ret) { |
| 547 | - echo ' ' . sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()) . ' (' . $xoopsDB->error() . ')<br>'; |
|
| 547 | + echo ' '.sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()).' ('.$xoopsDB->error().')<br>'; |
|
| 548 | 548 | } else { |
| 549 | - echo ' ' . sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()) . '<br>'; |
|
| 549 | + echo ' '.sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()).'<br>'; |
|
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * SmartObjectColumn constructor. |
| 36 | - * @param $keyname |
|
| 36 | + * @param string $keyname |
|
| 37 | 37 | * @param string $align |
| 38 | 38 | * @param bool $width |
| 39 | 39 | * @param bool $customMethodForValue |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * @param $smartObj |
| 129 | - * @param $objectid |
|
| 130 | - * @param $created_success_msg |
|
| 131 | - * @param $modified_success_msg |
|
| 129 | + * @param integer $objectid |
|
| 130 | + * @param string $created_success_msg |
|
| 131 | + * @param string $modified_success_msg |
|
| 132 | 132 | * @param bool $redirect_page |
| 133 | 133 | * @param bool $debug |
| 134 | 134 | * @return mixed |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | /** |
| 443 | - * @param $smartObj |
|
| 443 | + * @param SmartMlObject $smartObj |
|
| 444 | 444 | * @param bool $onlyUrl |
| 445 | 445 | * @param bool $withimage |
| 446 | 446 | * @return string |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | /** |
| 501 | - * @param $smartObj |
|
| 501 | + * @param BaseSmartObject $smartObj |
|
| 502 | 502 | * @return string |
| 503 | 503 | */ |
| 504 | 504 | public function getPrintAndMailLink($smartObj) |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | foreach (array_keys($smartObj->vars) as $key) { |
| 53 | 53 | switch ($smartObj->vars[$key]['data_type']) { |
| 54 | 54 | case XOBJ_DTYPE_IMAGE: |
| 55 | - if (isset($_POST['url_' . $key]) && '' !== $_POST['url_' . $key]) { |
|
| 56 | - $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e'); |
|
| 57 | - $smartObj->setVar($key, $_POST['url_' . $key]); |
|
| 55 | + if (isset($_POST['url_'.$key]) && '' !== $_POST['url_'.$key]) { |
|
| 56 | + $oldFile = $smartObj->getUploadDir(true).$smartObj->getVar($key, 'e'); |
|
| 57 | + $smartObj->setVar($key, $_POST['url_'.$key]); |
|
| 58 | 58 | if (file_exists($oldFile)) { |
| 59 | 59 | unlink($oldFile); |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | - if (isset($_POST['delete_' . $key]) && '1' == $_POST['delete_' . $key]) { |
|
| 63 | - $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e'); |
|
| 62 | + if (isset($_POST['delete_'.$key]) && '1' == $_POST['delete_'.$key]) { |
|
| 63 | + $oldFile = $smartObj->getUploadDir(true).$smartObj->getVar($key, 'e'); |
|
| 64 | 64 | $smartObj->setVar($key, ''); |
| 65 | 65 | if (file_exists($oldFile)) { |
| 66 | 66 | unlink($oldFile); |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | case XOBJ_DTYPE_URLLINK: |
| 72 | 72 | $linkObj = $smartObj->getUrlLinkObj($key); |
| 73 | - $linkObj->setVar('caption', $_POST['caption_' . $key]); |
|
| 74 | - $linkObj->setVar('description', $_POST['desc_' . $key]); |
|
| 75 | - $linkObj->setVar('target', $_POST['target_' . $key]); |
|
| 76 | - $linkObj->setVar('url', $_POST['url_' . $key]); |
|
| 73 | + $linkObj->setVar('caption', $_POST['caption_'.$key]); |
|
| 74 | + $linkObj->setVar('description', $_POST['desc_'.$key]); |
|
| 75 | + $linkObj->setVar('target', $_POST['target_'.$key]); |
|
| 76 | + $linkObj->setVar('url', $_POST['url_'.$key]); |
|
| 77 | 77 | if ('' !== $linkObj->getVar('url')) { |
| 78 | 78 | $smartObj->storeUrlLinkObj($linkObj); |
| 79 | 79 | } |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | break; |
| 83 | 83 | |
| 84 | 84 | case XOBJ_DTYPE_FILE: |
| 85 | - if (!isset($_FILES['upload_' . $key]['name']) || '' === $_FILES['upload_' . $key]['name']) { |
|
| 85 | + if (!isset($_FILES['upload_'.$key]['name']) || '' === $_FILES['upload_'.$key]['name']) { |
|
| 86 | 86 | $fileObj = $smartObj->getFileObj($key); |
| 87 | - $fileObj->setVar('caption', $_POST['caption_' . $key]); |
|
| 88 | - $fileObj->setVar('description', $_POST['desc_' . $key]); |
|
| 89 | - $fileObj->setVar('url', $_POST['url_' . $key]); |
|
| 87 | + $fileObj->setVar('caption', $_POST['caption_'.$key]); |
|
| 88 | + $fileObj->setVar('description', $_POST['desc_'.$key]); |
|
| 89 | + $fileObj->setVar('url', $_POST['url_'.$key]); |
|
| 90 | 90 | if (!('' === $fileObj->getVar('url') && '' === $fileObj->getVar('url') |
| 91 | 91 | && '' === $fileObj->getVar('url'))) { |
| 92 | 92 | $res = $smartObj->storeFileObj($fileObj); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $value = strtotime($_POST[$key]); |
| 111 | 111 | //if strtotime returns false, the value is already a time stamp |
| 112 | 112 | if (!$value) { |
| 113 | - $value = (int)$_POST[$key]; |
|
| 113 | + $value = (int) $_POST[$key]; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | $smartObj->setVar($key, $value); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | if (isset($file_array['name']) && '' !== $file_array['name'] |
| 160 | 160 | && in_array(str_replace('upload_', '', $name), array_keys($smartObj->vars))) { |
| 161 | 161 | if ($uploaderObj->fetchMedia($name)) { |
| 162 | - $uploaderObj->setTargetFileName(time() . '_' . $uploaderObj->getMediaName()); |
|
| 162 | + $uploaderObj->setTargetFileName(time().'_'.$uploaderObj->getMediaName()); |
|
| 163 | 163 | if ($uploaderObj->upload()) { |
| 164 | 164 | // Find the related field in the SmartObject |
| 165 | 165 | $related_field = str_replace('upload_', '', $name); |
@@ -168,14 +168,14 @@ discard block |
||
| 168 | 168 | if (XOBJ_DTYPE_FILE === $smartObj->vars[$related_field]['data_type']) { |
| 169 | 169 | $object_fileurl = $smartObj->getUploadDir(); |
| 170 | 170 | $fileObj = $smartObj->getFileObj($related_field); |
| 171 | - $fileObj->setVar('url', $object_fileurl . $uploaderObj->getSavedFileName()); |
|
| 172 | - $fileObj->setVar('caption', $_POST['caption_' . $related_field]); |
|
| 173 | - $fileObj->setVar('description', $_POST['desc_' . $related_field]); |
|
| 171 | + $fileObj->setVar('url', $object_fileurl.$uploaderObj->getSavedFileName()); |
|
| 172 | + $fileObj->setVar('caption', $_POST['caption_'.$related_field]); |
|
| 173 | + $fileObj->setVar('description', $_POST['desc_'.$related_field]); |
|
| 174 | 174 | $smartObj->storeFileObj($fileObj); |
| 175 | 175 | //todo: catch errors |
| 176 | 176 | $smartObj->setVar($related_field, $fileObj->getVar('fileid')); |
| 177 | 177 | } else { |
| 178 | - $old_file = $smartObj->getUploadDir(true) . $smartObj->getVar($related_field); |
|
| 178 | + $old_file = $smartObj->getUploadDir(true).$smartObj->getVar($related_field); |
|
| 179 | 179 | unlink($old_file); |
| 180 | 180 | $smartObj->setVar($related_field, $uploaderObj->getSavedFileName()); |
| 181 | 181 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | return $smartObj; |
| 207 | 207 | } else { |
| 208 | 208 | if (!$storeResult) { |
| 209 | - redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $smartObj->getHtmlErrors()); |
|
| 209 | + redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR.$smartObj->getHtmlErrors()); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | $redirect_page = $redirect_page ?: smart_get_page_before_form(); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $debug = false, |
| 236 | 236 | $x_param = false |
| 237 | 237 | ) { |
| 238 | - $objectid = isset($_POST[$this->handler->keyName]) ? (int)$_POST[$this->handler->keyName] : 0; |
|
| 238 | + $objectid = isset($_POST[$this->handler->keyName]) ? (int) $_POST[$this->handler->keyName] : 0; |
|
| 239 | 239 | if ($debug) { |
| 240 | 240 | if ($x_param) { |
| 241 | 241 | $smartObj = $this->handler->getD($objectid, true, $x_param); |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | { |
| 312 | 312 | global $smart_previous_page; |
| 313 | 313 | |
| 314 | - $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0; |
|
| 314 | + $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int) $_REQUEST[$this->handler->keyName] : 0; |
|
| 315 | 315 | $smartObj = $this->handler->get($objectid); |
| 316 | 316 | |
| 317 | 317 | if ($smartObj->isNew()) { |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
| 322 | 322 | if ($confirm) { |
| 323 | 323 | if (!$this->handler->delete($smartObj)) { |
| 324 | - redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors()); |
|
| 324 | + redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR.$smartObj->getHtmlErrors()); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | { |
| 355 | 355 | global $smart_previous_page, $xoopsTpl; |
| 356 | 356 | |
| 357 | - $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0; |
|
| 357 | + $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int) $_REQUEST[$this->handler->keyName] : 0; |
|
| 358 | 358 | $smartObj = $this->handler->get($objectid); |
| 359 | 359 | |
| 360 | 360 | if ($smartObj->isNew()) { |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
| 365 | 365 | if ($confirm) { |
| 366 | 366 | if (!$this->handler->delete($smartObj)) { |
| 367 | - redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors()); |
|
| 367 | + redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR.$smartObj->getHtmlErrors()); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_SUCCESS); |
@@ -396,14 +396,14 @@ discard block |
||
| 396 | 396 | */ |
| 397 | 397 | public function getAdminViewItemLink(SmartObject $smartObj, $onlyUrl = false, $withimage = false) |
| 398 | 398 | { |
| 399 | - $ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=view&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
| 399 | + $ret = $this->handler->_moduleUrl.'admin/'.$this->handler->_page.'?op=view&'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName); |
|
| 400 | 400 | if ($onlyUrl) { |
| 401 | 401 | return $ret; |
| 402 | 402 | } elseif ($withimage) { |
| 403 | - return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "viewmag.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_ADMIN_VIEW . "' title='" . _CO_SOBJECT_ADMIN_VIEW . "'></a>"; |
|
| 403 | + return "<a href='".$ret."'><img src='".SMARTOBJECT_IMAGES_ACTIONS_URL."viewmag.png' style='vertical-align: middle;' alt='"._CO_SOBJECT_ADMIN_VIEW."' title='"._CO_SOBJECT_ADMIN_VIEW."'></a>"; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
| 406 | + return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>'; |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
@@ -425,15 +425,15 @@ discard block |
||
| 425 | 425 | $seoIncludeId = true; |
| 426 | 426 | |
| 427 | 427 | if ('rewrite' === $seoMode) { |
| 428 | - $ret = XOOPS_URL . '/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html'; |
|
| 428 | + $ret = XOOPS_URL.'/'.$seoModuleName.'.'.$this->handler->_itemname.($seoIncludeId ? '.'.$smartObj->getVar($this->handler->keyName) : '').'/'.$smartObj->getVar('short_url').'.html'; |
|
| 429 | 429 | } elseif ('pathinfo' === $seoMode) { |
| 430 | - $ret = SMARTOBJECT_URL . 'seo.php/' . $seoModuleName . '.' . $this->handler->_itemname . ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . '/' . $smartObj->getVar('short_url') . '.html'; |
|
| 430 | + $ret = SMARTOBJECT_URL.'seo.php/'.$seoModuleName.'.'.$this->handler->_itemname.($seoIncludeId ? '.'.$smartObj->getVar($this->handler->keyName) : '').'/'.$smartObj->getVar('short_url').'.html'; |
|
| 431 | 431 | } else { |
| 432 | - $ret = $this->handler->_moduleUrl . $this->handler->_page . '?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
| 432 | + $ret = $this->handler->_moduleUrl.$this->handler->_page.'?'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | if (!$onlyUrl) { |
| 436 | - $ret = "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
| 436 | + $ret = "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>'; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | return $ret; |
@@ -447,14 +447,14 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | public function getEditLanguageLink($smartObj, $onlyUrl = false, $withimage = true) |
| 449 | 449 | { |
| 450 | - $ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName) . '&language=' . $smartObj->getVar('language'); |
|
| 450 | + $ret = $this->handler->_moduleUrl.'admin/'.$this->handler->_page.'?op=mod&'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName).'&language='.$smartObj->getVar('language'); |
|
| 451 | 451 | if ($onlyUrl) { |
| 452 | 452 | return $ret; |
| 453 | 453 | } elseif ($withimage) { |
| 454 | - return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "wizard.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_LANGUAGE_MODIFY . "' title='" . _CO_SOBJECT_LANGUAGE_MODIFY . "'></a>"; |
|
| 454 | + return "<a href='".$ret."'><img src='".SMARTOBJECT_IMAGES_ACTIONS_URL."wizard.png' style='vertical-align: middle;' alt='"._CO_SOBJECT_LANGUAGE_MODIFY."' title='"._CO_SOBJECT_LANGUAGE_MODIFY."'></a>"; |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
| 457 | + return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>'; |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | /** |
@@ -467,14 +467,14 @@ discard block |
||
| 467 | 467 | public function getEditItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false) |
| 468 | 468 | { |
| 469 | 469 | $admin_side = $userSide ? '' : 'admin/'; |
| 470 | - $ret = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
| 470 | + $ret = $this->handler->_moduleUrl.$admin_side.$this->handler->_page.'?op=mod&'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName); |
|
| 471 | 471 | if ($onlyUrl) { |
| 472 | 472 | return $ret; |
| 473 | 473 | } elseif ($withimage) { |
| 474 | - return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "edit.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_MODIFY . "' title='" . _CO_SOBJECT_MODIFY . "'></a>"; |
|
| 474 | + return "<a href='".$ret."'><img src='".SMARTOBJECT_IMAGES_ACTIONS_URL."edit.png' style='vertical-align: middle;' alt='"._CO_SOBJECT_MODIFY."' title='"._CO_SOBJECT_MODIFY."'></a>"; |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
| 477 | + return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>'; |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | /** |
@@ -487,14 +487,14 @@ discard block |
||
| 487 | 487 | public function getDeleteItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false) |
| 488 | 488 | { |
| 489 | 489 | $admin_side = $userSide ? '' : 'admin/'; |
| 490 | - $ret = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=del&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
| 490 | + $ret = $this->handler->_moduleUrl.$admin_side.$this->handler->_page.'?op=del&'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName); |
|
| 491 | 491 | if ($onlyUrl) { |
| 492 | 492 | return $ret; |
| 493 | 493 | } elseif ($withimage) { |
| 494 | - return "<a href='" . $ret . "'><img src='" . SMARTOBJECT_IMAGES_ACTIONS_URL . "editdelete.png' style='vertical-align: middle;' alt='" . _CO_SOBJECT_DELETE . "' title='" . _CO_SOBJECT_DELETE . "'></a>"; |
|
| 494 | + return "<a href='".$ret."'><img src='".SMARTOBJECT_IMAGES_ACTIONS_URL."editdelete.png' style='vertical-align: middle;' alt='"._CO_SOBJECT_DELETE."' title='"._CO_SOBJECT_DELETE."'></a>"; |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
| 497 | + return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>'; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | /** |
@@ -505,9 +505,9 @@ discard block |
||
| 505 | 505 | { |
| 506 | 506 | global $xoopsConfig; |
| 507 | 507 | |
| 508 | - $printlink = $this->handler->_moduleUrl . 'print.php?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
| 509 | - $js = "javascript:openWithSelfMain('" . $printlink . "', 'smartpopup', 700, 519);"; |
|
| 510 | - $printlink = '<a href="' . $js . '"><img src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . 'fileprint.png" alt="" style="vertical-align: middle;"></a>'; |
|
| 508 | + $printlink = $this->handler->_moduleUrl.'print.php?'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName); |
|
| 509 | + $js = "javascript:openWithSelfMain('".$printlink."', 'smartpopup', 700, 519);"; |
|
| 510 | + $printlink = '<a href="'.$js.'"><img src="'.SMARTOBJECT_IMAGES_ACTIONS_URL.'fileprint.png" alt="" style="vertical-align: middle;"></a>'; |
|
| 511 | 511 | |
| 512 | 512 | $smartModule = smart_getModuleInfo($smartObj->handler->_moduleName); |
| 513 | 513 | $link = smart_getCurrentPage(); |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | . _CO_SOBJECT_EMAIL |
| 527 | 527 | . '" style="vertical-align: middle;"></a>'; |
| 528 | 528 | |
| 529 | - $ret = '<span id="smartobject_print_button">' . $printlink . ' </span>' . '<span id="smartobject_mail_button">' . $friendlink . '</span>'; |
|
| 529 | + $ret = '<span id="smartobject_print_button">'.$printlink.' </span>'.'<span id="smartobject_mail_button">'.$friendlink.'</span>'; |
|
| 530 | 530 | |
| 531 | 531 | return $ret; |
| 532 | 532 | } |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | */ |
| 537 | 537 | public function getModuleItemString() |
| 538 | 538 | { |
| 539 | - $ret = $this->handler->_moduleName . '_' . $this->handler->_itemname; |
|
| 539 | + $ret = $this->handler->_moduleName.'_'.$this->handler->_itemname; |
|
| 540 | 540 | |
| 541 | 541 | return $ret; |
| 542 | 542 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | /** |
| 144 | 144 | * Use to update a table |
| 145 | 145 | * |
| 146 | - * @param object $table {@link SmartDbTable} that will be updated |
|
| 146 | + * @param SmartDbTable $table {@link SmartDbTable} that will be updated |
|
| 147 | 147 | * |
| 148 | 148 | * @see SmartDbTable |
| 149 | 149 | * |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | /** |
| 246 | 246 | * @param $module |
| 247 | 247 | * @param $item |
| 248 | - * @return bool |
|
| 248 | + * @return false|null |
|
| 249 | 249 | */ |
| 250 | 250 | public function upgradeObjectItem($module, $item) |
| 251 | 251 | { |
@@ -38,15 +38,15 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
| 40 | 40 | if (!defined('SMARTOBJECT_ROOT_PATH')) { |
| 41 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
| 41 | + require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
| 42 | 42 | } |
| 43 | 43 | /** |
| 44 | 44 | * Include the language constants for the SmartObjectDBUpdater |
| 45 | 45 | */ |
| 46 | 46 | global $xoopsConfig; |
| 47 | -$common_file = SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/smartdbupdater.php'; |
|
| 47 | +$common_file = SMARTOBJECT_ROOT_PATH.'language/'.$xoopsConfig['language'].'/smartdbupdater.php'; |
|
| 48 | 48 | if (!file_exists($common_file)) { |
| 49 | - $common_file = SMARTOBJECT_ROOT_PATH . 'language/english/smartdbupdater.php'; |
|
| 49 | + $common_file = SMARTOBJECT_ROOT_PATH.'language/english/smartdbupdater.php'; |
|
| 50 | 50 | } |
| 51 | 51 | include $common_file; |
| 52 | 52 | |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | $query = sprintf('ALTER TABLE %s RENAME %s', $from, $to); |
| 131 | 131 | $ret = $xoopsDB->query($query); |
| 132 | 132 | if (!$ret) { |
| 133 | - echo ' ' . sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from) . '<br>'; |
|
| 133 | + echo ' '.sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from).'<br>'; |
|
| 134 | 134 | |
| 135 | 135 | return false; |
| 136 | 136 | } else { |
| 137 | - echo ' ' . sprintf(_SDU_MSG_RENAME_TABLE, $from, $to) . '<br>'; |
|
| 137 | + echo ' '.sprintf(_SDU_MSG_RENAME_TABLE, $from, $to).'<br>'; |
|
| 138 | 138 | |
| 139 | 139 | return true; |
| 140 | 140 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | return false; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - $table = new SmartDbTable($module . '_' . $item); |
|
| 257 | + $table = new SmartDbTable($module.'_'.$item); |
|
| 258 | 258 | $object = $moduleHandler->create(); |
| 259 | 259 | $objectVars = $object->getVars(); |
| 260 | 260 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | "; |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | - $structure .= 'PRIMARY KEY (`' . $moduleHandler->keyName . '`) |
|
| 278 | + $structure .= 'PRIMARY KEY (`'.$moduleHandler->keyName.'`) |
|
| 279 | 279 | '; |
| 280 | 280 | $table->setStructure($structure); |
| 281 | 281 | if (!$this->updateTable($table)) { |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | ob_start(); |
| 337 | 337 | |
| 338 | - $table = new SmartDbTable($dirname . '_meta'); |
|
| 338 | + $table = new SmartDbTable($dirname.'_meta'); |
|
| 339 | 339 | if (!$table->exists()) { |
| 340 | 340 | $table->setStructure(" |
| 341 | 341 | `metakey` varchar(50) NOT NULL default '', |
@@ -353,20 +353,20 @@ discard block |
||
| 353 | 353 | if (!$dbVersion) { |
| 354 | 354 | $dbVersion = 0; |
| 355 | 355 | } |
| 356 | - $newDbVersion = constant(strtoupper($dirname . '_db_version')) ?: 0; |
|
| 357 | - echo 'Database version: ' . $dbVersion . '<br>'; |
|
| 358 | - echo 'New database version: ' . $newDbVersion . '<br>'; |
|
| 356 | + $newDbVersion = constant(strtoupper($dirname.'_db_version')) ?: 0; |
|
| 357 | + echo 'Database version: '.$dbVersion.'<br>'; |
|
| 358 | + echo 'New database version: '.$newDbVersion.'<br>'; |
|
| 359 | 359 | |
| 360 | 360 | if ($newDbVersion > $dbVersion) { |
| 361 | 361 | for ($i = $dbVersion + 1; $i <= $newDbVersion; ++$i) { |
| 362 | - $upgrade_function = $dirname . '_db_upgrade_' . $i; |
|
| 362 | + $upgrade_function = $dirname.'_db_upgrade_'.$i; |
|
| 363 | 363 | if (function_exists($upgrade_function)) { |
| 364 | 364 | $upgrade_function(); |
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - echo '<code>' . _SDU_UPDATE_UPDATING_DATABASE . '<br>'; |
|
| 369 | + echo '<code>'._SDU_UPDATE_UPDATING_DATABASE.'<br>'; |
|
| 370 | 370 | |
| 371 | 371 | // if there is a function to execute for this DB version, let's do it |
| 372 | 372 | //$function_ |
@@ -228,7 +228,7 @@ |
||
| 228 | 228 | * Creates a random number with a specified number of $digits |
| 229 | 229 | * |
| 230 | 230 | * @param int $digits number of digits |
| 231 | - * @return int random number |
|
| 231 | + * @return string random number |
|
| 232 | 232 | * @author xHelp Team |
| 233 | 233 | * |
| 234 | 234 | * @access public |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | use XoopsModules\Smartobject; |
| 22 | 22 | |
| 23 | 23 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
| 24 | -require_once XOOPS_ROOT_PATH . '/kernel/user.php'; |
|
| 25 | -require_once XOOPS_ROOT_PATH . '/kernel/group.php'; |
|
| 26 | -require_once XOOPS_ROOT_PATH . '/kernel/member.php'; |
|
| 24 | +require_once XOOPS_ROOT_PATH.'/kernel/user.php'; |
|
| 25 | +require_once XOOPS_ROOT_PATH.'/kernel/group.php'; |
|
| 26 | +require_once XOOPS_ROOT_PATH.'/kernel/member.php'; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * XOOPS member handler class. |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | // send some notifications |
| 145 | 145 | $xoopsMailer = xoops_getMailer(); |
| 146 | 146 | $xoopsMailer->useMail(); |
| 147 | - $xoopsMailer->setTemplateDir(SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/mail_template'); |
|
| 147 | + $xoopsMailer->setTemplateDir(SMARTOBJECT_ROOT_PATH.'language/'.$xoopsConfig['language'].'/mail_template'); |
|
| 148 | 148 | $xoopsMailer->setTemplate('smartobject_notify_user_added_by_admin.tpl'); |
| 149 | 149 | $xoopsMailer->assign('XOOPS_USER_PASSWORD', $password); |
| 150 | 150 | $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']); |
| 151 | 151 | $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']); |
| 152 | - $xoopsMailer->assign('SITEURL', XOOPS_URL . '/'); |
|
| 152 | + $xoopsMailer->assign('SITEURL', XOOPS_URL.'/'); |
|
| 153 | 153 | $xoopsMailer->assign('NAME', $userObj->getVar('name')); |
| 154 | 154 | $xoopsMailer->assign('UNAME', $userObj->getVar('uname')); |
| 155 | 155 | $xoopsMailer->setToUsers($userObj); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | if (strlen($name) > 0) { |
| 196 | 196 | $name = explode(' ', trim($name)); |
| 197 | 197 | if (count($name) > 1) { |
| 198 | - $basename = strtolower(substr($name[0], 0, 1) . $name[count($name) - 1]); |
|
| 198 | + $basename = strtolower(substr($name[0], 0, 1).$name[count($name) - 1]); |
|
| 199 | 199 | } else { |
| 200 | 200 | $basename = strtolower($name[0]); |
| 201 | 201 | } |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | while ($i < $count) { |
| 213 | 213 | $num = $this->genRandNumber(); |
| 214 | 214 | if ($onbasename < 0 && $hasbasename) { |
| 215 | - $names[] = xoops_substr($basename, 0, 58, '') . $num; |
|
| 215 | + $names[] = xoops_substr($basename, 0, 58, '').$num; |
|
| 216 | 216 | } else { |
| 217 | - $names[] = xoops_substr($emailname, 0, 58, '') . $num; |
|
| 217 | + $names[] = xoops_substr($emailname, 0, 58, '').$num; |
|
| 218 | 218 | } |
| 219 | 219 | $i = count($names); |
| 220 | 220 | $onbasename = ~$onbasename; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | { |
| 257 | 257 | static $randCalled = false; |
| 258 | 258 | if (!$randCalled) { |
| 259 | - mt_srand((double)microtime() * 1000000); |
|
| 259 | + mt_srand((double) microtime() * 1000000); |
|
| 260 | 260 | $randCalled = true; |
| 261 | 261 | } |
| 262 | 262 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Constructor |
| 35 | - * @param $object |
|
| 35 | + * @param BaseSmartObject $object |
|
| 36 | 36 | * @param bool $userSide |
| 37 | 37 | * @param array $actions |
| 38 | 38 | * @param bool $headerAsRow |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * @param $rowObj |
|
| 49 | + * @param SmartObjectRow $rowObj |
|
| 50 | 50 | */ |
| 51 | 51 | public function addRow($rowObj) |
| 52 | 52 | { |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | */ |
| 61 | 61 | public function render($fetchOnly = false, $debug = false) |
| 62 | 62 | { |
| 63 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 63 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
| 64 | 64 | |
| 65 | 65 | $this->_tpl = new \XoopsTpl(); |
| 66 | 66 | $vars = $this->_object->vars; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | - * @param $columnObj |
|
| 109 | + * @param SmartObjectColumn $columnObj |
|
| 110 | 110 | */ |
| 111 | 111 | public function addColumn($columnObj) |
| 112 | 112 | { |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | - * @param $name |
|
| 118 | - * @param $location |
|
| 117 | + * @param string $name |
|
| 118 | + * @param string $location |
|
| 119 | 119 | * @param $value |
| 120 | 120 | */ |
| 121 | 121 | public function addIntroButton($name, $location, $value) |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function addActionButton($op, $caption = false, $text = false) |
| 99 | 99 | { |
| 100 | - $action = [ |
|
| 100 | + $action = [ |
|
| 101 | 101 | 'op' => $op, |
| 102 | 102 | 'caption' => $caption, |
| 103 | 103 | 'text' => $text |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $current_urls = smart_getCurrentUrls(); |
| 134 | 134 | $current_url = $current_urls['full']; |
| 135 | - $this->_printerFriendlyPage = $current_url . '&print'; |
|
| 135 | + $this->_printerFriendlyPage = $current_url.'&print'; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function addDefaultIntroButton($caption) |
| 167 | 167 | { |
| 168 | - $this->addIntroButton($this->_objectHandler->_itemname, $this->_objectHandler->_page . '?op=mod', $caption); |
|
| 168 | + $this->addIntroButton($this->_objectHandler->_itemname, $this->_objectHandler->_page.'?op=mod', $caption); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | public function getDefaultSort() |
| 191 | 191 | { |
| 192 | 192 | if ($this->_sortsel) { |
| 193 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_sortsel', $this->_sortsel); |
|
| 193 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_sortsel', $this->_sortsel); |
|
| 194 | 194 | } else { |
| 195 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_sortsel', $this->_objectHandler->identifierName); |
|
| 195 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_sortsel', $this->_objectHandler->identifierName); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
@@ -210,9 +210,9 @@ discard block |
||
| 210 | 210 | public function getDefaultOrder() |
| 211 | 211 | { |
| 212 | 212 | if ($this->_ordersel) { |
| 213 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_ordersel', $this->_ordersel); |
|
| 213 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_ordersel', $this->_ordersel); |
|
| 214 | 214 | } else { |
| 215 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_ordersel', 'ASC'); |
|
| 215 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_ordersel', 'ASC'); |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
@@ -261,21 +261,21 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | public function setSortOrder() |
| 263 | 263 | { |
| 264 | - $this->_sortsel = isset($_GET[$this->_objectHandler->_itemname . '_' . 'sortsel']) ? $_GET[$this->_objectHandler->_itemname . '_' . 'sortsel'] : $this->getDefaultSort(); |
|
| 264 | + $this->_sortsel = isset($_GET[$this->_objectHandler->_itemname.'_'.'sortsel']) ? $_GET[$this->_objectHandler->_itemname.'_'.'sortsel'] : $this->getDefaultSort(); |
|
| 265 | 265 | //$this->_sortsel = isset($_POST['sortsel']) ? $_POST['sortsel']: $this->_sortsel; |
| 266 | - smart_setCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_sortsel', $this->_sortsel); |
|
| 266 | + smart_setCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_sortsel', $this->_sortsel); |
|
| 267 | 267 | $fieldsForSorting = $this->_tempObject->getFieldsForSorting($this->_sortsel); |
| 268 | 268 | |
| 269 | 269 | if (isset($this->_tempObject->vars[$this->_sortsel]['itemName']) |
| 270 | 270 | && $this->_tempObject->vars[$this->_sortsel]['itemName']) { |
| 271 | - $this->_criteria->setSort($this->_tempObject->vars[$this->_sortsel]['itemName'] . '.' . $this->_sortsel); |
|
| 271 | + $this->_criteria->setSort($this->_tempObject->vars[$this->_sortsel]['itemName'].'.'.$this->_sortsel); |
|
| 272 | 272 | } else { |
| 273 | - $this->_criteria->setSort($this->_objectHandler->_itemname . '.' . $this->_sortsel); |
|
| 273 | + $this->_criteria->setSort($this->_objectHandler->_itemname.'.'.$this->_sortsel); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - $this->_ordersel = isset($_GET[$this->_objectHandler->_itemname . '_' . 'ordersel']) ? $_GET[$this->_objectHandler->_itemname . '_' . 'ordersel'] : $this->getDefaultOrder(); |
|
| 276 | + $this->_ordersel = isset($_GET[$this->_objectHandler->_itemname.'_'.'ordersel']) ? $_GET[$this->_objectHandler->_itemname.'_'.'ordersel'] : $this->getDefaultOrder(); |
|
| 277 | 277 | //$this->_ordersel = isset($_POST['ordersel']) ? $_POST['ordersel']:$this->_ordersel; |
| 278 | - smart_setCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_ordersel', $this->_ordersel); |
|
| 278 | + smart_setCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_ordersel', $this->_ordersel); |
|
| 279 | 279 | $ordersArray = $this->getOrdersArray(); |
| 280 | 280 | $this->_criteria->setOrder($this->_ordersel); |
| 281 | 281 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | //$object->initiateCustomFields(); |
| 326 | 326 | } |
| 327 | 327 | if ('checked' === $column->_keyname) { |
| 328 | - $value = '<input type ="checkbox" name="selected_smartobjects[]" value="' . $object->id() . '">'; |
|
| 328 | + $value = '<input type ="checkbox" name="selected_smartobjects[]" value="'.$object->id().'">'; |
|
| 329 | 329 | } elseif ($column->_customMethodForValue |
| 330 | 330 | && method_exists($object, $column->_customMethodForValue)) { |
| 331 | 331 | $method = $column->_customMethodForValue; |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
| 373 | + require_once SMARTOBJECT_ROOT_PATH.'class/smartobjectcontroller.php'; |
|
| 374 | 374 | $controller = new SmartObjectController($this->_objectHandler); |
| 375 | 375 | |
| 376 | 376 | if ((!is_array($this->_actions)) || in_array('edit', $this->_actions)) { |
@@ -410,9 +410,9 @@ discard block |
||
| 410 | 410 | public function getDefaultFilter() |
| 411 | 411 | { |
| 412 | 412 | if ($this->_filtersel) { |
| 413 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_filtersel', $this->_filtersel); |
|
| 413 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_filtersel', $this->_filtersel); |
|
| 414 | 414 | } else { |
| 415 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_filtersel', 'default'); |
|
| 415 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_filtersel', 'default'); |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |
@@ -462,9 +462,9 @@ discard block |
||
| 462 | 462 | public function getDefaultFilter2() |
| 463 | 463 | { |
| 464 | 464 | if ($this->_filtersel2) { |
| 465 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_filtersel2', $this->_filtersel2); |
|
| 465 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_filtersel2', $this->_filtersel2); |
|
| 466 | 466 | } else { |
| 467 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_filtersel2', 'default'); |
|
| 467 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_filtersel2', 'default'); |
|
| 468 | 468 | } |
| 469 | 469 | } |
| 470 | 470 | |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | */ |
| 593 | 593 | public function render($fetchOnly = false, $debug = false) |
| 594 | 594 | { |
| 595 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 595 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
| 596 | 596 | |
| 597 | 597 | $this->_tpl = new \XoopsTpl(); |
| 598 | 598 | |
@@ -603,24 +603,24 @@ discard block |
||
| 603 | 603 | */ |
| 604 | 604 | $this->_tempObject = $this->_objectHandler->create(); |
| 605 | 605 | |
| 606 | - $this->_criteria->setStart(isset($_GET['start' . $this->_objectHandler->keyName]) ? (int)$_GET['start' . $this->_objectHandler->keyName] : 0); |
|
| 606 | + $this->_criteria->setStart(isset($_GET['start'.$this->_objectHandler->keyName]) ? (int) $_GET['start'.$this->_objectHandler->keyName] : 0); |
|
| 607 | 607 | |
| 608 | 608 | $this->setSortOrder(); |
| 609 | 609 | |
| 610 | 610 | if (!$this->_isTree) { |
| 611 | - $this->_limitsel = isset($_GET['limitsel']) ? $_GET['limitsel'] : smart_getCookieVar($_SERVER['PHP_SELF'] . '_limitsel', '15'); |
|
| 611 | + $this->_limitsel = isset($_GET['limitsel']) ? $_GET['limitsel'] : smart_getCookieVar($_SERVER['PHP_SELF'].'_limitsel', '15'); |
|
| 612 | 612 | } else { |
| 613 | 613 | $this->_limitsel = 'all'; |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | $this->_limitsel = isset($_POST['limitsel']) ? $_POST['limitsel'] : $this->_limitsel; |
| 617 | - smart_setCookieVar($_SERVER['PHP_SELF'] . '_limitsel', $this->_limitsel); |
|
| 617 | + smart_setCookieVar($_SERVER['PHP_SELF'].'_limitsel', $this->_limitsel); |
|
| 618 | 618 | $limitsArray = $this->getLimitsArray(); |
| 619 | 619 | $this->_criteria->setLimit($this->_limitsel); |
| 620 | 620 | |
| 621 | 621 | $this->_filtersel = isset($_GET['filtersel']) ? $_GET['filtersel'] : $this->getDefaultFilter(); |
| 622 | 622 | $this->_filtersel = isset($_POST['filtersel']) ? $_POST['filtersel'] : $this->_filtersel; |
| 623 | - smart_setCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_filtersel', $this->_filtersel); |
|
| 623 | + smart_setCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_filtersel', $this->_filtersel); |
|
| 624 | 624 | $filtersArray = $this->getFiltersArray(); |
| 625 | 625 | |
| 626 | 626 | if ($filtersArray) { |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | $filters2Array = $this->getFilters2Array(); |
| 647 | 647 | $this->_tpl->assign('smartobject_optionssel_filters2Array', $filters2Array); |
| 648 | 648 | |
| 649 | - smart_setCookieVar($_SERVER['PHP_SELF'] . '_filtersel2', $this->_filtersel2); |
|
| 649 | + smart_setCookieVar($_SERVER['PHP_SELF'].'_filtersel2', $this->_filtersel2); |
|
| 650 | 650 | if ('default' !== $this->_filtersel2) { |
| 651 | 651 | $this->_criteria->add(new \Criteria($this->_filtersel, $this->_filtersel2)); |
| 652 | 652 | } |
@@ -655,21 +655,21 @@ discard block |
||
| 655 | 655 | } |
| 656 | 656 | // Check if we have a quicksearch |
| 657 | 657 | |
| 658 | - if (isset($_POST['quicksearch_' . $this->_id]) && '' != $_POST['quicksearch_' . $this->_id]) { |
|
| 658 | + if (isset($_POST['quicksearch_'.$this->_id]) && '' != $_POST['quicksearch_'.$this->_id]) { |
|
| 659 | 659 | $quicksearch_criteria = new \CriteriaCompo(); |
| 660 | 660 | if (is_array($this->_quickSearch['fields'])) { |
| 661 | 661 | foreach ($this->_quickSearch['fields'] as $v) { |
| 662 | - $quicksearch_criteria->add(new \Criteria($v, '%' . $_POST['quicksearch_' . $this->_id] . '%', 'LIKE'), 'OR'); |
|
| 662 | + $quicksearch_criteria->add(new \Criteria($v, '%'.$_POST['quicksearch_'.$this->_id].'%', 'LIKE'), 'OR'); |
|
| 663 | 663 | } |
| 664 | 664 | } else { |
| 665 | - $quicksearch_criteria->add(new \Criteria($this->_quickSearch['fields'], '%' . $_POST['quicksearch_' . $this->_id] . '%', 'LIKE')); |
|
| 665 | + $quicksearch_criteria->add(new \Criteria($this->_quickSearch['fields'], '%'.$_POST['quicksearch_'.$this->_id].'%', 'LIKE')); |
|
| 666 | 666 | } |
| 667 | 667 | $this->_criteria->add($quicksearch_criteria); |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | $this->_objects = $this->fetchObjects($debug); |
| 671 | 671 | |
| 672 | - require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 672 | + require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
| 673 | 673 | if ($this->_criteria->getLimit() > 0) { |
| 674 | 674 | |
| 675 | 675 | /** |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | */ |
| 686 | 686 | $params_of_the_options_sel = []; |
| 687 | 687 | |
| 688 | - $not_needed_params = ['sortsel', 'limitsel', 'ordersel', 'start' . $this->_objectHandler->keyName]; |
|
| 688 | + $not_needed_params = ['sortsel', 'limitsel', 'ordersel', 'start'.$this->_objectHandler->keyName]; |
|
| 689 | 689 | foreach ($_GET as $k => $v) { |
| 690 | 690 | if (!in_array($k, $not_needed_params)) { |
| 691 | 691 | $new_get_array[] = "$k=$v"; |
@@ -696,12 +696,12 @@ discard block |
||
| 696 | 696 | /** |
| 697 | 697 | * Adding the new params of the pagenav |
| 698 | 698 | */ |
| 699 | - $new_get_array[] = 'sortsel=' . $this->_sortsel; |
|
| 700 | - $new_get_array[] = 'ordersel=' . $this->_ordersel; |
|
| 701 | - $new_get_array[] = 'limitsel=' . $this->_limitsel; |
|
| 699 | + $new_get_array[] = 'sortsel='.$this->_sortsel; |
|
| 700 | + $new_get_array[] = 'ordersel='.$this->_ordersel; |
|
| 701 | + $new_get_array[] = 'limitsel='.$this->_limitsel; |
|
| 702 | 702 | $otherParams = implode('&', $new_get_array); |
| 703 | 703 | |
| 704 | - $pagenav = new \XoopsPageNav($this->_objectHandler->getCount($this->_criteria), $this->_criteria->getLimit(), $this->_criteria->getStart(), 'start' . $this->_objectHandler->keyName, $otherParams); |
|
| 704 | + $pagenav = new \XoopsPageNav($this->_objectHandler->getCount($this->_criteria), $this->_criteria->getLimit(), $this->_criteria->getStart(), 'start'.$this->_objectHandler->keyName, $otherParams); |
|
| 705 | 705 | $this->_tpl->assign('smartobject_pagenav', $pagenav->renderNav()); |
| 706 | 706 | } |
| 707 | 707 | $this->renderOptionSelection($limitsArray, $params_of_the_options_sel); |
@@ -737,20 +737,20 @@ discard block |
||
| 737 | 737 | $aColumn['align'] = $column->getAlign(); |
| 738 | 738 | $aColumn['key'] = $column->getKeyName(); |
| 739 | 739 | if ('checked' === $column->_keyname) { |
| 740 | - $aColumn['caption'] = '<input type ="checkbox" id="checkall_smartobjects" name="checkall_smartobjects"' . ' value="checkall_smartobjects" onclick="smartobject_checkall(window.document.form_' . $this->_id . ', \'selected_smartobjects\');">'; |
|
| 740 | + $aColumn['caption'] = '<input type ="checkbox" id="checkall_smartobjects" name="checkall_smartobjects"'.' value="checkall_smartobjects" onclick="smartobject_checkall(window.document.form_'.$this->_id.', \'selected_smartobjects\');">'; |
|
| 741 | 741 | } elseif ($column->getCustomCaption()) { |
| 742 | 742 | $aColumn['caption'] = $column->getCustomCaption(); |
| 743 | 743 | } else { |
| 744 | 744 | $aColumn['caption'] = isset($this->_tempObject->vars[$column->getKeyName()]['form_caption']) ? $this->_tempObject->vars[$column->getKeyName()]['form_caption'] : $column->getKeyName(); |
| 745 | 745 | } |
| 746 | 746 | // Are we doing a GET sort on this column ? |
| 747 | - $getSort = (isset($_GET[$this->_objectHandler->_itemname . '_' . 'sortsel']) |
|
| 748 | - && $_GET[$this->_objectHandler->_itemname . '_' . 'sortsel'] == $column->getKeyName()) |
|
| 747 | + $getSort = (isset($_GET[$this->_objectHandler->_itemname.'_'.'sortsel']) |
|
| 748 | + && $_GET[$this->_objectHandler->_itemname.'_'.'sortsel'] == $column->getKeyName()) |
|
| 749 | 749 | || ($this->_sortsel == $column->getKeyName()); |
| 750 | - $order = isset($_GET[$this->_objectHandler->_itemname . '_' . 'ordersel']) ? $_GET[$this->_objectHandler->_itemname . '_' . 'ordersel'] : 'DESC'; |
|
| 750 | + $order = isset($_GET[$this->_objectHandler->_itemname.'_'.'ordersel']) ? $_GET[$this->_objectHandler->_itemname.'_'.'ordersel'] : 'DESC'; |
|
| 751 | 751 | |
| 752 | - if (isset($_REQUEST['quicksearch_' . $this->_id]) && '' != $_REQUEST['quicksearch_' . $this->_id]) { |
|
| 753 | - $qs_param = '&quicksearch_' . $this->_id . '=' . $_REQUEST['quicksearch_' . $this->_id]; |
|
| 752 | + if (isset($_REQUEST['quicksearch_'.$this->_id]) && '' != $_REQUEST['quicksearch_'.$this->_id]) { |
|
| 753 | + $qs_param = '&quicksearch_'.$this->_id.'='.$_REQUEST['quicksearch_'.$this->_id]; |
|
| 754 | 754 | } |
| 755 | 755 | if (!$this->_enableColumnsSorting || 'checked' === $column->_keyname || !$column->isSortable()) { |
| 756 | 756 | $aColumn['caption'] = $aColumn['caption']; |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | . $orderArray[$order]['image'] |
| 778 | 778 | . '" alt="ASC"></a>'; |
| 779 | 779 | } else { |
| 780 | - $aColumn['caption'] = '<a href="' . $current_url . '?' . $this->_objectHandler->_itemname . '_' . 'sortsel=' . $column->getKeyName() . '&' . $this->_objectHandler->_itemname . '_' . 'ordersel=ASC' . $qs_param . '&' . $new_query_string . '">' . $aColumn['caption'] . '</a>'; |
|
| 780 | + $aColumn['caption'] = '<a href="'.$current_url.'?'.$this->_objectHandler->_itemname.'_'.'sortsel='.$column->getKeyName().'&'.$this->_objectHandler->_itemname.'_'.'ordersel=ASC'.$qs_param.'&'.$new_query_string.'">'.$aColumn['caption'].'</a>'; |
|
| 781 | 781 | } |
| 782 | 782 | $aColumns[] = $aColumn; |
| 783 | 783 | } |
@@ -807,9 +807,9 @@ discard block |
||
| 807 | 807 | |
| 808 | 808 | $smartobjectTable_template = $this->_customTemplate ?: 'smartobject_smarttable_display.tpl'; |
| 809 | 809 | if ($fetchOnly) { |
| 810 | - return $this->_tpl->fetch('db:' . $smartobjectTable_template); |
|
| 810 | + return $this->_tpl->fetch('db:'.$smartobjectTable_template); |
|
| 811 | 811 | } else { |
| 812 | - $this->_tpl->display('db:' . $smartobjectTable_template); |
|
| 812 | + $this->_tpl->display('db:'.$smartobjectTable_template); |
|
| 813 | 813 | } |
| 814 | 814 | } |
| 815 | 815 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | /** |
| 195 | 195 | * @param $criteria |
| 196 | - * @param $perm_name |
|
| 196 | + * @param boolean $perm_name |
|
| 197 | 197 | * @return bool |
| 198 | 198 | */ |
| 199 | 199 | public function setGrantedObjectsCriteria($criteria, $perm_name) |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | /** |
| 390 | - * @param $sql |
|
| 390 | + * @param string $sql |
|
| 391 | 391 | * @param $criteria |
| 392 | 392 | * @param bool $force |
| 393 | 393 | * @param bool $debug |
@@ -150,16 +150,16 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | $this->_itemname = $itemname; |
| 152 | 152 | $this->_moduleName = $modulename; |
| 153 | - $this->table = $db->prefix($modulename . '_' . $itemname); |
|
| 153 | + $this->table = $db->prefix($modulename.'_'.$itemname); |
|
| 154 | 154 | $this->keyName = $keyname; |
| 155 | - $this->className = ucfirst($modulename) . ucfirst($itemname); |
|
| 155 | + $this->className = ucfirst($modulename).ucfirst($itemname); |
|
| 156 | 156 | $this->identifierName = $idenfierName; |
| 157 | 157 | $this->summaryName = $summaryName; |
| 158 | - $this->_page = $itemname . '.php'; |
|
| 159 | - $this->_modulePath = XOOPS_ROOT_PATH . '/modules/' . $this->_moduleName . '/'; |
|
| 160 | - $this->_moduleUrl = XOOPS_URL . '/modules/' . $this->_moduleName . '/'; |
|
| 161 | - $this->_uploadPath = XOOPS_UPLOAD_PATH . '/' . $this->_moduleName . '/'; |
|
| 162 | - $this->_uploadUrl = XOOPS_UPLOAD_URL . '/' . $this->_moduleName . '/'; |
|
| 158 | + $this->_page = $itemname.'.php'; |
|
| 159 | + $this->_modulePath = XOOPS_ROOT_PATH.'/modules/'.$this->_moduleName.'/'; |
|
| 160 | + $this->_moduleUrl = XOOPS_URL.'/modules/'.$this->_moduleName.'/'; |
|
| 161 | + $this->_uploadPath = XOOPS_UPLOAD_PATH.'/'.$this->_moduleName.'/'; |
|
| 162 | + $this->_uploadUrl = XOOPS_UPLOAD_URL.'/'.$this->_moduleName.'/'; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function addPermission($perm_name, $caption, $description = false) |
| 184 | 184 | { |
| 185 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectpermission.php'; |
|
| 185 | + require_once SMARTOBJECT_ROOT_PATH.'class/smartobjectpermission.php'; |
|
| 186 | 186 | |
| 187 | 187 | $this->permissionsArray[] = [ |
| 188 | 188 | 'perm_name' => $perm_name, |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $smartPermissionsHandler = new SmartobjectPermissionHandler($this); |
| 202 | 202 | $grantedItems = $smartPermissionsHandler->getGrantedItems($perm_name); |
| 203 | 203 | if (count($grantedItems) > 0) { |
| 204 | - $criteria->add(new \Criteria($this->keyName, '(' . implode(', ', $grantedItems) . ')', 'IN')); |
|
| 204 | + $criteria->add(new \Criteria($this->keyName, '('.implode(', ', $grantedItems).')', 'IN')); |
|
| 205 | 205 | |
| 206 | 206 | return true; |
| 207 | 207 | } else { |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function getImageUrl() |
| 259 | 259 | { |
| 260 | - return $this->_uploadUrl . $this->_itemname . '/'; |
|
| 260 | + return $this->_uploadUrl.$this->_itemname.'/'; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -265,12 +265,12 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function getImagePath() |
| 267 | 267 | { |
| 268 | - $dir = $this->_uploadPath . $this->_itemname; |
|
| 268 | + $dir = $this->_uploadPath.$this->_itemname; |
|
| 269 | 269 | if (!file_exists($dir)) { |
| 270 | 270 | smart_admin_mkdir($dir); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - return $dir . '/'; |
|
| 273 | + return $dir.'/'; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | if ($debug) { |
| 310 | 310 | $obj_array = $this->getObjectsD($criteria, false, $as_object); |
| 311 | 311 | } else { |
| 312 | - $obj_array =& $this->getObjects($criteria, false, $as_object); |
|
| 312 | + $obj_array = & $this->getObjects($criteria, false, $as_object); |
|
| 313 | 313 | //patch: weird bug of indexing by id even if id_as_key = false; |
| 314 | 314 | if (!isset($obj_array[0]) && is_object($obj_array[$id])) { |
| 315 | 315 | $obj_array[0] = $obj_array[$id]; |
@@ -363,13 +363,13 @@ discard block |
||
| 363 | 363 | if ($this->generalSQL) { |
| 364 | 364 | $sql = $this->generalSQL; |
| 365 | 365 | } elseif (!$sql) { |
| 366 | - $sql = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname; |
|
| 366 | + $sql = 'SELECT * FROM '.$this->table.' AS '.$this->_itemname; |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
| 370 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 370 | + $sql .= ' '.$criteria->renderWhere(); |
|
| 371 | 371 | if ('' !== $criteria->getSort()) { |
| 372 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 372 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
| 373 | 373 | } |
| 374 | 374 | $limit = $criteria->getLimit(); |
| 375 | 375 | $start = $criteria->getStart(); |
@@ -398,12 +398,12 @@ discard block |
||
| 398 | 398 | $ret = []; |
| 399 | 399 | |
| 400 | 400 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
| 401 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 401 | + $sql .= ' '.$criteria->renderWhere(); |
|
| 402 | 402 | if ($criteria->groupby) { |
| 403 | 403 | $sql .= $criteria->getGroupby(); |
| 404 | 404 | } |
| 405 | 405 | if ('' !== $criteria->getSort()) { |
| 406 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 406 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | if ($debug) { |
@@ -476,18 +476,18 @@ discard block |
||
| 476 | 476 | $obj->assignVars($myrow); |
| 477 | 477 | if (!$id_as_key) { |
| 478 | 478 | if ($as_object) { |
| 479 | - $ret[] =& $obj; |
|
| 479 | + $ret[] = & $obj; |
|
| 480 | 480 | } else { |
| 481 | 481 | $ret[] = $obj->toArray(); |
| 482 | 482 | } |
| 483 | 483 | } else { |
| 484 | 484 | if ($as_object) { |
| 485 | - $value =& $obj; |
|
| 485 | + $value = & $obj; |
|
| 486 | 486 | } else { |
| 487 | 487 | $value = $obj->toArray(); |
| 488 | 488 | } |
| 489 | 489 | if ('parentid' === $id_as_key) { |
| 490 | - $ret[$obj->getVar('parentid', 'e')][$obj->getVar($this->keyName)] =& $value; |
|
| 490 | + $ret[$obj->getVar('parentid', 'e')][$obj->getVar($this->keyName)] = & $value; |
|
| 491 | 491 | } else { |
| 492 | 492 | $ret[$obj->getVar($this->keyName)] = $value; |
| 493 | 493 | } |
@@ -530,15 +530,15 @@ discard block |
||
| 530 | 530 | $criteria->setSort($this->getIdentifierName()); |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | - $sql = 'SELECT ' . (is_array($this->keyName) ? implode(', ', $this->keyName) : $this->keyName); |
|
| 533 | + $sql = 'SELECT '.(is_array($this->keyName) ? implode(', ', $this->keyName) : $this->keyName); |
|
| 534 | 534 | if (!empty($this->identifierName)) { |
| 535 | - $sql .= ', ' . $this->getIdentifierName(); |
|
| 535 | + $sql .= ', '.$this->getIdentifierName(); |
|
| 536 | 536 | } |
| 537 | - $sql .= ' FROM ' . $this->table . ' AS ' . $this->_itemname; |
|
| 537 | + $sql .= ' FROM '.$this->table.' AS '.$this->_itemname; |
|
| 538 | 538 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
| 539 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 539 | + $sql .= ' '.$criteria->renderWhere(); |
|
| 540 | 540 | if ('' !== $criteria->getSort()) { |
| 541 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 541 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
| 542 | 542 | } |
| 543 | 543 | $limit = $criteria->getLimit(); |
| 544 | 544 | $start = $criteria->getStart(); |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
| 576 | 576 | if ('' !== $criteria->groupby) { |
| 577 | 577 | $groupby = true; |
| 578 | - $field = $criteria->groupby . ', '; //Not entirely secure unless you KNOW that no criteria's groupby clause is going to be mis-used |
|
| 578 | + $field = $criteria->groupby.', '; //Not entirely secure unless you KNOW that no criteria's groupby clause is going to be mis-used |
|
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | 581 | /** |
@@ -586,10 +586,10 @@ discard block |
||
| 586 | 586 | $sql = $this->generalSQL; |
| 587 | 587 | $sql = str_replace('SELECT *', 'SELECT COUNT(*)', $sql); |
| 588 | 588 | } else { |
| 589 | - $sql = 'SELECT ' . $field . 'COUNT(*) FROM ' . $this->table . ' AS ' . $this->_itemname; |
|
| 589 | + $sql = 'SELECT '.$field.'COUNT(*) FROM '.$this->table.' AS '.$this->_itemname; |
|
| 590 | 590 | } |
| 591 | 591 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
| 592 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 592 | + $sql .= ' '.$criteria->renderWhere(); |
|
| 593 | 593 | if ('' !== $criteria->groupby) { |
| 594 | 594 | $sql .= $criteria->getGroupby(); |
| 595 | 595 | } |
@@ -632,13 +632,13 @@ discard block |
||
| 632 | 632 | if (is_array($this->keyName)) { |
| 633 | 633 | $clause = []; |
| 634 | 634 | for ($i = 0, $iMax = count($this->keyName); $i < $iMax; ++$i) { |
| 635 | - $clause[] = $this->keyName[$i] . ' = ' . $obj->getVar($this->keyName[$i]); |
|
| 635 | + $clause[] = $this->keyName[$i].' = '.$obj->getVar($this->keyName[$i]); |
|
| 636 | 636 | } |
| 637 | 637 | $whereclause = implode(' AND ', $clause); |
| 638 | 638 | } else { |
| 639 | - $whereclause = $this->keyName . ' = ' . $obj->getVar($this->keyName); |
|
| 639 | + $whereclause = $this->keyName.' = '.$obj->getVar($this->keyName); |
|
| 640 | 640 | } |
| 641 | - $sql = 'DELETE FROM ' . $this->table . ' WHERE ' . $whereclause; |
|
| 641 | + $sql = 'DELETE FROM '.$this->table.' WHERE '.$whereclause; |
|
| 642 | 642 | if (false !== $force) { |
| 643 | 643 | $result = $this->db->queryF($sql); |
| 644 | 644 | } else { |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | * @TODO: Change to if (!(class_exists($this->className) && $obj instanceof $this->className)) when going fully PHP5 |
| 700 | 700 | */ |
| 701 | 701 | if (!is_a($obj, $this->className)) { |
| 702 | - $obj->setError(get_class($obj) . ' Differs from ' . $this->className); |
|
| 702 | + $obj->setError(get_class($obj).' Differs from '.$this->className); |
|
| 703 | 703 | |
| 704 | 704 | return false; |
| 705 | 705 | } |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | $fieldsToStoreInDB = []; |
| 761 | 761 | foreach ($obj->cleanVars as $k => $v) { |
| 762 | 762 | if (XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { |
| 763 | - $cleanvars[$k] = (int)$v; |
|
| 763 | + $cleanvars[$k] = (int) $v; |
|
| 764 | 764 | } elseif (is_array($v)) { |
| 765 | 765 | $cleanvars[$k] = $this->db->quoteString(implode(',', $v)); |
| 766 | 766 | } else { |
@@ -773,13 +773,13 @@ discard block |
||
| 773 | 773 | if ($obj->isNew()) { |
| 774 | 774 | if (!is_array($this->keyName)) { |
| 775 | 775 | if ($cleanvars[$this->keyName] < 1) { |
| 776 | - $cleanvars[$this->keyName] = $this->db->genId($this->table . '_' . $this->keyName . '_seq'); |
|
| 776 | + $cleanvars[$this->keyName] = $this->db->genId($this->table.'_'.$this->keyName.'_seq'); |
|
| 777 | 777 | } |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | - $sql = 'INSERT INTO ' . $this->table . ' (' . implode(',', array_keys($fieldsToStoreInDB)) . ') VALUES (' . implode(',', array_values($fieldsToStoreInDB)) . ')'; |
|
| 780 | + $sql = 'INSERT INTO '.$this->table.' ('.implode(',', array_keys($fieldsToStoreInDB)).') VALUES ('.implode(',', array_values($fieldsToStoreInDB)).')'; |
|
| 781 | 781 | } else { |
| 782 | - $sql = 'UPDATE ' . $this->table . ' SET'; |
|
| 782 | + $sql = 'UPDATE '.$this->table.' SET'; |
|
| 783 | 783 | foreach ($fieldsToStoreInDB as $key => $value) { |
| 784 | 784 | if ((!is_array($this->keyName) && $key == $this->keyName) |
| 785 | 785 | || (is_array($this->keyName) |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | if (isset($notfirst)) { |
| 790 | 790 | $sql .= ','; |
| 791 | 791 | } |
| 792 | - $sql .= ' ' . $key . ' = ' . $value; |
|
| 792 | + $sql .= ' '.$key.' = '.$value; |
|
| 793 | 793 | $notfirst = true; |
| 794 | 794 | } |
| 795 | 795 | if (is_array($this->keyName)) { |
@@ -798,12 +798,12 @@ discard block |
||
| 798 | 798 | if ($i > 0) { |
| 799 | 799 | $whereclause .= ' AND '; |
| 800 | 800 | } |
| 801 | - $whereclause .= $this->keyName[$i] . ' = ' . $obj->getVar($this->keyName[$i]); |
|
| 801 | + $whereclause .= $this->keyName[$i].' = '.$obj->getVar($this->keyName[$i]); |
|
| 802 | 802 | } |
| 803 | 803 | } else { |
| 804 | - $whereclause = $this->keyName . ' = ' . $obj->getVar($this->keyName); |
|
| 804 | + $whereclause = $this->keyName.' = '.$obj->getVar($this->keyName); |
|
| 805 | 805 | } |
| 806 | - $sql .= ' WHERE ' . $whereclause; |
|
| 806 | + $sql .= ' WHERE '.$whereclause; |
|
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | if ($debug) { |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | */ |
| 877 | 877 | public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = null, $force = false) |
| 878 | 878 | { |
| 879 | - $set_clause = $fieldname . ' = '; |
|
| 879 | + $set_clause = $fieldname.' = '; |
|
| 880 | 880 | if (is_numeric($fieldvalue)) { |
| 881 | 881 | $set_clause .= $fieldvalue; |
| 882 | 882 | } elseif (is_array($fieldvalue)) { |
@@ -884,9 +884,9 @@ discard block |
||
| 884 | 884 | } else { |
| 885 | 885 | $set_clause .= $this->db->quoteString($fieldvalue); |
| 886 | 886 | } |
| 887 | - $sql = 'UPDATE ' . $this->table . ' SET ' . $set_clause; |
|
| 887 | + $sql = 'UPDATE '.$this->table.' SET '.$set_clause; |
|
| 888 | 888 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
| 889 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 889 | + $sql .= ' '.$criteria->renderWhere(); |
|
| 890 | 890 | } |
| 891 | 891 | if (false != $force) { |
| 892 | 892 | $result = $this->db->queryF($sql); |
@@ -910,8 +910,8 @@ discard block |
||
| 910 | 910 | public function deleteAll(CriteriaElement $criteria = null) |
| 911 | 911 | { |
| 912 | 912 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
| 913 | - $sql = 'DELETE FROM ' . $this->table; |
|
| 914 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 913 | + $sql = 'DELETE FROM '.$this->table; |
|
| 914 | + $sql .= ' '.$criteria->renderWhere(); |
|
| 915 | 915 | if (!$this->db->query($sql)) { |
| 916 | 916 | return false; |
| 917 | 917 | } |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | */ |
| 945 | 945 | public function getModuleItemString() |
| 946 | 946 | { |
| 947 | - $ret = $this->_moduleName . '_' . $this->_itemname; |
|
| 947 | + $ret = $this->_moduleName.'_'.$this->_itemname; |
|
| 948 | 948 | |
| 949 | 949 | return $ret; |
| 950 | 950 | } |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | { |
| 957 | 957 | if (isset($object->vars['counter'])) { |
| 958 | 958 | $new_counter = $object->getVar('counter') + 1; |
| 959 | - $sql = 'UPDATE ' . $this->table . ' SET counter=' . $new_counter . ' WHERE ' . $this->keyName . '=' . $object->id(); |
|
| 959 | + $sql = 'UPDATE '.$this->table.' SET counter='.$new_counter.' WHERE '.$this->keyName.'='.$object->id(); |
|
| 960 | 960 | $this->query($sql, null, true); |
| 961 | 961 | } |
| 962 | 962 | } |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | public function getIdentifierName($withprefix = true) |
| 1001 | 1001 | { |
| 1002 | 1002 | if ($withprefix) { |
| 1003 | - return $this->_itemname . '.' . $this->identifierName; |
|
| 1003 | + return $this->_itemname.'.'.$this->identifierName; |
|
| 1004 | 1004 | } else { |
| 1005 | 1005 | return $this->identifierName; |
| 1006 | 1006 | } |